Changeset 365 for trunk/log.php


Ignore:
Timestamp:
Mar 9, 2010, 11:29:05 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Jména tabulek v databází upraveny na stejná s prvními velkými písmeny.
  • Upraveno: Doplněny SQL uvozovky do mnoha SQL dotazů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/log.php

    r357 r365  
    66{
    77  $Items = array();
    8   if(array_key_exists('type', $_GET)) $Where = ' WHERE `type` = "'.($_GET['type'] * 1).'"';
     8  if(array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"';
    99    else $Where = '';
    10   $sql = 'SELECT *,UNIX_TIMESTAMP(`date`), (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `log`.`user`) AS `user` FROM `log`'.$Where.' ORDER BY `date` DESC LIMIT 100';
     10  $sql = 'SELECT *,UNIX_TIMESTAMP(`Date`), (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `User` FROM `Log`'.$Where.' ORDER BY `Date` DESC LIMIT 100';
    1111  $ID = $Database->SQLCommand($sql);
    1212  while($Line = mysql_fetch_assoc($ID))
    1313  {
    14     $DbResult = $Database->SQLCommand('SELECT * FROM `LogType` WHERE `Id`='.$Line['type']);
     14    $DbResult = $Database->SQLCommand('SELECT * FROM `LogType` WHERE `Id`='.$Line['Type']);
    1515    $LogType = mysql_fetch_assoc($DbResult);
    1616   
    1717    $Items[] = array
    1818    (
    19       'Title' => strip_tags($LogType['Name'].': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')'),
     19      'Title' => strip_tags($LogType['Name'].': '.$Line['Text'].' ('.$Line['Name'].', '.$Line['IP'].')'),
    2020      'Link' =>  $Config['Web']['BaseURL'].'log.php',
    21       'Description' => $LogType['Name'].': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')',
    22       'Time' => $Line['UNIX_TIMESTAMP(date)'],
     21      'Description' => $LogType['Name'].': '.$Line['Text'].' ('.$Line['Name'].', '.$Line['IP'].')',
     22      'Time' => $Line['UNIX_TIMESTAMP(Date)'],
    2323    );
    2424  }
     
    3939  if(array_key_exists('group', $_GET)) $_SESSION['group'] = $_GET['group'];
    4040
    41   if($_SESSION['type'] != '') $WhereType = ' `type`='.$_SESSION['type'];
     41  if($_SESSION['type'] != '') $WhereType = ' `Type`='.$_SESSION['type'];
    4242    else $WhereType = '1=1';
    4343   
     
    6161  else
    6262  {
    63     if(array_key_exists('group', $_SESSION)) $Where = ' WHERE `text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
     63    if(array_key_exists('group', $_SESSION)) $Where = ' WHERE `Text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
    6464      else $Where = '';
    6565  }
    6666  //if(($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
    6767
    68   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `log` '.$Where);
     68  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log` '.$Where);
    6969  $DbRow = mysql_fetch_row($DbResult);
    7070  $PageList = GetPageList($DbRow[0]);   
     
    7575    array('Name' => 'date', 'Title' => 'Čas'),
    7676    array('Name' => 'text', 'Title' => 'Text'),
    77     array('Name' => 'user', 'Title' => 'Uživatel'),
     77    array('Name' => 'User', 'Title' => 'Uživatel'),
    7878    array('Name' => 'IP', 'Title' => 'Adresa'),
    7979  );
     
    8282  echo($Order['Output']);
    8383 
    84   $sql = 'SELECT *, `LogType`.`Color` AS `LogColor`, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `log`.`user`) AS `user` FROM `log` LEFT JOIN `LogType` ON `LogType`.`Id`=`log`.`type` '.$Where.$Order['SQL'].$PageList['SQLLimit'];
     84  $sql = 'SELECT *, `LogType`.`Color` AS `LogColor`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `User` FROM `Log` LEFT JOIN `LogType` ON `LogType`.`Id`=`Log`.`Type` '.$Where.$Order['SQL'].$PageList['SQLLimit'];
    8585  //echo($sql);
    8686  $ID = $Database->SQLCommand($sql);
    8787  while($Line = mysql_fetch_assoc($ID))
    8888  {
    89     echo('<tr><td>'.$Line['date'].'</td><td><span style="color: '.$Line['LogColor'].'">'.$Line['text'].'</span></td><td>'.$Line['user'].'</td><td>'.$Line['IP'].'</td></tr>');
     89    echo('<tr><td>'.$Line['Date'].'</td><td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td><td>'.$Line['Name'].'</td><td>'.$Line['IP'].'</td></tr>');
    9090  }
    9191  echo('</table>');
Note: See TracChangeset for help on using the changeset viewer.