Changeset 15 for user.php


Ignore:
Timestamp:
Oct 19, 2008, 8:16:37 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Mezitabulkovéí odkazy na položky jsou nyní realizovány jako odkazy na id položky(ItemId) namísto id řádku v tabulce(Id).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • user.php

    r9 r15  
    6969    {
    7070      $this->Database->delete($this->TableUserOnline, 'User='.$DbRow['User']);
    71       $this->System->Modules['Log']->NewRecord('User', 'Logout');
     71      //$this->System->Modules['Log']->Add('User', 'Logout');
    7272    }
    7373    //$this->LoadPermission($this->User['Role']);
     
    102102          mail($Email, $Subject, $Message, $AdditionalHeaders);
    103103          $Result = USER_REGISTRATED;
    104           $this->System->Modules['Log']->NewRecord('User', 'NewRegistration', $Nick);
     104          //$this->System->Modules['Log']->NewRecord('User', 'NewRegistration', $Nick);
    105105        }
    106106      }
     
    119119        $this->Database->update($this->TableUser, 'Id='.$Row['Id'], array('Locked' => 0));
    120120        $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']);
    122122      } else $Output = PASSWORDS_UNMATCHED;
    123123    } else $Output = USER_NOT_FOUND;
     
    141141        // načtení stavu stromu
    142142        $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()));
    144144      }
    145145    } else $Result = USER_NOT_REGISTRED;
     
    154154    $SID = session_id();
    155155    $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']);
    157157    $this->Check();
    158158    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 relation
    195     $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 relation
    202     $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 relation
    216       $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 relation
    220       $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);
    227159  }
    228160
     
    242174      mail($Row['Email'], $Subject, $Message, $AdditionalHeaders);
    243175      $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);
    245177    } else $Output = USER_PASSWORD_RECOVERY_FAIL;
    246178    return($Output);
     
    258190        $this->Database->update($this->TableUser, 'Id='.$Row['Id'], array('Password' => sha1($NewPassword), 'Locked' => 0));
    259191        $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']);
    261193      } else $Output = PASSWORDS_UNMATCHED;
    262194    } else $Output = USER_NOT_FOUND;
Note: See TracChangeset for help on using the changeset viewer.