Changeset 619
- Timestamp:
- Dec 26, 2013, 7:37:44 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r616 r619 1 1 <?php 2 2 3 $Revision = 61 6; // Subversion revision4 $DatabaseRevision = 61 5; // SQL structure revision5 $ReleaseTime = '2013-12-2 2';3 $Revision = 619; // Subversion revision 4 $DatabaseRevision = 619; // SQL structure revision 5 $ReleaseTime = '2013-12-26'; -
trunk/Common/Setup/Setup.php
r613 r619 97 97 { 98 98 $Output .= '<h3>Povýšení</h3>'; 99 $Output .= $this->System->Setup->Upgrade(); 100 $Output .= $this->ControlPanel(); 99 try { 100 $Output .= $this->System->Setup->Upgrade(); 101 } catch (Exception $E) { 102 $Output .= $this->SystemMessage('Chyba aktualizace', 'Došlo k chybě v SQL dotazu při aktualizaci: <br/>'.$E->getMessage()); 103 } 104 $Output .= $this->ControlPanel(); 101 105 } else 102 106 if($Action == 'install') -
trunk/Common/Setup/Update.php
r612 r619 49 49 echo($Output); 50 50 $Output = ''; 51 $RevUpdate = $TraceItem['Function']; 52 53 51 $RevUpdate = $TraceItem['Function']; 52 $RevUpdate($this); 53 $DbRevision = $TraceItem['Revision']; 54 54 $this->Database->query('UPDATE `'.$this->VersionTable.'` SET `Revision`= '.$TraceItem['Revision'].' WHERE `Id`=1'); 55 55 } -
trunk/Common/Setup/Updates.php
r615 r619 523 523 } 524 524 525 function UpdateTo619($Manager) 526 { 527 $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLogged` INT NOT NULL ;'); 528 } 529 525 530 class Updates 526 531 { … … 554 559 597 => array('Revision' => 601, 'Function' => 'UpdateTo601'), 555 560 601 => array('Revision' => 615, 'Function' => 'UpdateTo615'), 561 615 => array('Revision' => 619, 'Function' => 'UpdateTo619'), 556 562 )); 557 563 } -
trunk/Modules/Network/Network.php
r615 r619 156 156 )); 157 157 $this->System->FormManager->RegisterClass('NetworkDomainAlias', array( 158 159 160 161 162 163 164 158 'Title' => 'Alias domény', 159 'Table' => 'NetworkDomainAlias', 160 'Items' => array( 161 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 162 'Target' => array('Type' => 'String', 'Caption' => 'Cíl', 'Default' => ''), 163 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''), 164 ), 165 165 )); 166 166 $this->System->FormManager->RegisterClass('NetworkDevice', array( 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 167 'Title' => 'Síťové zařízení', 168 'Table' => 'NetworkDevice', 169 'Items' => array( 170 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 171 'Type' => array('Type' => 'TNetworkDeviceType', 'Caption' => 'Typ', 'Default' => '0'), 172 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'), 173 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'), 174 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true), 175 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '1'), 176 'Online' => array('Type' => 'Boolean', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true), 177 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true), 178 'PermanentOnline' => array('Type' => 'Boolean', 'Caption' => 'Běží stále', 'Default' => '0'), 179 'Interfaces' => array('Type' => 'TInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''), 180 'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '0', 'Null' => true), 181 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => '', 'Null' => true), 182 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => '', 'Null' => true), 183 ), 184 'Actions' => array( 185 array('Caption' => 'Dostupnost zařízení', 'URL' => '/network/availability/'), 186 ), 187 187 )); 188 188 $this->System->FormManager->RegisterClass('NetworkDeviceType', array( 189 190 191 192 193 194 195 189 'Title' => 'Typ síťového zařízení', 190 'Table' => 'NetworkDeviceType', 191 'Items' => array( 192 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 193 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'), 194 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'), 195 ), 196 196 )); 197 197 $this->System->FormManager->RegisterClass('NetworkInterface', array( 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 198 'Title' => 'Síťové rozhraní', 199 'Table' => 'NetworkInterface', 200 'Items' => array( 201 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 202 'Type' => array('Type' => 'TNetworkInterfaceType', 'Caption' => 'Typ', 'Default' => '0'), 203 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''), 204 'LocalIP' => array('Type' => 'IPv4Address', 'Caption' => 'IPv4', 'Default' => ''), 205 'IPv6' => array('Type' => 'IPv6Address', 'Caption' => 'IPv6', 'Default' => '', 'Null' => true), 206 'ExternalIP' => array('Type' => 'IPv4Address', 'Caption' => 'Veřejná IPv4', 'Default' => '', 'Null' => true), 207 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''), 208 'Online' => array('Type' => 'Boolean', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true), 209 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true), 210 'Links1' => array('Type' => 'TNetworkLinkListInterface1', 'Caption' => 'Propojení 1', 'Default' => ''), 211 'Links2' => array('Type' => 'TNetworkLinkListInterface2', 'Caption' => 'Propojení 2', 'Default' => ''), 212 ), 213 213 )); 214 214 $this->System->FormManager->RegisterClass('NetworkInterfaceType', array( 215 216 217 218 219 220 221 222 215 'Title' => 'Typ síťového rozhraní', 216 'Table' => 'NetworkInterfaceType', 217 'Items' => array( 218 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 219 'MaxSpeed' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0', 'Suffix' => 'Mbit/s'), 220 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'), 221 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'), 222 ), 223 223 )); 224 224 $this->System->FormManager->RegisterClass('NetworkSubnet', array( 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 225 'Title' => 'Podsítě', 226 'DefaultSortColumn' => 'Name', 227 'Table' => 'NetworkSubnet', 228 'Items' => array( 229 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 230 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''), 231 'Mask' => array('Type' => 'Integer', 'Caption' => 'Prefix', 'Default' => ''), 232 'DHCP' => array('Type' => 'IPv4Address', 'Caption' => 'DHCP', 'Default' => ''), 233 'Gateway' => array('Type' => 'IPv4Address', 'Caption' => 'Brána', 'Default' => ''), 234 'WINS' => array('Type' => 'IPv4Address', 'Caption' => 'WINS', 'Default' => ''), 235 'DNS' => array('Type' => 'String', 'Caption' => 'DNS', 'Default' => ''), 236 'Domain' => array('Type' => 'String', 'Caption' => 'Doména', 'Default' => ''), 237 'NTP' => array('Type' => 'String', 'Caption' => 'NTP', 'Default' => ''), 238 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'Null' => true), 239 'ExtAddressRange' => array('Type' => 'String', 'Caption' => 'Vnější rozsah adres', 'Default' => ''), 240 'ExtMask' => array('Type' => 'String', 'Caption' => 'Vnější prefix', 'Default' => ''), 241 'AddressRangeIPv6' => array('Type' => 'String', 'Caption' => 'Rozsah adres IPv6', 'Default' => ''), 242 'Configure' => array('Type' => 'Boolean', 'Caption' => 'Nastavovat', 'Default' => ''), 243 ), 244 244 )); 245 245 $this->System->FormManager->RegisterClass('NetworkLink', array( -
trunk/Modules/Portal/Portal.php
r599 r619 86 86 'Username' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 87 87 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 88 'StayLogged' => array('Type' => 'Boolean', 'Caption' => 'Zůstat přihlášen', 'Default' => '0'), 88 89 ), 89 90 )); … … 242 243 $Form->SetClass('UserLogin'); 243 244 $Form->OnSubmit = '?Action=Login'; 244 $Result = $this->System->User->Login($_POST['Username'], $_POST['Password']); 245 if($_POST['StayLogged'] == 0) $StayLogged = true; 246 else $StayLogged = false; 247 $Result = $this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged); 245 248 $Output .= $this->SystemMessage('Přihlášení', $Result); 246 249 if($Result <> USER_LOGGED_IN) -
trunk/Modules/User/User.php
r605 r619 42 42 function GetSalt() 43 43 { 44 mt_srand(microtime(true) *100000 + memory_get_usage(true));44 mt_srand(microtime(true) * 100000 + memory_get_usage(true)); 45 45 return sha1(uniqid(mt_rand(), true)); 46 46 } … … 53 53 var $Roles = array(); 54 54 var $User = array(); 55 var $OnlineStateTimeout = 600; // in seconds55 var $OnlineStateTimeout; 56 56 var $PermissionCache = array(); 57 57 var $PermissionGroupCache = array(); … … 63 63 { 64 64 parent::__construct($System); 65 $this->OnlineStateTimeout = 600; // in seconds 65 66 $this->PasswordHash = new PasswordHash(); 66 67 } … … 81 82 82 83 // Check login 83 $Query = $this->Database->select('UserOnline', '*', ' SessionId="'.$SID.'"');84 $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"'); 84 85 $Row = $Query->fetch_assoc(); 85 86 if($Row['User'] != '') 86 87 { 87 $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']); 88 $Query = $this->Database->query('SELECT `User`.*, `UserCustomerRel`.`Customer` AS `Member` FROM `User` '. 89 ' LEFT JOIN `UserCustomerRel` ON `UserCustomerRel`.`User`=`User`.`Id` WHERE `User`.`Id`='.$Row['User']); 88 90 $this->User = $Query->fetch_assoc(); 89 91 $Result = USER_LOGGED; … … 96 98 97 99 // Remove nonactive users 98 $DbResult = $this->Database->select('UserOnline', ' Id, User', 'ActivityTime < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)');100 $DbResult = $this->Database->select('UserOnline', '`Id`, `User`', '(`ActivityTime` < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)) AND (`StayLogged` = 0)'); 99 101 while($DbRow = $DbResult->fetch_array()) 100 102 { … … 181 183 } 182 184 183 function Login($Login, $Password )185 function Login($Login, $Password, $StayLogged = false) 184 186 { 185 187 $SID = session_id(); … … 194 196 { 195 197 $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => GetRemoteAddress())); 196 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id'] ));198 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id'], 'StayLogged' => $StayLogged)); 197 199 198 200 $Result = USER_LOGGED_IN;
Note:
See TracChangeset
for help on using the changeset viewer.