diff --git a/includes/ajaxHandler.class.php b/includes/ajaxHandler.class.php index a10512e6..9790c37d 100644 --- a/includes/ajaxHandler.class.php +++ b/includes/ajaxHandler.class.php @@ -73,12 +73,12 @@ class AjaxHandler return true; } - protected function checkEmptySet(string $val) : bool + protected static function checkEmptySet(string $val) : bool { return $val === ''; // parameter is expected to be empty } - protected function checkLocale(string $val) : int + protected static function checkLocale(string $val) : int { if (preg_match('/^'.implode('|', array_keys(array_filter(Util::$localeStrings))).'$/', $val)) return intVal($val); @@ -86,7 +86,7 @@ class AjaxHandler return -1; } - protected function checkInt(string $val) : int + protected static function checkInt(string $val) : int { if (preg_match('/^-?\d+$/', $val)) return intVal($val); @@ -94,7 +94,7 @@ class AjaxHandler return 0; } - protected function checkIdList(string $val) : array + protected static function checkIdList(string $val) : array { if (preg_match('/^-?\d+(,-?\d+)*$/', $val)) return array_map('intVal', explode(',', $val)); @@ -102,7 +102,7 @@ class AjaxHandler return []; } - protected function checkIdListUnsigned(string $val) : array + protected static function checkIdListUnsigned(string $val) : array { if (preg_match('/\d+(,\d+)*/', $val)) return array_map('intVal', explode(',', $val)); @@ -110,10 +110,10 @@ class AjaxHandler return []; } - protected function checkFulltext(string $val) : string + protected static function checkFulltext(string $val) : string { // trim non-printable chars - return preg_replace('/[\p{C}]/ui', '', $val); + return preg_replace('/[\p{Cf} \p{Co} \p{Cs} \p{Cn}]/ui', '', $val); } } ?> diff --git a/includes/ajaxHandler/account.class.php b/includes/ajaxHandler/account.class.php index 776b2c0a..3b5f85a6 100644 --- a/includes/ajaxHandler/account.class.php +++ b/includes/ajaxHandler/account.class.php @@ -165,7 +165,7 @@ class AjaxAccount extends AjaxHandler DB::Aowow()->query('DELETE FROM ?_account_favorites WHERE `userId` = ?d AND `type` = ?d AND `typeId` = ?d', User::$id, $type, $typeId); } - protected function checkScale(string $val) : string + protected static function checkScale(string $val) : string { if (preg_match('/^((\w+:\d+)(,\w+:\d+)*)$/', $val)) return $val; @@ -173,7 +173,7 @@ class AjaxAccount extends AjaxHandler return ''; } - protected function checkName(string $val) : string + protected static function checkName(string $val) : string { $var = trim(urldecode($val)); diff --git a/includes/ajaxHandler/admin.class.php b/includes/ajaxHandler/admin.class.php index 5e26a1b3..f8996c21 100644 --- a/includes/ajaxHandler/admin.class.php +++ b/includes/ajaxHandler/admin.class.php @@ -467,7 +467,7 @@ class AjaxAdmin extends AjaxHandler return '-1'; } - protected function checkKey(string $val) : string + protected static function checkKey(string $val) : string { // expecting string if (preg_match('/[^a-z0-9_\.\-]/i', $val)) @@ -476,7 +476,7 @@ class AjaxAdmin extends AjaxHandler return strtolower($val); } - protected function checkUser($val) : string + protected static function checkUser($val) : string { $n = Util::lower(trim(urldecode($val))); @@ -486,7 +486,7 @@ class AjaxAdmin extends AjaxHandler return ''; } - protected function checkScale($val) : string + protected static function checkScale($val) : string { if (preg_match('/^((\w+:\d+)(,\w+:\d+)*)$/', $val)) return $val; @@ -494,7 +494,7 @@ class AjaxAdmin extends AjaxHandler return ''; } - private function confOnChange(string $key, string $val, string &$msg) : bool + private static function confOnChange(string $key, string $val, string &$msg) : bool { $fn = $buildList = null; diff --git a/includes/ajaxHandler/comment.class.php b/includes/ajaxHandler/comment.class.php index 4c73cd65..ea046e08 100644 --- a/includes/ajaxHandler/comment.class.php +++ b/includes/ajaxHandler/comment.class.php @@ -92,7 +92,7 @@ class AjaxComment extends AjaxHandler // trim to max length if (!User::isInGroup(U_GROUP_MODERATOR) && mb_strlen($this->_post['commentbody']) > (self::COMMENT_LENGTH_MAX * (User::isPremium() ? 3 : 1))) - $this->post['commentbody'] = mb_substr($this->_post['commentbody'], 0, (self::COMMENT_LENGTH_MAX * (User::isPremium() ? 3 : 1))); + $this->_post['commentbody'] = mb_substr($this->_post['commentbody'], 0, (self::COMMENT_LENGTH_MAX * (User::isPremium() ? 3 : 1))); if (User::canComment()) { @@ -144,7 +144,7 @@ class AjaxComment extends AjaxHandler // trim to max length if (!User::isInGroup(U_GROUP_MODERATOR) && mb_strlen($this->_post['body']) > (self::COMMENT_LENGTH_MAX * (User::isPremium() ? 3 : 1))) - $this->post['body'] = mb_substr($this->_post['body'], 0, (self::COMMENT_LENGTH_MAX * (User::isPremium() ? 3 : 1))); + $this->_post['body'] = mb_substr($this->_post['body'], 0, (self::COMMENT_LENGTH_MAX * (User::isPremium() ? 3 : 1))); $update = array( 'body' => $this->_post['body'], diff --git a/includes/ajaxHandler/data.class.php b/includes/ajaxHandler/data.class.php index 644d3b39..2df14239 100644 --- a/includes/ajaxHandler/data.class.php +++ b/includes/ajaxHandler/data.class.php @@ -117,12 +117,12 @@ class AjaxData extends AjaxHandler return $result; } - protected function checkSkill(string $val) : array + protected static function checkSkill(string $val) : array { return array_intersect([171, 164, 333, 202, 182, 773, 755, 165, 186, 393, 197, 185, 129, 356], explode(',', $val)); } - protected function checkCallback(string $val) : bool + protected static function checkCallback(string $val) : bool { return substr($val, 0, 29) === '$WowheadProfiler.loadOnDemand'; } diff --git a/includes/ajaxHandler/profile.class.php b/includes/ajaxHandler/profile.class.php index ba7eb65c..7bb61aa1 100644 --- a/includes/ajaxHandler/profile.class.php +++ b/includes/ajaxHandler/profile.class.php @@ -746,7 +746,7 @@ class AjaxProfile extends AjaxHandler */ protected function handlePurge() : void { } // removes completion data (as uploaded by the wowhead client) Just fail silently if someone triggers this manually - protected function checkItemList($val) : array + protected static function checkItemList($val) : array { // expecting item-list if (preg_match('/\d+(:\d+)*/', $val)) @@ -755,7 +755,7 @@ class AjaxProfile extends AjaxHandler return []; } - protected function checkUser(string $val) : string + protected static function checkUser(string $val) : string { if (User::isValidName($val)) return $val;