/** * @see Form::validate() */ public function validate() { if (!count($this->groupIDs)) { throw new UserInputException('groupIDs', 'empty'); } if (!@is_int($this->maxLifeTime)) { throw new UserInputException('maxLifeTime', 'isNoInteger'); } if (empty($this->subject)) { throw new UserInputException('subject', 'empty'); } if (empty($this->text)) { throw new UserInputException('text', 'empty'); } else { if (StringUtil::length($this->text) > $this->maxTextLength) { throw new UserInputException('text', 'tooLong'); } else { if (defined('ENABLE_CENSORSHIP') && ENABLE_CENSORSHIP) { require_once WCF_DIR . 'lib/data/message/censorship/Censorship.class.php'; $result = Censorship::test($this->text); if ($result) { WCF::getTPL()->assign('censoredWords', $result); throw new UserInputException('text', 'censoredWordsFound'); } } } } parent::validate(); }
/** * Validates message text. */ protected function validateText() { if (empty($this->text)) { throw new UserInputException('text'); } // check text length if ($this->maxTextLength !== null && StringUtil::length($this->text) > $this->maxTextLength) { throw new UserInputException('text', 'tooLong'); } // search for censored words if (ENABLE_CENSORSHIP) { require_once WCF_DIR . 'lib/data/message/censorship/Censorship.class.php'; $result = Censorship::test($this->text); if ($result) { WCF::getTPL()->assign('censoredWords', $result); throw new UserInputException('text', 'censoredWordsFound'); } } }