Changeset 556 for trunk/pages/events.php


Ignore:
Timestamp:
Mar 29, 2009, 6:45:56 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Formátování stránek a validace XHTML.
  • Opraveno: Opakované připojování k databází při zobraznení gmlogu. Chybně umístěný obrázek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/events.php

    r407 r556  
    11<?php
    22
    3 $EventsLinks = array(
    4   1 => array("http://wwpw.wowwiki.com/Midsummer_Fire_Festival", "http://www.worldofwarcraft.com/info/events/midsummer/"),
    5   2 => array("http://www.wowwiki.com/Feast_of_Winter_Veil", "http://www.worldofwarcraft.com/info/events/winterveil/"),
    6   3 => array("http://www.wowwiki.com/Darkmoon_Faire", "http://www.worldofwarcraft.com/info/basics/factions/darkmoon/"),
    7   4 => array("http://www.wowwiki.com/Darkmoon_Faire", "http://www.worldofwarcraft.com/info/basics/factions/darkmoon/"),
    8   5 => array("http://www.wowwiki.com/Darkmoon_Faire", "http://www.worldofwarcraft.com/info/basics/factions/darkmoon/"),
    9   6 => array("http://www.wowwiki.com/New_Year", "http://www.worldofwarcraft.com/info/events/newyears/"),
    10   7 => array("http://www.wowwiki.com/Lunar_Festival", "http://www.worldofwarcraft.com/info/events/lunarnewyears/"),
    11   8 => array("http://www.wowwiki.com/Love_is_in_the_Air", "http://www.worldofwarcraft.com/info/events/loveisintheair/"),
    12   9 => array("http://www.wowwiki.com/Noblegarden", "http://www.worldofwarcraft.com/community/ingameevents.html#noblegarden"),
    13   10 => array("http://www.wowwiki.com/Children%27s_Week", "http://www.worldofwarcraft.com/info/events/childrensweek/"),
    14   11 => array("http://www.wowwiki.com/Harvest_Festival", "http://www.worldofwarcraft.com/info/events/harvestfestival/"),
    15   12 => array("http://www.wowwiki.com/Hallow%27s_End", "http://www.worldofwarcraft.com/info/events/hallowsend/"),
    16   13 => array("http://www.wowwiki.com/Elemental_Invasions", "http://www.worldofwarcraft.com/community/ingameevents.html#elemental"),
    17   14 => array("http://www.wowwiki.com/Stranglethorn_Fishing_Extravaganza", "http://www.worldofwarcraft.com/info/events/fishing/"),
    18   15 => array("http://www.wowwiki.com/Stranglethorn_Fishing_Extravaganza", "http://www.worldofwarcraft.com/info/events/fishing/"),
    19   16 => array("http://www.wowwiki.com/Gurubashi_Arena#Gurubashi_Arena_Booty_Run", "http://www.worldofwarcraft.com/community/ingameevents.html#gurubashi"),
    20   17 => array("http://www.wowwiki.com/The_Scourge_Invasion", "http://www.worldofwarcraft.com/info/events/scourgeinvasion/"),
    21   18 => array("", "http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms"),
    22   19 => array("", "http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms"),
    23   20 => array("", "http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms"),
    24   21 => array("", "http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms"),
    25   22 => array("http://www.wowwiki.com/Ahn%27Qiraj_War_Effort", "http://www.worldofwarcraft.com/wareffort/servers.html"),
    26   23 => array("", ""),
    27   24 => array("", ""),
    28   25 => array("", "http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms"),
    29   26 => array("http://www.wowwiki.com/Brewfest", "http://www.worldofwarcraft.com/info/events/brewfest/"),
    30   27 => array("", ""),
    31   28 => array("http://www.wowwiki.com/Noblegarden", "http://www.worldofwarcraft.com/community/ingameevents.html#noblegarden"),
    32   29 => array("http://www.wowwiki.com/Edge_of_Madness", ""),
    33   30 => array("http://www.wowwiki.com/Edge_of_Madness", ""),
    34   31 => array("http://www.wowwiki.com/Edge_of_Madness", ""),
    35   32 => array("http://www.wowwiki.com/Edge_of_Madness", ""),
    36   34 => array("http://www.wowwiki.com/L70ETC", ""),
     3$EventsLinks = array
     4(
     5  1 => array('http://wwpw.wowwiki.com/Midsummer_Fire_Festival', 'http://www.worldofwarcraft.com/info/events/midsummer/'),
     6  2 => array('http://www.wowwiki.com/Feast_of_Winter_Veil', 'http://www.worldofwarcraft.com/info/events/winterveil/'),
     7  3 => array('http://www.wowwiki.com/Darkmoon_Faire', 'http://www.worldofwarcraft.com/info/basics/factions/darkmoon/'),
     8  4 => array('http://www.wowwiki.com/Darkmoon_Faire', 'http://www.worldofwarcraft.com/info/basics/factions/darkmoon/'),
     9  5 => array('http://www.wowwiki.com/Darkmoon_Faire', 'http://www.worldofwarcraft.com/info/basics/factions/darkmoon/'),
     10  6 => array('http://www.wowwiki.com/New_Year', 'http://www.worldofwarcraft.com/info/events/newyears/'),
     11  7 => array('http://www.wowwiki.com/Lunar_Festival', 'http://www.worldofwarcraft.com/info/events/lunarnewyears/'),
     12  8 => array('http://www.wowwiki.com/Love_is_in_the_Air', 'http://www.worldofwarcraft.com/info/events/loveisintheair/'),
     13  9 => array('http://www.wowwiki.com/Noblegarden', 'http://www.worldofwarcraft.com/community/ingameevents.html#noblegarden'),
     14  10 => array('http://www.wowwiki.com/Children%27s_Week', 'http://www.worldofwarcraft.com/info/events/childrensweek/'),
     15  11 => array('http://www.wowwiki.com/Harvest_Festival', 'http://www.worldofwarcraft.com/info/events/harvestfestival/'),
     16  12 => array('http://www.wowwiki.com/Hallow%27s_End', 'http://www.worldofwarcraft.com/info/events/hallowsend/'),
     17  13 => array('http://www.wowwiki.com/Elemental_Invasions', 'http://www.worldofwarcraft.com/community/ingameevents.html#elemental'),
     18  14 => array('http://www.wowwiki.com/Stranglethorn_Fishing_Extravaganza', 'http://www.worldofwarcraft.com/info/events/fishing/'),
     19  15 => array('http://www.wowwiki.com/Stranglethorn_Fishing_Extravaganza', 'http://www.worldofwarcraft.com/info/events/fishing/'),
     20  16 => array('http://www.wowwiki.com/Gurubashi_Arena#Gurubashi_Arena_Booty_Run', 'http://www.worldofwarcraft.com/community/ingameevents.html#gurubashi'),
     21  17 => array('http://www.wowwiki.com/The_Scourge_Invasion', 'http://www.worldofwarcraft.com/info/events/scourgeinvasion/'),
     22  18 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
     23  19 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
     24  20 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
     25  21 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
     26  22 => array('http://www.wowwiki.com/Ahn%27Qiraj_War_Effort', 'http://www.worldofwarcraft.com/wareffort/servers.html'),
     27  23 => array('', ''),
     28  24 => array('', ''),
     29  25 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
     30  26 => array('http://www.wowwiki.com/Brewfest', 'http://www.worldofwarcraft.com/info/events/brewfest/'),
     31  27 => array('', ''),
     32  28 => array('http://www.wowwiki.com/Noblegarden', 'http://www.worldofwarcraft.com/community/ingameevents.html#noblegarden'),
     33  29 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
     34  30 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
     35  31 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
     36  32 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
     37  34 => array('http://www.wowwiki.com/L70ETC', ''),
    3738);
    3839
    3940function Events()
    4041{
    41 include("inc/db.php");
     42  include('inc/db.php');
    4243
    43   global $db, $EventsLinks;
    44   $Events = array("Running" => array(), "Planned" => array());
    45   $db -> select_db("$db_mangos");
     44  global $db, $EventsLinks, $Config;
    4645 
     46  $Events = array('Running' => array(), 'Planned' => array());
     47  $db->select_db($Config['Mangos']['DatabaseMangos']); 
    4748
    48   $DbResult = $db->query("SELECT *, UNIX_TIMESTAMP(start_time) as start FROM game_event WHERE end_time > NOW() AND start_time < NOW()");
     49  $DbResult = $db->query('SELECT *, UNIX_TIMESTAMP(start_time) as start FROM game_event WHERE end_time > NOW() AND start_time < NOW()');
    4950  while($Row = $DbResult->fetch_array())
    5051  {
    51     if(!array_key_exists($Row["entry"], $EventsLinks)) $EventsLinks[$Row["entry"]] = array("", "");
    52     $Start = (floor((time() - $Row["start"]) / ($Row["occurence"] * 60))) * $Row["occurence"] * 60 + $Row["start"];
    53     $End = $Start + $Row["length"] * 60;
    54     if((time() > $Start) and (time() < $End)) $EventState = "Running";
     52    if(!array_key_exists($Row['entry'], $EventsLinks)) $EventsLinks[$Row['entry']] = array('', '');
     53    $Start = (floor((time() - $Row['start']) / ($Row['occurence'] * 60))) * $Row['occurence'] * 60 + $Row['start'];
     54    $End = $Start + $Row['length'] * 60;
     55    if((time() > $Start) and (time() < $End)) $EventState = 'Running';
    5556    else
    5657    {
    57       $EventState = "Planned";
    58       $Start += $Row["occurence"] * 60;
    59       $End += $Row["occurence"] * 60;
     58      $EventState = 'Planned';
     59      $Start += $Row['occurence'] * 60;
     60      $End += $Row['occurence'] * 60;
    6061    }
    61     $Events[$EventState][$Row["start"]] = array("StartTime" => $Start, "EndTime" => $End, "Title" => $Row["description"], "WoWWiki" => $EventsLinks[$Row["entry"]][0], "Official" => $EventsLinks[$Row["entry"]][1]);
     62    $Events[$EventState][$Row['start']] = array('StartTime' => $Start, 'EndTime' => $End, 'Title' => $Row['description'], 'WoWWiki' => $EventsLinks[$Row['entry']][0], 'Official' => $EventsLinks[$Row['entry']][1]);
    6263  }
    6364
    6465  // Add events not started so far
    65   //$DbResult = $db->select("game_event", "*, UNIX_TIMESTAMP(start_time) as start", "start_time > NOW()");
    66   $DbResult = $db->query("SELECT * , UNIX_TIMESTAMP(start_time) as start FROM game_event WHERE start_time > NOW()");
     66  //$DbResult = $db->select('game_event', '*, UNIX_TIMESTAMP(start_time) as start', 'start_time > NOW()');
     67  $DbResult = $db->query('SELECT * , UNIX_TIMESTAMP(start_time) as start FROM game_event WHERE start_time > NOW()');
    6768  while($Row = $DbResult->fetch_array())
    6869  {
    69     if(!array_key_exists($Row["entry"], $EventsLinks)) $EventsLinks[$Row["entry"]] = array("", "");
    70     $Events["Planned"][$Row["start"]] = array("StartTime" => $Row["start"], "EndTime" => ($Row["start"] + $Row["length"] * 60), "Title" => $Row["description"], "WoWWiki" => $EventsLinks[$Row["entry"]][0], "Official" => $EventsLinks[$Row["entry"]][1]);
     70    if(!array_key_exists($Row['entry'], $EventsLinks)) $EventsLinks[$Row['entry']] = array('', '');
     71    $Events['Planned'][$Row['start']] = array('StartTime' => $Row['start'], 'EndTime' => ($Row['start'] + $Row['length'] * 60), 'Title' => $Row['description'], 'WoWWiki' => $EventsLinks[$Row['entry']][0], 'Official' => $EventsLinks[$Row['entry']][1]);
    7172  }
    7273
    73   sort($Events["Running"]);
    74   sort($Events["Planned"]);
     74  sort($Events['Running']);
     75  sort($Events['Planned']);
    7576
    7677  return($Events);
     
    8182  foreach($Events as $Event)
    8283  {
    83     echo("<tr><td align=\"Left\">".$Event["Title"]."</td><td align=\"right\">".date("j.n.Y H:i", $Event["StartTime"])."</td><td align=\"right\">".date("j.n.Y H:i", $Event["EndTime"])."</td>");
    84     if($Event["WoWWiki"] != "") echo("<td><a href=\"".$Event["WoWWiki"]."\">wowwiki</a></td>");
    85 else echo("<td>&nbsp;</td>");
    86     if($Event["Official"] != "") echo("<td><a href=\"".$Event["Official"]."\">worldofwarcraft</a></td>"); else echo("<td>&nbsp;</td>");
    87     echo("</tr>");
     84    echo('<tr><td>'.$Event['Title'].'</td><td>'.date('j.n.Y H:i', $Event['StartTime']).'</td><td>'.date('j.n.Y H:i', $Event['EndTime']).'</td>');
     85    if($Event['WoWWiki'] != '') echo('<td><a href="'.$Event['WoWWiki'].'">wowwiki</a>');
     86else echo('<td>&nbsp;');
     87    if($Event['Official'] != '') echo(' <a href="'.$Event['Official'].'">worldofwarcraft</a></td>'); else echo(' &nbsp;</td>');
     88    echo('</tr>');
    8889  }
    8990}
    9091
    91 
    92 
    93 
    94 echo"<center><h3>Události ve hře :</h3></center>";
     92echo('<center><h3>Události ve hře :</h3></center>');
    9593
    9694$Events = Events();
    97 echo "<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"540\" align=\"center\">";
    98 echo"<tr><th>Název</th><th>Začátek</th><th>Konec</th><th>Informace</th><th>Informace</th></tr>";
    99 echo"<tr><td colspan=\"5\"><b>Probíhající akce</b></td></tr>";
    100 ShowEventList($Events["Running"]);
    101 echo"<tr><td colspan=\"5\"><b>Plánované akce</b></td></tr>";
    102 ShowEventList($Events["Planned"]);
    103 echo"</table>";
    104 
    105 
     95echo('<table class="gmlog">');
     96echo('<tr><th>Název</th><th>Začátek</th><th>Konec</th><th>Informace</th></tr>');
     97echo('<tr><td colspan="5"><b>Probíhající akce</b></td></tr>');
     98ShowEventList($Events['Running']);
     99echo('<tr><td colspan="5"><b>Plánované akce</b></td></tr>');
     100ShowEventList($Events['Planned']);
     101echo('</table>');
    106102
    107103?>
    108 
    109 
    110 
    111 
    112 
Note: See TracChangeset for help on using the changeset viewer.