Adds handling of available BBCodes
authorMatthias Schmidt <gravatronics@live.com>
Fri, 28 Jun 2013 15:22:50 +0000 (17:22 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 28 Jun 2013 15:22:50 +0000 (17:22 +0200)
files/lib/data/conversation/message/ConversationMessageAction.class.php
files/lib/page/ConversationPage.class.php

index 69dd90b11e76b702ee365fa53cce5aca61b1827f..af86fe6db38c2adefda27f77ff0fdba787e93701 100644 (file)
@@ -9,6 +9,7 @@ use wcf\data\IExtendedMessageQuickReplyAction;
 use wcf\data\IMessageInlineEditorAction;
 use wcf\data\IMessageQuoteAction;
 use wcf\system\attachment\AttachmentHandler;
+use wcf\system\bbcode\BBCodeHandler;
 use wcf\system\bbcode\BBCodeParser;
 use wcf\system\bbcode\PreParser;
 use wcf\system\exception\PermissionDeniedException;
@@ -293,9 +294,12 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
         * @see wcf\data\IMessageInlineEditorAction::beginEdit()
         */
        public function beginEdit() {
+               BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes')));
+               
                WCF::getTPL()->assign(array(
                        'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(),
                        'message' => $this->message,
+                       'permissionCanUseSmilies' => 'user.message.canUseSmilies',
                        'wysiwygSelector' => 'messageEditor'.$this->message->messageID
                ));
                
index 20e0955002863c6a92a437727493ec5f2f4def77..01612238b5cb7ad2866dc034753e5c8f31fe8fbd 100644 (file)
@@ -8,6 +8,7 @@ use wcf\data\conversation\ConversationParticipantList;
 use wcf\data\conversation\ViewableConversation;
 use wcf\data\modification\log\ConversationLogModificationLogList;
 use wcf\data\smiley\SmileyCache;
+use wcf\system\bbcode\BBCodeHandler;
 use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
@@ -235,8 +236,11 @@ class ConversationPage extends MultipleLinkPage {
                        'conversation' => $this->conversation,
                        'conversationID' => $this->conversationID,
                        'participants' => $this->participantList->getObjects(),
-                       'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies()
+                       'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(),
+                       'permissionCanUseSmilies' => 'user.message.canUseSmilies'
                ));
+               
+               BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes')));
        }
        
        /**
@@ -249,8 +253,8 @@ class ConversationPage extends MultipleLinkPage {
                $sql = "SELECT  COUNT(*) AS messages
                        FROM    wcf".WCF_N."_conversation_message conversation_message
                        ".$conditionBuilder;
-               $statement = WCF::getDB()->prepareStatement($sql);      
-               $statement->execute($conditionBuilder->getParameters());        
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute($conditionBuilder->getParameters());
                $row = $statement->fetchArray();
                $this->pageNo = intval(ceil($row['messages'] / $this->itemsPerPage));
        }
@@ -284,8 +288,8 @@ class ConversationPage extends MultipleLinkPage {
                        FROM            wcf".WCF_N."_conversation_message conversation_message
                        ".$conditionBuilder."
                        ORDER BY        time ASC";
-               $statement = WCF::getDB()->prepareStatement($sql, 1);   
-               $statement->execute($conditionBuilder->getParameters());        
+               $statement = WCF::getDB()->prepareStatement($sql, 1);
+               $statement->execute($conditionBuilder->getParameters());
                $row = $statement->fetchArray();
                if ($row !== false) {
                        HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', array(