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

    r358 r365  
    1515    $Table = $Group['TablePrefix'];
    1616 
    17     $sql = 'SELECT count(*) FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
    18       OR `entry` LIKE "%'.$Search.'%"
     17    $sql = 'SELECT COUNT(*) FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
     18      OR `Entry` LIKE "%'.$Search.'%"
    1919      OR `User` LIKE "%'.$Search.'%"
    2020      OR `Complete` LIKE "%'.$Search.'%"';
     
    2727  }
    2828 
    29     $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `user` WHERE `user` LIKE "%'.$Search.'%"'));
     29    $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `User` WHERE `User` LIKE "%'.$Search.'%"'));
    3030  echo('<tr><td><a href="userlist.php?search='.$Search.'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>');
    3131    $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"'));
     
    3434  echo('<tr><td><a href="download.php?addon">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>');
    3535  echo('<tr><td><a href="aowow/?search='.$Search.'">Vyhledávací databáze AoWoW</a></td></tr>');
    36     $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND Language = 0'));
     36    $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `Dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = 0'));
    3737  echo('<tr><td><a href="dictionary.php?search='.$Search.'">Slovníček</a></td><td>'.$Line[0].'</td></tr>');
    3838 
    3939  echo('</table>');
    4040}
    41 
    4241
    4342function DatabaseKit()
     
    6261    if(array_key_exists('Type',$_POST))
    6362    {
    64       $sql = 'DELETE FROM log WHERE Type = '.$_POST['Type'];
     63      $sql = 'DELETE FROM `Log` WHERE `Type` = '.$_POST['Type'];
    6564      $Database->SQLCommand($sql);
    6665      WriteLog('Vymazán log '.$_POST['Type'], LOG_TYPE_MODERATOR);
     
    7978        echo($Table.' ');
    8079   
    81         $sql = 'SELECT * FROM '.$Table.' WHERE (Language <> 0) AND (';
     80        $sql = 'SELECT * FROM '.$Table.' WHERE (`Language` <> 0) AND (';
    8281        foreach($Group['Items'] as $Item)
    8382        {
     
    9796          }
    9897          $sql = substr($sql,0,strlen($sql)-1);
    99           $sql .= ' WHERE ID = '.$Line['ID'];
     98          $sql .= ' WHERE `ID` = '.$Line['ID'];
    10099          $Database->SQLCommand($sql);
    101100          echo ('.');
     
    121120        echo($Table.' ');
    122121   
    123         $sql = 'SELECT ID,entry as entry_tran, Take,
    124      (SELECT ID FROM '.$Table.' WHERE Language = 0 AND entry = entry_tran LIMIT 1) as ID_orig
    125       FROM '.$Table.' as tran WHERE (Language <> 0) AND ((Take = 0) OR (ID = Take) OR NOT EXISTS(SELECT 1 FROM '.$Table.' WHERE ID = tran.Take))';
     122        $sql = 'SELECT `ID`, `Entry` AS EntryTran, `Take`,
     123     (SELECT `ID` FROM `'.$Table.'` WHERE `Language = 0 AND `Entry` = `EntryTran` LIMIT 1) AS `IDOrig`
     124      FROM `'.$Table.'` AS `Tran` WHERE (`Language` <> 0) AND ((`Take` = 0) OR (`ID` = `Take`) OR NOT EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `ID` = `Tran`.`Take`))';
    126125     
    127126        $ID = $Database->SQLCommand($sql);
    128127        while($Line = mysql_fetch_assoc($ID))
    129128        {
    130           $sql = 'UPDATE '.$Table.' SET Take = '.$Line['ID_orig'].' WHERE ID = '.$Line['ID'];
     129          $sql = 'UPDATE `'.$Table.'` SET `Take` = '.$Line['IDOrig'].' WHERE `ID` = '.$Line['ID'];
    131130          $Database->SQLCommand($sql);
    132131          echo('.');
     
    151150      {     
    152151        echo ($Table.' ');
    153         $sql = 'SELECT gs_orig.ID, gs_tran.entry, gs_tran.ShortCut as ShortCut_tran, gs_orig.ShortCut  as ShortCut_orig FROM '.$Table.' as gs_tran JOIN '.$Table.' as gs_orig ON gs_orig.entry = gs_tran.entry WHERE gs_tran.Language <> 0 AND gs_tran.ShortCut <> gs_orig.ShortCut';     
     152        $sql = 'SELECT `gs_orig`.`ID`, `gs_tran`.`Entry`, `gs_tran`.`ShortCut` AS `ShortCut_tran`, `gs_orig`.`ShortCut`  AS `ShortCut_orig` FROM `'.$Table.'` AS `gs_tran` JOIN `'.$Table.'` AS `gs_orig` ON `gs_orig`.`Entry` = `gs_tran`.`Entry` WHERE `gs_tran`.`Language` <> 0 AND `gs_tran`.`ShortCut` <> `gs_orig`.`ShortCut`';     
    154153        $ID = $Database->SQLCommand($sql);
    155154        while ($Line = mysql_fetch_assoc($ID))
    156155        {
    157           $sql = 'UPDATE '.$Table.' SET ShortCut = '.$Line['ShortCut_orig'].' WHERE ID = '.$Line['ID'];
     156          $sql = 'UPDATE `'.$Table.'` SET `ShortCut` = '.$Line['ShortCut_orig'].' WHERE `ID` = '.$Line['ID'];
    158157          $Database->SQLCommand($sql);
    159158          echo ('.');
     
    178177  {
    179178    $TextID = $_GET['ID'];       
    180     $Database->SQLCommand('DELETE FROM '.$Table.' WHERE ID = '.$TextID.' AND Language <> 0');
     179    $Database->SQLCommand('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> 0');
    181180    echo('Překlad byl smazán!');   
    182181    WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&amp;ID='.$TextID.'">'.$TextID.'</a>', LOG_TYPE_MODERATOR);
     
    205204  else die('Pro vkládaní musíte byt registrováni!');
    206205    $text = $_POST['text'];
    207     $Database->SQLCommand('INSERT INTO `shoutbox` ( `user` , `text` , `date` , `IP` )
     206    $Database->SQLCommand('INSERT INTO `ShoutBox` ( `User` , `Text` , `Date` , `IP` )
    208207    VALUES ("'.$user.'", "'.$text.'", NOW(), "'.$_SERVER['REMOTE_ADDR'].'")');
    209208    echo('Zpráva vložena!<br>Budete přesměrováni...');   
     
    219218  global $Database;
    220219 
    221   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `shoutbox`');
     220  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ShoutBox`');
    222221  $DbRow = mysql_fetch_row($DbResult);
    223222  $PageList = GetPageList($DbRow[0]);   
     
    227226  if(Licence(LICENCE_USER)) echo(' <a href="action.php?action=shoutbox">Vložit</a>');
    228227  echo('<div class="shoutbox">');
    229   $ID = $Database->SQLCommand('SELECT * FROM `shoutbox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);
     228  $ID = $Database->SQLCommand('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    230229  while($Line = mysql_fetch_assoc($ID))
    231     echo('<div><strong>'.$Line['user'].'</strong>: '.htmlspecialchars($Line['text']).'</div>');
     230    echo('<div><strong>'.$Line['User'].'</strong>: '.htmlspecialchars($Line['Text']).'</div>');
    232231  echo('</div>');
    233232  echo($PageList['Output']);
     
    238237  global $Database;
    239238 
    240   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `news`');
     239  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `News`');
    241240  $DbRow = mysql_fetch_row($DbResult);
    242241  $PageList = GetPageList($DbRow[0]);   
     
    246245  if(Licence(LICENCE_USER)) echo(' <a href="admin.php?action=addnew">Vložit</a>');
    247246  echo('<div class="shoutbox">');
    248   $ID = $Database->SQLCommand('SELECT `news`.`time`, `news`.`text`, `user`.`user` FROM `news` JOIN `user` ON `user`.`ID`=`news`.`user` ORDER BY `news`.`time` DESC '.$PageList['SQLLimit']);
     247  $ID = $Database->SQLCommand('SELECT `News`.`Time`, `News`.`Text`, `User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`ID`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']);
    249248  while($Line = mysql_fetch_assoc($ID))
    250     echo('<div><strong>'.HumanDate($Line['time']).'</strong> '.$Line['text'].' ('.$Line['user'].')</div>');
     249    echo('<div><strong>'.HumanDate($Line['Time']).'</strong> '.$Line['Text'].' ('.$Line['User'].')</div>');
    251250  echo('</div>');
    252251  echo($PageList['Output']);
Note: See TracChangeset for help on using the changeset viewer.