source: trunk/index.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: 6.4 KB
Line 
1<?php
2
3// URL routing
4$QueryString = $_SERVER['QUERY_STRING'];
5if(substr($QueryString, -1, 1) == '/') $QueryString = substr($QueryString, 0, -1);
6$QueryItems = explode('/', $QueryString);
7//echo($_SERVER['QUERY_STRING']);
8//print_r($QueryItems);
9if(strpos($_SERVER['REQUEST_URI'], '?') !== false)
10 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
11 else $_SERVER['QUERY_STRING'] = '';
12//echo(phpinfo());
13
14if(count($QueryItems) > 0)
15 $Page = 'pages/'.$QueryItems[0].'.php';
16if(!file_exists($Page)) $Page = 'pages/main.php';
17
18if(file_exists('inc/config.php')) include_once('inc/config.php');
19 else die('Nenalezen soubor inc/config.php. Vytvořte jej z předlohy config.sample.php.');
20
21session_start();
22include_once('inc/error.php');
23include_once('inc/database.php');
24include_once('inc/html.php');
25include_once('inc/system.php');
26include_once('inc/player.php');
27include_once('inc/server.php');
28include_once('inc/realm.php');
29
30// SQL injection hack protection
31foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
32foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
33
34// classes start
35$System = new System($Config);
36$db = $System->Database;
37$player = new Player($db);
38$server = new Server($System, 1);
39$html = new Html(0, $db);
40$html->Start();
41$_GET = $html->GetQueryStringArray();
42
43if(array_key_exists('RealmIndex', $_POST))
44{
45 setcookie('RealmIndex', $_POST['RealmIndex']);
46 $_COOKIE['RealmIndex'] = $_POST['RealmIndex'];
47}
48if(array_key_exists('RealmIndex', $_GET))
49{
50 setcookie('RealmIndex', $_GET['RealmIndex']);
51 $_COOKIE['RealmIndex'] = $_GET['RealmIndex'];
52}
53
54if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1;
55 else $num_headers = 8;
56
57// Check right RealmIndex
58if(!array_key_exists('RealmIndex', $_COOKIE))
59{
60 $_COOKIE['RealmIndex'] = $Config['Web']['DefaultRealmIndex'];
61} else
62{
63 $DbResult = $System->Database->query('SELECT Id FROM Realm WHERE Id='.$_COOKIE['RealmIndex']);
64 if($DbResult->num_rows == 0) $_COOKIE['RealmIndex'] = $Config['Web']['DefaultRealmIndex'];
65}
66
67echo('<div id="page">'.
68 '<div id="header" style="background-image: url('.$html->Link('/imgs/web/headers/header'.rand(0, $num_headers - 1).'.jpg').');"></div>'.
69 '<div id="top"></div>'.
70 '<div id="menu">');
71
72$ServerMenuItems = array(
73 array('link' => $html->Link('/'), 'Text' => 'Úvod'),
74 array('link' => $html->Link('/jak-zacit/'), 'Text' => 'Jak začít'),
75 array('link' => $html->Link('/registrace/'), 'Text' => 'Registrace'),
76 array('link' => $html->Link('/ucet/'), 'Text' => 'Správa účtu'),
77 array('link' => $html->Link('/forum/'), 'Text' => 'Fórum'),
78 array('link' => $html->Link('/server/'), 'Text' => 'Server'),
79 array('link' => $html->Link('/galerie/'), 'Text' => 'Galerie'),
80 array('link' => $html->Link('/propagace/'), 'Text' => 'Propagace'),
81 array('link' => $html->Link('/odkazy/'), 'Text' => 'Odkazy'),
82 //array('link' => $html->Link('/blokovani-uctu/'), 'Text' => 'Bany'),
83 array('link' => $html->Link('/finance/'), 'Text' => 'Dotace'),
84 array('link' => $html->Link('/teamspeak/'), 'Text' => 'Team speak'),
85 array('link' => $html->Link('/hledani/'), 'Text' => 'Vyhledávání'),
86 array('link' => $html->Link('/svety/'), 'Text' => 'Světy'),
87);
88
89$DbResult = $System->Database->query('SELECT '.$System->SQLURLName('Name').' AS URLName FROM Realm WHERE Id='.$_COOKIE['RealmIndex']);
90$Realm = $DbResult->fetch_assoc();
91$RealmMenuItems = array(
92 array('link' => $html->Link('/svety/'.$Realm['URLName'].'/online-hraci/'), 'Text' => 'Online hráči'),
93 array('link' => '#', 'Text' => 'Mapa hráčů', 'OnClick' => "popup('".$html->Link("/minimanager/map/?r_id=".$_COOKIE['RealmIndex'])."', 1000, 800); return false;"),
94 array('link' => $html->Link('/svety/'.$Realm['URLName'].'/nej-hraci/'), 'Text' => 'Nej hráči'),
95 array('link' => $html->Link('/svety/'.$Realm['URLName'].'/spolky/'), 'Text' => 'Spolky'),
96 array('link' => $html->Link('/armory/'), 'Text' => 'Armory'),
97 array('link' => $html->Link('/svety/'.$Realm['URLName'].'/arena/'), 'Text' => 'Arény'),
98 array('link' => $html->Link('/svety/'.$Realm['URLName'].'/akce/'), 'Text' => 'Události'),
99 array('link' => $html->Link('/svety/'.$Realm['URLName'].'/prikazy/'), 'Text' => 'Příkazy'),
100);
101
102echo('<br /><br />');
103echo('<div class="mainmenu">');
104foreach($ServerMenuItems as $Item)
105{
106 if(array_key_exists('OnClick', $Item)) $OnClick = ' onclick="'.$Item['OnClick'].'"';
107 else $OnClick = '';
108 if(array_key_exists('Target', $Item)) $Target = ' target="'.$Item['Target'].'"';
109 else $Target = '';
110
111 echo('<a href="'.$Item['link'].'"'.$OnClick.$Target.'>'.$Item['Text'].'</a><br />');
112}
113echo('</div>');
114
115echo($server->RealmSelection('Menu'));
116
117echo('<br /><br />');
118echo('<div class="mainmenu">');
119foreach($RealmMenuItems as $Item)
120{
121 if(array_key_exists('OnClick', $Item)) $OnClick = ' onclick="'.$Item['OnClick'].'"';
122 else $OnClick = '';
123 if(array_key_exists('Target', $Item)) $Target = ' target="'.$Item['Target'].'"';
124 else $Target = '';
125
126 echo('<a href="'.$Item['link'].'"'.$OnClick.$Target.'>'.$Item['Text'].'</a><br />');
127}
128echo('</div>');
129
130echo('<div class="Banners">'.
131 '<br />'.
132 '<a href="http://wowpreklad.zdechov.net/"><img src="http://wowpreklad.zdechov.net/banners/baner_88_31.jpg" alt="baner_http://wowpreklad.zdechov.net/" height="31" width="88" /></a><br />'.
133 '<br/><br/>'.
134 '<a href="http://www.toplist.cz/"><img src="http://toplist.cz/count.asp?logo=mc&amp;ID=324802" width="88" height="60" alt="counter" /></a><br />'.
135 '<br /><a href="http://counter.cnw.cz/">'.
136 '<img src="http://counter.cnw.cz/monika.cgi?wowzdechov&amp;7&amp;000000&amp;FFFFFF&amp;on" alt="CNW:Counter" /></a>'.
137 "\n".
138 '<script type="text/javascript">
139 <!--
140 document.write("<a href=\"http://counter.cnw.cz\" target=\"_parent\"><img src=\"http://counter.cnw.cz/trackit.cgi?wowzdechov&t4&" + escape(top.document.referrer) + "\" alt=\"CNW:Tracker\" border=\"0\" width=\"1\" height=\"1\"><\/a>");
141 // -->
142 </script>'.
143 '</div>'.
144 '</div>'.
145 '<div id="content">');
146
147// obsah start
148$include = 1;
149if($include == 1)
150{
151 include_once($Page);
152}
153echo('</div>'.
154'<div id="footer"><br /><div id="copyright"><a href="'.$html->Link('/autori/').'">Vývoj webu</a></div></div></div>');
155
156$html->Stop();
157$db->close();
158
159?>
Note: See TracBrowser for help on using the repository browser.