Fixed message form implementation
authorAlexander Ebert <ebert@woltlab.com>
Tue, 28 Jun 2016 15:36:24 +0000 (17:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 28 Jun 2016 15:37:05 +0000 (17:37 +0200)
wcfsetup/install/files/lib/form/MessageForm.class.php

index aa36f11bd18201c3bd1728d460550e09102a801e..df32f580c3be9f61fd138a9ffcbdc0e0ccf5b8b9 100644 (file)
@@ -91,6 +91,12 @@ abstract class MessageForm extends AbstractCaptchaForm {
         */
        public $maxTextLength = 0;
        
+       /**
+        * message object type for html processing
+        * @var string
+        */
+       public $messageObjectType = '';
+       
        /**
         * list of smiley categories
         * @var SmileyCategory[]
@@ -199,6 +205,10 @@ abstract class MessageForm extends AbstractCaptchaForm {
         * Validates the message text.
         */
        protected function validateText() {
+               if (empty($this->messageObjectType)) {
+                       throw new \RuntimeException("Expected non-empty message object type for '".get_class($this)."'");
+               }
+               
                if (empty($this->text)) {
                        throw new UserInputException('text');
                }
@@ -209,7 +219,7 @@ abstract class MessageForm extends AbstractCaptchaForm {
                }
                
                $this->htmlInputProcessor = new HtmlInputProcessor();
-               $this->htmlInputProcessor->process($this->text);
+               $this->htmlInputProcessor->process($this->text, $this->messageObjectType, 0);
                
                // TODO: add checks for disallowed bbcodes and stuff
                $this->htmlInputProcessor->validate();