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

    r440 r455  
    66function ExportList()
    77{
    8   global $Database, $User;
     8  global $System, $User;
    99 
    1010  echo('<a href="?Action=ViewList">Všechny</a>');
     
    2222  }
    2323 
    24   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` '.$Filter);
    25   $DbRow = mysql_fetch_row($DbResult);
     24  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter);
     25  $DbRow = $DbResult->fetch_row();
    2626  $PageList = GetPageList($DbRow[0]);   
    2727
     
    4444  echo($Order['Output']);
    4545
    46   $DbResult = $Database->SQLCommand('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (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']);
    47   while($Export = mysql_fetch_assoc($DbResult))
     46  $DbResult = $System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (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']);
     47  while($Export = $DbResult->fetch_assoc())
    4848  {
    4949    $Action = '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=0">Zobrazit</a> <a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=7">Exportovat</a>';
     
    5959function ExportCreate()
    6060{
    61   global $Database, $Config, $User;
     61  global $System, $User;
    6262 
    6363  if($User->Licence(LICENCE_USER))
    6464  {   
    65     $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
    66     $DbRow = mysql_fetch_row($DbResult);
    67     if($DbRow[0] < $Config['MaxExportPerUser'])
     65    $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
     66    $DbRow = $DbResult->fetch_row();
     67    if($DbRow[0] < $System->Config['MaxExportPerUser'])
    6868    {
    6969      echo('<form action="?Action=CreateFinish" method="post">'.
     
    7373      '<tr><td colspan="2"><input type="submit" value="Vytvořit" /></td></tr>'.
    7474      '</table></fieldset></form>');
    75     } else echo('Nemůžete vytvářet další export. Max. počet na uživatele je '.$Config['MaxExportPerUser'].'.');
     75    } else echo('Nemůžete vytvářet další export. Max. počet na uživatele je '.$System->Config['MaxExportPerUser'].'.');
    7676  } else echo('Nemáte oprávnění');
    7777}
     
    7979function ExportCreateFinish()
    8080{
    81   global $Database, $Config, $User, $System;
     81  global $User, $System;
    8282 
    8383  if($User->Licence(LICENCE_USER))
     
    8585    if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    8686    {
    87       $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
    88       $DbRow = mysql_fetch_row($DbResult);
    89       if($DbRow[0] < $Config['MaxExportPerUser'])
     87      $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);
     88      $DbRow = $DbResult->fetch_row();
     89      if($DbRow[0] < $System->Config['MaxExportPerUser'])
    9090      {
    91         $Database->SQLCommand('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
    92         $ExportId = mysql_insert_id();
     91        $System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
     92        $ExportId = $System->database->insert_id;
    9393        echo('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&amp;ExportId='.$ExportId.'">zde</a><br/><br/>');
    9494        WriteLog('Vytvořen nový export <a href="'.$System->Link('/export/?Action=View&amp;ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT);
    9595        $_GET['Filter'] = 'my';
    9696        ExportList();
    97       } else echo('Nemůžete vytvářet další export. Max. počet na uživatele je '.$Config['MaxExportPerUser'].'.');
     97      } else echo('Nemůžete vytvářet další export. Max. počet na uživatele je '.$System->Config['MaxExportPerUser'].'.');
    9898    } else echo('Chybí údaje formuláře');
    9999  } else echo('Nemáte oprávnění');
     
    102102function ExportDelete()
    103103{
    104   global $Database, $User;
     104  global $System, $User;
    105105 
    106106  if($User->Licence(LICENCE_USER))
    107107  {   
    108     $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId'].' AND `User`='.$User->Id);
    109     $Database->SQLCommand('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     108    $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId'].' AND `User`='.$User->Id);
     109    $System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    110110    DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/');
    111111    echo('Export smazán.<br/><br/>');
     
    118118function ExportViewTranslators()
    119119{
    120   global $Database, $TranslationTree, $Config, $User, $System;
     120  global $TranslationTree, $User, $System;
    121121
    122122  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    123   $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    124   $Export = mysql_fetch_assoc($DbRows);
     123  $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     124  $Export = $DbResult->fetch_assoc();
    125125  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
    126126    else $Editable = false;       
     
    140140            else $Selected = false;
    141141          $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId;
    142           $DbResult = $Database->SQLCommand('SELECT * FROM `ExportUser` '.$Condition);
    143           if(mysql_num_rows($DbResult) > 0)
     142          $DbResult = $System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
     143          if($DbResult->num_rows > 0)
    144144          {
    145             if(!$Selected) $Database->SQLCommand('DELETE FROM `ExportUser` '.$Condition);
    146               else $Database->SQLCommand('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
     145            if(!$Selected) $System->Database->query('DELETE FROM `ExportUser` '.$Condition);
     146              else $System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
    147147          } else
    148148          {
    149             if($Selected) $Database->SQLCommand('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
     149            if($Selected) $System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
    150150          }         
    151151        }
     
    153153     
    154154      // Recalculate sequence number
    155       $Database->SQLCommand('SET @I = 0');
    156       $Database->SQLCommand('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
     155      $System->Database->query('SET @I = 0');
     156      $System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
    157157    }
    158158  }
     
    174174  $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`';
    175175
    176   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
    177   $DbRow = mysql_fetch_row($DbResult);
     176  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
     177  $DbRow = $DbResult->fetch_row();
    178178  $PageList = GetPageList($DbRow[0]);   
    179179 
     
    194194
    195195  $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    196   $Database->SQLCommand('SET @I = 0');
    197   $DbResult = $Database->SQLCommand($Query);
    198   while($UserLine = mysql_fetch_assoc($DbResult))
     196  $System->Database->query('SET @I = 0');
     197  $DbResult = $System->Database->query($Query);
     198  while($UserLine = $DbResult->fetch_assoc())
    199199  {
    200200    $XP = GetLevelMinMax($UserLine['XP']);
     
    216216function ExportViewGeneral()
    217217{
    218   global $Database, $User;
     218  global $System, $User;
    219219 
    220220  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    221221  $DisabledTextArea = array(false => ' readonly="yes"', true => '');
    222222  echo('<h3>Obecná nastavení</h3>');
    223   $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    224   $Export = mysql_fetch_assoc($DbRows);
     223  $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     224  $Export = $DbRows->fetch_assoc();
    225225  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
    226226    else $Editable = false;
     
    229229    if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
    230230      else $WithDiacritic = 0;
    231     $Database->SQLCommand('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);
     231    $System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);
    232232    $Export['Title'] = $_POST['Title'];
    233233    $Export['Description'] = $_POST['Description'];
     
    250250function ExportViewLanguages()
    251251{
    252   global $Database, $TranslationTree, $Config, $User;
     252  global $System, $TranslationTree, $User;
    253253
    254254  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    255   $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    256   $Export = mysql_fetch_assoc($DbRows);
     255  $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     256  $Export = $DbRows->fetch_assoc();
    257257  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
    258258    else $Editable = false;
     
    272272            else $Selected = false;
    273273          $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
    274           $DbResult = $Database->SQLCommand('SELECT * FROM `ExportLanguage` '.$Condition);
    275           if(mysql_num_rows($DbResult) > 0)
     274          $DbResult = $System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
     275          if($DbResult->num_rows > 0)
    276276          {
    277             if(!$Selected) $Database->SQLCommand('DELETE FROM `ExportLanguage` '.$Condition);
    278               else $Database->SQLCommand('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
     277            if(!$Selected) $System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
     278              else $System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
    279279          } else
    280280          {
    281             if($Selected) $Database->SQLCommand('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
     281            if($Selected) $System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
    282282          }         
    283283        }
     
    285285     
    286286      // Recalculate sequence number
    287       $Database->SQLCommand('SET @I = 0');
    288       $Database->SQLCommand('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
     287      $System->Database->query('SET @I = 0');
     288      $System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
    289289    }
    290290  }
     
    294294  $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)';
    295295
    296   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
    297   $DbRow = mysql_fetch_row($DbResult);
     296  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
     297  $DbRow = $DbResult->fetch_row();
    298298  $PageList = GetPageList($DbRow[0]);   
    299299 
     
    319319
    320320  $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    321   $Database->SQLCommand('SET @I = 0');
    322   $DbResult = $Database->SQLCommand($Query);
    323   while($Langugage = mysql_fetch_assoc($DbResult))
     321  $System->Database->query('SET @I = 0');
     322  $DbResult = $System->Database->query($Query);
     323  while($Langugage = $DbResult->fetch_assoc())
    324324  {
    325325    $Checked = $Langugage['Sequence'] != '';
     
    337337function ExportViewGroups()
    338338{
    339   global $Database, $TranslationTree, $Config, $User;
     339  global $System, $TranslationTree, $User;
    340340
    341341  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    342   $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
    343   $Export = mysql_fetch_assoc($DbRows);
     342  $DbRows = $System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
     343  $Export = $DbRows->fetch_assoc();
    344344  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
    345345    else $Editable = false;
     
    359359            else $Selected = false;
    360360          $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
    361           $DbResult = $Database->SQLCommand('SELECT * FROM `ExportGroup` '.$Condition);
    362           if(mysql_num_rows($DbResult) > 0)
     361          $DbResult = $System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
     362          if($DbResult->num_rows > 0)
    363363          {
    364             if(!$Selected) $Database->SQLCommand('DELETE FROM `ExportGroup` '.$Condition);
     364            if(!$Selected) $System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
    365365          } else
    366366          {
    367             if($Selected) $Database->SQLCommand('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
     367            if($Selected) $System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
    368368          }         
    369369        }
     
    374374  $Query = 'SELECT `Group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `Group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`Group`.`Id`';
    375375
    376   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
    377   $DbRow = mysql_fetch_row($DbResult);
     376  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
     377  $DbRow = $DbResult->fetch_row();
    378378  $PageList = GetPageList($DbRow[0]);   
    379379 
     
    401401
    402402  $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    403   $DbResult = $Database->SQLCommand($Query);
    404   while($Group = mysql_fetch_assoc($DbResult))
     403  $DbResult = $System->Database->query($Query);
     404  while($Group = $DbResult->fetch_assoc())
    405405  {
    406406    $Checked = $Group['ExportGroupId'] != '';
     
    420420function ExportViewOutputFormat()
    421421{
    422   global $Database, $User;
     422  global $System, $User;
    423423 
    424424  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    425425  if(array_key_exists('ExportId', $_GET))
    426426  {
    427     $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    428     if(mysql_num_rows($DbRows) > 0)
     427    $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     428    if($DbRows->num_rows > 0)
    429429    {   
    430       $Export = mysql_fetch_assoc($DbRows);
     430      $Export = $DbRows->fetch_assoc();
    431431      if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
    432432        else $Editable = false;
     
    434434  if(array_key_exists('OutputType', $_POST))
    435435  {
    436     $Database->SQLCommand('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
    437   }
    438 
    439   $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    440   $Export = mysql_fetch_assoc($DbResult);
     436    $System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
     437  }
     438
     439  $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     440  $Export = $DbResult->fetch_assoc();
    441441 
    442442  echo('<h3>Formát generovaného výstupu</h3>');
     
    447447    '<br />');
    448448  }
    449   $DbResult = $Database->SQLCommand('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
    450   while($ExportFormat = mysql_fetch_assoc($DbResult))
     449  $DbResult = $System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
     450  while($ExportFormat = $DbResult->fetch_assoc())
    451451  {
    452452    echo(RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>');
     
    459459function ExportViewVersion()
    460460{
    461   global $Database, $Config, $User;
     461  global $System, $User;
    462462
    463463  $DisabledInput = array(false => ' disabled="disabled"', true => '');
    464   $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    465   $Export = mysql_fetch_assoc($DbRows);
     464  $DbRows = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     465  $Export = $DbRows->fetch_assoc();
    466466  if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true;
    467467    else $Editable = false;
     
    469469  if(array_key_exists('ClientVersion', $_POST))
    470470  {
    471     $Database->SQLCommand('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
    472   }
    473 
    474   $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    475   $Export = mysql_fetch_assoc($DbResult);
     471    $System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
     472  }
     473
     474  $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     475  $Export = $DbResult->fetch_assoc();
    476476
    477477  $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType'];
    478478
    479   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
    480   $DbRow = mysql_fetch_row($DbResult);
     479  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
     480  $DbRow = $DbResult->fetch_row();
    481481  $PageList = GetPageList($DbRow[0]);   
    482482 
     
    503503
    504504  $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    505   $DbResult = $Database->SQLCommand($Query);
    506   while($Version = mysql_fetch_assoc($DbResult))
     505  $DbResult = $System->Database->query($Query);
     506  while($Version = $DbResult->fetch_assoc())
    507507  {
    508508    echo('<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'.$Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'.HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'.RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable
     
    517517function ExportViewOutput()
    518518{
    519   global $Database;
    520  
    521   $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    522   $Export = mysql_fetch_assoc($DbResult);
    523   $DbResult = $Database->SQLCommand('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
    524   if(mysql_num_rows($DbResult) > 0)
    525   {
    526     $DbResult = $Database->SQLCommand('SELECT * FROM `ExportVersion` WHERE `ExportType`='.$Export[ 'OutputType'].' AND `ClientVersion`='.$Export['ClientVersion']);
    527     if(mysql_num_rows($DbResult) > 0)
     519  global $System;
     520 
     521  $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     522  $Export = $DbResult->fetch_assoc();
     523  $DbResult = $System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
     524  if($DbResult->num_rows > 0)
     525  {
     526    $DbResult = $System->Database->query('SELECT * FROM `ExportVersion` WHERE `ExportType`='.$Export[ 'OutputType'].' AND `ClientVersion`='.$Export['ClientVersion']);
     527    if($DbResult->num_rows > 0)
    528528    { 
    529       $Database->SQLCommand('UPDATE Export SET UsedCount = UsedCount + 1 WHERE Id='.$Export['Id']);
     529      $System->Database->query('UPDATE Export SET UsedCount = UsedCount + 1 WHERE Id='.$Export['Id']);
    530530      ExportOutput($Export['Id'], $Export['OutputType']);
    531531    } else echo('Nebyla vybrána požadovaná verze klienta');
     
    535535function ExportViewStat()
    536536{
    537   global $Database, $System;
     537  global $System;
    538538
    539539  $Export = new Export($System);
     
    547547  $Query = '';
    548548  $UnionItems = array();
    549   $DbResult = $Database->SQLCommand($GroupListQuery);
    550   while($DbRow = mysql_fetch_assoc($DbResult))
     549  $DbResult = $System->Database->query($GroupListQuery);
     550  while($DbRow = $DbResult->fetch_assoc())
    551551  {
    552552    $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    563563  $Query = substr($Query, 0, - 6);
    564564
    565   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
    566   $DbRow = mysql_fetch_row($DbResult);
     565  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
     566  $DbRow = $DbResult->fetch_row();
    567567  $PageList = GetPageList($DbRow[0]); 
    568568  echo('<h3>Statistika dokončení vybraných skupin</h3>');
     
    584584  if(count($UnionItems) > 0)
    585585  {
    586     $ID = $Database->SQLCommand('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    587     while($Group = mysql_fetch_assoc($ID))
     586    $ID = $System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
     587    while($Group = $ID->fetch_assoc())
    588588    {
    589589      echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>');
     
    601601function ExportView()
    602602{
    603   global $Database;
     603  global $System;
    604604
    605605  if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    606606  {
    607     $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    608     if(mysql_num_rows($DbResult) > 0)
     607    $DbResult = $System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
     608    if($DbResult->num_rows > 0)
    609609    {   
    610       $Export = mysql_fetch_assoc($DbResult);
    611  
    612       $DbResult = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID`='.$Export['User']);
    613       $UserLine = mysql_fetch_assoc($DbResult);
     610      $Export = $DbResult->fetch_assoc();
     611 
     612      $DbResult = $System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']);
     613      $UserLine = $DbResult->fetch_assoc();
    614614      echo('Export <strong><a href="?Action=View&amp;Tab=6&amp;ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');
    615615      ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup'));
Note: See TracChangeset for help on using the changeset viewer.