Changeset 524 for trunk/Modules/User
- Timestamp:
- Apr 20, 2013, 8:51:15 PM (12 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/User.php
r521 r524 1 1 <?php 2 3 include_once(dirname(__FILE__).'/UserList.php'); 2 4 3 5 define('LOGIN_USED', 'Přihlašovací jméno již použito.'); … … 47 49 class User extends Module 48 50 { 49 var $Dependencies = array('Log');50 51 var $Roles = array(); 51 52 var $User = array(); 52 var $DefaultRole = 2;53 53 var $OnlineStateTimeout = 600; // in seconds 54 54 var $PermissionCache = array(); … … 58 58 var $PasswordHash; 59 59 60 function __construct() 61 { 60 function __construct($System) 61 { 62 parent::__construct($System); 62 63 $this->PasswordHash = new PasswordHash(); 63 64 } … … 97 98 { 98 99 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); 99 if($DbRow['User'] != null) $this->System->Module s['Log']->NewRecord('User', 'Logout');100 if($DbRow['User'] != null) $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Logout'); 100 101 } 101 102 //$this->LoadPermission($this->User['Role']); … … 107 108 function Register($Login, $Password, $Password2, $Email, $Name, $PhoneNumber, $ICQ) 108 109 { 109 global $ Options, $Config;110 global $Config; 110 111 111 112 if(($Email == '') || ($Login == '') || ($Password == '') || ($Password2 == '') || ($Name == '')) $Result = DATA_MISSING; … … 155 156 156 157 $Result = USER_REGISTRATED; 157 $this->System->Module s['Log']->NewRecord('User', 'NewRegistration', $Login);158 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'NewRegistration', $Login); 158 159 } 159 160 } … … 174 175 $this->Database->update('User', 'Id='.$Row['Id'], array('Locked' => 0)); 175 176 $Output = USER_REGISTRATION_CONFIRMED; 176 $this->System->Module s['Log']->NewRecord('User', 'RegisterConfirm', 'Login='.177 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'RegisterConfirm', 'Login='. 177 178 $Row['Login'].', Id='.$Row['Id']); 178 179 } else $Output = PASSWORDS_UNMATCHED; … … 198 199 $Result = USER_LOGGED_IN; 199 200 $this->Check(); 200 $this->System->Module s['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress()));201 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress())); 201 202 } 202 203 } else $Result = USER_NOT_REGISTRED; … … 208 209 $SID = session_id(); 209 210 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null)); 210 $this->System->Module s['Log']->NewRecord('User', 'Logout', $this->User['Login']);211 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Logout', $this->User['Login']); 211 212 $this->Check(); 212 213 return(USER_LOGGED_OUT); … … 354 355 355 356 $Output = USER_PASSWORD_RECOVERY_SUCCESS; 356 $this->System->Module s['Log']->NewRecord('User', 'PasswordRecoveryRequest', 'Login='.$Login.',Email='.$Email);357 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'PasswordRecoveryRequest', 'Login='.$Login.',Email='.$Email); 357 358 } else $Output = USER_PASSWORD_RECOVERY_FAIL; 358 359 return($Output); … … 373 374 'Salt' => $Salt, 'Locked' => 0)); 374 375 $Output = USER_PASSWORD_RECOVERY_CONFIRMED; 375 $this->System->Module s['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'Login='.$Row['Login']);376 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'Login='.$Row['Login']); 376 377 } else $Output = PASSWORDS_UNMATCHED; 377 378 } else $Output = USER_NOT_FOUND; … … 380 381 } 381 382 383 class ModuleUser extends AppModule 384 { 385 function __construct($System) 386 { 387 parent::__construct($System); 388 $this->Name = 'User'; 389 $this->Version = '1.0'; 390 $this->Creator = 'Chronos'; 391 $this->License = 'GNU/GPLv3'; 392 $this->Description = 'User management'; 393 $this->Dependencies = array(); 394 } 395 396 function Install() 397 { 398 } 399 400 function Uninstall() 401 { 402 } 403 404 function Start() 405 { 406 parent::Start(); 407 $this->System->User = new User($this->System); 408 if(isset($_SERVER['REMOTE_ADDR'])) $this->System->User->Check(); 409 $this->System->RegisterPage('userlist', 'PageUserList'); 410 } 411 412 function Stop() 413 { 414 } 415 } 416 382 417 ?>
Note:
See TracChangeset
for help on using the changeset viewer.