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

    r357 r365  
    4242  echo($Order['Output']);
    4343
    44   $DbResult = $Database->SQLCommand('SELECT `user`.`user` AS `UserName`, `Export`.*, (SELECT COUNT(*) FROM ExportGroup WHERE ExportGroup.Export=Export.Id) AS GroupCount, (SELECT COUNT(*) FROM ExportUser WHERE ExportUser.Export=Export.Id) AS UserCount FROM `Export` LEFT JOIN `user` ON `user`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
     44  $DbResult = $Database->SQLCommand('SELECT `User`.`Name` AS `UserName`, `Export`.*, (SELECT COUNT(*) FROM `ExportGroup` WHERE `ExportGroup`.`Export`=`Export`.`Id`) AS `GroupCount`, (SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
    4545  while($Export = mysql_fetch_assoc($DbResult))
    4646  {
     
    178178    else $InitialOrder = '';
    179179
    180   $Query = 'SELECT (@I := @I + 1) AS Sequence2, TT.* FROM (SELECT ExportUser.Sequence, T.ID, T.TranslatedCount, T.user, T.XP FROM (SELECT user.ID, user.user, user.XP, TranslatedCount FROM `user`) AS T';
    181   $Query .=' LEFT JOIN ExportUser ON ExportUser.Export = '.$_GET['ExportId'].' AND ExportUser.User=T.ID';
    182   $Query .=' WHERE T.TranslatedCount > 0 ORDER BY COALESCE(ExportUser.Sequence, 100000000)'.$InitialOrder.') AS TT';
    183 
    184   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
     180  $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `TT`.* FROM (SELECT `ExportUser`.`Sequence`, `T`.`ID`, `T`.`TranslatedCount`, `T`.`Name`, `T`.`XP` FROM (SELECT `User`.`ID`, `User`.`Name`, `User`.`XP`, `TranslatedCount` FROM `User`) AS T';
     181  $Query .=' LEFT JOIN `ExportUser` ON `ExportUser`.`Export` = '.$_GET['ExportId'].' AND `ExportUser`.`User`=`T`.`ID`';
     182  $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`';
     183
     184  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
    185185  $DbRow = mysql_fetch_row($DbResult);
    186186  $PageList = GetPageList($DbRow[0]);   
     
    210210    $Sequence = '<input type="text" name="seq'.$User['ID'].'" style="text-align: center; width: 40px;" value="'.$User['Sequence2'].'"'.$DisabledInput[$Editable].'/>';
    211211    echo('<tr>
    212     <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$User['ID'].'&amp;action=userall" title="Zobrazit všechny jeho přeložené texty">'.$User['user'].'</a></td>
     212    <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$User['ID'].'&amp;action=userall" title="Zobrazit všechny jeho přeložené texty">'.$User['Name'].'</a></td>
    213213    <td>'.$User['TranslatedCount'].'</td>
    214       <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$User['user'].'/level.png" alt="Úroveň uživatele" /></td>
     214      <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$User['Name'].'/level.png" alt="Úroveň uživatele" /></td>
    215215    <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>');
    216216  }
     
    269269  if(array_key_exists('ExportId', $_GET))
    270270  {
    271     $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     271    $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    272272    if(mysql_num_rows($DbRows) > 0)
    273273    {   
     
    289289          if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
    290290            else $Selected = false;
    291           $Condition = ' WHERE Export='.$_GET['ExportId'].' AND Language='.$LanguageId;
    292           $DbResult = $Database->SQLCommand('SELECT * FROM ExportLanguage '.$Condition);
     291          $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
     292          $DbResult = $Database->SQLCommand('SELECT * FROM `ExportLanguage` '.$Condition);
    293293          if(mysql_num_rows($DbResult) > 0)
    294294          {
    295             if(!$Selected) $Database->SQLCommand('DELETE FROM ExportLanguage '.$Condition);
    296               else $Database->SQLCommand('UPDATE ExportLanguage SET Sequence='.$Value.$Condition);
     295            if(!$Selected) $Database->SQLCommand('DELETE FROM `ExportLanguage` '.$Condition);
     296              else $Database->SQLCommand('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
    297297          } else
    298298          {
    299             if($Selected) $Database->SQLCommand('INSERT INTO ExportLanguage (Export, Language, Sequence) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
     299            if($Selected) $Database->SQLCommand('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
    300300          }         
    301301        }
     
    304304      // Recalculate sequence number
    305305      $Database->SQLCommand('SET @I = 0');
    306       $Database->SQLCommand('UPDATE ExportLanguage SET Sequence = (@I := @I + 1) WHERE Export='.$_GET['ExportId'].' ORDER BY Sequence;');
     306      $Database->SQLCommand('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
    307307    }
    308308  }
    309309
    310   $Query = 'SELECT (@I := @I + 1) AS Sequence2, Sequence, language.Id, Name FROM language';
    311   $Query .=' LEFT JOIN ExportLanguage ON ExportLanguage.Export = '.$_GET['ExportId'].' AND ExportLanguage.Language=language.Id';
    312   $Query .=' WHERE language.Enabled = 1 ORDER BY COALESCE(Sequence, 100)';
     310  $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `Sequence`, `Language`.`Id`, `Name` FROM `Language`';
     311  $Query .=' LEFT JOIN `ExportLanguage` ON `ExportLanguage`.`Export` = '.$_GET['ExportId'].' AND `ExportLanguage`.`Language`=`Language`.`Id`';
     312  $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)';
    313313
    314314  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
     
    451451  if(array_key_exists('ExportId', $_GET))
    452452  {
    453     $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     453    $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    454454    if(mysql_num_rows($DbRows) > 0)
    455455    {   
     
    463463  }
    464464
    465   $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     465  $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    466466  $Export = mysql_fetch_assoc($DbResult);
    467467 
     
    473473    '<br />');
    474474  }
    475   $DbResult = $Database->SQLCommand('SELECT * FROM ExportOutputType ORDER BY Name');
     475  $DbResult = $Database->SQLCommand('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
    476476  while($ExportFormat = mysql_fetch_assoc($DbResult))
    477477  {
     
    490490  if(array_key_exists('ExportId', $_GET))
    491491  {
    492     $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     492    $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    493493    if(mysql_num_rows($DbRows) > 0)
    494494    {   
     
    499499  if(array_key_exists('ClientVersion', $_POST))
    500500  {
    501     $Database->SQLCommand('UPDATE Export SET ClientVersion='.$_POST['ClientVersion'].' WHERE Id='.$_GET['ExportId']);
    502   }
    503 
    504   $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     501    $Database->SQLCommand('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
     502  }
     503
     504  $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    505505  $Export = mysql_fetch_assoc($DbResult);
    506506
    507   $Query = 'SELECT wow_client_version.* FROM ExportVersion LEFT JOIN wow_client_version ON wow_client_version.Id=ExportVersion.ClientVersion WHERE ExportType='.$Export['OutputType'];
    508 
    509   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
     507  $Query = 'SELECT `wow_client_version`.* FROM `ExportVersion` LEFT JOIN `wow_client_version` ON `wow_client_version`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType'];
     508
     509  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
    510510  $DbRow = mysql_fetch_row($DbResult);
    511511  $PageList = GetPageList($DbRow[0]);   
     
    532532  echo($Order['Output']);
    533533
    534   $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
     534  $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    535535  $DbResult = $Database->SQLCommand($Query);
    536536  while($Version = mysql_fetch_assoc($DbResult))
     
    551551  global $Database;
    552552 
    553   $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     553  $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    554554  $Export = mysql_fetch_assoc($DbResult);
    555   $DbResult = $Database->SQLCommand('SELECT * FROM ExportOutputType WHERE Id='.$Export['OutputType']);
     555  $DbResult = $Database->SQLCommand('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
    556556  if(mysql_num_rows($DbResult) > 0)
    557557  {
    558     $DbResult = $Database->SQLCommand('SELECT * FROM ExportVersion WHERE ExportType='.$Export[ 'OutputType'].' AND ClientVersion='.$Export['ClientVersion']);
     558    $DbResult = $Database->SQLCommand('SELECT * FROM `ExportVersion` WHERE `ExportType`='.$Export[ 'OutputType'].' AND `ClientVersion`='.$Export['ClientVersion']);
    559559    if(mysql_num_rows($DbResult) > 0)
    560560    { 
     
    569569  global $Database;
    570570
    571   $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     571  $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    572572  $Export = mysql_fetch_assoc($DbResult);
    573   $DbResult = $Database->SQLCommand('SELECT * FROM user WHERE ID='.$Export['User']);
     573  $DbResult = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID`='.$Export['User']);
    574574  $User = mysql_fetch_assoc($DbResult);
    575   echo('Export <strong><a href="?Action=View&amp;Tab=6&amp;ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$User['user'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');
     575  echo('Export <strong><a href="?Action=View&amp;Tab=6&amp;ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$User['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');
    576576  ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Výstup'));
    577577  echo('<div id="content">');
Note: See TracChangeset for help on using the changeset viewer.