2 include_once("include/functions.php");
3 include_once("include/report_generator.php");
5 // Îïðåäåëÿåì ðåæèì ïîèñêà
6 $allmode = @$_REQUEST['s']=='all';
8 // Ñîçäà¸ì ññûëêó íà ñòðàíèöó, èãíîðèðóåì äåôîëòíûå çíà÷åíèÿ
9 $FindRefrence = "?s=s";
11 $show_fields = array('SPELL_REPORT_ICON','SPELL_REPORT_NAME','SPELL_REPORT_SCHOOL');
12 //==============================================================================
13 // Ñîçäà¸ì SQL çàïðîñ èñõîäÿ èç çàäàíûõ ïîëüçîâàòåëåì ïàðàìåòðîâ
14 //==============================================================================
17 if ($name = mysql_real_escape_string(@$_REQUEST['name']))
19 $filter.= " AND `SpellName` LIKE '%$name%'";
20 $FindRefrence.="&name=$name";
24 if ($desc = mysql_real_escape_string(@$_REQUEST['desc']))
26 $filter.= " AND `Description` LIKE '%$desc%'";
27 $FindRefrence.="&desc=$desc";
31 if ($mech = intval(@$_REQUEST['mech']))
33 $filter.= " AND (`Mechanic` = $mech OR `EffectMechanic_1` = $mech OR `EffectMechanic_2` = $mech OR `EffectMechanic_3` = $mech)";
34 $FindRefrence.="&mech=$mech";
38 if ($dispel = intval(@$_REQUEST['dispel']))
40 $filter.= " AND `Dispel` = $dispel";
41 $FindRefrence.="&dispel=$dispel";
45 if ($cat = intval(@$_REQUEST['cat']))
47 $filter.= " AND `Category` = $cat";
48 $FindRefrence.="&cat=$cat";
52 if ($focus = intval(@$_REQUEST['focus']))
54 $filter.= " AND `RequiresSpellFocus` = $focus";
55 $FindRefrence.="&focus=$focus";
58 // Spell apply form (aura == 36 - form == misc)
59 if ($form = intval(@$_REQUEST['form']))
61 $filter.= " AND ((`EffectApplyAuraName_1` = 36 AND `EffectMiscValue_1` = $form) OR (`EffectApplyAuraName_2` = 36 AND `EffectMiscValue_2` = $form) OR (`EffectApplyAuraName_3` = 36 AND `EffectMiscValue_3` = $form))";
62 $FindRefrence.="&form=$form";
65 // Spell apply form (aura == 36 - form == misc)
66 if ($lock = intval(@$_REQUEST['lock']))
69 (`Effect_1` = 33 AND `EffectMiscValue_1` = $lock) OR
70 (`Effect_2` = 33 AND `EffectMiscValue_2` = $lock) OR
71 (`Effect_3` = 33 AND `EffectMiscValue_3` = $lock))";
72 $FindRefrence.="&lock=$lock";
75 // Óáèðàåì íåíóæíûé AND â íà÷àëå ñòðîêè
76 $filter = substr($filter, 5);
78 // Âûâîä äèàëîãà ïîèñêà
79 if ($allmode==0 and $ajaxmode==0)
82 echo'<input name="s" type="hidden" value="s">';
83 echo'<table class=find>';
84 echo'<tr><td class=top colspan=2>';
85 echo'<table class=findtop><tr><td class=topleft> </td><td class=top>'.$lang['find_spell'].'</td><td class=topright> </td></tr></table>';
87 echo'<tr><td align="center">'.$lang['spell_name'].':</td><td><input class=ls_search alt="s" name="name" value="'.$name.'" size="35"></td></tr>';
88 echo'<tr><td align="center">'.$lang['spell_desc'].':</td><td><input name="desc" value="'.$desc.'" size="35"></td></tr>';
89 echo'<tr><td class=bottom colspan=2><input type=submit value="'.$lang['search'].'"></td></tr>';
96 $spell_search = new SpellReportGenerator
;
98 $spell_search->disableMark();
99 $spell_search->Init($show_fields, $FindRefrence, 'searchSpell', $config['fade_limit'], 'name');
100 $spell_search->doRequirest($filter);
101 $number = $spell_search->getTotalDataCount();
103 echo $lang['not_found'];
104 else if ($number == 1 && $allmode == 0) // Ïåðåíàïðàâëÿåì
105 echo '<meta http-equiv="refresh" content=1;URL=?spell='.$spell_search->data_array
[0]['id'].'>';
107 $spell_search->createReport($lang['search_results'].' - '.$lang['found'].' '.$number);