From 6c266a3d3f87ea92f4801394a785ac8329c7aeb2 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 28 Apr 2015 15:34:27 +0200 Subject: [PATCH] Added emoji filter in user title / user options --- .../install/files/lib/data/user/UserProfileAction.class.php | 3 ++- .../lib/system/option/user/UserOptionHandler.class.php | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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; } -- 2.20.1