From 99eb8f426b1973c130baaa18dadac943895aaee0 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 13 Jan 2016 20:47:01 +0100 Subject: [PATCH] Misc/Fixes * fixed typo preventing management of custom weight scales * added forgotten GET-Parameter to sanitization, preventing rating of comments * avoid hardcoding locales * do not show tooltip on BUTTON_WOWHEAD --- includes/ajaxHandler.class.php | 6 +++--- includes/ajaxHandler/account.class.php | 2 +- includes/ajaxHandler/comment.class.php | 1 + includes/types/item.class.php | 2 +- setup/tools/sqlgen/itemset.func.php | 3 +-- template/bricks/redButtons.tpl.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/ajaxHandler.class.php b/includes/ajaxHandler.class.php index e51c29f9..7142e979 100644 --- a/includes/ajaxHandler.class.php +++ b/includes/ajaxHandler.class.php @@ -42,8 +42,8 @@ class AjaxHandler return false; } - $h = $this->handler; - $out = $this->$h(); + $h = $this->handler; + $out = (string)$this->$h(); return true; } @@ -55,7 +55,7 @@ class AjaxHandler protected function checkLocale($val) { - if (preg_match('/^'.implode('|', [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]).'$/', $val)) + if (preg_match('/^'.implode('|', array_keys(array_filter(Util::$localeStrings))).'$/', $val)) return intVal($val); return null; diff --git a/includes/ajaxHandler/account.class.php b/includes/ajaxHandler/account.class.php index 2c0f0860..cc8ac327 100644 --- a/includes/ajaxHandler/account.class.php +++ b/includes/ajaxHandler/account.class.php @@ -54,7 +54,7 @@ class AjaxAccount extends AjaxHandler { $res = DB::Aowow()->selectRow('SELECT MAX(id) AS max, count(id) AS num FROM ?_account_weightscales WHERE userId = ?d', User::$id); if ($res['num'] < 5) // more or less hard-defined in LANG.message_weightscalesaveerror - $this->post['id'] = ++$res['max']; + $this->_post['id'] = ++$res['max']; else return 0; } diff --git a/includes/ajaxHandler/comment.class.php b/includes/ajaxHandler/comment.class.php index 3e7d5417..04339bb0 100644 --- a/includes/ajaxHandler/comment.class.php +++ b/includes/ajaxHandler/comment.class.php @@ -26,6 +26,7 @@ class AjaxComment extends AjaxHandler 'id' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']], 'type' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']], 'typeid' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']], + 'rating' => [FILTER_SANITIZE_NUMBER_INT, null] ); public function __construct(array $params) diff --git a/includes/types/item.class.php b/includes/types/item.class.php index a6488a3d..cf2b97c5 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -1329,7 +1329,7 @@ class ItemList extends BaseType if ($interactive) $js = ' ('.sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)).')'; else - $js = " (".Util::setRatingLevel($level, $type, $value).")"; + $js = ' ('.Util::setRatingLevel($level, $type, $value).')'; return Lang::item('trigger', 1).str_replace('%d', ''.$value.$js, Lang::item('statType', $type)); } diff --git a/setup/tools/sqlgen/itemset.func.php b/setup/tools/sqlgen/itemset.func.php index 7fbcc104..2df19dbd 100644 --- a/setup/tools/sqlgen/itemset.func.php +++ b/setup/tools/sqlgen/itemset.func.php @@ -26,7 +26,6 @@ $reqDBC = ['itemset']; function itemset() { - $locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]; $setToHoliday = array ( 761 => 141, // Winterveil 762 => 372, // Brewfest @@ -285,7 +284,7 @@ function itemset() /* get name & description */ /**************************/ - foreach ($locales as $loc) + foreach (array_keys(array_filter(Util::$localeStrings)) as $loc) { User::useLocale($loc); diff --git a/template/bricks/redButtons.tpl.php b/template/bricks/redButtons.tpl.php index 6cada52b..2f15b592 100644 --- a/template/bricks/redButtons.tpl.php +++ b/template/bricks/redButtons.tpl.php @@ -2,7 +2,7 @@ // link to wowhead if (isset($this->redButtons[BUTTON_WOWHEAD])): if ($this->redButtons[BUTTON_WOWHEAD]): - echo 'WowheadWowhead'; + echo 'WowheadWowhead'; else: echo 'WowheadWowhead'; endif;