Changeset 630


Ignore:
Timestamp:
Aug 26, 2009, 3:07:07 PM (15 years ago)
Author:
george
Message:
  • Přidáno: Podpora pro umístění světů na oddělených serverech. Vzdálené připojení k databázi.
  • Přidáno: Třída Realm pro sadu funkcí týkajících se světů.
  • Přidáno: Třída System pro reprezentaci obecných funkcí.
Location:
trunk
Files:
3 added
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Readme.txt

    r600 r630  
    2626pages - složka se stránkami webu
    2727mangos_debug - záznam a zobrazování logů mangosu
    28 minimanager - webová správa databáze MaNGOSu
    2928
    3029Neverzované
     
    3534
    3635Každých 5 minut spouštět skript inc/registration_update.php
     36
     37
     385) Stažení podsložek jiných projektů
     39
     40Stáhněte projekt Minimanager for Mangos pomocí:
     41svn co https://mmfpm.svn.sourceforge.net/svnroot/mmfpm/trunk minimanager
     42Zkopírujte a nastavte konfigurační soubor minimanager/scripts/config.php
  • trunk/inc/config.sample.php

    r627 r630  
    2020    'ScriptDev2Revision' => '137',
    2121    'ClientVersion' => '3.1.3',
     22    'DatabaseHost' => 'localhost',
     23    'DatabaseUser' => 'server1',
     24    'DatabasePassword' => 'server1',
    2225    'DatabaseRealmd' => 'realmd',
    2326    'RequiredOnlinePlayers' => 70,
     
    3538        'Id' => 7,
    3639        'Name' => 'Realm 1'
     40        'DatabaseHost' => 'localhost',
     41        'DatabaseUser' => 'server1',
     42        'DatabasePassword' => 'server1',
    3743        'DatabaseCharacters' => 'realm1_characters',
    3844        'DatabaseMangos' => 'realm1_mangos',
    3945        'DatabaseScriptDev2' => 'realm1_scriptdev2',
     46        'Server' => 1,
    4047        'MaxOnlinePlayers' => 100,
    4148        'XPRate' => 1,
     
    6370    'BankAccount' => '670100-2202937132/6210',
    6471    'ServerList' => array(
    65       array(
     72      1 => array(
    6673        'OS' => 'GNU/Linux',
    6774        'CPU' => 'AMD Athlon 64 X2 5600+, 2,8 GHz',
     
    7077        'Address' => 'localhost',
    7178        'Internet' => '16/16 Mbit/s, agregace 1:32',
    72         'Realms' => array(1),
    7379        'Statistic' => 'http://localhost/stat/',
    7480      },
  • trunk/inc/html.php

    r614 r630  
    284284  function QuickNew()
    285285  {
    286     global $server, $Config;
     286    global $server, $Config, $System;
    287287
    288288    if(isset($_COOKIE['hof-quick']) AND $_COOKIE['hof-quick'] == 'no')
     
    297297        '<tr>'.
    298298        '<td colspan="2">'.
    299         '<strong>Server : </strong>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 3724)).'<b> (<a href="?page=realmlist">'.$server->ServerMangosOnline().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | <a href="?page=server">Server info</a> | <a href="?page=realmlist">Seznam světů</a></b>'.
     299        '<strong>Server : </strong>'.$server->OnlineStateImage($System->NetworkPortState($Config['Web']['WoWServerAddr'], 3724)).'<b> (<a href="?page=realmlist">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | <a href="?page=server">Server info</a> | <a href="?page=realmlist">Seznam světů</a></b>'.
    300300        '</td></tr></table><br />');
    301301    }
  • trunk/inc/server.php

    r627 r630  
    55}
    66
    7 class Server
     7class Server extends Module
    88{
    9   private $db;
    10  
    11   public function __construct($db)
    12   {
    13     $this->db = $db;
    14   }
    15  
    16   public function HumanDate($date, $time = 1)
     9  function __construct($System, $Id)
     10  {
     11    parent::__construct($System);
     12    $this->Id = $Id;
     13  }
     14
     15  function HumanDate($date, $time = 1)
    1716  {
    1817    // input date is 0000-00-00 00:00:00
     
    2726  }
    2827
    29   public function RealmOnline()
    30   {
    31     global $Config;
    32    
    33     $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
    34     $DbResult = $this->db->query('SELECT COUNT(*) FROM `account` WHERE `online` = 1');
     28  function OnlineAccountCount()
     29  {
     30    $this->Database->select_db($this->Config['Mangos']['DatabaseRealmd']);
     31    $DbResult = $this->Database->query('SELECT COUNT(*) FROM `account` WHERE `online` = 1');
    3532    $DbRow = $DbResult->fetch_row();
    3633    return($DbRow[0]);
    3734  }
    3835
    39   public function ParseCopper($copper_in)
     36  function ParseCopper($copper_in)
    4037  {
    4138    $copper = $copper_in;
     
    5047  }
    5148     
    52   public function MangosOnline($RealmId)
    53   {
    54     global $Config;
    55    
    56     $this->db->select_db($Config['Mangos']['RealmList'][$RealmId]['DatabaseCharacters']);   
    57     $DbResult = $this->db->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1');
    58     $DbRow = $DbResult->fetch_row();
    59     return($DbRow[0]);
    60   }
    61 
    62   public function ServerMangosOnline()
    63   {
    64     global $Config;
    65    
     49  function OnlineCharactersCount()
     50  {
    6651    $TotalCount = 0;
    67     foreach($Config['Mangos']['RealmList'] as $Index => $Realm)
     52    foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm)
    6853    {
    69       $TotalCount += $this->MangosOnline($Index);
     54      $Realm = new Realm($this->System, $Index);
     55      $TotalCount += $Realm->OnlineCharactersCount();
    7056    }
    7157    return($TotalCount);
    7258  } 
    7359
    74   public function ServerOnline($Address, $Port, $Timeout = 0.5)
    75   {
    76     set_error_handler('NullErrorHandler');
    77     if($Socket = @fsockopen($Address, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout))
     60  function OnlineStateImage($Status)
     61  {
     62    if($Status) return('<img src="imgs/inc/on.gif" alt="online" />&nbsp;<span style="text-color: #234303; text-size: 4;">Online</span>');
     63      else return('<img src="imgs/inc/off.gif" alt="offline" />&nbsp;<span style="text-color: #990000; text-size: 4;">Offline</span>');
     64  }
     65
     66  function CharacterCount()
     67  {
     68    $TotalCount = 0;
     69    foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm)
    7870    {
    79       fclose($Socket);
    80       $Result = true;
    81     } else $Result = false;
    82     restore_error_handler();
    83     return($Result);  }
    84 
    85   public function ServerImg($status)
    86   {
    87     if($status) return('<img src="imgs/inc/on.gif" alt="online" />&nbsp;<span style="text-color: #234303; text-size: 4;">Online</span>');
    88       else return('<img src="imgs/inc/off.gif" alt="offline" />&nbsp;<span style="text-color: #990000; text-size: 4;">Offline</span>');
    89   }
    90 
    91   public function ServerUptime()
    92   {
    93     global $Config;
    94 
    95     $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
    96     $row = $this->db->query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1')
    97   ->fetch_array();
    98     $uptime = round($row['uptime'] / 3600);
    99     return($uptime);
    100   }
    101 
    102   public function CharacterCount($RealmId)
    103   {
    104     global $Config;
    105 
    106     $this->db->select_db($Config['Mangos']['RealmList'][$RealmId]['DatabaseCharacters']);   
    107     $DbResult = $this->db->query('SELECT COUNT(*) FROM `characters`');
    108     $DbRow = $DbResult->fetch_row();
    109     return($DbRow[0]);
    110   }
    111 
    112   public function ServerCharacterCount()
    113   {
    114     global $Config;
    115    
    116     $TotalCount = 0;
    117     foreach($Config['Mangos']['RealmList'] as $Index => $Realm)
    118     {
    119       $TotalCount += $this->CharacterCount($Index);
     71      $Realm = new Realm($this->System, $Index);
     72      $TotalCount += $Realm->CharacterCount($Index);
    12073    }
    12174    return($TotalCount);
     
    12477  public function AccountCount()
    12578  {
    126     global $Config;
    127 
    128     $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
    129     $row = $this->db->query('SELECT COUNT(*) FROM account')->fetch_row();
     79    $this->Database->select_db($this->Config['Mangos']['DatabaseRealmd']);
     80    $row = $this->Database->query('SELECT COUNT(*) FROM account')->fetch_row();
    13081    return($row[0]);
    131   }
    132 
    133   public function GuidToCharName($guid)
    134   {
    135     global $Config;
    136 
    137     $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    138     $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array();
    139     return($row['name']);
    140   }
    141  
    142   public function ShowGmLog($log)
    143   {
    144     echo('<table border="1" width="540">'.
    145       '<tr>
    146             <th>Čas</th>
    147             <th>GM</th>
    148             <th>Příkaz</th>
    149             <th>Vybrán</th>
    150           </tr>');
    151     $gm_log = ereg_replace("\n",";",$log);
    152     $gm_log = explode(";",$gm_log);
    153     $gm_log = array_reverse($gm_log);
    154     foreach($gm_log as $row)
    155     {
    156       if (strpos($row,"Command:") == true)
    157       {
    158         $edited = str_replace(" Command: ", ";", $row);     // 0 - time
    159         $edited = str_replace(" (Account: ", ";", $edited); // 1 - command
    160         $edited = str_replace(" [Player: ", ";", $edited);  // 2 - gm
    161         $edited = str_replace(" Selected: ", ";", $edited); // 3 - position
    162         $edited = str_replace(" (GUID: ", ";", $edited);    // 4 - selected
    163         $edited = str_replace(")]", ";", $edited);          // 5 - selected guid
    164         $edited_arr = explode(";",$edited);
    165         if($edited_arr[4] == "player") $sel_name = " - ".$this -> GuidToCharName($edited_arr[5]);
    166           else $sel_name = '';
    167         $human_date = $this -> HumanDate ($edited_arr[0]);
    168         echo('<tr>
    169             <td><font size="2">'.$human_date.'</font></td>
    170             <td>'.$edited_arr[2].'</td>
    171             <td>'.$edited_arr[1].'</td>
    172             <td>'.$edited_arr[4].$sel_name.'</td>
    173           </tr>');
    174       }
    175       if(strpos($row, 'mail item:') == true)
    176       {
    177         $edited = str_replace(" GM ", ";", $row);
    178         $edited = str_replace(" (Account: ", ";", $edited);
    179         $edited = str_replace(") mail item: ", ";", $edited);
    180         $edited = str_replace(" (Account: ", ";", $edited);
    181         $edited = str_replace(")", "", $edited);
    182         $edited_arr = explode(";",$edited);
    183         $human_date = $this -> HumanDate ($edited_arr[0]);
    184         echo('<tr>
    185             <td><font size="2">'.$human_date.'</font></td>
    186             <td>'.$edited_arr[1].'</td>
    187             <td>Send : '.$edited_arr[3].')</td>
    188             <td>-</td>
    189           </tr>');
    190       }
    191       if(strpos($row,"trade:") == true)
    192       {
    193         $edited = str_replace(" GM ", ";", $row);
    194         $edited = str_replace(" (Account: ", ";", $edited);
    195         $edited = str_replace(") trade: ", ";", $edited);
    196         $edited = str_replace(" (Account: ", ";", $edited);
    197         $edited = str_replace(")", "", $edited);
    198         $edited_arr = explode(";",$edited);
    199            
    200         $human_date = $this -> HumanDate ($edited_arr[0]);
    201         echo('<tr>
    202             <td><font size="2">'.$human_date.'</font></td>
    203             <td>'.$edited_arr[1].'</td>
    204             <td>Trade : '.$edited_arr[3].')</td>
    205             <td>-</td>
    206           </tr>');
    207       }
    208     }
    209     echo('</table>');
    210   }
    211 
    212   public function SeoUrl($title)
    213   { 
    214     $address = $title; 
    215     $diakritika = array("á","ä","č","ď","é","ě","ë","í","ň","ó","ö","ř","š","ť","ú","ů","ü","ý","ž","Á","Ä","Č","Ď","É","Ě","Ë","Í","Ň","Ó","Ö","Ř","Š","Ť","Ú","Ů","Ü","Ý","Ž");
    216     $nediakritika = array("a","a","c","d","e","e","e","i","n","o","o","r","s","t","u","u","u","y","z","A","A","C","D","E","E","E","I","N","O","O","R","S","T","U","U","U","Y","Z");
    217     $address = str_replace($diakritika, $nediakritika, $address);
    218     $address = strtolower ($address);   
    219     $address = preg_replace ("/[^[:alpha:][:digit:]]/", "-", $address); 
    220     $address = trim ($address, "-"); 
    221     $address = preg_replace ("/[-]+/", "-", $address); 
    222     return($address); 
    22382  }
    22483
     
    372231  function RealmSelection($FormNameSufix = '')
    373232  {
    374     global $Config;
    375    
    376    
    377233    $Output = '';
    378     if(count($Config['Mangos']['RealmList']) > 1)
     234    if(count($this->Config['Mangos']['RealmList']) > 1)
    379235    {
    380236      if(array_key_exists('page', $_GET)) $Target = '?page='.$_GET['page'];
     
    382238      $Output .= '<div style="text-align: center;"><form name="RealmSelection'.$FormNameSufix.'" action="'.$Target.'" method="post">'.
    383239      '<div>Výběr světa <select name="RealmIndex" onchange="document.RealmSelection'.$FormNameSufix.'.submit()">';
    384       foreach($Config['Mangos']['RealmList'] as $Index => $Realm)
     240      foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm)
    385241      {
    386242        if($_COOKIE['RealmIndex'] == $Index) $Selected = ' selected="selected"';
  • trunk/index.php

    r628 r630  
    55foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    66
    7 include_once('inc/config.php');
     7if(file_exists('inc/config.php')) include_once('inc/config.php');
     8  else die('Nenalezen soubor inc/config.php. Vytvořte jej z předlohy config.sample.php.');
    89
    910if(array_key_exists('RealmIndex', $_POST))
     
    2829session_start();
    2930include_once('inc/error.php');
    30 include_once('inc/db.php');
     31include_once('inc/database.php');
     32include_once('inc/module.php');
    3133include_once('inc/html.php');
     34include_once('inc/system.php');
    3235include_once('inc/player.php');
    3336include_once('inc/server.php');
     37include_once('inc/realm.php');
    3438
    3539// classes start
     40$System = new System($Config);
     41$db = $System->Database;
    3642$player = new Player($db);
    37 $server = new Server($db);
     43$server = new Server($System, 1);
    3844$html = new Html(0, $db);
    3945$html->Start();
  • trunk/pages/arena.php

    r614 r630  
    1818}
    1919
    20 $db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
     20$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     21$db = $Realm->Database;
     22$db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']);
     23
    2124$count = $db->query('SELECT COUNT(*) FROM arena_team')->fetch_row();
    2225$all_record = $count[0];
  • trunk/pages/commands.php

    r614 r630  
    44$Output .= $server->RealmSelection();
    55
    6 $db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseMangos']);
     6$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     7$db = $Realm->Database;
     8$db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseMangos']);
    79
    810$Output .= '<ul>';
  • trunk/pages/events.php

    r614 r630  
    9090echo('<h3 class="PageTitle">Události ve hře</h3>');
    9191echo($server->RealmSelection());
     92$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     93$db = $Realm->Database;
     94$db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseMangos']);
    9295
    9396$Events = Events();
  • trunk/pages/gmteam.php

    r627 r630  
    33function ShowGMList($Realm)
    44{
    5   global $db, $Config;
     5  global $db, $db2, $Config;
    66 
    77  $Result = $db->query('SELECT * FROM `GmTeam` WHERE (`RealmId` = '.$Realm['Id'].') AND (`TimeTo` IS NULL) ORDER BY `RealmId`, `Nick`');
     
    2121    $Output .= '<td>';
    2222    $Characters = array();
    23     $ResultMangos = $db->query('SELECT * FROM `'.$Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters'].'`.`characters` WHERE `account` = "'.$Line['AccountId'].'"');
     23    $ResultMangos = $db2->query('SELECT * FROM `characters` WHERE `account` = "'.$Line['AccountId'].'"');
    2424    while($LineMangos = $ResultMangos->fetch_array())
    2525    {
     
    4949//$_COOKIE['RealmIndex']
    5050
     51$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     52$db2 = $Realm->Database;
     53$db2->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']);
     54
    5155$db->select_db($Config['Database']['Database']);
    5256$Output = '<h2 class="PageTitle">GM tým</h3>';
  • trunk/pages/guilda.php

    r609 r630  
    1010}
    1111
    12 $db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
     12$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     13$db = $Realm->Database;
     14$db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']);
    1315$id = (isset($_GET['id'])) ? $_GET['id'] : 0;
    1416if($id != 0)
  • trunk/pages/guildy.php

    r614 r630  
    4343  </tr>');
    4444
    45 $db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
     45$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     46$db = $Realm->Database;
     47$db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']);
    4648
    4749$sql = $db->query('SELECT `guild`.homepage, `guild`.name, `guild`.guildid, `guild`.createdate, COUNT(`guild_member`.`guildid`) AS member_count ,`leader`.`race` IN (1, 3, 4, 7, 11) AS fraction , `leader`.`guid` AS leader FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `characters` AS `memebers` ON `memebers`.`guid`= `guild_member`.`guid` JOIN `characters` AS `leader` ON `leader`.`guid`= `guild`.`leaderguid` GROUP BY guild.name ORDER BY '.$order_by.' '.$order_dir.';');
  • trunk/pages/online.php

    r615 r630  
    2424echo($server->RealmSelection());
    2525
    26 echo('<div style="text-align: center">Celkem '.$server->MangosOnline($_COOKIE['RealmIndex']).' hráčů.</div>'.
     26$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     27echo('<div style="text-align: center">Celkem '.$Realm->OnlineCharactersCount().' hráčů.</div>'.
    2728'<table class="BaseTable">
    2829  <tr>
     
    3637    MakeLink('Aréna body', 'arena_points').'</th></tr>');
    3738
    38 $db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    39 $sql = $db->query('SELECT guid, name, race, class, zone, map, '.
     39$Realm->Database->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
     40$sql = $Realm->Database->query('SELECT guid, name, race, class, zone, map, '.
    4041  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['HonorPoints'].'+1), " ", -1) AS UNSIGNED) AS highest_rank, '.
    4142  'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['Level'].' + 1), " ", -1) AS UNSIGNED) AS level, '.
  • trunk/pages/realmlist.php

    r616 r630  
    1818  if($DbResult->num_rows > 0)
    1919  {
     20    $Realm = new Realm($System, $Index);
    2021    $DbRow = $DbResult->fetch_assoc();
    21     $Output .= '<tr><td><a href="?page=online&amp;RealmIndex='.$Index.'">'.$RealmConfig['Name'].'</a></td><td>'.$RealmConfig['XPRate'].'x</td><td>'.$RealmConfig['Type'].'</td><td>'.$server->ServerImg($server->ServerOnline($DbRow['address'], $DbRow['port'])).'</td><td>'.$server->MangosOnline($Index).' / '.$RealmConfig['MaxOnlinePlayers'].' / '.$server->CharacterCount($Index).'</td></tr>';
     22    $Output .= '<tr><td><a href="?page=online&amp;RealmIndex='.$Index.'">'.$RealmConfig['Name'].'</a></td><td>'.$RealmConfig['XPRate'].'x</td><td>'.$RealmConfig['Type'].'</td><td>'.$server->OnlineStateImage($System->NetworkPortState($DbRow['address'], $DbRow['port'])).'</td><td>'.$Realm->OnlineCharactersCount($Index).' / '.$RealmConfig['MaxOnlinePlayers'].' / '.$Realm->CharacterCount($Index).'</td></tr>';
    2223    $Output .= '<tr><td colspan="5">'.$RealmConfig['Description'].'</td></tr>';
    2324    if(array_key_exists($Index + 1, $Config['Mangos']['RealmList'])) $Output .= '<tr><td colspan="5">&nbsp;</td></tr>';
  • trunk/pages/server.php

    r628 r630  
    88  <tr>
    99    <td>Přihlašovací server je</td>
    10     <td>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 3724)).'</td>
     10    <td>'.$server->OnlineStateImage($System->NetworkPortState($Config['Web']['WoWServerAddr'], 3724)).'</td>
    1111  </tr>
    1212  <tr>
     
    1616  <tr>
    1717    <td>Ve všech světech přítomno</td>
    18     <td>'.$server->ServerMangosOnline().' hráčů</td>
    19   </tr>
    20   <tr>
    21     <td>Server beží bez restartu</td>
    22     <td>'.$server->ServerUptime().' (hodiny)</td>
     18    <td>'.$server->OnlineAccountCount().' hráčů</td>
    2319  </tr>
    2420  <tr>
     
    2824  <tr>
    2925    <td>Ve všech světech uloženo</td>
    30     <td>'.$server->ServerCharacterCount().' postav</td>
     26    <td>'.$server->CharacterCount().' postav</td>
    3127  </tr>
    3228  <tr>
    3329    <td><a href="?page=teamspeak">TeamSpeak</a> server je</td>
    34     <td>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 51234)).'</td>
     30    <td>'.$server->OnlineStateImage($System->NetworkPortState($Config['Web']['WoWServerAddr'], 51234)).'</td>
    3531  </tr>
    3632  <tr>
    3733    <td><a href="http://www.heroesoffantasy.cz:6969/">Torrent</a> server je</td>
    38     <td>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 6969)).'</td>
     34    <td>'.$server->OnlineStateImage($System->NetworkPortState($Config['Web']['WoWServerAddr'], 6969)).'</td>
    3935  </tr>
    4036  <tr>
     
    6561{
    6662  $Realms = array();
    67   foreach($Server['Realms'] as $Realm)
    68     $Realms[] = $Config['Mangos']['RealmList'][$Realm]['Name'];
     63  foreach($Config['Mangos']['RealmList'] as $RealmIndex => $Realm)
     64  {
     65    if($Realm['Server'] == $Index) $Realms[] = $Realm['Name'];
     66  }
    6967   
    7068  $Output .= '<table class="BaseTable" style="width: 100%; margin: 5px;">
  • trunk/pages/tophraci.php

    r614 r630  
    2121}
    2222
    23 $db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
     23$Realm = new Realm($System, $_COOKIE['RealmIndex']);
     24$db = $Realm->Database;
     25$db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']);
     26
    2427$sql = 'SELECT name, totaltime, online FROM characters ORDER BY totaltime DESC LIMIT '.$top;
    2528$result = $db->query($sql);
Note: See TracChangeset for help on using the changeset viewer.