Legend:
- Unmodified
- Added
- Removed
-
user.php
r9 r15 69 69 { 70 70 $this->Database->delete($this->TableUserOnline, 'User='.$DbRow['User']); 71 $this->System->Modules['Log']->NewRecord('User', 'Logout');71 //$this->System->Modules['Log']->Add('User', 'Logout'); 72 72 } 73 73 //$this->LoadPermission($this->User['Role']); … … 102 102 mail($Email, $Subject, $Message, $AdditionalHeaders); 103 103 $Result = USER_REGISTRATED; 104 $this->System->Modules['Log']->NewRecord('User', 'NewRegistration', $Nick);104 //$this->System->Modules['Log']->NewRecord('User', 'NewRegistration', $Nick); 105 105 } 106 106 } … … 119 119 $this->Database->update($this->TableUser, 'Id='.$Row['Id'], array('Locked' => 0)); 120 120 $Output = USER_REGISTRATION_CONFIRMED; 121 $this->System->Modules['Log']->NewRecord('User', 'RegisterConfirm', 'UserName='.$Row['Name']);121 //$this->System->Modules['Log']->NewRecord('User', 'RegisterConfirm', 'UserName='.$Row['Name']); 122 122 } else $Output = PASSWORDS_UNMATCHED; 123 123 } else $Output = USER_NOT_FOUND; … … 141 141 // načtení stavu stromu 142 142 $Result = USER_LOGGED_IN; 143 $this->System->Modules['Log']->NewRecord('User', 'Login', 'Nick='.$Nick.',Host='.gethostbyaddr(GetRemoteAddress()));143 //$this->System->Modules['Log']->NewRecord('User', 'Login', 'Nick='.$Nick.',Host='.gethostbyaddr(GetRemoteAddress())); 144 144 } 145 145 } else $Result = USER_NOT_REGISTRED; … … 154 154 $SID = session_id(); 155 155 $this->Database->update($this->TableUserOnline, 'SessionId="'.$SID.'"', array('User' => 0)); 156 $this->System->Modules['Log']->NewRecord('User', 'Logout', $this->User['Name']);156 //$this->System->Modules['Log']->NewRecord('User', 'Logout', $this->User['Name']); 157 157 $this->Check(); 158 158 return(USER_LOGGED_OUT); 159 }160 161 function LoadRoles()162 {163 $this->Roles = array();164 $DbResult = $this->Database->select('UserRole', '*');165 while($DbRow = $DbResult->fetch_array())166 $this->Roles[] = $DbRow;167 }168 169 function LoadPermission($Role)170 {171 $this->User['Permission'] = array();172 $DbResult = $this->Database->query('SELECT `UserRolePermission`.*, `PermissionOperation`.`Description` FROM `UserRolePermission` JOIN `PermissionOperation` ON `PermissionOperation`.`Id` = `UserRolePermission`.`Operation` WHERE `UserRolePermission`.`Role` = '.$Role);173 if($DbResult->num_rows > 0)174 while($DbRow = $DbResult->fetch_array())175 $this->User['Permission'][$DbRow['Operation']] = $DbRow;176 }177 178 function PermissionMatrix()179 {180 $Result = array();181 $DbResult = $this->Database->query('SELECT `UserRolePermission`.*, `PermissionOperation`.`Description`, `UserRole`.`Title` FROM `UserRolePermission` LEFT JOIN `PermissionOperation` ON `PermissionOperation`.`Id` = `UserRolePermission`.`Operation` LEFT JOIN `UserRole` ON `UserRole`.`Id` = `UserRolePermission`.`Role`');182 while($DbRow = $DbResult->fetch_array())183 {184 $Value = '';185 if($DbRow['Read']) $Value .= 'R';186 if($DbRow['Write']) $Value .= 'W';187 $Result[$DbRow['Description']][$DbRow['Title']] = $Value;188 }189 return($Result);190 }191 192 function CheckGroupPermission($GroupId, $OperationId)193 {194 // Check group-group relation195 $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `Type`="Group"');196 while($DbRow = $DbResult->fetch_array())197 {198 if($this->CheckGroupPermission($DbRow['GroupOrOperation'], $OperationId) == true) return(true);199 }200 201 // Check group-operation relation202 $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `GroupOrOperation`="'.$OperationId.'" AND `Type`="Operation"');203 if($DbResult->num_rows > 0) return(true);204 return(false);205 }206 207 function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0)208 {209 $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"');210 if($DbResult->num_rows > 0)211 {212 $DbRow = $DbResult->fetch_array();213 $OperationId = $DbRow['Id'];214 215 // Check user-operation relation216 $DbResult = $this->Database->select('PermissionUserAssignment', '*', '`User`="'.$this->User['Id'].'" AND `GroupOrOperation`="'.$OperationId.'" AND `Type`="Operation"');217 if($DbResult->num_rows > 0) return(true);218 219 // Check user-group relation220 $DbResult = $this->Database->select('PermissionUserAssignment', 'GroupOrOperation', '`User`="'.$this->User['Id'].'" AND `Type`="Group"');221 while($DbRow = $DbResult->fetch_array())222 {223 if($this->CheckGroupPermission($DbRow['GroupOrOperation'], $OperationId) == true) return(true);224 }225 return(false);226 } else return(false);227 159 } 228 160 … … 242 174 mail($Row['Email'], $Subject, $Message, $AdditionalHeaders); 243 175 $Output = USER_PASSWORD_RECOVERY_SUCCESS; 244 $this->System->Modules['Log']->NewRecord('User', 'PasswordRecoveryRequest', 'UserName='.$Name.',Email='.$Email);176 //$this->System->Modules['Log']->NewRecord('User', 'PasswordRecoveryRequest', 'UserName='.$Name.',Email='.$Email); 245 177 } else $Output = USER_PASSWORD_RECOVERY_FAIL; 246 178 return($Output); … … 258 190 $this->Database->update($this->TableUser, 'Id='.$Row['Id'], array('Password' => sha1($NewPassword), 'Locked' => 0)); 259 191 $Output = USER_PASSWORD_RECOVERY_CONFIRMED; 260 $this->System->Modules['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'UserName='.$Row['Name']);192 //$this->System->Modules['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'UserName='.$Row['Name']); 261 193 } else $Output = PASSWORDS_UNMATCHED; 262 194 } else $Output = USER_NOT_FOUND;
Note:
See TracChangeset
for help on using the changeset viewer.