Changeset 21 for trunk/www/index.php
- Timestamp:
- Jun 12, 2009, 7:26:20 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/index.php
r20 r21 47 47 $Output .= $Form->ShowTable(); 48 48 $Output .= '<div style="text-align: center">'; 49 if(( $this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) and ($this->System->Modules['User']->User['Id'] == $Server->Server['User']))49 if((($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) and ($this->System->Modules['User']->User['Id'] == $Server->Server['User'])) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 50 50 { 51 51 $Output .= '<br /><a href="http://'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> '; … … 53 53 { 54 54 $ServerStatus = $Server->GetState(); 55 if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop ">Zastavit</a> <a href="?Action=ServerRestart">Restartovat</a>';56 else $Output .= ' <a href="?Action=ServerStart ">Spustit</a>';55 if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&Id='.$Server->Id.'">Zastavit</a> <a href="?Action=ServerRestart&Id='.$Server->Id.'">Restartovat</a>'; 56 else $Output .= ' <a href="?Action=ServerStart&Id='.$Server->Id.'">Spustit</a>'; 57 57 } 58 $Output .= ' <a href="?Action=ServerEdit ">Upravit</a>';59 $Output .= ' <a href="?Action=ServerDatabaseImport ">Načtení čisté databáze</a>';58 $Output .= ' <a href="?Action=ServerEdit&Id='.$Server->Id.'">Upravit</a>'; 59 $Output .= ' <a href="?Action=ServerDatabaseImport&Id='.$Server->Id.'">Načtení čisté databáze</a>'; 60 60 } 61 61 $Output .= '</div>'; … … 253 253 { 254 254 if(array_key_exists('Id', $_GET)) $Output .= $this->ShowServer($_GET['Id']); 255 else 256 { 257 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 258 $Server = $DbResult->fetch_assoc(); 259 $Output .= $this->ShowServer($Server['Id']); 260 } 255 else $this->SystemMessage('Zobrazení serveru', 'Nebylo zadáno Id'); 261 256 } else 262 257 if($_GET['Action'] == 'ServerEdit') 263 258 { 264 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 265 { 266 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 267 $Server = $DbResult->fetch_assoc(); 259 $Server = new Server($this->Database, $_GET['Id']); 260 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 261 { 268 262 $Form = new Form('EditServer'); 269 $Form->LoadValuesFromDatabase($Server['Id']); 263 $Form->LoadValuesFromDatabase($_GET['Id']); 264 $Form->Values['ServerId'] = $_GET['Id']; 270 265 $Form->OnSubmit = '?Action=ServerSave'; 271 266 $Output .= $Form->ShowEditForm(); 272 } else $ Output .= USER_BAD_ROLE;267 } else $this->SystemMessage('Nastavení serveru', 'Nemáte oprávnění'); 273 268 } else 274 269 if($_GET['Action'] == 'ServerSave') 275 270 { 276 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 277 { 278 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 279 $Server = $DbResult->fetch_assoc(); 280 $UserOptions = new Form('EditServer', array()); 281 $UserOptions->LoadValuesFromForm(); 271 $Server = new Server($this->Database, $_POST['ServerId']); 272 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 273 { 274 $Form = new Form('EditServer', array()); 275 $Form->LoadValuesFromForm(); 276 $ServerId = $_POST['ServerId']; 277 unset($Form->Values['ServerId']); 282 278 $Output .= $this->SystemMessage('Upravit server', 'Nastavení serveru uloženo.'); 283 $ UserOptions->SaveValuesToDatabase($Server['Id']);284 $ UserOptions->OnSubmit = '?Action=ServerSave';279 $Form->SaveValuesToDatabase($_POST['ServerId']); 280 $Form->OnSubmit = '?Action=ServerSave'; 285 281 286 $Server = new Server($this->Database, $ Server['Id']);282 $Server = new Server($this->Database, $_POST['ServerId']); 287 283 $Server->SaveConfiguration(); 288 289 $Output .= $ UserOptions->ShowEditForm();290 } else $ Output .= USER_BAD_ROLE;284 $Form->Values['ServerId'] = $ServerId; 285 $Output .= $Form->ShowEditForm(); 286 } else $this->SystemMessage('Nastavení serveru', 'Nemáte oprávnění'); 291 287 } else 292 288 if($_GET['Action'] == 'ServerStart') … … 294 290 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 295 291 { 296 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 297 $Server = $DbResult->fetch_assoc(); 298 $Server = new Server($this->Database, $Server['Id']); 299 $Output .= $this->SystemMessage('Spuštění serveru', $Server->Start()); 292 $Server = new Server($this->Database, $_GET['Id']); 293 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 294 { 295 $Output .= $this->SystemMessage('Spuštění serveru', $Server->Start()); 296 } else $this->SystemMessage('Spuštění serveru', 'Nemáte oprávnění'); 300 297 } else $Output .= USER_BAD_ROLE; 301 298 } else … … 304 301 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 305 302 { 306 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 307 $Server = $DbResult->fetch_assoc(); 308 $Server = new Server($this->Database, $Server['Id']); 309 $Output .= $this->SystemMessage('Zastavení serveru', $Server->Stop()); 303 $Server = new Server($this->Database, $_GET['Id']); 304 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 305 { 306 $Output .= $this->SystemMessage('Zastavení serveru', $Server->Stop()); 307 } else $this->SystemMessage('Zastavení serveru', 'Nemáte oprávnění'); 310 308 } else $Output .= USER_BAD_ROLE; 311 309 } else … … 314 312 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 315 313 { 316 $DbResult = $this->Database->query('SELECT Id FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 317 $Server = $DbResult->fetch_assoc(); 318 $Server = new Server($this->Database, $Server['Id']); 319 $Server->ImportDatabase(true); 320 $Output .= $this->SystemMessage('Import čisté databáze', 'Úloha zařazena do fronty'); 314 $Server = new Server($this->Database, $_GET['Id']); 315 if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 316 { 317 $Server->ImportDatabase(true); 318 $Output .= $this->SystemMessage('Import čisté databáze', 'Úloha zařazena do fronty'); 319 } else $this->SystemMessage('Zastavení serveru', 'Nemáte oprávnění'); 321 320 } else $Output .= USER_BAD_ROLE; 322 321 } else
Note:
See TracChangeset
for help on using the changeset viewer.