Changeset 609 for trunk/inc


Ignore:
Timestamp:
Aug 7, 2009, 10:03:50 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Stránky přizpůsobeny pro podporu více světů. Doplněna stránka seznamu světů.
Location:
trunk/inc
Files:
1 added
4 edited

Legend:

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

    r597 r609  
    1919    'UDBRevision' => '204',
    2020    'ScriptDev2Revision' => '137',
    21     'ClientVersion' => '3.0.9',
    22     'MaxOnlinePlayers' => 100,
     21    'ClientVersion' => '3.1.3',
     22    'DatabaseRealmd' => 'realmd',
    2323    'RequiredOnlinePlayers' => 70,
    24     'DatabaseMangos' => 'mangos',
    25     'DatabaseCharacters' => 'characters',
    26     'DatabaseRealmd' => 'realmd',
    27     'DatabaseScriptDev2' => 'scriptdev2',
    2824    'GMCommandsLog' => 'gm_commands.log',
    2925    'CharacterDataOffset' => array
     
    3430      'HonorPoints' => 1648,
    3531      'ArenaPoints' => 1649,
     32    ),
     33    'RealmList' => array(
     34      1 => array(
     35        'Name' => 'Realm 1'
     36        'DatabaseCharacters' => 'realm1_characters',
     37        'DatabaseMangos' => 'realm1_mangos',
     38        'DatabaseScriptDev2' => 'realm1_scriptdev2',
     39        'MaxOnlinePlayers' => 100,
     40        'XPRate' => 1,
     41        'Type' => 'Normalní',
     42        'Description' => 'Hlavní realm',
     43      ),
    3644    ),
    3745  ),
     
    5058    'ShowSQLError' => false,
    5159    'ShowSQLQuery' => false,
     60    'ShowPHPError' => false,
    5261  ),
    5362  'CheckRegistration' => array
  • trunk/inc/html.php

    r595 r609  
    195195  public function ShowNews($kategorie)
    196196  {
    197           global $Config;
    198                
     197    global $Config;
     198   
    199199    echo('<table class="NewsCategoryTable">'.
    200200      '<tr>'.
     
    214214      $where = 'WHERE `category` = "'.$kategorie.'"';
    215215    }
    216                
     216   
    217217    $this->db->select_db($Config['Database']['Database']);
    218218    $limit = 5;
     
    297297        '<tr>'.
    298298        '<td colspan="2">'.
    299         '<strong>Server : </strong>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 8085)).'<b> (<a href="?page=online">'.$server->MangosOnline().' hráčů</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | Více info <a href="?page=server">zde</a></b>'.
     299        '<strong>Server : </strong>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 3724)).'<b> (<a href="?page=online">'.$server->ServerMangosOnline().' hráčů</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | Více info <a href="?page=server">zde</a></b>'.
    300300        '</td></tr></table><br />');
    301301    }
  • trunk/inc/player.php

    r583 r609  
    77  private $db;
    88 
    9   function __construct ($db)
     9  function __construct($db)
    1010  {
    1111    $this->db = &$db;
     
    1515  {
    1616    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 />');
     17      else echo('<img src="imgs/inc/off.gif">&nbsp;<font color="#990000" size="4\">'.$text.'</font><br />');
    1818  }
    1919
     
    4949    if($sql->num_rows == 1)
    5050    {
    51       $row = $sql->fetch_array();
     51      $row = $sql->fetch_assoc();
    5252      $_SESSION['UserId'] = $row['id'];
    5353      $_SESSION['UserName'] = $username;
     
    7373    if(!array_key_exists('Time', $_SESSION)) $_SESSION['Time'] = time();
    7474    if(!array_key_exists('UserId', $_SESSION)) $_SESSION['UserId'] = 0;
    75     if($_SESSION['Time'] < (time() - 60 * $this->SessionTimeout))
    76     {
    77       $this->Logout();
    78     }
     75    if($_SESSION['Time'] < (time() - 60 * $this->SessionTimeout)) $this->Logout();
    7976    $_SESSION['Time'] = time();
    8077    return($_SESSION['UserId'] != 0);
     
    8380  public function LoginForm()
    8481  {
    85     echo('<form method="post" action="?page=acc">
    86      <table>
    87                 <tr>
    88                   <td><b>Jméno : </b></td><td><input type="text" name="user" class="textinput"></td>
     82    echo('<form method="post" action="?page=acc">'.
     83     '<table>'.
     84    '<tr>'.
     85    '<td><b>Jméno : </b></td><td><input type="text" name="user" class="textinput"></td>
    8986                </tr>
    9087                <tr>
     
    9794            </form>
    9895            <div align="left">
    99             <a href="?page=register">Registrace</a><br /><a href="?page=lostpass">Obnova hesla</a>
    100             </div>');
     96            <a href="?page=register">Registrace</a><br />'. //<a href="?page=lostpass">Obnova hesla</a>
     97            '</div>');
    10198   }
    10299
     
    105102    global $Config;
    106103
    107     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
    108       $DbResult = $this->db->query(
    109       'SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1)'.
    110       ' AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;');
     104    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
     105    $DbResult = $this->db->query('SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1) AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;');
    111106    $row = $DbResult->fetch_assoc();
    112107    return($row['level']);
     
    146141      if(!$this->IsOnline($guid))
    147142      {
    148         $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     143        $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    149144        $row = $this->db->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc();
    150145        $data = explode(' ', $row['data']);
     
    161156    global $Config;
    162157
    163     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     158    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    164159    if($this->CharInAcc($guid, 0))
    165160    {
     
    189184    global $Config;
    190185
    191     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     186    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    192187    // .go xyz -90.54 41.35 -31.71
    193188    // .go xyz -91.01 100.46 -31.71
     
    230225    global $Config;
    231226
    232     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     227    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    233228    $row = $this->db->query('SELECT `online` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();
    234229    if($row['online'] == 1) return(true);
    235     else return(false);
     230      else return(false);
    236231  }
    237232
     
    246241        $acc = $_SESSION['UserId'];
    247242      }
    248       $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     243      $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    249244      if($this->db->query('SELECT `guid` FROM `characters` WHERE `characters`.`guid`="'.$char.'" AND `account`="'.$acc.'" LIMIT 1;')->num_rows == 1)
    250245      {
     
    265260    global $Config;
    266261
    267     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     262    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    268263    $row = $this->db->query('SELECT `guid` FROM `characters` WHERE `name` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc();
    269264    if($row['guid'] != '')
     
    280275    global $Config;
    281276
    282     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     277    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    283278    $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();
    284279    if($row['name'] != '')
     
    359354            <th>Nahráno</th>
    360355          </tr>');
    361     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     356    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    362357    echo($this->db->error);
    363358    $sql = $this->db->query('SELECT `guid`,`name`,`race`,`totaltime`,`class`, mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.($Config['Mangos']['CharacterDataOffset']['Gender'] + 1).'), " ",-1) AS unsigned) ), 8, 0), 4, 1) AS gender FROM `characters` WHERE `account`='.$accid.' ORDER BY `totaltime` DESC LIMIT 0, 10');
  • trunk/inc/server.php

    r596 r609  
    11<?php
     2
     3function NullErrorHandler()
     4{
     5}
    26
    37class Server
     
    4549  }
    4650     
    47   public function MangosOnline()
     51  public function MangosOnline($RealmId)
    4852  {
    4953    global $Config;
    5054   
    51     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);   
     55    $this->db->select_db($Config['Mangos']['RealmList'][$RealmId]['DatabaseCharacters']);   
    5256    $DbResult = $this->db->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1');
    5357    $DbRow = $DbResult->fetch_row();
     
    5559  }
    5660
    57   public function ServerOnline($ip, $port)
    58   {
    59     if($fp1 = @fsockopen($ip, $port, $ERROR_NO, $ERROR_STR, (float)0.5))
     61  public function ServerMangosOnline()
     62  {
     63    global $Config;
     64   
     65    $TotalCount = 0;
     66    foreach($Config['Mangos']['RealmList'] as $Index => $Realm)
    6067    {
    61       fclose($fp1);
    62       return(true);
    63     } else
     68      $TotalCount += $this->MangosOnline($Index);
     69    }
     70    return($TotalCount);
     71  } 
     72
     73  public function ServerOnline($Address, $Port, $Timeout = 0.5)
     74  {
     75    set_error_handler('NullErrorHandler');
     76    if($Socket = @fsockopen($Address, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout))
    6477    {
    65       return(false);
    66     }
    67   }
     78      fclose($Socket);
     79      $Result = true;
     80    } else $Result = false;
     81    restore_error_handler();
     82    return($Result);  }
    6883
    6984  public function ServerImg($status)
     
    7590  public function ServerUptime()
    7691  {
    77           global $Config;
     92    global $Config;
    7893
    7994    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     
    8499  }
    85100
    86   public function CharacterCount()
    87   {
    88     global $Config;
    89 
    90     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     101  public function CharacterCount($RealmId)
     102  {
     103    global $Config;
     104
     105    $this->db->select_db($Config['Mangos']['RealmList'][$RealmId]['DatabaseCharacters']);
    91106    $row = $this->db->query('SELECT COUNT(*) FROM characters')->fetch_row();
    92107    return($row[0]);
    93108  }
    94109
     110  public function ServerCharacterCount()
     111  {
     112    global $Config;
     113   
     114    $TotalCount = 0;
     115    foreach($Config['Mangos']['RealmList'] as $Index => $Realm)
     116    {
     117      $TotalCount += $this->CharacterCount($Index);
     118    }
     119    return($TotalCount);
     120  }
     121 
    95122  public function AccountCount()
    96123  {
    97           global $Config;
     124    global $Config;
    98125
    99126    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     
    104131  public function GuidToCharName($guid)
    105132  {
    106           global $Config;
    107 
    108     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     133    global $Config;
     134
     135    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    109136    $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array();
    110137    return($row['name']);
     
    198225    $map_id = Array
    199226    (
    200         0 => array(0,"Azeroths"),
     227      0 => array(0,"Azeroths"),
    201228      1 => array(1,"Kalimdor"),
    202229      13 => array(13,"Test Zone"),
     
    269296    );
    270297    if(isset($map_id[$id])) return($map_id[$id][1]);
    271                 else return("Neznámá");
     298    else return("Neznámá");
    272299  }
    273300
     
    276303    $zone_id = Array
    277304    (
    278         1497 => Array("Undercity",1497),
    279         1537 => Array("Ironforge",1537),
    280         1519 => Array("Stormwind city",1519),
    281         3 => Array("Badlands",3),
    282         11 => Array("Wetlands",11),
    283         33 => Array("Stranglethorn Vale",33),
    284         44 => Array("Redridge Mountains",44),
    285         38 => Array("Loch Modan",38),
    286         10 => Array("Duskwood",10),
    287         41 => Array("Deadwind Pass",41),
    288         12 => Array("Elwynn Forest",12),
    289         46 => Array("Burning Steppes",46),
    290         51 => Array("Searing Gorge",51),
    291         1 => Array("Dun Morogh",1),
    292         47 => Array("The Hinterlands",47),
    293         40 => Array("Westfall",40),
    294         267 => Array("Hillsbrad Foothills",267),
    295         139 => Array("Eastern Plaguelands",139),
    296         28 => Array("Western Plaguelands",28),
    297         130 => Array("Silverpine Forest",130),
    298         85 => Array("Tirisfal Glades",85),
    299         4 => Array("Blasted Lands",4),
    300         8 => Array("Swamp of Sorrows",8),
    301         45 => Array("Arathi Highlands",45),
    302         36 => Array("Alterac Mountains",36),
    303         1657 => Array("Darnassus",1657),
    304         1638 => Array("Thunder_bluff",1638),
    305         1637 => Array("Orgrimmar",1637),
    306         493 => Array("Moonglade",493),
    307         1377 => Array("Silithus",1377),
    308         618 => Array("Winterspring",618),
    309         490 => Array("Un Goro Crater",490),
    310         361 => Array("Felwood",361),
    311         16 => Array("Azshara",16),
    312         440 => Array("Tanaris",440),
    313         15 => Array("Dustwallow Marsh",15),
    314         215 => Array("Mulgore",215),
    315         357 => Array("Feralas",357),
    316         405 => Array("Desolace",405),
    317         400 => Array("Thousand Needles",400),
    318         14 => Array("Durotar",14),
    319         331 => Array("Ashenvale",331),
    320         148 => Array("Darkshore",148),
    321         141 => Array("Teldrassil",141),
    322         406 => Array("Stonetalon Mountains",406),
    323         17 => Array("She Barrens",17),
    324         3703 => Array("Shattrath city",3703),
    325         3487 => Array("Silvermoon city",3487),
    326         3523 => Array("Netherstorm",3523),
    327         3519 => Array("Terokkar Forest",3519),
    328         3518 => Array("Nagrand",3518),
    329         3525 => Array("Bloodmyst Isle",3525),
    330         3522 => Array("Blades Edge Mountains",3522),
    331         3520 => Array("Shadowmoon Valley",3520),
    332         3557 => Array("The Exodar",3557),
    333         3521 => Array("Zangarmarsh",3521),
    334         3483 => Array("Hellfire Peninsula",3483),
    335         3524 => Array("Azuremyst Isle",3524),
    336         3433 => Array("Ghostlands",3433),
    337         3430 => Array("Eversong Woods",3430)
     305      1497 => Array("Undercity",1497),
     306      1537 => Array("Ironforge",1537),
     307      1519 => Array("Stormwind city",1519),
     308      3 => Array("Badlands",3),
     309      11 => Array("Wetlands",11),
     310      33 => Array("Stranglethorn Vale",33),
     311      44 => Array("Redridge Mountains",44),
     312      38 => Array("Loch Modan",38),
     313      10 => Array("Duskwood",10),
     314      41 => Array("Deadwind Pass",41),
     315      12 => Array("Elwynn Forest",12),
     316      46 => Array("Burning Steppes",46),
     317      51 => Array("Searing Gorge",51),
     318      1 => Array("Dun Morogh",1),
     319      47 => Array("The Hinterlands",47),
     320      40 => Array("Westfall",40),
     321      267 => Array("Hillsbrad Foothills",267),
     322      139 => Array("Eastern Plaguelands",139),
     323      28 => Array("Western Plaguelands",28),
     324      130 => Array("Silverpine Forest",130),
     325      85 => Array("Tirisfal Glades",85),
     326      4 => Array("Blasted Lands",4),
     327      8 => Array("Swamp of Sorrows",8),
     328      45 => Array("Arathi Highlands",45),
     329      36 => Array("Alterac Mountains",36),
     330      1657 => Array("Darnassus",1657),
     331      1638 => Array("Thunder_bluff",1638),
     332      1637 => Array("Orgrimmar",1637),
     333      493 => Array("Moonglade",493),
     334      1377 => Array("Silithus",1377),
     335      618 => Array("Winterspring",618),
     336      490 => Array("Un Goro Crater",490),
     337      361 => Array("Felwood",361),
     338      16 => Array("Azshara",16),
     339      440 => Array("Tanaris",440),
     340      15 => Array("Dustwallow Marsh",15),
     341      215 => Array("Mulgore",215),
     342      357 => Array("Feralas",357),
     343      405 => Array("Desolace",405),
     344      400 => Array("Thousand Needles",400),
     345      14 => Array("Durotar",14),
     346      331 => Array("Ashenvale",331),
     347      148 => Array("Darkshore",148),
     348      141 => Array("Teldrassil",141),
     349      406 => Array("Stonetalon Mountains",406),
     350      17 => Array("She Barrens",17),
     351      3703 => Array("Shattrath city",3703),
     352      3487 => Array("Silvermoon city",3487),
     353      3523 => Array("Netherstorm",3523),
     354      3519 => Array("Terokkar Forest",3519),
     355      3518 => Array("Nagrand",3518),
     356      3525 => Array("Bloodmyst Isle",3525),
     357      3522 => Array("Blades Edge Mountains",3522),
     358      3520 => Array("Shadowmoon Valley",3520),
     359      3557 => Array("The Exodar",3557),
     360      3521 => Array("Zangarmarsh",3521),
     361      3483 => Array("Hellfire Peninsula",3483),
     362      3524 => Array("Azuremyst Isle",3524),
     363      3433 => Array("Ghostlands",3433),
     364      3430 => Array("Eversong Woods",3430)
    338365    );
    339366    if(isset($zone_id[$id])) return($zone_id[$id][0]);
Note: See TracChangeset for help on using the changeset viewer.