Fixed disallowed bbcodes in message preview
authorAlexander Ebert <ebert@woltlab.com>
Mon, 27 Feb 2017 10:52:16 +0000 (11:52 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 27 Feb 2017 11:05:42 +0000 (12:05 +0100)
wcfsetup/install/files/lib/data/bbcode/MessagePreviewAction.class.php

index 6315f4bf91fde62400306969c5a12cc3cc201ef2..30d3b52266e2629fd85041f3717c17f4f5a1ef01 100644 (file)
@@ -38,13 +38,17 @@ class MessagePreviewAction extends BBCodeAction {
         * @throws      UserInputException
         */
        public function getMessagePreview() {
+               // set disallowed bbcodes first to ensure proper parsing
+               $disallowedBBCodesPermission = isset($this->parameters['disallowedBBCodesPermission']) ? $this->parameters['disallowedBBCodesPermission'] : 'user.message.disallowedBBCodes';
+               if ($disallowedBBCodesPermission) {
+                       BBCodeHandler::getInstance()->setDisallowedBBCodes(ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($disallowedBBCodesPermission))));
+               }
+               
                $htmlInputProcessor = new HtmlInputProcessor();
                $htmlInputProcessor->process($this->parameters['data']['message'], $this->parameters['messageObjectType'], $this->parameters['messageObjectID']);
                
                // check if disallowed bbcode are used
-               $disallowedBBCodesPermission = isset($this->parameters['disallowedBBCodesPermission']) ? $this->parameters['disallowedBBCodesPermission'] : 'user.message.disallowedBBCodes';
                if ($disallowedBBCodesPermission) {
-                       BBCodeHandler::getInstance()->setDisallowedBBCodes(ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($disallowedBBCodesPermission))));
                        $disallowedBBCodes = $htmlInputProcessor->validate();
                        if (!empty($disallowedBBCodes)) {
                                throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', [