2 include_once("include/functions.php");
3 include_once("include/gameobject_table.php");
4 include_once("include/report_generator.php");
6 // Îïðåäåëÿåì ðåæèì ïîèñêà
7 $allmode = @$_REQUEST['s']=='all';
9 // Ñîçäà¸ì ññûëêó íà ñòðàíèöó, èãíîðèðóåì äåôîëòíûå çíà÷åíèÿ
10 $FindRefrence = "?s=o";
12 $show_fields = array('GO_REPORT_NAME','GO_REPORT_TYPE','GO_REPORT_MAP');
13 //==============================================================================
14 // Ñîçäà¸ì SQL çàïðîñ èñõîäÿ èç çàäàíûõ ïîëüçîâàòåëåì ïàðàìåòðîâ
15 //==============================================================================
18 if ($name = mysql_real_escape_string(@$_REQUEST['name']))
20 $filter.= " AND `name` like '%$name%'";
21 $FindRefrence.="&name=$name";
24 if ($spellFocus = intval(@$_REQUEST['focus']))
26 $filter.= " AND (`type` = ".GAMEOBJECT_TYPE_SPELL_FOCUS
." AND `data0` = $spellFocus)";
27 $FindRefrence.="&focus=$spellFocus";
31 $locks = intval(@$_REQUEST['lockSkill']);
32 $locki = intval(@$_REQUEST['lockItem']);
37 $lock = $wDB->selectCol(
38 "SELECT `id` FROM `wowd_lock`
40 (`keytype_0` = ?d AND `key_0` = ?d) OR
41 (`keytype_1` = ?d AND `key_1` = ?d) OR
42 (`keytype_2` = ?d AND `key_2` = ?d) OR
43 (`keytype_3` = ?d AND `key_3` = ?d) OR
44 (`keytype_4` = ?d AND `key_4` = ?d)",
45 $key, $locks, $key, $locks, $key, $locks, $key, $locks, $key, $locks);
48 $data0 = GAMEOBJECT_TYPE_QUESTGIVER
.",".GAMEOBJECT_TYPE_CHEST
.",".GAMEOBJECT_TYPE_TRAP
.",".GAMEOBJECT_TYPE_GOOBER
.",".GAMEOBJECT_TYPE_CAMERA
;
49 $data1 = GAMEOBJECT_TYPE_DOOR
.",".GAMEOBJECT_TYPE_BUTTON
;
50 $llist=join(", ", $lock);
51 $filter.= " AND ((`type` IN ($data0) AND `data0` IN ($llist)) OR (`type` IN ($data1) AND `data1` IN ($llist)))";
53 if ($locki) $FindRefrence.='&lockItem='.$locki;
54 if ($locks) $FindRefrence.='&lockSkill='.$locks;
58 if ($type = intval(@$_REQUEST['type']))
60 $filter.= " AND `type` = $type";
61 $FindRefrence.="&type=$type";
64 // Óáèðàåì íåíóæíûé AND â íà÷àëå ñòðîêè
65 $filter = substr($filter, 5);
66 // Âûâîä äèàëîãà ïîèñêà
67 if ($allmode==0 and $ajaxmode==0)
70 echo '<input name="s" type="hidden" value="o">';
71 echo '<table class=find>';
72 echo '<tr><td class=top colspan=2>';
73 echo '<table class=findtop><tr><td class=topleft> </td><td class=top>'.$lang['go_find'].'</td><td class=topright> </td></tr></table>';
75 echo '<tr><td align="center">'.$lang['go_name'].':</td><td><input class=ls_search alt=g name="name" value="'.$name.'" size=35></td></tr>';
76 echo '<tr><td class=bottom colspan=2><input type=submit value="'.$lang['search'].'"></td></tr>';
83 $go_search =& new GameobjectReportGenerator();
85 $go_search->disableMark();
86 //==============================================================================
87 // Ëîêàëèçàöèÿ çàïðîñà
88 //==============================================================================
89 if ($config['locales_lang'] > 0 && $name)
91 if (preg_match($config['locales_charset'], $name))
92 $filter = str_replace('`name`', '`name_loc'.$config['locales_lang'].'`', $filter);
94 $go_search->disableNameLocalisation();
96 $go_search->Init($show_fields, $FindRefrence, 'searchGo', $config['fade_limit'], 'name');
97 $go_search->doRequirest($filter);
98 $number = $go_search->getTotalDataCount();
100 echo $lang['not_found'];
101 else if ($number == 1 && $allmode == 0) // Ïåðåíàïðàâëÿåì
102 echo '<meta http-equiv="refresh" content=1;URL=?object='.$go_search->data_array
[0]['entry'].'>';
104 $go_search->createReport($lang['search_results'].' - '.$lang['found'].' '.$number);