Changeset 556 for trunk/inc


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.
Location:
trunk/inc
Files:
2 edited

Legend:

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

    r551 r556  
    2626    'DatabaseRealmd' => 'realmd',
    2727    'DatabaseScriptDev2' => 'scriptdev2',
     28    'GMCommandsLog' => 'gm_commands.log',
    2829  ),
    2930  'Web' => array
  • trunk/inc/server.php

    r553 r556  
    44{
    55  private $db;
    6       public function __construct ($db)
    7       {
    8         $this -> db = $db;
    9       }
    10       // --
    11       public function HumanDate ($date,$time = 1)
    12       {
    13         // input date is 0000-00-00 00:00:00
    14         $date_arr = explode(" ",$date);
    15         $date = explode("-",$date_arr[0]);
    16         $time_stp = explode(":",$date_arr[1]);
    17         $time = mktime($time_stp[0],$time_stp[1],$time_stp[2],$date[1],$date[2],$date[0]);
    18         if ($time == 1)
    19         {
    20           $human_date = date ("d.m.Y H:i:s",$time);
    21         }
    22         else
    23         {
    24           $human_date = date ("d.m.Y",$time);
    25         }
    26         return $human_date;
    27       }
    28       // --
    29       public function RealmOnline ()
    30       {
    31         $this -> db -> select_db("realm1_realmd");
    32         $pocet = $this -> db -> query("SELECT `id` FROM `account` WHERE `online` = '1'") -> num_rows;
    33         return $pocet;
    34       }
    35       // --
    36       public function ParseCopper ($copper_in)
    37       {
    38         $copper = $copper_in;
    39         $golds = floor($copper / 10000);
    40         $num = $copper - $golds * 10000;
    41         $silver = floor($num / 100);
    42         $copper = $num - $silver * 100;
    43         $show_golds = "<font size=\"4\">".$golds."</font>&nbsp;<img src=\"imgs/inc/g.gif\">";
    44         $show_silver = "<font size=\"4\">".$silver."</font>&nbsp;<img src=\"imgs/inc/s.gif\">";
    45         $show_copper = "<font size=\"4\">".$copper."</font>&nbsp;<img src=\"imgs/inc/c.gif\">";
    46         return $show_golds."&nbsp;".$show_silver."&nbsp;".$show_copper;
    47       }
     6 
     7  public function __construct($db)
     8  {
     9    $this->db = $db;
     10  }
     11 
     12  public function HumanDate($date, $time = 1)
     13  {
     14    // input date is 0000-00-00 00:00:00
     15    $date_arr = explode(' ', $date);
     16    $date = explode('-', $date_arr[0]);
     17    $time_stp = explode(':', $date_arr[1]);
     18    $time = mktime($time_stp[0], $time_stp[1], $time_stp[2], $date[1], $date[2], $date[0]);
     19    if($time == 1) $human_date = date('d.m.Y H:i:s', $time);
     20      else $human_date = date('d.m.Y', $time);
     21    return($human_date);
     22  }
     23
     24  public function RealmOnline()
     25  {
     26    global $Config;
     27   
     28    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     29    $pocet = $this->db->query('SELECT `id` FROM `account` WHERE `online` = 1')->num_rows;
     30    return($pocet);
     31  }
     32
     33  public function ParseCopper($copper_in)
     34  {
     35    $copper = $copper_in;
     36    $golds = floor($copper / 10000);
     37    $num = $copper - $golds * 10000;
     38    $silver = floor($num / 100);
     39    $copper = $num - $silver * 100;
     40    $show_golds = '<font size="4">'.$golds.'</font>&nbsp;<img src="imgs/inc/g.gif">';
     41    $show_silver = '<font size="4">'.$silver.'</font>&nbsp;<img src="imgs/inc/s.gif">';
     42    $show_copper = '<font size="4">'.$copper.'</font>&nbsp;<img src="imgs/inc/c.gif">';
     43    return($show_golds.'&nbsp;'.$show_silver.'&nbsp;'.$show_copper);
     44  }
    4845     
    49       // --
    50       public function MangosOnline()
    51       {
    52            include("inc/db.php");
    53         $this -> db -> select_db($db_characters);
    54         $pocet = $this -> db -> query("SELECT `guid` FROM `characters` WHERE `online` = '1'") -> num_rows;
    55         return $pocet;
    56       }
    57       // --
    58       public function ServerOnline($ip, $port)
    59       {
    60         if($fp1 = @fsockopen($ip, $port, $ERROR_NO, $ERROR_STR,(float)0.5))
    61         {
    62           fclose($fp1);
    63           return true;
    64         }
    65         else
    66         {return false;}
    67       }
    68       // --
    69       public function ServerImg ($status)
    70       {
    71         if ($status)
    72         {
    73           return('<img src="imgs/inc/on.gif" alt="online" />&nbsp;<span style="text-color: #234303; text-size: 4;">Online</span>');
    74         }
    75         else
    76         {
    77           return('<img src="imgs/inc/off.gif" alt="offline" />&nbsp;<span style="text-color: #990000; text-size: 4;">Offline</span>');
    78         }
    79       }
    80       // --
    81       public function ServerUptime ()
    82       {
    83            include("inc/db.php");
    84         $this -> db -> select_db($db_mangos);
    85         $row = $this -> db -> query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1') ->fetch_array();
    86         $uptime = round($row["uptime"] / 3600);
    87         return $uptime;
    88       }
    89       // --
    90       public function CharacterCount()
    91       {
    92            include("inc/db.php");
    93         $this -> db -> select_db($db_characters);
    94         $row = $this -> db -> query("SELECT COUNT(*) FROM characters") -> fetch_array();
    95         return($row[0]);
    96       }
    97       // --
    98       public function AccountCount()
    99       {
    100            include("inc/db.php");
    101         $this -> db -> select_db($db_realmd);
    102         $row = $this -> db -> query("SELECT COUNT(*) FROM account") -> fetch_array();
    103         return($row[0]);
    104       }
    105       // --
    106       public function GuidToCharName ($guid)
    107       {
    108            include("inc/db.php");
    109         $this -> db -> select_db($db_characters);
    110         $row = $this -> db -> query("SELECT `name` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    111         return $row["name"];
    112       }
    113       // --
    114       public function ShowGmLog ($log)
    115       {
    116         echo "
    117         <table border=\"1\" width=\"540\">
    118           <tr>
     46  public function MangosOnline()
     47  {
     48    global $Config;
     49   
     50    include('inc/db.php');
     51    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     52    $pocet = $this->db->query('SELECT `guid` FROM `characters` WHERE `online` = 1')->num_rows;
     53    return($pocet);
     54  }
     55
     56  public function ServerOnline($ip, $port)
     57  {
     58    if($fp1 = @fsockopen($ip, $port, $ERROR_NO, $ERROR_STR, (float)0.5))
     59    {
     60      fclose($fp1);
     61      return(true);
     62    } else
     63    {
     64      return(false);
     65    }
     66  }
     67
     68  public function ServerImg($status)
     69  {
     70    if($status) return('<img src="imgs/inc/on.gif" alt="online" />&nbsp;<span style="text-color: #234303; text-size: 4;">Online</span>');
     71      else return('<img src="imgs/inc/off.gif" alt="offline" />&nbsp;<span style="text-color: #990000; text-size: 4;">Offline</span>');
     72  }
     73
     74  public function ServerUptime()
     75  {
     76          global $Config;
     77
     78    include('inc/db.php');
     79    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     80    $row = $this->db->query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1')
     81  ->fetch_array();
     82    $uptime = round($row['uptime'] / 3600);
     83    return($uptime);
     84  }
     85
     86  public function CharacterCount()
     87  {
     88    global $Config;
     89
     90    include('inc/db.php');
     91    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     92    $row = $this->db->query('SELECT COUNT(*) FROM characters')->fetch_array();
     93    return($row[0]);
     94  }
     95
     96  public function AccountCount()
     97  {
     98          global $Config;
     99
     100    include('inc/db.php');
     101    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     102    $row = $this->db->query('SELECT COUNT(*) FROM account')->fetch_array();
     103    return($row[0]);
     104  }
     105
     106  public function GuidToCharName($guid)
     107  {
     108          global $Config;
     109    include('inc/db.php');
     110    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     111    $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array();
     112    return($row['name']);
     113  }
     114 
     115  public function ShowGmLog($log)
     116  {
     117    echo('<table border="1" width="540">'.
     118      '<tr>
    119119            <th>Čas</th>
    120120            <th>GM</th>
    121121            <th>Příkaz</th>
    122122            <th>Vybrán</th>
    123           </tr> 
    124         ";
    125         $gm_log = ereg_replace("\n",";",$log);
    126         $gm_log = explode(";",$gm_log);
    127         $gm_log = array_reverse($gm_log);
    128         foreach($gm_log as $row)
    129         {
    130          
    131           if (strpos($row,"Command:") == true)
    132           {
    133             $edited = str_replace(" Command: ", ";", $row);     // 0 - time
    134             $edited = str_replace(" (Account: ", ";", $edited); // 1 - command
    135             $edited = str_replace(" [Player: ", ";", $edited);  // 2 - gm
    136             $edited = str_replace(" Selected: ", ";", $edited); // 3 - position
    137             $edited = str_replace(" (GUID: ", ";", $edited);    // 4 - selected
    138             $edited = str_replace(")]", ";", $edited);          // 5 - selected guid
    139             $edited_arr = explode(";",$edited);
    140             if ($edited_arr[4] == "player")
    141             {$sel_name = " - ".$this -> GuidToCharName($edited_arr[5]);}
    142             else
    143             {$sel_name = "";}
    144               $human_date = $this -> HumanDate ($edited_arr[0]);
    145            echo "
    146           <tr>
    147             <td><font size=\"2\">".$human_date."</font></td>
    148             <td>".$edited_arr[2]."</td>
    149             <td>".$edited_arr[1]."</td>
    150             <td>".$edited_arr[4].$sel_name."</td>
    151           </tr>
    152           ";
    153           }
    154           if (strpos($row,"mail item:") == true)
    155           {
    156             $edited = str_replace(" GM ", ";", $row);
    157             $edited = str_replace(" (Account: ", ";", $edited);
    158             $edited = str_replace(") mail item: ", ";", $edited);
    159             $edited = str_replace(" (Account: ", ";", $edited);
    160             $edited = str_replace(")", "", $edited);
    161             $edited_arr = explode(";",$edited);
    162               $human_date = $this -> HumanDate ($edited_arr[0]);
    163           echo "
    164           <tr>
    165             <td><font size=\"2\">".$human_date."</font></td>
    166             <td>".$edited_arr[1]."</td>
    167             <td>Send : ".$edited_arr[3].")</td>
     123          </tr>');
     124    $gm_log = ereg_replace("\n",";",$log);
     125    $gm_log = explode(";",$gm_log);
     126    $gm_log = array_reverse($gm_log);
     127    foreach($gm_log as $row)
     128    {
     129      if (strpos($row,"Command:") == true)
     130      {
     131        $edited = str_replace(" Command: ", ";", $row);     // 0 - time
     132        $edited = str_replace(" (Account: ", ";", $edited); // 1 - command
     133        $edited = str_replace(" [Player: ", ";", $edited);  // 2 - gm
     134        $edited = str_replace(" Selected: ", ";", $edited); // 3 - position
     135        $edited = str_replace(" (GUID: ", ";", $edited);    // 4 - selected
     136        $edited = str_replace(")]", ";", $edited);          // 5 - selected guid
     137        $edited_arr = explode(";",$edited);
     138        if($edited_arr[4] == "player") $sel_name = " - ".$this -> GuidToCharName($edited_arr[5]);
     139          else $sel_name = '';
     140        $human_date = $this -> HumanDate ($edited_arr[0]);
     141        echo('<tr>
     142            <td><font size="2">'.$human_date.'</font></td>
     143            <td>'.$edited_arr[2].'</td>
     144            <td>'.$edited_arr[1].'</td>
     145            <td>'.$edited_arr[4].$sel_name.'</td>
     146          </tr>');
     147      }
     148      if(strpos($row, 'mail item:') == true)
     149      {
     150        $edited = str_replace(" GM ", ";", $row);
     151        $edited = str_replace(" (Account: ", ";", $edited);
     152        $edited = str_replace(") mail item: ", ";", $edited);
     153        $edited = str_replace(" (Account: ", ";", $edited);
     154        $edited = str_replace(")", "", $edited);
     155        $edited_arr = explode(";",$edited);
     156        $human_date = $this -> HumanDate ($edited_arr[0]);
     157        echo('<tr>
     158            <td><font size="2">'.$human_date.'</font></td>
     159            <td>'.$edited_arr[1].'</td>
     160            <td>Send : '.$edited_arr[3].')</td>
    168161            <td>-</td>
    169           </tr>
    170           ";
     162          </tr>');
     163      }
     164      if(strpos($row,"trade:") == true)
     165      {
     166        $edited = str_replace(" GM ", ";", $row);
     167        $edited = str_replace(" (Account: ", ";", $edited);
     168        $edited = str_replace(") trade: ", ";", $edited);
     169        $edited = str_replace(" (Account: ", ";", $edited);
     170        $edited = str_replace(")", "", $edited);
     171        $edited_arr = explode(";",$edited);
    171172           
    172           }
    173           if (strpos($row,"trade:") == true)
    174           {
    175             $edited = str_replace(" GM ", ";", $row);
    176             $edited = str_replace(" (Account: ", ";", $edited);
    177             $edited = str_replace(") trade: ", ";", $edited);
    178             $edited = str_replace(" (Account: ", ";", $edited);
    179             $edited = str_replace(")", "", $edited);
    180             $edited_arr = explode(";",$edited);
    181            
    182             $human_date = $this -> HumanDate ($edited_arr[0]);
    183           echo "
    184           <tr>
    185             <td><font size=\"2\">".$human_date."</font></td>
    186             <td>".$edited_arr[1]."</td>
    187             <td>Trade : ".$edited_arr[3].")</td>
     173        $human_date = $this -> HumanDate ($edited_arr[0]);
     174        echo('<tr>
     175            <td><font size="2">'.$human_date.'</font></td>
     176            <td>'.$edited_arr[1].'</td>
     177            <td>Trade : '.$edited_arr[3].')</td>
    188178            <td>-</td>
    189           </tr>
    190           ";
    191           }
    192         }
    193          echo "</table>";
     179          </tr>');
    194180      }
    195       // --
    196         public function SeoUrl ($title)
    197         { 
    198           $address = $title; 
    199           $diakritika = array("á","ä","č","ď","é","ě","ë","í","ň","ó","ö","ř","š","ť","ú","ů","ü","ý","ž","Á","Ä","Č","Ď","É","Ě","Ë","Í","Ň","Ó","Ö","Ř","Š","Ť","Ú","Ů","Ü","Ý","Ž");
    200           $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");
    201           $address = str_replace($diakritika, $nediakritika, $address);
    202           $address = strtolower ($address);   
    203           $address = preg_replace ("/[^[:alpha:][:digit:]]/", "-", $address); 
    204           $address = trim ($address, "-"); 
    205           $address = preg_replace ("/[-]+/", "-", $address); 
    206             return $address; 
    207         }
    208         // --
    209         public function MapName ($id)
    210         {
    211           $map_id = Array(
    212                 0 => array(0,"Azeroths"),
    213                 1 => array(1,"Kalimdor"),
    214                 13 => array(13,"Test Zone"),
    215                 17 => array(17,"Kalidar"),
    216                 30 => array(30,"Alterac Valley"),
    217                 33 => array(33,"Shadowfang Keep Instance"),
    218                 34 => array(34,"The Stockade Instance"),
    219                 35 => array(35,"Stormwind Prison"),
    220                 36 => array(36,"Deadmines Instance"),
    221                 37 => array(37,"Plains of Snow"),
    222                 43 => array(43,"Wailing Caverns Instance"),
    223                 44 => array(44,"Monastery Interior"),
    224                 47 => array(47,"Razorfen Kraul Instance"),
    225                 48 => array(48,"Blackfathom Deeps Instance"),
    226                 70 => array(70,"Uldaman Instance"),
    227                 90 => array(90,"Gnomeregan Instance"),
    228                 109 => array(109,"Sunken Temple Instance"),
    229                 129 => array(129,"Razorfen Downs Instance"),
    230                 150 => array(150,"Outland"),
    231                 169 => array(169,"Emerald Forest"),
    232                 189 => array(189,"Scarlet Onastery Instance"),
    233                 209 => array(209,"Zul farrak Instance"),
    234                 229 => array(229,"Blackrock Spire Instance"),
    235                 230 => array(230,"Blackrock Depths Instance"),
    236                 249 => array(249,"Onyxia s Lair Instance"),
    237                 269 => array(269,"Cot Black Morass"),
    238                 289 => array(289,"Scholomance Instance"),
    239                 309 => array(309,"Zul Gurub Instance"),
    240                 329 => array(329,"Stratholme Instance"),
    241                 349 => array(349,"Maraudon Instance"),
    242                 369 => array(369,"Deeprun Tram"),
    243                 389 => array(389,"Ragefire Chasm Instance"),
    244                 409 => array(409,"The Molten Core Instance"),
    245                 429 => array(429,"dire_maul Instance"),
    246                 449 => array(449,"Alliance pvp Barracks"),
    247                 450 => array(450,"Horde pvp Barracks"),
    248                 451 => array(451,"Development Land"),
    249                 469 => array(469,"BlackwingLair Instance"),
    250                 489 => array(489,"Warsong Gulch"),
    251                 509 => array(509,"Ruins of ahn Qiraj Instance"),
    252                 529 => array(529,"Arathi Basin"),
    253                 530 => array(530,"Outland"),
    254                 531 => array(531,"Temple of ahn Qiraj Instance"),
    255                 532 => array(532,"Karazahn"),
    256                 533 => array(533,"Naxxramas Instance"),
    257                 534 => array(534,"Cot_hyjal Past"),
    258                 540 => array(540,"Hellfire Military"),
    259                 542 => array(542,"Hellfire Demon"),
    260                 543 => array(543,"Hellfire Rampart"),
    261                 544 => array(544,"Hellfire Raid"),
    262                 545 => array(545,"Coilfang Pumping"),
    263                 546 => array(546,"Coilfang Marsh"),
    264                 547 => array(547,"Coilfang Draenei"),
    265                 548 => array(548,"Coilfang Raid"),
    266                 550 => array(550,"Tempest Keep Raid"),
    267                 552 => array(552,"Tempest Keep Arcane"),
    268                 553 => array(553,"Tempest Keep Atrium"),
    269                 554 => array(554,"Tempest Keep Factory"),
    270                 555 => array(555,"Auchindoun Shadow"),
    271                 556 => array(556,"Auchindoun Srakkoa"),
    272                 557 => array(557,"Auchindoun Ethereal"),
    273                 558 => array(558,"Auchindoun Draenei"),
    274                 559 => array(559,"Nagrand Arena"),
    275                 560 => array(560,"Cot Hillsbrad Past"),
    276                 562 => array(562,"Blades Edge Arena"),
    277                 564 => array(564,"Black Temple"),
    278                 565 => array(565,"Gruuls Lair"),
    279                 566 => array(566,"Netherstorm Arena"),
    280                 568 => array(568,"Zulaman")
    281           );
    282           if(isset($map_id[$id]))
    283           {
    284             return $map_id[$id][1];
    285           }
    286                       else
    287                       {
    288             return("Neznámá");
    289           }
    290         }
    291         // --
    292         public function ZoneName($id)
    293         {
    294           $zone_id = Array(
    295                 1497 => Array("Undercity",1497),
    296                 1537 => Array("Ironforge",1537),
    297                 1519 => Array("Stormwind city",1519),
    298                 3 => Array("Badlands",3),
    299                 11 => Array("Wetlands",11),
    300                 33 => Array("Stranglethorn Vale",33),
    301                 44 => Array("Redridge Mountains",44),
    302                 38 => Array("Loch Modan",38),
    303                 10 => Array("Duskwood",10),
    304                 41 => Array("Deadwind Pass",41),
    305                 12 => Array("Elwynn Forest",12),
    306                 46 => Array("Burning Steppes",46),
    307                 51 => Array("Searing Gorge",51),
    308                 1 => Array("Dun Morogh",1),
    309                 47 => Array("The Hinterlands",47),
    310                 40 => Array("Westfall",40),
    311                 267 => Array("Hillsbrad Foothills",267),
    312                 139 => Array("Eastern Plaguelands",139),
    313                 28 => Array("Western Plaguelands",28),
    314                 130 => Array("Silverpine Forest",130),
    315                 85 => Array("Tirisfal Glades",85),
    316                 4 => Array("Blasted Lands",4),
    317                 8 => Array("Swamp of Sorrows",8),
    318                 45 => Array("Arathi Highlands",45),
    319                 36 => Array("Alterac Mountains",36),
    320                 1657 => Array("Darnassus",1657),
    321                 1638 => Array("Thunder_bluff",1638),
    322                 1637 => Array("Orgrimmar",1637),
    323                 493 => Array("Moonglade",493),
    324                 1377 => Array("Silithus",1377),
    325                 618 => Array("Winterspring",618),
    326                 490 => Array("Un Goro Crater",490),
    327                 361 => Array("Felwood",361),
    328                 16 => Array("Azshara",16),
    329                 440 => Array("Tanaris",440),
    330                 15 => Array("Dustwallow Marsh",15),
    331                 215 => Array("Mulgore",215),
    332                 357 => Array("Feralas",357),
    333                 405 => Array("Desolace",405),
    334                 400 => Array("Thousand Needles",400),
    335                 14 => Array("Durotar",14),
    336                 331 => Array("Ashenvale",331),
    337                 148 => Array("Darkshore",148),
    338                 141 => Array("Teldrassil",141),
    339                 406 => Array("Stonetalon Mountains",406),
    340                 17 => Array("She Barrens",17),
    341                 3703 => Array("Shattrath city",3703),
    342                 3487 => Array("Silvermoon city",3487),
    343                 3523 => Array("Netherstorm",3523),
    344                 3519 => Array("Terokkar Forest",3519),
    345                 3518 => Array("Nagrand",3518),
    346                 3525 => Array("Bloodmyst Isle",3525),
    347                 3522 => Array("Blades Edge Mountains",3522),
    348                 3520 => Array("Shadowmoon Valley",3520),
    349                 3557 => Array("The Exodar",3557),
    350                 3521 => Array("Zangarmarsh",3521),
    351                 3483 => Array("Hellfire Peninsula",3483),
    352                 3524 => Array("Azuremyst Isle",3524),
    353                 3433 => Array("Ghostlands",3433),
    354                 3430 => Array("Eversong Woods",3430)
    355           );
    356              if( isset($zone_id[$id]))
    357              {
    358                 return $zone_id[$id][0];
    359        }
    360        else
    361              {
    362                return("-");
    363        }             
    364181    }
     182    echo('</table>');
     183  }
     184
     185  public function SeoUrl($title)
     186  { 
     187    $address = $title; 
     188    $diakritika = array("á","ä","č","ď","é","ě","ë","í","ň","ó","ö","ř","š","ť","ú","ů","ü","ý","ž","Á","Ä","Č","Ď","É","Ě","Ë","Í","Ň","Ó","Ö","Ř","Š","Ť","Ú","Ů","Ü","Ý","Ž");
     189    $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");
     190    $address = str_replace($diakritika, $nediakritika, $address);
     191    $address = strtolower ($address);   
     192    $address = preg_replace ("/[^[:alpha:][:digit:]]/", "-", $address); 
     193    $address = trim ($address, "-"); 
     194    $address = preg_replace ("/[-]+/", "-", $address); 
     195    return($address); 
     196  }
     197
     198  public function MapName($id)
     199  {
     200    $map_id = Array
     201    (
     202        0 => array(0,"Azeroths"),
     203      1 => array(1,"Kalimdor"),
     204      13 => array(13,"Test Zone"),
     205      17 => array(17,"Kalidar"),
     206      30 => array(30,"Alterac Valley"),
     207      33 => array(33,"Shadowfang Keep Instance"),
     208      34 => array(34,"The Stockade Instance"),
     209      35 => array(35,"Stormwind Prison"),
     210      36 => array(36,"Deadmines Instance"),
     211      37 => array(37,"Plains of Snow"),
     212      43 => array(43,"Wailing Caverns Instance"),
     213      44 => array(44,"Monastery Interior"),
     214      47 => array(47,"Razorfen Kraul Instance"),
     215      48 => array(48,"Blackfathom Deeps Instance"),
     216      70 => array(70,"Uldaman Instance"),
     217      90 => array(90,"Gnomeregan Instance"),
     218      109 => array(109,"Sunken Temple Instance"),
     219      129 => array(129,"Razorfen Downs Instance"),
     220      150 => array(150,"Outland"),
     221      169 => array(169,"Emerald Forest"),
     222      189 => array(189,"Scarlet Onastery Instance"),
     223      209 => array(209,"Zul farrak Instance"),
     224      229 => array(229,"Blackrock Spire Instance"),
     225      230 => array(230,"Blackrock Depths Instance"),
     226      249 => array(249,"Onyxia s Lair Instance"),
     227      269 => array(269,"Cot Black Morass"),
     228      289 => array(289,"Scholomance Instance"),
     229      309 => array(309,"Zul Gurub Instance"),
     230      329 => array(329,"Stratholme Instance"),
     231      349 => array(349,"Maraudon Instance"),
     232      369 => array(369,"Deeprun Tram"),
     233      389 => array(389,"Ragefire Chasm Instance"),
     234      409 => array(409,"The Molten Core Instance"),
     235      429 => array(429,"dire_maul Instance"),
     236      449 => array(449,"Alliance pvp Barracks"),
     237      450 => array(450,"Horde pvp Barracks"),
     238      451 => array(451,"Development Land"),
     239      469 => array(469,"BlackwingLair Instance"),
     240      489 => array(489,"Warsong Gulch"),
     241      509 => array(509,"Ruins of ahn Qiraj Instance"),
     242      529 => array(529,"Arathi Basin"),
     243      530 => array(530,"Outland"),
     244      531 => array(531,"Temple of ahn Qiraj Instance"),
     245      532 => array(532,"Karazahn"),
     246      533 => array(533,"Naxxramas Instance"),
     247      534 => array(534,"Cot_hyjal Past"),
     248      540 => array(540,"Hellfire Military"),
     249      542 => array(542,"Hellfire Demon"),
     250      543 => array(543,"Hellfire Rampart"),
     251      544 => array(544,"Hellfire Raid"),
     252      545 => array(545,"Coilfang Pumping"),
     253      546 => array(546,"Coilfang Marsh"),
     254      547 => array(547,"Coilfang Draenei"),
     255      548 => array(548,"Coilfang Raid"),
     256      550 => array(550,"Tempest Keep Raid"),
     257      552 => array(552,"Tempest Keep Arcane"),
     258      553 => array(553,"Tempest Keep Atrium"),
     259      554 => array(554,"Tempest Keep Factory"),
     260      555 => array(555,"Auchindoun Shadow"),
     261      556 => array(556,"Auchindoun Srakkoa"),
     262      557 => array(557,"Auchindoun Ethereal"),
     263      558 => array(558,"Auchindoun Draenei"),
     264      559 => array(559,"Nagrand Arena"),
     265      560 => array(560,"Cot Hillsbrad Past"),
     266      562 => array(562,"Blades Edge Arena"),
     267      564 => array(564,"Black Temple"),
     268      565 => array(565,"Gruuls Lair"),
     269      566 => array(566,"Netherstorm Arena"),
     270      568 => array(568,"Zulaman")
     271    );
     272    if(isset($map_id[$id])) return($map_id[$id][1]);
     273                else return("Neznámá");
     274  }
     275
     276  public function ZoneName($id)
     277  {
     278    $zone_id = Array
     279    (
     280        1497 => Array("Undercity",1497),
     281        1537 => Array("Ironforge",1537),
     282        1519 => Array("Stormwind city",1519),
     283        3 => Array("Badlands",3),
     284        11 => Array("Wetlands",11),
     285        33 => Array("Stranglethorn Vale",33),
     286        44 => Array("Redridge Mountains",44),
     287        38 => Array("Loch Modan",38),
     288        10 => Array("Duskwood",10),
     289        41 => Array("Deadwind Pass",41),
     290        12 => Array("Elwynn Forest",12),
     291        46 => Array("Burning Steppes",46),
     292        51 => Array("Searing Gorge",51),
     293        1 => Array("Dun Morogh",1),
     294        47 => Array("The Hinterlands",47),
     295        40 => Array("Westfall",40),
     296        267 => Array("Hillsbrad Foothills",267),
     297        139 => Array("Eastern Plaguelands",139),
     298        28 => Array("Western Plaguelands",28),
     299        130 => Array("Silverpine Forest",130),
     300        85 => Array("Tirisfal Glades",85),
     301        4 => Array("Blasted Lands",4),
     302        8 => Array("Swamp of Sorrows",8),
     303        45 => Array("Arathi Highlands",45),
     304        36 => Array("Alterac Mountains",36),
     305        1657 => Array("Darnassus",1657),
     306        1638 => Array("Thunder_bluff",1638),
     307        1637 => Array("Orgrimmar",1637),
     308        493 => Array("Moonglade",493),
     309        1377 => Array("Silithus",1377),
     310        618 => Array("Winterspring",618),
     311        490 => Array("Un Goro Crater",490),
     312        361 => Array("Felwood",361),
     313        16 => Array("Azshara",16),
     314        440 => Array("Tanaris",440),
     315        15 => Array("Dustwallow Marsh",15),
     316        215 => Array("Mulgore",215),
     317        357 => Array("Feralas",357),
     318        405 => Array("Desolace",405),
     319        400 => Array("Thousand Needles",400),
     320        14 => Array("Durotar",14),
     321        331 => Array("Ashenvale",331),
     322        148 => Array("Darkshore",148),
     323        141 => Array("Teldrassil",141),
     324        406 => Array("Stonetalon Mountains",406),
     325        17 => Array("She Barrens",17),
     326        3703 => Array("Shattrath city",3703),
     327        3487 => Array("Silvermoon city",3487),
     328        3523 => Array("Netherstorm",3523),
     329        3519 => Array("Terokkar Forest",3519),
     330        3518 => Array("Nagrand",3518),
     331        3525 => Array("Bloodmyst Isle",3525),
     332        3522 => Array("Blades Edge Mountains",3522),
     333        3520 => Array("Shadowmoon Valley",3520),
     334        3557 => Array("The Exodar",3557),
     335        3521 => Array("Zangarmarsh",3521),
     336        3483 => Array("Hellfire Peninsula",3483),
     337        3524 => Array("Azuremyst Isle",3524),
     338        3433 => Array("Ghostlands",3433),
     339        3430 => Array("Eversong Woods",3430)
     340    );
     341    if(isset($zone_id[$id])) return($zone_id[$id][0]);
     342      else return('-');
     343  }
    365344}
    366345
Note: See TracChangeset for help on using the changeset viewer.