Thread: Novul
View Single Post
  #71  
Old 12-20-2015, 09:14 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 127,435
Kyttias is on a distinguished road
Default PM System

I've finally finished my updates to the PM System. Unfortunately, these were massively deep edits, so I cannot possibly remember all my little tweaks to assist people in overhauling their own.

Finished: PM System
  • Sending New PMs
  • Notifications
  • Inbox Preview
  • Delete Confirmation

You'll notice I did away with drafts as a feature, because, well... Why do we really need that? And I was SUPER tired of CKEditor, so I decided to switch over to WYSIHTML5 for Bootstrap 3. I can give you a hint for that change over, at least:

In view/messagesview.php, in the newpm() function, find:
PHP Code:
$pmForm->add(new Comment($editor->editor("mtext""Enter your message here."))); 
Replace and/or comment it out with this instead:
PHP Code:
$pmForm->add(new Comment("<textarea name='mtext' class='msgarea' placeholder='Enter your message here.'></textarea>")); 
But, uh, again... I'm not here to help with that. All the documentation for WYSIHTML5 for Bootstrap 3 can be found at the link provided. There are dependencies you need (jQuery, Bootstrap, Bootstrap's jQuery plugin, it, it's css file, and optionally Font Awesome). And then you just need too add a line of code to the end of your template and, bam, textareas with a particular class name are awesome-tastic (I used the class 'msgarea' above). Despite the effort of changing over I feel a lot better about how lightweight it is.

I've thoroughly checked it for security holes like script injection and it seems just as secure! *thumbs up*

There was only one issue I had, where whitespace was being deleted around formatted areas. I fixed the problem inside classes/class_privatemessage.php, by modifying the format() function:

PHP Code:
public function format($text){
        
$text html_entity_decode($text);
        
$text stripslashes($text);
        
$text str_replace("&nbsp;"," ",$text);
        
$text str_replace("'","'",$text); // added this so some forms wouldn't break
        
$text str_replace("i>","em>",$text); //changed this over, too - em is standard now
        
return $text;
    } 
※ I also found the Report feature for PMs is broken. If you'd like yours fixed, I made this thread about it.

※ The Reply button, as it exists by default, lacks some functionality. If you want your Reply page to not only remember the user's name but the topic and message, check out this thread because I managed to get some help achieving that.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 12-22-2015 at 11:46 PM.
Reply With Quote