Added emoji filter in user title / user options
authorMarcel Werk <burntime@woltlab.com>
Tue, 28 Apr 2015 13:34:27 +0000 (15:34 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 28 Apr 2015 13:34:27 +0000 (15:34 +0200)
wcfsetup/install/files/lib/data/user/UserProfileAction.class.php
wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php

index 597ad734430e6a7ec216eafcc51f8c502e8432e7..bfc50b637307ff1a8b46a285f8d4373315dc2431 100644 (file)
@@ -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']);
                }
                
index 7883667f5f87e99e323546cf03d5befda4943e34..67ed0e848fce566bac9b0d88069e4fb12c053967 100644 (file)
@@ -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;
                }