Ignore:
Timestamp:
Aug 15, 2013, 11:17:26 PM (11 years ago)
Author:
chronos
Message:
  • Fixed: System variable as parameter to constructors of descendents of Module class.
  • Removed: End PHP mark "?>" from all files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/Application/View/Server.php

    r81 r93  
    8484  function ItemList()
    8585  {
    86     global $Config;
    87    
    8886    $Output = '<h4>Seznam serverů</h4>';
    8987    $Table = new Table($this->ItemListFormClass, $this->System);
     
    110108      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
    111109      $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']))
    113111        $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&amp;Action=Add">Vytvořit nový server</a></div>';     
    114112    }
     
    118116  function Item()
    119117  {
    120     global $Config;
    121    
    122118    $Id = $_GET['Id'];
    123     $Server = new Server($this->Database, $Id);
     119    $Server = new Server($this->System, $Id);
    124120    if(isset($Server->Server))
    125121    {
     
    132128    $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => '');   
    133129    $ServerStatus = $Server->GetState();
    134     $Form->Values['Realmlist'] = $Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];
     130    $Form->Values['Realmlist'] = $this->Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];
    135131    unset($Form->Definition['Items']['NetworkPortRealmd']);
    136132    $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time');
     
    167163  function Add()
    168164  {
    169     global $Config;
    170    
    171165    $Output = '';
    172166    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
     
    175169      $DbRow = $DbResult->fetch_row();
    176170      $ServerCount = $DbRow[0];
    177       if($ServerCount < $Config['MaxServerCount'])
     171      if($ServerCount < $this->Config['MaxServerCount'])
    178172      {
    179173        $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
    180174        $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ů');
    182178        else
    183179        {
     
    195191  function Create()
    196192  {
    197     global $Config;
    198    
    199193    $Output = '';
    200194    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
     
    202196      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']);
    203197      $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ů');
    205201      else
    206202      {
     
    208204        $DbRow = $DbResult->fetch_row();
    209205        $NewPortRealmd = $DbRow[0] + 1;
    210         if($NewPortRealmd < $Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];
     206        if($NewPortRealmd < $this->Config['BaseNetworkPortRealmd']) $NewPortRealmd = $this->Config['BaseNetworkPortRealmd'];
    211207           
    212208        $Form = new Form($this->System, $this->CreateFormClass, array());
     
    214210        $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()'));
    215211        $LastInsertId = $this->Database->insert_id;
    216         $Server = new Server($this->Database, $LastInsertId);
     212        $Server = new Server($this->System, $LastInsertId);
    217213        $Server->CreateDatabase();           
    218214        $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true));
     
    230226  {
    231227    $Output = '';
    232     $Server = new Server($this->Database, $_POST['ServerId']);
     228    $Server = new Server($this->System, $_POST['ServerId']);
    233229    if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    234230    {
     
    241237      $Form->OnSubmit = '?Action=ServerSave';
    242238       
    243       $Server = new Server($this->Database, $_POST['ServerId']);
     239      $Server = new Server($this->System, $_POST['ServerId']);
    244240      $Server->SaveConfiguration();
    245241      $Form->Values['ServerId'] = $ServerId;
     
    252248  {
    253249    $Output = '';
    254     $Server = new Server($this->Database, $_GET['Id']);
     250    $Server = new Server($this->System, $_GET['Id']);
    255251    if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    256252    {
     
    269265    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
    270266    {
    271       $Server = new Server($this->Database, $_GET['Id']);
     267      $Server = new Server($this->System, $_GET['Id']);
    272268      if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    273269      {
     
    285281    if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
    286282    {
    287       $Server = new Server($this->Database, $_GET['Id']);
     283      $Server = new Server($this->System, $_GET['Id']);
    288284      if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
    289285      {
     
    310306    $Form = new Form($this->System, $this->GameAccountNewFormClass);
    311307    $Form->LoadValuesFromForm();
    312     $Server = new Server($this->Database, $Form->Values['ServerId']);
     308    $Server = new Server($this->System, $Form->Values['ServerId']);
    313309    $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']));
    314310    $Output .= '<a href="?Module=Server&amp;Action=GameAccountRegister&amp;Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';
     
    322318      Header('Content-Type: text/plain');
    323319      Header('Content-Disposition: attachment; filename="realmlist.wtf"');
    324       $Server = new Server($this->Database, $_GET['Id']);
     320      $Server = new Server($this->System, $_GET['Id']);
    325321      $Output = array(
    326322        'set realmlist '.$this->Config['Web']['Host'].':'.$Server->Server['NetworkPortRealmd'],
     
    337333    if(array_key_exists('Id', $_GET))
    338334    {
    339       $Server = new Server($this->Database, $_GET['Id'] * 1);
     335      $Server = new Server($this->System, $_GET['Id'] * 1);
    340336      echo($Server->GetPatchList());
    341337    } else echo('Zadané id serveru nenalezeno.');
     
    371367  } 
    372368}
    373 
    374 ?>
Note: See TracChangeset for help on using the changeset viewer.