Legend:
- Unmodified
- Added
- Removed
-
base.php
r27 r28 5 5 global $Database, $Config; 6 6 7 if(!CheckPermission('Read', $List['I temId']))7 if(!CheckPermission('Read', $List['Id'])) 8 8 { 9 9 if($Column != '') return(''); … … 21 21 $Output .= '<th>Akce</th></tr>'; 22 22 23 $Where = ' AND (t1.DeletionTime IS NULL)';23 $Where = '1'; 24 24 25 25 if(($Column != '') and ($ColumnValue != 0)) 26 26 { 27 $Where .= ' AND ( t1.'.$Column.'='.$ColumnValue.')';27 $Where .= ' AND ('.$Column.'='.$ColumnValue.')'; 28 28 $ColumnSelection = '&Column='.$Column.'&ColumnValue='.$ColumnValue; 29 $FullListLink = '<a href="?Action=ViewList&Table='.$List['I temId'].'">Celkový seznam</a>';29 $FullListLink = '<a href="?Action=ViewList&Table='.$List['Id'].'">Celkový seznam</a>'; 30 30 } else 31 31 { … … 39 39 if($_SESSION['OrderColumn'] == $_GET['OrderColumn']) // Same column => reverse order 40 40 $_SESSION['OrderDirection'] = ($_SESSION['OrderDirection'] + 1) % 2; 41 if($_SESSION['OrderTable'] != $List['I temId']) // Different table => set ascending order41 if($_SESSION['OrderTable'] != $List['Id']) // Different table => set ascending order 42 42 $_SESSION['OrderDirection'] = 0; 43 43 $_SESSION['OrderColumn'] = $_GET['OrderColumn']; 44 $_SESSION['OrderTable'] = $List['I temId'];45 } 46 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List['I temId']))44 $_SESSION['OrderTable'] = $List['Id']; 45 } 46 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List['Id'])) 47 47 { 48 48 $OrderDirection = array('ASC', 'DESC'); 49 $Order = 'ORDER BY t1.`'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']];49 $Order = 'ORDER BY `'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']]; 50 50 } else $Order = ''; 51 51 … … 53 53 //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))'; 54 54 $Where .= ' '.$Order; 55 $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');55 $DbResult = $Database->query('SELECT COUNT(*) AS Count FROM `'.$List['TableName'].'` WHERE 1'.$Where); 56 56 $DbRow = $DbResult->fetch_row(); 57 57 $TotalItemCount = $DbRow[0]; 58 58 59 $DbResult = $Database->query('SELECT t1.* FROM `'.$List['TableName'].'` AS t1 LEFT JOIN `'.$List['TableName'].'` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL)'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']);59 $DbResult = $Database->query('SELECT * FROM `'.$List['TableName'].'` WHERE '.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 60 60 //echo($Database->LastQuery); 61 61 while($DbRow = $DbResult->fetch_assoc()) … … 66 66 if($Item['VisibleInList'] == 1) 67 67 { 68 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['I temId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);68 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 69 69 $Output .= '<td>'.ExecuteTypeEvent($Item['Type'], 'OnView', $ItemDefinition).'</td>'; 70 70 } 71 71 } 72 72 $Output .= '<td>'; 73 if(CheckPermission('Read', $List['I temId'])) $Output .= '<a href="?Action=ViewItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/view.png" alt="Zobrazit" title="Zobrazit"></a>';74 if(CheckPermission('Write', $List['I temId'])) $Output .= ' <a href="?Action=EditItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/edit.png" alt="Editovat" title="Editovat"></a>';75 if(CheckPermission('Write', $List['I temId'])) $Output .= ' <a href="?Action=DeleteItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/delete.png" alt="Smazat" title="Smazat" onclick="return confirmAction(\'Opravdu smazat položku?\');"></a>';73 if(CheckPermission('Read', $List['Id'])) $Output .= '<a href="?Action=ViewItem&Table='.$List['Id'].'&Item='.$DbRow['Id'].'"><img border="0" src="images/view.png" alt="Zobrazit" title="Zobrazit"></a>'; 74 if(CheckPermission('Write', $List['Id'])) $Output .= ' <a href="?Action=EditItem&Table='.$List['Id'].'&Item='.$DbRow['Id'].'"><img border="0" src="images/edit.png" alt="Editovat" title="Editovat"></a>'; 75 if(CheckPermission('Write', $List['Id'])) $Output .= ' <a href="?Action=DeleteItem&Table='.$List['Id'].'&Item='.$DbRow['Id'].'"><img border="0" src="images/delete.png" alt="Smazat" title="Smazat" onclick="return confirmAction(\'Opravdu smazat položku?\');"></a>'; 76 76 $Output .= '</td></tr>'; 77 77 } … … 79 79 $PageList = PagesList($Page, $TotalItemCount); 80 80 if(strlen($PageList) != 0) $Output .= $PageList.'<br />'; 81 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=AddItem&Table='.$List['ItemId'].$ColumnSelection.'">Přidat</a> '.$FullListLink; 82 if(CheckPermission('Read', $List['ItemId'])) $Output .= ' <a href="?Action=ShowSearch&Table='.$List['ItemId'].$ColumnSelection.'">Hledat</a> '.$FullListLink; 83 return($Output); 84 } 85 81 if(CheckPermission('Write', $List['Id'])) $Output .= ' <a href="?Action=AddItem&Table='.$List['Id'].$ColumnSelection.'">Přidat</a> '.$FullListLink; 82 if(CheckPermission('Read', $List['Id'])) $Output .= ' <a href="?Action=ShowSearch&Table='.$List['Id'].$ColumnSelection.'">Hledat</a> '.$FullListLink; 83 return($Output); 84 } 85 86 /* 86 87 function ShowHistory($List, $Id, $Title = '') 87 88 { … … 149 150 return($Output); 150 151 } 152 */ 151 153 152 154 function ShowEditItem($List, $Id) … … 154 156 global $Database; 155 157 156 if(!CheckPermission('Write', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));157 $DbResult = $Database->select($List['TableName'], '*', 'I temId='.$Id.' ORDER BY Id DESC LIMIT 1');158 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 159 $DbResult = $Database->select($List['TableName'], '*', 'Id='.$Id); 158 160 while($DbRow = $DbResult->fetch_assoc()) 159 161 { … … 166 168 if($Item['Editable'] == 1) 167 169 { 168 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['I temId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);170 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 169 171 } else $DefinitionItems[] = array('Name' => $Index, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $DbRow[$Index]); 170 172 } … … 182 184 if(($Column != '') and ($ColumnValue != 0)) 183 185 { 184 $Output .= '<a href="?Action=ShowList&Table='.$List['I temId'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>';186 $Output .= '<a href="?Action=ShowList&Table='.$List['Id'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 185 187 } else 186 188 { 187 $Output .= '<a href="?Action=ShowList&Table='.$List['I temId'].'">Celkový seznam</a>';189 $Output .= '<a href="?Action=ShowList&Table='.$List['Id'].'">Celkový seznam</a>'; 188 190 } 189 191 return($Output); … … 194 196 global $Database, $System, $LogActionType; 195 197 196 if(!CheckPermission('Write', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));197 $DbResult = $Database->select($List['TableName'], '*', 'I temId='.$Id.' ORDER BY Id DESC LIMIT 1');198 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 199 $DbResult = $Database->select($List['TableName'], '*', 'Id='.$Id); 198 200 while($DbRow = $DbResult->fetch_assoc()) 199 201 { … … 204 206 if($Type['BaseType'] != 'PointerOneToMany') 205 207 { 206 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['I temId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);208 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 207 209 } 208 210 } … … 216 218 ); 217 219 $Form->LoadValuesFromForm(); 218 $System->Modules['DatabaseList']->EditItem($List['I temId'], $Form->Values, $Id);220 $System->Modules['DatabaseList']->EditItem($List['Id'], $Form->Values, $Id); 219 221 $NewId = $Database->insert_id; 220 $System->Modules['Log']->Add($List['I temId'], $NewId, $LogActionType['Edit']);222 $System->Modules['Log']->Add($List['Id'], $NewId, $LogActionType['Edit']); 221 223 $Output = 'Změny uloženy.'; 222 224 $Output .= ShowViewItem($List, $Id); 223 225 $Form->Values['Column'] = $_POST['Column']; 224 $Form->Values['I temId'] = $Id;226 $Form->Values['Id'] = $Id; 225 227 $Form->Values['ListTableName'] = $List['TableName']; 226 ExecuteListEvent($List['I temId'], 'OnEdit', $Form->Values);228 ExecuteListEvent($List['Id'], 'OnEdit', $Form->Values); 227 229 return($Output); 228 230 } … … 232 234 global $Database; 233 235 234 if(!CheckPermission('Write', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));236 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 235 237 $DefinitionItems = array(); 236 238 $AfterTableOutput = ''; … … 243 245 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 244 246 if($Item['Editable'] == 1) 245 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['I temId'], 'SourceItemId' => 0);247 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['Id'], 'SourceItemId' => 0); 246 248 } else 247 249 if($Item['Name'] == $Column) … … 263 265 if(($Column != '') and ($ColumnValue != 0)) 264 266 { 265 $Output .= '<a href="?Action=ShowList&Table='.$List['I temId'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>';267 $Output .= '<a href="?Action=ShowList&Table='.$List['Id'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 266 268 } else 267 269 { 268 $Output .= '<a href="?Action=ShowList&Table='.$List['I temId'].'">Celkový seznam</a>';270 $Output .= '<a href="?Action=ShowList&Table='.$List['Id'].'">Celkový seznam</a>'; 269 271 } 270 272 return($Output); … … 275 277 global $Database, $System, $LogActionType; 276 278 277 if(!CheckPermission('Write', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));279 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 278 280 $DefinitionItems = array(); 279 281 $AfterTableOutput = ''; … … 285 287 { 286 288 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 287 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['I temId'], 'SourceItemId' => 0);289 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['Id'], 'SourceItemId' => 0); 288 290 } else 289 291 if($Item['Name'] == $Column) … … 301 303 ); 302 304 $Form->LoadValuesFromForm(); 303 $NewItemId = $System->Modules['DatabaseList']->AddItem($List['I temId'], $Form->Values);305 $NewItemId = $System->Modules['DatabaseList']->AddItem($List['Id'], $Form->Values); 304 306 $NewId = $Database->insert_id; 305 $System->Modules['Log']->Add($List['I temId'], $NewId, $LogActionType['Add']);307 $System->Modules['Log']->Add($List['Id'], $NewId, $LogActionType['Add']); 306 308 $Output = 'Položka přidána'; 307 309 $Output .= ShowViewItem($List, $NewItemId); 308 310 $Form->Values['Column'] = $_POST['Column']; 309 ExecuteListEvent($List['I temId'], 'OnAdd', $Form->Values);311 ExecuteListEvent($List['Id'], 'OnAdd', $Form->Values); 310 312 return($Output); 311 313 } … … 315 317 global $Database; 316 318 317 if(!CheckPermission('Read', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));319 if(!CheckPermission('Read', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 318 320 $Output = ''; 319 $DbResult = $Database->select($List['TableName'], '*', 'I temId='.$Id.' ORDER BY Id DESC LIMIT 1');321 $DbResult = $Database->select($List['TableName'], '*', 'Id='.$Id); 320 322 while($DbRow = $DbResult->fetch_assoc()) 321 323 { … … 327 329 if($Type['BaseType'] != 'PointerOneToMany') 328 330 { 329 $DefinitionItems[] = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['I temId'], 'SourceItemId' => 0);331 $DefinitionItems[] = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => 0); 330 332 } 331 333 } … … 337 339 ); 338 340 $Output .= $Form->ShowReadOnlyForm(); 339 if(CheckPermission('Write', $List['I temId'])) $Output .= '<a href="?Action=EditItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'">Editovat</a> ';341 if(CheckPermission('Write', $List['Id'])) $Output .= '<a href="?Action=EditItem&Table='.$List['Id'].'&Item='.$DbRow['Id'].'">Editovat</a> '; 340 342 341 343 if(($Column != '') and ($ColumnValue != 0)) 342 344 { 343 $Output .= '<a href="?Action=ShowList&Table='.$List['I temId'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>';345 $Output .= '<a href="?Action=ShowList&Table='.$List['Id'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 344 346 } else 345 347 { 346 $Output .= '<a href="?Action=ShowList&Table='.$List['I temId'].'">Celkový seznam</a>';347 } 348 $Output .= ' <a href="?Action=ShowHistory&Table='.$List['I temId'].'&Item='.$DbRow['ItemId'].'">Historie</a>';349 $Output .= ' <a href="?Action=DeleteItem&Table='.$List['I temId'].'&Item='.$DbRow['ItemId'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';348 $Output .= '<a href="?Action=ShowList&Table='.$List['Id'].'">Celkový seznam</a>'; 349 } 350 $Output .= ' <a href="?Action=ShowHistory&Table='.$List['Id'].'&Item='.$DbRow['Id'].'">Historie</a>'; 351 $Output .= ' <a href="?Action=DeleteItem&Table='.$List['Id'].'&Item='.$DbRow['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 350 352 $Output .= '<div class="line"></div>'; 351 353 foreach($List['Items'] as $Index => $Item) … … 355 357 { 356 358 $SubList = GetListDefinition($Type['Parameters'][0]); 357 $Output .= ShowList($SubList, $Type['Parameters'][1], $DbRow['I temId'], $Item['TextBefore']).'<br /><br />';359 $Output .= ShowList($SubList, $Type['Parameters'][1], $DbRow['Id'], $Item['TextBefore']).'<br /><br />'; 358 360 } 359 361 } … … 366 368 global $Database, $System, $LogActionType; 367 369 368 if(!CheckPermission('Write', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));369 $System->Modules['Log']->Add($List['I temId'], $Id, $LogActionType['Delete']);370 $System->Modules['DatabaseList']->DeleteItem($List['I temId'], $Id);370 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 371 $System->Modules['Log']->Add($List['Id'], $Id, $LogActionType['Delete']); 372 $System->Modules['DatabaseList']->DeleteItem($List['Id'], $Id); 371 373 $Output = 'Položka smazána.'; 372 374 $Output .= ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />'; 373 ExecuteListEvent($List['I temId'], 'OnDelete', $Id);375 ExecuteListEvent($List['Id'], 'OnDelete', $Id); 374 376 return($Output); 375 377 } … … 379 381 global $Database; 380 382 381 if(!CheckPermission('Read', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));383 if(!CheckPermission('Read', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 382 384 $DefinitionItems = array(); 383 385 $AfterTableOutput = ''; … … 389 391 { 390 392 if($Item['Editable'] == 1) 391 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'], 'Value' => '', 'SourceTable' => $List['I temId'], 'SourceItemId' => 0);393 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'], 'Value' => '', 'SourceTable' => $List['Id'], 'SourceItemId' => 0); 392 394 } else 393 395 if($Item['Name'] == $Column) … … 414 416 global $Database, $System, $LogActionType; 415 417 416 if(!CheckPermission('Write', $List['I temId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));417 $System->Modules['Log']->Add($List['I temId'], $Id, $LogActionType['Delete']);418 $System->Modules['DatabaseList']->DeleteItem($List['I temId'], $Id);418 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 419 $System->Modules['Log']->Add($List['Id'], $Id, $LogActionType['Delete']); 420 $System->Modules['DatabaseList']->DeleteItem($List['Id'], $Id); 419 421 $Output = 'Položka smazána.'; 420 422 $Output .= ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />'; 421 ExecuteListEvent($List['I temId'], 'OnDelete', $Id);423 ExecuteListEvent($List['Id'], 'OnDelete', $Id); 422 424 return($Output); 423 425 … … 431 433 432 434 $Output = ''; 433 $DbResult = $Database->query('SELECT t1.* FROM `SystemMenu` AS t1 LEFT JOIN `SystemMenu` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL)');435 $DbResult = $Database->query('SELECT * FROM `SystemMenu`'); 434 436 while($DbRow = $DbResult->fetch_assoc()) 435 437 { 436 438 $Group = ''; 437 $DbResult2 = $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.`Menu` = '.$DbRow['ItemId'].')');439 $DbResult2 = $Database->query('SELECT * FROM `SystemList` WHERE `Menu` = '.$DbRow['Id']); 438 440 while($DbRow2 = $DbResult2->fetch_assoc()) 439 441 { 440 if(CheckPermission('Read', $DbRow2['I temId']))441 $Group .= '<a href="?Action=ShowList&Table='.$DbRow2['I temId'].'">'.$DbRow2['Title'].'</a><br />';442 if(CheckPermission('Read', $DbRow2['Id'])) 443 $Group .= '<a href="?Action=ShowList&Table='.$DbRow2['Id'].'">'.$DbRow2['Title'].'</a><br />'; 442 444 } 443 445 if($Group != '') … … 511 513 if(!array_key_exists($Id, $Lists)) 512 514 { 513 $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.ItemId="'.$Id.'"');515 $DbResult = $Database->query('SELECT * FROM `SystemList` WHERE Id='.$Id); 514 516 if($DbResult->num_rows > 0) 515 517 { 516 518 $DbRow = $DbResult->fetch_assoc(); 517 519 $Items = array(); 518 $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'].')');520 $DbResult2 = $Database->query('SELECT * FROM `SystemListItem` WHERE List='.$DbRow['Id']); 519 521 while($DbRow2 = $DbResult2->fetch_assoc()) 520 522 { … … 523 525 $List = array( 524 526 'Id' => $DbRow['Id'], 525 'ItemId' => $DbRow['ItemId'],526 527 'TableName' => $DbRow['TableName'], 527 528 'Title' => $DbRow['Title'], … … 533 534 if(class_exists($ClassName)) $List['Class'] = new $ClassName; 534 535 } 535 $Lists[$List['I temId']] = $List;536 } else $Lists[$List['I temId']] = NULL;536 $Lists[$List['Id']] = $List; 537 } else $Lists[$List['Id']] = NULL; 537 538 } 538 539 return($Lists[$Id]); … … 546 547 if(!array_key_exists($Id, $Types)) 547 548 { 548 $DbResult = $Database->query('SELECT t1.* FROM `SystemType` AS t1 LEFT JOIN `SystemType` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND t1.ItemId='.$Id);549 $DbResult = $Database->query('SELECT * FROM `SystemType` WHERE Id='.$Id); 549 550 if($DbResult->num_rows > 0) 550 551 { … … 553 554 if(($DbRow['ParentType'] == TypePointerOneToOneId) or ($DbRow['ParentType'] == TypePointerOneToManyId)) 554 555 { 555 $DbResult2 = $Database->query('SELECT t1.* FROM `SystemList` AS t1 LEFT JOIN `SystemType` 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="'.$DbRow['Parameters'][0].'"');556 $DbResult2 = $Database->query('SELECT * FROM `SystemList` WHERE TableName="'.$DbRow['Parameters'][0].'"'); 556 557 $DbRow2 = $DbResult2->fetch_assoc(); 557 558 //echo($DbRow['ParentType'].'-'.$DbRow['Parameters'][0].'='.$DbRow2['ItemId'].'<br>'); 558 $DbRow['Parameters'][0] = $DbRow2['I temId'];559 $DbRow['Parameters'][0] = $DbRow2['Id']; 559 560 } 560 561 $DbRow['BaseType'] = $DbRow['Name']; … … 577 578 } 578 579 $DbRow['Class'] = &$TypeDefinitionList[$DbRow['BaseType']]; 579 $Types[$DbRow['I temId']] = $DbRow;580 } else $Types[$DbRow['I temId']] = NULL;580 $Types[$DbRow['Id']] = $DbRow; 581 } else $Types[$DbRow['Id']] = NULL; 581 582 } 582 583 //print_r($Types); … … 620 621 $Result = FALSE; 621 622 //return(TRUE); 622 $DbResult = $Database->query('SELECT t1.* FROM `Permission` AS t1 LEFT JOIN `Permission` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND t1.PermissionGroup = (SELECT PermissionGroup.Id FROM PermissionGroup WHERE PermissionGroup.Id=(SELECT User.PermissionGroup FROM User WHERE User.ItemId='.$System->Modules['User']->User['ItemId'].' ORDER BY User.Id DESC LIMIT 1) ORDER BY PermissionGroup.Id DESC LIMIT 1) AND t1.DeletionTime IS NULLAND t1.List='.$ListId);623 $DbResult = $Database->query('SELECT t1.* FROM `Permission` AS t1 WHERE t1.PermissionGroup = (SELECT PermissionGroup.Id FROM PermissionGroup WHERE PermissionGroup.Id=(SELECT User.PermissionGroup FROM User WHERE User.Id='.$System->Modules['User']->User['Id'].')) AND t1.List='.$ListId); 623 624 if($DbResult->num_rows > 0) 624 625 {
Note:
See TracChangeset
for help on using the changeset viewer.