source: trunk/index.php@ 693

Last change on this file since 693 was 693, checked in by george, 15 years ago
  • Opraveny: Další odkazy na stránky.
File size: 6.0 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
21
22session_start();
23include_once('inc/error.php');
24include_once('inc/database.php');
25include_once('inc/html.php');
26include_once('inc/system.php');
27include_once('inc/player.php');
28include_once('inc/server.php');
29include_once('inc/realm.php');
30
31// SQL injection hack protection
32foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
33foreach($_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
44if(array_key_exists('RealmIndex', $_POST))
45{
46 setcookie('RealmIndex', $_POST['RealmIndex']);
47 $_COOKIE['RealmIndex'] = $_POST['RealmIndex'];
48}
49if(array_key_exists('RealmIndex', $_GET))
50{
51 setcookie('RealmIndex', $_GET['RealmIndex']);
52 $_COOKIE['RealmIndex'] = $_GET['RealmIndex'];
53}
54
55if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1;
56 else $num_headers = 8;
57
58// Check right RealmIndex
59if(!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
68echo('<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
101echo('<br /><br />');
102echo('<div class="mainmenu">');
103foreach($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}
112echo('</div>');
113
114echo($server->RealmSelection('Menu'));
115
116echo('<br /><br />');
117echo('<div class="mainmenu">');
118foreach($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}
127echo('</div>');
128
129echo('<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&amp;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&amp;7&amp;000000&amp;FFFFFF&amp;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;
148if($include == 1)
149{
150 include_once($Page);
151}
152echo('</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?>
Note: See TracBrowser for help on using the repository browser.