source: trunk/pages/svety.php@ 695

Last change on this file since 695 was 695, checked in by george, 15 years ago
  • Upraveno: Použití názvů světů v URL namísto RealmIndex.
  • Přidáno: Stránka zobrazující informace o jednotlivých světech.
  • Odebráno: Nezobrazovat kategorie aktualit. Stačí jen jedna.
  • Přidáno: Funkce pro generování XML seznamu hráčů ve stylu WoWEmu pro wowstatus.
File size: 3.4 KB
Line 
1<?php
2
3function RealmList()
4{
5 global $System, $html;
6
7if(array_key_exists('Server', $_GET))
8{
9 $DbResult = $System->Database->query('SELECT Logon.Id, Host.Address, Logon.Port FROM Logon JOIN Host ON Host.Id=Logon.Host WHERE Logon.Id='.$_GET['Server'].' AND Logon.Enabled=1');
10 if($DbResult->num_rows > 0)
11 {
12 $Realm = $DbResult->fetch_assoc();
13 echo('set realmlist '.$Realm['Address']);
14 if($Realm['Port'] != 3724) echo(':'.$Realm['Port']);
15 echo('</div>');
16 } else echo('Neznámé Id serveru');
17} else
18{
19 $Output = '<h2 align="center">Seznam světů</h2>';
20
21 $DbResult = $System->Database->query('SELECT Logon.ClientVersion, Logon.Name, Logon.Id, Host.Address, Logon.Port FROM Logon JOIN Host ON Host.Id=Logon.Host WHERE Logon.Enabled=1');
22 while($DbRow = $DbResult->fetch_assoc())
23 {
24 $Server = new Server($System, $DbRow['Id']);
25 $Output .= '<div style="text-align: center">'.$DbRow['Name'].' '.$DbRow['ClientVersion'].' - realmlist: <a href="'.$html->Link('/svety/?Server='.$DbRow['Id']).'">'.$DbRow['Address'];
26 if($DbRow['Port'] != 3724) $Output .= ':'.$DbRow['Port'];
27 $Output .= '</a></div>';
28 $Output .= '<table class="BaseTable">'.
29 '<tr>'.
30 '<th>Název</th>'.
31 '<th>Násobek XP</th>'.
32 '<th>Zaměření</th>'.
33 '<th>Stav</th>'.
34 '<th>Hráči online / max. online / celkem</th>'.
35 '</tr>';
36
37 $DbResult2 = $System->Database->query('SELECT *, '.$System->SQLURLName('Name').' AS URLName FROM Realm WHERE Logon='.$Server->Id.' AND Enabled=1 ORDER BY Name');
38 while($DbRow = $DbResult2->fetch_assoc())
39 {
40 $Realm = new Realm($System, $DbRow['Id']);
41 $Output .= '<tr><td><a href="'.$html->Link('/svety/'.$DbRow['URLName'].'/').'">'.$Realm->Data['Name'].'</a></td><td>'.$Realm->Data['Rate'].'</td><td>'.$Realm->Data['Type'].'</td><td>'.$Server->OnlineStateImage($Realm->Data['Online']).'</td><td>'.$Realm->OnlineCharactersCount().' / '.$Realm->Data['MaxOnlinePlayers'].' / '.$Realm->CharacterCount().'</td></tr>';
42 $Output .= '<tr><td colspan="5">'.$Realm->Data['Description'].'</td></tr>';
43 //if(array_key_exists($Index + 1, $Config['Mangos']['RealmList']))
44 $Output .= '<tr><td colspan="5">&nbsp;</td></tr>';
45 }
46 $Output .= '</table><br/>';
47 }
48 echo($Output);
49}
50}
51
52function RealmInfo()
53{
54 global $System;
55
56 $DbResult = $System->Database->query('SELECT * FROM Realm WHERE Id='.$_COOKIE['RealmIndex']);
57 $Realm = $DbResult->fetch_assoc();
58 echo('<h2 align="center">'.$Realm['Name'].'</h2>');
59 echo($Realm['Information']);
60}
61
62if(count($QueryItems) > 1)
63{
64 $RealmName = $QueryItems[1];
65 $DbResult = $System->Database->query('SELECT Id FROM Realm WHERE '.$System->SQLURLName('Name').'="'.$RealmName.'"');
66 $DbRow = $DbResult->fetch_assoc();
67 $_COOKIE['RealmIndex'] = $DbRow['Id'];
68
69 if(count($QueryItems) > 2)
70 {
71 if($QueryItems[2] == 'online-hraci') include('online-hraci.php');
72 else if($QueryItems[2] == 'prikazy') include('prikazy.php');
73 else if($QueryItems[2] == 'akce') include('akce.php');
74 else if($QueryItems[2] == 'arena') include('arena.php');
75 else if($QueryItems[2] == 'nej-hraci') include('nej-hraci.php');
76 else if($QueryItems[2] == 'mapa') include('mapa.php');
77 else if($QueryItems[2] == 'spolek') include('spolek.php');
78 else if($QueryItems[2] == 'spolky') include('spolky.php');
79 else RealmInfo();
80 } else RealmInfo();
81} else RealmList();
82
83?>
Note: See TracBrowser for help on using the repository browser.