Changeset 426
- Timestamp:
- Oct 10, 2012, 8:28:07 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/database.php
r414 r426 78 78 function delete($Table, $Condition) 79 79 { 80 $this-> PDO->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);80 $this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 81 81 } 82 82 … … 93 93 $Name = substr($Name, 1); 94 94 $Values = substr($Values, 1); 95 $this-> PDO->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');95 $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 96 96 $this->insert_id = $this->PDO->lastInsertId(); 97 97 } … … 106 106 } 107 107 $Values = substr($Values, 2); 108 $this-> PDO->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');108 $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')'); 109 109 } 110 110 … … 122 122 $Values = substr($Values, 1); 123 123 //echo('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES ('.$Values.')<br />'); 124 $this-> PDO->query('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');124 $this->query('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 125 125 //echo($this->error().'<br>'); 126 126 } … … 128 128 function charset($Charset) 129 129 { 130 $this-> PDO->query('SET NAMES "'.$Charset.'"');130 $this->query('SET NAMES "'.$Charset.'"'); 131 131 } 132 132 -
trunk/forms.php
r302 r426 20 20 { 21 21 if(!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit'; 22 $Output = '<form class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().'<div><input type="submit" value="'.$this->Definition['SubmitText'].'" /></div></form>'; 22 $Output = '<form class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock(). 23 '<div><input type="submit" value="'.$this->Definition['SubmitText'].'" /> '. 24 '<input type="button" value="Zrušit" onclick="location.href=\'?\'"/></div></form>'; 23 25 return($Output); 24 26 } -
trunk/network/user_hosts.php
r245 r426 14 14 $Output = '<div align="center" style="font-size: small;"><table class="WideTable">'; 15 15 $Output .= '<tr><th>Jméno počítače</th><th>Místní adresa</th><th>Veřejná adresa</th><th>CZFree adresa</th><th>Fyzická adresa</th><th>Typ</th><th>Naposledy online</th></tr>'; 16 $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = '.$this->System->Modules['User']->User['Member'].'ORDER BY NetworkDevice.Name');16 $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->Modules['User']->User['Id'].') ORDER BY NetworkDevice.Name'); 17 17 while($Device = $DbResult->fetch_assoc()) 18 18 { -
trunk/page.php
r323 r426 17 17 'map' => array('', 18 18 'index.php' => 'Mapa sítě', 19 ), 20 'tv' => array('', 21 'index.php' => 'Síťová televize', 19 22 ), 20 23 'network' => array('', -
trunk/user.php
r416 r426 36 36 var $PermissionCache = array(); 37 37 var $PermissionGroupCache = array(); 38 var $PermissionGroupCacheOp = array(); 38 39 39 40 function Check() … … 54 55 if($Row['User'] != $this->AnonymousUserId) 55 56 { 56 $Query = $this->Database->query('SELECT User.*, UserCustomerRel.Customer AS Member FROM User JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']);57 $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']); 57 58 $this->User = $Query->fetch_assoc(); 58 59 $Result = USER_LOGGED; … … 218 219 } 219 220 220 221 221 // Check group-operation relation 222 $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `AssignedOperation`="'.$OperationId.'"'); 223 if($DbResult->num_rows > 0) return(true); 222 if(array_key_exists($GroupId.','.$OperationId, $this->PermissionGroupCacheOp)) 223 { 224 $PermissionExists = true; 225 } else 226 { 227 // If no permission combination exists in cache, do new check of database items 228 $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `AssignedOperation`="'.$OperationId.'"'); 229 if($DbResult->num_rows > 0) $this->PermissionGroupCacheOp[$GroupId.','.$OperationId] = true; 230 else $this->PermissionGroupCacheOp[$GroupId.','.$OperationId] = false; 231 $PermissionExists = true; 232 } 233 if($PermissionExists) 234 { 235 return($this->PermissionGroupCacheOp[$GroupId.','.$OperationId]); 236 } 224 237 return(false); 225 238 } … … 227 240 function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0) 228 241 { 242 //echo('Check '.$Module.' '.$Operation.' '.$ItemType.' '.$ItemIndex); 243 // 229 244 // First try to check cache 230 245 if(in_array(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache)) 231 246 { 232 $OperationId = array_search(array($Module, $Operation, $ItemType, $Item Type), $this->PermissionCache);247 $OperationId = array_search(array($Module, $Operation, $ItemType, $ItemIndex), $this->PermissionCache); 233 248 $PermissionExists = is_numeric($OperationId); 234 249 } else … … 240 255 $DbRow = $DbResult->fetch_array(); 241 256 $OperationId = $DbRow['Id']; 242 $this->PermissionCache[$DbRow['Id']] = array($Module, $Operation, $ItemType, $Item Type);257 $this->PermissionCache[$DbRow['Id']] = array($Module, $Operation, $ItemType, $ItemIndex); 243 258 $PermissionExists = true; 244 259 } else 245 260 { 246 $this->PermissionCache[$DbRow['Id'].'_'] = array($Module, $Operation, $ItemType, $Item Type);261 $this->PermissionCache[$DbRow['Id'].'_'] = array($Module, $Operation, $ItemType, $ItemIndex); 247 262 $PermissionExists = false; 248 263 }
Note:
See TracChangeset
for help on using the changeset viewer.