Changeset 93
- Timestamp:
- Aug 15, 2013, 11:17:26 PM (11 years ago)
- Location:
- trunk/www
- Files:
-
- 82 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/Application/Application.php
r78 r93 37 37 $Application = new Application(); 38 38 $Application->Run(); 39 40 ?> -
trunk/www/Application/Config/ConfigSample.php
r76 r93 45 45 'BackupCountPerServer' => 20, 46 46 ); 47 48 ?> -
trunk/www/Application/Controller/Backup.php
r80 r93 35 35 } 36 36 } 37 38 ?> -
trunk/www/Application/Controller/Client.php
r80 r93 14 14 } 15 15 } 16 17 ?> -
trunk/www/Application/Controller/Cluster.php
r80 r93 57 57 } 58 58 } 59 60 ?> -
trunk/www/Application/Controller/Debug.php
r80 r93 21 21 } 22 22 } 23 24 ?> -
trunk/www/Application/Controller/Emulator.php
r80 r93 49 49 } 50 50 } 51 52 ?> -
trunk/www/Application/Controller/HomePage.php
r78 r93 37 37 } 38 38 } 39 40 ?> -
trunk/www/Application/Controller/News.php
r80 r93 21 21 } 22 22 } 23 24 ?> -
trunk/www/Application/Controller/Realm.php
r80 r93 91 91 } 92 92 } 93 94 ?> -
trunk/www/Application/Controller/Server.php
r80 r93 104 104 function UnLock() 105 105 { 106 $Model = new Server($this-> Database, $_GET['Id']);106 $Model = new Server($this->System, $_GET['Id']); 107 107 $Model->UnLock(); 108 108 } … … 110 110 function Lock() 111 111 { 112 $Model = new Server($this-> Database, $_GET['Id']);112 $Model = new Server($this->System, $_GET['Id']); 113 113 $Model->Lock(); 114 114 } 115 115 } 116 117 ?> -
trunk/www/Application/Controller/Task.php
r80 r93 37 37 } 38 38 } 39 40 ?> -
trunk/www/Application/Controller/Update.php
r80 r93 21 21 } 22 22 } 23 24 ?> -
trunk/www/Application/Controller/User.php
r78 r93 84 84 } 85 85 } 86 87 ?> -
trunk/www/Application/Localization/cz.php
r76 r93 29 29 'AccessDenied' => 'K provedení požadované akce nemáte dostatečné oprávnění', 30 30 ); 31 32 ?> -
trunk/www/Application/Model/Backup.php
r80 r93 8 8 var $Task; 9 9 10 function __construct($ Database, $Id)10 function __construct($System, $Id) 11 11 { 12 $this->Database = $Database;13 $this->Task = new Task($ Database);12 parent::__construct($System); 13 $this->Task = new Task($System); 14 14 $this->Id = $Id; 15 15 $DbResult = $this->Database->query('SELECT * FROM `Backup` WHERE `Id`='.$Id); … … 42 42 function Create($ServerId) 43 43 { 44 $Server = new Server($this-> Database, $ServerId);44 $Server = new Server($this->System, $ServerId); 45 45 $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']; 46 46 $this->Database->insert('Backup', array('Server' => $ServerId, 'Time' => 'NOW()', 'Description' => $Description, 'Lock' => 1, 'Database' => $Server->Server['Database']['Id'])); … … 73 73 } 74 74 } 75 76 ?> -
trunk/www/Application/Model/Cluster.php
r78 r93 7 7 function __construct($System, $Id) 8 8 { 9 $this->System = $System; 10 $this->Config = $System->Config; 11 $this->Database = $System->Database; 9 parent::__construct($System); 12 10 13 11 $DbResult = $this->Database->query('SELECT * FROM `ClusterNode` WHERE `Id`='.$Id); … … 31 29 } 32 30 } 33 34 ?> -
trunk/www/Application/Model/ClusterList.php
r78 r93 13 13 } 14 14 } 15 16 ?> -
trunk/www/Application/Model/Emulator.php
r78 r93 9 9 var $Task; 10 10 11 function __construct($ Database, $Id)11 function __construct($System, $Id) 12 12 { 13 $this->Database = $Database;14 $this->Task = new Task($ Database);13 parent::__construct($System); 14 $this->Task = new Task($System); 15 15 $this->Id = $Id; 16 16 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$Id); … … 35 35 function Download() 36 36 { 37 global $Config;38 39 37 $this->Lock(); 40 38 $this->Task->Add('Stažení emulátoru', array( 41 39 '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.'/', 44 42 'git clone git://github.com/mangos/mangos.git source', 45 43 'cd source', … … 55 53 function Compile() 56 54 { 57 global $Config;58 59 55 $this->Lock(); 60 56 $this->Task->Add('Překlad emulátoru', array( 61 57 'php www/shell.php EmulatorLock '.$this->Id, 62 'cd '.$ Config['BaseDir'].'emulator/'.$this->Id.'/source',58 'cd '.$this->Config['BaseDir'].'emulator/'.$this->Id.'/source', 63 59 'autoreconf -ifv', 64 60 'mkdir objdir', 65 61 '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', 69 65 'make', 70 66 'make install', … … 99 95 } 100 96 } 101 102 ?> -
trunk/www/Application/Model/History.php
r78 r93 11 11 var $Resolution = 1000; 12 12 13 function __construct($ Database, $ServerId, $MeasureId)13 function __construct($System, $ServerId, $MeasureId) 14 14 { 15 $this->Database = $Database;15 parent::__construct($System); 16 16 $this->ServerId = $ServerId; 17 17 $this->MeasureId = $MeasureId; … … 59 59 } 60 60 } 61 62 ?> -
trunk/www/Application/Model/MangosConfigurationFile.php
r78 r93 7 7 var $ParameterList; 8 8 9 function __construct($ Database)9 function __construct($System) 10 10 { 11 $this->Database = $Database;11 parent::__construct($System); 12 12 $this->Parameters = array(); 13 13 } … … 41 41 } 42 42 } 43 44 ?> -
trunk/www/Application/Model/MangosDebug.php
r78 r93 8 8 var $MaxMangosThreadCount = 12; 9 9 10 function __construct($ Database)10 function __construct($System) 11 11 { 12 $this->Database = $Database;12 parent::__construct($System); 13 13 } 14 14 15 15 function ProcessLog($RealmId) 16 16 { 17 global $Config;18 19 17 $Output = ''; 20 18 // Read server Id from first parameter 21 $Realm = new Realm($this-> Database, $RealmId);19 $Realm = new Realm($this->System, $RealmId); 22 20 23 21 $LogDir = '../realm/'.$RealmId.'/log/'; … … 104 102 } 105 103 } 106 107 ?> -
trunk/www/Application/Model/Permission.php
r78 r93 46 46 } 47 47 } 48 49 ?> -
trunk/www/Application/Model/Platform.php
r78 r93 7 7 var $Id; 8 8 9 function __construct($ Database)9 function __construct($System) 10 10 { 11 $this->Database = $Database;11 parent::__construct($System); 12 12 } 13 13 … … 46 46 function State() 47 47 { 48 global $Config;49 50 48 $State = array(); 51 49 $State['MemoryUsed'] = $this->MemoryUsage(); … … 76 74 $DbRow = $DbResult->fetch_row(); 77 75 $State['TaskQueued'] = $DbRow[0]; 78 $State['ServerMaxCount'] = $ Config['MaxServerCount'];76 $State['ServerMaxCount'] = $this->Config['MaxServerCount']; 79 77 return($State); 80 78 } 81 79 } 82 83 ?> -
trunk/www/Application/Model/Realm.php
r78 r93 9 9 var $Task; 10 10 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); 15 15 $this->Id = $Id; 16 16 $DbResult = $this->Database->query('SELECT * FROM `Realm` WHERE `Id`='.$Id); … … 31 31 32 32 function GetState() 33 { 34 global $System; 35 33 { 36 34 $State = array(); 37 $State['WorlddPortState'] = $ System->NetworkPortState('localhost', $this->Data['NetworkPortWorldd']);35 $State['WorlddPortState'] = $this->System->NetworkPortState('localhost', $this->Data['NetworkPortWorldd']); 38 36 $State['Online'] = $State['WorlddPortState']; 39 37 $State['Uptime'] = $this->Uptime(); … … 140 138 function UpdateRealmlist() 141 139 { 142 $Server = new Server($this-> Database, $this->Data['Server']);140 $Server = new Server($this->System, $this->Data['Server']); 143 141 $Server->UpdateRealmList(); 144 142 } … … 153 151 function UpdateScripts() 154 152 { 155 global $Config;156 157 153 $RealmBinDir = '../realm/'.$this->Id.'/bin/'; 158 154 if(!file_exists($RealmBinDir)) mkdir($RealmBinDir, 0777, true); … … 165 161 'info thread', 166 162 ); 167 for($I = 1; $I < $ Config['MangosWorlddThreadCountMax']; $I++)163 for($I = 1; $I < $this->Config['MangosWorlddThreadCountMax']; $I++) 168 164 $Content[] = 'thread apply '.$I.' bt full'; 169 165 file_put_contents($ScriptFileName, implode("\n", $Content)); … … 209 205 function SetupConfigurationFiles() 210 206 { 211 global $Config;212 213 207 $EmulatorEtcDir = '../emulator/'.$this->Data['Database']['Emulator']['Id'].'/etc/'; 214 208 $RealmEtcDir = '../realm/'.$this->Id.'/etc/'; … … 220 214 if(!file_exists($RealmEtcDir.'mangosd.conf')) 221 215 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); 223 217 $EmulatorConfig->Load($RealmEtcDir.'mangosd.conf'); 224 218 $EmulatorConfig->ParameterList['RealmID'] = $this->Data['Id']; … … 235 229 236 230 // scriptdev2.conf 237 $EmulatorConfig = new MangosConfigurationFile($this-> Database);231 $EmulatorConfig = new MangosConfigurationFile($this->System); 238 232 $EmulatorConfig->Load($EmulatorEtcDir.'scriptdev2.conf'); 239 233 $EmulatorConfig->ParameterList['ScriptDev2DatabaseInfo'] = 'localhost;3306;server'.$this->Data['Server'].';server'.$this->Data['Server'].';realm'.$this->Id.'_scriptdev2'; … … 255 249 if($DoBackup) 256 250 { 257 $Backup = new Backup($this-> Database, 0);251 $Backup = new Backup($this->System, 0); 258 252 $Output .= '<br />'.$Backup->Create($this->Id); 259 253 } … … 364 358 while($DbRow = $DbResult->fetch_assoc()) 365 359 { 366 $Realm = new Realm($this-> Database, $DbRow['Id']);360 $Realm = new Realm($this->System, $DbRow['Id']); 367 361 $Realm->UpdateState(); 368 362 } … … 380 374 } 381 375 } 382 383 ?> -
trunk/www/Application/Model/RealmList.php
r78 r93 12 12 while($DbRow = $DbResult->fetch_assoc()) 13 13 { 14 $Server = new Server($this-> Database, $DbRow['Id']);14 $Server = new Server($this->System, $DbRow['Id']); 15 15 $Total += $Server->RealmCount(); 16 16 } … … 18 18 } 19 19 } 20 21 ?> -
trunk/www/Application/Model/RemoteConsole.php
r79 r93 49 49 } 50 50 } 51 52 ?> -
trunk/www/Application/Model/Server.php
r78 r93 9 9 var $Task; 10 10 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); 15 15 $this->Id = $Id; 16 16 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); … … 68 68 function GetState() 69 69 { 70 global $System;71 72 70 $State = array(); 73 $State['RealmdPortState'] = $ System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);71 $State['RealmdPortState'] = $this->System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']); 74 72 $State['Online'] = $State['RealmdPortState']; 75 73 $DbResult = $this->Database->query('SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = "server'.$this->Id.'_realmd"'); … … 97 95 function UpdateRealmlist() 98 96 { 99 global $Config;100 101 97 $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmlist'); 102 98 $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id); 103 99 while($Realm = $DbResult->fetch_assoc()) 104 100 { 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)); 106 105 } 107 106 } … … 116 115 function UpdateScripts() 117 116 { 118 global $Config;119 120 117 $ServerBinDir = '../server/'.$this->Id.'/bin/'; 121 118 if(!file_exists($ServerBinDir)) mkdir($ServerBinDir, 0777, true); … … 147 144 function SetupConfigurationFiles() 148 145 { 149 global $Config;150 151 146 $EmulatorEtcDir = '../emulator/'.$this->Server['Database']['Emulator']['Id'].'/etc/'; 152 147 $ServerEtcDir = '../server/'.$this->Id.'/etc/'; … … 156 151 157 152 // realmd.conf 158 $EmulatorConfig = new MangosConfigurationFile($this-> Database);153 $EmulatorConfig = new MangosConfigurationFile($this->System); 159 154 $EmulatorConfig->Load($EmulatorEtcDir.'realmd.conf.dist'); 160 155 $EmulatorConfig->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_realmd'; … … 178 173 while($DbRow = $DbResult->fetch_assoc()) 179 174 { 180 $Server = new Server($this-> Database, $DbRow['Id']);175 $Server = new Server($this->System, $DbRow['Id']); 181 176 $Server->UpdateState(); 182 177 } … … 249 244 if($DoBackup) 250 245 { 251 $Backup = new Backup($this-> Database, 0);246 $Backup = new Backup($this->System, 0); 252 247 $Output .= '<br />'.$Backup->Create($this->Id); 253 248 } … … 308 303 while($DbRow = $DbResult->fetch_assoc()) 309 304 { 310 $Realm = new Realm($this-> Database, $DbRow['Id']);305 $Realm = new Realm($this->System, $DbRow['Id']); 311 306 $UsedMemory += $Realm->GetUsedMemory(); 312 307 } … … 335 330 function UpdateRealmlistAccountCount() 336 331 { 337 global $Config;338 339 332 $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmcharacters'); 340 333 $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id); … … 345 338 } 346 339 } 347 348 ?> -
trunk/www/Application/Model/ServerList.php
r78 r93 13 13 14 14 } 15 16 ?> -
trunk/www/Application/Model/Shell.php
r78 r93 7 7 var $Database; 8 8 9 function __construct($ Database)9 function __construct($System) 10 10 { 11 $this->Database = $Database;11 parent::__construct($System); 12 12 } 13 13 … … 17 17 while($Server = $DbResult->fetch_assoc()) 18 18 { 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']); 21 21 $History->AddValue($Server->GetUsedMemory()); 22 22 } 23 23 } 24 24 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 25 47 if($Command == 'ServerUnLock') 26 48 { 27 49 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 28 50 { 29 $Server = new Server($this-> Database, $_SERVER['argv'][2]);51 $Server = new Server($this->System, $_SERVER['argv'][2]); 30 52 $Server->UnLock(); 31 53 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; … … 35 57 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 36 58 { 37 $Realm = new Realm($this-> Database, $_SERVER['argv'][2]);59 $Realm = new Realm($this->System, $_SERVER['argv'][2]); 38 60 $Realm->Lock(); 39 61 } else $Output = 'Jako druhý parameter je nutno zadat Id světa.'; … … 43 65 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 44 66 { 45 $Realm = new Realm($this-> Database, $_SERVER['argv'][2]);67 $Realm = new Realm($this->System, $_SERVER['argv'][2]); 46 68 $Realm->UnLock(); 47 69 } else $Output = 'Jako druhý parameter je nutno zadat Id světa.'; … … 51 73 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 52 74 { 53 $Emulator = new Emulator($this-> Database, $_SERVER['argv'][2]);75 $Emulator = new Emulator($this->System, $_SERVER['argv'][2]); 54 76 $Emulator->Lock(); 55 77 } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.'; … … 59 81 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 60 82 { 61 $Emulator = new Emulator($this-> Database, $_SERVER['argv'][2]);83 $Emulator = new Emulator($this->System, $_SERVER['argv'][2]); 62 84 $Emulator->UnLock(); 63 85 } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.'; … … 67 89 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 68 90 { 69 $Backup = new Backup($this-> Database, $_SERVER['argv'][2]);91 $Backup = new Backup($this->System, $_SERVER['argv'][2]); 70 92 $Backup->Lock(); 71 93 } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.'; … … 75 97 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 76 98 { 77 $Backup = new Backup($this-> Database, $_SERVER['argv'][2]);99 $Backup = new Backup($this->System, $_SERVER['argv'][2]); 78 100 $Backup->UnLock(); 79 101 } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.'; … … 81 103 if($Command == 'TaskProcess') 82 104 { 83 $Task = new Task($this-> Database);105 $Task = new Task($this->System); 84 106 $Task->ProcessAllCycle(); 85 107 } else … … 90 112 while($DbRow = $DbResult->fetch_assoc()) 91 113 { 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']; 94 116 $Server->Start(); 95 117 } … … 98 120 while($DbRow = $DbResult->fetch_assoc()) 99 121 { 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']; 102 124 $Realm->Start(); 103 125 } … … 106 128 { 107 129 // Servers 108 $Backup = new Backup($this-> Database, 0);130 $Backup = new Backup($this->System, 0); 109 131 $DbResult = $this->Database->select('Server', 'Id, User'); 110 132 while($DbRow = $DbResult->fetch_assoc()) 111 133 { 112 $ System->Modules['User']->User['Id'] = $DbRow['User'];134 $this->System->Modules['User']->User['Id'] = $DbRow['User']; 113 135 $Backup->Create($DbRow['Id']); 114 136 } … … 118 140 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 119 141 { 120 $Server = new Server($this-> Database, $_SERVER['argv'][2]);142 $Server = new Server($this->System, $_SERVER['argv'][2]); 121 143 $Server->ProcessLog(); 122 144 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; … … 128 150 if($Command == 'UpdateState') 129 151 { 130 $Realm = new Realm($this-> Database, 0);152 $Realm = new Realm($this->System, 0); 131 153 $Realm->UpdateStateAll(); 132 $Server = new Server($this-> Database, 0);154 $Server = new Server($this->System, 0); 133 155 $Server->UpdateStateAll(); 134 156 } else … … 137 159 if((count($_SERVER['argv']) > 3) and is_numeric($_SERVER['argv'][2]) and is_numeric($_SERVER['argv'][3])) 138 160 { 139 $Server = new Server($this-> Database, $_SERVER['argv'][2]);161 $Server = new Server($this->System, $_SERVER['argv'][2]); 140 162 $Server->ChangeDatabaseId($_SERVER['argv'][3]); 141 163 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru, jako třetí Id databáze.'; … … 145 167 if((count($_SERVER['argv']) > 3) and is_numeric($_SERVER['argv'][2]) and is_numeric($_SERVER['argv'][3])) 146 168 { 147 $Realm = new Realm($this-> Database, $_SERVER['argv'][2]);169 $Realm = new Realm($this->System, $_SERVER['argv'][2]); 148 170 $Realm->ChangeDatabaseId($_SERVER['argv'][3]); 149 171 } else $Output = 'Jako druhý parameter je nutno zadat Id světa, jako třetí Id databáze.'; … … 154 176 } 155 177 } 156 157 ?> -
trunk/www/Application/Model/TableRelations.php
r69 r93 63 63 64 64 ); 65 66 ?> -
trunk/www/Application/Model/Task.php
r78 r93 7 7 var $TempScript = 'temp/wowhosting_script.sh'; 8 8 9 function __construct($ Database)9 function __construct($System) 10 10 { 11 $this->Database = $Database;11 parent::__construct($System); 12 12 } 13 13 14 14 function Add($Title, $Task) 15 15 { 16 global $System;17 18 16 $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)); 20 18 } 21 19 22 20 function ProcessAll() 23 21 { 24 global $Config; 25 26 chdir($Config['BaseDir']); 22 chdir($this->Config['BaseDir']); 27 23 $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,TimeCreate ASC'); 28 24 while($Task = $DbResult->fetch_assoc()) … … 59 55 } 60 56 } 61 62 ?> -
trunk/www/Application/Model/User.php
r80 r93 57 57 function Register($Login, $Password, $Password2, $Email, $Name) 58 58 { 59 global $Options, $Config;60 61 59 if(($Email == '') || ($Login == '') || ($Password == '') || ($Password2 == '') || ($Name == '')) $Result = $this->System->Translate('MissingData'); 62 60 else if($Password != $Password2) $Result = $this->System->Translate('PasswordsUnmatched'); … … 154 152 $Mail = new Mail(); 155 153 $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."; 157 163 $Mail->RecipientName = $Row['Name']; 158 164 $Mail->RecipientAddress = $Row['Email']; … … 184 190 } 185 191 } 186 187 ?> -
trunk/www/Application/View/Backup.php
r92 r93 22 22 function ItemList() 23 23 { 24 global $Config;25 26 24 $ServerId = $_GET['Id']; 27 25 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 28 26 { 29 $Server = new Server($this-> Database, $_GET['Id']);27 $Server = new Server($this->System, $_GET['Id']); 30 28 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 31 29 { … … 61 59 else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 62 60 { 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']); 65 63 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 66 64 { … … 79 77 else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 80 78 { 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']); 83 81 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 84 82 { … … 95 93 else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 96 94 { 97 $Server = new Server($this-> Database, $_GET['Id']);95 $Server = new Server($this->System, $_GET['Id']); 98 96 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 99 97 { 100 $Backup = new Backup($this-> Database, 0);98 $Backup = new Backup($this->System, 0); 101 99 $Output = $this->SystemMessage('Ruční zálohování', $Backup->Create($Server->Id)); 102 100 $Output .= $this->ShowTaskList(); … … 106 104 } 107 105 } 108 109 ?> -
trunk/www/Application/View/Client.php
r92 r93 26 26 function ItemList() 27 27 { 28 global $Config;29 30 28 $Output = '<h4>Verze herního klienta</h4>'; 31 29 $Table = new Table($this->ItemListFormClass, $this->System); … … 36 34 } 37 35 } 38 39 ?> -
trunk/www/Application/View/Cluster.php
r81 r93 37 37 } 38 38 } 39 40 ?> -
trunk/www/Application/View/Database.php
r78 r93 10 10 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 11 11 { 12 $Server = new Server($this-> Database, $_GET['Id']);12 $Server = new Server($this->System, $_GET['Id']); 13 13 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 14 14 { … … 21 21 } 22 22 } 23 24 ?> -
trunk/www/Application/View/Debug.php
r92 r93 37 37 function ItemList() 38 38 { 39 global $Config;40 41 39 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 42 40 { 43 $Realm = new Realm($this-> Database, $_GET['Id']);41 $Realm = new Realm($this->System, $_GET['Id']); 44 42 if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 45 43 { … … 61 59 function Item() 62 60 { 63 global $System;64 65 61 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 66 62 { 67 $Realm = new Realm($this-> Database, $_GET['Id']);63 $Realm = new Realm($this->System, $_GET['Id']); 68 64 if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 69 65 { 70 66 $Output = '<div>Ladící informace serveru</div>'; 71 67 72 $MangosDebug = new MangosDebug($this-> Database, $this->System);68 $MangosDebug = new MangosDebug($this->System, $this->System); 73 69 $Form = new Form($this->System, $this->ItemFormClass); 74 70 if($Form->LoadValuesFromDatabase($_GET['Id'])) … … 127 123 } 128 124 } 129 130 ?> -
trunk/www/Application/View/Emulator.php
r92 r93 36 36 function ItemList() 37 37 { 38 global $Config;39 40 38 $Output = '<h4>Seznam verzí emulátoru</h4>'; 41 39 $Table = new Table($this->ItemListFormClass, $this->System); … … 59 57 { 60 58 $Id = $_GET['Id']; 61 //$Server = new Server($this-> Database, $Id);59 //$Server = new Server($this->System, $Id); 62 60 $Output = '<h4>Podrobnosti emulátoru</h4>'; 63 61 $Form = new Form($this->System, $this->ItemFormClass); … … 65 63 $Output .= $Form->ShowTable(); 66 64 $Output .= '<div style="text-align: center">'; 67 $Emulator = new Emulator($this-> Database, $Id);65 $Emulator = new Emulator($this->System, $Id); 68 66 if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id)) 69 67 { … … 106 104 if(array_key_exists('Id', $_GET)) 107 105 { 108 $Emulator = new Emulator($this-> Database, $_GET['Id']);106 $Emulator = new Emulator($this->System, $_GET['Id']); 109 107 if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id)) 110 108 { … … 122 120 if(array_key_exists('Id', $_GET)) 123 121 { 124 $Emulator = new Emulator($this-> Database, $_GET['Id']);122 $Emulator = new Emulator($this->System, $_GET['Id']); 125 123 if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id)) 126 124 { … … 134 132 } 135 133 } 136 137 ?> -
trunk/www/Application/View/HomePage.php
r78 r93 47 47 function State() 48 48 { 49 $Platform = new Platform($this-> Database);49 $Platform = new Platform($this->System); 50 50 $State = $Platform->State(); 51 51 $Output = '<h4>Stav systému</h4>'. … … 64 64 } 65 65 } 66 67 ?> -
trunk/www/Application/View/News.php
r78 r93 51 51 } 52 52 } 53 54 ?> -
trunk/www/Application/View/Page.php
r78 r93 102 102 function GetOutput($Content) 103 103 { 104 global $Config;105 106 104 $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle). 107 105 $this->CenterPanel($Content); 108 106 $Output .= $this->ShowFooter(); 109 if($ Config['Web']['FormatHTML'] == true) echo($this->FormatOutput($Output));107 if($this->Config['Web']['FormatHTML'] == true) echo($this->FormatOutput($Output)); 110 108 else echo($Output); 111 109 } … … 123 121 } 124 122 } 125 126 ?> -
trunk/www/Application/View/Realm.php
r92 r93 105 105 function ItemList() 106 106 { 107 global $Config;108 109 107 if(array_key_exists('Id', $_GET)) $ServerId = $_GET['Id']; 110 108 111 $Realm = new Realm($this-> Database, 0);109 $Realm = new Realm($this->System, 0); 112 110 //$Realm->UpdateServerList(); 113 111 $Output = '<h4>Seznam světů</h4>'; … … 131 129 //$DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm WHERE Server='.$this->System->Modules['User']->User['Id']); 132 130 //$DbRow = $DbResult->fetch_row(); 133 if(($RealmCount < $ Config['MaxRealmPerServerCount']))131 if(($RealmCount < $this->Config['MaxRealmPerServerCount'])) 134 132 $Output .= '<br /><div style="text-align: center;"><a href="?Module=Realm&Action=Add">Vytvořit nový svět</a></dev>'; 135 133 } … … 139 137 function Item() 140 138 { 141 global $Config;142 143 139 $Id = $_GET['Id']; 144 $Realm = new Realm($this-> Database, $Id);140 $Realm = new Realm($this->System, $Id); 145 141 //if(isset($Server->Server)) 146 142 //{ … … 179 175 function Add() 180 176 { 181 global $Config;182 183 177 if(array_key_exists('Id', $_GET)) 184 178 { … … 190 184 $DbRow = $DbResult->fetch_row(); 191 185 $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ů'); 195 191 else 196 192 { … … 209 205 function Create() 210 206 { 211 global $Config;212 213 207 if(array_key_exists('Id', $_GET)) 214 208 { … … 216 210 if($this->System->Modules['Permission']->Check('Realm', 'Add')) 217 211 { 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ů'); 219 215 else 220 216 { … … 223 219 $DbRow = $DbResult->fetch_row(); 224 220 $NewPortWorldd = $DbRow[0] + 1; 225 if($NewPortWorldd < $ Config['BaseNetworkPortWorldd']) $NewPortWorldd = $Config['BaseNetworkPortWorldd'];221 if($NewPortWorldd < $this->Config['BaseNetworkPortWorldd']) $NewPortWorldd = $this->Config['BaseNetworkPortWorldd']; 226 222 227 223 $Form = new Form($this->System, $this->CreateFormClass, array()); … … 229 225 $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()')); 230 226 $LastInsertId = $this->Database->insert_id; 231 $Realm = new Realm($this-> Database, $LastInsertId);227 $Realm = new Realm($this->System, $LastInsertId); 232 228 $Realm->CreateDatabase(); 233 229 $Output = $this->System->SystemMessage('Vytvoření světu', $Realm->ImportDatabase(true)); … … 246 242 { 247 243 $Output = ''; 248 $Realm = new Realm($this-> Database, $_POST['RealmId']);244 $Realm = new Realm($this->System, $_POST['RealmId']); 249 245 if($this->System->Modules['Permission']->Check('Realm', 'Save', $Realm->Id)) 250 246 { … … 257 253 $Form->OnSubmit = '?Module=Realm&Action=Save'; 258 254 259 $Realm = new Realm($this-> Database, $_POST['RealmId']);255 $Realm = new Realm($this->System, $_POST['RealmId']); 260 256 $Realm->SaveConfiguration(); 261 257 $Form->Values['RealmId'] = $RealmId; … … 268 264 { 269 265 $Output = ''; 270 $Realm = new Realm($this-> Database, $_GET['Id']);266 $Realm = new Realm($this->System, $_GET['Id']); 271 267 if($this->System->Modules['Permission']->Check('Realm', 'Edit', $Realm->Id)) 272 268 { … … 283 279 { 284 280 $Output = ''; 285 $Realm = new Realm($this-> Database, $_GET['Id']);281 $Realm = new Realm($this->System, $_GET['Id']); 286 282 if($this->System->Modules['Permission']->Check('Realm', 'EditDetailed', $Realm->Id)) 287 283 { 288 284 $Form = new Form($this->System, $this->SettingDetailedFormClass); 289 $EmulatorConfig = new MangosConfigurationFile($this-> Database);285 $EmulatorConfig = new MangosConfigurationFile($this->System); 290 286 $EmulatorConfig->Load('../realm/'.$Realm->Id.'/etc/mangosd.conf'); 291 287 $Form->Values = array(); … … 302 298 { 303 299 $Output = ''; 304 $Realm = new Realm($this-> Database, $_POST['RealmId']);300 $Realm = new Realm($this->System, $_POST['RealmId']); 305 301 if($this->System->Modules['Permission']->Check('Realm', 'SaveDetailed', $Realm->Id)) 306 302 { 307 303 $Form = new Form($this->System, $this->SettingDetailedFormClass, array()); 308 304 $Form->LoadValuesFromForm(); 309 $EmulatorConfig = new MangosConfigurationFile($this-> Database);305 $EmulatorConfig = new MangosConfigurationFile($this->System); 310 306 $EmulatorConfig->Load('../realm/'.$Realm->Id.'/etc/mangosd.conf'); 311 307 foreach($Form->Definition['Items'] as $Index => $Item) … … 322 318 $Form->OnSubmit = '?Module=Realm&Action=SaveDetailed'; 323 319 324 $Realm = new Realm($this-> Database, $_POST['RealmId']);320 $Realm = new Realm($this->System, $_POST['RealmId']); 325 321 $Realm->SaveConfiguration(); 326 322 $Form->Values['RealmId'] = $RealmId; … … 333 329 { 334 330 $Output = ''; 335 $Realm = new Realm($this-> Database, $_GET['Id']);331 $Realm = new Realm($this->System, $_GET['Id']); 336 332 if($this->System->Modules['Permission']->Check('Realm', 'Start', $Realm->Id)) 337 333 { … … 346 342 { 347 343 $Output = ''; 348 $Realm = new Realm($this-> Database, $_GET['Id']);344 $Realm = new Realm($this->System, $_GET['Id']); 349 345 if($this->System->Modules['Permission']->Check('Realm', 'Stop', $Realm->Id)) 350 346 { … … 358 354 function InitDatabase() 359 355 { 360 global $Config;361 362 356 if(array_key_exists('Id', $_GET)) 363 357 { 364 358 $RealmId = $_GET['Id']; 365 $Realm = new Realm($this-> Database, $RealmId);359 $Realm = new Realm($this->System, $RealmId); 366 360 if($this->System->Modules['Permission']->Check('Realm', 'InitDatabase', $Realm->Id)) 367 361 { … … 377 371 } 378 372 } 379 380 ?> -
trunk/www/Application/View/Server.php
r81 r93 84 84 function ItemList() 85 85 { 86 global $Config;87 88 86 $Output = '<h4>Seznam serverů</h4>'; 89 87 $Table = new Table($this->ItemListFormClass, $this->System); … … 110 108 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']); 111 109 $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'])) 113 111 $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&Action=Add">Vytvořit nový server</a></div>'; 114 112 } … … 118 116 function Item() 119 117 { 120 global $Config;121 122 118 $Id = $_GET['Id']; 123 $Server = new Server($this-> Database, $Id);119 $Server = new Server($this->System, $Id); 124 120 if(isset($Server->Server)) 125 121 { … … 132 128 $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => ''); 133 129 $ServerStatus = $Server->GetState(); 134 $Form->Values['Realmlist'] = $ Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];130 $Form->Values['Realmlist'] = $this->Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd']; 135 131 unset($Form->Definition['Items']['NetworkPortRealmd']); 136 132 $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time'); … … 167 163 function Add() 168 164 { 169 global $Config;170 171 165 $Output = ''; 172 166 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) … … 175 169 $DbRow = $DbResult->fetch_row(); 176 170 $ServerCount = $DbRow[0]; 177 if($ServerCount < $ Config['MaxServerCount'])171 if($ServerCount < $this->Config['MaxServerCount']) 178 172 { 179 173 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']); 180 174 $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ů'); 182 178 else 183 179 { … … 195 191 function Create() 196 192 { 197 global $Config;198 199 193 $Output = ''; 200 194 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) … … 202 196 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']); 203 197 $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ů'); 205 201 else 206 202 { … … 208 204 $DbRow = $DbResult->fetch_row(); 209 205 $NewPortRealmd = $DbRow[0] + 1; 210 if($NewPortRealmd < $ Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];206 if($NewPortRealmd < $this->Config['BaseNetworkPortRealmd']) $NewPortRealmd = $this->Config['BaseNetworkPortRealmd']; 211 207 212 208 $Form = new Form($this->System, $this->CreateFormClass, array()); … … 214 210 $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()')); 215 211 $LastInsertId = $this->Database->insert_id; 216 $Server = new Server($this-> Database, $LastInsertId);212 $Server = new Server($this->System, $LastInsertId); 217 213 $Server->CreateDatabase(); 218 214 $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true)); … … 230 226 { 231 227 $Output = ''; 232 $Server = new Server($this-> Database, $_POST['ServerId']);228 $Server = new Server($this->System, $_POST['ServerId']); 233 229 if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 234 230 { … … 241 237 $Form->OnSubmit = '?Action=ServerSave'; 242 238 243 $Server = new Server($this-> Database, $_POST['ServerId']);239 $Server = new Server($this->System, $_POST['ServerId']); 244 240 $Server->SaveConfiguration(); 245 241 $Form->Values['ServerId'] = $ServerId; … … 252 248 { 253 249 $Output = ''; 254 $Server = new Server($this-> Database, $_GET['Id']);250 $Server = new Server($this->System, $_GET['Id']); 255 251 if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 256 252 { … … 269 265 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) 270 266 { 271 $Server = new Server($this-> Database, $_GET['Id']);267 $Server = new Server($this->System, $_GET['Id']); 272 268 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 273 269 { … … 285 281 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) 286 282 { 287 $Server = new Server($this-> Database, $_GET['Id']);283 $Server = new Server($this->System, $_GET['Id']); 288 284 if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 289 285 { … … 310 306 $Form = new Form($this->System, $this->GameAccountNewFormClass); 311 307 $Form->LoadValuesFromForm(); 312 $Server = new Server($this-> Database, $Form->Values['ServerId']);308 $Server = new Server($this->System, $Form->Values['ServerId']); 313 309 $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'])); 314 310 $Output .= '<a href="?Module=Server&Action=GameAccountRegister&Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>'; … … 322 318 Header('Content-Type: text/plain'); 323 319 Header('Content-Disposition: attachment; filename="realmlist.wtf"'); 324 $Server = new Server($this-> Database, $_GET['Id']);320 $Server = new Server($this->System, $_GET['Id']); 325 321 $Output = array( 326 322 'set realmlist '.$this->Config['Web']['Host'].':'.$Server->Server['NetworkPortRealmd'], … … 337 333 if(array_key_exists('Id', $_GET)) 338 334 { 339 $Server = new Server($this-> Database, $_GET['Id'] * 1);335 $Server = new Server($this->System, $_GET['Id'] * 1); 340 336 echo($Server->GetPatchList()); 341 337 } else echo('Zadané id serveru nenalezeno.'); … … 371 367 } 372 368 } 373 374 ?> -
trunk/www/Application/View/Task.php
r92 r93 26 26 function ItemList() 27 27 { 28 global $Config;29 30 28 $Output = '<h4>Fronta úloh</h4>'; 31 29 $Table = new Table($this->ItemListFormClass, $this->System); 32 30 $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)'; 34 33 $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => ''); 35 34 $Table->LoadValuesFromDatabase($this->Database); … … 65 64 } 66 65 } 67 68 ?> -
trunk/www/Application/View/Update.php
r92 r93 7 7 function ItemList() 8 8 { 9 global $Config;10 11 9 $ServerId = $_GET['Id']; 12 10 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 13 11 { 14 $Server = new Server($this-> Database, $_GET['Id']);12 $Server = new Server($this->System, $_GET['Id']); 15 13 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 16 14 { 17 $Server = new Server($this-> Database, $ServerId);15 $Server = new Server($this->System, $ServerId); 18 16 $Output = '<h4>Seznam dostupných aktulizací</h4>'; 19 17 $Output .= 'Před provedením aktualizace bude server zastaven a provedena záloha databáze.'; … … 41 39 else if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 42 40 { 43 $Server = new Server($this-> Database, $_GET['Server']);41 $Server = new Server($this->System, $_GET['Server']); 44 42 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 45 43 { … … 51 49 } 52 50 } 53 54 ?> -
trunk/www/Application/View/User.php
r80 r93 53 53 function Login() 54 54 { 55 global $Config;56 57 55 $Form = new Form($this->System, $this->LoginFormClass); 58 56 $Form->OnSubmit = '?Module=User&Action=LoginFinish'; 59 57 $Output = $Form->ShowEditForm(); 60 58 $Output .= '<div class="Centred">'; 61 if($ Config['Web']['UserRegistrationEnabled'])59 if($this->Config['Web']['UserRegistrationEnabled']) 62 60 $Output .= '<a href="?Module=User&Action=Register">Registrovat se</a> '; 63 61 $Output .= '<a href="?Module=User&Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>'; … … 85 83 function RegisterSave() 86 84 { 87 global $Config; 88 89 if($Config['Web']['UserRegistrationEnabled']) 85 if($this->Config['Web']['UserRegistrationEnabled']) 90 86 { 91 87 $Form = new Form($this->System, $this->RegisterFormClass, array()); … … 96 92 if($Result <> $this->System->Translate('UserRegistrated')) 97 93 { 98 $Form->OnSubmit = '?Module=User&Action= UserRegisterSave';94 $Form->OnSubmit = '?Module=User&Action=RegisterSave'; 99 95 $Output = $Form->ShowEditForm(); 100 96 } … … 166 162 function Register() 167 163 { 168 global $Config; 169 170 if($Config['Web']['UserRegistrationEnabled']) 164 if($this->Config['Web']['UserRegistrationEnabled']) 171 165 { 172 166 $Form = new Form($this->System, $this->RegisterFormClass); 173 167 $Form->LoadValuesFromForm(); 174 $Form->OnSubmit = '?Module=User&Action= UserRegisterSave';168 $Form->OnSubmit = '?Module=User&Action=RegisterSave'; 175 169 $Output = 'Vyplňte správně požadované údaje. Na zadaný email vám bude zaslán aktivační email.'; 176 170 $Output .= $Form->ShowEditForm(); … … 181 175 function RegisterConfirm() 182 176 { 183 global $Config; 184 185 if($Config['Web']['UserRegistrationEnabled']) 177 if($this->Config['Web']['UserRegistrationEnabled']) 186 178 { 187 179 $Page = new PageView($this->System); … … 192 184 } 193 185 } 194 195 ?> -
trunk/www/Base/Controller.php
r78 r93 17 17 } 18 18 } 19 20 ?> -
trunk/www/Base/Database.php
r92 r93 107 107 } 108 108 } 109 110 ?> -
trunk/www/Base/Error.php
r69 r93 73 73 74 74 set_error_handler('CustomErrorHandler'); 75 76 ?> -
trunk/www/Base/Form.php
r78 r93 13 13 function __construct($System, $FormClass) 14 14 { 15 parent::__construct($System); 15 16 $this->Definition = $FormClass; 16 17 foreach($this->Definition['Items'] as $Index => $Item) … … 18 19 $this->Values[$Index] = ''; 19 20 } 20 $this->System = $System;21 $this->Database = $System->Database;22 $this->Config = $System->Config;23 21 } 24 22 … … 43 41 { 44 42 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', 46 44 array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); 47 45 array_push($Table['Rows'], array($Item['Caption'], $Edit)); … … 74 72 { 75 73 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'])); 77 75 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 78 76 } … … 82 80 '</fieldset>'; 83 81 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'])); 85 83 return($Output); 86 84 } … … 123 121 { 124 122 if(array_key_exists($Context.$Index, $_POST)) 125 $Values[$Index] = ExecuteTypeEvent($ Item['Type'], 'OnLoad',123 $Values[$Index] = ExecuteTypeEvent($this->System, $Item['Type'], 'OnLoad', 126 124 array('Name' => $Index, 'Type' => $Item['Type'])); 127 125 } … … 129 127 } 130 128 } 131 132 ?> -
trunk/www/Base/Global.php
r78 r93 84 84 return($out); 85 85 } 86 87 ?> -
trunk/www/Base/Html.php
r71 r93 125 125 } 126 126 } 127 128 ?> -
trunk/www/Base/Mail.php
r78 r93 17 17 $this->AdditionalHeaders['MIME-Version'] = '1.0'; 18 18 $this->AdditionalHeaders['Content-type'] = 'text/html; charset=UTF-8'; 19 $Headers = ''; 19 20 foreach($this->AdditionalHeaders as $Index => $Item) 20 21 { … … 22 23 } 23 24 $Subject = $this->EncodeBase64($this->Subject); 24 return(mail($this-> Address, $Subject, $this->Content, $Headers));25 return(mail($this->RecipientAddress, $Subject, $this->Content, $Headers)); 25 26 } 26 27 … … 30 31 } 31 32 } 32 33 ?> -
trunk/www/Base/Model.php
r78 r93 6 6 { 7 7 } 8 9 ?> -
trunk/www/Base/Module.php
r78 r93 14 14 } 15 15 } 16 17 ?> -
trunk/www/Base/System.php
r92 r93 228 228 } 229 229 } 230 231 ?> -
trunk/www/Base/Table.php
r92 r93 97 97 foreach($this->Definition['Items'] as $Index => $Item) 98 98 { 99 $DbRow[$Index] = ExecuteTypeEvent($ Item['Type'], 'OnView',99 $DbRow[$Index] = ExecuteTypeEvent($this->System, $Item['Type'], 'OnView', 100 100 array('Name' => $Index, 'Value' => $DbRow[$Index], 'Type' => $Item['Type'])); 101 101 $Row[$Index] = $DbRow[$Index]; … … 105 105 } 106 106 } 107 108 ?> -
trunk/www/Base/Types/Base.php
r78 r93 27 27 } 28 28 } 29 30 ?> -
trunk/www/Base/Types/Boolean.php
r69 r93 23 23 } 24 24 } 25 26 ?> -
trunk/www/Base/Types/Date.php
r69 r93 58 58 } 59 59 } 60 61 ?> -
trunk/www/Base/Types/DateTime.php
r69 r93 90 90 } 91 91 } 92 93 ?> -
trunk/www/Base/Types/Enumeration.php
r69 r93 28 28 } 29 29 } 30 31 ?> -
trunk/www/Base/Types/File/File.php
r69 r93 43 43 } 44 44 } 45 46 ?> -
trunk/www/Base/Types/File/FileDownload.php
r69 r93 20 20 echo(file_get_contents($Config['UploadFileFolder'].'/'.$DbRow['Id'])); 21 21 } else echo('Soubor nenalezen!'); 22 23 ?> -
trunk/www/Base/Types/Float.php
r69 r93 22 22 } 23 23 } 24 25 ?> -
trunk/www/Base/Types/GPS.php
r69 r93 68 68 } 69 69 } 70 71 ?> -
trunk/www/Base/Types/Hidden.php
r69 r93 20 20 } 21 21 } 22 23 ?> -
trunk/www/Base/Types/Hyperlink.php
r69 r93 20 20 } 21 21 } 22 23 ?> -
trunk/www/Base/Types/IPv4Address.php
r69 r93 20 20 } 21 21 } 22 23 ?> -
trunk/www/Base/Types/Integer.php
r69 r93 22 22 } 23 23 } 24 25 ?> -
trunk/www/Base/Types/Password.php
r69 r93 40 40 } 41 41 } 42 43 ?> -
trunk/www/Base/Types/PointerOneToMany.php
r69 r93 20 20 } 21 21 } 22 23 ?> -
trunk/www/Base/Types/PointerOneToOne.php
r71 r93 45 45 } 46 46 } 47 48 ?> -
trunk/www/Base/Types/String.php
r69 r93 27 27 } 28 28 } 29 30 ?> -
trunk/www/Base/Types/Text.php
r69 r93 27 27 } 28 28 } 29 30 ?> -
trunk/www/Base/Types/Time.php
r69 r93 54 54 } 55 55 } 56 57 ?> -
trunk/www/Base/Types/Type.php
r78 r93 40 40 ); 41 41 42 function ExecuteTypeEvent($ TypeName, $Event, $Parameters = array())42 function ExecuteTypeEvent($System, $TypeName, $Event, $Parameters = array()) 43 43 { 44 global $TypeDefinitionList , $System;44 global $TypeDefinitionList; 45 45 46 46 if(array_key_exists($TypeName, $TypeDefinitionList)) … … 74 74 return($TypeDefinitionList[$TypeName]); 75 75 } 76 77 ?> -
trunk/www/Base/UTF8.php
r75 r93 563 563 return($Result); 564 564 } 565 566 ?> -
trunk/www/Base/View.php
r78 r93 6 6 { 7 7 } 8 9 ?> -
trunk/www/Include.php
r78 r93 4 4 include('Base/Include.php'); 5 5 include('Application/Include.php'); 6 7 ?> -
trunk/www/index.php
r78 r93 2 2 3 3 include_once(dirname(__FILE__).'/Application/Application.php'); 4 5 ?>
Note:
See TracChangeset
for help on using the changeset viewer.