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
This commit is contained in:
Sarjuuk
2016-01-13 20:47:01 +01:00
parent ff3babacb7
commit 99eb8f426b
6 changed files with 8 additions and 8 deletions

View File

@@ -42,8 +42,8 @@ class AjaxHandler
return false; return false;
} }
$h = $this->handler; $h = $this->handler;
$out = $this->$h(); $out = (string)$this->$h();
return true; return true;
} }
@@ -55,7 +55,7 @@ class AjaxHandler
protected function checkLocale($val) 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 intVal($val);
return null; return null;

View File

@@ -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); $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 if ($res['num'] < 5) // more or less hard-defined in LANG.message_weightscalesaveerror
$this->post['id'] = ++$res['max']; $this->_post['id'] = ++$res['max'];
else else
return 0; return 0;
} }

View File

@@ -26,6 +26,7 @@ class AjaxComment extends AjaxHandler
'id' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']], 'id' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']],
'type' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']], 'type' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']],
'typeid' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']], 'typeid' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkInt']],
'rating' => [FILTER_SANITIZE_NUMBER_INT, null]
); );
public function __construct(array $params) public function __construct(array $params)

View File

@@ -1329,7 +1329,7 @@ class ItemList extends BaseType
if ($interactive) if ($interactive)
$js = '&nbsp;<small>('.sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)).')</small>'; $js = '&nbsp;<small>('.sprintf(Util::$changeLevelString, Util::setRatingLevel($level, $type, $value)).')</small>';
else else
$js = "&nbsp;<small>(".Util::setRatingLevel($level, $type, $value).")</small>"; $js = '&nbsp;<small>('.Util::setRatingLevel($level, $type, $value).')</small>';
return Lang::item('trigger', 1).str_replace('%d', '<!--rtg'.$type.'-->'.$value.$js, Lang::item('statType', $type)); return Lang::item('trigger', 1).str_replace('%d', '<!--rtg'.$type.'-->'.$value.$js, Lang::item('statType', $type));
} }

View File

@@ -26,7 +26,6 @@ $reqDBC = ['itemset'];
function itemset() function itemset()
{ {
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$setToHoliday = array ( $setToHoliday = array (
761 => 141, // Winterveil 761 => 141, // Winterveil
762 => 372, // Brewfest 762 => 372, // Brewfest
@@ -285,7 +284,7 @@ function itemset()
/* get name & description */ /* get name & description */
/**************************/ /**************************/
foreach ($locales as $loc) foreach (array_keys(array_filter(Util::$localeStrings)) as $loc)
{ {
User::useLocale($loc); User::useLocale($loc);

View File

@@ -2,7 +2,7 @@
// link to wowhead // link to wowhead
if (isset($this->redButtons[BUTTON_WOWHEAD])): if (isset($this->redButtons[BUTTON_WOWHEAD])):
if ($this->redButtons[BUTTON_WOWHEAD]): if ($this->redButtons[BUTTON_WOWHEAD]):
echo '<a href="'.Util::$wowheadLink.'" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>'; echo '<a href="'.Util::$wowheadLink.'" rel="np" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>';
else: else:
echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>'; echo '<a href="javascript:;" class="button-red button-red-disabled"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>';
endif; endif;