- Timestamp:
- Oct 7, 2012, 8:37:15 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 6 6 postfixadmin 7 7 backup 8 .project 9 .buildpath 10 .settings
-
- Property svn:ignore
-
trunk/finance/spotreba.php
r409 r415 14 14 $Output = 'Spotřeba zařízení jednotlivých segmentů:<div align="center"><table class="WideTable"><tr><th>Jméno segmentu</th><th>Spotřeba [W]</th><th>Cena [Kč/měsíc]</th></tr>'; 15 15 $CelkovaSpotreba = 0; 16 $DbResult = $this->Database->query( "SELECT * FROM NetworkSegment");16 $DbResult = $this->Database->query('SELECT * FROM NetworkSegment'); 17 17 while($Segment = $DbResult->fetch_array()) 18 18 { 19 $DbResult2 = $this->Database->query( "SELECT SUM(Consumption) FROM Product WHERE Segment=".$Segment['Id']." AND Used=1");19 $DbResult2 = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE Segment='.$Segment['Id'].' AND Used=1'); 20 20 $Row2 = $DbResult2->fetch_array(); 21 21 $CelkovaSpotreba = $CelkovaSpotreba + $Row2[0]; 22 $Output .= '<tr><td>'.$ Row['Name'].'</td><td align="right">'.$Row2[0].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2[0]).'</td></tr>';22 $Output .= '<tr><td>'.$Segment['Name'].'</td><td align="right">'.$Row2[0].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2[0]).'</td></tr>'; 23 23 } 24 24 $Output .= '<tr style="font-weight: Bold;"><td><strong>Celkem</strong></td><td align="right">'.$CelkovaSpotreba.'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($CelkovaSpotreba).'</td></tr>'; -
trunk/finance/user_state.php
r413 r415 22 22 if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění'); 23 23 $UserId = $this->System->Modules['User']->User['Id']; 24 $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Customer FROM UserCustomerRel WHERE User='.$UserId.' ))');24 $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Customer FROM UserCustomerRel WHERE User='.$UserId.' LIMIT 1))'); 25 25 $Subject = $DbResult->fetch_assoc(); 26 26 } -
trunk/index.php
r305 r415 9 9 var $ShortTitle = ''; 10 10 11 function ShowLinks($GroupId) 12 { 13 global $Database; 14 15 $DbResult = $Database->query('SELECT * FROM `HyperlinkGroup` WHERE `Id`='.$GroupId); 16 $HyperlinkGroup = $DbResult->fetch_assoc(); 17 11 function ShowLinks($HyperlinkGroup) 12 { 18 13 $Output = ''; 19 $DbResult = $ Database->query('SELECT * FROM `Hyperlink` WHERE (`Group`='.$GroupId.') AND (`Enable` = 1)');14 $DbResult = $this->Database->query('SELECT * FROM `Hyperlink` WHERE (`Group`='.$HyperlinkGroup['Id'].') AND (`Enable` = 1)'); 20 15 while($HyperLink = $DbResult->fetch_assoc()) 21 16 { 22 17 if($HyperLink['IconFile'] == '') $HyperLink['IconFile'] = 'clear.png'; 23 18 if(substr($HyperLink['URL'], 0, 4) != 'http') $HyperLink['URL'] = $this->System->Config['Web']['RootFolder'].$HyperLink['URL']; 24 if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System->Modules['User']-> CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation'])))19 if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System->Modules['User']->Models['User']->CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation']))) 25 20 $Output .= '<img alt="'.$HyperLink['Name'].'" src="images/favicons/'.$HyperLink['IconFile'].'" width="16" height="16" /> <a href="'.$HyperLink['URL'].'">'.$HyperLink['Name'].'</a><br />'; 26 21 } … … 63 58 if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) 64 59 { 65 $DbResult = $this->Database->select(' Subject', 'Money', 'Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$this->System->Modules['User']->User['Id'].'))');60 $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.$this->System->Modules['User']->User['Id'].')'); 66 61 if($DbResult->num_rows > 0) 67 62 { 68 63 $DbRow = $DbResult->fetch_assoc(); 69 $Output2 .= ' <img alt="" src="images/favicons/money.png" width="16" height="16" /> '.$DbRow[' Money'].' Kč';64 $Output2 .= ' <img alt="" src="images/favicons/money.png" width="16" height="16" /> '.$DbRow['Cash'].' Kč'; 70 65 } 71 66 } … … 273 268 $Database->select_db($Config['Database']['Database']); 274 269 270 $DbResult = $Database->query('SELECT * FROM `HyperlinkGroup`'); 271 while($DbRow = $DbResult->fetch_assoc()) 272 $HyperlinkGroups[$DbRow['Id']] = $DbRow; 273 275 274 // Show pannels 276 275 //if(IsInternetAddr()) echo('Internet'); else echo('LAN'); 277 //$Output .= $this->InfoBar();276 $Output .= $this->InfoBar(); 278 277 $Output .= '<table id="MainTable"><tr>'; 279 278 $DbResult = $Database->select('PanelColumn', '*'); … … 283 282 else $Width = ''; 284 283 $Output .= '<td valign="top"'.$Width.'>'; 285 $DbResult2 = $Database->query('SELECT * FROM 284 $DbResult2 = $Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`'); 286 285 while($Panel = $DbResult2->fetch_assoc()) 287 286 { 288 if($Panel['Module'] == 'HyperlinkGroup') $Output .= $this->ShowLinks($ Panel['Parameters']);287 if($Panel['Module'] == 'HyperlinkGroup') $Output .= $this->ShowLinks($HyperlinkGroups[$Panel['Parameters']]); 289 288 else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList()); 290 289 else if($Panel['Module'] == 'UserOptions') -
trunk/sql/updates/409.sql
r409 r415 6 6 CHANGE `pos` `Pos` INT( 11 ) NOT NULL DEFAULT '0', 7 7 CHANGE `first` `First` INT( 11 ) NOT NULL DEFAULT '0', 8 CHANGE `last` `Last` INT( 11 ) NOT NULL DEFAULT '0' 8 CHANGE `last` `Last` INT( 11 ) NOT NULL DEFAULT '0'; 9 9 10 10 -
trunk/sql/updates/410.sql
r410 r415 9 9 10 10 ALTER TABLE `UserCustomerRel` 11 ADD CONSTRAINT `usercustomerrel_ibfk_2` FOREIGN KEY (`User`) REFERENCES ` user` (`Id`),12 ADD CONSTRAINT `usercustomerrel_ibfk_1` FOREIGN KEY (`Customer`) REFERENCES ` member` (`Id`);11 ADD CONSTRAINT `usercustomerrel_ibfk_2` FOREIGN KEY (`User`) REFERENCES `User` (`Id`), 12 ADD CONSTRAINT `usercustomerrel_ibfk_1` FOREIGN KEY (`Customer`) REFERENCES `Member` (`Id`); 13 13 14 14 INSERT INTO `UserCustomerRel` (SELECT NULL as Id, Member as Customer, Id AS User FROM User WHERE Member IS NOT NULL); -
trunk/user.php
r410 r415 34 34 var $AnonymousUserId = 98; 35 35 var $OnlineStateTimeout = 600; // in seconds 36 var $PermissionCache = array(); 36 37 37 38 function Check() … … 52 53 if($Row['User'] != $this->AnonymousUserId) 53 54 { 54 $Query = $this->Database->query('SELECT *, UserCustomerRel.Customer AS Member FROM User JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']);55 $Query = $this->Database->query('SELECT User.*, UserCustomerRel.Customer AS Member FROM User JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']); 55 56 $this->User = $Query->fetch_assoc(); 56 57 $Result = USER_LOGGED; … … 208 209 function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0) 209 210 { 210 $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"'); 211 if($DbResult->num_rows > 0) 212 { 213 $DbRow = $DbResult->fetch_array(); 214 $OperationId = $DbRow['Id']; 215 211 // First try to check cache 212 if(in_array(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache)) 213 { 214 $OperationId = array_search(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache); 215 $PermissionExists = is_numeric($OperationId); 216 } else 217 { 218 // If no permission combination exists in cache, do new check of database items 219 $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"'); 220 if($DbResult->num_rows > 0) 221 { 222 $DbRow = $DbResult->fetch_array(); 223 $OperationId = $DbRow['Id']; 224 $this->PermissionCache[$DbRow['Id']] = array($Module, $Operation, $ItemType, $ItemType); 225 $PermissionExists = true; 226 } else 227 { 228 $this->PermissionCache[$DbRow['Id'].'_'] = array($Module, $Operation, $ItemType, $ItemType); 229 $PermissionExists = false; 230 } 231 } 232 233 if($PermissionExists) 234 { 216 235 // Check user-operation relation 217 236 $DbResult = $this->Database->select('PermissionUserAssignment', '*', '`User`="'.$this->User['Id'].'" AND `AssignedOperation`="'.$OperationId.'"'); … … 219 238 220 239 // Check user-group relation 221 $DbResult = $this->Database->select('PermissionUserAssignment', 'AssignedGroup', '`User`="'.$this->User['Id'].'" AND `AssignedGroup` IS NOT NULL');240 $DbResult = $this->Database->select('PermissionUserAssignment', 'AssignedGroup', '`User`="'.$this->User['Id'].'"'); 222 241 while($DbRow = $DbResult->fetch_array()) 223 242 { 224 243 if($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return(true); 225 244 } 226 245 return(false);
Note:
See TracChangeset
for help on using the changeset viewer.