Changeset 5 for trunk/www/index.php
- Timestamp:
- Jun 9, 2009, 10:39:27 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/index.php
r4 r5 23 23 function ShowServer($Id) 24 24 { 25 $DbResult = $this->Database->query('SELECT * FROM Server WHERE Id='.$Id); 26 $Server = $DbResult->fetch_assoc(); 25 $Server = new Server($this->Database, $Id); 27 26 $Output = '<h4>Podrobnosti serveru</h4>'; 28 27 $Output .= '<table class="WideTable"><tr><th>Položka</th><th>Hodnota</th></tr>'; 29 $Output .= '<tr><td>Jméno</td><td>'.$Server['Name'].'</td></tr>'. 30 '<tr><td>Síťový port realmd</td><td>'.$Server['NetworkPortRealmd'].'</td></tr>'. 31 '<tr><td>Síťový port mangosd</td><td>'.$Server['NetworkPortMangosd'].'</td></tr>'. 32 '<tr><td>Emulátor</td><td>'.$Server['NetworkPortMangosd'].'</td></tr>'. 33 '<tr><td>Databáze</td><td>'.$this->System->Config['Web']['Host'].':'.$Server['NetworkPortRealmd'].'</td></tr>'; 28 $Output .= '<tr><td>Jméno</td><td>'.$Server->Server['Name'].'</td></tr>'. 29 '<tr><td>Zpráva dne</td><td>'.$Server->Server['Motd'].'</td></tr>'. 30 '<tr><td>Síťový port realmd</td><td>'.($Server->RealmdBaseNetworkPort + $Server->Id).'</td></tr>'. 31 '<tr><td>Síťový port mangosd</td><td>'.($Server->WorlddBaseNetworkPort + $Server->Id).'</td></tr>'. 32 '<tr><td>Emulátor</td><td>'.$Server->Server['Database']['Emulator']['Name'].'</td></tr>'. 33 '<tr><td>Databáze</td><td>'.$Server->Server['Database']['Name'].'</td></tr>'; 34 34 $Output .= '</table>'; 35 $Output .= '<br /><a hreg="'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a><br />'; 35 $Output .= '<br /><a href="'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> '; 36 $ServerStatus = $Server->GetState(); 37 if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop">Zastavit server</a> <a href="?Action=ServerRestart">RestartovatServer</a>'; 38 else $Output .= ' <a href="?Action=ServerStart">Spustit server</a>'; 39 36 40 return($Output); 37 41 } … … 167 171 $Output .= $UserOptions->ShowEditForm(); 168 172 } else 169 if($_GET['Action'] == ' NewServer')173 if($_GET['Action'] == 'ServerAdd') 170 174 { 171 175 $Form = new Form('NewServer'); … … 183 187 $Output .= $UserOptions->ShowEditForm(); 184 188 } else 185 if($_GET['Action'] == 'EditServer') 189 if($_GET['Action'] == 'ServerShow') 190 { 191 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 192 $Server = $DbResult->fetch_assoc(); 193 $Output .= $this->ShowServer($Server['Id']); 194 } else 195 if($_GET['Action'] == 'ServerEdit') 186 196 { 187 197 $Form = new Form('EditServer'); … … 200 210 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 201 211 $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 226 $Output .= $UserOptions->ShowEditForm(); 212 $Server = new Server($this->Database, $Server['Id']); 213 $Server->SetupConfigurationFiles(); 214 215 $Output .= $UserOptions->ShowEditForm(); 216 } else 217 if($_GET['Action'] == 'ServerStart') 218 { 219 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 220 $Server = $DbResult->fetch_assoc(); 221 $Server = new Server($this->Database, $Server['Id']); 222 $Output .= $this->SystemMessage('Spuštění serveru', $Server->Start()); 223 } else 224 if($_GET['Action'] == 'ServerStop') 225 { 226 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 227 $Server = $DbResult->fetch_assoc(); 228 $Server = new Server($this->Database, $Server['Id']); 229 $Output .= $this->SystemMessage('Zastavení serveru', $Server->Stop()); 227 230 } else 228 231 if($_GET['Action'] == 'Test') … … 236 239 { 237 240 $Output = $this->ShowServerList(); 238 $Output .= '<br /><a href="?Action= NewServer">Nový server</a>';241 $Output .= '<br /><a href="?Action=ServerAdd">Nový server</a>'; 239 242 } 240 243 } else 241 244 { 242 245 $Output = $this->ShowServerList(); 243 $Output .= '<br /><a href="?Action= NewServer">Nový server</a>';246 $Output .= '<br /><a href="?Action=ServerAdd">Nový server</a>'; 244 247 } 245 248 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.