From fc6bd73821f65ecc177216976cd977abb541babc Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 28 Jun 2016 17:36:24 +0200 Subject: [PATCH] Fixed message form implementation --- .../install/files/lib/form/MessageForm.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/form/MessageForm.class.php b/wcfsetup/install/files/lib/form/MessageForm.class.php index aa36f11bd1..df32f580c3 100644 --- a/wcfsetup/install/files/lib/form/MessageForm.class.php +++ b/wcfsetup/install/files/lib/form/MessageForm.class.php @@ -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(); -- 2.20.1