Changeset 365 for trunk/index.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/index.php

    r357 r365  
    88
    99  $Output = '<strong>Změny systému:</strong><div class="NewsBox">';
    10   $DbResult = $Database->SQLCommand('SELECT news.Time, user.user, news.Text FROM news JOIN user ON user.ID = news.User ORDER BY Time DESC LIMIT 10');
     10  $DbResult = $Database->SQLCommand('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
    1111  while($DbRow = mysql_fetch_assoc($DbResult))
    12     $Output .= '<div><strong>'.$DbRow['user'].' ('.date('d.m.Y', MysqlDateTimeToTime($DbRow['Time'])).')</strong> <br />'.$DbRow['Text'].'</div>'; 
     12    $Output .= '<div><strong>'.$DbRow['Name'].' ('.date('d.m.Y', MysqlDateTimeToTime($DbRow['Time'])).')</strong> <br />'.$DbRow['Text'].'</div>'; 
    1313  $Output .= '<a href="action.php?action=news">Všechny zprávy</a>';
    1414  $Output .= '</div>';
     
    2121
    2222  $Output = '<br /><strong>Poslední překlady:</strong><div class="NewsBox">';
    23   $DbResult = $Database->SQLCommand('SELECT date,user.user,text FROM log JOIN user ON user.ID = log.User WHERE type = 1 ORDER BY date DESC LIMIT 20');
     23  $DbResult = $Database->SQLCommand('SELECT `Date`, `User`.`Name`, `Text` FROM `Log` JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 20');
    2424  while($DbRow = mysql_fetch_assoc($DbResult))
    25     $Output .= '<strong>'.$DbRow['user'].' ('.date('d.m.Y', MysqlDateTimeToTime($DbRow['date'])).')</strong>
    26     '.$DbRow['text'].' <br />'; 
     25    $Output .= '<strong>'.$DbRow['Name'].' ('.date('d.m.Y', MysqlDateTimeToTime($DbRow['Date'])).')</strong>
     26    '.$DbRow['Text'].' <br />'; 
    2727  $Output .= '</div>';
    2828  return($Output);
     
    3636  if($_GET['rss'] == 'news')
    3737  {
    38     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(news.Time), news.Time, user.user, news.Text FROM news JOIN user ON user.ID = news.User ORDER BY Time DESC LIMIT 10');
     38    $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
    3939    while($DbRow = mysql_fetch_assoc($DbResult))
    4040    {
    4141      $Items[] = array
    4242    (
    43         'Title' => $DbRow['user'].'('.date('d.m.Y', MysqlDateTimeToTime($DbRow['Time'])).')',
     43        'Title' => $DbRow['Name'].'('.date('d.m.Y', MysqlDateTimeToTime($DbRow['Time'])).')',
    4444        'Link' =>  $Config['Web']['BaseURL'],
    4545        'Description' => $DbRow['Text'],
    46         'Time' => $DbRow['UNIX_TIMESTAMP(news.Time)'],
     46        'Time' => $DbRow['UnixTime'],
    4747      );
    4848    }
     
    5858  if($_GET['rss'] == 'translation')
    5959  {
    60     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(date), date, user.user, text FROM log JOIN user ON user.ID = log.User WHERE type = 1 ORDER BY date DESC LIMIT 100');
     60    $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
    6161    while($DbRow = mysql_fetch_assoc($DbResult))
    6262    {
    6363      $Items[] = array
    6464    (
    65         'Title' => strip_tags($DbRow['text'].' ('.$DbRow['user'].')'),
     65        'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'),
    6666        'Link' =>  $Config['Web']['BaseURL'],
    67         'Description' => $DbRow['text'],
    68         'Time' => $DbRow['UNIX_TIMESTAMP(date)'],
     67        'Description' => $DbRow['Text'],
     68        'Time' => $DbRow['Date'],
    6969      );
    7070    }
     
    8282  $TitleLength = 50;
    8383  mb_internal_encoding('utf-8');
    84     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(date), user, text FROM shoutbox ORDER BY ID DESC LIMIT 20');
     84    $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
    8585    while($DbRow = mysql_fetch_assoc($DbResult))
    8686    {
     
    8989      $Items[] = array
    9090    (
    91         'Title' => $DbRow['user'].': '.$Title,
     91        'Title' => $DbRow['User'].': '.$Title,
    9292        'Link' =>  $Config['Web']['BaseURL'],
    93         'Description' => $DbRow['text'],
    94         'Time' => $DbRow['UNIX_TIMESTAMP(date)'],
     93        'Description' => $DbRow['Text'],
     94        'Time' => $DbRow['UnixDate'],
    9595      );
    9696    }
Note: See TracChangeset for help on using the changeset viewer.