Changeset 19 for minimanager/index.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/index.php

    r5 r19  
    1313
    1414require_once("scripts/get_lib.php");
     15require_once("scripts\bbcode_lib.php");
    1516
    16 $mysql = new MySQL;
    17 $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     17$sql = new SQL;
     18$sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    1819
    1920$output .= "<div class=\"top\">";
    2021if (test_port($server[$realm_id]['addr'],$server[$realm_id]['game_port'])) {
    2122       
    22         $query = $mysql->query("SELECT uptime/60 FROM uptime ORDER BY starttime DESC LIMIT 1");
    23         $uptime = $mysql->result($query, 0);
     23        $query = $sql->query("SELECT uptime/60 FROM uptime ORDER BY starttime DESC LIMIT 1");
     24        $uptime = $sql->result($query, 0);
    2425        $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} : (".(int)($uptime/60).":".(($uptime >= 60 )?(int)($uptime-60*(int)($uptime/60)):(int)$uptime)."h)</font></h1>";
    2526        $online = true;
     
    3031$output .= "Mangos: {$server[$realm_id]['rev']} Using DB: {$mangos_db[$realm_id]['db_rev']}</div>";
    3132
    32 $mysql->db($mangos_db[$realm_id]['name']);
     33$sql->db($mangos_db[$realm_id]['name']);
    3334//MOTD part
    34 $start = (isset($_GET['start'])) ? $mysql->quote_smart($_GET['start']) : 0;
     35$start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0;
    3536
    36 $query_1 = $mysql->query("SELECT count(*) FROM bugreport");
    37 $all_record = $mysql->result($query_1, 0);
     37$query_1 = $sql->query("SELECT count(*) FROM bugreport");
     38$all_record = $sql->result($query_1, 0);
    3839
     40if ($user_lvl > 0) $output .= "<script type=\"text/javascript\">
     41        answerbox.btn_ok='{$lang_global['yes_low']}';
     42        answerbox.btn_cancel='{$lang_global['no']}';
     43        var del_motd = 'motd.php?action=delete_motd&amp;id=';
     44 </script>";
    3945$output .= "<center>
    4046                        <table class=\"lined\">
    4147                        <tr>
    42                         <td class=\"head\" align=\"right\">";
    43 if ($user_lvl) $output .= "<a href=\"motd.php?action=add_motd\" class=\"head_link\">{$lang_index['add_motd']}</a>";
     48                        <th align=\"right\">";
     49if ($user_lvl) $output .= "<a href=\"motd.php?action=add_motd\">{$lang_index['add_motd']}</a>";
    4450$output .= "</td></tr>";
    4551if($all_record){
    46         $result = $mysql->query("SELECT id, type, content FROM bugreport ORDER BY id DESC LIMIT $start, 3");
    47         while($post = $mysql->fetch_row($result)){
    48                 $output .= "<tr><td align=\"left\" class=\"large\"><blockquote>$post[2]</blockquote></td></tr>
     52        $result = $sql->query("SELECT id, type, content FROM bugreport ORDER BY id DESC LIMIT $start, 3");
     53        while($post = $sql->fetch_row($result)){
     54                $output .= "<tr><td align=\"left\" class=\"large\"><blockquote>".bbcode2html($post[2])."</blockquote></td></tr>
    4955                                        <tr><td align=\"right\">$post[1] ";
    50                 if ($user_lvl > 0) $output .= "<a href=\"motd.php?action=delete_motd&amp;id=$post[0]\">{$lang_index['delete']}</a>";                   
    51                 $output .= "</td></tr>
     56                if ($user_lvl > 0) $output .= "<img src=\"img/cross.png\" width=\"12\" height=\"12\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$post[0]}</font><br />{$lang_global['are_you_sure']}', del_motd + $post[0]);\" style=\"cursor:pointer;\" />
     57                        <a href=\"motd.php?action=edit_motd&amp;id=$post[0]\"><img src=\"img/edit.png\" width=\"14\" height=\"14\" /></a>";
     58                $output .= "</th></tr>
    5259                                        <tr><td class=\"hidden\"></td></tr>";
    5360        }
     
    5865//print online chars
    5966if ($online){
    60         $order_by = (isset($_GET['order_by'])) ? $mysql->quote_smart($_GET['order_by']) : "name";
     67        $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "name";
    6168
    62         $dir = (isset($_GET['dir'])) ? $mysql->quote_smart($_GET['dir']) : 1;
     69        $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
    6370        $order_dir = ($dir) ? "ASC" : "DESC";
    6471        $dir = ($dir) ? 0 : 1;
    6572       
    66         $result = $mysql->query("SELECT count(*) FROM `character` WHERE `online`= 1");
    67         $total_online = $mysql->result($result, 0);
     73        $result = $sql->query("SELECT count(*) FROM `character` WHERE `online`= 1");
     74        $total_online = $sql->result($result, 0);
    6875
    6976        if( !$user_lvl && !$server[$realm_id]['both_factions']){
    70                 $result = $mysql->query("SELECT race FROM `character` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `character` WHERE account = '$user_id') LIMIT 1");
    71                 if ($mysql->num_rows($result)){
    72                         $order_side = (in_array($mysql->result($result, 0, 'race'),array(2,5,6,8,10))) ?
     77                $result = $sql->query("SELECT race FROM `character` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `character` WHERE account = '$user_id') LIMIT 1");
     78                if ($sql->num_rows($result)){
     79                        $order_side = (in_array($sql->result($result, 0, 'race'),array(2,5,6,8,10))) ?
    7380                        " AND race IN (2,5,6,8,10) " : " AND race IN (1,3,4,7,11) ";
    7481                } else $order_side = "";
     
    7784        require_once("scripts/defines.php");
    7885       
    79         $result = $mysql->query("SELECT guid,name,race,class,position_x,position_y,map,
     86        $result = $sql->query("SELECT guid,name,race,class,zone,map,
    8087                        CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,
    81                         CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level,account 
     88                        CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level,account
    8289                        FROM `character` WHERE `online`= 1 $order_side ORDER BY $order_by $order_dir");
    8390
     
    8693        <table class=\"lined\">
    8794        <tr>
    88         <td width=\"22%\" class=\"head\"><a href=\"index.php?order_by=name&amp;dir=$dir\" class=\"head_link\">{$lang_index['name']}</a></td>
    89         <td width=\"10%\" class=\"head\"><a href=\"index.php?order_by=race&amp;dir=$dir\" class=\"head_link\">{$lang_index['race']}</a></td>
    90         <td width=\"10%\" class=\"head\"><a href=\"index.php?order_by=class&amp;dir=$dir\" class=\"head_link\">{$lang_index['class']}</a></td>
    91         <td width=\"5%\" class=\"head\"><a href=\"index.php?order_by=level&amp;dir=$dir\" class=\"head_link\">{$lang_index['level']}</a></td>
    92         <td width=\"20%\" class=\"head\"><a href=\"index.php?order_by=map&amp;dir=$dir\" class=\"head_link\">{$lang_index['map']}</a></td>
    93         <td width=\"25%\" class=\"head\">{$lang_index['zone']}</td>
    94     <td width=\"8%\" class=\"head\"><a href=\"index.php?order_by=highest_rank&amp;dir=$dir\" class=\"head_link\">{$lang_index['honor_kills']}</a></td>
     95        <th width=\"26%\"><a href=\"index.php?order_by=name&amp;dir=$dir\">".($order_by=='name' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['name']}</a></th>
     96        <th width=\"7%\"><a href=\"index.php?order_by=race&amp;dir=$dir\">".($order_by=='race' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['race']}</a></th>
     97        <th width=\"7%\"><a href=\"index.php?order_by=class&amp;dir=$dir\">".($order_by=='class' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['class']}</a></th>
     98        <th width=\"7%\"><a href=\"index.php?order_by=level&amp;dir=$dir\">".($order_by=='level' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['level']}</a></th>
     99        <th width=\"20%\"><a href=\"index.php?order_by=map&amp;dir=$dir\">".($order_by=='map' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['map']}</a></th>
     100        <th width=\"25%\">{$lang_index['zone']}</td>
     101    <th width=\"10%\"><a href=\"index.php?order_by=highest_rank&amp;dir=$dir\">".($order_by=='highest_rank' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['honor_kills']}</a></th>
    95102        </tr>";
    96103
    97104        require_once("scripts/id_tab.php");
    98105
    99         while($char = $mysql->fetch_row($result)){
     106        while($char = $sql->fetch_row($result)){
    100107                $output .= "<tr>
    101108                 <td><a href=\"char.php?id=$char[0]\">$char[1]</a></td>
    102          <td>".get_player_race($char[2])."</td>
    103                  <td>".get_player_class($char[3])."</td>
    104                  <td>$char[8]</td>
    105                  <td>".get_map_name($char[6])."</td>
    106                  <td>".get_zone_name($char[6], $char[4], $char[5])."</td>
     109         <td><img src='img/c_icons/{$char[2]}-0.gif' onmousemove='toolTip(\"".get_player_race($char[2])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
     110                 <td><img src='img/c_icons/{$char[3]}.gif' onmousemove='toolTip(\"".get_player_class($char[3])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td>
    107111                 <td>$char[7]</td>
     112                 <td>".get_map_name($char[5])."</td>
     113                 <td>".get_zone_name($char[4])."</td>
     114                 <td>$char[6]</td>
    108115         </tr>";
    109116        }
    110117   $output .= "</table><br /></center>";
    111118}
    112 $mysql->close();
     119$sql->close();
    113120
    114121require_once("footer.php");
Note: See TracChangeset for help on using the changeset viewer.