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/TranslationList.php

    r322 r365  
    88 
    99  // Get total item count
    10   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS T');
     10  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `T`');
    1111  $DbRow = mysql_fetch_row($DbResult);
    1212  $PageList = GetPageList($DbRow[0]);   
     
    1616  $TableColumns = array(
    1717    array('Name' => 'ID', 'Title' => 'Pořadové číslo'),
    18     array('Name' => 'entry', 'Title' => 'Identifikační číslo'),
     18    array('Name' => 'Entry', 'Title' => 'Identifikační číslo'),
    1919    array('Name' => $TranslationTree[$GroupId]['Items'][0]['Column'], 'Title' => 'Název'),
    2020    array('Name' => 'VersionStart', 'Title' => 'Verze'),
     
    3131  while($Line = mysql_fetch_assoc($DbResult))
    3232  {
    33     echo('<tr><td><a href="form.php?group='.$GroupId.'&amp;ID='.$Line['ID'].'">'.$Line['ID'].'</a></td><td>'.$Line['entry'].'</td>'.
     33    echo('<tr><td><a href="form.php?group='.$GroupId.'&amp;ID='.$Line['ID'].'">'.$Line['ID'].'</a></td><td>'.$Line['Entry'].'</td>'.
    3434      '<td>'.htmlspecialchars($Line[$TranslationTree[$GroupId]['Items'][0]['Column']]).'</td>'.
    3535      '<td>'.GetVersionWOW($Line['VersionStart']).'-'.GetVersionWOW($Line['VersionEnd']).'</td>');
     
    5151  '<strong>Vypsání nepřeložených textů s limitem na stránku</strong><br /><br />');
    5252
    53   WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0) AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Language` <> 0) AND (`sub`.`entry` = `items`.`entry`) AND (`sub`.`Complete`=1) AND (`sub`.`VersionStart` = `items`.`VersionStart`) AND (`sub`.`VersionEnd` = `items`.`VersionEnd`))');
     53  WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0) AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Language` <> 0) AND (`sub`.`Entry` = `items`.`Entry`) AND (`sub`.`Complete`=1) AND (`sub`.`VersionStart` = `items`.`VersionStart`) AND (`sub`.`VersionEnd` = `items`.`VersionEnd`))');
    5454}
    5555
     
    6060  if(array_key_exists('connexion_id', $_GET)) $_SESSION['connexion_id'] = $_GET['connexion_id'];
    6161
    62  //SELECT * FROM spell WHERE entry IN(SELECT entry FROM connexion_item WHERE connexion = 1)
    6362  $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT `Name` FROM `connexion` WHERE `Id` = '.$_SESSION['connexion_id']));
    6463    echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
     
    6665        <strong>Vypsání souvislostí ze skupiny '.$Line['Name'].'</strong><br /><br />');
    6766
    68    WriteQuests('SELECT *, (SELECT `sub`.`User` FROM `'.$Table.'` AS `sub` WHERE (`sub`.`entry` = `'.$Table.'`.`entry`) AND (`Language` <> 0) LIMIT 1) AS `UserID`, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `UserID`) AS `UserName` FROM `'.$Table.'` WHERE (`Language` = 0) AND (`entry` IN(SELECT `entry` FROM `connexion_item` WHERE `connexion` = '.$_SESSION['connexion_id'].') AND `VersionEnd` = "'.$BuildNumber_max.'" AND `VersionEnd` = "'.$BuildNumber_max.'"');
     67   WriteQuests('SELECT *, (SELECT `sub`.`User` FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Entry` = `'.$Table.'`.`Entry`) AND (`Language` <> 0) LIMIT 1) AS `UserID`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `UserID`) AS `UserName` FROM `'.$Table.'` WHERE (`Language` = 0) AND (`Entry` IN(SELECT `Entry` FROM `connexion_item` WHERE `connexion` = '.$_SESSION['connexion_id'].') AND `VersionEnd` = "'.$BuildNumber_max.'" AND `VersionEnd` = "'.$BuildNumber_max.'"');
    6968}
    7069
     
    7372  global $GroupId, $Table, $BuildNumber_max, $Database;
    7473
    75  //SELECT * FROM spell WHERE entry IN(SELECT entry FROM connexion_item WHERE connexion = 1)
    7674  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> -> '.
    7775    '<a title="Zde je seznam souvislostí" href="?group='.$GroupId.'&amp;action=connexion">Souvislosti</a> - > '.
     
    7977  echo('<table class="BaseTable"><tr><th>Pořadové číslo</th><th>Název</th>');
    8078  echo('</tr>');
    81   $ID = $Database->SQLCommand('SELECT * FROM connexion WHERE `Group` = '.$GroupId);       
     79  $ID = $Database->SQLCommand('SELECT * FROM `connexion` WHERE `Group` = '.$GroupId);       
    8280  while($Line = mysql_fetch_assoc($ID))
    8381  {
     
    9694        <strong>Vypsání nedokončených textů s limitem na stránku</strong><br /><br />');
    9795
    98   WriteQuests('SELECT `items`.*, `user`.`user` AS `UserName` FROM `'.$Table.'` AS `items` JOIN `user` ON `user`.`id` = `items`.`User` WHERE (`items`.`Language` = 0) AND
    99     NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Language` <> 0) AND (`sub`.`entry` = `items`.`entry`) AND (`sub`.`Complete` = 1) AND (`VersionEnd` = '.$BuildNumber_max.')) AND
    100    EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub2` WHERE (`sub2`.`Language` <> 0) AND (`sub2`.`entry` = `items`.`entry`) AND (`sub2`.`Complete` = 0) AND (`VersionEnd` = '.$BuildNumber_max.')) AND (`items`.`VersionEnd` = '.$BuildNumber_max.')');
     96  WriteQuests('SELECT `items`.*, `User`.`Name` AS `UserName` FROM `'.$Table.'` AS `items` JOIN `User` ON `User`.`ID` = `items`.`User` WHERE (`items`.`Language` = 0) AND
     97    NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Language` <> 0) AND (`sub`.`Entry` = `items`.`Entry`) AND (`sub`.`Complete` = 1) AND (`VersionEnd` = '.$BuildNumber_max.')) AND
     98   EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub2` WHERE (`sub2`.`Language` <> 0) AND (`sub2`.`Entry` = `items`.`Entry`) AND (`sub2`.`Complete` = 0) AND (`VersionEnd` = '.$BuildNumber_max.')) AND (`items`.`VersionEnd` = '.$BuildNumber_max.')');
    10199}
    102100
     
    108106     <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat texty" href="?group='.$GroupId.'&amp;action=Translate">Přeložené texty</a><br /><br />');
    109107     
    110   WriteQuests('SELECT `'.$Table.'`.*, `user`.`user` AS `UserName` FROM `'.$Table.'` JOIN `user` ON `user`.`id` = `'.$Table.'`.`User` WHERE (`'.$Table.'`.`Language` <> 0) AND (`'.$Table.'`.`Complete` = 1)');
     108  WriteQuests('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName` FROM `'.$Table.'` JOIN `User` ON `User`.`ID` = `'.$Table.'`.`User` WHERE (`'.$Table.'`.`Language` <> 0) AND (`'.$Table.'`.`Complete` = 1)');
    111109}
    112110
     
    117115  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
    118116        <a title="Přeložené questy přilášeného uživatele" href="?group='.$GroupId.'&amp;action=my">Moje překlady</a><br /><br />');
    119   WriteQuests('SELECT `'.$Table.'`.*, `user`.`user` AS `UserName` FROM `'.$Table.'` JOIN `user` ON `user`.`id` = `'.$Table.'`.`user` WHERE `'.$Table.'`.`user` = '.$_SESSION['UserID']);
     117  WriteQuests('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName` FROM `'.$Table.'` JOIN `User` ON `User`.`id` = `'.$Table.'`.`User` WHERE `'.$Table.'`.`User` = '.$_SESSION['UserID']);
    120118}
    121119
     
    126124  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
    127125    <a title="Nedokončené texty" href="?group='.$GroupId.'&amp;action=mydevelop">Rozepsané překlady</a><br /><br />');
    128   WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `user` = '.$_SESSION['UserID'].' AND `Complete` = 0');
     126  WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `User` = '.$_SESSION['UserID'].' AND `Complete` = 0');
    129127}
    130128
     
    146144  if($WhereUsers == '') $WhereUsers = '0'; 
    147145 
    148   WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE '.$WhereUsers);
     146  WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE '.$WhereUsers);
    149147}
    150148
     
    153151  global $Database, $Table, $GroupId, $TranslationTree;
    154152 
    155   $ID = $Database->SQLCommand('SELECT `user` FROM `user` WHERE `id` = '.$_GET['user']);
     153  $ID = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID` = '.$_GET['user']);
    156154  $Line = mysql_fetch_row($ID);
    157155  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a>'.
     
    165163      if(array_key_exists('not', $_GET))
    166164      {
    167         $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `Complete` = 0 AND `user`='.$_GET['user'];
     165        $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `Complete` = 0 AND `User`='.$_GET['user'];
    168166        $ID = $Database->SQLCommand($sql);
    169167        $Line = mysql_fetch_row($ID);
     
    173171      } else
    174172      {
    175         $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `user`='.$_GET['user'];
     173        $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `User`='.$_GET['user'];
    176174        $ID = $Database->SQLCommand($sql);
    177175        $Line = mysql_fetch_row($ID);
     
    223221  if(array_key_exists('user', $_GET))
    224222  {
    225     $ID = $Database->SQLCommand('SELECT `user` FROM `user` WHERE `id` = '.($_GET['user'] * 1));
     223    $ID = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID` = '.($_GET['user'] * 1));
    226224    if(mysql_num_rows($ID) > 0)
    227225    {
     
    230228        '<strong>Vypis překladů uživatele '.$Line[0].': </strong><br /><br />');
    231229      if(array_key_exists('not', $_GET))
    232         WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE (`Complete` = 0) AND (`user` = '.$_GET['user'].')');
    233       else WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `user` = '.$_GET['user']);
     230        WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Complete` = 0) AND (`User` = '.$_GET['user'].')');
     231      else WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `User` = '.$_GET['user']);
    234232    } else echo('Nebyl nalezen uživatel se zadaným id');
    235233  } else echo('Je nutno zadat id uživatele.');
     
    244242  else ErrorMessage('Nebyl zadán text k vyhledání.');
    245243 
    246   $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
    247     OR `entry` LIKE "%'.$Search.'%"
     244  $sql = 'SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
     245    OR `Entry` LIKE "%'.$Search.'%"
    248246    OR `Language` LIKE "%'.$Search.'%"
    249247    OR `User` LIKE "%'.$Search.'%"
     
    265263  else $Search = '';
    266264 
    267   $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';
     265  $sql = 'SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `Entry` LIKE "'.$Search.'"';
    268266   
    269267  WriteQuests($sql);
     
    278276        <strong>Výpis všech textů s limitem na stránku</strong><br /><br />');
    279277
    280   WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0)');
     278  WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`'.$Table.'`.`Language` = 0)');
    281279}
    282280
     
    307305    '<select name="users[]" size="10" multiple="multiple" class="UserList">');
    308306       
    309   $ID = $Database->SQLCommand('SELECT `user`, `ID` FROM `user` WHERE
    310     EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `user` = `user`.`ID`) ORDER BY `user`');
     307  $ID = $Database->SQLCommand('SELECT `Name`, `ID` FROM `User` WHERE
     308    EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `User` = `User`.`ID`) ORDER BY `Name`');
    311309  if($ID)
    312310  while($Line = mysql_fetch_assoc($ID))
    313     echo('<option value="'.$Line['ID'].'">'.$Line['user'].'</option>');
     311    echo('<option value="'.$Line['ID'].'">'.$Line['Name'].'</option>');
    314312 
    315313  echo('</select><br />
     
    331329                                               
    332330  echo('</table>');
    333   //  WriteQuests("SELECT * FROM quests Where user = ".$_SESSION['UserID']." AND Complete = '0'", '', 'mydevelop');
    334331}
    335332
Note: See TracChangeset for help on using the changeset viewer.