From: Tim Düsterhus Date: Fri, 22 Oct 2021 09:28:16 +0000 (+0200) Subject: Stop checking the `enable_censorship` option X-Git-Tag: 5.5.0_Alpha_1~355^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1678565e1157de876f89e6d9fa8acaea6b36e92e;p=GitHub%2FWoltLab%2FWCF.git Stop checking the `enable_censorship` option --- diff --git a/wcfsetup/install/files/lib/form/MessageForm.class.php b/wcfsetup/install/files/lib/form/MessageForm.class.php index d570c8c00d..45dc408bee 100644 --- a/wcfsetup/install/files/lib/form/MessageForm.class.php +++ b/wcfsetup/install/files/lib/form/MessageForm.class.php @@ -202,13 +202,10 @@ abstract class MessageForm extends AbstractCaptchaForm $this->subject = \mb_substr($this->subject, 0, 255); } - // search for censored words - if (ENABLE_CENSORSHIP) { - $result = Censorship::getInstance()->test($this->subject); - if ($result) { - WCF::getTPL()->assign('censoredWords', $result); - throw new UserInputException('subject', 'censoredWordsFound'); - } + $censoredWords = Censorship::getInstance()->test($this->subject); + if ($censoredWords) { + WCF::getTPL()->assign('censoredWords', $censoredWords); + throw new UserInputException('subject', 'censoredWordsFound'); } } @@ -251,12 +248,10 @@ abstract class MessageForm extends AbstractCaptchaForm } // search for censored words - if (ENABLE_CENSORSHIP) { - $result = Censorship::getInstance()->test($message); - if ($result) { - WCF::getTPL()->assign('censoredWords', $result); - throw new UserInputException('text', 'censoredWordsFound'); - } + $censoredWords = Censorship::getInstance()->test($message); + if ($censoredWords) { + WCF::getTPL()->assign('censoredWords', $censoredWords); + throw new UserInputException('text', 'censoredWordsFound'); } } diff --git a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php index 288c63280b..f4a7c3ecfb 100644 --- a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php +++ b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php @@ -735,18 +735,15 @@ class CommentHandler extends SingletonFactory */ public static function enforceCensorship($text) { - // search for censored words - if (ENABLE_CENSORSHIP) { - $result = Censorship::getInstance()->test($text); - if ($result) { - throw new UserInputException( - 'text', - WCF::getLanguage()->getDynamicVariable( - 'wcf.message.error.censoredWordsFound', - ['censoredWords' => $result] - ) - ); - } + $censoredWords = Censorship::getInstance()->test($text); + if ($censoredWords) { + throw new UserInputException( + 'text', + WCF::getLanguage()->getDynamicVariable( + 'wcf.message.error.censoredWordsFound', + ['censoredWords' => $censoredWords] + ) + ); } } } diff --git a/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygFormField.class.php index 5b3fc4ff5a..43ef8b85d1 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygFormField.class.php @@ -435,13 +435,13 @@ class WysiwygFormField extends AbstractFormField implements $this->validateMinimumLength($message); $this->validateMaximumLength($message); - if (empty($this->getValidationErrors()) && ENABLE_CENSORSHIP) { - $result = Censorship::getInstance()->test($message); - if ($result) { + if (empty($this->getValidationErrors())) { + $censoredWords = Censorship::getInstance()->test($message); + if ($censoredWords) { $this->addValidationError(new FormFieldValidationError( 'censoredWords', 'wcf.message.error.censoredWordsFound', - ['censoredWords' => $result] + ['censoredWords' => $censoredWords] )); } } diff --git a/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php b/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php index 6f999c91b7..35dc117167 100644 --- a/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php @@ -28,13 +28,10 @@ class AboutMeOptionType extends MessageOptionType throw new UserInputException($option->optionName, 'tooLong'); } - // search for censored words - if (ENABLE_CENSORSHIP) { - $result = Censorship::getInstance()->test($newValue); - if ($result) { - WCF::getTPL()->assign('censoredWords', $result); - throw new UserInputException($option->optionName, 'censoredWordsFound'); - } + $censoredWords = Censorship::getInstance()->test($newValue); + if ($censoredWords) { + WCF::getTPL()->assign('censoredWords', $censoredWords); + throw new UserInputException($option->optionName, 'censoredWordsFound'); } } }