Changeset 4
- Timestamp:
- Jun 8, 2009, 9:50:59 PM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/form_classes.php
r3 r4 159 159 ), 160 160 ), 161 ' Server' => array(161 'NewServer' => array( 162 162 'Title' => 'Nový server', 163 'Table' => ' ',163 'Table' => 'Server', 164 164 'SubmitText' => 'Registrovat', 165 165 'Items' => array( 166 166 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'), 167 ), 168 ), 169 'EditServer' => array( 170 'Title' => 'Nastavení', 171 'Table' => 'Server', 172 'SubmitText' => 'Uložit', 173 'Items' => array( 174 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'), 175 'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'), 167 176 ), 168 177 ), -
trunk/www/index.php
r3 r4 169 169 if($_GET['Action'] == 'NewServer') 170 170 { 171 $Form = new Form('Server'); 171 $Form = new Form('NewServer'); 172 $Form->LoadValuesFromForm(); 173 $Form->OnSubmit = '?Action=ServerCreate'; 174 $Output .= $Form->ShowEditForm(); 175 } else 176 if($_GET['Action'] == 'ServerCreate') 177 { 178 $UserOptions = new Form('NewServer', array()); 179 $UserOptions->LoadValuesFromForm(); 180 $Output .= $this->SystemMessage('Nový server', 'Server vytvořen.'); 181 //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 182 $UserOptions->OnSubmit = '?Action=ServerCreate'; 183 $Output .= $UserOptions->ShowEditForm(); 184 } else 185 if($_GET['Action'] == 'EditServer') 186 { 187 $Form = new Form('EditServer'); 172 188 $Form->LoadValuesFromForm(); 173 189 $Form->OnSubmit = '?Action=ServerSave'; 174 190 $Output .= $Form->ShowEditForm(); 175 191 } else 176 if($_GET['Action'] == ' NewServerSave')177 { 178 $UserOptions = new Form(' Server', array());179 $UserOptions->LoadValuesFromForm(); 180 $Output .= $this->SystemMessage(' Nový server', 'Server vytvořen.');192 if($_GET['Action'] == 'ServerSave') 193 { 194 $UserOptions = new Form('EditServer', array()); 195 $UserOptions->LoadValuesFromForm(); 196 $Output .= $this->SystemMessage('Upravit server', 'Nastavení serveru uloženo.'); 181 197 $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 182 198 $UserOptions->OnSubmit = '?Action=ServerSave'; 199 200 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 201 $Server = $DbResult->fetch_assoc(); 202 $ServerId = $Server['Id']; 203 $Server = new Server($this->Database, $ServerId); 204 205 // Setup mangosd.conf 206 $Config = new MangosConfigurationFile($this->Database); 207 $Config->Load('../emu/mangos/'.$Server->Server['Database']['Emulator']['Revision'].'/etc/mangosd.conf'); 208 $Config->ParameterList['LoginDatabaseInfo'] = 'localhost:3306:server'.$ServerId.':server'.$ServerId.':server'.$ServerId.'_realmd'; 209 $Config->ParameterList['WorldDatabaseInfo'] = 'localhost:3306:server'.$ServerId.':server'.$ServerId.':server'.$ServerId.'_mangos'; 210 $Config->ParameterList['CharacterDatabaseInfo'] = 'localhost:3306:server'.$ServerId.':server'.$ServerId.':server'.$ServerId.'_characters'; 211 $Config->ParameterList['WorldServerPort'] = 8085 + $ServerId; 212 $Config->ParameterList['Motd'] = $Server->Server['Motd']; 213 $Config->Save('../server/'.$ServerId.'/etc/mangosd.conf'); 214 // Setup realmd.conf 215 $Config = new MangosConfigurationFile($this->Database); 216 $Config->Load('../emu/mangos/'.$Server->Server['Database']['Emulator']['Revision'].'/etc/realmd.conf'); 217 $Config->ParameterList['LoginDatabaseInfo'] = 'localhost:3306:server'.$ServerId.':server'.$ServerId.':server'.$ServerId.'_realmd'; 218 $Config->ParameterList['RealmServerPort'] = 3724 + $ServerId; 219 $Config->Save('../server/'.$ServerId.'/etc/realmd.conf'); 220 // Setup realmd.conf 221 $Config = new MangosConfigurationFile($this->Database); 222 $Config->Load('../emu/mangos/'.$Server->Server['Database']['Emulator']['Revision'].'/etc/scriptdev2.conf'); 223 $Config->ParameterList['ScriptDev2DatabaseInfo'] = 'localhost:3306:server'.$ServerId.':server'.$ServerId.':server'.$ServerId.'_scriptdev2'; 224 $Config->Save('../server/'.$ServerId.'/etc/scriptdev2.conf'); 225 183 226 $Output .= $UserOptions->ShowEditForm(); 184 227 } else -
trunk/www/process_tasks.php
r3 r4 9 9 { 10 10 echo('Provádím '.$Task['Command']."...\n"); 11 $Output = array(); 12 exec($Task['Command'], $Output); 13 echo(implode("\n", $Output)); 11 foreach(explode("\n", $Task['CommandList']) as $Command) 12 { 13 $Output = array(); 14 exec($Command, $Output); 15 echo(implode("\n", $Output)); 16 } 14 17 $Database->query('UPDATE Task SET Executed=1 WHERE Id='.$Task['Id']); 15 18 } -
trunk/www/server.php
r3 r4 12 12 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); 13 13 $this->Server = $DbResult->fetch_assoc(); 14 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE `Id`='.$this->Server['Database']); 15 $this->Server['Database'] = $DbResult->fetch_assoc(); 16 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$this->Server['Database']['Emulator']); 17 $this->Server['Database']['Emulator'] = $DbResult->fetch_assoc(); 14 18 } 15 19 16 function AddTask($T ask)20 function AddTask($Title, $Task) 17 21 { 18 $this->Database->insert('Task', array('Server' => $this->Server['Id'], 'Ti me' => 'NOW()', 'Command' => $Task));22 $this->Database->insert('Task', array('Server' => $this->Server['Id'], 'Title' => $Title, 'Time' => 'NOW()', 'CommandList' => implode("\n", $Task))); 19 23 } 20 24 … … 25 29 $DbResult = $this->Database->query('SELECT `Revision` FROM `Emulator` WHERE `Id`='.$Database['Emulator']); 26 30 $Emulator = $DbResult->fetch_assoc(); 27 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/udb/'.$Database['SourceFileName']); 28 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_create_structure.sql'); 29 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql'); 30 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql'); 31 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/realmd.sql'); 32 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_characters < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/characters.sql'); 31 $this->AddTask('Inicializace databáze', array( 32 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/udb/'.$Database['SourceFileName'], 33 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_create_structure.sql', 34 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql', 35 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql', 36 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/realmd.sql', 37 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_characters < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/characters.sql')); 33 38 } 34 39 … … 40 45 function Start() 41 46 { 47 AddTask('Start emulátoru', array( 48 'screen -A -m -d -S server'.$this->Id.'-realmd emu/mangos/'.$this->Server['Database']['Emulator']['Revision'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf', 49 'screen -A -m -d -S server'.$this->Id.'-realmd emu/mangos/'.$this->Server['Database']['Emulator']['Revision'].'/bin/mangos-worldd -c server/'.$this->Id.'/etc/mangosd.conf', 50 )); 42 51 } 43 52 44 53 function Stop() 45 54 { 55 AddTask('Zastavení emulátoru', array( 56 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-realmd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 57 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-worldd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 58 )); 46 59 } 47 60 } -
trunk/www/user.php
r3 r4 144 144 // načtení stavu stromu 145 145 $Result = USER_LOGGED_IN; 146 $this->System->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress()));146 //$this->System->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress())); 147 147 } 148 148 } else $Result = USER_NOT_REGISTRED;
Note:
See TracChangeset
for help on using the changeset viewer.