Changeset 33


Ignore:
Timestamp:
Mar 12, 2009, 6:01:58 PM (16 years ago)
Author:
george
Message:
  • Přidáno: Vlastní obsluha chyb.
  • Přidáno: Import dat z databáze centrály.
  • Opraveno: Řazení řádků v tabulkách při přepínání stránek.
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • base.php

    r31 r33  
    1111  global $Database, $Config;
    1212 
    13   echo($Column.','.$ColumnValue.' ');
     13  //echo($Column.','.$ColumnValue.' ');
    1414
    1515  if(!CheckPermission('Read', $List['Id']))
     
    2525  {
    2626    if(($Item['VisibleInList'] == 1) and ($Item['Name'] != $Column))
    27       $Output .= '<th><a href="?OrderColumn='.$Item['Name'].'">'.$Item['TextBefore'].'</a></th>';
     27      $Output .= '<th><a href="?OrderColumn='.$Item['Name'].'&amp;OrderDirection='.(($_SESSION['OrderDirection'] + 1) % 2).'">'.$Item['TextBefore'].'</a></th>';
    2828  }
    2929  $Output .= '<th>Akce</th></tr>';
     
    4646  if(array_key_exists('OrderColumn', $_GET))
    4747  {
    48     if($_SESSION['OrderColumn'] == $_GET['OrderColumn']) // Same column => reverse order
    49       $_SESSION['OrderDirection'] = ($_SESSION['OrderDirection'] + 1) % 2;
    5048    if($_SESSION['OrderTable'] != $List['Id']) // Different table => set ascending order
    5149      $_SESSION['OrderDirection'] = 0;
    5250    $_SESSION['OrderColumn'] = $_GET['OrderColumn'];
    5351    $_SESSION['OrderTable'] = $List['Id'];
    54   }
     52    $_SESSION['OrderDirection'] = $_GET['OrderDirection'];
     53  }
     54  //echo(';'.$_SESSION['OrderTable'].','.$_SESSION['OrderColumn']);
    5555  if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List['Id']))
    5656  {
     
    5858    $Order = 'ORDER BY `'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']];
    5959  } else $Order = '';
    60 
    6160  if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0;
    6261  //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))';
     
    558557  if(!array_key_exists($Id, $Lists))
    559558  {
    560     $DbResult = $Database->query('SELECT * FROM `SystemList` WHERE Id='.$Id);
     559    $DbResult = $Database->query('SELECT * FROM `SystemList` WHERE `Id`='.$Id);
    561560    if($DbResult->num_rows > 0)
    562561    {
    563562      $DbRow = $DbResult->fetch_assoc();
    564563      $Items = array();
    565       $DbResult2 = $Database->query('SELECT * FROM `SystemListItem` WHERE List='.$DbRow['Id']);
     564      $DbResult2 = $Database->query('SELECT * FROM `SystemListItem` WHERE `List`='.$DbRow['Id'].' ORDER BY `Sequence`');
    566565      while($DbRow2 = $DbResult2->fetch_assoc())
    567566      {
     
    569568      }
    570569      $List = array(
    571        'Id' => $DbRow['Id'],
    572        'TableName' => $DbRow['TableName'],
    573        'Database' => $DbRow['Database'],
    574        'Title' => $DbRow['Title'],
    575        'IdName' => $DbRow['IdName'],
    576        'Items' => $Items,
     570        'Id' => $DbRow['Id'],
     571        'TableName' => $DbRow['TableName'],
     572        'Database' => $DbRow['Database'],
     573        'Title' => $DbRow['Title'],
     574        'IdName' => $DbRow['IdName'],
     575        'Items' => $Items,
    577576      );
    578577      //if(!array_key_exists($List['ItemId'], $TypeDefinitionList))
     
    594593  if(!array_key_exists($Id, $Types))
    595594  {
    596     $DbResult = $Database->query('SELECT * FROM `SystemType` WHERE Id='.$Id);
     595    $DbResult = $Database->query('SELECT * FROM `SystemType` WHERE `Id`='.$Id);
    597596    if($DbResult->num_rows > 0)
    598597    {
     
    601600      if(($DbRow['ParentType'] == TypePointerOneToOneId) or ($DbRow['ParentType'] == TypePointerOneToManyId))
    602601      {
    603         $DbResult2 = $Database->query('SELECT * FROM `SystemList` WHERE TableName="'.$DbRow['Parameters'][0].'"');
     602        $DbResult2 = $Database->query('SELECT * FROM `SystemList` WHERE `TableName`="'.$DbRow['Parameters'][0].'"');
    604603        $DbRow2 = $DbResult2->fetch_assoc();
    605604        //echo($DbRow['ParentType'].'-'.$DbRow['Parameters'][0].'='.$DbRow2['ItemId'].'<br>');
  • config.sample.php

    r32 r33  
    2222    'AdminEmail' => 'admin@localhost',
    2323    'ItemsPerPage' => 20,
     24        'ShowSQLQuery' => true,
    2425        'ShowSQLError' => true,
    2526        'ShowPHPError' => true,
  • database.php

    r30 r33  
    88  var $Prefix = '';
    99  var $LastQuery = '';
    10   var $ShowError = 0;
    1110
    1211  function query($Query)
    1312  {
    14     $this->LastQuery = $Query;
     13    global $Config;
     14
     15        if($Config['Web']['ShowSQLQuery'] == true)
     16          echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: silver; padding-bottom: 2px; padding-top: 2px; font-size: 12px; font-family: Arial;">'.$Query.'</div>');
     17        $this->LastQuery = $Query;
    1518    $DbResult = parent::query($Query);
    16     if(($this->ShowError == TRUE) and ($this->error != ''))
     19    if(($this->error != '') and ($Config['Web']['ShowSQLError'] == true))
    1720    {
    1821      echo('<strong>Database error:</strong> '.$this->error.'<br />');
     
    7073      $Value = strtr($Value, '"', '\"');
    7174      if($Value != 'NOW()') $Value = "'".$Value."'";
    72       $Values .= ", ".$Key."=".$Value;
     75      $Values .= ", `".$Key."`=".$Value;
    7376    }
    7477    $Values = substr($Values, 2);
  • global.php

    r21 r33  
    55foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    66
    7 session_start();
     7if(!isset($SessionDisable)) session_start();
    88include('config.php');
     9include('error.php');
    910include('database.php');
    10 include_once('code.php');
     11include('code.php');
    1112$Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
    1213$Database->Prefix = $Config['Database']['Prefix'];
    1314$Database->charset($Config['Database']['Charset']);
    1415$Database->ShowError = TRUE;
    15 include_once('module.php');
    16 include_once('page.php');
    17 include_once('forms.php');
    18 include_once('types/include.php');
    19 include_once('lists/include.php');
    20 include_once('base.php');
     16include('module.php');
     17include('page.php');
     18include('forms.php');
     19include('types/include.php');
     20include('lists/include.php');
     21include('base.php');
    2122
    2223class System extends Module
Note: See TracChangeset for help on using the changeset viewer.