Changeset 93


Ignore:
Timestamp:
Aug 15, 2013, 11:17:26 PM (11 years ago)
Author:
chronos
Message:
  • Fixed: System variable as parameter to constructors of descendents of Module class.
  • Removed: End PHP mark "?>" from all files.
Location:
trunk/www
Files:
82 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/Application/Application.php

    r78 r93  
    3737$Application = new Application();
    3838$Application->Run();
    39 
    40 ?>
  • trunk/www/Application/Config/ConfigSample.php

    r76 r93  
    4545  'BackupCountPerServer' => 20, 
    4646);
    47 
    48 ?>
  • trunk/www/Application/Controller/Backup.php

    r80 r93  
    3535  }   
    3636}
    37 
    38 ?>
  • trunk/www/Application/Controller/Client.php

    r80 r93  
    1414  }   
    1515}
    16 
    17 ?>
  • trunk/www/Application/Controller/Cluster.php

    r80 r93  
    5757  }   
    5858}
    59 
    60 ?>
  • trunk/www/Application/Controller/Debug.php

    r80 r93  
    2121  }   
    2222}
    23 
    24 ?>
  • trunk/www/Application/Controller/Emulator.php

    r80 r93  
    4949  }   
    5050}
    51 
    52 ?>
  • trunk/www/Application/Controller/HomePage.php

    r78 r93  
    3737  }
    3838}
    39 
    40 ?>
  • trunk/www/Application/Controller/News.php

    r80 r93  
    2121  }   
    2222}
    23 
    24 ?>
  • trunk/www/Application/Controller/Realm.php

    r80 r93  
    9191  }   
    9292}
    93 
    94 ?>
  • trunk/www/Application/Controller/Server.php

    r80 r93  
    104104  function UnLock()
    105105  {
    106     $Model = new Server($this->Database, $_GET['Id']);
     106    $Model = new Server($this->System, $_GET['Id']);
    107107    $Model->UnLock();
    108108  }   
     
    110110  function Lock()
    111111  {
    112     $Model = new Server($this->Database, $_GET['Id']);
     112    $Model = new Server($this->System, $_GET['Id']);
    113113    $Model->Lock();
    114114  }     
    115115}
    116 
    117 ?>
  • trunk/www/Application/Controller/Task.php

    r80 r93  
    3737  }   
    3838}
    39 
    40 ?>
  • trunk/www/Application/Controller/Update.php

    r80 r93  
    2121  }   
    2222}
    23 
    24 ?>
  • trunk/www/Application/Controller/User.php

    r78 r93  
    8484  }   
    8585}
    86 
    87 ?>
  • trunk/www/Application/Localization/cz.php

    r76 r93  
    2929  'AccessDenied' => 'K provedení požadované akce nemáte dostatečné oprávnění',
    3030);
    31 
    32 ?>
  • trunk/www/Application/Model/Backup.php

    r80 r93  
    88  var $Task;
    99 
    10   function __construct($Database, $Id)
     10  function __construct($System, $Id)
    1111  {
    12     $this->Database = $Database;
    13     $this->Task = new Task($Database);
     12        parent::__construct($System);
     13    $this->Task = new Task($System);
    1414    $this->Id = $Id;
    1515    $DbResult = $this->Database->query('SELECT * FROM `Backup` WHERE `Id`='.$Id);
     
    4242  function Create($ServerId)
    4343  {
    44     $Server = new Server($this->Database, $ServerId);
     44    $Server = new Server($this->System, $ServerId);
    4545    $Description = 'MaNGOS r'.$Server->Server['Database']['Emulator']['Revision'].', UDB r'.$Server->Server['Database']['Revision'].', SD2 r'.$Server->Server['Database']['ScriptDev2Revision'].', Client '.$Server->Server['Database']['Emulator']['Client']['Version'];
    4646    $this->Database->insert('Backup', array('Server' => $ServerId, 'Time' => 'NOW()', 'Description' => $Description, 'Lock' => 1, 'Database' => $Server->Server['Database']['Id']));
     
    7373  }
    7474}
    75 
    76 ?>
  • trunk/www/Application/Model/Cluster.php

    r78 r93  
    77  function __construct($System, $Id)
    88  {
    9     $this->System = $System;
    10     $this->Config = $System->Config;
    11     $this->Database = $System->Database;
     9        parent::__construct($System);
    1210   
    1311    $DbResult = $this->Database->query('SELECT * FROM `ClusterNode` WHERE `Id`='.$Id);
     
    3129  } 
    3230}
    33 
    34 ?>
  • trunk/www/Application/Model/ClusterList.php

    r78 r93  
    1313  } 
    1414}
    15 
    16 ?>
  • trunk/www/Application/Model/Emulator.php

    r78 r93  
    99  var $Task;
    1010 
    11   function __construct($Database, $Id)
     11  function __construct($System, $Id)
    1212  {
    13     $this->Database = $Database;
    14     $this->Task = new Task($Database);
     13    parent::__construct($System);
     14    $this->Task = new Task($System);
    1515    $this->Id = $Id;
    1616    $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$Id);
     
    3535  function Download()
    3636  {
    37     global $Config;
    38    
    3937    $this->Lock();
    4038    $this->Task->Add('Stažení emulátoru', array(
    4139      'php www/shell.php EmulatorLock '.$this->Id,
    42       'mkdir '.$Config['BaseDir'].'emulator/'.$this->Id.'/',
    43       'cd '.$Config['BaseDir'].'emulator/'.$this->Id.'/',
     40      'mkdir '.$this->Config['BaseDir'].'emulator/'.$this->Id.'/',
     41      'cd '.$this->Config['BaseDir'].'emulator/'.$this->Id.'/',
    4442      'git clone git://github.com/mangos/mangos.git source',
    4543      'cd source',
     
    5553  function Compile()
    5654  {
    57     global $Config;
    58    
    5955    $this->Lock();
    6056    $this->Task->Add('Překlad emulátoru', array(
    6157      'php www/shell.php EmulatorLock '.$this->Id,
    62       'cd '.$Config['BaseDir'].'emulator/'.$this->Id.'/source',
     58      'cd '.$this->Config['BaseDir'].'emulator/'.$this->Id.'/source',
    6359      'autoreconf -ifv',
    6460      'mkdir objdir',
    6561      'cd objdir',
    66       'export CFLAGS="-g -ggdb '.$Config['CompilerParameters'].'"',
    67       'export CXXFLAGS="-g -ggdb '.$Config['CompilerParameters'].'"',
    68       '../configure --prefix='.$Config['BaseDir'].'emulator/'.$this->Id.'/ --enable-cli --enable-ra',
     62      'export CFLAGS="-g -ggdb '.$this->Config['CompilerParameters'].'"',
     63      'export CXXFLAGS="-g -ggdb '.$this->Config['CompilerParameters'].'"',
     64      '../configure --prefix='.$this->Config['BaseDir'].'emulator/'.$this->Id.'/ --enable-cli --enable-ra',
    6965      'make',
    7066      'make install',
     
    9995  }
    10096}
    101 
    102 ?>
  • trunk/www/Application/Model/History.php

    r78 r93  
    1111  var $Resolution = 1000;
    1212 
    13   function __construct($Database, $ServerId, $MeasureId)
     13  function __construct($System, $ServerId, $MeasureId)
    1414  {
    15     $this->Database = $Database;
     15    parent::__construct($System);
    1616    $this->ServerId = $ServerId;
    1717    $this->MeasureId = $MeasureId;
     
    5959  }
    6060}
    61 
    62 ?>
  • trunk/www/Application/Model/MangosConfigurationFile.php

    r78 r93  
    77  var $ParameterList;
    88 
    9   function __construct($Database)
     9  function __construct($System)
    1010  {
    11     $this->Database = $Database;
     11    parent::__construct($System);
    1212    $this->Parameters = array();
    1313  }
     
    4141  }
    4242}
    43 
    44 ?>
  • trunk/www/Application/Model/MangosDebug.php

    r78 r93  
    88  var $MaxMangosThreadCount = 12;
    99 
    10   function __construct($Database)
     10  function __construct($System)
    1111  {
    12     $this->Database = $Database;
     12    parent::__construct($System);
    1313  }
    1414 
    1515  function ProcessLog($RealmId)
    1616  {
    17     global $Config;
    18    
    1917    $Output = '';
    2018    // Read server Id from first parameter
    21     $Realm = new Realm($this->Database, $RealmId);
     19    $Realm = new Realm($this->System, $RealmId);
    2220   
    2321    $LogDir = '../realm/'.$RealmId.'/log/';
     
    104102  }
    105103}
    106 
    107 ?>
  • trunk/www/Application/Model/Permission.php

    r78 r93  
    4646  }
    4747}
    48 
    49 ?>
  • trunk/www/Application/Model/Platform.php

    r78 r93  
    77  var $Id;
    88 
    9   function __construct($Database)
     9  function __construct($System)
    1010  {
    11     $this->Database = $Database;
     11    parent::__construct($System);
    1212  }
    1313 
     
    4646  function State()
    4747  {
    48     global $Config;
    49    
    5048    $State = array();
    5149    $State['MemoryUsed'] = $this->MemoryUsage();
     
    7674    $DbRow = $DbResult->fetch_row();
    7775    $State['TaskQueued'] = $DbRow[0];
    78     $State['ServerMaxCount'] = $Config['MaxServerCount'];
     76    $State['ServerMaxCount'] = $this->Config['MaxServerCount'];
    7977    return($State);
    8078  } 
    8179}
    82 
    83 ?>
  • trunk/www/Application/Model/Realm.php

    r78 r93  
    99  var $Task;
    1010 
    11   function __construct($Database, $Id)
    12   {
    13     $this->Database = $Database;
    14     $this->Task = new Task($Database);
     11  function __construct($System, $Id)
     12  {
     13    parent::__construct($System);
     14    $this->Task = new Task($System);
    1515    $this->Id = $Id;
    1616    $DbResult = $this->Database->query('SELECT * FROM `Realm` WHERE `Id`='.$Id);
     
    3131
    3232  function GetState()
    33   {
    34     global $System;
    35    
     33  {   
    3634    $State = array();
    37     $State['WorlddPortState'] = $System->NetworkPortState('localhost', $this->Data['NetworkPortWorldd']);
     35    $State['WorlddPortState'] = $this->System->NetworkPortState('localhost', $this->Data['NetworkPortWorldd']);
    3836    $State['Online'] = $State['WorlddPortState'];
    3937    $State['Uptime'] = $this->Uptime();
     
    140138  function UpdateRealmlist()
    141139  {
    142     $Server = new Server($this->Database, $this->Data['Server']);
     140    $Server = new Server($this->System, $this->Data['Server']);
    143141    $Server->UpdateRealmList();
    144142  }
     
    153151  function UpdateScripts()
    154152  {
    155     global $Config;
    156    
    157153    $RealmBinDir = '../realm/'.$this->Id.'/bin/';
    158154    if(!file_exists($RealmBinDir)) mkdir($RealmBinDir, 0777, true);   
     
    165161      'info thread',
    166162    );
    167     for($I = 1; $I < $Config['MangosWorlddThreadCountMax']; $I++)
     163    for($I = 1; $I < $this->Config['MangosWorlddThreadCountMax']; $I++)
    168164      $Content[] = 'thread apply '.$I.' bt full';
    169165    file_put_contents($ScriptFileName, implode("\n", $Content));
     
    209205  function SetupConfigurationFiles()
    210206  {
    211     global $Config;
    212    
    213207    $EmulatorEtcDir = '../emulator/'.$this->Data['Database']['Emulator']['Id'].'/etc/';
    214208    $RealmEtcDir = '../realm/'.$this->Id.'/etc/';
     
    220214    if(!file_exists($RealmEtcDir.'mangosd.conf'))
    221215      file_put_contents($RealmEtcDir.'mangosd.conf', file_get_contents($EmulatorEtcDir.'mangosd.conf.dist'));
    222     $EmulatorConfig = new MangosConfigurationFile($this->Database);
     216    $EmulatorConfig = new MangosConfigurationFile($this->System);
    223217    $EmulatorConfig->Load($RealmEtcDir.'mangosd.conf');
    224218    $EmulatorConfig->ParameterList['RealmID'] = $this->Data['Id'];
     
    235229     
    236230    // scriptdev2.conf
    237     $EmulatorConfig = new MangosConfigurationFile($this->Database);
     231    $EmulatorConfig = new MangosConfigurationFile($this->System);
    238232    $EmulatorConfig->Load($EmulatorEtcDir.'scriptdev2.conf');
    239233    $EmulatorConfig->ParameterList['ScriptDev2DatabaseInfo'] = 'localhost;3306;server'.$this->Data['Server'].';server'.$this->Data['Server'].';realm'.$this->Id.'_scriptdev2';
     
    255249    if($DoBackup)
    256250    {
    257       $Backup = new Backup($this->Database, 0);
     251      $Backup = new Backup($this->System, 0);
    258252      $Output .= '<br />'.$Backup->Create($this->Id);
    259253    }
     
    364358    while($DbRow = $DbResult->fetch_assoc())
    365359    {
    366       $Realm = new Realm($this->Database, $DbRow['Id']);   
     360      $Realm = new Realm($this->System, $DbRow['Id']);   
    367361      $Realm->UpdateState();
    368362    }   
     
    380374  }
    381375}
    382 
    383 ?>
  • trunk/www/Application/Model/RealmList.php

    r78 r93  
    1212    while($DbRow = $DbResult->fetch_assoc())
    1313    {
    14       $Server = new Server($this->Database, $DbRow['Id']);
     14      $Server = new Server($this->System, $DbRow['Id']);
    1515      $Total += $Server->RealmCount();
    1616    }
     
    1818  }
    1919}
    20 
    21 ?>
  • trunk/www/Application/Model/RemoteConsole.php

    r79 r93  
    4949  }
    5050}
    51 
    52 ?>
  • trunk/www/Application/Model/Server.php

    r78 r93  
    99  var $Task;
    1010 
    11   function __construct($Database, $Id)
    12   {
    13     $this->Database = $Database;
    14     $this->Task = new Task($Database);
     11  function __construct($System, $Id)
     12  {
     13    parent::__construct($System);
     14    $this->Task = new Task($System);
    1515    $this->Id = $Id;
    1616    $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id);
     
    6868  function GetState()
    6969  {
    70     global $System;
    71    
    7270    $State = array();
    73     $State['RealmdPortState'] = $System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);
     71    $State['RealmdPortState'] = $this->System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);
    7472    $State['Online'] = $State['RealmdPortState'];
    7573    $DbResult = $this->Database->query('SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = "server'.$this->Id.'_realmd"');
     
    9795  function UpdateRealmlist()
    9896  {
    99     global $Config;
    100    
    10197    $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmlist');
    10298    $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id);
    10399    while($Realm = $DbResult->fetch_assoc())
    104100    {
    105       $this->Database->insert('server'.$this->Id.'_realmd`.`realmlist', array('id' => $Realm['Id'], 'name' => addslashes($Realm['Name']), 'address' => $Config['Web']['Host'], 'port' => $Realm['NetworkPortWorldd'], 'icon' => 0, 'timezone' => 1, 'color' => 0));
     101      $this->Database->insert('server'.$this->Id.'_realmd`.`realmlist',
     102        array('id' => $Realm['Id'], 'name' => addslashes($Realm['Name']),
     103        'address' => $this->Config['Web']['Host'], 'port' => $Realm['NetworkPortWorldd'],
     104        'icon' => 0, 'timezone' => 1, 'color' => 0));
    106105    }
    107106  }
     
    116115  function UpdateScripts()
    117116  {
    118     global $Config;
    119    
    120117    $ServerBinDir = '../server/'.$this->Id.'/bin/';
    121118    if(!file_exists($ServerBinDir)) mkdir($ServerBinDir, 0777, true);       
     
    147144  function SetupConfigurationFiles()
    148145  {
    149     global $Config;
    150    
    151146    $EmulatorEtcDir = '../emulator/'.$this->Server['Database']['Emulator']['Id'].'/etc/';
    152147    $ServerEtcDir = '../server/'.$this->Id.'/etc/';
     
    156151   
    157152    // realmd.conf
    158     $EmulatorConfig = new MangosConfigurationFile($this->Database);
     153    $EmulatorConfig = new MangosConfigurationFile($this->System);
    159154    $EmulatorConfig->Load($EmulatorEtcDir.'realmd.conf.dist');
    160155    $EmulatorConfig->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_realmd';
     
    178173    while($DbRow = $DbResult->fetch_assoc())
    179174    {
    180       $Server = new Server($this->Database, $DbRow['Id']);
     175      $Server = new Server($this->System, $DbRow['Id']);
    181176      $Server->UpdateState();
    182177    }   
     
    249244    if($DoBackup)
    250245    {
    251       $Backup = new Backup($this->Database, 0);
     246      $Backup = new Backup($this->System, 0);
    252247      $Output .= '<br />'.$Backup->Create($this->Id);
    253248    }
     
    308303    while($DbRow = $DbResult->fetch_assoc())
    309304    {
    310       $Realm = new Realm($this->Database, $DbRow['Id']);
     305      $Realm = new Realm($this->System, $DbRow['Id']);
    311306      $UsedMemory += $Realm->GetUsedMemory();
    312307    }
     
    335330  function UpdateRealmlistAccountCount()
    336331  {
    337     global $Config;
    338    
    339332    $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmcharacters');
    340333    $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id);
     
    345338  }
    346339}
    347 
    348 ?>
  • trunk/www/Application/Model/ServerList.php

    r78 r93  
    1313
    1414}
    15 
    16 ?>
  • trunk/www/Application/Model/Shell.php

    r78 r93  
    77  var $Database;
    88 
    9   function __construct($Database)
     9  function __construct($System)
    1010  {
    11     $this->Database = $Database
     11    parent::__construct($System)
    1212  }
    1313 
     
    1717    while($Server = $DbResult->fetch_assoc())
    1818    {
    19       $History = new History($this->Database, $Server['Id'], 1);
    20       $Server = new Server($this->Database, $Server['Id']);
     19      $History = new History($this->System, $Server['Id'], 1);
     20      $Server = new Server($this->System, $Server['Id']);
    2121      $History->AddValue($Server->GetUsedMemory());
    2222    }   
    2323  }
    2424
     25  function Show()
     26  {
     27    $Output = '';
     28    if(count($_SERVER['argv']) > 1)
     29    {
     30      $Command = $_SERVER['argv'][1];
     31      if($Command == 'ServerProcessLog')
     32      {
     33        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
     34        {
     35          $MangosDebug = new MangosDebug($this->System);
     36          $Output = $MangosDebug->ProcessLog($_SERVER['argv'][2]);
     37        } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';
     38      } else
     39      if($Command == 'ServerLock')
     40      {
     41        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
     42        {
     43          $Server = new Server($this->System, $_SERVER['argv'][2]);
     44          $Server->Lock();
     45        } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';
     46      } else 
    2547      if($Command == 'ServerUnLock')
    2648      {
    2749        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    2850        {
    29           $Server = new Server($this->Database, $_SERVER['argv'][2]);
     51          $Server = new Server($this->System, $_SERVER['argv'][2]);
    3052          $Server->UnLock();
    3153        } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';
     
    3557        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    3658        {
    37           $Realm = new Realm($this->Database, $_SERVER['argv'][2]);
     59          $Realm = new Realm($this->System, $_SERVER['argv'][2]);
    3860          $Realm->Lock();
    3961        } else $Output = 'Jako druhý parameter je nutno zadat Id světa.';
     
    4365        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    4466        {
    45           $Realm = new Realm($this->Database, $_SERVER['argv'][2]);
     67          $Realm = new Realm($this->System, $_SERVER['argv'][2]);
    4668          $Realm->UnLock();
    4769        } else $Output = 'Jako druhý parameter je nutno zadat Id světa.';
     
    5173        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    5274        {
    53           $Emulator = new Emulator($this->Database, $_SERVER['argv'][2]);
     75          $Emulator = new Emulator($this->System, $_SERVER['argv'][2]);
    5476          $Emulator->Lock();
    5577        } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.';
     
    5981        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    6082        {
    61           $Emulator = new Emulator($this->Database, $_SERVER['argv'][2]);
     83          $Emulator = new Emulator($this->System, $_SERVER['argv'][2]);
    6284          $Emulator->UnLock();
    6385        } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.';
     
    6789        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    6890        {
    69           $Backup = new Backup($this->Database, $_SERVER['argv'][2]);
     91          $Backup = new Backup($this->System, $_SERVER['argv'][2]);
    7092          $Backup->Lock();
    7193        } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.';
     
    7597        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    7698        {
    77           $Backup = new Backup($this->Database, $_SERVER['argv'][2]);
     99          $Backup = new Backup($this->System, $_SERVER['argv'][2]);
    78100          $Backup->UnLock();
    79101        } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.';
     
    81103      if($Command == 'TaskProcess')
    82104      {
    83         $Task = new Task($this->Database);
     105        $Task = new Task($this->System);
    84106        $Task->ProcessAllCycle();
    85107      } else
     
    90112        while($DbRow = $DbResult->fetch_assoc())
    91113        {
    92           $Server = new Server($this->Database, $DbRow['Id']);
    93           $System->Modules['User']->User['Id'] = $Server->Server['User'];
     114          $Server = new Server($this->System, $DbRow['Id']);
     115          $this->System->Modules['User']->User['Id'] = $Server->Server['User'];
    94116          $Server->Start();
    95117        }
     
    98120        while($DbRow = $DbResult->fetch_assoc())
    99121        {
    100           $Realm = new Realm($this->Database, $DbRow['Id']);
    101           $System->Modules['User']->User['Id'] = $Realm->Data['User'];
     122          $Realm = new Realm($this->System, $DbRow['Id']);
     123          $this->System->Modules['User']->User['Id'] = $Realm->Data['User'];
    102124          $Realm->Start();
    103125        }
     
    106128      {
    107129        // Servers
    108         $Backup = new Backup($this->Database, 0);
     130        $Backup = new Backup($this->System, 0);
    109131        $DbResult = $this->Database->select('Server', 'Id, User');
    110132        while($DbRow = $DbResult->fetch_assoc())
    111133        {
    112           $System->Modules['User']->User['Id'] = $DbRow['User'];
     134          $this->System->Modules['User']->User['Id'] = $DbRow['User'];
    113135          $Backup->Create($DbRow['Id']);
    114136        }
     
    118140        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
    119141        {
    120           $Server = new Server($this->Database, $_SERVER['argv'][2]);
     142          $Server = new Server($this->System, $_SERVER['argv'][2]);
    121143          $Server->ProcessLog();
    122144        } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';
     
    128150      if($Command == 'UpdateState')
    129151      {
    130         $Realm = new Realm($this->Database, 0);
     152        $Realm = new Realm($this->System, 0);
    131153        $Realm->UpdateStateAll();
    132         $Server = new Server($this->Database, 0);
     154        $Server = new Server($this->System, 0);
    133155        $Server->UpdateStateAll();
    134156      } else
     
    137159        if((count($_SERVER['argv']) > 3) and is_numeric($_SERVER['argv'][2]) and is_numeric($_SERVER['argv'][3]))
    138160        {
    139           $Server = new Server($this->Database, $_SERVER['argv'][2]);
     161          $Server = new Server($this->System, $_SERVER['argv'][2]);
    140162          $Server->ChangeDatabaseId($_SERVER['argv'][3]);
    141163        } else $Output = 'Jako druhý parameter je nutno zadat Id serveru, jako třetí Id databáze.';
     
    145167        if((count($_SERVER['argv']) > 3) and is_numeric($_SERVER['argv'][2]) and is_numeric($_SERVER['argv'][3]))
    146168        {
    147           $Realm = new Realm($this->Database, $_SERVER['argv'][2]);
     169          $Realm = new Realm($this->System, $_SERVER['argv'][2]);
    148170          $Realm->ChangeDatabaseId($_SERVER['argv'][3]);
    149171        } else $Output = 'Jako druhý parameter je nutno zadat Id světa, jako třetí Id databáze.';
     
    154176  }
    155177}
    156 
    157 ?>
  • trunk/www/Application/Model/TableRelations.php

    r69 r93  
    6363 
    6464);
    65 
    66 ?>
  • trunk/www/Application/Model/Task.php

    r78 r93  
    77  var $TempScript = 'temp/wowhosting_script.sh';
    88 
    9   function __construct($Database)
     9  function __construct($System)
    1010  {
    11     $this->Database = $Database;
     11        parent::__construct($System);   
    1212  }
    1313 
    1414  function Add($Title, $Task)
    1515  {
    16     global $System;
    17    
    1816    $CommandList = implode("\n", $Task)."\n";
    19     $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'TimeCreate' => 'NOW()', 'CommandList' => $CommandList));
     17    $this->Database->insert('Task', array('User' => $this->System->Modules['User']->User['Id'], 'Title' => $Title, 'TimeCreate' => 'NOW()', 'CommandList' => $CommandList));
    2018  }
    2119
    2220  function ProcessAll()
    2321  {
    24     global $Config;
    25    
    26     chdir($Config['BaseDir']);
     22    chdir($this->Config['BaseDir']);
    2723    $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,TimeCreate ASC');
    2824    while($Task = $DbResult->fetch_assoc())
     
    5955  }
    6056}
    61 
    62 ?>
  • trunk/www/Application/Model/User.php

    r80 r93  
    5757  function Register($Login, $Password, $Password2, $Email, $Name)
    5858  {
    59     global $Options, $Config;
    60 
    6159    if(($Email == '') || ($Login == '') || ($Password == '') || ($Password2 == '')  || ($Name == '')) $Result = $this->System->Translate('MissingData');
    6260    else if($Password != $Password2) $Result = $this->System->Translate('PasswordsUnmatched');
     
    154152      $Mail = new Mail();
    155153      $Mail->Subject = 'Obnova hesla';
    156       $Mail->Content = 'Požádali jste o zaslání nového hesla na serveru <a href="http://'.$this->Config['Web']['Host'].$this->Config['Web']['RootFolder'].'">http://'.$this->Config['Web']['Host'].$this->Config['Web']['RootFolder']."</a>.<br />\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br /><br />\n\nVaše nové heslo k účtu ".$Row['Login']." je: ".$NewPassword."\n<br>Pro aktivaci tohoto hesla klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=PasswordRecoveryConfirm&User='.$Row['Id'].'&H='.$Row['Password'].'&P='.$NewPassword.'">tento odkaz</a>.'."\n<br /> Po přihlášení si prosím změňte heslo na nové.\n\n<br><br>Na tento email neodpovídejte.";
     154      $Mail->Content = 'Požádali jste o zaslání nového hesla na serveru <a href="http://'.
     155        $this->Config['Web']['Host'].$this->Config['Web']['RootFolder'].'">http://'.
     156        $this->Config['Web']['Host'].$this->Config['Web']['RootFolder']."</a>.<br />\n".
     157        "Pokud jste tak neučinili, měli by jste tento email ignorovat.<br /><br />\n\nVaše nové heslo k účtu ".
     158        $Row['Login']." je: ".$NewPassword."\n<br>Pro aktivaci tohoto hesla klikněte na ".
     159        '<a href="http://'.$this->Config['Web']['Host'].$this->Config['Web']['RootFolder'].
     160        '/?Action=PasswordRecoveryConfirm&User='.$Row['Id'].'&H='.$Row['Password'].'&P='.
     161        $NewPassword.'">tento odkaz</a>.'."\n<br /> Po přihlášení si prosím změňte heslo na nové.\n\n".
     162        "<br><br>Na tento email neodpovídejte.";
    157163      $Mail->RecipientName = $Row['Name'];
    158164      $Mail->RecipientAddress = $Row['Email'];
     
    184190  }
    185191}
    186 
    187 ?>
  • trunk/www/Application/View/Backup.php

    r92 r93  
    2222  function ItemList()
    2323  {
    24     global $Config;
    25    
    2624    $ServerId = $_GET['Id'];
    2725    if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    2826    {
    29       $Server = new Server($this->Database, $_GET['Id']);
     27      $Server = new Server($this->System, $_GET['Id']);
    3028      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    3129      {
     
    6159    else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    6260    {
    63       $Backup = new Backup($this->Database, $_GET['Id']);
    64       $Server = new Server($this->Database, $Backup->Backup['Server']);
     61      $Backup = new Backup($this->System, $_GET['Id']);
     62      $Server = new Server($this->System, $Backup->Backup['Server']);
    6563      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    6664      {
     
    7977    else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    8078    {
    81       $Backup = new Backup($this->Database, $_GET['Id']);
    82       $Server = new Server($this->Database, $Backup->Backup['Server']);
     79      $Backup = new Backup($this->System, $_GET['Id']);
     80      $Server = new Server($this->System, $Backup->Backup['Server']);
    8381      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    8482      {
     
    9593    else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    9694    {
    97       $Server = new Server($this->Database, $_GET['Id']);
     95      $Server = new Server($this->System, $_GET['Id']);
    9896      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    9997      {
    100         $Backup = new Backup($this->Database, 0);
     98        $Backup = new Backup($this->System, 0);
    10199        $Output = $this->SystemMessage('Ruční zálohování', $Backup->Create($Server->Id));
    102100        $Output .= $this->ShowTaskList();
     
    106104  }
    107105}
    108 
    109 ?>
  • trunk/www/Application/View/Client.php

    r92 r93  
    2626  function ItemList()
    2727  {
    28     global $Config;
    29    
    3028    $Output = '<h4>Verze herního klienta</h4>';
    3129    $Table = new Table($this->ItemListFormClass, $this->System);
     
    3634  }
    3735}
    38 
    39 ?>
  • trunk/www/Application/View/Cluster.php

    r81 r93  
    3737  }
    3838}
    39 
    40 ?>
  • trunk/www/Application/View/Database.php

    r78 r93  
    1010    if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    1111    {
    12       $Server = new Server($this->Database, $_GET['Id']);
     12      $Server = new Server($this->System, $_GET['Id']);
    1313      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    1414      {
     
    2121  }
    2222}
    23 
    24 ?>
  • trunk/www/Application/View/Debug.php

    r92 r93  
    3737  function ItemList()
    3838  {
    39     global $Config;
    40    
    4139    if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    4240    {
    43       $Realm = new Realm($this->Database, $_GET['Id']);
     41      $Realm = new Realm($this->System, $_GET['Id']);
    4442      if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    4543      {
     
    6159  function Item()
    6260  {
    63     global $System;
    64 
    6561    if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    6662    {
    67       $Realm = new Realm($this->Database, $_GET['Id']);
     63      $Realm = new Realm($this->System, $_GET['Id']);
    6864      if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    6965      {
    7066        $Output = '<div>Ladící informace serveru</div>';
    7167   
    72     $MangosDebug = new MangosDebug($this->Database, $this->System);
     68    $MangosDebug = new MangosDebug($this->System, $this->System);
    7369    $Form = new Form($this->System, $this->ItemFormClass);
    7470    if($Form->LoadValuesFromDatabase($_GET['Id']))
     
    127123  }
    128124}
    129 
    130 ?>
  • trunk/www/Application/View/Emulator.php

    r92 r93  
    3636  function ItemList()
    3737  {
    38     global $Config;
    39    
    4038    $Output = '<h4>Seznam verzí emulátoru</h4>';
    4139    $Table = new Table($this->ItemListFormClass, $this->System);
     
    5957  {
    6058    $Id = $_GET['Id'];
    61     //$Server = new Server($this->Database, $Id);
     59    //$Server = new Server($this->System, $Id);
    6260    $Output = '<h4>Podrobnosti emulátoru</h4>';
    6361    $Form = new Form($this->System, $this->ItemFormClass);
     
    6563    $Output .= $Form->ShowTable();
    6664    $Output .= '<div style="text-align: center">';
    67     $Emulator = new Emulator($this->Database, $Id);
     65    $Emulator = new Emulator($this->System, $Id);
    6866    if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id))
    6967    {
     
    106104    if(array_key_exists('Id', $_GET))
    107105    {
    108       $Emulator = new Emulator($this->Database, $_GET['Id']);
     106      $Emulator = new Emulator($this->System, $_GET['Id']);
    109107      if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id))
    110108      {
     
    122120    if(array_key_exists('Id', $_GET))
    123121    {
    124       $Emulator = new Emulator($this->Database, $_GET['Id']);
     122      $Emulator = new Emulator($this->System, $_GET['Id']);
    125123      if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id))
    126124      {
     
    134132  }
    135133}
    136 
    137 ?>
  • trunk/www/Application/View/HomePage.php

    r78 r93  
    4747  function State()
    4848  {
    49     $Platform = new Platform($this->Database);
     49    $Platform = new Platform($this->System);
    5050    $State = $Platform->State();
    5151    $Output = '<h4>Stav systému</h4>'.
     
    6464  }
    6565}
    66 
    67 ?>
  • trunk/www/Application/View/News.php

    r78 r93  
    5151  }
    5252}
    53 
    54 ?>
  • trunk/www/Application/View/Page.php

    r78 r93  
    102102  function GetOutput($Content)
    103103  {
    104     global $Config;
    105    
    106104    $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).
    107105      $this->CenterPanel($Content);
    108106    $Output .= $this->ShowFooter();
    109     if($Config['Web']['FormatHTML'] == true) echo($this->FormatOutput($Output));
     107    if($this->Config['Web']['FormatHTML'] == true) echo($this->FormatOutput($Output));
    110108    else echo($Output);
    111109  }
     
    123121  }
    124122}
    125 
    126 ?>
  • trunk/www/Application/View/Realm.php

    r92 r93  
    105105  function ItemList()
    106106  {
    107     global $Config;
    108    
    109107    if(array_key_exists('Id', $_GET)) $ServerId = $_GET['Id'];
    110108   
    111     $Realm = new Realm($this->Database, 0);
     109    $Realm = new Realm($this->System, 0);
    112110    //$Realm->UpdateServerList();
    113111    $Output = '<h4>Seznam světů</h4>';
     
    131129      //$DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm WHERE Server='.$this->System->Modules['User']->User['Id']);
    132130      //$DbRow = $DbResult->fetch_row();
    133       if(($RealmCount < $Config['MaxRealmPerServerCount']))
     131      if(($RealmCount < $this->Config['MaxRealmPerServerCount']))
    134132        $Output .= '<br /><div style="text-align: center;"><a href="?Module=Realm&amp;Action=Add">Vytvořit nový svět</a></dev>';     
    135133    }
     
    139137  function Item()
    140138  {
    141     global $Config;
    142    
    143139    $Id = $_GET['Id'];
    144     $Realm = new Realm($this->Database, $Id);
     140    $Realm = new Realm($this->System, $Id);
    145141    //if(isset($Server->Server))
    146142    //{
     
    179175  function Add()
    180176  {
    181     global $Config;
    182    
    183177    if(array_key_exists('Id', $_GET))
    184178    {
     
    190184      $DbRow = $DbResult->fetch_row();
    191185      $RealmCount = $DbRow[0];
    192       if($RealmCount < $Config['MaxRealmCount'])
    193       {
    194         if($this->System->Modules['User']->RealmCount() >= $Config['MaxServerCountPerUser']) $Output .= $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.$Config['MaxServerCountPerUser'].' světů');
     186      if($RealmCount < $this->Config['MaxRealmCount'])
     187      {
     188        if($this->System->Modules['User']->RealmCount() >= $this->Config['MaxServerCountPerUser'])
     189                $Output .= $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.
     190                        $this->Config['MaxServerCountPerUser'].' světů');
    195191        else
    196192        {
     
    209205  function Create()
    210206  {
    211     global $Config;   
    212      
    213207    if(array_key_exists('Id', $_GET))
    214208    {
     
    216210    if($this->System->Modules['Permission']->Check('Realm', 'Add'))
    217211    {
    218       if($this->System->Modules['User']->RealmCount() >= $Config['MaxServerCountPerUser']) $Output = $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.$Config['MaxServerCountPerUser'].' světů');
     212      if($this->System->Modules['User']->RealmCount() >= $this->Config['MaxServerCountPerUser'])
     213        $Output = $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.
     214        $this->Config['MaxServerCountPerUser'].' světů');
    219215      else
    220216      {
     
    223219        $DbRow = $DbResult->fetch_row();
    224220        $NewPortWorldd = $DbRow[0] + 1;
    225         if($NewPortWorldd < $Config['BaseNetworkPortWorldd']) $NewPortWorldd = $Config['BaseNetworkPortWorldd'];
     221        if($NewPortWorldd < $this->Config['BaseNetworkPortWorldd']) $NewPortWorldd = $this->Config['BaseNetworkPortWorldd'];
    226222           
    227223        $Form = new Form($this->System, $this->CreateFormClass, array());
     
    229225        $this->Database->insert('Realm', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'Server' => $ServerId, 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => $Form->Values['Database'], 'NetworkPortWorldd' => $NewPortWorldd, 'Lock' => 1, 'TimeCreate' => 'NOW()'));
    230226        $LastInsertId = $this->Database->insert_id;
    231         $Realm = new Realm($this->Database, $LastInsertId);
     227        $Realm = new Realm($this->System, $LastInsertId);
    232228        $Realm->CreateDatabase();           
    233229        $Output = $this->System->SystemMessage('Vytvoření světu', $Realm->ImportDatabase(true));
     
    246242  {
    247243    $Output = '';
    248     $Realm = new Realm($this->Database, $_POST['RealmId']);
     244    $Realm = new Realm($this->System, $_POST['RealmId']);
    249245    if($this->System->Modules['Permission']->Check('Realm', 'Save', $Realm->Id))
    250246    {
     
    257253      $Form->OnSubmit = '?Module=Realm&amp;Action=Save';
    258254       
    259       $Realm = new Realm($this->Database, $_POST['RealmId']);
     255      $Realm = new Realm($this->System, $_POST['RealmId']);
    260256      $Realm->SaveConfiguration();
    261257      $Form->Values['RealmId'] = $RealmId;
     
    268264  {
    269265    $Output = '';
    270     $Realm = new Realm($this->Database, $_GET['Id']);
     266    $Realm = new Realm($this->System, $_GET['Id']);
    271267    if($this->System->Modules['Permission']->Check('Realm', 'Edit', $Realm->Id))
    272268    {
     
    283279  {
    284280    $Output = '';
    285     $Realm = new Realm($this->Database, $_GET['Id']);
     281    $Realm = new Realm($this->System, $_GET['Id']);
    286282    if($this->System->Modules['Permission']->Check('Realm', 'EditDetailed', $Realm->Id))
    287283    {
    288284      $Form = new Form($this->System, $this->SettingDetailedFormClass);
    289       $EmulatorConfig = new MangosConfigurationFile($this->Database);
     285      $EmulatorConfig = new MangosConfigurationFile($this->System);
    290286      $EmulatorConfig->Load('../realm/'.$Realm->Id.'/etc/mangosd.conf');
    291287      $Form->Values = array();
     
    302298  {
    303299    $Output = '';
    304     $Realm = new Realm($this->Database, $_POST['RealmId']);
     300    $Realm = new Realm($this->System, $_POST['RealmId']);
    305301    if($this->System->Modules['Permission']->Check('Realm', 'SaveDetailed', $Realm->Id))
    306302    {
    307303      $Form = new Form($this->System, $this->SettingDetailedFormClass, array());
    308304      $Form->LoadValuesFromForm();
    309       $EmulatorConfig = new MangosConfigurationFile($this->Database);
     305      $EmulatorConfig = new MangosConfigurationFile($this->System);
    310306      $EmulatorConfig->Load('../realm/'.$Realm->Id.'/etc/mangosd.conf');
    311307      foreach($Form->Definition['Items'] as $Index => $Item)
     
    322318      $Form->OnSubmit = '?Module=Realm&amp;Action=SaveDetailed';
    323319       
    324       $Realm = new Realm($this->Database, $_POST['RealmId']);
     320      $Realm = new Realm($this->System, $_POST['RealmId']);
    325321      $Realm->SaveConfiguration();
    326322      $Form->Values['RealmId'] = $RealmId;
     
    333329  {
    334330    $Output = '';
    335     $Realm = new Realm($this->Database, $_GET['Id']);
     331    $Realm = new Realm($this->System, $_GET['Id']);
    336332    if($this->System->Modules['Permission']->Check('Realm', 'Start', $Realm->Id))
    337333    {
     
    346342  {
    347343    $Output = '';
    348     $Realm = new Realm($this->Database, $_GET['Id']);
     344    $Realm = new Realm($this->System, $_GET['Id']);
    349345    if($this->System->Modules['Permission']->Check('Realm', 'Stop', $Realm->Id))
    350346    {
     
    358354  function InitDatabase()
    359355  {
    360     global $Config;   
    361      
    362356    if(array_key_exists('Id', $_GET))
    363357    {
    364358      $RealmId = $_GET['Id'];
    365       $Realm = new Realm($this->Database, $RealmId);
     359      $Realm = new Realm($this->System, $RealmId);
    366360      if($this->System->Modules['Permission']->Check('Realm', 'InitDatabase', $Realm->Id))
    367361      {
     
    377371  }
    378372}
    379 
    380 ?>
  • trunk/www/Application/View/Server.php

    r81 r93  
    8484  function ItemList()
    8585  {
    86     global $Config;
    87    
    8886    $Output = '<h4>Seznam serverů</h4>';
    8987    $Table = new Table($this->ItemListFormClass, $this->System);
     
    110108      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
    111109      $DbRow = $DbResult->fetch_row();
    112       if(($ServerCount < $Config['MaxServerCount']) and ($DbRow[0] < $Config['MaxServerCountPerUser']))
     110      if(($ServerCount < $this->Config['MaxServerCount']) and ($DbRow[0] < $this->Config['MaxServerCountPerUser']))
    113111        $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&amp;Action=Add">Vytvořit nový server</a></div>';     
    114112    }
     
    118116  function Item()
    119117  {
    120     global $Config;
    121    
    122118    $Id = $_GET['Id'];
    123     $Server = new Server($this->Database, $Id);
     119    $Server = new Server($this->System, $Id);
    124120    if(isset($Server->Server))
    125121    {
     
    132128    $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => '');   
    133129    $ServerStatus = $Server->GetState();
    134     $Form->Values['Realmlist'] = $Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];
     130    $Form->Values['Realmlist'] = $this->Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];
    135131    unset($Form->Definition['Items']['NetworkPortRealmd']);
    136132    $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time');
     
    167163  function Add()
    168164  {
    169     global $Config;
    170    
    171165    $Output = '';
    172166    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
     
    175169      $DbRow = $DbResult->fetch_row();
    176170      $ServerCount = $DbRow[0];
    177       if($ServerCount < $Config['MaxServerCount'])
     171      if($ServerCount < $this->Config['MaxServerCount'])
    178172      {
    179173        $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
    180174        $DbRow = $DbResult->fetch_row();
    181         if($DbRow[0] >= $Config['MaxServerCountPerUser']) $Output .= $this->System->SystemMessage('Nový server', 'Na jeden účet lze vytvořit maximálně '.$Config['MaxServerCountPerUser'].' serverů');
     175        if($DbRow[0] >= $this->Config['MaxServerCountPerUser'])
     176                $Output .= $this->System->SystemMessage('Nový server', 'Na jeden účet lze vytvořit maximálně '.
     177                  $this->Config['MaxServerCountPerUser'].' serverů');
    182178        else
    183179        {
     
    195191  function Create()
    196192  {
    197     global $Config;
    198    
    199193    $Output = '';
    200194    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
     
    202196      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
    203197      $DbRow = $DbResult->fetch_row();
    204       if($DbRow[0] >= $Config['MaxServerCountPerUser']) $Output .= $this->System->SystemMessage('Nový server', 'Na jeden účet lze vytvořit maximálně '.$Config['MaxServerCountPerUser'].' serverů');
     198      if($DbRow[0] >= $this->Config['MaxServerCountPerUser'])
     199        $Output .= $this->System->SystemMessage('Nový server', 'Na jeden účet lze vytvořit maximálně '.
     200                $this->Config['MaxServerCountPerUser'].' serverů');
    205201      else
    206202      {
     
    208204        $DbRow = $DbResult->fetch_row();
    209205        $NewPortRealmd = $DbRow[0] + 1;
    210         if($NewPortRealmd < $Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];
     206        if($NewPortRealmd < $this->Config['BaseNetworkPortRealmd']) $NewPortRealmd = $this->Config['BaseNetworkPortRealmd'];
    211207           
    212208        $Form = new Form($this->System, $this->CreateFormClass, array());
     
    214210        $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->Data['Id'], 'Homepage' => $Form->Values['Homepage'], 'Database' => $Form->Values['Database'], 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1, 'TimeCreate' => 'NOW()'));
    215211        $LastInsertId = $this->Database->insert_id;
    216         $Server = new Server($this->Database, $LastInsertId);
     212        $Server = new Server($this->System, $LastInsertId);
    217213        $Server->CreateDatabase();           
    218214        $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true));
     
    230226  {
    231227    $Output = '';
    232     $Server = new Server($this->Database, $_POST['ServerId']);
     228    $Server = new Server($this->System, $_POST['ServerId']);
    233229    if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    234230    {
     
    241237      $Form->OnSubmit = '?Action=ServerSave';
    242238       
    243       $Server = new Server($this->Database, $_POST['ServerId']);
     239      $Server = new Server($this->System, $_POST['ServerId']);
    244240      $Server->SaveConfiguration();
    245241      $Form->Values['ServerId'] = $ServerId;
     
    252248  {
    253249    $Output = '';
    254     $Server = new Server($this->Database, $_GET['Id']);
     250    $Server = new Server($this->System, $_GET['Id']);
    255251    if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    256252    {
     
    269265    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
    270266    {
    271       $Server = new Server($this->Database, $_GET['Id']);
     267      $Server = new Server($this->System, $_GET['Id']);
    272268      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    273269      {
     
    285281    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
    286282    {
    287       $Server = new Server($this->Database, $_GET['Id']);
     283      $Server = new Server($this->System, $_GET['Id']);
    288284      if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    289285      {
     
    310306    $Form = new Form($this->System, $this->GameAccountNewFormClass);
    311307    $Form->LoadValuesFromForm();
    312     $Server = new Server($this->Database, $Form->Values['ServerId']);
     308    $Server = new Server($this->System, $Form->Values['ServerId']);
    313309    $Output = $this->System->SystemMessage('Vytvoření herního účtu', $Server->NewAccount($Form->Values['Name'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Expansion']));
    314310    $Output .= '<a href="?Module=Server&amp;Action=GameAccountRegister&amp;Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';
     
    322318      Header('Content-Type: text/plain');
    323319      Header('Content-Disposition: attachment; filename="realmlist.wtf"');
    324       $Server = new Server($this->Database, $_GET['Id']);
     320      $Server = new Server($this->System, $_GET['Id']);
    325321      $Output = array(
    326322        'set realmlist '.$this->Config['Web']['Host'].':'.$Server->Server['NetworkPortRealmd'],
     
    337333    if(array_key_exists('Id', $_GET))
    338334    {
    339       $Server = new Server($this->Database, $_GET['Id'] * 1);
     335      $Server = new Server($this->System, $_GET['Id'] * 1);
    340336      echo($Server->GetPatchList());
    341337    } else echo('Zadané id serveru nenalezeno.');
     
    371367  } 
    372368}
    373 
    374 ?>
  • trunk/www/Application/View/Task.php

    r92 r93  
    2626  function ItemList()
    2727  {
    28     global $Config;
    29    
    3028    $Output = '<h4>Fronta úloh</h4>';
    3129    $Table = new Table($this->ItemListFormClass, $this->System);
    3230    $Table->OnRow = array($this, 'ShowListOnRow');
    33     $Table->Definition['Table'] = '(SELECT Id, (COALESCE(UNIX_TIMESTAMP(TimeEnd), UNIX_TIMESTAMP(NOW())) - UNIX_TIMESTAMP(TimeStart)) AS Duration, TimeCreate, Title, State FROM Task WHERE User='.$this->System->Modules['User']->User['Id'].' ORDER BY Id DESC)';
     31    $Table->Definition['Table'] = '(SELECT Id, (COALESCE(UNIX_TIMESTAMP(TimeEnd), UNIX_TIMESTAMP(NOW())) - UNIX_TIMESTAMP(TimeStart)) AS Duration, TimeCreate, Title, State FROM Task WHERE User='.
     32      $this->System->Modules['User']->User['Id'].' ORDER BY Id DESC)';
    3433    $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => '');
    3534    $Table->LoadValuesFromDatabase($this->Database);
     
    6564  }
    6665}
    67 
    68 ?>
  • trunk/www/Application/View/Update.php

    r92 r93  
    77  function ItemList()
    88  {
    9     global $Config;
    10    
    119    $ServerId = $_GET['Id'];
    1210    if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    1311    {
    14       $Server = new Server($this->Database, $_GET['Id']);
     12      $Server = new Server($this->System, $_GET['Id']);
    1513      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    1614      {
    17         $Server = new Server($this->Database, $ServerId);
     15        $Server = new Server($this->System, $ServerId);
    1816        $Output = '<h4>Seznam dostupných aktulizací</h4>';
    1917        $Output .= 'Před provedením aktualizace bude server zastaven a provedena záloha databáze.';
     
    4139    else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    4240    {
    43       $Server = new Server($this->Database, $_GET['Server']);
     41      $Server = new Server($this->System, $_GET['Server']);
    4442      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    4543      {
     
    5149  }
    5250}
    53 
    54 ?>
  • trunk/www/Application/View/User.php

    r80 r93  
    5353  function Login()
    5454  {
    55     global $Config;
    56    
    5755    $Form = new Form($this->System, $this->LoginFormClass);
    5856    $Form->OnSubmit = '?Module=User&amp;Action=LoginFinish';
    5957    $Output = $Form->ShowEditForm();
    6058    $Output .= '<div class="Centred">';
    61     if($Config['Web']['UserRegistrationEnabled'])
     59    if($this->Config['Web']['UserRegistrationEnabled'])
    6260      $Output .= '<a href="?Module=User&amp;Action=Register">Registrovat se</a> ';
    6361    $Output .= '<a href="?Module=User&amp;Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     
    8583  function RegisterSave()
    8684  {
    87     global $Config;
    88    
    89     if($Config['Web']['UserRegistrationEnabled'])
     85    if($this->Config['Web']['UserRegistrationEnabled'])
    9086    {
    9187      $Form = new Form($this->System, $this->RegisterFormClass, array());
     
    9692      if($Result <> $this->System->Translate('UserRegistrated'))
    9793      {
    98         $Form->OnSubmit = '?Module=User&amp;Action=UserRegisterSave';
     94        $Form->OnSubmit = '?Module=User&amp;Action=RegisterSave';
    9995        $Output = $Form->ShowEditForm();
    10096      }
     
    166162  function Register()
    167163  {
    168     global $Config;
    169    
    170     if($Config['Web']['UserRegistrationEnabled'])
     164    if($this->Config['Web']['UserRegistrationEnabled'])
    171165    {
    172166      $Form = new Form($this->System, $this->RegisterFormClass);
    173167      $Form->LoadValuesFromForm();
    174       $Form->OnSubmit = '?Module=User&amp;Action=UserRegisterSave';
     168      $Form->OnSubmit = '?Module=User&amp;Action=RegisterSave';
    175169      $Output = 'Vyplňte správně požadované údaje. Na zadaný email vám bude zaslán aktivační email.';
    176170      $Output .= $Form->ShowEditForm();
     
    181175  function RegisterConfirm()
    182176  {
    183     global $Config;
    184    
    185     if($Config['Web']['UserRegistrationEnabled'])
     177    if($this->Config['Web']['UserRegistrationEnabled'])
    186178    {
    187179      $Page = new PageView($this->System);
     
    192184  }
    193185}
    194 
    195 ?>
  • trunk/www/Base/Controller.php

    r78 r93  
    1717  }
    1818}
    19 
    20 ?>
  • trunk/www/Base/Database.php

    r92 r93  
    107107  }
    108108}
    109 
    110 ?>
  • trunk/www/Base/Error.php

    r69 r93  
    7373
    7474set_error_handler('CustomErrorHandler');
    75 
    76 ?>
  • trunk/www/Base/Form.php

    r78 r93  
    1313  function __construct($System, $FormClass)
    1414  { 
     15        parent::__construct($System);
    1516    $this->Definition = $FormClass;
    1617    foreach($this->Definition['Items'] as $Index => $Item)
     
    1819      $this->Values[$Index] = '';
    1920    }   
    20     $this->System = $System;
    21     $this->Database = $System->Database;
    22     $this->Config = $System->Config;
    2321  }
    2422
     
    4341      {
    4442        if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default'];
    45         $Edit = ExecuteTypeEvent($Item['Type'], 'OnView',
     43        $Edit = ExecuteTypeEvent($this->System, $Item['Type'], 'OnView',
    4644          array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
    4745        array_push($Table['Rows'], array($Item['Caption'], $Edit));
     
    7472      {
    7573        if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default'];
    76         $Edit = ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
     74        $Edit = ExecuteTypeEvent($this->System, $Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
    7775        array_push($Table['Rows'], array($Item['Caption'].':', $Edit));
    7876      }
     
    8280    '</fieldset>';
    8381    foreach($this->Definition['Items'] as $Index => $Item)
    84       if($Item['Type'] == 'Hidden') $Output .= ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
     82      if($Item['Type'] == 'Hidden') $Output .= ExecuteTypeEvent($this->System, $Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type']));
    8583    return($Output);
    8684  }
     
    123121    {
    124122      if(array_key_exists($Context.$Index, $_POST))
    125       $Values[$Index] = ExecuteTypeEvent($Item['Type'], 'OnLoad',
     123      $Values[$Index] = ExecuteTypeEvent($this->System, $Item['Type'], 'OnLoad',
    126124        array('Name' => $Index, 'Type' => $Item['Type']));
    127125    }
     
    129127  }
    130128}
    131 
    132 ?>
  • trunk/www/Base/Global.php

    r78 r93  
    8484  return($out);
    8585}
    86 
    87 ?>
  • trunk/www/Base/Html.php

    r71 r93  
    125125  }
    126126}
    127 
    128 ?>
  • trunk/www/Base/Mail.php

    r78 r93  
    1717    $this->AdditionalHeaders['MIME-Version'] = '1.0';
    1818    $this->AdditionalHeaders['Content-type'] = 'text/html; charset=UTF-8';
     19    $Headers = '';
    1920    foreach($this->AdditionalHeaders as $Index => $Item)
    2021    {
     
    2223    }
    2324    $Subject = $this->EncodeBase64($this->Subject);
    24     return(mail($this->Address, $Subject, $this->Content, $Headers));
     25    return(mail($this->RecipientAddress, $Subject, $this->Content, $Headers));
    2526  }
    2627
     
    3031  }
    3132}
    32 
    33 ?>
  • trunk/www/Base/Model.php

    r78 r93  
    66{
    77}
    8 
    9 ?>
  • trunk/www/Base/Module.php

    r78 r93  
    1414  }
    1515}
    16 
    17 ?>
  • trunk/www/Base/System.php

    r92 r93  
    228228  } 
    229229}
    230 
    231 ?>
  • trunk/www/Base/Table.php

    r92 r93  
    9797      foreach($this->Definition['Items'] as $Index => $Item)
    9898      {
    99         $DbRow[$Index] = ExecuteTypeEvent($Item['Type'], 'OnView',
     99        $DbRow[$Index] = ExecuteTypeEvent($this->System, $Item['Type'], 'OnView',
    100100          array('Name' => $Index, 'Value' => $DbRow[$Index], 'Type' => $Item['Type']));
    101101        $Row[$Index] = $DbRow[$Index];
     
    105105  }
    106106}
    107 
    108 ?>
  • trunk/www/Base/Types/Base.php

    r78 r93  
    2727  }
    2828}
    29 
    30 ?>
  • trunk/www/Base/Types/Boolean.php

    r69 r93  
    2323  }
    2424}
    25 
    26 ?>
  • trunk/www/Base/Types/Date.php

    r69 r93  
    5858  }
    5959}
    60 
    61 ?>
  • trunk/www/Base/Types/DateTime.php

    r69 r93  
    9090  }
    9191}
    92 
    93 ?>
  • trunk/www/Base/Types/Enumeration.php

    r69 r93  
    2828  }
    2929}
    30 
    31 ?>
  • trunk/www/Base/Types/File/File.php

    r69 r93  
    4343  }
    4444}
    45 
    46 ?>
  • trunk/www/Base/Types/File/FileDownload.php

    r69 r93  
    2020  echo(file_get_contents($Config['UploadFileFolder'].'/'.$DbRow['Id']));
    2121} else echo('Soubor nenalezen!');
    22 
    23 ?>
  • trunk/www/Base/Types/Float.php

    r69 r93  
    2222  }
    2323}
    24 
    25 ?>
  • trunk/www/Base/Types/GPS.php

    r69 r93  
    6868  }
    6969}
    70 
    71 ?>
  • trunk/www/Base/Types/Hidden.php

    r69 r93  
    2020  }
    2121}
    22 
    23 ?>
  • trunk/www/Base/Types/Hyperlink.php

    r69 r93  
    2020  }
    2121}
    22 
    23 ?>
  • trunk/www/Base/Types/IPv4Address.php

    r69 r93  
    2020  }
    2121}
    22 
    23 ?>
  • trunk/www/Base/Types/Integer.php

    r69 r93  
    2222  }
    2323}
    24 
    25 ?>
  • trunk/www/Base/Types/Password.php

    r69 r93  
    4040  }
    4141}
    42 
    43 ?>
  • trunk/www/Base/Types/PointerOneToMany.php

    r69 r93  
    2020  }
    2121}
    22 
    23 ?>
  • trunk/www/Base/Types/PointerOneToOne.php

    r71 r93  
    4545  }
    4646}
    47 
    48 ?>
  • trunk/www/Base/Types/String.php

    r69 r93  
    2727  }
    2828}
    29 
    30 ?>
  • trunk/www/Base/Types/Text.php

    r69 r93  
    2727  }
    2828}
    29 
    30 ?>
  • trunk/www/Base/Types/Time.php

    r69 r93  
    5454  }
    5555}
    56 
    57 ?>
  • trunk/www/Base/Types/Type.php

    r78 r93  
    4040);
    4141
    42 function ExecuteTypeEvent($TypeName, $Event, $Parameters = array())
     42function ExecuteTypeEvent($System, $TypeName, $Event, $Parameters = array())
    4343{
    44   global $TypeDefinitionList, $System;
     44  global $TypeDefinitionList;
    4545 
    4646  if(array_key_exists($TypeName, $TypeDefinitionList))
     
    7474  return($TypeDefinitionList[$TypeName]);
    7575}
    76 
    77 ?>
  • trunk/www/Base/UTF8.php

    r75 r93  
    563563  return($Result);
    564564}
    565 
    566 ?>
  • trunk/www/Base/View.php

    r78 r93  
    66{
    77}
    8 
    9 ?>
  • trunk/www/Include.php

    r78 r93  
    44include('Base/Include.php');
    55include('Application/Include.php');
    6 
    7 ?>
  • trunk/www/index.php

    r78 r93  
    22
    33include_once(dirname(__FILE__).'/Application/Application.php');
    4 
    5 ?>
Note: See TracChangeset for help on using the changeset viewer.