Changeset 39
- Timestamp:
- Jun 16, 2009, 6:11:15 PM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/form_classes.php
r38 r39 47 47 ), 48 48 ), 49 ' NewServer' => array(49 'ServerCreate' => array( 50 50 'Title' => 'Nový server', 51 51 'Table' => 'Server', … … 60 60 ), 61 61 ), 62 ' EditServer' => array(62 'ServerEdit' => array( 63 63 'Title' => 'Nastavení', 64 64 'Table' => 'Server', … … 73 73 'ServerId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0), 74 74 //'TimeCreation' => array('Type' => 'DateTime', 'Caption' => 'Datum založení', 'Default' => 'NOW()'), 75 ), 76 ), 77 'ServerView' => array( 78 'Title' => 'Nastavení', 79 'Table' => 'Server', 80 'SubmitText' => 'Uložit', 81 'Items' => array( 82 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'), 83 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''), 84 'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''), 85 'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0), 86 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0), 87 'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'), 88 'ServerId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0), 89 'TimeCreate' => array('Type' => 'DateTime', 'Caption' => 'Datum založení', 'Default' => 'NOW()'), 90 'NetworkPortRealmd' => array('Type' => 'Integer', 'Caption' => 'Port realmd', 'Default' => ''), 75 91 ), 76 92 ), -
trunk/www/index.php
r36 r39 49 49 function ShowServer($Id) 50 50 { 51 global $Config; 52 51 53 $Server = new Server($this->Database, $Id); 52 54 $Output = '<h4>Podrobnosti serveru</h4>'; 53 $Form = new Form(' EditServer');55 $Form = new Form('ServerView'); 54 56 $Form->LoadValuesFromDatabase($Id); 57 $Form->Definition['Items']['Realmlist'] = array('Type' => 'String', 'Caption' => 'Adresa k připojení', 'Default' => ''); 58 $Form->Definition['Items']['Uptime'] = array('Type' => 'String', 'Caption' => 'Doba běhu', 'Default' => ''); 59 $Form->Definition['Items']['UsedMemory'] = array('Type' => 'String', 'Caption' => 'Použitá paměť', 'Default' => ''); 60 $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => ''); 61 $Form->Definition['Items']['CharacterCount'] = array('Type' => 'String', 'Caption' => 'Počet postav', 'Default' => ''); 62 $Form->Definition['Items']['CharacterOnlineCount'] = array('Type' => 'String', 'Caption' => 'Počet hráčů online', 'Default' => ''); 63 $ServerStatus = $Server->GetState(); 64 $Form->Values['Realmlist'] = $Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd']; 65 unset($Form->Values['NetworkPortRealmd']); 66 $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time'); 67 $Form->Values['UsedMemory'] = $this->System->AddPrefixMultipliers($ServerStatus['UsedMemory'] * 1024, 'B', 4, 'Binary'); 68 $Form->Values['AccountCount'] = $ServerStatus['AccountCount']; 69 $Form->Values['CharacterCount'] = $ServerStatus['CharacterCount']; 70 $Form->Values['CharacterOnlineCount'] = $ServerStatus['CharacterOnlineCount']; 55 71 $Output .= $Form->ShowTable(); 56 72 $Output .= '<div style="text-align: center">'; … … 60 76 if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0)) 61 77 { 62 $ServerStatus = $Server->GetState();63 78 if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&Id='.$Server->Id.'">Zastavit</a> <a href="?Action=ServerRestart&Id='.$Server->Id.'">Restartovat</a>'; 64 79 else $Output .= ' <a href="?Action=ServerStart&Id='.$Server->Id.'">Spustit</a>'; … … 457 472 else 458 473 { 459 $Form = new Form(' NewServer');474 $Form = new Form('ServerCreate'); 460 475 $Form->LoadValuesFromForm(); 461 476 $Form->OnSubmit = '?Action=ServerCreate'; … … 482 497 if($NewPortWorldd < $Config['BaseNetworkPortWorldd']) $NewPortWorldd = $Config['BaseNetworkPortWorldd']; 483 498 484 $Form = new Form(' NewServer', array());499 $Form = new Form('ServerCreate', array()); 485 500 $Form->LoadValuesFromForm(); 486 $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => 1, 'NetworkPortWorldd' => $NewPortWorldd, 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1 ));501 $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => 1, 'NetworkPortWorldd' => $NewPortWorldd, 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1, 'TimeCreate' => 'NOW()')); 487 502 $LastInsertId = $this->Database->insert_id; 488 503 $Server = new Server($this->Database, $LastInsertId); … … 506 521 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 507 522 { 508 $Form = new Form(' EditServer');523 $Form = new Form('ServerEdit'); 509 524 $Form->LoadValuesFromDatabase($_GET['Id']); 510 525 $Form->Values['ServerId'] = $_GET['Id']; … … 518 533 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 519 534 { 520 $Form = new Form(' EditServer', array());535 $Form = new Form('ServerEdit', array()); 521 536 $Form->LoadValuesFromForm(); 522 537 $ServerId = $_POST['ServerId']; -
trunk/www/server.php
r38 r39 137 137 $DbRow = $DbResult->fetch_row(); 138 138 $State['AccountCount'] = $DbRow[0]; 139 $DbResult = $this->Database->query('SELECT uptime FROM server'.$this->Id.'_realmd.uptime AS T ORDER BY T.startstring DESC'); 140 $DbRow = $DbResult->fetch_assoc(); 141 $State['Uptime'] = $DbRow['uptime']; 139 142 } else 140 143 { … … 143 146 $State['AccountCount'] = 0; 144 147 } 148 $State['UsedMemory'] = $this->GetUsedMemory(); 145 149 return($State); 146 150 } … … 345 349 { 346 350 $Output = array(); 347 exec('ps -aux|grep "emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-worldd -c server/'.$this->Id.'/etc/mangosd.conf"| grep -v grep', $Output);348 print_r($Output);351 if(isset($this->Server['Database']['Emulator']['Id'])) 352 exec('ps -aux|grep "emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-worldd -c server/'.$this->Id.'/etc/mangosd.conf"| grep -v grep', $Output); 349 353 if(count($Output) > 0) 350 354 {
Note:
See TracChangeset
for help on using the changeset viewer.