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