Skip the HTML filter when reprocessing messages
authorAlexander Ebert <ebert@woltlab.com>
Wed, 9 May 2018 15:45:25 +0000 (17:45 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 9 May 2018 15:45:25 +0000 (17:45 +0200)
wcfsetup/install/files/lib/system/html/input/HtmlInputProcessor.class.php

index 73f5f823948e3401d6d7ac8ffdd41d53dfac98b1..8ed20e5bc26b15cd71849e507c03126d2bd6caba 100644 (file)
@@ -34,6 +34,12 @@ class HtmlInputProcessor extends AbstractHtmlProcessor {
         */
        protected $htmlInputNodeProcessor;
        
+       /**
+        * skip the HTML filter during message reprocessing
+        * @var boolean
+        */
+       protected $skipFilter = false;
+       
        /**
         * Processes the input html string.
         *
@@ -59,7 +65,9 @@ class HtmlInputProcessor extends AbstractHtmlProcessor {
                $html = HtmlBBCodeParser::getInstance()->parse($html);
                
                // filter HTML
-               $html = $this->getHtmlInputFilter()->apply($html);
+               if (!$this->skipFilter) {
+                       $html = $this->getHtmlInputFilter()->apply($html);
+               }
                
                // pre-parse HTML
                $this->getHtmlInputNodeProcessor()->load($this, $html);
@@ -120,7 +128,13 @@ class HtmlInputProcessor extends AbstractHtmlProcessor {
                        DOMUtil::removeNode($metacode, true);
                }
                
-               $this->process($this->getHtml(), $objectType, $objectID, false);
+               try {
+                       $this->skipFilter = true;
+                       $this->process($this->getHtml(), $objectType, $objectID, false);
+               }
+               finally {
+                       $this->skipFilter = false;
+               }
        }
        
        /**