From 882f42adcfa640438974b10d1617c08e62aecbde Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sat, 27 Sep 2014 22:45:30 +0200 Subject: [PATCH] Added censorship in 'about me' text --- .../lib/system/option/AboutMeOptionType.class.php | 10 ++++++++++ wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 3 files changed, 12 insertions(+) diff --git a/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php b/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php index e0a01f80f6..86b6ef1907 100644 --- a/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php @@ -2,6 +2,7 @@ namespace wcf\system\option; use wcf\data\option\Option; use wcf\system\exception\UserInputException; +use wcf\system\message\censorship\Censorship; use wcf\system\WCF; /** @@ -24,5 +25,14 @@ class AboutMeOptionType extends MessageOptionType { if (WCF::getSession()->getPermission('user.profile.aboutMeMaxLength') < mb_strlen($newValue)) { 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'); + } + } } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index a5b346d42f..e6768be1b2 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2624,6 +2624,7 @@ Fehler sind beispielsweise: + 1} ({#$number}×){/if}{/implode}]]> user->banExpires != 0} bis zum {@$__wcf->user->banExpires|plainTime}{/if} gesperrt{if $__wcf->user->banReason}: {@$__wcf->user->banReason|htmlspecialchars|nl2br}{else}.{/if}]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index a5a385bd4b..f32429558d 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2515,6 +2515,7 @@ Errors are: + 1} ({#$number}×){/if}{/implode}]]> user->banExpires != 0} until {@$__wcf->user->banExpires|plainTime}{/if}{if $__wcf->user->banReason}: {@$__wcf->user->banReason|htmlspecialchars|nl2br}{else}.{/if}]]> -- 2.20.1