From edd0ff5209d657603ef0a59bdb65c4d4286a7ae8 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 5 Mar 2013 22:28:15 +0100 Subject: [PATCH] search: initial implementation currently searchable are: - classes - races - titles - currencies - items - itemsets - achievements directly or as &opensearch &json is yet to come, yes that means ?compare cant find any items --- includes/class.charclass.php | 50 ++ includes/class.charrace.php | 46 ++ includes/class.currency.php | 50 ++ includes/class.itemset.php | 94 ++++ index.php | 18 +- opensearch.php | 273 ----------- search.php | 610 ++++++++++++++++-------- template/bricks/allclasses_table.tpl | 6 + template/bricks/allcurrencies_table.tpl | 8 + template/bricks/allitems_table.tpl | 10 + template/bricks/allraces_table.tpl | 6 + template/bricks/class_table.tpl | 37 ++ template/bricks/currency_table.tpl | 28 ++ template/bricks/item_table.tpl | 114 +++++ template/bricks/itemset_table.tpl | 33 ++ template/bricks/race_table.tpl | 34 ++ template/bricks/title_table.tpl | 9 +- template/search.tpl | 51 ++ 18 files changed, 985 insertions(+), 492 deletions(-) create mode 100644 includes/class.charclass.php create mode 100644 includes/class.charrace.php create mode 100644 includes/class.currency.php create mode 100644 includes/class.itemset.php delete mode 100644 opensearch.php create mode 100644 template/bricks/allclasses_table.tpl create mode 100644 template/bricks/allcurrencies_table.tpl create mode 100644 template/bricks/allitems_table.tpl create mode 100644 template/bricks/allraces_table.tpl create mode 100644 template/bricks/class_table.tpl create mode 100644 template/bricks/currency_table.tpl create mode 100644 template/bricks/item_table.tpl create mode 100644 template/bricks/itemset_table.tpl create mode 100644 template/bricks/race_table.tpl create mode 100644 template/search.tpl diff --git a/includes/class.charclass.php b/includes/class.charclass.php new file mode 100644 index 00000000..3810cdcf --- /dev/null +++ b/includes/class.charclass.php @@ -0,0 +1,50 @@ +iterate()) + { + $data[$this->Id] = array( + 'Id' => $this->Id, + 'name' => $this->names[$this->Id], + 'races' => $this->curTpl['raceMask'], + 'roles' => $this->curTpl['roles'], + 'weapon' => $this->curTpl['weaponTypeMask'], + 'armor' => $this->curTpl['armorTypeMask'], + 'power' => $this->curTpl['powerType'], + ); + + if ($this->curTpl['expansion'] == 2) // todo: grr, move to db + $data[$this->Id]['hero'] = 1; + + if ($this->curTpl['expansion']) + $data[$this->Id]['expansion'] = $this->curTpl['expansion']; + } + + return $data; + } + + public function addGlobalsToJscript(&$refs) + { + if (!isset($refs['gClasses'])) + $refs['gClasses'] = []; + + while ($this->iterate()) + $refs['gClasses'][$this->Id] = Util::jsEscape($this->names[$this->Id]); + } + + public function addRewardsToJScript(&$ref) { } + public function renderTooltip() { } +} + +?> diff --git a/includes/class.charrace.php b/includes/class.charrace.php new file mode 100644 index 00000000..12dd3be5 --- /dev/null +++ b/includes/class.charrace.php @@ -0,0 +1,46 @@ +iterate()) + { + $data[$this->Id] = array( + 'Id' => $this->Id, + 'name' => $this->names[$this->Id], + 'classes' => $this->curTpl['classMask'], + 'faction' => $this->curTpl['factionId'], + 'leader' => $this->curTpl['leader'], + 'zone' => $this->curTpl['startAreaId'], + 'side' => $this->curTpl['side'] + ); + + if ($this->curTpl['expansion']) + $data[$this->Id]['expansion'] = $this->curTpl['expansion']; + } + + return $data; + } + + public function addGlobalsToJscript(&$refs) + { + if (!isset($refs['gRaces'])) + $refs['gRaces'] = []; + + $refs['gRaces'][$this->Id] = Util::jsEscape($this->names[$this->Id]); + } + + public function addRewardsToJScript(&$ref) { } + public function renderTooltip() { } +} + +?> diff --git a/includes/class.currency.php b/includes/class.currency.php new file mode 100644 index 00000000..c31ac9e1 --- /dev/null +++ b/includes/class.currency.php @@ -0,0 +1,50 @@ +iterate()) + { + $data[$this->Id] = array( + 'Id' => $this->Id, + 'category' => $this->curTpl['category'], + 'name' => $this->names[$this->Id], + 'icon' => $this->curTpl['iconString'] + ); + } + + return $data; + } + + public function addGlobalsToJscript(&$refs) + { + if (!isset($refs['gCurrencies'])) + $refs['gCurrencies'] = []; + + $data = []; + + while ($this->iterate()) + { + $refs['gCurrencies'][$this->Id] = array( + 'name_'.User::$localeString => Util::jsEscape($this->names[$this->Id]), + 'icon' => $this->curTpl['iconString'] + ); + } + + return $data; + } + + public function addRewardsToJScript(&$ref) { } + public function renderTooltip() { } +} + +?> diff --git a/includes/class.itemset.php b/includes/class.itemset.php new file mode 100644 index 00000000..ba7a1ea4 --- /dev/null +++ b/includes/class.itemset.php @@ -0,0 +1,94 @@ +templates as $this->curTpl) + { + $Id = $this->curTpl['Id']; + + $this->templates[$Id]['classes'] = []; + $this->templates[$Id]['pieces'] = []; + + for ($i = 1; $i < 12; $i++) + { + if ($this->curTpl['classMask'] & (1 << $i)) + { + $this->classes[] = $i + 1; + $this->templates[$Id]['classes'][] = $i + 1; + } + } + + for ($i = 1; $i < 10; $i++) + { + if ($piece = $this->curTpl['item'.$i]) + { + $this->pieces[] = $piece; + $this->templates[$Id]['pieces'][] = $piece; + $this->pieceToSet[$piece] = $this->Id; + } + } + } + + $this->classes = array_unique($this->classes); + $this->pieces = array_unique($this->pieces); + $this->pieceToSet = array_unique($this->pieceToSet); + + + // AAARG TODO! + $this->curTpl = reset($this->templates); // restore 'iterator' + } + + public function getListviewData() + { + $data = []; + + while ($this->iterate()) + { + $data[$this->Id] = array( + 'Id' => $this->Id, + 'idbak' => $this->curTpl['refSetId'], + 'name' => $this->names[$this->Id], + 'quality' => 7 - $this->curTpl['quality'], + 'minlevel' => $this->curTpl['minLevel'], + 'maxlevel' => $this->curTpl['maxLevel'], + 'note' => $this->curTpl['contentGroup'], + 'type' => $this->curTpl['type'], + 'heroic' => $this->curTpl['heroic'] == 1, // we want to be bool + 'reqclass' => $this->curTpl['classMask'], + 'classes' => $this->curTpl['classes'], + 'pieces' => $this->curTpl['pieces'] + ); + } + + return $data; + } + + public function addGlobalsToJscript(&$refs) + { + if ($this->classes) + (new CharClassList(array(['Id', $this->classes])))->addGlobalsToJscript($refs); + + if ($this->pieces) + (new ItemList(array(['i.entry', $this->pieces])))->addGlobalsToJscript($refs); + } + + public function addRewardsToJScript(&$ref) { } + public function renderTooltip() { } +} + +?> diff --git a/index.php b/index.php index c270d2e3..843e3e68 100644 --- a/index.php +++ b/index.php @@ -89,9 +89,9 @@ switch ($pageCall) User::writeCookie(); header('Location: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '.')); break; - case 'search': // tool: quick search - case 'data': // dataset-loader - require $pageCall.'.php'; + case 'data': // tool: dataset-loader + case 'search': // tool: searches + include $pageCall.'.php'; break; /* other */ case '': // no parameter given -> MainPage @@ -107,18 +107,18 @@ switch ($pageCall) case 'random': require 'pages/miscTools.php'; break; + case 'build': + if (User::isInGroup(U_GROUP_EMPLOYEE)) + { + require 'setup/tools/dataset-assembler/'.$pageParam.'.php'; + break; + } case 'setup': if (User::isInGroup(U_GROUP_EMPLOYEE)) { require 'setup/syncronize.php'; break; } - case 'build': - if (User::isInGroup(U_GROUP_EMPLOYEE) && !empty($pageParam)) - { - require 'setup/tools/dataset-assembler/'.$pageParam.'.php'; - break; - } default: // unk parameter given -> ErrorPage if (isset($_GET['power'])) die('$WowheadPower.register(0, '.User::$localeId.', {})'); diff --git a/opensearch.php b/opensearch.php deleted file mode 100644 index a6b9fd65..00000000 --- a/opensearch.php +++ /dev/null @@ -1,273 +0,0 @@ - NPC - Type 2 => GameObject - Type 3 => Items - Type 4 => Item Sets - Type 5 => Quests - Type 6 => Spells - Type 7 => Zones - Type 8 => Factions - Type 9 => Pets - Type 10 => Achievement - Type 11 => Title - Type 12 => Event - Type 13 => Class - Type 14 => Race - Type 15 => Skill - Type 17 => Currency -*/ - -// Ajax can't handle debug, force to false -$AoWoWconf['debug'] = false; - -header("Content-type: text/javascript"); - -// Receives requests from at least 3 characters (although vovhede and 1 character) -$_query = Util::sqlEscape($_GET['search']); -$_type = isset($_GET['type']) ? (1 << intVal($_GET['type'])) : 0xFFFF; - -if (strlen($_query) < 3) - exit('["", []]'); - -echo "[\"".str_replace('"', '\"', $_query)."\", [\n"; - -// Item Comparison search -$foundItems = []; -$foundSets = []; -$pieceAssoc = []; -if ($_type & 0x10) { - - $rows = DB::Aowow()->Select(' - SELECT - id, - refSetId as idbak, - CONCAT(7 - quality, ?#) as name, - minlevel, - maxlevel, - contentGroup as note, - type, - IF(heroic=1, "true", "false") as heroic, - classMask as reqclass, - item1, item2, item3, item4, item5, - item6, item7, item8, item9, item10 - FROM - ?_itemset - WHERE - ?# LIKE ?s;', - 'name_loc'.User::$localeId, - 'name_loc'.User::$localeId, - '%'.$_query.'%' - ); - - // parse items, create class-array - - foreach ($rows as $row) - { - $row['pieces'] = []; - for ($i=1; $i<=10; $i++) - { - if ($row['item'.$i]) - { - $foundItems[] = $row['item'.$i]; - $row['pieces'][] = $row['item'.$i]; - $pieceAssoc[$row['item'.$i]] = $row['id']; - unset($row['item'.$i]); - } - } - $row['classes'] = []; - for ($i = 1; $i < 12; $i++) - if ($row['reqclass'] & (1 << $i)) - $row['classes'][] = $i + 1; - - unset($row['classMask']); - $foundSets[] = $row; - } -} -if ($_type & 0x18) { // 3 | 4 - $conditions = array( - array('i.class', [2, 4]), - empty($foundItems) ? array(User::$localeId ? 'name_loc'.User::$localeId : 'name', $_query) : array('i.entry', $foundItems) - ); - $iList = new ItemList($conditions); - - $items = []; - while ($iList->iterate()) - { - $iList->extendJsonStats($pieceAssoc); - - $stats = []; - foreach ($iList->json[$iList->Id] as $k => $v) - { - if (!$v && $k != 'classs' && $k != 'subclass') - continue; - - $stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"'; - } - - foreach ($iList->itemMods[$iList->Id] as $k => $v) - $stats[] = '"'.Util::$itemMods[$k].'":'.$v.''; - - $items[$iList->Id] = "\t{".implode(',', $stats)."}"; - } - echo implode(",\n", $items)."\n],[\n"; - - $i = 0; - foreach ($foundSets as $single) - { - $set = []; - foreach ($single as $key => $value) - { - if ((is_numeric($value) && $value == 0) || $value === "false") - continue; - - if (is_array($value)) - $value = "[".implode(',',$value)."]"; - - $set[] = is_numeric($value) || $value[0] == "[" ? '"'.$key.'":'.str_replace('"', '\"', $value).'' : '"'.$key.'":"'.str_replace('"', '\"', $value).'"'; - } - echo "\t{".implode(',', $set)."}"; - echo ($i < count($foundSets) - 1) ? ",\n" : "\n"; - $i++; - } -echo "]]"; -exit(); -} -/* -// Ищем вещи: - -$rows = $DB->select(' - SELECT i.entry, ?# as name, a.iconname, i.quality - FROM ?_icons a, item_template i{, ?# l} - WHERE - ?# LIKE ? - AND a.id = i.displayid - { AND i.entry = l.?# } - ORDER BY i.quality DESC, ?# - LIMIT 3 - ', - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // SELECT - User::$localeId == 0 ? DBSIMPLE_SKIP : 'locales_item', // FROM - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // WHERE1 - $_query, - User::$localeId == 0 ? DBSIMPLE_SKIP : 'entry', // WHERE2 - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId // ORDER -); - -foreach($rows as $i => $row) - $found[$row['name'].' (Item)'] = array( - 'type' => 3, - 'entry' => $row['entry'], - 'iconname' => $row['iconname'], - 'quality' => $row['quality'] - ); - -// Ищем объекты: -$rows = $DB->select(' - SELECT entry, ?# as name - FROM ?# - WHERE ?# LIKE ? - ORDER BY ?# - LIMIT 3 - ', - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // SELECT - User::$localeId == 0 ? 'gameobject_template' : 'locales_gameobject', // FROM - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // WHERE1 - $_query, - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId // ORDER -); - -foreach($rows as $i => $row) - $found[$row['name'].' (Object)'] = array( - 'type' => 2, - 'entry'=>$row['entry'], - ); - -// Ищем квесты: -$rows = $DB->select(' - SELECT q.entry, ?# as Title, q.RequiredRaces - FROM quest_template q {, ?# l} - WHERE - (?# LIKE ?) - {AND (q.entry=l.?#)} - ORDER BY ?# - LIMIT 3 - ', - User::$localeId == 0 ? 'Title' : 'Title_loc'.User::$localeId, // SELECT - User::$localeId == 0 ? DBSIMPLE_SKIP : 'locales_quest', // FROM - User::$localeId == 0 ? 'Title' : 'Title_loc'.User::$localeId, // WHERE1 - $_query, - User::$localeId == 0 ? DBSIMPLE_SKIP : 'entry', // WHERE2 - User::$localeId == 0 ? 'Title' : 'Title_loc'.User::$localeId // ORDER -); - -foreach($rows as $i => $row) - $found[$row['Title'].' (Quest)'] = array( - 'type' => 5, - 'entry'=> $row['entry'], - 'side' => factionByRaceMask($row['RequiredRaces']) - ); - -// Ищем creature: -$rows = $DB->select(' - SELECT entry, ?# as name - FROM ?# - WHERE ?# LIKE ? - ORDER BY ?# - LIMIT 3 - ', - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // SELECT - User::$localeId == 0 ? 'creature_template' : 'locales_creature', // FROM - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // WHERE1 - $_query, - User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId // ORDER -); - -foreach($rows as $i => $row) - $found[$row['name'].' (NPC)'] = array( - 'type' => 1, - 'entry' => $row['entry'] - ); - -// Если ничего не найдено... -if(!isset($found)) -{ - echo ']]'; - exit; -} - -//ksort($found); - -$found = array_slice($found, 0, 10); - -$i=0; -foreach($found as $name => $fitem) -{ - echo '"'.str_replace('"', '\"', $name).'"'; - if($i $fitem) -{ - echo '['.$fitem['type'].', '.$fitem['entry']; - if(isset($fitem['iconname'])) echo ', "'.$fitem['iconname'].'"'; - if(isset($fitem['quality'])) echo ", ".$fitem['quality']; - if(isset($fitem['side'])) echo ", ".$fitem['side']; - echo ']'; - if($i \ No newline at end of file diff --git a/search.php b/search.php index 934f6bf7..341b80a4 100644 --- a/search.php +++ b/search.php @@ -1,9 +1,13 @@ suche ausm compare heraus (profiler evtl auch noch) + => search by compare or profiler else if &opensearch => suche aus der suchbox oben rechts, bzw Startseite array:[ @@ -14,219 +18,411 @@ [], // unused [], // unused [], // unused - str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10:icon, 5:faction), param2 (3:quality, 6:rank) + str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10,17:icon, 5:faction), param2 (3:quality, 6:rank) ] else - => Sucheseite über Template - + 1: Listview - template: 'classs', id: 'classes', name: LANG.tab_classes, + 2: Listview - template: 'race', id: 'races', name: LANG.tab_races, + 3: Listview - template: 'title', id: 'titles', name: LANG.tab_titles, + 4: Listview - template: 'holiday', id: 'holidays', name: LANG.tab_holidays, + 5: Listview - template: 'currency', id: 'currencies', name: LANG.tab_currencies, + 6: Listview - template: 'itemset', id: 'itemsets', name: LANG.tab_itemsets, + 7: Listview - template: 'item', id: 'items', name: LANG.tab_items, + 8: Listview - template: 'spell', id: 'abilities', name: LANG.tab_abilities, visibleCols: ['level', 'schools'], + 9: Listview - template: 'spell', id: 'talents', name: LANG.tab_talents, visibleCols: ['level', 'schools'], hiddenCols: ['reagents'], + 10: Listview - template: 'spell', id: 'glyphs', name: LANG.tab_glyphs, visibleCols: ['singleclass', 'glyphtype'], hiddenCols: ['reagents', 'skill', 'level'], + 11: Listview - template: 'spell', id: 'proficiencies', name: LANG.tab_proficiencies, visibleCols: ['classes'], hiddenCols: ['reagents', 'skill'], + 12: Listview - template: 'spell', id: 'professions', name: LANG.tab_professions, visibleCols: ['source'], + 13: Listview - template: 'spell', id: 'companions', name: LANG.tab_companions, visibleCols: ['reagents'], hiddenCols: ['level', 'skill'], + 14: Listview - template: 'spell', id: 'mounts', name: LANG.tab_mounts, visibleCols: ['reagents'], hiddenCols: ['level', 'skill'], + 15: Listview - template: 'npc', id: 'npcs', name: LANG.tab_npcs, + 16: Listview - template: 'quest', id: 'quests', name: LANG.tab_quests, + 17: Listview - template: 'achievement', id: 'achievements', name: LANG.tab_achievements, visibleCols: ['category'], + 18: Listview - template: 'zone', id: 'zones', name: LANG.tab_zones, + 19: Listview - template: 'object', id: 'objects', name: LANG.tab_objects, + 20: Listview - template: 'faction', id: 'factions', name: LANG.tab_factions, + 21: Listview - template: 'skill', id: 'skills', name: LANG.tab_skills, hiddenCols: ['reagents', 'skill'], + 22: Listview - template: 'pet', id: 'pets', name: LANG.tab_pets, + 23: Listview - template: 'spell', id: 'npc-abilities', name: LANG.tab_npcabilities, visibleCols: ['level'], hiddenCols: ['reagents', 'skill'], + 24: Listview - template: 'spell', id: 'spells', name: LANG.tab_uncategorizedspells, visibleCols: ['level'], hiddenCols: ['reagents', 'skill'], + 25: Listview - template: 'profile', id: 'characters', name: LANG.tab_characters, visibleCols: ['race','classs','level','talents','gearscore','achievementpoints'], + 26: Guilds..? */ -if (isset($_GET['opensearch']) || isset($_GET['json'])) +$search = urlDecode(trim($pageParam)); +$query = Util::sqlEscape(str_replace('?', '_', str_replace('*', '%', ($search)))); +$type = @intVal($_GET['type']); +$searchMask = 0x0; +$found = []; +$jsGlobals = []; + +if (isset($_GET['json'])) { - require 'opensearch.php'; - die(); -} - -// Необходима функция iteminfo -require 'includes/game.php'; -require 'includes/allspells.php'; -require 'includes/allquests.php'; -require 'includes/allitems.php'; -require 'includes/allnpcs.php'; -require 'includes/allobjects.php'; - -// Настраиваем Smarty ;) -$smarty->config_load($conf_file, 'search'); - -// Строка поиска: -$search = urldecode($pageParam); -$nsearch = '%'.$search.'%'; -$smarty->assign('search', $search); - -// Подключаемся к ДБ -global $DB; -global $allitems; -global $allspells; - -global $npc_cols; -global $spell_cols; - -// Массив всего найденного -$found = []; - -// Ищем вещи: -if($_SESSION['locale']>0) -{ - $m = $DB->selectCol(' - SELECT entry - FROM locales_item - WHERE name_loc?d LIKE ? - ', - $_SESSION['locale'], - $nsearch - ); -} - -$rows = $DB->select(' - SELECT i.?# - {, l.name_loc?d AS `name_loc`} - FROM ?_icons a, item_template i - {LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d} - WHERE - (i.name LIKE ? {OR i.entry IN (?a)}) - AND a.id = i.displayid; - ', - $item_cols[3], - ($m)? $_SESSION['locale']: DBSIMPLE_SKIP, - ($m)? 1: DBSIMPLE_SKIP, - $nsearch, - ($m)? $m: DBSIMPLE_SKIP -); -unset($m); -foreach($rows as $row) - $found['item'][] = iteminfo2($row); - -// Ищем NPC: -if($_SESSION['locale']>0) -{ - $m = $DB->selectCol(' - SELECT entry - FROM locales_creature - WHERE - name_loc?d LIKE ? - OR subname_loc?d LIKE ? - ', - $_SESSION['locale'], $nsearch, - $_SESSION['locale'], $nsearch - ); -} -$rows = $DB->select(' - SELECT ?#, c.entry - {, l.name_loc?d AS `name_loc`, - l.subname_loc'.$_SESSION['locale'].' AS `subname_loc`} - FROM ?_factiontemplate, creature_template c - {LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ?d} - WHERE - (name LIKE ? - OR subname LIKE ? - {OR c.entry IN (?a)}) - AND factiontemplateID=faction_A - ', - $npc_cols[0], - ($m)? $_SESSION['locale']: DBSIMPLE_SKIP, - ($m)? 1: DBSIMPLE_SKIP, - $nsearch, $nsearch, - ($m)? $m: DBSIMPLE_SKIP -); -unset($m); -foreach($rows as $row) - $found['npc'][] = creatureinfo2($row); - -// Ищем объекты -if($_SESSION['locale']>0) -{ - $m = $DB->selectCol(' - SELECT entry - FROM locales_gameobject - WHERE - name_loc?d LIKE ? - ', - $_SESSION['locale'], $nsearch - ); -} -$rows = $DB->select(' - SELECT g.?# - {, l.name_loc?d AS `name_loc`} - FROM gameobject_template g - {LEFT JOIN (locales_gameobject l) ON l.entry=g.entry AND ?d} - WHERE name LIKE ? {OR g.entry IN (?a)} - ', - $object_cols[0], - ($m)? $_SESSION['locale']: DBSIMPLE_SKIP, - ($m)? 1: DBSIMPLE_SKIP, - $nsearch, - ($m)? $m: DBSIMPLE_SKIP -); -unset($m); -foreach($rows as $row) - $found['object'][] = objectinfo2($row); - -// Ищем квесты -if($_SESSION['locale']>0) -{ - $m = $DB->selectCol(' - SELECT entry - FROM locales_quest - WHERE - Title_loc?d LIKE ? - ', - $_SESSION['locale'], $nsearch - ); -} -$rows = $DB->select(' - SELECT * - {, l.Title_loc?d AS `Title_loc`} - FROM quest_template q - {LEFT JOIN (locales_quest l) ON l.entry=q.entry AND ?d} - WHERE Title LIKE ? {OR q.entry IN (?a)} - ', - ($m)? $_SESSION['locale']: DBSIMPLE_SKIP, - ($m)? 1: DBSIMPLE_SKIP, - $nsearch, - ($m)? $m: DBSIMPLE_SKIP -); -unset($m); -foreach($rows as $row) - $found['quest'][] = GetQuestInfo($row, 0xFFFFFF); - -// Ищем наборы вещей -$rows = $DB->select(' - SELECT * - FROM ?_itemset - WHERE name_loc'.$_SESSION['locale'].' LIKE ? - ', - $nsearch -); -foreach($rows as $row) - $found['itemset'][] = itemsetinfo2($row); - -// Ищем спеллы -$rows = $DB->select(' - SELECT ?#, spellID - FROM ?_spell s, ?_spellicons i - WHERE - s.spellname_loc'.$_SESSION['locale'].' like ? - AND i.id = s.spellicon - ', - $spell_cols[2], - $nsearch -); -foreach($rows as $row) - $found['spell'][] = spellinfo2($row); - -$keys = array_keys($found); - -// Если найден один элемент - перенаправляем на него -if(count($found) == 1 && count($found[$keys[0]]) == 1) -{ - header("Location: ?".$keys[0].'='.$found[$keys[0]][0]['entry']); + if ($type == TYPE_ITEMSET) + $searchMask |= SEARCH_TYPE_JSON | 0x60; + else if ($type == TYPE_ITEM) + $searchMask |= SEARCH_TYPE_JSON | 0x40; } +else if (isset($_GET['opensearch'])) + $searchMask |= SEARCH_TYPE_OPEN | SEARCH_MASK_OPEN; else + $searchMask |= SEARCH_TYPE_REGULAR | SEARCH_MASK_ALL; + +$cacheKey = implode('_', [CACHETYPE_SEARCH, $searchMask, sha1($query), User::$localeId]); + +// invalid conditions: not enough characters to search OR no types to search +if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL)) { - $smarty->assign('found', $found); + if ($searchMask & SEARCH_TYPE_REGULAR) + { + // empty queries go home + if (!$query) + header("Location:?"); - // Параметры страницы - $page = []; - // Номер вкладки меню - $page['tab'] = 0; - // Заголовок страницы - $page['Title'] = $search.' - '.$smarty->get_config_vars('Search'); - $smarty->assign('page', $page); + // insufficient queries throw an error + $smarty->assign('lang', array_merge(Lang::$main, Lang::$search)); + $smarty->assign('found', []); + $smarty->assign('mysql', DB::Aowow()->getStatistics()); + $smarty->assign('search', $query); - $smarty->assign('mysql', $DB->getStatistics()); - $smarty->assign('search', $search); - - $smarty->display('search.tpl'); + $smarty->display('search.tpl'); + die(); + } + else if ($searchMask & SEARCH_TYPE_OPEN) + { + header("Content-type: text/javascript"); + exit('["'.Util::jsEscape($query).'", []]'); + } + else /* if ($searchMask & SEARCH_TYPE_JSON) */ + { + header("Content-type: text/javascript"); + exit ("[\"".Util::jsEscape($query)."\", [\n],[\n]]\n"); + } } -?> \ No newline at end of file +// 1 Classes: +if ($searchMask & 0x1) +{ + /* custom data :( + armor: build manually - ItemSubClassMask (+Shield +Relics) + weapon: build manually - ItemSubClassMask + roles: build manually - 1:heal; 2:mleDPS; 4:rngDPS; 8:tank + */ + $classes = new CharClassList(array(['name_loc'.User::$localeId, $query])); + + if ($data = $classes->getListviewData()) + { + while ($classes->iterate()) + $data[$classes->Id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"'; + + $found['class'] = array( + 'type' => TYPE_CLASS, + 'appendix' => ' (Class)', + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + } +} + +// 2 Races: +if ($searchMask & 0x2) +{ + /* custom data :( + faction: dbc-data is internal -> doesn't work how to link to displayable faction..? + leader: 29611 for human .. DAFUQ?! + zone: starting zone... + */ + + $races = new CharRaceList(array(['name_loc'.User::$localeId, $query])); + + if ($data = $races->getListviewData()) + { + while ($races->iterate()) + $data[$races->Id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"'; + + $found['race'] = array( + 'type' => TYPE_RACE, + 'appendix' => ' (Race)', + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + } +} + +// 3 Titles: +if ($searchMask & 0x4) +{ + /* custom data :( + category:1, // custom data .. FU! + expansion:0, // custom data .. FU FU! + gender:3, // again.. luckiely 136; 137 only + side:2, // hmm, derive from source..? + source: {} // g_sources .. holy cow.. that will cost some nerves + */ + + $sources = array( + 4 => [], // Quest + 12 => [], // Achievement + 13 => [] // DB-Text + ); + + $conditions = array( + 'OR', + ['male_loc'.User::$localeId, $query], + ['female_loc'.User::$localeId, $query] + ); + + $titles = new TitleList($conditions); + $data = $titles->getListviewData(); + + if (!empty($data)) + { + $found['title'] = array( + 'type' => TYPE_TITLE, + 'appendix' => ' (Title)', + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + } +} + +// 4 World Events: +// if ($searchMask & 0x8) +{ + // /* custom data :( + // */ + + // $wEvents = new WorldEventList(array(['name_loc'.User::$localeId, $query])); + + // if (!empty($data)) + // { + // $found[] = array( + // 'type' => TYPE_WORLDEVENT, + // 'appendix' => ' (World Event)', + // 'data' => $data + // ); + // } +} + +// 5 Currencies +if ($searchMask & 0x10) +{ + $money = new CurrencyList(array(['name_loc'.User::$localeId, $query])); + + if ($data = $money->getListviewData()) + { + while ($money->iterate()) + $data[$money->Id]['param1'] = strToLower($money->getField('iconString')); + + $found['currency'] = array( + 'type' => TYPE_CURRENCY, + 'appendix' => ' (Currency)', + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + } +} + +// 6 Itemsets +if ($searchMask & 0x20) +{ + $sets = new ItemsetList(array(['name_loc'.User::$localeId, $query])); + $sets->addGlobalsToJscript($jsGlobals); + + if ($data = $sets->getListviewData()) + { + while ($sets->iterate()) + $data[$sets->Id]['param1'] = $sets->getField('quality'); + + $found['itemset'] = array( + 'type' => TYPE_ITEMSET, + 'appendix' => ' (Item Set)', + 'data' => $data, + 'params' => ['tabs' => '$myTabs'], + 'pieces' => $sets->pieces + ); + } +} + +// 7 Items +if ($searchMask & 0x40) +{ + if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && $found['itemset']['pieces']) + $conditions = [['i.class', [2, 4]], ['i.entry', $foundItems]]; + else + $conditions = [[User::$localeId ? 'name_loc'.User::$localeId : 'name', $query], 0]; + $items = new ItemList($conditions); + $items->addGlobalsToJscript($jsGlobals); + + if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? ITEMINFO_SUBITEMS : 0)) + { + while ($items->iterate()) + { + $data[$items->Id]['param1'] = '"'.$items->getField('icon').'"'; + $data[$items->Id]['param2'] = $items->getField('Quality'); + } + + $found['item'] = array( + 'type' => TYPE_ITEM, + 'appendix' => ' (Item)', + 'params' => ['tabs' => '$myTabs'], + 'data' => $data, + ); + } +} + +// 8 Abilities +// if ($searchMask & 0x80) + +// 9 Talents +// if ($searchMask & 0x100) + +// 10 Glyphs +// if ($searchMask & 0x200) + +// 11 Proficiencies +// if ($searchMask & 0x400) + +// 12 Professions +// if ($searchMask & 0x800) + +// 13 Companions +// if ($searchMask & 0x1000) + +// 14 Mounts +// if ($searchMask & 0x2000) + +// 15 NPCs +// if ($searchMask & 0x4000) + +// 16 Quests +// if ($searchMask & 0x8000) + +// 17 Achievements +if ($searchMask & 0x10000) +{ + $acvs = new AchievementList(array(['name_loc'.User::$localeId, $query])); + + if ($data = $acvs->getListviewData()) + { + $acvs->addGlobalsToJScript($jsGlobals); + $acvs->addRewardsToJScript($jsGlobals); + + $found['achievement'] = array( + 'type' => TYPE_ACHIEVEMENT, + 'appendix' => ' (Achievement)', + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs', + 'visibleCols' => '$[\'category\']' + ] + ); + } +} + +// 18 Zones +// if ($searchMask & 0x20000) + +// 19 Objects +// if ($searchMask & 0x40000) + +// 20 Factions +// if ($searchMask & 0x80000) + +// 21 Skills +// if ($searchMask & 0x100000) + +// 22 Pets +// if ($searchMask & 0x200000) + +// 23 NPCAbilities +// if ($searchMask & 0x400000) + +// 24 Spells (Misc) +// if ($searchMask & 0x800000) + +// 25 Characters +// if ($searchMask & 0x1000000) + +// 26 Guilds +// if ($searchMask & 0x2000000) + + +if ($searchMask & SEARCH_TYPE_JSON) +{ + header("Content-type: text/javascript"); + echo "/* not yet supported */\n"; + exit ("[\"".Util::jsEscape($query)."\", [\n],[\n]]\n"); +} +else if ($searchMask & SEARCH_TYPE_OPEN) +{ + // this one is funny: we want 10 results, ideally equally destributed over each type + $foundTotal = 0; + $maxResults = 10; + $names = []; + $info = []; + + foreach ($found as $tmp) + $foundTotal += count($tmp['data']); + + if (!$foundTotal) + exit('["'.Util::jsEscape($query).'", []]'); + + foreach ($found as $id => $set) + { + $max = max(1, round($maxResults * count($set['data']) / $foundTotal)); + $maxResults -= $max; + + for ($i = 0; $i < $max; $i++) + { + $data = array_pop($set['data']); + if (!$data) + break; + + $names[] = '"'.$data['name'].$set['appendix'].'"'; + $extra = [$set['type'], $data['Id']]; + + if (isset($data['param1'])) + $extra[] = $data['param1']; + + if (isset($data['param2'])) + $extra[] = $data['param2']; + + $info[] = '['.implode(', ', $extra).']'; + } + } + + header("Content-type: text/javascript"); + die('["'.Util::jsEscape($search).'", ['.implode(', ', $names).'], [], [], [], [], [], ['.implode(', ', $info).']]'); +} +else /* if ($searchMask & SEARCH_TYPE_REGULAR) */ +{ + $foundTotal = 0; + + foreach ($found as $tmp) + $foundTotal += count($tmp['data']); + + // // only one match -> redirect to find + // if ($foundTotal == 1) + // { + // header("Location: ?".Util::$typeStrings[$found[0]['type']].'='.$found[0]['data'][0]['Id']); + // die(); + // } + + $vars = array( + 'title' => $search.' - '.Lang::$search['search'], + 'tab' => 0 // tabId 0: Database for g_initHeader($tab) + ); + + $smarty->updatePageVars($vars); + $smarty->assign('lang', array_merge(Lang::$main, Lang::$search)); + $smarty->assign('found', $found); + $smarty->assign('data', $jsGlobals); + $smarty->assign('search', $search); + $smarty->assign('mysql', DB::Aowow()->getStatistics()); + $smarty->assign('util', new Util); // just for debugging / optimizing + + $smarty->display('search.tpl'); +} + +?> diff --git a/template/bricks/allclasses_table.tpl b/template/bricks/allclasses_table.tpl new file mode 100644 index 00000000..522d0621 --- /dev/null +++ b/template/bricks/allclasses_table.tpl @@ -0,0 +1,6 @@ +var _ = g_classes; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim}name_{$user.language}:'{$item|escape:"javascript"}'{rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/allcurrencies_table.tpl b/template/bricks/allcurrencies_table.tpl new file mode 100644 index 00000000..461d3223 --- /dev/null +++ b/template/bricks/allcurrencies_table.tpl @@ -0,0 +1,8 @@ +{strip} + +var _ = g_gatheredcurrencies; +{foreach from=$data key=id item=item} + _[{$id}]={ldelim}icon:'{$item.icon|escape:"javascript"}',name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim}; +{/foreach} + +{/strip} \ No newline at end of file diff --git a/template/bricks/allitems_table.tpl b/template/bricks/allitems_table.tpl new file mode 100644 index 00000000..efbdc659 --- /dev/null +++ b/template/bricks/allitems_table.tpl @@ -0,0 +1,10 @@ +var _ = g_items; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + icon:'{$item.icon|escape:"javascript"}', + name_{$user.language}:'{$item.name|escape:"javascript"}' + {if isset($item.quality)}, quality:'{$item.quality}'{/if} + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/allraces_table.tpl b/template/bricks/allraces_table.tpl new file mode 100644 index 00000000..eaae9168 --- /dev/null +++ b/template/bricks/allraces_table.tpl @@ -0,0 +1,6 @@ +var _ = g_races; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim}name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/class_table.tpl b/template/bricks/class_table.tpl new file mode 100644 index 00000000..fb334488 --- /dev/null +++ b/template/bricks/class_table.tpl @@ -0,0 +1,37 @@ +{strip} + new Listview({ldelim} + template:'classs', + {if !isset($params.id)}id:'classes',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_classes,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + id:{$curr.Id}, + name:'{$curr.name|escape:"javascript"}', + races:{$curr.races}, + roles:{$curr.roles}, + power:{$curr.power}, + weapon:{$curr.weapon}, + armor:{$curr.armor} + {if isset($curr.hero)} + ,hero:1 + {/if} + {if isset($curr.expansion)} + ,expansion:{$curr.expansion} + {/if} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} \ No newline at end of file diff --git a/template/bricks/currency_table.tpl b/template/bricks/currency_table.tpl new file mode 100644 index 00000000..6503d56e --- /dev/null +++ b/template/bricks/currency_table.tpl @@ -0,0 +1,28 @@ +{strip} + new Listview({ldelim} + template:'currency', + {if !isset($params.id)}id:'currencies',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_currencies,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + id:{$curr.Id}, + category:{$curr.category}, + name:'{$curr.name|escape:"javascript"}', + icon:'{$curr.icon}', + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} \ No newline at end of file diff --git a/template/bricks/item_table.tpl b/template/bricks/item_table.tpl new file mode 100644 index 00000000..4cdfa5a8 --- /dev/null +++ b/template/bricks/item_table.tpl @@ -0,0 +1,114 @@ +{strip} + new Listview({ldelim} + template:'item', + {if !isset($params.id)}id:'items',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_items,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + name:'{$curr.quality}{$curr.name|escape:"quotes"}', + {if isset($curr.level)} + level:{$curr.level}, + {/if} + {if isset($curr.reqlevel)} + reqlevel:{$curr.reqlevel}, + {/if} + classs:{$curr.classs}, + subclass:{$curr.subclass}, + {if isset($curr.maxcount)} + {if $curr.maxcount>1} + stack:[{$curr.mincount},{$curr.maxcount}], + {/if} + {/if} + {if isset($curr.percent)} + percent:{$curr.percent}, + {/if} + {if isset($curr.group) and isset($curr.groupcount)} + group:'({$curr.group}){if $curr.groupcount!=1} x{$curr.groupcount}{/if}', + {/if} + {if isset($curr.cost.money) || isset($curr.cost.honor) ||isset($curr.cost.arena) || isset($curr.cost.items)} + stock:-1, + cost:[ + {if isset($curr.cost.money)}{$curr.cost.money}{/if} + {if isset($curr.cost.honor) or isset($curr.cost.arena) or isset($curr.cost.items)} + ,{if isset($curr.cost.honor)}{$curr.cost.honor}{/if} + {if isset($curr.cost.arena) or isset($curr.cost.items)} + ,{if isset($curr.cost.arena)}{$curr.cost.arena}{/if} + {if isset($curr.cost.items)} + ,[ + {foreach from=$curr.cost.items item=curitem name=c} + [{$curitem.item},{$curitem.count}] + {if $smarty.foreach.c.last}{else},{/if} + {/foreach} + ] + {/if} + {/if} + {/if} + ], + {/if} + {if $curr.classs == 1} + nslots:{$curr.nslots}, + {/if} + {if $curr.classs == 2} + dps:{$curr.dps}, + speed:{$curr.speed}, + {/if} + {if $curr.classs == 4} + armor:{$curr.armor}, + {/if} + {if isset($curr.slot)} + slot:{$curr.slot}, + slotbak:{$curr.slotbak}, + {/if} + id:{$curr.id} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} + +{* 4.3 loot-example + + template: 'item', + id: 'drops', + name: LANG.tab_drops, + tabs: tabsRelated, + parent: 'lkljbjkb574', + extraCols: [Listview.extraCols.count, Listview.extraCols.percent], + sort:['-percent', 'name'], + _totalCount: 448092, /* total # creature killed/looted */ + computeDataFunc: Listview.funcBox.initLootTable, + onAfterCreate: Listview.funcBox.addModeIndicator, + data: [ + { + "classs":15, /* Tab Type */ + "commondrop":true, /* loot filtered as "not noteworthy" */ + "id":25445, + "level":1, + "name":"7Wretched Ichor", + "slot":0, + "source":[2], /* 1: crafted; 2:zonedrop; 3:pvp; 4:quest; 5: Vendors; 6:Trainer; 7:Discovery; 8:Redemption; 9: Talent; 10:Starter; 11: Event; 12:Achievement; */ + "sourcemore":[{"z":3520}], /* z: zone... */ + "subclass":0, /* Tab:Type */ + modes:{ + "mode":4, /* &1: heroic; &4: noteworthy(?); &8: reg10; &16: reg25; &32: hc10; &64: hc25; &128: RaidFinder */ + "4":{"count":363318,"outof":448092} /* calculate pct chance */ + }, + count:363318, + stack:[1,1], /* [min, max] */ + pctstack:'{1: 50.0123,2: 49.9877}' /* {dropCount: relChanceForThisStack} */ + } + ] +}); +*} \ No newline at end of file diff --git a/template/bricks/itemset_table.tpl b/template/bricks/itemset_table.tpl new file mode 100644 index 00000000..ed26b6a6 --- /dev/null +++ b/template/bricks/itemset_table.tpl @@ -0,0 +1,33 @@ +{strip} + new Listview({ldelim} + template:'itemset', + {if !isset($params.id)}id:'itemsets',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_itemsets,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + name:'{$curr.quality}{$curr.name|escape:"quotes"}', + {if $curr.minlevel}minlevel:{$curr.minlevel},{/if} + {if $curr.maxlevel}maxlevel:{$curr.maxlevel},{/if} + {if $curr.classes}classes:[{section name=j loop=$curr.classes}{$curr.classes[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if} + {if $curr.reqclass}reqclass:{$curr.reqclass},{/if} + {if $curr.note}note:{$curr.note},{/if} + {if $curr.pieces}pieces:[{section name=j loop=$curr.pieces}{$curr.pieces[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if} + {if isset($curr.type)}type:{$curr.type},{/if} + id:{$curr.Id} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/race_table.tpl b/template/bricks/race_table.tpl new file mode 100644 index 00000000..553d0e2f --- /dev/null +++ b/template/bricks/race_table.tpl @@ -0,0 +1,34 @@ +{strip} + new Listview({ldelim} + template:'race', + {if !isset($params.id)}id:'races',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_races,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + id:{$curr.Id}, + name:'{$curr.name|escape:"javascript"}', + classes:{$curr.classes}, + faction:{$curr.faction}, + leader:{$curr.leader}, + zone:{$curr.zone}, + side:{$curr.side} + {if isset($curr.expansion)} + ,expansion:{$curr.expansion} + {/if} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/title_table.tpl b/template/bricks/title_table.tpl index 5d075dbf..4c3ac267 100644 --- a/template/bricks/title_table.tpl +++ b/template/bricks/title_table.tpl @@ -2,6 +2,9 @@ new Listview({ldelim} template:'title', {if !isset($params.id)}id:'titles',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_titles,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} {if isset($params.note)}_truncated: 1,{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} @@ -13,12 +16,12 @@ data:[ {foreach name=i from=$data item=curr} {ldelim} + id:{$curr.Id}, + name:'{$curr.name|escape:"javascript"}', category:{$curr.category}, expansion:{$curr.expansion}, gender:{$curr.gender}, - id:{$curr.id}, - side:{$curr.side}, - name:'{$curr.name|escape:"javascript"}' + side:{$curr.side} {if isset($curr.namefemale)} , namefemale:'{$curr.namefemale|escape:"javascript"}' {/if} diff --git a/template/search.tpl b/template/search.tpl new file mode 100644 index 00000000..e216e441 --- /dev/null +++ b/template/search.tpl @@ -0,0 +1,51 @@ +{include file='header.tpl'} + +
+ +
+ +
+
+ WowheadWowhead + {if !empty($found)} +

{$lang.foundResult} {$search|escape:"html"}

+
+
+
+ + {else} +

{$lang.noResult} {$search|escape:"html"}

+ + {$lang.tryAgain} + {/if} +
+ +
+ +
+ +{include file='footer.tpl'}