From: Matthias Schmidt Date: Fri, 28 Jun 2013 15:22:50 +0000 (+0200) Subject: Adds handling of available BBCodes X-Git-Tag: 2.0.0_Beta_3~17^2~2^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a21c873268572c8dd1fe2d09d76bb4393c1dd112;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Adds handling of available BBCodes --- diff --git a/files/lib/data/conversation/message/ConversationMessageAction.class.php b/files/lib/data/conversation/message/ConversationMessageAction.class.php index 69dd90b..af86fe6 100644 --- a/files/lib/data/conversation/message/ConversationMessageAction.class.php +++ b/files/lib/data/conversation/message/ConversationMessageAction.class.php @@ -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 )); diff --git a/files/lib/page/ConversationPage.class.php b/files/lib/page/ConversationPage.class.php index 20e0955..0161223 100644 --- a/files/lib/page/ConversationPage.class.php +++ b/files/lib/page/ConversationPage.class.php @@ -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(