mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
search:
- search input is now handled as whitespace separated list of search terms (was direct input) - substrings prefixed with '-' must not be matched - substrings with a content length of less than 3 are ignored
This commit is contained in:
@@ -242,8 +242,8 @@ class AchievementListFilter extends Filter
|
||||
{
|
||||
if (in_array($cr[0], array_keys($this->genericFilter)))
|
||||
{
|
||||
if ($genCR = $this->genericCriterion($cr))
|
||||
return $genCR;
|
||||
if ($genCr = $this->genericCriterion($cr))
|
||||
return $genCr;
|
||||
|
||||
unset($cr);
|
||||
$this->error = true;
|
||||
@@ -281,10 +281,14 @@ class AchievementListFilter extends Filter
|
||||
// name ex: +description, +rewards
|
||||
if (isset($_v['na']))
|
||||
{
|
||||
$_ = [];
|
||||
if (isset($_v['ex']) && $_v['ex'] == 'on')
|
||||
$parts[] = ['OR', ['name_loc'.User::$localeId, $_v['na']], ['description_loc'.User::$localeId, $_v['na']], ['reward_loc'.User::$localeId, $_v['na']]];
|
||||
$_ = $this->modularizeString(['name_loc'.User::$localeId, 'reward_loc'.User::$localeId, 'description_loc'.User::$localeId]);
|
||||
else
|
||||
$parts[] = ['name_loc'.User::$localeId, $_v['na']];
|
||||
$_ = $this->modularizeString(['name_loc'.User::$localeId]);
|
||||
|
||||
if ($_)
|
||||
$parts[] = $_;
|
||||
}
|
||||
|
||||
// points min
|
||||
|
||||
@@ -747,6 +747,55 @@ abstract class Filter
|
||||
}
|
||||
}
|
||||
|
||||
protected function modularizeString(array $fields, $string = '')
|
||||
{
|
||||
if (!$string)
|
||||
$string = $this->fiData['v']['na'];
|
||||
|
||||
$qry = [];
|
||||
$valid = false;
|
||||
foreach ($fields as $n => $f)
|
||||
{
|
||||
$sub = [];
|
||||
$parts = explode(' ', $string);
|
||||
|
||||
foreach ($parts as $p)
|
||||
{
|
||||
if ($p[0] == '-' && strlen($p) > 3)
|
||||
$sub[] = [$f, substr($p, 1), '!'];
|
||||
else if ($p[0] != '-' && strlen($p) > 2)
|
||||
{
|
||||
$valid = true;
|
||||
$sub[] = [$f, $p];
|
||||
}
|
||||
}
|
||||
|
||||
// single cnd?
|
||||
if (!$sub)
|
||||
continue;
|
||||
else if (count($sub) > 1)
|
||||
array_unshift($sub, 'AND');
|
||||
else
|
||||
$sub = $sub[0];
|
||||
|
||||
$qry[] = $sub;
|
||||
}
|
||||
|
||||
if (!$valid) // no +term with length >= 3 set
|
||||
{
|
||||
$this->error = 1;
|
||||
return [];
|
||||
}
|
||||
|
||||
// single cnd?
|
||||
if (count($qry) > 1)
|
||||
array_unshift($qry, 'OR');
|
||||
else
|
||||
$qry = $qry[0];
|
||||
|
||||
return $qry;
|
||||
}
|
||||
|
||||
protected function int2Op(&$op)
|
||||
{
|
||||
switch ($op)
|
||||
@@ -824,9 +873,10 @@ abstract class Filter
|
||||
|
||||
private function genericString($field, $value, $localized)
|
||||
{
|
||||
$field .= $localized ? '_loc'.User::$localeId : null;
|
||||
|
||||
if (!$localized)
|
||||
return [$field, (string)$value];
|
||||
|
||||
return $this->modularizeString([$field.'_loc'.User::$localeId], $value);
|
||||
}
|
||||
|
||||
private function genericNumeric($field, &$value, $op, $castInt)
|
||||
|
||||
@@ -261,8 +261,8 @@ class CreatureListFilter extends Filter
|
||||
{
|
||||
if (in_array($cr[0], array_keys($this->genericFilter)))
|
||||
{
|
||||
if ($genCR = $this->genericCriterion($cr))
|
||||
return $genCR;
|
||||
if ($genCr = $this->genericCriterion($cr))
|
||||
return $genCr;
|
||||
|
||||
unset($cr);
|
||||
$this->error = true;
|
||||
@@ -439,10 +439,14 @@ class CreatureListFilter extends Filter
|
||||
// name [str]
|
||||
if (isset($_v['na']))
|
||||
{
|
||||
$_ = [];
|
||||
if (isset($_v['ex']) && $_v['ex'] == 'on')
|
||||
$parts[] = ['OR', ['name_loc'.User::$localeId, $_v['na']], ['subname_loc'.User::$localeId, $_v['na']]];
|
||||
$_ = $this->modularizeString(['name_loc'.User::$localeId, 'subname_loc'.User::$localeId]);
|
||||
else
|
||||
$parts[] = ['name_loc'.User::$localeId, $_v['na']];
|
||||
$_ = $this->modularizeString(['name_loc'.User::$localeId]);
|
||||
|
||||
if ($_)
|
||||
$parts[] = $_;
|
||||
}
|
||||
|
||||
// pet family [list]
|
||||
|
||||
@@ -1553,7 +1553,7 @@ class ItemListFilter extends Filter
|
||||
|
||||
public function createConditionsForWeights(&$data)
|
||||
{
|
||||
if (count($data['wt']) != count($data['wtv']))
|
||||
if (!$data['wt'] || !$data['wtv'] || count($data['wt']) != count($data['wtv']))
|
||||
return null;
|
||||
|
||||
$select = $cnd = [];
|
||||
@@ -1598,8 +1598,8 @@ class ItemListFilter extends Filter
|
||||
{
|
||||
if (in_array($cr[0], array_keys($this->genericFilter)))
|
||||
{
|
||||
if ($genCR = $this->genericCriterion($cr))
|
||||
return $genCR;
|
||||
if ($genCr = $this->genericCriterion($cr))
|
||||
return $genCr;
|
||||
|
||||
unset($cr);
|
||||
$this->error = true;
|
||||
@@ -1678,6 +1678,7 @@ class ItemListFilter extends Filter
|
||||
break;
|
||||
case 124: // randomenchants [str]
|
||||
// joining this in one step results in hell .. so .. two steps
|
||||
// todo (low): in _theory_ Filter::modularizeString() should also be applied here
|
||||
$randIds = DB::Aowow()->selectCol('SELECT IF (ire.id > 0, iet.entry, -iet.entry) FROM item_enchantment_template iet JOIN ?_itemrandomenchant ire ON ABS(ire.id) = iet.ench WHERE ire.name_loc'.User::$localeId.' LIKE ?', '%'.$cr[2].'%');
|
||||
|
||||
if ($randIds)
|
||||
@@ -1918,7 +1919,8 @@ class ItemListFilter extends Filter
|
||||
|
||||
// name
|
||||
if (isset($_v['na']))
|
||||
$parts[] = ['name_loc'.User::$localeId, $_v['na']];
|
||||
if ($_ = $this->modularizeString(['name_loc'.User::$localeId]))
|
||||
$parts[] = $_;
|
||||
|
||||
// usable-by (not excluded by requiredClass && armor or weapons match mask from ?_classes)
|
||||
if (isset($_v['ub']))
|
||||
|
||||
@@ -382,8 +382,8 @@ class QuestListFilter extends Filter
|
||||
{
|
||||
if (in_array($cr[0], array_keys($this->genericFilter)))
|
||||
{
|
||||
if ($genCR = $this->genericCriterion($cr))
|
||||
return $genCR;
|
||||
if ($genCr = $this->genericCriterion($cr))
|
||||
return $genCr;
|
||||
|
||||
unset($cr);
|
||||
$this->error = true;
|
||||
|
||||
@@ -1832,8 +1832,8 @@ class SpellListFilter extends Filter
|
||||
{
|
||||
if (in_array($cr[0], array_keys($this->genericFilter)))
|
||||
{
|
||||
if ($genCR = $this->genericCriterion($cr))
|
||||
return $genCR;
|
||||
if ($genCr = $this->genericCriterion($cr))
|
||||
return $genCr;
|
||||
|
||||
unset($cr);
|
||||
$this->error = true;
|
||||
@@ -1889,10 +1889,14 @@ class SpellListFilter extends Filter
|
||||
//string (extended)
|
||||
if (isset($_v['na']))
|
||||
{
|
||||
$_ = [];
|
||||
if (isset($_v['ex']) && $_v['ex'] == 'on')
|
||||
$parts[] = ['OR', ['name_loc'.User::$localeId, $_v['na']], ['buff_loc'.User::$localeId, $_v['na']], ['description_loc'.User::$localeId, $_v['na']]];
|
||||
$_ = $this->modularizeString(['name_loc'.User::$localeId, 'buff_loc'.User::$localeId, 'description_loc'.User::$localeId]);
|
||||
else
|
||||
$parts[] = ['name_loc'.User::$localeId, $_v['na']];
|
||||
$_ = $this->modularizeString(['name_loc'.User::$localeId]);
|
||||
|
||||
if ($_)
|
||||
$parts[] = $_;
|
||||
}
|
||||
|
||||
// spellLevel min todo (low): talentSpells (typeCat -2) commonly have spellLevel 1 (and talentLevel >1) -> query is inaccurate
|
||||
|
||||
@@ -20,6 +20,8 @@ class ZoneList extends BaseType
|
||||
{
|
||||
$data = [];
|
||||
/*
|
||||
UPDATE dbc.worldmaparea a, world.aowow_zones z SET yMax = `left`, xMax = top, yMin = `right`, xMin = bottom WHERE a.areaId = z.id;
|
||||
|
||||
LFG_TYPE_NONE = 0, // Internal use only
|
||||
LFG_TYPE_DUNGEON = 1,
|
||||
LFG_TYPE_RAID = 2,
|
||||
|
||||
@@ -120,6 +120,7 @@ $lang = array(
|
||||
'foundResult' => "Suchergebnisse für",
|
||||
'noResult' => "Keine Ergebnisse für",
|
||||
'tryAgain' => "Bitte versucht es mit anderen Suchbegriffen oder überprüft deren Schreibweise.",
|
||||
'ignoredTerms' => "Die folgenden Wörter wurden in Eurer Suche ignoriert: %s"
|
||||
),
|
||||
'game' => array(
|
||||
'achievement' => "Erfolg",
|
||||
|
||||
@@ -107,6 +107,7 @@ $lang = array(
|
||||
'foundResult' => "Search Results for",
|
||||
'noResult' => "No Results for",
|
||||
'tryAgain' => "Please try some different keywords or check your spelling.",
|
||||
'ignoredTerms' => "The following words were ignored in your search: %s"
|
||||
),
|
||||
'game' => array(
|
||||
'achievement' => "achievement",
|
||||
|
||||
@@ -112,6 +112,7 @@ $lang = array(
|
||||
'foundResult' => "Resultados de busqueda para",
|
||||
'noResult' => "Ningún resultado para",
|
||||
'tryAgain' => "Por favor, introduzca otras palabras claves o verifique el término ingresado.",
|
||||
'ignoredTerms' => "Las siguientes palabras fueron ignoradas en tu búsqueda: %s"
|
||||
),
|
||||
'game' => array(
|
||||
'achievement' => "logro",
|
||||
|
||||
@@ -112,6 +112,7 @@ $lang = array(
|
||||
'foundResult' => "Résultats de recherche pour",
|
||||
'noResult' => "Aucun résultat pour malordawsne",
|
||||
'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.",
|
||||
'ignoredTerms' => "Les mots suivants ont été ignorés dans votre recherches : %s"
|
||||
),
|
||||
'game' => array (
|
||||
'achievement' => "haut fait",
|
||||
|
||||
@@ -112,6 +112,7 @@ $lang = array(
|
||||
'foundResult' => "Результаты поиска для",
|
||||
'noResult' => "Ничего не найдено для",
|
||||
'tryAgain' => "Пожалуйста, попробуйте другие ключевые слова или проверьте правильность запроса.",
|
||||
'ignoredTerms' => "[Следующие слова были проигнорированы в вашему запросу]: %s"
|
||||
),
|
||||
'game' => array(
|
||||
'achievement' => "достижение",
|
||||
|
||||
200
search.php
200
search.php
@@ -16,7 +16,7 @@ if (!defined('AOWOW_REVISION'))
|
||||
[], // unused
|
||||
[], // unused
|
||||
[], // unused
|
||||
str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10,17:icon, 5:faction), param2 (3:quality, 6:rank)
|
||||
str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10,17:icon, 5,11:faction), param2 (3:quality, 6:rank)
|
||||
]
|
||||
else
|
||||
=> listviews
|
||||
@@ -27,8 +27,6 @@ todo 26: Listview - template: 'profile', id: 'characters', name: LANG.
|
||||
29: Arena Teams..?
|
||||
*/
|
||||
|
||||
$search = urlDecode(trim($pageParam));
|
||||
$query = Util::sqlEscape(str_replace('?', '_', str_replace('*', '%', ($search))), true);
|
||||
$type = @intVal($_GET['type']);
|
||||
$searchMask = 0x0;
|
||||
$found = [];
|
||||
@@ -39,6 +37,65 @@ $_wt = isset($_GET['wt']) ? explode(':', $_GET['wt']) : null;
|
||||
$_wtv = isset($_GET['wtv']) ? explode(':', $_GET['wtv']) : null;
|
||||
$_slots = [];
|
||||
|
||||
$search = urlDecode(trim($pageParam));
|
||||
$query = Util::sqlEscape(str_replace('?', '_', str_replace('*', '%', ($search))), true);
|
||||
$invalid = [];
|
||||
$include = [];
|
||||
$exclude = [];
|
||||
|
||||
$parts = explode(' ', $query);
|
||||
foreach ($parts as $p)
|
||||
{
|
||||
if ($p[0] == '-')
|
||||
{
|
||||
if (strlen($p) < 4)
|
||||
$invalid[] = $p;
|
||||
else
|
||||
$exclude[] = substr($p, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($p) < 3)
|
||||
$invalid[] = $p;
|
||||
else
|
||||
$include[] = $p;
|
||||
}
|
||||
}
|
||||
|
||||
$createLookup = function(array $fields = []) use($include, $exclude)
|
||||
{
|
||||
// default to name-field
|
||||
if (!$fields)
|
||||
$fields[] = 'name_loc'.User::$localeId;
|
||||
|
||||
$qry = [];
|
||||
foreach ($fields as $n => $f)
|
||||
{
|
||||
$sub = [];
|
||||
foreach ($include as $i)
|
||||
$sub[] = [$f, $i];
|
||||
|
||||
foreach ($exclude as $x)
|
||||
$sub[] = [$f, $x, '!'];
|
||||
|
||||
// single cnd?
|
||||
if (count($sub) > 1)
|
||||
array_unshift($sub, 'AND');
|
||||
else
|
||||
$sub = $sub[0];
|
||||
|
||||
$qry[] = $sub;
|
||||
}
|
||||
|
||||
// single cnd?
|
||||
if (count($qry) > 1)
|
||||
array_unshift($qry, 'OR');
|
||||
else
|
||||
$qry = $qry[0];
|
||||
|
||||
return $qry;
|
||||
};
|
||||
|
||||
if (isset($_GET['json']))
|
||||
{
|
||||
if ($_ = intVal($search)) // allow for search by Id
|
||||
@@ -75,7 +132,7 @@ if (!User::isInGroup(U_GROUP_STAFF))
|
||||
$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)) && !($searchMask & SEARCH_TYPE_JSON && intVal($search)))
|
||||
if ((!$include || !($searchMask & SEARCH_MASK_ALL)) && !($searchMask & SEARCH_TYPE_JSON && intVal($search)))
|
||||
{
|
||||
if ($searchMask & SEARCH_TYPE_REGULAR)
|
||||
{
|
||||
@@ -86,7 +143,8 @@ if ((strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL)) && !($searchMask &
|
||||
// insufficient queries throw an error
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$search));
|
||||
$smarty->assign('found', []);
|
||||
$smarty->assign('search', $query);
|
||||
$smarty->assign('search', $search);
|
||||
$smarty->assign('ignored', implode(', ', $invalid));
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
die();
|
||||
@@ -108,8 +166,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 1 Classes:
|
||||
if ($searchMask & 0x00000001)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$classes = new CharClassList($cnd);
|
||||
|
||||
if ($data = $classes->getListviewData())
|
||||
@@ -143,8 +200,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
zone: starting zone...
|
||||
*/
|
||||
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$races = new CharRaceList($cnd);
|
||||
|
||||
if ($data = $races->getListviewData())
|
||||
@@ -180,18 +236,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
source: {} // g_sources .. holy cow.. that will cost some nerves
|
||||
*/
|
||||
|
||||
$sources = array(
|
||||
4 => [], // Quest
|
||||
12 => [], // Achievement
|
||||
13 => [] // DB-Text
|
||||
);
|
||||
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'OR',
|
||||
['male_loc'.User::$localeId, $query],
|
||||
['female_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup(['male_loc'.User::$localeId, 'female_loc'.User::$localeId])]);
|
||||
$titles = new TitleList($cnd);
|
||||
|
||||
if ($data = $titles->getListviewData())
|
||||
@@ -225,10 +270,13 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'OR',
|
||||
['h.name_loc'.User::$localeId, $query],
|
||||
['AND', ['e.description', $query], ['e.holidayId', 0]]
|
||||
$createLookup(['h.name_loc'.User::$localeId]),
|
||||
[
|
||||
'AND',
|
||||
$createLookup(['e.description']),
|
||||
['e.holidayId', 0]
|
||||
]
|
||||
));
|
||||
|
||||
$wEvents = new WorldEventList($cnd);
|
||||
|
||||
if ($data = $wEvents->getListviewData())
|
||||
@@ -264,8 +312,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 5 Currencies
|
||||
if ($searchMask & 0x0000010)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$money = new CurrencyList($cnd);
|
||||
|
||||
if ($data = $money->getListviewData())
|
||||
@@ -294,8 +341,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
if ($searchMask & 0x0000020)
|
||||
{
|
||||
// ['item1', 0, '!'], // remove empty sets from search, set in cuFlags
|
||||
$cnd = array_merge($cndBase, [is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [is_int($query) ? ['id', $query] : $createLookup()]);
|
||||
$sets = new ItemsetList($cnd);
|
||||
|
||||
if ($data = $sets->getListviewData())
|
||||
@@ -327,7 +373,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
if ($searchMask & 0x0000040)
|
||||
{
|
||||
$miscData = [];
|
||||
$cndAdd = empty($query) ? [] : (is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query]);
|
||||
$cndAdd = empty($query) ? [] : (is_int($query) ? ['id', $query] : $createLookup());
|
||||
|
||||
if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && isset($found['itemset']))
|
||||
{
|
||||
@@ -336,7 +382,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
}
|
||||
else if (($searchMask & SEARCH_TYPE_JSON) && ($type == TYPE_ITEM || $_slots))
|
||||
{
|
||||
$iCnd = ['AND', ['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]], $cndAdd];
|
||||
$iCnd = [['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]], $cndAdd];
|
||||
if ($_slots)
|
||||
$iCnd[] = ['slot', $_slots];
|
||||
|
||||
@@ -389,13 +435,11 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
if ($searchMask & 0x0000080)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array( // hmm, inclued classMounts..?
|
||||
'AND',
|
||||
['s.typeCat', [7, -2, -3]],
|
||||
[['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT), '&'], 0],
|
||||
[['s.attributes0', 0x80, '&'], 0],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
$createLookup()
|
||||
));
|
||||
|
||||
$abilities = new SpellList($cnd);
|
||||
|
||||
if ($data = $abilities->getListviewData())
|
||||
@@ -437,12 +481,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 9 Talents (Player + Pet)
|
||||
if ($searchMask & 0x0000100)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.typeCat', [-7, -2]],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', [-7, -2]], $createLookup()]);
|
||||
$talents = new SpellList($cnd);
|
||||
|
||||
if ($data = $talents->getListviewData())
|
||||
@@ -484,12 +523,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 10 Glyphs
|
||||
if ($searchMask & 0x0000200)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.typeCat', -13],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', -13], $createLookup()]);
|
||||
$glyphs = new SpellList($cnd);
|
||||
|
||||
if ($data = $glyphs->getListviewData())
|
||||
@@ -524,12 +558,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 11 Proficiencies
|
||||
if ($searchMask & 0x0000400)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.typeCat', -11],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', -11], $createLookup()]);
|
||||
$prof = new SpellList($cnd);
|
||||
|
||||
if ($data = $prof->getListviewData())
|
||||
@@ -564,12 +593,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 12 Professions (Primary + Secondary)
|
||||
if ($searchMask & 0x0000800)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.typeCat', [9, 11]],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', [9, 11]], $createLookup()]);
|
||||
$prof = new SpellList($cnd);
|
||||
|
||||
if ($data = $prof->getListviewData())
|
||||
@@ -604,12 +628,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 13 Companions
|
||||
if ($searchMask & 0x0001000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.typeCat', -6],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', -6], $createLookup()]);
|
||||
$vPets = new SpellList($cnd);
|
||||
|
||||
if ($data = $vPets->getListviewData())
|
||||
@@ -644,12 +663,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 14 Mounts
|
||||
if ($searchMask & 0x0002000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.typeCat', -5],
|
||||
['s.name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', -5], $createLookup()]);
|
||||
$mounts = new SpellList($cnd);
|
||||
|
||||
if ($data = $mounts->getListviewData())
|
||||
@@ -684,8 +698,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
if ($searchMask & 0x0004000)
|
||||
{
|
||||
// [['cuFlags', MASKE, '&'], 0], // todo (med): exclude trigger creatures and difficulty entries
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$npcs = new CreatureList($cnd);
|
||||
|
||||
if ($data = $npcs->getListviewData())
|
||||
@@ -720,7 +733,6 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
[User::$localeId ? 'lq.Title_loc'.User::$localeId : 'Title', $query],
|
||||
$maxResults
|
||||
);
|
||||
|
||||
$quests = new QuestList($cnd);
|
||||
|
||||
if ($data = $quests->getListviewData())
|
||||
@@ -747,12 +759,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 17 Achievements
|
||||
if ($searchMask & 0x0010000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
[['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], 0],
|
||||
['name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [[['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], 0], $createLookup()]);
|
||||
$acvs = new AchievementList($cnd);
|
||||
|
||||
if ($data = $acvs->getListviewData())
|
||||
@@ -785,12 +792,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 18 Statistics
|
||||
if ($searchMask & 0x0020000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['flags', ACHIEVEMENT_FLAG_COUNTER, '&'],
|
||||
['name_loc'.User::$localeId, $query]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], $createLookup()]);
|
||||
$stats = new AchievementList($cnd);
|
||||
|
||||
if ($data = $stats->getListviewData())
|
||||
@@ -822,8 +824,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 19 Zones
|
||||
if ($searchMask & 0x0040000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$zones = new ZoneList($cnd);
|
||||
|
||||
if ($data = $zones->getListviewData())
|
||||
@@ -852,8 +853,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 20 Objects
|
||||
if ($searchMask & 0x0080000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$objects = new GameObjectList($cnd);
|
||||
|
||||
if ($data = $objects->getListviewData())
|
||||
@@ -882,8 +882,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 21 Factions
|
||||
if ($searchMask & 0x0100000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$factions = new FactionList($cnd);
|
||||
|
||||
if ($data = $factions->getListviewData())
|
||||
@@ -910,8 +909,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 22 Skills
|
||||
if ($searchMask & 0x0200000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$skills = new SkillList($cnd);
|
||||
|
||||
if ($data = $skills->getListviewData())
|
||||
@@ -941,8 +939,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 23 Pets
|
||||
if ($searchMask & 0x0400000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]);
|
||||
|
||||
$cnd = array_merge($cndBase, [$createLookup()]);
|
||||
$pets = new PetList($cnd);
|
||||
|
||||
if ($data = $pets->getListviewData())
|
||||
@@ -970,12 +967,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 24 NPCAbilities
|
||||
if ($searchMask & 0x0800000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.name_loc'.User::$localeId, $query],
|
||||
['s.typeCat', -8]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', -8], $createLookup()]);
|
||||
$npcAbilities = new SpellList($cnd);
|
||||
|
||||
if ($data = $npcAbilities->getListviewData())
|
||||
@@ -1011,12 +1003,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
// 25 Spells (Misc + GM)
|
||||
if ($searchMask & 0x1000000)
|
||||
{
|
||||
$cnd = array_merge($cndBase, array(
|
||||
'AND',
|
||||
['s.name_loc'.User::$localeId, $query],
|
||||
['s.typeCat', [0, -9]]
|
||||
));
|
||||
|
||||
$cnd = array_merge($cndBase, [['s.typeCat', [0, -9]], $createLookup()]);
|
||||
$misc = new SpellList($cnd);
|
||||
|
||||
if ($data = $misc->getListviewData())
|
||||
@@ -1177,6 +1164,7 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$search));
|
||||
$smarty->assign('found', $found);
|
||||
$smarty->assign('search', $search);
|
||||
$smarty->assign('ignored', implode(', ', $invalid));
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<div id="main">
|
||||
<div id="main-precontents"></div>
|
||||
<div class="main-contents" id="main-contents">
|
||||
|
||||
{if !empty($announcements)}
|
||||
{foreach from=$announcements item=item}
|
||||
{include file='bricks/announcement.tpl' an=$item}
|
||||
@@ -11,7 +12,7 @@
|
||||
<div class="text">
|
||||
<a href="{$wowhead}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
|
||||
{if !empty($found)}
|
||||
<h1>{$lang.foundResult} <i>{$search|escape:"html"}</i></h1>
|
||||
<h1>{$lang.foundResult} <i>{$search|escape:"html"}</i>{if $ignored}<span class="sub">{$lang.ignoredTerms|sprintf:$ignored}</span>{/if}</h1>
|
||||
</div>
|
||||
<div id="tabs-generic"></div>
|
||||
<div id="lv-generic" class="listview"></div>
|
||||
@@ -23,7 +24,7 @@
|
||||
myTabs.flush();
|
||||
</script>
|
||||
{else}
|
||||
<h1>{$lang.noResult} <i>{$search|escape:"html"}</i></h1>
|
||||
<h1>{$lang.noResult} <i>{$search|escape:"html"}</i>{if $ignored}<span class="sub">{$lang.ignoredTerms|sprintf:$ignored}</span>{/if}</h1>
|
||||
<div class="search-noresults"/></div>
|
||||
|
||||
{$lang.tryAgain}
|
||||
|
||||
Reference in New Issue
Block a user