Ignore:
Timestamp:
Dec 22, 2009, 10:22:38 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Kontrola správného zadání Id překladové skupiny.
  • Opraveno: Kontrola správného zadání Id překladového jazyka.
  • Upraveno: Zobrazovat PageFooter pouze pokud již byl zobrazen PageHeader.
  • Opraveno: Chyba určení počtu stránek pro zobrazení stránkování.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/TranslationList.php

    r280 r286  
    66
    77$TranslationItemPerPage = 200;
    8 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1; else $GroupId = 1;
     8$GroupId = LoadGroupIdParameter();
    99if(array_key_exists('connexion_id', $_GET)) {
    1010  $_SESSION['connexion_id'] = $_GET['connexion_id'];
    11 }
    12 $DbResult = $Database->SQLCommand('SELECT Id FROM `group` WHERE `Id`='.$GroupId);
    13 if(mysql_num_rows($DbResult) == 0)
    14 {
    15   echo('Neexistující id překladové skupiny.');
    16   ShowFooter();
    17   die();
    1811}
    1912$Table = $TranslationTree[$GroupId]['TablePrefix'];
     
    144137if($Action == 'connexion')
    145138{ //SELECT * FROM spell WHERE entry IN(SELECT entry FROM connexion_item WHERE connexion = 1)
    146         $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT Name FROM connexion WHERE `Id` = '.$_SESSION['connexion_id']));
     139  $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT Name FROM connexion WHERE `Id` = '.$_SESSION['connexion_id']));
    147140    echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
    148141        <a title="Zde je seznam souvislostí" href="?group='.$GroupId.'&amp;action=connexion">Souvislosti</a> - >
     
    166159      <td>'.$Line['Name'].'</td>');
    167160    }
    168         echo ('</table>');
     161  echo ('</table>');
    169162} else
    170163if($Action == 'nocomplete')
     
    196189  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
    197190        <a title="Přeložené questy přilášeného uživatele" href="?group='.$GroupId.'&amp;action=my">Moje překlady</a><br /><br />');
    198   WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where user = '.$_SESSION['UserID'], '', 'my');
     191  WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = '.$Table.'.`user`) AS `User` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID'], '', 'my');
    199192} else
    200193if(($Action == 'mydevelop') and Licence(LICENCE_USER))
     
    202195  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
    203196    <a title="Nedokončené texty" href="?group='.$GroupId.'&amp;action=mydevelop">Rozepsané překlady</a><br /><br />');
    204   WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where user = '.$_SESSION['UserID'].' AND Complete = 0', '', 'mydevelop');
     197  WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID'].' AND `Complete` = 0', '', 'mydevelop');
    205198} else     
    206199if($Action == 'users')
     
    208201  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a> ->
    209202        <strong>Vypsání textů od určitých uživatelů</strong><br /><br />');
    210   $users = @$_POST['users'];
    211  
    212   $WhereUsers = '';
    213    
     203  if(array_key_exists('users', $_POST)) $users = $_POST['users'];
     204    else $users = array();
     205 
     206  $WhereUsers = '';   
    214207  for($i = 0; $i < Count($users); $i++)
    215208  {
    216     if($WhereUsers <> '') $WhereUsers .= ' OR User = '.$users[$i];
    217       else $WhereUsers .= ' User = '.$users[$i];
    218   }
    219   WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where '.$WhereUsers, '', 'users');
     209    if($WhereUsers <> '') $WhereUsers .= ' OR `User` = '.$users[$i];
     210      else $WhereUsers .= ' `User` = '.$users[$i];
     211  }
     212  if($WhereUsers == '') $WhereUsers = '0';
     213 
     214 
     215  WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` WHERE '.$WhereUsers, '', 'users');
    220216} else     
    221217if($Action == 'userall')
    222218{
    223   $ID = $Database->SQLCommand('SELECT user FROM user WHERE id = '.$_GET['user']);
     219  $ID = $Database->SQLCommand('SELECT `user` FROM `user` WHERE `id` = '.$_GET['user']);
    224220  $Line = mysql_fetch_row($ID);
    225221  echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr textů</a>'.
     
    232228  {
    233229    if(array_key_exists('not', $_GET)) {
    234        $sql = 'SELECT COUNT(*) FROM '.$Group['TablePrefix'].' WHERE Complete = 0 AND user='.$_GET['user'];
     230       $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `Complete` = 0 AND `user`='.$_GET['user'];
    235231         $ID = $Database->SQLCommand($sql);
    236232         $Line = mysql_fetch_row($ID);
     
    239235       $Total += $Line[0];
    240236    } else {
    241          $sql = 'SELECT COUNT(*) FROM '.$Group['TablePrefix'].' WHERE user='.$_GET['user'];
     237         $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `user`='.$_GET['user'];
    242238         $ID = $Database->SQLCommand($sql);
    243239         $Line = mysql_fetch_row($ID);
     
    289285  if(array_key_exists('user', $_GET))
    290286  {
    291     $ID = $Database->SQLCommand('SELECT user FROM user WHERE id = '.($_GET['user'] * 1));
     287    $ID = $Database->SQLCommand('SELECT `user` FROM `user` WHERE `id` = '.($_GET['user'] * 1));
    292288    if(mysql_num_rows($ID) > 0)
    293289    {
     
    296292        '<strong>Vypis překladů uživatele '.$Line[0].': </strong><br /><br />');
    297293      if(array_key_exists('not', $_GET))
    298         WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where Complete = 0 AND user = '.$_GET['user'], '', 'userid');
    299       else WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where user = '.$_GET['user'], '', 'userid');
     294        WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` Where `Complete` = 0 AND `user` = '.$_GET['user'], '', 'userid');
     295      else WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` Where `user` = '.$_GET['user'], '', 'userid');
    300296    } else echo('Nebyl nalezen uživatel se zadaným id');
    301297  } else echo('Je nutno zadat id uživatele.');
     
    306302  else $Search = $_POST['search'];
    307303 
    308   $sql = 'SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
     304  $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
    309305    OR `entry` LIKE "%'.$Search.'%"
    310306    OR `Language` LIKE "%'.$Search.'%"
     
    323319  else $Search = $_POST['ID'];
    324320 
    325   $sql = 'SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';
     321  $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';
    326322   
    327323  WriteQuests($sql, '', 'searchentry='.$Search);
     
    333329        <strong>Výpis všech textů s limitem na stránku</strong><br /><br />');
    334330
    335   WritePages('?group='.$GroupId.'&amp;action=all', ' AS items WHERE (items.Language = 0)');
    336 
    337   WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language = 0)', $_SESSION['limitx'].','.$_SESSION['limity'], 'all');
     331  WritePages('?group='.$GroupId.'&amp;action=all', ' AS `items` WHERE (`items`.`Language` = 0)');
     332
     333  WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0)', $_SESSION['limitx'].','.$_SESSION['limity'], 'all');
    338334} else     
    339335if($Action == 'filter')
     
    359355       
    360356  echo('<tr><td><form action="?group='.$GroupId.'&amp;action=users" method="post"><div>'.
    361     '<select name="users[]" size="10" multiple="multiple">');
    362        
    363   $ID = $Database->SQLCommand('SELECT user, ID FROM `user` WHERE
    364     EXISTS(SELECT 1 FROM '.$Table.' WHERE user = user.ID) ORDER BY user');
     357    '<select name="users[]" size="10" multiple="multiple" class="UserList">');
     358       
     359  $ID = $Database->SQLCommand('SELECT `user`, `ID` FROM `user` WHERE
     360    EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `user` = `user`.`ID`) ORDER BY `user`');
    365361  if($ID)
    366362  while($Line = mysql_fetch_assoc($ID))
Note: See TracChangeset for help on using the changeset viewer.