Changeset 20
- Timestamp:
- Oct 22, 2008, 9:31:11 AM (16 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
base.php
r19 r20 120 120 $DbResult = $Database->query('SELECT COUNT(t2.Id) AS Count FROM (SELECT DISTINCT(ItemId) as Id FROM `'.$List['TableName'].'` as t1 WHERE 1'.$Where.') as t2'); 121 121 //echo($Database->LastQuery.'<br>'); 122 $DbRow = $DbResult->fetch_ array();122 $DbRow = $DbResult->fetch_row(); 123 123 $TotalItemCount = $DbRow[0]; 124 124 125 125 $DbResult = $Database->query('SELECT * FROM `'.$List['TableName'].'` AS t1 WHERE 1'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 126 126 //echo($Database->LastQuery.'<br>'); 127 while($DbRow = $DbResult->fetch_a rray())127 while($DbRow = $DbResult->fetch_assoc()) 128 128 { 129 129 $Output .= '<tr>'; … … 155 155 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 156 156 $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1'); 157 while($DbRow = $DbResult->fetch_a rray())157 while($DbRow = $DbResult->fetch_assoc()) 158 158 { 159 159 $DefinitionItems = array(); … … 194 194 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 195 195 $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1'); 196 while($DbRow = $DbResult->fetch_a rray())196 while($DbRow = $DbResult->fetch_assoc()) 197 197 { 198 198 $DefinitionItems = array(); … … 308 308 function ShowViewItem($List, $Id, $Column = '', $ColumnValue = 0) 309 309 { 310 global $Database, $Types , $Lists;310 global $Database, $Types; 311 311 312 312 if(!CheckPermission('Read', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 313 313 $Output = ''; 314 314 $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1'); 315 while($DbRow = $DbResult->fetch_a rray())315 while($DbRow = $DbResult->fetch_assoc()) 316 316 { 317 317 $DefinitionItems = array(); … … 346 346 if($Types[$Item['Type']]['BaseType'] == 'PointerOneToMany') 347 347 { 348 $SubList = $Lists[$Types[$Item['Type']]['Parameters'][0]];348 $SubList = GetListDefinition($Types[$Item['Type']]['Parameters'][0]); 349 349 $Output .= ShowList($SubList, $Types[$Item['Type']]['Parameters'][1], $DbRow['ItemId'], $Item['TextBefore']).'<br /><br />'; 350 350 } … … 356 356 function ShowDeleteItem($List, $Id) 357 357 { 358 global $Database, $ Lists, $System, $LogActionType;358 global $Database, $System, $LogActionType; 359 359 360 360 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); … … 362 362 $System->Modules['DatabaseList']->DeleteItem($List['TableName'], $Id); 363 363 $Output = 'Položka smazána.'; 364 $Output .= ShowList($ Lists[$_SESSION['Table']], $Lists[$_SESSION['Column']], $Lists[$_SESSION['ColumnValue']]).'<br /><br />';364 $Output .= ShowList($_SESSION['Table'], $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />'; 365 365 ExecuteListEvent($List['TableName'], 'OnDelete', $Id); 366 366 return($Output); … … 369 369 function ShowMenu() 370 370 { 371 global $ Lists, $Database;371 global $Database; 372 372 373 373 $Output = ''; … … 391 391 function Output() 392 392 { 393 global $Lists;394 395 393 $PermanentVar = array('Table', 'Item', 'Column', 'ColumnValue', 'Action'); 396 394 if($_GET['Table'] != $_SESSION['Table']) … … 404 402 } 405 403 $Output = ''; 406 if(array_key_exists('Table', $_SESSION) and array_key_exists($_SESSION['Table'], $Lists))407 { 408 $List = $Lists[$_SESSION['Table']];404 if(array_key_exists('Table', $_SESSION)) 405 { 406 $List = GetListDefinition($_SESSION['Table']); 409 407 if(array_key_exists('Action', $_SESSION)) 410 408 { … … 441 439 } 442 440 443 function LoadListDefinition()441 function GetListDefinition($Id) 444 442 { 445 443 global $Database, $Lists; 446 444 447 $DbResult = $Database->query('SELECT t1.* FROM `SystemList` AS t1 LEFT JOIN `SystemList` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL)'); 448 while($DbRow = $DbResult->fetch_assoc()) 449 { 450 $Items = array(); 451 $DbResult2 = $Database->query('SELECT t1.* FROM `SystemListItem` AS t1 LEFT JOIN `SystemListItem` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND (t1.List='.$DbRow['ItemId'].')'); 452 while($DbRow2 = $DbResult2->fetch_assoc()) 453 { 454 $Items[$DbRow2['Name']] = $DbRow2; 455 } 456 $List = array( 457 'Id' => $DbRow['Id'], 458 'ItemId' => $DbRow['ItemId'], 459 'TableName' => $DbRow['TableName'], 460 'Title' => $DbRow['Title'], 461 'Items' => $Items, 462 ); 463 $Lists[$List['TableName']] = $List; 464 } 445 if(!array_key_exists($Id, $Lists)) 446 { 447 $DbResult = $Database->query('SELECT t1.* FROM `SystemList` AS t1 LEFT JOIN `SystemList` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND t1.TableName="'.$Id.'"'); 448 if($DbResult->num_rows > 0) 449 { 450 $DbRow = $DbResult->fetch_assoc(); 451 $Items = array(); 452 $DbResult2 = $Database->query('SELECT t1.* FROM `SystemListItem` AS t1 LEFT JOIN `SystemListItem` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND (t1.List='.$DbRow['ItemId'].')'); 453 while($DbRow2 = $DbResult2->fetch_assoc()) 454 { 455 $Items[$DbRow2['Name']] = $DbRow2; 456 } 457 $List = array( 458 'Id' => $DbRow['Id'], 459 'ItemId' => $DbRow['ItemId'], 460 'TableName' => $DbRow['TableName'], 461 'Title' => $DbRow['Title'], 462 'Items' => $Items, 463 ); 464 $Lists[$List['TableName']] = $List; 465 } else $Lists[$List['TableName']] = NULL; 466 } 467 return($Lists[$Id]); 465 468 //print_r($Lists); 466 469 } -
forms.php
r19 r20 98 98 99 99 $DbResult = $Database->query('SELECT * FROM '.$this->Definition['Table'].' WHERE Id='.$Id); 100 $DbRow = $DbResult->fetch_a rray();100 $DbRow = $DbResult->fetch_assoc(); 101 101 foreach($this->Definition['Items'] as $Item) 102 102 { -
global.php
r19 r20 50 50 $System->Modules['User']->Check(); 51 51 LoadTypeDefinition(); 52 LoadListDefinition();53 52 54 53 $MonthNames = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'); -
types/PointerOneToOne.php
r19 r20 5 5 function GetTablePointerName($Type, $Item) 6 6 { 7 global $Database , $Lists;7 global $Database; 8 8 9 9 //print_r($Item); … … 11 11 $TargetTable = $Type['Parameters'][0]; 12 12 13 foreach($Lists[$TargetTable]['Items'] as $ListItem) 13 $List = GetListDefinition($TargetTable); 14 foreach($List['Items'] as $ListItem) 14 15 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 15 16 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, ItemId, Id'; … … 24 25 function GetTablePointerNameList($Type, $Item) 25 26 { 26 global $Database , $Lists;27 global $Database; 27 28 28 29 $Columns = ''; 29 30 $TargetTable = $Type['Parameters'][0]; 30 31 31 foreach($Lists[$TargetTable]['Items'] as $ListItem) 32 $List = GetListDefinition($TargetTable); 33 foreach($List['Items'] as $ListItem) 32 34 if($ListItem['VisibleInPointer'] == 1) $Columns .= 't1.`'.$ListItem['Name'].'`," ",'; 33 35 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, t1.Id, t1.ItemId, t1.DeletionTime'; … … 45 47 function OnView($Item) 46 48 { 47 global $Database, $ Lists, $Types;49 global $Database, $Types; 48 50 49 51 $Type = $Types[$Item['Type']]; … … 56 58 function OnEdit($Item) 57 59 { 58 global $Database, $ Lists, $Types;60 global $Database, $Types; 59 61 60 62 $Type = $Types[$Item['Type']]; -
user.php
r18 r20 51 51 // Zkontroluj přihlášení 52 52 $Query = $this->Database->select($this->TableUserOnline, '*', 'SessionId="'.$SID.'"'); 53 $Row = $Query->fetch_a rray();53 $Row = $Query->fetch_assoc(); 54 54 if($Row['User'] != 0) 55 55 { … … 115 115 if($DbResult->num_rows > 0) 116 116 { 117 $Row = $DbResult->fetch_a rray();117 $Row = $DbResult->fetch_assoc(); 118 118 if($Hash == $Row['Password']) 119 119 { … … 133 133 if($Query->num_rows > 0) 134 134 { 135 $Row = $Query->fetch_a rray();135 $Row = $Query->fetch_assoc(); 136 136 if($Row['Password'] != $Password) $Result = BAD_PASSWORD; 137 137 else if($Row['Locked'] == 1) $Result = ACCOUNT_LOCKED; … … 167 167 if($DbResult->num_rows > 0) 168 168 { 169 $Row = $DbResult->fetch_a rray();169 $Row = $DbResult->fetch_assoc(); 170 170 $NewPassword = substr(sha1(strtoupper($Row['Name'])), 0, 7); 171 171 … … 185 185 if($DbResult->num_rows > 0) 186 186 { 187 $Row = $DbResult->fetch_a rray();187 $Row = $DbResult->fetch_assoc(); 188 188 $NewPassword2 = substr(sha1(strtoupper($Row['Name'])), 0, 7); 189 189 if(($NewPassword == $NewPassword2) and ($Hash == $Row['Password']))
Note:
See TracChangeset
for help on using the changeset viewer.