Changeset 356
- Timestamp:
- Jan 18, 2012, 10:21:43 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/User.php
r347 r356 34 34 var $AnonymousUserId = 98; 35 35 var $OnlineStateTimeout = 600; // in seconds 36 var $PermissionCache = array(); 36 37 37 38 function __construct($Database, $System) … … 226 227 function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0) 227 228 { 228 $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"'); 229 if($DbResult->num_rows > 0) 230 { 231 $DbRow = $DbResult->fetch_array(); 232 $OperationId = $DbRow['Id']; 233 229 // First try to check cache 230 if(in_array(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache)) 231 { 232 $OperationId = array_search(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache); 233 $PermissionExists = is_numeric($OperationId); 234 } else 235 { 236 // If no permission combination exists in cache, do new check of database items 237 $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"'); 238 if($DbResult->num_rows > 0) 239 { 240 $DbRow = $DbResult->fetch_array(); 241 $OperationId = $DbRow['Id']; 242 $this->PermissionCache[$DbRow['Id']] = array($Module, $Operation, $ItemType, $ItemType); 243 $PermissionExists = true; 244 } else 245 { 246 $this->PermissionCache[$DbRow['Id'].'_'] = array($Module, $Operation, $ItemType, $ItemType); 247 $PermissionExists = false; 248 } 249 } 250 251 if($PermissionExists) 252 { 234 253 // Check user-operation relation 235 254 $DbResult = $this->Database->select('PermissionUserAssignment', '*', '`User`="'.$this->User['Id'].'" AND `GroupOrOperation`="'.$OperationId.'" AND `Type`="Operation"'); … … 240 259 while($DbRow = $DbResult->fetch_array()) 241 260 { 242 261 if($this->CheckGroupPermission($DbRow['GroupOrOperation'], $OperationId) == true) return(true); 243 262 } 244 263 return(false); -
trunk/forms.php
r302 r356 2 2 3 3 include_once('form_classes.php'); 4 include_once(' database.php');4 include_once('Common/Database.php'); 5 5 6 6 class Form -
trunk/global.php
r355 r356 6 6 else die('Nenalezen konfigurační soubor '.$ConfigFileName.'!'); 7 7 8 include_once(' database.php');8 include_once('Common/Database.php'); 9 9 include_once('Common/Error.php'); 10 10 include_once('Common/Code.php'); … … 204 204 $System = new System($Database); 205 205 $System->Config = &$Config; 206 $System->ReloadList();207 $System->Install();206 //$System->ReloadList(); 207 //$System->Install(); 208 208 $System->Init(); 209 209 if(isset($_SERVER['REMOTE_ADDR'])) $System->Models['User']->Check(); -
trunk/system/generators/common.php
r288 r356 1 1 <?php 2 2 3 include_once('../../ network_address.php');3 include_once('../../Common/NetworkAddress.php'); 4 4 5 5 function GetMarkByComment($Comment)
Note:
See TracChangeset
for help on using the changeset viewer.