Added censorship in 'about me' text
authorMarcel Werk <burntime@woltlab.com>
Sat, 27 Sep 2014 20:45:30 +0000 (22:45 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sat, 27 Sep 2014 20:45:30 +0000 (22:45 +0200)
wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index e0a01f80f6a75b6ff0814f743356551ecd30c6cc..86b6ef1907135f448ba67044e507940205fb0dc7 100644 (file)
@@ -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');
+                       }
+               }
        }
 }
index a5b346d42f1a3d74277b54e765f40a70d458d036..e6768be1b2243a6bc6e2cbc11e155d53767ad91d 100644 (file)
@@ -2624,6 +2624,7 @@ Fehler sind beispielsweise:
                <item name="wcf.user.option.error.tooShort"><![CDATA[Der eingegebene Text ist zu kurz.]]></item>
                <item name="wcf.user.option.error.validationFailed"><![CDATA[Sie haben einen ungültigen Inhalt eingegeben.]]></item>
                <item name="wcf.user.option.error.birthdayTooYoung"><![CDATA[Sie sind zu jung. Für eine Anmeldung auf dieser Seite müssen Sie mindestens {#REGISTER_MIN_USER_AGE} Jahre alt sein.]]></item>
+               <item name="wcf.user.option.error.censoredWordsFound"><![CDATA[Ihr Text enthält folgende zensierte Wörter: {implode from=$censoredWords key=censoredWord item=number}{$censoredWord}{if $number > 1} ({#$number}×){/if}{/implode}]]></item>
                <item name="wcf.user.error.isBanned"><![CDATA[Ihr Benutzeraccount wurde{if $__wcf->user->banExpires != 0} bis zum {@$__wcf->user->banExpires|plainTime}{/if} gesperrt{if $__wcf->user->banReason}: {@$__wcf->user->banReason|htmlspecialchars|nl2br}{else}.{/if}]]></item>
                <item name="wcf.user.access.everyone"><![CDATA[Jeder]]></item>
                <item name="wcf.user.access.following"><![CDATA[Benutzer, denen ich folge]]></item>
index a5a385bd4b36919bb83e1e1de8facd19fa00a0de..f32429558d60585bab45abd57525480e25cd9e9e 100644 (file)
@@ -2515,6 +2515,7 @@ Errors are:
                <item name="wcf.user.option.error.tooShort"><![CDATA[Entered text is too short.]]></item>
                <item name="wcf.user.option.error.validationFailed"><![CDATA[Entered text is invalid.]]></item>
                <item name="wcf.user.option.error.birthdayTooYoung"><![CDATA[You’re not old enough. To register with this website you must be at least {#REGISTER_MIN_USER_AGE} years old.]]></item>
+               <item name="wcf.user.option.error.censoredWordsFound"><![CDATA[Text contains censored words: {implode from=$censoredWords key=censoredWord item=number}{$censoredWord}{if $number > 1} ({#$number}×){/if}{/implode}]]></item>
                <item name="wcf.user.error.isBanned"><![CDATA[Your user account has been banned{if $__wcf->user->banExpires != 0} until {@$__wcf->user->banExpires|plainTime}{/if}{if $__wcf->user->banReason}: {@$__wcf->user->banReason|htmlspecialchars|nl2br}{else}.{/if}]]></item>
                <item name="wcf.user.access.everyone"><![CDATA[Everyone]]></item>
                <item name="wcf.user.access.following"><![CDATA[Users I’m following]]></item>