From: Marcel Werk Date: Tue, 28 Apr 2015 13:34:27 +0000 (+0200) Subject: Added emoji filter in user title / user options X-Git-Tag: 2.1.4~41 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6c266a3d3f87ea92f4801394a785ac8329c7aeb2;p=GitHub%2FWoltLab%2FWCF.git Added emoji filter in user title / user options --- diff --git a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php index 597ad73443..bfc50b6373 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php @@ -10,6 +10,7 @@ use wcf\system\option\user\UserOptionHandler; use wcf\system\user\group\assignment\UserGroupAssignmentHandler; use wcf\system\user\storage\UserStorageHandler; use wcf\system\WCF; +use wcf\util\MessageUtil; use wcf\util\StringUtil; /** @@ -232,7 +233,7 @@ class UserProfileAction extends UserAction { public function save() { $userTitle = null; if (isset($this->parameters['values']['__userTitle'])) { - $userTitle = $this->parameters['values']['__userTitle']; + $userTitle = StringUtil::trim(MessageUtil::stripCrap($this->parameters['values']['__userTitle'])); unset($this->parameters['values']['__userTitle']); } diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index 7883667f5f..67ed0e848f 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -8,6 +8,7 @@ use wcf\system\exception\UserInputException; use wcf\system\option\ISearchableConditionUserOption; use wcf\system\option\OptionHandler; use wcf\util\DateUtil; +use wcf\util\MessageUtil; /** * Handles user options. @@ -281,6 +282,11 @@ class UserOptionHandler extends OptionHandler { public function readUserInput(array &$source) { parent::readUserInput($source); + // remove 4 byte utf-8 characters (e.g. emoji) + foreach ($this->rawValues as &$value) { + if (is_string($value)) $value = MessageUtil::stripCrap($value); + } + if ($this->searchMode) { $this->optionValues = $this->rawValues; }