- Timestamp:
- Dec 21, 2009, 1:19:51 PM (15 years ago)
- Location:
- branches/new
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new/inc/server.php
r655 r663 2 2 3 3 include_once(dirname(__FILE__).'/module.php'); 4 5 function NullErrorHandler()6 {7 }8 4 9 5 class Server extends Module … … 223 219 } 224 220 225 function RealmSelection($FormNameSufix = '')226 {227 $Output = '';228 if(count($this->Config['Mangos']['RealmList']) > 1)229 {230 if(array_key_exists('page', $_GET)) $Target = '?page='.$_GET['page'];231 else $Target = '';232 $Output .= '<div style="text-align: center;"><form id="RealmSelection'.$FormNameSufix.'" action="'.$Target.'" method="post">'.233 '<div>Výběr světa <select name="RealmIndex" onchange="document.getElementById(\'RealmSelection'.$FormNameSufix.'\').submit()">';234 foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm)235 {236 if($_COOKIE['RealmIndex'] == $Index) $Selected = ' selected="selected"';237 else $Selected = '';238 $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Realm['Name'].'</option>';239 }240 $Output .= '</select></div>'.241 '</form></div>';242 }243 return($Output);244 }245 221 } 246 222 -
branches/new/index.php
r654 r663 1 <?php 1 <?php 2 session_start(); 2 3 3 4 // SQL injection hack protection … … 5 6 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); 6 7 7 if(file_exists('inc/config.php')) include_once('inc/config.php');8 if(file_exists('inc/config.php')) require_once('inc/config.php'); 8 9 else die('Nenalezen soubor inc/config.php. Vytvořte jej z předlohy config.sample.php.'); 9 10 if(array_key_exists('RealmIndex', $_POST))11 {12 setcookie('RealmIndex', $_POST['RealmIndex']);13 $_COOKIE['RealmIndex'] = $_POST['RealmIndex'];14 }15 if(array_key_exists('RealmIndex', $_GET))16 {17 setcookie('RealmIndex', $_GET['RealmIndex']);18 $_COOKIE['RealmIndex'] = $_GET['RealmIndex'];19 }20 $RealmList = $Config['Mangos']['RealmList'];21 $FirstRealm = array_shift($RealmList);22 if(!array_key_exists('RealmIndex', $_COOKIE)) $_COOKIE['RealmIndex'] = $FirstRealm['Id'];23 else24 {25 if(!array_key_exists($_COOKIE['RealmIndex'], $Config['Mangos']['RealmList']))26 $_COOKIE['RealmIndex'] = $FirstRealm['Id'];27 }28 10 29 session_start(); 30 include_once('inc/error.php'); 31 include_once('inc/database.php'); 32 include_once('inc/html.php'); 33 include_once('inc/system.php'); 34 include_once('inc/player.php'); 35 include_once('inc/server.php'); 36 include_once('inc/realm.php'); 11 require_once('inc/error.php'); 12 require_once('inc/database.php'); 13 require_once('inc/html.php'); 14 require_once('inc/system.php'); 15 require_once('inc/player.php'); 16 require_once('inc/server.php'); 17 require_once('inc/realm.php'); 37 18 38 19 // classes start … … 43 24 $html = new Html(0, $db); 44 25 $html->Start(); 45 if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1;46 else $num_headers = 8;47 26 48 27 echo('<div id="page">'. 49 '<div id="header" style="background-image: url(imgs/web/headers/header '.rand(0, $num_headers - 1).'.jpg);"></div>'.28 '<div id="header" style="background-image: url(imgs/web/headers/header0.jpg);"></div>'. 50 29 '<div id="top"></div>'. 51 30 '<div id="menu">'); … … 72 51 ); 73 52 74 $RealmMenuItems = array(75 array('link' => '?page=online', 'Text' => 'Online hráči'),76 array('link' => '#', 'Text' => 'Mapa hráčů', 'OnClick' => "popup('../minimanager/pomm/pomm.php?realmid=".$_COOKIE['RealmIndex']."', 1000, 800); return false;"),77 array('link' => '?page=tophraci', 'Text' => 'Nej hráči'),78 array('link' => '?page=guildy', 'Text' => 'Spolky'),79 array('link' => 'armory/', 'Text' => 'Armory'),80 array('link' => '?page=gh', 'Text' => 'Domky spolků'),81 array('link' => '?page=arena', 'Text' => 'Arény'),82 array('link' => '?page=events', 'Text' => 'Události'),83 //array('link' => '?page=gmlog', 'Text' => 'GM log'),84 array('link' => '?page=commands', 'Text' => 'Příkazy'),85 );86 87 53 echo('<br /><br />'); 88 54 echo('<div class="mainmenu">'); 89 55 foreach($ServerMenuItems as $Item) 90 {91 if(array_key_exists('OnClick', $Item)) $OnClick = ' onclick="'.$Item['OnClick'].'"';92 else $OnClick = '';93 if(array_key_exists('Target', $Item)) $Target = ' target="'.$Item['Target'].'"';94 else $Target = '';95 96 echo('<a href="'.$Item['link'].'"'.$OnClick.$Target.'>'.$Item['Text'].'</a><br />');97 }98 echo('</div>');99 100 echo($server->RealmSelection('Menu'));101 102 echo('<br /><br />');103 echo('<div class="mainmenu">');104 foreach($RealmMenuItems as $Item)105 56 { 106 57 if(array_key_exists('OnClick', $Item)) $OnClick = ' onclick="'.$Item['OnClick'].'"';
Note:
See TracChangeset
for help on using the changeset viewer.