Changeset 74
- Timestamp:
- Aug 23, 2009, 9:38:51 PM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/Application/Config/ConfigSample.php
r69 r74 29 29 'TableRowPerPage' => 30, 30 30 'UserRegistrationEnabled' => false, 31 'UserAnonymousId' => 1, 32 'UserConsoleId' => 2, 31 33 ), 32 34 'BaseDir' => '/opt/wowhosting/', -
trunk/www/Application/Controller/Include.php
r73 r74 11 11 include('Application/Controller/Debug.php'); 12 12 include('Application/Controller/Backup.php'); 13 include('Application/Controller/Cluster.php'); 13 14 14 15 ?> -
trunk/www/Application/Controller/Server.php
r73 r74 97 97 $View->XMLExport(); 98 98 } 99 100 function UnLock() 101 { 102 $Model = new Server($this->Database, $_GET['Id']); 103 $Model->UnLock(); 104 } 105 106 function Lock() 107 { 108 $Model = new Server($this->Database, $_GET['Id']); 109 $Model->Lock(); 110 } 99 111 } 100 112 -
trunk/www/Application/Model/Cluster.php
r69 r74 6 6 { 7 7 $this->System = $System; 8 $this->Config = $System->Config; 8 9 $this->Database = $System->Database; 9 10 … … 20 21 } 21 22 23 function MigrateRealm($RealmId) 24 { 25 } 26 27 function MigrateServer($ServerId) 28 { 29 } 22 30 } 23 31 -
trunk/www/Application/Model/Include.php
r69 r74 11 11 include('Application/Model/Platform.php'); 12 12 include('Application/Model/History.php'); 13 include('Application/Model/Shell.php');14 13 15 14 ?> -
trunk/www/Application/Model/Shell.php
r69 r74 21 21 } 22 22 23 function Show()24 {25 global $System;26 27 $Output = '';28 if(count($_SERVER['argv']) > 1)29 {30 $Command = $_SERVER['argv'][1];31 if($Command == 'ServerProcessLog')32 {33 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))34 {35 $MangosDebug = new MangosDebug($this->Database);36 $Output = $MangosDebug->ProcessLog($_SERVER['argv'][2]);37 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';38 } else39 if($Command == 'ServerLock')40 {41 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))42 {43 $Server = new Server($this->Database, $_SERVER['argv'][2]);44 $Server->Lock();45 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';46 } else47 23 if($Command == 'ServerUnLock') 48 24 { -
trunk/www/Application/Model/User.php
r69 r74 38 38 var $User = array(); 39 39 var $DefaultRole = 2; 40 var $AnonymousUserId = 1;41 40 var $OnlineStateTimeout = 600; // in seconds 42 41 … … 50 49 { 51 50 $this->System->Modules['User']->User['Id'] = $DbRow['User']; 52 if($DbRow['User'] != $this-> AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');51 if($DbRow['User'] != $this->Config['Web']['UserAnonymousId']) $this->System->Modules['Log']->NewRecord('User', 'Logout'); 53 52 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); 54 53 } … … 57 56 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 58 57 if($Query->num_rows == 0) 59 $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this-> AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF']));58 $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->Config['Web']['UserAnonymousId'], 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 60 59 //echo($this->Database->LastQuery); 61 60 … … 63 62 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 64 63 $Row = $Query->fetch_assoc(); 65 if($Row['User'] != $this-> AnonymousUserId)64 if($Row['User'] != $this->Config['Web']['UserAnonymousId']) 66 65 { 67 66 $Query = $this->Database->select('User', '*', 'Id='.$Row['User']); … … 70 69 } else 71 70 { 72 $Query = $this->Database->select('User', '*', 'Id='.$this-> AnonymousUserId);71 $Query = $this->Database->select('User', '*', 'Id='.$this->Config['Web']['UserAnonymousId']); 73 72 $this->User = $Query->fetch_assoc(); 74 73 $Result = USER_NOT_LOGGED; … … 162 161 { 163 162 $SID = session_id(); 164 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this-> AnonymousUserId));163 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->Config['Web']['UserAnonymousId'])); 165 164 $this->System->Modules['Log']->NewRecord('User', 'Logout', $this->User['Login']); 166 165 $this->Check(); -
trunk/www/Application/View/Emulator.php
r72 r74 104 104 $Emulator->Download(); 105 105 $Output = $this->System->SystemMessage('Stažení emulátoru', 'Úloha zařazena do fronty'); 106 $TaskView = new TaskView($this-> Database, $this->System);106 $TaskView = new TaskView($this->System); 107 107 $Output .= $TaskView->ItemList(); 108 108 } else $Output = $this->System->SystemMessage('Stažení emulátoru', 'Nebylo zadáno Id'); … … 117 117 $Emulator->Compile(); 118 118 $Output = $this->System->SystemMessage('Překlad emulátoru', 'Úloha zařazena do fronty'); 119 $TaskView = new TaskView($this-> Database, $this->System);119 $TaskView = new TaskView($this->System); 120 120 $Output .= $TaskView->ItemList(); 121 121 } else $Output = $this->System->SystemMessage('Překlad emulátoru', 'Nebylo zadáno Id'); -
trunk/www/Application/View/Include.php
r69 r74 14 14 include('Application/View/Client.php'); 15 15 include('Application/View/Debug.php'); 16 include('Application/View/Cluster.php'); 17 16 18 ?> -
trunk/www/Application/View/Page.php
r73 r74 35 35 ' <a href="?Module=Emulator&Action=ItemList">Verze emulátoru</a>'. 36 36 '</span><div class="MenuItem2">'; 37 if($this->System->Modules['User']->User['Id'] == $this-> System->Modules['User']->AnonymousUserId)37 if($this->System->Modules['User']->User['Id'] == $this->Config['Web']['UserAnonymousId']) 38 38 { 39 39 $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Module=User&Action=Login">Přihlášení</a>'; … … 64 64 { 65 65 $Output = '<table class="BasicTable"><tr>'; 66 if($this->System->Modules['User']->User['Id'] != $this-> System->Modules['User']->AnonymousUserId)66 if($this->System->Modules['User']->User['Id'] != $this->Config['Web']['UserAnonymousId']) 67 67 $Output .= '<td class="UserMenu">'.$this->UserMenu().'</td>'; 68 68 $Output .= '<td class="Content">'.$Content.'</td>'; 69 69 if(!array_key_exists('Action', $_GET)) 70 70 { 71 $NewsView = new NewsView($this-> Database, $this->System);71 $NewsView = new NewsView($this->System); 72 72 $Output .= $NewsView->View(); 73 73 } … … 79 79 { 80 80 $Output = '<strong>Uživatelské menu</strong><br />'; 81 if($this->System->Modules['User']->User['Id'] != $this-> System->Modules['User']->AnonymousUserId)81 if($this->System->Modules['User']->User['Id'] != $this->Config['Web']['UserAnonymousId']) 82 82 { 83 $Output .= '<div><a href="?Module=Cluster&Action=ItemList">Uzly skupiny</a></div>'; 83 84 $Output .= '<div><a href="?Module=Server&Action=ItemList&Filter=User">Moje servery</a></div>'; 84 85 //$Output .= '<div><a href="?Action=RealmList&Filter=User">Moje světy</a></div>'; -
trunk/www/Application/View/Realm.php
r72 r74 230 230 $Realm->CreateDatabase(); 231 231 $Output = $this->System->SystemMessage('Vytvoření světu', $Realm->ImportDatabase(true)); 232 $TaskView = new TaskView($this-> Database, $this->System);232 $TaskView = new TaskView($this->System); 233 233 $Output .= $TaskView->ItemList(); 234 234 //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); … … 337 337 { 338 338 $Output .= $this->System->SystemMessage('Spuštění serveru', $Realm->Start()); 339 $TaskView = new TaskView($this-> Database, $this->System);339 $TaskView = new TaskView($this->System); 340 340 $Output .= $TaskView->ItemList();; 341 341 } else $this->System->SystemMessage('Spuštění serveru', 'Nemáte oprávnění'); … … 353 353 { 354 354 $Output .= $this->System->SystemMessage('Zastavení serveru', $Realm->Stop()); 355 $TaskView = new TaskView($this-> Database, $this->System);355 $TaskView = new TaskView($this->System); 356 356 $Output .= $TaskView->ItemList();; 357 357 } else $this->System->SystemMessage('Zastavení serveru', 'Nemáte oprávnění'); … … 373 373 { 374 374 $Output = $this->System->SystemMessage('Vynulování databáze', $Realm->ImportDatabase(true)); 375 $TaskView = new TaskView($this-> Database, $this->System);375 $TaskView = new TaskView($this->System); 376 376 $Output .= $TaskView->ItemList(); 377 377 //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); -
trunk/www/Base/Global.php
r69 r74 73 73 } 74 74 75 function ParseCommandLineArgs($argv) 76 { 77 array_shift($argv); 78 $out = array(); 79 foreach ($argv as $arg) 80 { 81 if(substr($arg,0,2) == '--') 82 { 83 $eqPos = strpos($arg,'='); 84 if($eqPos === false) 85 { 86 $key = substr($arg,2); 87 $out[$key] = isset($out[$key]) ? $out[$key] : true; 88 } else 89 { 90 $key = substr($arg,2,$eqPos-2); 91 $out[$key] = substr($arg,$eqPos+1); 92 } 93 } else if(substr($arg,0,1) == '-') 94 { 95 if(substr($arg,2,1) == '=') 96 { 97 $key = substr($arg,1,1); 98 $out[$key] = substr($arg,3); 99 } else 100 { 101 $chars = str_split(substr($arg,1)); 102 foreach($chars as $char) 103 { 104 $key = $char; 105 $out[$key] = isset($out[$key]) ? $out[$key] : true; 106 } 107 } 108 } else 109 { 110 $out[] = $arg; 111 } 112 } 113 return($out); 114 } 115 75 116 ?> -
trunk/www/index.php
r69 r74 2 2 3 3 include('Include.php'); 4 if(array_key_exists('argv', $_SERVER)) 5 $_GET = array_merge($_GET, ParseCommandLineArgs($_SERVER['argv'])); 4 6 5 7 // SQL injection hack protection … … 18 20 $System->AddModule(new User($System)); 19 21 if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check(); 20 else $System->Modules['User']->User['Id'] = 0; 21 22 else $System->Modules['User']->User['Id'] = $Config['Web']['UserConsoleId']; 22 23 23 24 if(array_key_exists('Module', $_GET)) $Module = $_GET['Module'];
Note:
See TracChangeset
for help on using the changeset viewer.