Changeset 19 for minimanager/ticket.php


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/ticket.php

    r5 r19  
    3131function browse_tickets() {
    3232 global  $lang_global, $lang_ticket, $output, $mangos_db, $realm_id, $itemperpage, $ticket_type;
    33 $itemperpage = 2;
    34  $mysql = new MySQL;
    35  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    36  
    37  $start = (isset($_GET['start'])) ? $mysql->quote_smart($_GET['start']) : 0;
    38 
    39  $order_by = (isset($_GET['order_by'])) ? $mysql->quote_smart($_GET['order_by']) : "ticket_id";
    40  $dir = (isset($_GET['dir'])) ? $mysql->quote_smart($_GET['dir']) : 1;
     33
     34 $sql = new SQL;
     35 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     36 
     37 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0;
     38
     39 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "ticket_id";
     40 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
    4141 $order_dir = ($dir) ? "ASC" : "DESC";
    4242 $dir = ($dir) ? 0 : 1;
    4343 
    4444 //get total number of items
    45  $query_1 = $mysql->query("SELECT count(*) FROM character_ticket");
    46  $all_record = $mysql->result($query_1,0);
    47 
    48  $query = $mysql->query("SELECT character_ticket.ticket_id, character_ticket.guid,SUBSTRING_INDEX(character_ticket.ticket_text,' ',6),
     45 $query_1 = $sql->query("SELECT count(*) FROM character_ticket");
     46 $all_record = $sql->result($query_1,0);
     47
     48 $query = $sql->query("SELECT character_ticket.ticket_id, character_ticket.guid,SUBSTRING_INDEX(character_ticket.ticket_text,' ',6),
    4949                                                character_ticket.ticket_category,`character`.name
    5050                                                FROM character_ticket,`character`
     
    5252                                                WHERE character_ticket.guid = `character`.`guid`
    5353                                                ORDER BY $order_by $order_dir LIMIT $start, $itemperpage");
    54  $this_page = $mysql->num_rows($query);
     54 $this_page = $sql->num_rows($query);
    5555
    5656 $output .="<script type=\"text/javascript\" src=\"js/check.js\"></script>
     
    6565 <table class=\"lined\">
    6666   <tr>
    67         <td width=\"5%\" class=\"head\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form);\" /></td>
    68         <td width=\"5%\" class=\"head\">{$lang_global['edit']}</td>
    69         <td width=\"8%\" class=\"head\"><a href=\"ticket.php?order_by=ticket_id&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_ticket['id']}</a></td>
    70         <td width=\"15%\" class=\"head\"><a href=\"ticket.php?order_by=guid&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_ticket['sender']}</a></td>
    71         <td width=\"55%\" class=\"head\"><a href=\"ticket.php?order_by=ticket_text&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_ticket['ticket_text']}</a></td>
    72     <td width=\"13%\" class=\"head\"><a href=\"ticket.php?order_by=ticket_category&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_ticket['category']}</a></td>
     67        <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form);\" /></th>
     68        <th width=\"5%\">{$lang_global['edit']}</th>
     69        <th width=\"8%\"><a href=\"ticket.php?order_by=ticket_id&amp;start=$start&amp;dir=$dir\">".($order_by=='ticket_id' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_ticket['id']}</a></th>
     70        <th width=\"15%\"><a href=\"ticket.php?order_by=guid&amp;start=$start&amp;dir=$dir\">".($order_by=='guid' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_ticket['sender']}</a></th>
     71        <th width=\"55%\">{$lang_ticket['ticket_text']}</th>
     72    <th width=\"13%\"><a href=\"ticket.php?order_by=ticket_category&amp;start=$start&amp;dir=$dir\">".($order_by=='ticket_category' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_ticket['category']}</a></tthd>
    7373  </tr>";
    7474
    75  while ($ticket = $mysql->fetch_row($query)){
     75 while ($ticket = $sql->fetch_row($query)){
    7676        $output .= "<tr>
    7777                    <td><input type=\"checkbox\" name=\"check[]\" value=\"$ticket[0]\" onclick=\"CheckCheckAll(document.form);\" /></td>
     
    9494 </form><br /></center>";
    9595 
    96 $mysql->close();
     96$sql->close();
    9797}
    9898
     
    104104global $lang_global, $mangos_db, $realm_id;
    105105
    106  $mysql = new MySQL;
    107  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    108 
    109  if(isset($_GET['check'])) $check = $mysql->quote_smart($_GET['check']);
     106 $sql = new SQL;
     107 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     108
     109 if(isset($_GET['check'])) $check = $sql->quote_smart($_GET['check']);
    110110        else redirect("ticket.php?error=1");
    111111
     
    114114 for ($i=0; $i<count($check); $i++) {
    115115    if ($check[$i] != "" ) {
    116                 $query = $mysql->query("DELETE FROM character_ticket WHERE ticket_id = '$check[$i]'");
     116                $query = $sql->query("DELETE FROM character_ticket WHERE ticket_id = '$check[$i]'");
    117117                $deleted_tickets++;
    118118                }
    119119        }
    120120
    121  $mysql->close();
     121 $sql->close();
    122122
    123123 if ($deleted_tickets == 0) redirect("ticket.php?error=3");
     
    132132 global  $lang_global, $lang_ticket, $output, $mangos_db, $realm_id, $ticket_type;
    133133
    134  $mysql = new MySQL;
    135  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    136  
    137  if(isset($_GET['id'])) $id = $mysql->quote_smart($_GET['id']);
     134 $sql = new SQL;
     135 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     136 
     137 if(isset($_GET['id'])) $id = $sql->quote_smart($_GET['id']);
    138138        else redirect("ticket.php?error=1");
    139139
    140  $query = $mysql->query("SELECT character_ticket.guid, character_ticket.ticket_text,
     140 $query = $sql->query("SELECT character_ticket.guid, character_ticket.ticket_text,
    141141                                                character_ticket.ticket_category,`character`.name
    142142                                                FROM character_ticket,`character`
     
    144144                                                WHERE character_ticket.guid = `character`.`guid` AND character_ticket.ticket_id = '$id'");
    145145
    146  if ($ticket = $mysql->fetch_row($query)) {
     146 if ($ticket = $sql->fetch_row($query)) {
    147147        $output .= "<center>
    148148        <fieldset style=\"width: 550px;\">
     
    189189  } else error($lang_global['err_no_records_found']);
    190190 
    191  $mysql->close();
     191 $sql->close();
    192192}
    193193
     
    203203 }
    204204
    205  $mysql = new MySQL;
    206  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    207  
    208  $new_category = $mysql->quote_smart($_POST['new_category']);
    209  $new_text = $mysql->quote_smart($_POST['new_text']);
    210  $id = $mysql->quote_smart($_POST['id']);
    211 
    212  $query = $mysql->query("UPDATE character_ticket SET ticket_text='$new_text', ticket_category ='$new_category' WHERE ticket_id = '$id'");
    213 
    214  if (mysql_affected_rows()) {
    215         $mysql->close();
     205 $sql = new SQL;
     206 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     207 
     208 $new_category = $sql->quote_smart($_POST['new_category']);
     209 $new_text = $sql->quote_smart($_POST['new_text']);
     210 $id = $sql->quote_smart($_POST['id']);
     211
     212 $query = $sql->query("UPDATE character_ticket SET ticket_text='$new_text', ticket_category ='$new_category' WHERE ticket_id = '$id'");
     213
     214 if ($sql->affected_rows()) {
     215        $sql->close();
    216216        redirect("ticket.php?error=5");
    217217    } else {
    218                 $mysql->close();
     218                $sql->close();
    219219                redirect("ticket.php?error=6");
    220220        }
Note: See TracChangeset for help on using the changeset viewer.