Changeset 690 for trunk/index.php


Ignore:
Timestamp:
Mar 19, 2010, 9:22:00 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Zavedení systému pěkných URL. Přejmenováno mnoho stránek.
  • Přidáno: Skript pro generování SERVERALERT aktualit pro klienta.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r688 r690  
    11<?php
    22
    3 // SQL injection hack protection
    4 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
    5 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
     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'] = '';
     12echo(phpinfo());
     13
     14if(count($QueryItems) > 0)
     15  $Page = 'pages/'.$QueryItems[0].'.php';
     16if(!file_exists($Page)) $Page = 'pages/main.php';
    617
    718if(file_exists('inc/config.php')) include_once('inc/config.php');
     
    2839include_once('inc/realm.php');
    2940
     41// SQL injection hack protection
     42foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     43foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
     44
    3045// classes start
    3146$System = new System($Config);
     
    3550$html = new Html(0, $db);
    3651$html->Start();
     52$_GET = $html->GetQueryStringArray();
     53
    3754if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1;
    3855  else $num_headers = 8;
     
    4966
    5067echo('<div id="page">'.
    51   '<div id="header" style="background-image: url(imgs/web/headers/header'.rand(0, $num_headers - 1).'.jpg);"></div>'.
     68  '<div id="header" style="background-image: url('.$html->Link('/imgs/web/headers/header'.rand(0, $num_headers - 1).'.jpg').');"></div>'.
    5269  '<div id="top"></div>'.
    5370  '<div id="menu">');
    5471
    5572$ServerMenuItems = array(
    56   array('link' => '?page=main', 'Text' => 'Úvod'),
    57   array('link' => '?page=begin', 'Text' => 'Jak začít'),
     73  array('link' => $html->Link('/'), 'Text' => 'Úvod'),
     74  array('link' => $html->Link('/jak-zacit/'), 'Text' => 'Jak začít'),
    5875  //array('link' => '?page=rules', 'Text' => 'Pravidla'),
    59   array('link' => '?page=register', 'Text' => 'Registrace'),
    60   array('link' => '?page=acc', 'Text' => 'Správa účtu'),
    61   array('link' => 'forum/', 'Text' => 'Fórum'),
    62   array('link' => '?page=server', 'Text' => 'Server'),
     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'),
    6380  //array('link' => '?page=gmteam', 'Text' => 'GM Tým'),
    6481  //array('link' => 'bug_tracker/', 'Text' => 'Nahlaš chybu'),
    65   array('link' => 'gallery/', 'Text' => 'Galerie'),     
    66   array('link' => '?page=reklama', 'Text' => 'Reklama'),
     82  array('link' => $html->Link('/galerie/'), 'Text' => 'Galerie'),     
     83  array('link' => $html->Link('/propagace/'), 'Text' => 'Propagace'),
    6784  //array('link' => '?page=download', 'Text' => 'Stahování'),
    68   array('link' => '?page=links', 'Text' => 'Odkazy'),
    69   array('link' => '?page=banlist', 'Text' => 'Bany'),
    70   array('link' => '?page=dotation', 'Text' => 'Dotace'),
    71   array('link' => '?page=teamspeak', 'Text' => 'Team speak'),
    72   array('link' => '?page=search', 'Text' => 'Vyhledávání'),
    73   array('link' => '?page=realmlist', 'Text' => 'Světy'),   
     85  array('link' => $html->Link('/odkazy/'), 'Text' => 'Odkazy'),
     86  //array('link' => $html->Link('/blokovani-uctu/'), 'Text' => 'Bany'),
     87  array('link' => $html->Link('/finance/'), 'Text' => 'Dotace'),
     88  array('link' => $html->Link('/teamspeak/'), 'Text' => 'Team speak'),
     89  array('link' => $html->Link('/hledani/'), 'Text' => 'Vyhledávání'),
     90  array('link' => $html->Link('/realmlist/'), 'Text' => 'Světy'),   
    7491);
    7592
    7693$RealmMenuItems = array(
    77   array('link' => '?page=online', 'Text' => 'Online hráči'),
    78   array('link' => '#', 'Text' => 'Mapa hráčů', 'OnClick' => "popup('../minimanager/pomm/pomm.php?realmid=".$_COOKIE['RealmIndex']."', 1000, 800); return false;"),
    79   array('link' => '?page=tophraci', 'Text' => 'Nej hráči'),
    80   array('link' => '?page=guildy', 'Text' => 'Spolky'),
    81   array('link' => 'armory/', 'Text' => 'Armory'),
     94  array('link' => $html->Link('/online-hraci/'), 'Text' => 'Online hráči'),
     95  array('link' => '#', 'Text' => 'Mapa hráčů', 'OnClick' => "popup('".$html->Link("/minimanager/pomm/pomm.php?realmid=".$_COOKIE['RealmIndex'])."', 1000, 800); return false;"),
     96  array('link' => $html->Link('/nej-hraci/'), 'Text' => 'Nej hráči'),
     97  array('link' => $html->Link('/spolky/'), 'Text' => 'Spolky'),
     98  array('link' => $html->Link('/armory/'), 'Text' => 'Armory'),
    8299  //array('link' => '?page=gh', 'Text' => 'Domky spolků'),
    83   array('link' => '?page=arena', 'Text' => 'Arény'),
    84   array('link' => '?page=events', 'Text' => 'Události'),
     100  array('link' => $html->Link('/arena/'), 'Text' => 'Arény'),
     101  array('link' => $html->Link('/akce/'), 'Text' => 'Události'),
    85102  //array('link' => '?page=gmlog', 'Text' => 'GM log'),
    86   array('link' => '?page=commands', 'Text' => 'Příkazy'),
     103  array('link' => $html->Link('/prikazy/'), 'Text' => 'Příkazy'),
    87104);
    88105
     
    116133
    117134echo('<div class="Banners">'.
    118   '<strong>Naše ikonka :</strong><br />'.
    119   '<a href="'.$Config['Web']['BaseURL'].'"><img src="imgs/web/hof_ban.png" alt="WoW Server Heroes of Fantasy" /></a><br />'.
    120   '<strong>Odkazy :</strong><br />'.
    121   '<a href="http://servery.wowresource.eu/"><img src="http://servery.wowresource.eu/templates/img/bannery/banner_maly.gif" alt="WoW Server status" /></a><br />'.
    122   '<a href="http://www.wowhead.com"><img src="http://www.wowhead.com/images/badge_88x31.gif" width="88" height="31" alt="" /></a><br />'.
     135  '<br />'.
    123136  '<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 />'.
    124   '<strong>Statistika :</strong><br />'.
    125   '<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 /><br />'.
    126   'Počet přístupů: <br /><a href="http://counter.cnw.cz/">'.
     137  '<br/><br/>'.
     138  '<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 />'.
     139  '<br /><a href="http://counter.cnw.cz/">'.
    127140  '<img src="http://counter.cnw.cz/monika.cgi?wowzdechov&amp;7&amp;000000&amp;FFFFFF&amp;on" alt="CNW:Counter" /></a>'.
    128141  "\n".
     
    147160if($include == 1)
    148161{
    149   if(isset($_GET['page'])) include_once($html->Pager($_GET['page'], 'pages', 'main'));
    150     else include_once('pages/main.php');
     162  include_once($Page);
    151163}
    152164echo('</div>'.
    153 '<div id="footer"><br /><div id="copyright"><a href="?page=autori">Vývoj webu</a></div></div></div>');
     165'<div id="footer"><br /><div id="copyright"><a href="'.$html->Link('/autori/').'">Vývoj webu</a></div></div></div>');
    154166
    155167$html->Stop();
Note: See TracChangeset for help on using the changeset viewer.