Changeset 93 for trunk/www/Application/View/Server.php
- Timestamp:
- Aug 15, 2013, 11:17:26 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/Application/View/Server.php
r81 r93 84 84 function ItemList() 85 85 { 86 global $Config;87 88 86 $Output = '<h4>Seznam serverů</h4>'; 89 87 $Table = new Table($this->ItemListFormClass, $this->System); … … 110 108 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']); 111 109 $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'])) 113 111 $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&Action=Add">Vytvořit nový server</a></div>'; 114 112 } … … 118 116 function Item() 119 117 { 120 global $Config;121 122 118 $Id = $_GET['Id']; 123 $Server = new Server($this-> Database, $Id);119 $Server = new Server($this->System, $Id); 124 120 if(isset($Server->Server)) 125 121 { … … 132 128 $Form->Definition['Items']['AccountCount'] = array('Type' => 'String', 'Caption' => 'Počet účtů', 'Default' => ''); 133 129 $ServerStatus = $Server->GetState(); 134 $Form->Values['Realmlist'] = $ Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd'];130 $Form->Values['Realmlist'] = $this->Config['Web']['Host'].':'.$Form->Values['NetworkPortRealmd']; 135 131 unset($Form->Definition['Items']['NetworkPortRealmd']); 136 132 $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($ServerStatus['Uptime'], '', 4, 'Time'); … … 167 163 function Add() 168 164 { 169 global $Config;170 171 165 $Output = ''; 172 166 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) … … 175 169 $DbRow = $DbResult->fetch_row(); 176 170 $ServerCount = $DbRow[0]; 177 if($ServerCount < $ Config['MaxServerCount'])171 if($ServerCount < $this->Config['MaxServerCount']) 178 172 { 179 173 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']); 180 174 $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ů'); 182 178 else 183 179 { … … 195 191 function Create() 196 192 { 197 global $Config;198 199 193 $Output = ''; 200 194 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) … … 202 196 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->Data['Id']); 203 197 $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ů'); 205 201 else 206 202 { … … 208 204 $DbRow = $DbResult->fetch_row(); 209 205 $NewPortRealmd = $DbRow[0] + 1; 210 if($NewPortRealmd < $ Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];206 if($NewPortRealmd < $this->Config['BaseNetworkPortRealmd']) $NewPortRealmd = $this->Config['BaseNetworkPortRealmd']; 211 207 212 208 $Form = new Form($this->System, $this->CreateFormClass, array()); … … 214 210 $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()')); 215 211 $LastInsertId = $this->Database->insert_id; 216 $Server = new Server($this-> Database, $LastInsertId);212 $Server = new Server($this->System, $LastInsertId); 217 213 $Server->CreateDatabase(); 218 214 $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true)); … … 230 226 { 231 227 $Output = ''; 232 $Server = new Server($this-> Database, $_POST['ServerId']);228 $Server = new Server($this->System, $_POST['ServerId']); 233 229 if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 234 230 { … … 241 237 $Form->OnSubmit = '?Action=ServerSave'; 242 238 243 $Server = new Server($this-> Database, $_POST['ServerId']);239 $Server = new Server($this->System, $_POST['ServerId']); 244 240 $Server->SaveConfiguration(); 245 241 $Form->Values['ServerId'] = $ServerId; … … 252 248 { 253 249 $Output = ''; 254 $Server = new Server($this-> Database, $_GET['Id']);250 $Server = new Server($this->System, $_GET['Id']); 255 251 if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 256 252 { … … 269 265 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) 270 266 { 271 $Server = new Server($this-> Database, $_GET['Id']);267 $Server = new Server($this->System, $_GET['Id']); 272 268 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 273 269 { … … 285 281 if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) 286 282 { 287 $Server = new Server($this-> Database, $_GET['Id']);283 $Server = new Server($this->System, $_GET['Id']); 288 284 if(($this->System->Modules['User']->Data['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR)) 289 285 { … … 310 306 $Form = new Form($this->System, $this->GameAccountNewFormClass); 311 307 $Form->LoadValuesFromForm(); 312 $Server = new Server($this-> Database, $Form->Values['ServerId']);308 $Server = new Server($this->System, $Form->Values['ServerId']); 313 309 $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'])); 314 310 $Output .= '<a href="?Module=Server&Action=GameAccountRegister&Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>'; … … 322 318 Header('Content-Type: text/plain'); 323 319 Header('Content-Disposition: attachment; filename="realmlist.wtf"'); 324 $Server = new Server($this-> Database, $_GET['Id']);320 $Server = new Server($this->System, $_GET['Id']); 325 321 $Output = array( 326 322 'set realmlist '.$this->Config['Web']['Host'].':'.$Server->Server['NetworkPortRealmd'], … … 337 333 if(array_key_exists('Id', $_GET)) 338 334 { 339 $Server = new Server($this-> Database, $_GET['Id'] * 1);335 $Server = new Server($this->System, $_GET['Id'] * 1); 340 336 echo($Server->GetPatchList()); 341 337 } else echo('Zadané id serveru nenalezeno.'); … … 371 367 } 372 368 } 373 374 ?>
Note:
See TracChangeset
for help on using the changeset viewer.