Changeset 690 for trunk/inc


Ignore:
Timestamp:
Mar 19, 2010, 9:22:00 PM (15 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.
Location:
trunk/inc
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/config.sample.php

    r682 r690  
    3838  (
    3939    'Charset' => 'utf-8',
    40     'BaseURL' => 'http://localhost/',
     40    'Host' => 'george-virt.zdechov.net',
    4141    'Description' => 'Neoficiální herní server hry World of Warcraft',
    4242    'Keywords' => 'wowserver, world of warcraft, free, wow, server, hof, heroes of fantasy, zdechov, mangos',
  • trunk/inc/html.php

    r684 r690  
    3232    }
    3333  }
     34 
     35  function Link($Path)
     36  {
     37    global $Config;
     38   
     39    if(substr($Path, 0, 1) == '/') return($Config['Web']['BaseURL'].$Path);
     40    return($Path);
     41  }
    3442
    3543  private function CfgChck($value)
     
    6068    '<meta name="description" content="'.$Config['Web']['Description'].'" />'.
    6169    '<meta name="keywords" content="'.$Config['Web']['Keywords'].'" />'.
    62     '<link rel="stylesheet" type="text/css" href="styles/style.css" />'.
    63     '<link href="inc/teamspeakdisplay/teamspeakdisplay.css" rel="stylesheet" type="text/css" />'.
    64     '<link rel="alternate" title="Články" href="rss.php?category=articles" type="application/rss+xml" />'.
    65     '<link rel="alternate" title="Finanční přispěvky" href="rss.php?category=finance" type="application/rss+xml" />'.
    66     '<script type="text/javascript" src="styles/global.js"></script>'.
    67     '<!--[if IE]><link rel="stylesheet" type="text/css" href="styles/ie.css" /><![endif]-->'.
     70    '<link rel="stylesheet" type="text/css" href="'.$this->Link('/styles/style.css.php').'" />'.
     71    '<link href="'.$this->Link('/inc/teamspeakdisplay/teamspeakdisplay.css').'" rel="stylesheet" type="text/css" />'.
     72    '<link rel="alternate" title="Články" href="'.$this->Link('/rss.php?category=articles').'" type="application/rss+xml" />'.
     73    '<link rel="alternate" title="Finanční přispěvky" href="'.$this->Link('rss.php?category=finance').'" type="application/rss+xml" />'.
     74    '<script type="text/javascript" src="'.$this->Link('/styles/global.js').'"></script>'.
     75    '<!--[if IE]><link rel="stylesheet" type="text/css" href="'.$this->Link('styles/ie.css').'" /><![endif]-->'.
    6876    '</head>'.
    6977    '<body>';
     
    100108  }
    101109
    102   public function Pager($get, $dir_pages, $def)
    103   {
    104     $anti_ref = array
    105     (
    106       'server' => 5,
    107       'events' => 2,
    108       'aukce' => 2,
    109       'gmlog' => 300,
    110       'online' => 2,
    111     );
    112     $site_show = $dir_pages.'/'.$get.'.php';
    113     if(isset($anti_ref[$get]))
    114     {
    115       if(!$this->Antirefresh($anti_ref[$get], $get))
    116       {         
    117         if(($site_show != '') and is_readable($site_show)) return($site_show);
    118           else return('./'.$dir_pages.'/'.$def.'.php');
    119       } else
    120       {
    121         $this->RefreshMsg($this->Antirefresh($anti_ref[$get], $get), $get);
    122         return($dir_pages.'/free.php');
    123       }
    124     } else
    125     {
    126       if(($site_show != '') and is_readable($site_show)) return($site_show);
    127         else return($dir_pages.'/'.$def.'.php');
    128     }
    129   }
    130 
    131   public function Antirefresh($value, $page)
    132   {
    133     $hash = md5($page);
    134     if(isset($_SESSION['rf'.$hash.'rsh']))
    135     {
    136       $refresh = $_SESSION['rf'.$hash.'rsh'] + $value;
    137       if(time() < $refresh)
    138       {
    139         $dif = $refresh - time();
    140         return($dif);
    141       }
    142     }
    143     $_SESSION['rf'.$hash.'rsh'] = time();
    144   }
    145 
    146   public function RefreshMsg($dif, $get)
    147   {
    148     if($dif != 0)
    149     {
    150       if($dif > 60)
    151       {
    152         $dif = round($dif / 60).' min';
    153         $refresh = 30;
    154       } else
    155       {
    156         $dif = $dif.' s';
    157         $refresh = 2;
    158       }
    159       echo('<center><h3>Refresh omezení</h3></center>
    160           Stránka nepovoluje tak krátký čas pro refresh (znovunačtení).<br />
    161           Další načtení stránky <b>?page='.$get.'</b> bude možné za <b>'.$dif.'</b>.<br />
    162           Pokud tento čas vyčkáte budete přesměrován automaticky !
    163          <meta http-equiv="refresh" content="'.$refresh.';url=">');
    164     }
    165   }
    166 
    167110  public function PrgStart()
    168111  {
    169     echo('<table align="center" width="346" height="417" border="0" style="background-image: url(imgs/web/prg.gif);">
     112    global $html;
     113   
     114    echo('<table align="center" width="346" height="417" border="0" style="background-image: url('.$html->Link('/imgs/web/prg.gif').');">
    170115          <tr height="80">
    171116            <td width="20"></td>
     
    262207  function QuickNew()
    263208  {
    264     global $server, $Config, $System;
     209    global $server, $Config, $System, $html;
    265210   
    266211    // Check servers online state.
     
    280225        '<tr>'.
    281226        '<td colspan="2">'.
    282         '<strong>Server : </strong>'.$server->OnlineStateImage($OnlineState).'<b> (<a href="?page=realmlist">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | <a href="?page=server">Server info</a> | <a href="?page=realmlist">Seznam světů</a></b>'.
     227        '<strong>Server : </strong>'.$server->OnlineStateImage($OnlineState).'<b> (<a href="'.$html->Link('/realmlist/').'">'.$server->OnlineCharactersCount().' hráčů celkem</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$html->Link('/pages/realmlist.wtf').'">Realmlist</a> | <a href="'.$html->Link('/server/').'">Server info</a> | <a href="'.$html->Link('/realmlist/').'">Seznam světů</a></b>'.
    283228        '</td></tr></table><br />');
    284229    }
     
    294239      {
    295240        $Item = explode('=', $Part);
    296         $Result[$Item[0]] = $Item[1];
     241        if(count($Item) > 1) $Result[$Item[0]] = $Item[1];
     242          else $Result[$Item[0]] = '';
    297243      }
    298244    }
  • trunk/inc/player.php

    r685 r690  
    1414  private function Msg($text, $err)
    1515  {
    16     if($err == 0) echo('<img src="imgs/inc/on.gif">&nbsp;<font color="#234303" size="4">'.$text.'</font><br />');
    17       else echo('<img src="imgs/inc/off.gif">&nbsp;<font color="#990000" size="4\">'.$text.'</font><br />');
     16    global $html;
     17   
     18    if($err == 0) echo('<img src="'.$html->Link('/imgs/inc/on.gif').'">&nbsp;<font color="#234303" size="4">'.$text.'</font><br />');
     19      else echo('<img src="'.$html->Link('imgs/inc/off.gif').'">&nbsp;<font color="#990000" size="4\">'.$text.'</font><br />');
    1820  }
    1921
     
    3133        ' VALUES (NULL , "'.$acc_name.'", "'.$sha_pass.'", 0, NULL , NULL , NULL , "'.$email.'", CURRENT_TIMESTAMP , "'.$_SERVER['REMOTE_ADDR'].'", 0, 0, "0000-00-00 00:00:00", 0, "'.$tbc.'", 0, 0)');
    3234      $this->Msg('Účet založen úspěšně', 0);
    33       echo('<meta http-equiv="refresh" content="0;?page=acc">');
     35      echo('<meta http-equiv="refresh" content="0;'.$html->Link('/ucet/').'">');
    3436    } else
    3537    {
     
    8082  public function LoginForm()
    8183  {
    82     echo('<form method="post" action="?page=acc">'.
     84    global $html;
     85   
     86    echo('<form method="post" action="'.$html->Link('/ucet/').'">'.
    8387     '<table>'.
    8488    '<tr>'.
     
    9498            </form>
    9599            <div align="left">
    96             <a href="?page=register">Registrace</a><br />'. //<a href="?page=lostpass">Obnova hesla</a>
     100            <a href="'.$html->Link('/registrace/').'">Registrace</a><br />'. //<a href="?page=lostpass">Obnova hesla</a>
    97101            '</div>');
    98102   }
  • trunk/inc/server.php

    r684 r690  
    3939  function ParseCopper($copper_in)
    4040  {
     41    global $html;
     42   
    4143    $copper = $copper_in;
    4244    $golds = floor($copper / 10000);
     
    4446    $silver = floor($num / 100);
    4547    $copper = $num - $silver * 100;
    46     $show_golds = '<font size="4">'.$golds.'</font>&nbsp;<img src="imgs/inc/g.gif">';
    47     $show_silver = '<font size="4">'.$silver.'</font>&nbsp;<img src="imgs/inc/s.gif">';
    48     $show_copper = '<font size="4">'.$copper.'</font>&nbsp;<img src="imgs/inc/c.gif">';
     48    $show_golds = '<font size="4">'.$golds.'</font>&nbsp;<img src="'.$html->Link('/imgs/inc/g.gif').'">';
     49    $show_silver = '<font size="4">'.$silver.'</font>&nbsp;<img src="'.$html->Link('/imgs/inc/s.gif').'">';
     50    $show_copper = '<font size="4">'.$copper.'</font>&nbsp;<img src="'.$html->Link('/imgs/inc/c.gif').'">';
    4951    return($show_golds.'&nbsp;'.$show_silver.'&nbsp;'.$show_copper);
    5052  }
     
    6466  function OnlineStateImage($Status)
    6567  {
    66     if($Status) return('<img src="imgs/inc/on.gif" alt="online" />&nbsp;<span style="text-color: #234303; text-size: 4;">Online</span>');
    67       else return('<img src="imgs/inc/off.gif" alt="offline" />&nbsp;<span style="text-color: #990000; text-size: 4;">Offline</span>');
     68    global $html;
     69   
     70    if($Status) return('<img src="'.$html->Link('/imgs/inc/on.gif').'" alt="online" />&nbsp;<span style="text-color: #234303; text-size: 4;">Online</span>');
     71      else return('<img src="'.$html->Link('/imgs/inc/off.gif').'" alt="offline" />&nbsp;<span style="text-color: #990000; text-size: 4;">Offline</span>');
    6872  }
    6973
  • trunk/inc/system.php

    r630 r690  
    2828  }
    2929   
    30   function SeoUrl($title)
     30  function SeoUrl($Address)
    3131  { 
    32     $address = $title; 
    33     $diakritika = array("á","ä","č","ď","é","ě","ë","í","ň","ó","ö","ř","š","ť","ú","ů","ü","ý","ž","Á","Ä","Č","Ď","É","Ě","Ë","Í","Ň","Ó","Ö","Ř","Š","Ť","Ú","Ů","Ü","Ý","Ž");
    34     $nediakritika = array("a","a","c","d","e","e","e","i","n","o","o","r","s","t","u","u","u","y","z","A","A","C","D","E","E","E","I","N","O","O","R","S","T","U","U","U","Y","Z");
    35     $address = str_replace($diakritika, $nediakritika, $address);
    36     $address = strtolower ($address);   
    37     $address = preg_replace ("/[^[:alpha:][:digit:]]/", "-", $address); 
    38     $address = trim ($address, "-"); 
    39     $address = preg_replace ("/[-]+/", "-", $address); 
    40     return($address); 
     32    $Diakritika = array("á","ä","č","ď","é","ě","ë","í","ň","ó","ö","ř","š","ť","ú","ů","ü","ý","ž","Á","Ä","Č","Ď","É","Ě","Ë","Í","Ň","Ó","Ö","Ř","Š","Ť","Ú","Ů","Ü","Ý","Ž");
     33    $Nediakritika = array("a","a","c","d","e","e","e","i","n","o","o","r","s","t","u","u","u","y","z","A","A","C","D","E","E","E","I","N","O","O","R","S","T","U","U","U","Y","Z");
     34    $Address = str_replace($Diakritika, $Nediakritika, $Address);
     35    $Address = strtolower($Address);   
     36    $Address = preg_replace("/[^[:alpha:][:digit:]]/", "-", $Address); 
     37    $Address = trim($Address, "-"); 
     38    $Address = preg_replace("/[-]+/", "-", $Address); 
     39    return($Address); 
    4140  }
    4241 
  • trunk/inc/teamspeakdisplay/teamspeakdisplay.php

    r607 r690  
    332332  // be hard to read >:)
    333333  function displayTeamspeakEx($settings) {
     334    global $html;
     335   
    334336    $serverInfo = $this->queryTeamspeakServerEx($settings);
    335337   
     
    343345      }
    344346      echo("<table><tr><td>");
    345       echo("<img src=\"inc/teamspeakdisplay/teamspeak_offline.png\" alt=\"\" title=\"" . $popupInfo . "\">");
     347      echo("<img src=\"".$html->Link('/inc/teamspeakdisplay/teamspeak_offline.png')."\" alt=\"\" title=\"" . $popupInfo . "\">");
    346348      echo("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
    347349      echo("Server offline");
     
    410412      // Print the topmost element of the teamspeak tree
    411413      echo("<table><tr><td>");
    412       echo("<img src=\"inc/teamspeakdisplay/teamspeak_online.png\" alt=\"\" title=\"" . $popupInfo . "\">");
     414      echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/teamspeak_online.png")."\" alt=\"\" title=\"" . $popupInfo . "\">");
    413415      echo("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
    414416      echo("<a class=\"teamspeakserver\" href=\"javascript:enterServer_" . $jsTeamspeakId . "();\">");
     
    450452        // Display channel:
    451453        echo("<table><tr><td>");
    452         echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "3" : "2") . ".png\" alt=\"\">");
    453         echo("<img src=\"inc/teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
     454        echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "3" : "2") . ".png")."\" alt=\"\">");
     455        echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/channel.png")."\" alt=\"\" title=\"" . $popupInfo . "\">");
    454456        echo("</td><td class=\"teamspeakchannel\" title=\"" . $popupInfo . "\">");
    455457        echo("<a class=\"teamspeakchannel\" href=\"javascript:enterChannel_" . $jsTeamspeakId . "('" . str_replace("'", "\'", $channelInfo["channelname"]) . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ");\">");
     
    471473            // Display player:
    472474            echo("<table><tr><td>");
    473             echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
    474             echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
    475             echo("<img src=\"inc/teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
     475            echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png")."\" alt=\"\">");
     476            echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png")."\" alt=\"\">");
     477            echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png")."\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
    476478            echo("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
    477479            echo(str_replace(" ", "&nbsp;", $this -> Kodovani($playerInfo["displayname"])));
     
    496498          // Display channel:
    497499          echo("<table><tr><td>");
    498           echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
    499           echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
    500           echo("<img src=\"inc/teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
     500          echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png")."\" alt=\"\">");
     501          echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png")."\" alt=\"\">");
     502          echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/channel.png")."\" alt=\"\" title=\"" . $popupInfo . "\">");
    501503          echo("</td><td class=\"teamspeaksubchannel\" title=\"" . $popupInfo . "\">");
    502504          echo("<a class=\"teamspeaksubchannel\" href=\"javascript:enterSubChannel_" . $jsTeamspeakId . "('" . str_replace("'", "\'", $channelInfo["channelname"]) . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ", '" . str_replace("'", "\'", $subchannelInfo["channelname"]) . "');\">");
     
    518520              // Display player:
    519521              echo("<table><tr><td>");
    520               echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
    521               echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "4" : "1") . ".png\" alt=\"\">");
    522               echo("<img src=\"inc/teamspeakdisplay/treeimage" . ((($counter_player + 1) == $currentplayers) ? "3" : "2") . ".png\" alt=\"\">");
    523               echo("<img src=\"inc/teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
     522              echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png")."\" alt=\"\">");
     523              echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "4" : "1") . ".png")."\" alt=\"\">");
     524              echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/treeimage" . ((($counter_player + 1) == $currentplayers) ? "3" : "2") . ".png")."\" alt=\"\">");
     525              echo("<img src=\"".$html->Link("/inc/teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png")."\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
    524526              echo("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
    525527              echo(str_replace(" ", "&nbsp;", $this -> Kodovani($playerInfo["displayname"])));
Note: See TracChangeset for help on using the changeset viewer.