Changeset 663 for branches


Ignore:
Timestamp:
Dec 21, 2009, 1:19:51 PM (15 years ago)
Author:
Bidi
Message:

Větev NEW: Smazáno RealmMenu & náhodný header (příprava na třídu Menu). Opraveny varování a poznámky PHP.

Location:
branches/new
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/new/inc/server.php

    r655 r663  
    22
    33include_once(dirname(__FILE__).'/module.php');
    4 
    5 function NullErrorHandler()
    6 {
    7 }
    84
    95class Server extends Module
     
    223219  }
    224220 
    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   }
    245221}
    246222
  • branches/new/index.php

    r654 r663  
    1 <?php
     1<?php
     2session_start();
    23
    34// SQL injection hack protection
     
    56foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    67
    7 if(file_exists('inc/config.php')) include_once('inc/config.php');
     8if(file_exists('inc/config.php')) require_once('inc/config.php');
    89  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   else
    24   {
    25     if(!array_key_exists($_COOKIE['RealmIndex'], $Config['Mangos']['RealmList']))
    26       $_COOKIE['RealmIndex'] = $FirstRealm['Id'];
    27   }
    2810 
    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');
     11require_once('inc/error.php');
     12require_once('inc/database.php');
     13require_once('inc/html.php');
     14require_once('inc/system.php');
     15require_once('inc/player.php');
     16require_once('inc/server.php');
     17require_once('inc/realm.php');
    3718
    3819// classes start
     
    4324$html = new Html(0, $db);
    4425$html->Start();
    45 if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1;
    46   else $num_headers = 8;
    4726
    4827echo('<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>'.
    5029  '<div id="top"></div>'.
    5130  '<div id="menu">');
     
    7251);
    7352
    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 
    8753echo('<br /><br />');
    8854echo('<div class="mainmenu">');
    8955foreach($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)
    10556{
    10657  if(array_key_exists('OnClick', $Item)) $OnClick = ' onclick="'.$Item['OnClick'].'"';
Note: See TracChangeset for help on using the changeset viewer.