Changeset 39 for trunk/www/index.php


Ignore:
Timestamp:
Jun 16, 2009, 6:11:15 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Zobrazení více informací o serverech včetně počtu účtů, postav a online hráčů, dále pak zabraná paměť a doba běhu.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/index.php

    r36 r39  
    4949  function ShowServer($Id)
    5050  {
     51    global $Config;
     52   
    5153    $Server = new Server($this->Database, $Id);
    5254    $Output = '<h4>Podrobnosti serveru</h4>';
    53     $Form = new Form('EditServer');
     55    $Form = new Form('ServerView');
    5456    $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'];
    5571    $Output .= $Form->ShowTable();
    5672    $Output .= '<div style="text-align: center">';
     
    6076      if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0))
    6177      {
    62         $ServerStatus = $Server->GetState();
    6378        if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&amp;Id='.$Server->Id.'">Zastavit</a>  <a href="?Action=ServerRestart&amp;Id='.$Server->Id.'">Restartovat</a>';
    6479          else $Output .= ' <a href="?Action=ServerStart&amp;Id='.$Server->Id.'">Spustit</a>';
     
    457472            else
    458473            {
    459               $Form = new Form('NewServer');
     474              $Form = new Form('ServerCreate');
    460475              $Form->LoadValuesFromForm();
    461476              $Form->OnSubmit = '?Action=ServerCreate';
     
    482497            if($NewPortWorldd < $Config['BaseNetworkPortWorldd']) $NewPortWorldd = $Config['BaseNetworkPortWorldd'];
    483498           
    484             $Form = new Form('NewServer', array());
     499            $Form = new Form('ServerCreate', array());
    485500            $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()'));
    487502            $LastInsertId = $this->Database->insert_id;
    488503            $Server = new Server($this->Database, $LastInsertId);
     
    506521        if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    507522        {
    508           $Form = new Form('EditServer');
     523          $Form = new Form('ServerEdit');
    509524          $Form->LoadValuesFromDatabase($_GET['Id']);
    510525          $Form->Values['ServerId'] = $_GET['Id'];
     
    518533        if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    519534        {
    520           $Form = new Form('EditServer', array());
     535          $Form = new Form('ServerEdit', array());
    521536          $Form->LoadValuesFromForm();
    522537          $ServerId = $_POST['ServerId'];
Note: See TracChangeset for help on using the changeset viewer.