Fixed setting the list of disallowed bbcodes for comments
authorAlexander Ebert <ebert@woltlab.com>
Tue, 15 Aug 2017 11:10:47 +0000 (13:10 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 15 Aug 2017 11:10:47 +0000 (13:10 +0200)
com.woltlab.wcf/templates/commentListAddComment.tpl
wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php
wcfsetup/install/files/lib/system/comment/manager/ICommentManager.class.php

index 79674c28eab98a9d6305f6668b9c4a2d6a449348..b820c55d08510028b6733ad82830b10dfc45f39f 100644 (file)
                                  data-disable-attachments="true"
                                  data-disable-media="true"
                        ></textarea>
+                       
+                       {* in-template call for full backwards-compatibility *}
+                       {$commentList->getCommentManager()->setDisallowedBBCodes()}
+                       
                        {include file='wysiwyg'}
                        
                        <div class="formSubmit">
index ffe563abf6dd630e8d2c472eacfee6093a642a49..9bae5b60c31f1eb7421e87d09014d94c20a461cf 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\system\comment\manager;
 use wcf\data\comment\response\CommentResponse;
 use wcf\data\comment\Comment;
+use wcf\system\bbcode\BBCodeHandler;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -62,6 +63,12 @@ abstract class AbstractCommentManager extends SingletonFactory implements IComme
         */
        protected $permissionModEdit = '';
        
+       /**
+        * permission name for the list of disallowed bbcodes
+        * @var string
+        */
+       protected $permissionDisallowedBBCodes = 'user.comment.disallowedBBCodes';
+       
        /**
         * @inheritDoc
         */
@@ -97,6 +104,13 @@ abstract class AbstractCommentManager extends SingletonFactory implements IComme
                return (WCF::getSession()->getPermission($this->permissionAddWithoutModeration) ? true : false);
        }
        
+       /**
+        * @inheritDoc
+        */
+       public function setDisallowedBBCodes() {
+               BBCodeHandler::getInstance()->setDisallowedBBCodes(explode(',', WCF::getSession()->getPermission($this->permissionDisallowedBBCodes)));
+       }
+       
        /**
         * @inheritDoc
         */
index 847eea42316d702335fb7e1cae4c268192e5e883..446fde87f76d504dd38b5831403cd4041afe103c 100644 (file)
@@ -142,4 +142,9 @@ interface ICommentManager {
         * @return      boolean
         */
        public function supportsReport();
+       
+       /**
+        * Sets the list of disallowed bbcodes.
+        */
+       public function setDisallowedBBCodes();
 }