From a3f1f2b54968839e26bcd40a3dc4d9f06a17b700 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 26 Mar 2013 20:52:32 +0100 Subject: [PATCH] misc fixes: spell: - removed weired break from tooltips - fixed time units being omitted by intval and subsequent cast to int achievement: - casting id to int to avoid string-comparison in mysql (sped up load a lot) localization: - fixed malformed file infobox: - show video-options only when logged in filter: - allow underscores in search (icon search) search: - really fixed prepended quality for items --- includes/class.filter.php | 2 +- includes/class.spell.php | 4 +-- includes/defines.php | 2 +- pages/achievement.php | 51 ++++++++++++++++++++----------------- search.php | 4 ++- template/bricks/infobox.tpl | 6 ++--- template/js/locale_frfr.js | 3 ++- 7 files changed, 38 insertions(+), 34 deletions(-) diff --git a/includes/class.filter.php b/includes/class.filter.php index 4c41d1f3..89680b27 100644 --- a/includes/class.filter.php +++ b/includes/class.filter.php @@ -4,7 +4,7 @@ if(!defined('AOWOW_REVISION')) abstract class Filter { - private static $pattern = "/[^\p{L}0-9\s\-\'\?\*]/ui";// delete any char not in unicode, number, hyphen, single quote or common wildcard + private static $pattern = "/[^\p{L}0-9\s_\-\'\?\*]/ui";// delete any char not in unicode, number, hyphen, single quote or common wildcard private static $wildcards = ['*' => '%', '?' => '_']; private static $criteria = ['cr', 'crs', 'crv']; // [cr]iterium, [cr].[s]ign, [cr].[v]alue diff --git a/includes/class.spell.php b/includes/class.spell.php index 83dd439c..6ff58c55 100644 --- a/includes/class.spell.php +++ b/includes/class.spell.php @@ -934,7 +934,7 @@ class SpellList extends BaseType $pos += strlen($result[0]); $resolved = $this->resolveVariableString($result, $level, $interactive); - $str .= intVal($resolved) ? abs($resolved) : $resolved; + $str .= is_numeric($resolved) ? abs($resolved) : $resolved; } $str .= substr($data, $pos); $str = str_replace('#', '$', $str); // reset marks @@ -1074,8 +1074,6 @@ class SpellList extends BaseType if ($this->curTpl['powerCostPerLevel'] > 0) $x .= sprintf(Lang::$spell['costPerLevel'], $this->curTpl['powerCostPerLevel']); - $x .= '
'; - if ($reqWrapper) $x .= ''; diff --git a/includes/defines.php b/includes/defines.php index a639afd2..83886afa 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -33,7 +33,7 @@ define('CACHETYPE_SEARCH', 3); define('SEARCH_TYPE_REGULAR', 0x10000000); define('SEARCH_TYPE_OPEN', 0x20000000); define('SEARCH_TYPE_JSON', 0x40000000); -define('SEARCH_MASK_OPEN', 0x001D807F); // open search +define('SEARCH_MASK_OPEN', 0x003DC0FF); // open search define('SEARCH_MASK_ALL', 0x07FFFFFF); // normal search // Databases diff --git a/pages/achievement.php b/pages/achievement.php index 86e122a3..f61dd235 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -162,13 +162,16 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'type' => $crt['type'], ); + $obj = (int)$crt['value1']; + $qty = (int)$crt['value2']; + switch ($crt['type']) { // link to npc case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: $tmp['link'] = array( - 'href' => '?npc='.$crt['value1'], + 'href' => '?npc='.$obj, 'text' => $crtName, ); $tmp['extra_text'] = Lang::$achievement['slain']; @@ -179,7 +182,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP: - if ($zoneId = DB::Aowow()->selectCell('SELECT areatableID FROM ?_zones WHERE mapID = ? LIMIT 1', $crt['value1'])) + if ($zoneId = DB::Aowow()->selectCell('SELECT areatableID FROM ?_zones WHERE mapID = ? LIMIT 1', $obj)) $tmp['link'] = array( 'href' => '?zone='.$zoneId, 'text' => $crtName, @@ -191,7 +194,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: $tmp['link'] = array( - 'href' => '?zone='.$crt['value1'], + 'href' => '?zone='.$obj, 'text' => $crtName, ); break; @@ -201,21 +204,21 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: $tmp['link'] = array( - 'href' => '?skill='.$crt['value1'], + 'href' => '?skill='.$obj, 'text' => $crtName, ); break; // link to class case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: $tmp['link'] = array( - 'href' => '?class='.$crt['value1'], + 'href' => '?class='.$obj, 'text' => $crtName, ); break; // link to race case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: $tmp['link'] = array( - 'href' => '?race='.$crt['value1'], + 'href' => '?race='.$obj, 'text' => $crtName, ); break; @@ -226,23 +229,23 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // link to achivement (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: $tmp['link'] = array( - 'href' => '?achievement='.$crt['value1'], + 'href' => '?achievement='.$obj, 'text' => $crtName, ); $tmp['icon'] = $iconId; $pageData['page']['icons'][] = array( 'itr' => $iconId++, 'type' => 'g_achievements', - 'id' => $crt['value1'], + 'id' => $obj, ); - if ($crtAcv = new AchievementList(array(['id', $crt['value1']]))) + if ($crtAcv = new AchievementList(array(['id', $obj]))) $crtAcv->addGlobalsToJscript($pageData); break; // link to quest case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: - $crtName = Quest::getName($crt['value1']); + $crtName = Quest::getName($obj); $tmp['link'] = array( - 'href' => '?quest='.$crt['value1'], + 'href' => '?quest='.$obj, 'text' => $crtName ? $crtName : $crtName, ); break; @@ -252,18 +255,18 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: - $crtSpl = new SpellList(array(['id', $crt['value1']])); + $crtSpl = new SpellList(array(['id', $obj])); $crtSpl->addGlobalsToJscript($pageData); $text = $crtName ? $crtName : $crtSpl->names[$crtSpl->id]; $tmp['link'] = array( - 'href' => '?spell='.$crt['value1'], + 'href' => '?spell='.$obj, 'text' => $text ); $tmp['icon'] = $iconId; $pageData['page']['icons'][] = array( 'itr' => $iconId++, 'type' => 'g_spells', - 'id' => $crt['value1'], + 'id' => $obj, ); break; // link to item (/w icon) @@ -271,44 +274,44 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: - $crtItm = new ItemList(array(['id', $crt['value1']])); + $crtItm = new ItemList(array(['id', $obj])); $crtItm->addGlobalsToJscript($pageData); $text = $crtName ? $crtName : $crtItm->names[$crtItm->id]; $tmp['link'] = array( - 'href' => '?item='.$crt['value1'], + 'href' => '?item='.$obj, 'text' => $text, 'quality' => $crtItm->getField('Quality'), - 'count' => $crt['value2'], + 'count' => $qty, ); $tmp['icon'] = $iconId; $pageData['page']['icons'][] = array( 'itr' => $iconId++, 'type' => 'g_items', - 'id' => $crt['value1'], - 'count' => $crt['value2'], + 'id' => $obj, + 'count' => $qty, ); break; // link to faction (/w target reputation) case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: - $crtName = Faction::getName($crt['value1']); + $crtName = Faction::getName($obj); $tmp['link'] = array( - 'href' => '?faction='.$crt['value1'], + 'href' => '?faction='.$obj, 'text' => $crtName ? $crtName : $crtName, ); - $tmp['extra_text'] = ' ('.Lang::getReputationLevelForPoints($crt['value2']).')'; + $tmp['extra_text'] = ' ('.Lang::getReputationLevelForPoints($qty).')'; break; // link to GObject case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: $tmp['link'] = array( - 'href' => '?object='.$crt['value1'], + 'href' => '?object='.$obj, 'text' => $crtName, ); break; default: $tmp['standard'] = true; // Add a gold coin icon - $tmp['extra_text'] = $displayMoney ? Util::formatMoney($crt['value2']) : $crtName; + $tmp['extra_text'] = $displayMoney ? Util::formatMoney($qty) : $crtName; break; } // If the right column diff --git a/search.php b/search.php index d458f2d1..5a030fde 100644 --- a/search.php +++ b/search.php @@ -288,9 +288,11 @@ if ($searchMask & 0x40) { while ($items->iterate()) { - $data[$items->id]['name'] = substr($data[$items->id]['name'], 1); $data[$items->id]['param1'] = '"'.$items->getField('icon').'"'; $data[$items->id]['param2'] = $items->getField('Quality'); + + if ($searchMask & SEARCH_TYPE_OPEN) + $data[$items->id]['name'] = substr($data[$items->id]['name'], 1); } $found['item'] = array( diff --git a/template/bricks/infobox.tpl b/template/bricks/infobox.tpl index 529a6b2f..19e0f6a2 100644 --- a/template/bricks/infobox.tpl +++ b/template/bricks/infobox.tpl @@ -3,11 +3,11 @@
{$lang.screenshots}
- {$lang.videos} -
+{if $user.id > 0} {$lang.videos} +
{/if} - +{if $user.id > 0} {/if} \ No newline at end of file diff --git a/template/js/locale_frfr.js b/template/js/locale_frfr.js index 2980de61..96202654 100644 --- a/template/js/locale_frfr.js +++ b/template/js/locale_frfr.js @@ -2409,9 +2409,10 @@ var LANG = { message_fillsomecriteria: "Vous devez utiliser au moins un critère.", - tooltip_jconlygems: "Si coché, les gemmes pour joailler,
\nvont aussi être utilisé pour déterminer les meilleurs
\ngemmes possible pour le score pondéré d'un objet.",fidropdowns:{yn:[[1,"Oui"], + tooltip_jconlygems: "Si coché, les gemmes pour joailler,
\nvont aussi être utilisé pour déterminer les meilleurs
\ngemmes possible pour le score pondéré d'un objet.", tooltip_genericrating: "Equipé: Augmente votre $1 de $3 (0 @ L0).
", + fidropdowns:{yn:[[1,"Oui"], [2,"Non"]],num:[[1,">"], [2,">="], [3,"="],