From a21c873268572c8dd1fe2d09d76bb4393c1dd112 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 28 Jun 2013 17:22:50 +0200 Subject: [PATCH] Adds handling of available BBCodes --- .../message/ConversationMessageAction.class.php | 4 ++++ files/lib/page/ConversationPage.class.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) 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( -- 2.20.1