Changeset 493 for trunk/Common
- Timestamp:
- Mar 1, 2013, 9:20:14 PM (12 years ago)
- Location:
- trunk/Common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Page.php
r485 r493 158 158 if($this->System->Config['Web']['UserSupport'] == 1) 159 159 { 160 if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId)160 if($this->System->Modules['User']->User['Id'] == null) 161 161 $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>'; 162 162 else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>'; -
trunk/Common/Update.php
r491 r493 8 8 var $Trace; 9 9 var $VersionTable; 10 /* @var Database */ 10 11 var $Database; 11 12 var $InstallMethod; … … 16 17 $this->Trace = array(); 17 18 $this->VersionTable = 'SystemVersion'; 19 $this->InstallMethod = 'FullInstall'; 20 $this->InsertSampleDataMethod = 'InsertSampleData'; 18 21 } 19 22 … … 28 31 { 29 32 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 30 return($DbResult->num_rows > 0); 33 return($DbResult->num_rows > 0); 31 34 } 32 35 … … 63 66 } 64 67 68 function InsertSampleData() 69 { 70 $InstallMethod = $this->InsertSampleDataMethod; 71 $InstallMethod($this); 72 } 73 65 74 function Execute($Query) 66 75 { 67 echo($Query.' <br/>');76 echo($Query.';<br/>'); 68 77 flush(); 69 78 $this->Database->query($Query); … … 110 119 if(!$this->UpdateManager->IsUpToDate()) 111 120 $Output .= '<input type="submit" name="update" value="Aktualizovat"/> '; 121 $Output .= '<input type="submit" name="insert_sample_data" value="Vložit vzorová data"/> '; 112 122 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/> '; 113 123 } else $Output .= '<input type="submit" name="install" value="Instalovat"/> '; … … 120 130 function Show() 121 131 { 122 session_start();123 124 132 $Output = '<?xml version="1.0" encoding="utf-8"?> 125 133 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> … … 167 175 { 168 176 $Output .= '<h3>Aktualizace</h3>'; 169 $ UpdateManager->Update();177 $this->UpdateManager->Update(); 170 178 $Output .= $this->ControlPanel(); 171 179 } else … … 173 181 { 174 182 $Output .= '<h3>Instalace</h3>'; 175 $UpdateManager->Install(); 183 $this->UpdateManager->Install(); 184 $this->UpdateManager->Update(); 176 185 $Output .= $this->ControlPanel(); 177 186 } else … … 179 188 { 180 189 $Output .= '<h3>Odinstalace</h3>'; 181 $UpdateManager->Uninstall(); 190 $this->UpdateManager->Uninstall(); 191 $Output .= $this->ControlPanel(); 192 } else 193 if(array_key_exists('insert_sample_data', $_POST)) 194 { 195 $Output .= '<h3>Vložení vzorových dat</h3>'; 196 $this->UpdateManager->InsertSampleData(); 182 197 $Output .= $this->ControlPanel(); 183 198 } else -
trunk/Common/User.php
r439 r493 51 51 var $User = array(); 52 52 var $DefaultRole = 2; 53 var $AnonymousUserId = 98;54 53 var $OnlineStateTimeout = 600; // in seconds 55 54 var $PermissionCache = array(); … … 74 73 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 75 74 } else $this->Database->insert('UserOnline', array('SessionId' => $SID, 76 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()',75 'User' => null, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 77 76 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 78 77 'ScriptName' => $_SERVER['PHP_SELF'])); 79 //echo($this->Database->LastQuery);80 78 81 79 // Check login 82 80 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 83 81 $Row = $Query->fetch_assoc(); 84 if($Row['User'] != $this->AnonymousUserId)82 if($Row['User'] != '') 85 83 { 86 84 $Query = $this->Database->query('SELECT User.*, UserCustomerRel.Customer AS Member FROM User LEFT JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']); … … 89 87 } else 90 88 { 91 $Query = $this->Database->select('User', '*', 'Id ='.$this->AnonymousUserId);92 $this->User = $Query->fetch_assoc();89 $Query = $this->Database->select('User', '*', 'Id IS NULL'); 90 $this->User = array('Id' => null, 'Member' => null); 93 91 $Result = USER_NOT_LOGGED; 94 92 } … … 99 97 { 100 98 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); 101 if($DbRow['User'] != $this->AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');99 if($DbRow['User'] != null) $this->System->Modules['Log']->NewRecord('User', 'Logout'); 102 100 } 103 101 //$this->LoadPermission($this->User['Role']); … … 198 196 // načtení stavu stromu 199 197 $Result = USER_LOGGED_IN; 198 $this->Check(); 200 199 $this->System->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress())); 201 200 } 202 201 } else $Result = USER_NOT_REGISTRED; 203 $this->Check();204 202 return($Result); 205 203 } … … 208 206 { 209 207 $SID = session_id(); 210 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId));208 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null)); 211 209 $this->System->Modules['Log']->NewRecord('User', 'Logout', $this->User['Login']); 212 210 $this->Check(); -
trunk/Common/Version.php
r491 r493 1 1 <?php 2 2 3 $Revision = 49 1; // Subversion revision4 $DatabaseRevision = 49 1;5 $ReleaseTime = '2013-0 2-25';3 $Revision = 493; // Subversion revision 4 $DatabaseRevision = 493; 5 $ReleaseTime = '2013-03-01'; 6 6 7 7 ?>
Note:
See TracChangeset
for help on using the changeset viewer.