Ignore:
Timestamp:
Aug 13, 2007, 9:05:34 PM (17 years ago)
Author:
george
Message:

Aktualizace MaNGOS Minimanageru na verzi 0.1.4a.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/game_object.php

    r5 r19  
    6363 global $lang_global, $lang_game_object, $output, $mangos_db, $realm_id, $go_type;
    6464
    65  $mysql = new MySQL;
    66  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    67 
    68  $result = $mysql->query("SELECT count(*) FROM gameobject_template");
    69  $tot_go = $mysql->result($result, 0);
    70  $mysql->close();
     65 $sql = new SQL;
     66 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     67
     68 $result = $sql->query("SELECT count(*) FROM gameobject_template");
     69 $tot_go = $sql->result($result, 0);
     70 $sql->close();
    7171
    7272 $output .= "<center>
     
    133133        }
    134134
    135 $mysql = new MySQL;
    136 $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    137 
    138 if ($_POST['entry'] != '') $entry = $mysql->quote_smart($_POST['entry']);
    139 if ($_POST['name'] != '') $name = $mysql->quote_smart($_POST['name']);
    140 if ($_POST['type'] != -1) $type = $mysql->quote_smart($_POST['type']);
    141 if ($_POST['ScriptName'] != '') $ScriptName = $mysql->quote_smart($_POST['ScriptName']);
    142 if ($_POST['displayId'] != '') $displayId = $mysql->quote_smart($_POST['displayId']);
    143 if ($_POST['faction'] != '') $faction = $mysql->quote_smart($_POST['faction']);
    144 if ($_POST['flags'] != '') $flags = $mysql->quote_smart($_POST['flags']);
    145 if ($_POST['custom_search'] != '') $custom_search = $mysql->quote_smart($_POST['custom_search']);
     135$sql = new SQL;
     136$sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     137
     138if ($_POST['entry'] != '') $entry = $sql->quote_smart($_POST['entry']);
     139if ($_POST['name'] != '') $name = $sql->quote_smart($_POST['name']);
     140if ($_POST['type'] != -1) $type = $sql->quote_smart($_POST['type']);
     141if ($_POST['ScriptName'] != '') $ScriptName = $sql->quote_smart($_POST['ScriptName']);
     142if ($_POST['displayId'] != '') $displayId = $sql->quote_smart($_POST['displayId']);
     143if ($_POST['faction'] != '') $faction = $sql->quote_smart($_POST['faction']);
     144if ($_POST['flags'] != '') $flags = $sql->quote_smart($_POST['flags']);
     145if ($_POST['custom_search'] != '') $custom_search = $sql->quote_smart($_POST['custom_search']);
    146146        else $custom_search = "";
    147147
     
    158158 if($where == "WHERE entry > 0 ") redirect("game_object.php?error=1");
    159159
    160  $result = $mysql->query("SELECT entry, type, displayId, name, faction FROM gameobject_template $where ORDER BY entry LIMIT $sql_search_limit");
    161  $total_found = $mysql->num_rows($result);
     160 $result = $sql->query("SELECT entry, type, displayId, name, faction FROM gameobject_template $where ORDER BY entry LIMIT $sql_search_limit");
     161 $total_found = $sql->num_rows($result);
    162162
    163163  $output .= "<center>
     
    171171  $output .= "<table class=\"lined\">
    172172   <tr>
    173         <td width=\"10%\" class=\"head\">{$lang_game_object['entry']}</td>
    174         <td width=\"40%\" class=\"head\">{$lang_game_object['name']}</td>
    175         <td width=\"20%\" class=\"head\">{$lang_game_object['type']}</td>
    176         <td width=\"15%\" class=\"head\">{$lang_game_object['displayId']}</td>
    177         <td width=\"15%\" class=\"head\">{$lang_game_object['faction']}</td>
     173        <th width=\"10%\">{$lang_game_object['entry']}</th>
     174        <th width=\"40%\">{$lang_game_object['name']}</th>
     175        <th width=\"20%\">{$lang_game_object['type']}</th>
     176        <th width=\"15%\">{$lang_game_object['displayId']}</th>
     177        <th width=\"15%\">{$lang_game_object['faction']}</th>
    178178  </tr>";
    179179
    180180 for ($i=1; $i<=$total_found; $i++){
    181   $go = $mysql->fetch_row($result);
     181  $go = $sql->fetch_row($result);
    182182
    183183  $output .= "<tr>
     
    191191  $output .= "</table></center><br />";
    192192
    193  $mysql->close();
     193 $sql->close();
    194194}
    195195
     
    364364 if (!isset($_GET['entry'])) redirect("game_object.php?error=1");
    365365       
    366  $mysql = new MySQL;
    367  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    368  
    369  $entry = $mysql->quote_smart($_GET['entry']);
    370  $result = $mysql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'");
    371 
    372  if ($go = $mysql->fetch_assoc($result)){
     366 $sql = new SQL;
     367 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     368 
     369 $entry = $sql->quote_smart($_GET['entry']);
     370 $result = $sql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'");
     371
     372 if ($go = $sql->fetch_assoc($result)){
    373373
    374374  $output .= "<script type=\"text/javascript\" src=\"js/tab.js\"></script>
     
    449449</table><br />";
    450450
    451 $result1 = $mysql->query("SELECT COUNT(*) FROM gameobject WHERE id = '{$go['entry']}'");
    452 $output .= "<tr><td colspan=\"6\">{$lang_game_object['go_swapned']} : ".$mysql->result($result1, 0)." {$lang_game_object['times']}.</td></tr>
     451$result1 = $sql->query("SELECT COUNT(*) FROM gameobject WHERE id = '{$go['entry']}'");
     452$output .= "<tr><td colspan=\"6\">{$lang_game_object['go_swapned']} : ".$sql->result($result1, 0)." {$lang_game_object['times']}.</td></tr>
    453453
    454454<br />
     
    534534        $row_flag = 0;
    535535        $output .= "<table class=\"hidden\" align=\"center\"><tr>";
    536         $result1 = $mysql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM gameobject_loot_template WHERE entry = {$go['entry']} ORDER BY ChanceOrRef DESC");
    537         while ($item = $mysql->fetch_row($result1)){
     536        $result1 = $sql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM gameobject_loot_template WHERE entry = {$go['entry']} ORDER BY ChanceOrRef DESC");
     537        while ($item = $sql->fetch_row($result1)){
    538538                $cel_counter++;
    539539                $tooltip = get_item_name($item[0])." ($item[0])<br />{$lang_game_object['drop_chance']}: $item[1]%<br />{$lang_game_object['quest_drop_chance']}: $item[2]%<br />{$lang_game_object['drop_chance']}: $item[3]-$item[4]<br />{$lang_game_object['quest_freeforall']}: $item[5]";
     
    577577        <tr class=\"large_bold\"><td colspan=\"2\" class=\"hidden\" align=\"left\">{$lang_game_object['start_quests']}:</td></tr>";
    578578
    579         $result1 = $mysql->query("SELECT quest FROM gameobject_questrelation WHERE id = {$go['entry']}");
    580         while ($quest = $mysql->fetch_row($result1)){
    581                 $query1 = $mysql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
    582                 $quest_templ = $mysql->fetch_row($query1);
     579        $result1 = $sql->query("SELECT quest FROM gameobject_questrelation WHERE id = {$go['entry']}");
     580        while ($quest = $sql->fetch_row($result1)){
     581                $query1 = $sql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
     582                $quest_templ = $sql->fetch_row($query1);
    583583               
    584584                $output .= "<tr><td width=\"5%\"><input type=\"checkbox\" name=\"del_questrelation[]\" value=\"$quest[0]\" /></td>
     
    592592<tr class=\"large_bold\"><td colspan=\"2\" class=\"hidden\" align=\"left\">{$lang_game_object['ends_quests']}:</td></tr>";
    593593
    594         $result1 = $mysql->query("SELECT quest FROM gameobject_involvedrelation WHERE id = {$go['entry']}");
    595         while ($quest = $mysql->fetch_row($result1)){
    596                 $query1 = $mysql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
    597                 $quest_templ = $mysql->fetch_row($query1);
     594        $result1 = $sql->query("SELECT quest FROM gameobject_involvedrelation WHERE id = {$go['entry']}");
     595        while ($quest = $sql->fetch_row($result1)){
     596                $query1 = $sql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
     597                $quest_templ = $sql->fetch_row($query1);
    598598               
    599599                $output .= "<tr><td width=\"5%\"><input type=\"checkbox\" name=\"del_involvedrelation[]\" value=\"$quest[0]\" /></td>
     
    626626        </table></center>";
    627627
    628  $mysql->close();
     628 $sql->close();
    629629 } else {
    630                 $mysql->close();
     630                $sql->close();
    631631                error($lang_game_object['tmpl_not_found']);
    632632                exit();
     
    644644 if (!isset($_POST['entry']) || $_POST['entry'] === '') redirect("game_object.php?error=1");
    645645 
    646  $mysql = new MySQL;
    647  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    648 
    649  $entry = $mysql->quote_smart($_POST['entry']);
    650  if (isset($_POST['type']) && $_POST['type'] != '') $type = $mysql->quote_smart($_POST['type']);
     646 $sql = new SQL;
     647 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     648
     649 $entry = $sql->quote_smart($_POST['entry']);
     650 if (isset($_POST['type']) && $_POST['type'] != '') $type = $sql->quote_smart($_POST['type']);
    651651        else $type = 0;
    652  if (isset($_POST['displayId']) && $_POST['displayId'] != '') $displayId = $mysql->quote_smart($_POST['displayId']);
     652 if (isset($_POST['displayId']) && $_POST['displayId'] != '') $displayId = $sql->quote_smart($_POST['displayId']);
    653653        else $displayId = 0;
    654  if (isset($_POST['name']) && $_POST['name'] != '') $name = $mysql->quote_smart($_POST['name']);
     654 if (isset($_POST['name']) && $_POST['name'] != '') $name = $sql->quote_smart($_POST['name']);
    655655        else $name = "";
    656  if (isset($_POST['faction']) && $_POST['faction'] != '') $faction = $mysql->quote_smart($_POST['faction']);
     656 if (isset($_POST['faction']) && $_POST['faction'] != '') $faction = $sql->quote_smart($_POST['faction']);
    657657        else $faction = 0;
    658  if (isset($_POST['flags']) && $_POST['flags'] != '') $flags = $mysql->quote_smart($_POST['flags']);
     658 if (isset($_POST['flags']) && $_POST['flags'] != '') $flags = $sql->quote_smart($_POST['flags']);
    659659        else $flags = 0;
    660  if (isset($_POST['size']) && $_POST['size'] != '') $size = $mysql->quote_smart($_POST['size']);
     660 if (isset($_POST['size']) && $_POST['size'] != '') $size = $sql->quote_smart($_POST['size']);
    661661        else $size = 0;
    662  if (isset($_POST['ScriptName']) && $_POST['ScriptName'] != '') $ScriptName = $mysql->quote_smart($_POST['ScriptName']);
     662 if (isset($_POST['ScriptName']) && $_POST['ScriptName'] != '') $ScriptName = $sql->quote_smart($_POST['ScriptName']);
    663663        else $ScriptName = "";
    664  if (isset($_POST['sound0']) && $_POST['sound0'] != '') $sound0 = $mysql->quote_smart($_POST['sound0']);
     664 if (isset($_POST['sound0']) && $_POST['sound0'] != '') $sound0 = $sql->quote_smart($_POST['sound0']);
    665665        else $sound0 = 0;
    666  if (isset($_POST['sound1']) && $_POST['sound1'] != '') $sound1 = $mysql->quote_smart($_POST['sound1']);
     666 if (isset($_POST['sound1']) && $_POST['sound1'] != '') $sound1 = $sql->quote_smart($_POST['sound1']);
    667667        else $sound1 = 0;
    668  if (isset($_POST['sound2']) && $_POST['sound2'] != '') $sound2 = $mysql->quote_smart($_POST['sound2']);
     668 if (isset($_POST['sound2']) && $_POST['sound2'] != '') $sound2 = $sql->quote_smart($_POST['sound2']);
    669669        else $sound2 = 0;
    670  if (isset($_POST['sound3']) && $_POST['sound3'] != '') $sound3 = $mysql->quote_smart($_POST['sound3']);
     670 if (isset($_POST['sound3']) && $_POST['sound3'] != '') $sound3 = $sql->quote_smart($_POST['sound3']);
    671671        else $sound3 = 0;
    672  if (isset($_POST['sound4']) && $_POST['sound4'] != '') $sound4 = $mysql->quote_smart($_POST['sound4']);
     672 if (isset($_POST['sound4']) && $_POST['sound4'] != '') $sound4 = $sql->quote_smart($_POST['sound4']);
    673673        else $sound4 = 0;
    674  if (isset($_POST['sound5']) && $_POST['sound5'] != '') $sound5 = $mysql->quote_smart($_POST['sound5']);
     674 if (isset($_POST['sound5']) && $_POST['sound5'] != '') $sound5 = $sql->quote_smart($_POST['sound5']);
    675675        else $sound5 = 0;
    676  if (isset($_POST['sound6']) && $_POST['sound6'] != '') $sound6 = $mysql->quote_smart($_POST['sound6']);
     676 if (isset($_POST['sound6']) && $_POST['sound6'] != '') $sound6 = $sql->quote_smart($_POST['sound6']);
    677677        else $sound6 = 0;
    678  if (isset($_POST['sound7']) && $_POST['sound7'] != '') $sound7 = $mysql->quote_smart($_POST['sound7']);
     678 if (isset($_POST['sound7']) && $_POST['sound7'] != '') $sound7 = $sql->quote_smart($_POST['sound7']);
    679679        else $sound7 = 0;
    680  if (isset($_POST['sound8']) && $_POST['sound8'] != '') $sound8 = $mysql->quote_smart($_POST['sound8']);
     680 if (isset($_POST['sound8']) && $_POST['sound8'] != '') $sound8 = $sql->quote_smart($_POST['sound8']);
    681681        else $sound8 = 0;
    682  if (isset($_POST['sound9']) && $_POST['sound9'] != '') $sound9 = $mysql->quote_smart($_POST['sound9']);
     682 if (isset($_POST['sound9']) && $_POST['sound9'] != '') $sound9 = $sql->quote_smart($_POST['sound9']);
    683683        else $sound9 = 0;
    684  if (isset($_POST['sound10']) && $_POST['sound10'] != '') $sound10 = $mysql->quote_smart($_POST['sound10']);
     684 if (isset($_POST['sound10']) && $_POST['sound10'] != '') $sound10 = $sql->quote_smart($_POST['sound10']);
    685685        else $sound10 = 0;
    686  if (isset($_POST['sound11']) && $_POST['sound11'] != '') $sound11 = $mysql->quote_smart($_POST['sound11']);
     686 if (isset($_POST['sound11']) && $_POST['sound11'] != '') $sound11 = $sql->quote_smart($_POST['sound11']);
    687687        else $sound11 = 0;
    688  if (isset($_POST['sound12']) && $_POST['sound12'] != '') $sound12 = $mysql->quote_smart($_POST['sound12']);
     688 if (isset($_POST['sound12']) && $_POST['sound12'] != '') $sound12 = $sql->quote_smart($_POST['sound12']);
    689689        else $sound12 = 0;
    690  if (isset($_POST['sound13']) && $_POST['sound13'] != '') $sound13 = $mysql->quote_smart($_POST['sound13']);
     690 if (isset($_POST['sound13']) && $_POST['sound13'] != '') $sound13 = $sql->quote_smart($_POST['sound13']);
    691691        else $sound13 = 0;
    692  if (isset($_POST['sound14']) && $_POST['sound14'] != '') $sound14 = $mysql->quote_smart($_POST['sound14']);
     692 if (isset($_POST['sound14']) && $_POST['sound14'] != '') $sound14 = $sql->quote_smart($_POST['sound14']);
    693693        else $sound14 = 0;
    694  if (isset($_POST['sound15']) && $_POST['sound15'] != '') $sound15 = $mysql->quote_smart($_POST['sound15']);
     694 if (isset($_POST['sound15']) && $_POST['sound15'] != '') $sound15 = $sql->quote_smart($_POST['sound15']);
    695695        else $sound15 = 0;
    696  if (isset($_POST['sound16']) && $_POST['sound16'] != '') $sound16 = $mysql->quote_smart($_POST['sound16']);
     696 if (isset($_POST['sound16']) && $_POST['sound16'] != '') $sound16 = $sql->quote_smart($_POST['sound16']);
    697697        else $sound16 = 0;
    698  if (isset($_POST['sound17']) && $_POST['sound17'] != '') $sound17 = $mysql->quote_smart($_POST['sound17']);
     698 if (isset($_POST['sound17']) && $_POST['sound17'] != '') $sound17 = $sql->quote_smart($_POST['sound17']);
    699699        else $sound17 = 0;
    700  if (isset($_POST['sound18']) && $_POST['sound18'] != '') $sound18 = $mysql->quote_smart($_POST['sound18']);
     700 if (isset($_POST['sound18']) && $_POST['sound18'] != '') $sound18 = $sql->quote_smart($_POST['sound18']);
    701701        else $sound18 = 0;
    702  if (isset($_POST['sound19']) && $_POST['sound19'] != '') $sound19 = $mysql->quote_smart($_POST['sound19']);
     702 if (isset($_POST['sound19']) && $_POST['sound19'] != '') $sound19 = $sql->quote_smart($_POST['sound19']);
    703703        else $sound19 = 0;
    704  if (isset($_POST['sound20']) && $_POST['sound20'] != '') $sound20 = $mysql->quote_smart($_POST['sound20']);
     704 if (isset($_POST['sound20']) && $_POST['sound20'] != '') $sound20 = $sql->quote_smart($_POST['sound20']);
    705705        else $sound20 = 0;
    706  if (isset($_POST['sound21']) && $_POST['sound21'] != '') $sound21 = $mysql->quote_smart($_POST['sound21']);
     706 if (isset($_POST['sound21']) && $_POST['sound21'] != '') $sound21 = $sql->quote_smart($_POST['sound21']);
    707707        else $sound21 = 0;
    708  if (isset($_POST['sound22']) && $_POST['sound22'] != '') $sound22 = $mysql->quote_smart($_POST['sound22']);
     708 if (isset($_POST['sound22']) && $_POST['sound22'] != '') $sound22 = $sql->quote_smart($_POST['sound22']);
    709709        else $sound22 = 0;
    710  if (isset($_POST['sound23']) && $_POST['sound23'] != '') $sound23 = $mysql->quote_smart($_POST['sound23']);
     710 if (isset($_POST['sound23']) && $_POST['sound23'] != '') $sound23 = $sql->quote_smart($_POST['sound23']);
    711711        else $sound23 = 0;
    712712
    713         if (isset($_POST['ChanceOrRef']) && $_POST['ChanceOrRef'] != '') $ChanceOrRef = $mysql->quote_smart($_POST['ChanceOrRef']);
     713        if (isset($_POST['ChanceOrRef']) && $_POST['ChanceOrRef'] != '') $ChanceOrRef = $sql->quote_smart($_POST['ChanceOrRef']);
    714714                else $ChanceOrRef = 0;
    715         if (isset($_POST['QuestChanceOrGroup']) && $_POST['QuestChanceOrGroup'] != '') $QuestChanceOrGroup = $mysql->quote_smart($_POST['QuestChanceOrGroup']);
     715        if (isset($_POST['QuestChanceOrGroup']) && $_POST['QuestChanceOrGroup'] != '') $QuestChanceOrGroup = $sql->quote_smart($_POST['QuestChanceOrGroup']);
    716716                else $QuestChanceOrGroup = 0;
    717         if (isset($_POST['mincount']) && $_POST['mincount'] != '') $mincount = $mysql->quote_smart($_POST['mincount']);
     717        if (isset($_POST['mincount']) && $_POST['mincount'] != '') $mincount = $sql->quote_smart($_POST['mincount']);
    718718                else $mincount = 0;
    719         if (isset($_POST['maxcount']) && $_POST['maxcount'] != '') $maxcount = $mysql->quote_smart($_POST['maxcount']);
     719        if (isset($_POST['maxcount']) && $_POST['maxcount'] != '') $maxcount = $sql->quote_smart($_POST['maxcount']);
    720720                else $maxcount = 0;
    721         if (isset($_POST['quest_freeforall']) && $_POST['quest_freeforall'] != '') $quest_freeforall = $mysql->quote_smart($_POST['quest_freeforall']);
     721        if (isset($_POST['quest_freeforall']) && $_POST['quest_freeforall'] != '') $quest_freeforall = $sql->quote_smart($_POST['quest_freeforall']);
    722722                else $quest_freeforall = 0;
    723         if (isset($_POST['item']) && $_POST['item'] != '') $item = $mysql->quote_smart($_POST['item']);
     723        if (isset($_POST['item']) && $_POST['item'] != '') $item = $sql->quote_smart($_POST['item']);
    724724                else $item = 0;
    725         if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') $del_loot_items = $mysql->quote_smart($_POST['del_loot_items']);
     725        if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') $del_loot_items = $sql->quote_smart($_POST['del_loot_items']);
    726726                else $del_loot_items = NULL;
    727727       
    728         if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') $involvedrelation = $mysql->quote_smart($_POST['involvedrelation']);
     728        if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') $involvedrelation = $sql->quote_smart($_POST['involvedrelation']);
    729729                else $involvedrelation = 0;
    730         if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') $del_involvedrelation = $mysql->quote_smart($_POST['del_involvedrelation']);
     730        if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') $del_involvedrelation = $sql->quote_smart($_POST['del_involvedrelation']);
    731731                else $del_involvedrelation = NULL;
    732         if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') $questrelation = $mysql->quote_smart($_POST['questrelation']);
     732        if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') $questrelation = $sql->quote_smart($_POST['questrelation']);
    733733                else $questrelation = 0;
    734         if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') $del_questrelation = $mysql->quote_smart($_POST['del_questrelation']);
     734        if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') $del_questrelation = $sql->quote_smart($_POST['del_questrelation']);
    735735                else $del_questrelation = NULL;
    736736       
    737737  if ($_POST['opp_type'] == "add_new"){
    738         $sql = "INSERT INTO gameobject_template ( entry, type, displayId, name, faction, flags, size, sound0, sound1,
     738        $sql_query = "INSERT INTO gameobject_template ( entry, type, displayId, name, faction, flags, size, sound0, sound1,
    739739        sound2, sound3, sound4, sound5, sound6, sound7, sound8, sound9, sound10, sound11, sound12, sound13,
    740740        sound14, sound15, sound16, sound17, sound18, sound19, sound20, sound21, sound22, sound23, ScriptName )
     
    746746 } elseif ($_POST['opp_type'] == "edit"){
    747747
    748         $sql = "UPDATE gameobject_template SET ";
    749 
    750         $result = $mysql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'");
    751         if ($go_templ = $mysql->fetch_assoc($result)){
    752                 if ($go_templ['type'] != $type) $sql .= "type='$type',";
    753                 if ($go_templ['displayId'] != $displayId) $sql .= "displayId='$displayId',";
    754                 if ($go_templ['name'] != $name) $sql .= "name='$name',";
    755                 if ($go_templ['faction'] != $faction) $sql .= "faction='$faction',";
    756                 if ($go_templ['flags'] != $flags) $sql .= "flags='$flags',";
    757                 if ($go_templ['size'] != $size) $sql .= "size='$size',";
    758                 if ($go_templ['sound0'] != $sound0) $sql .= "sound0='$sound0',";
    759                 if ($go_templ['sound1'] != $sound1) $sql .= "sound1='$sound1',";
    760                 if ($go_templ['sound2'] != $sound2) $sql .= "sound2='$sound2',";
    761                 if ($go_templ['sound3'] != $sound3) $sql .= "sound3='$sound3',";
    762                 if ($go_templ['sound4'] != $sound4) $sql .= "sound4='$sound4',";
    763                 if ($go_templ['sound5'] != $sound5) $sql .= "sound5='$sound5',";
    764                 if ($go_templ['sound6'] != $sound6) $sql .= "sound6='$sound6',";
    765                 if ($go_templ['sound7'] != $sound7) $sql .= "sound7='$sound7',";
    766                 if ($go_templ['sound8'] != $sound8) $sql .= "sound8='$sound8',";
    767                 if ($go_templ['sound9'] != $sound9) $sql .= "sound9='$sound9',";
    768                 if ($go_templ['sound10'] != $sound10) $sql .= "sound10='$sound10',";
    769                 if ($go_templ['sound11'] != $sound11) $sql .= "sound11='$sound11',";
    770                 if ($go_templ['sound12'] != $sound12) $sql .= "sound12='$sound12',";
    771                 if ($go_templ['sound13'] != $sound13) $sql .= "sound13='$sound13',";
    772                 if ($go_templ['sound14'] != $sound14) $sql .= "sound14='$sound14',";
    773                 if ($go_templ['sound15'] != $sound15) $sql .= "sound15='$sound15',";
    774                 if ($go_templ['sound16'] != $sound16) $sql .= "sound16='$sound16',";
    775                 if ($go_templ['sound17'] != $sound17) $sql .= "sound17='$sound17',";
    776                 if ($go_templ['sound18'] != $sound18) $sql .= "sound18='$sound18',";
    777                 if ($go_templ['sound19'] != $sound19) $sql .= "sound19='$sound19',";
    778                 if ($go_templ['sound20'] != $sound20) $sql .= "sound20='$sound20',";
    779                 if ($go_templ['sound21'] != $sound21) $sql .= "sound21='$sound21',";
    780                 if ($go_templ['sound22'] != $sound22) $sql .= "sound22='$sound22',";
    781                 if ($go_templ['sound23'] != $sound23) $sql .= "sound23='$sound23',";
    782                 if ($go_templ['ScriptName'] != $ScriptName) $sql .= "ScriptName='$ScriptName',";
    783 
    784           $mysql->free_result($result);
     748        $sql_query = "UPDATE gameobject_template SET ";
     749
     750        $result = $sql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'");
     751        if ($go_templ = $sql->fetch_assoc($result)){
     752                if ($go_templ['type'] != $type) $sql_query .= "type='$type',";
     753                if ($go_templ['displayId'] != $displayId) $sql_query .= "displayId='$displayId',";
     754                if ($go_templ['name'] != $name) $sql_query .= "name='$name',";
     755                if ($go_templ['faction'] != $faction) $sql_query .= "faction='$faction',";
     756                if ($go_templ['flags'] != $flags) $sql_query .= "flags='$flags',";
     757                if ($go_templ['size'] != $size) $sql_query .= "size='$size',";
     758                if ($go_templ['sound0'] != $sound0) $sql_query .= "sound0='$sound0',";
     759                if ($go_templ['sound1'] != $sound1) $sql_query .= "sound1='$sound1',";
     760                if ($go_templ['sound2'] != $sound2) $sql_query .= "sound2='$sound2',";
     761                if ($go_templ['sound3'] != $sound3) $sql_query .= "sound3='$sound3',";
     762                if ($go_templ['sound4'] != $sound4) $sql_query .= "sound4='$sound4',";
     763                if ($go_templ['sound5'] != $sound5) $sql_query .= "sound5='$sound5',";
     764                if ($go_templ['sound6'] != $sound6) $sql_query .= "sound6='$sound6',";
     765                if ($go_templ['sound7'] != $sound7) $sql_query .= "sound7='$sound7',";
     766                if ($go_templ['sound8'] != $sound8) $sql_query .= "sound8='$sound8',";
     767                if ($go_templ['sound9'] != $sound9) $sql_query .= "sound9='$sound9',";
     768                if ($go_templ['sound10'] != $sound10) $sql_query .= "sound10='$sound10',";
     769                if ($go_templ['sound11'] != $sound11) $sql_query .= "sound11='$sound11',";
     770                if ($go_templ['sound12'] != $sound12) $sql_query .= "sound12='$sound12',";
     771                if ($go_templ['sound13'] != $sound13) $sql_query .= "sound13='$sound13',";
     772                if ($go_templ['sound14'] != $sound14) $sql_query .= "sound14='$sound14',";
     773                if ($go_templ['sound15'] != $sound15) $sql_query .= "sound15='$sound15',";
     774                if ($go_templ['sound16'] != $sound16) $sql_query .= "sound16='$sound16',";
     775                if ($go_templ['sound17'] != $sound17) $sql_query .= "sound17='$sound17',";
     776                if ($go_templ['sound18'] != $sound18) $sql_query .= "sound18='$sound18',";
     777                if ($go_templ['sound19'] != $sound19) $sql_query .= "sound19='$sound19',";
     778                if ($go_templ['sound20'] != $sound20) $sql_query .= "sound20='$sound20',";
     779                if ($go_templ['sound21'] != $sound21) $sql_query .= "sound21='$sound21',";
     780                if ($go_templ['sound22'] != $sound22) $sql_query .= "sound22='$sound22',";
     781                if ($go_templ['sound23'] != $sound23) $sql_query .= "sound23='$sound23',";
     782                if ($go_templ['ScriptName'] != $ScriptName) $sql_query .= "ScriptName='$ScriptName',";
     783
     784          $sql->free_result($result);
    785785          unset($go_templ);
    786          
    787         if (($sql == "UPDATE gameobject_template SET ")&&(!$item)&&(!$del_loot_items)
     786
     787        if (($sql_query == "UPDATE gameobject_template SET ")&&(!$item)&&(!$del_loot_items)
    788788                &&(!$del_questrelation)&&(!$questrelation)&&(!$del_involvedrelation)&&(!$involvedrelation)){
    789                 $mysql->close();
     789                $sql->close();
    790790                redirect("game_object.php?action=edit&entry=$entry&error=6");
    791791                } else {
    792                                 if ($sql != "UPDATE gameobject_template SET "){
    793                                         $sql[strlen($sql)-1] = " ";
    794                                         $sql .= " WHERE entry = '$entry';\n";
    795                                         } else $sql = "";
     792                                if ($sql_query != "UPDATE gameobject_template SET "){
     793                                        $sql_query[strlen($sql_query)-1] = " ";
     794                                        $sql_query .= " WHERE entry = '$entry';\n";
     795                                        } else $sql_query = "";
    796796                }
    797797
    798798        if ($item){
    799         $sql .= "INSERT INTO gameobject_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
     799        $sql_query .= "INSERT INTO gameobject_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
    800800                        VALUES ($entry,$item,'$ChanceOrRef', '$QuestChanceOrGroup' ,$mincount ,$maxcount ,$quest_freeforall);\n";
    801801        }
     
    803803        if ($del_loot_items){
    804804        foreach($del_loot_items as $item_id)
    805                 $sql .= "DELETE FROM gameobject_loot_template WHERE entry = $entry AND item = $item_id;\n";
     805                $sql_query .= "DELETE FROM gameobject_loot_template WHERE entry = $entry AND item = $item_id;\n";
    806806        }
    807807
    808808        if ($questrelation){
    809         $sql .= "INSERT INTO gameobject_questrelation (id, quest) VALUES ($entry,$questrelation);\n";
     809        $sql_query .= "INSERT INTO gameobject_questrelation (id, quest) VALUES ($entry,$questrelation);\n";
    810810        }
    811811       
    812812        if ($involvedrelation){
    813         $sql .= "INSERT INTO gameobject_involvedrelation (id, quest) VALUES ($entry,$involvedrelation);\n";
     813        $sql_query .= "INSERT INTO gameobject_involvedrelation (id, quest) VALUES ($entry,$involvedrelation);\n";
    814814        }
    815815
    816816        if ($del_questrelation){
    817817        foreach($del_questrelation as $quest_id)
    818                 $sql .= "DELETE FROM gameobject_questrelation WHERE id = $entry AND quest = $quest_id;\n";
     818                $sql_query .= "DELETE FROM gameobject_questrelation WHERE id = $entry AND quest = $quest_id;\n";
    819819        }
    820820
    821821        if ($del_involvedrelation){
    822822        foreach($del_involvedrelation as $quest_id)
    823                 $sql .= "DELETE FROM gameobject_involvedrelation WHERE id = $entry AND quest = $quest_id;\n";
     823                $sql_query .= "DELETE FROM gameobject_involvedrelation WHERE id = $entry AND quest = $quest_id;\n";
    824824        }
    825825       
    826826
    827827 } else {
    828                 $mysql->close();
     828                $sql->close();
    829829                redirect("game_object.php?error=5");
    830830                }
    831831 } else {
    832         $mysql->close();
     832        $sql->close();
    833833        redirect("game_object.php?error=5");
    834834        }
    835835
    836836 if ( isset($_POST['backup_op']) && ($_POST['backup_op'] == 1) ){
    837         $mysql->close();
     837        $sql->close();
    838838        Header("Content-type: application/octet-stream");
    839839        Header("Content-Disposition: attachment; filename=goid_$entry.sql");
    840         echo $sql;
     840        echo $sql_query;
    841841        exit();
    842842        redirect("game_object.php?action=edit&entry=$entry&error=4");
    843843        } else {
    844                 $sql = explode(';',$sql);
    845                 foreach($sql as $tmp_query) if(($tmp_query)&&($tmp_query != "\n")) $result = $mysql->query($tmp_query);
    846                 $mysql->close();
     844                $sql_query = explode(';',$sql_query);
     845                foreach($sql_query as $tmp_query) if(($tmp_query)&&($tmp_query != "\n")) $result = $sql->query($tmp_query);
     846                $sql->close();
    847847                }
    848848
     
    884884        else redirect("game_object.php?error=1");
    885885
    886  $mysql = new MySQL;
    887  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    888 
    889  $result = $mysql->query("SELECT guid FROM gameobject WHERE id = '$entry'");
    890  while ($guid = $mysql->fetch_row($result)){
    891         $result = $mysql->query("DELETE FROM gameobject_respawn WHERE guid = '$guid'");
     886 $sql = new SQL;
     887 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     888
     889 $result = $sql->query("SELECT guid FROM gameobject WHERE id = '$entry'");
     890 while ($guid = $sql->fetch_row($result)){
     891        $result = $sql->query("DELETE FROM gameobject_respawn WHERE guid = '$guid'");
    892892        }
    893  $mysql->query("DELETE FROM gameobject_involvedrelation WHERE id = '$entry'");
    894  $mysql->query("DELETE FROM gameobject_questrelation WHERE id = '$entry'");
    895  $mysql->query("DELETE FROM gameobject_loot_template WHERE entry = '$entry'");
    896  $mysql->query("DELETE FROM gameobject_template WHERE entry = '$entry'");
    897  
    898  $mysql->close();
     893 $sql->query("DELETE FROM gameobject_involvedrelation WHERE id = '$entry'");
     894 $sql->query("DELETE FROM gameobject_questrelation WHERE id = '$entry'");
     895 $sql->query("DELETE FROM gameobject_loot_template WHERE entry = '$entry'");
     896 $sql->query("DELETE FROM gameobject_template WHERE entry = '$entry'");
     897 
     898 $sql->close();
    899899 redirect("game_object.php");
    900900 }
     
    910910        else redirect("game_object.php?error=1");
    911911
    912  $mysql = new MySQL;
    913  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    914  $mysql->query("DELETE FROM gameobject WHERE id = '$entry'");
    915  $mysql->close();
     912 $sql = new SQL;
     913 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     914 $sql->query("DELETE FROM gameobject WHERE id = '$entry'");
     915 $sql->close();
    916916 redirect("game_object.php?action=edit&entry=$entry&error=4");
    917917 }
Note: See TracChangeset for help on using the changeset viewer.