Changeset 455 for trunk/index.php


Ignore:
Timestamp:
Apr 13, 2010, 10:03:12 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Přístup k databázi převeden na objektový pomocí rozšířené PHP třídy mysqli. Při práci s databází použít globální objekt $System a jeho prvek $Database ($System->Database->query("SELECT ...");.
  • Upraveno: Při vkládání nové zprávy do Kecátka neprovádět přesměrování, ale rovnou zobrazit výpis. U některých překladatelů toto způsobovalo opakované vložení zprávy.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r436 r455  
    1313function ShowNews()
    1414{
    15   global $Database;
     15  global $System;
    1616
    1717  $Output = '<strong>Změny systému:</strong><div class="NewsBox">';
    18   $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');
    19   while($DbRow = mysql_fetch_assoc($DbResult))
     18  $DbResult = $System->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
     19  while($DbRow = $DbResult->fetch_assoc())
    2020    $Output .= '<div><strong>'.$DbRow['Name'].' ('.HumanDate($DbRow['Time']).')</strong> <br />'.$DbRow['Text'].'</div>'; 
    2121  $Output .= '<a href="action.php?action=news">Všechny zprávy</a>';
     
    5656function ShowRSSChannel()
    5757{
    58   global $Database, $Config, $System;
     58  global $System, $Config, $System;
    5959 
    6060  $Items = array(); 
    6161  if($_GET['rss'] == 'news')
    6262  {
    63     $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');
    64     while($DbRow = mysql_fetch_assoc($DbResult))
     63    $DbResult = $System->Database->query('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');
     64    while($DbRow = $DbResult->fetch_assoc())
    6565    {
    6666      $Items[] = array
     
    8383  if($_GET['rss'] == 'translation')
    8484  {
    85     $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');
    86     while($DbRow = mysql_fetch_assoc($DbResult))
     85    $DbResult = $System->Database->query('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');
     86    while($DbRow = $DbResult->fetch_assoc())
    8787    {
    8888      $Items[] = array
     
    107107    $TitleLength = 50;
    108108    mb_internal_encoding('utf-8');
    109     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
    110     while($DbRow = mysql_fetch_assoc($DbResult))
     109    $DbResult = $Sytem->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
     110    while($DbRow = $DbResult->fetch_assoc())
    111111    {
    112112      $Title = mb_substr($DbRow['Text'], 0, $TitleLength);
Note: See TracChangeset for help on using the changeset viewer.