Changeset 455


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.
Location:
trunk
Files:
1 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/Options.php

    r376 r455  
    1717    if($NewPass == $NewPass2)
    1818    {
    19       $DbResult = $Database->SQLCommand('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id);
    20       $DbRow = mysql_fetch_assoc($DbResult);
     19      $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id);
     20      $DbRow = $DbResult->fetch_assoc();
    2121      if($DbRow['Hash'] == $DbRow['Pass'])
    2222      {     
    2323        // Update password
    2424        $Salt = $User->GetPasswordSalt();
    25         $Database->SQLCommand('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id);
     25        $System->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id);
    2626        echo('Heslo změněno!<br />');
    2727      } else echo('<br />Staré heslo neodpovídá!<br />');
    2828    } else echo('<br />Hesla se neshodují!<br />');
    2929   
    30     $Database->SQLCommand('UPDATE `User` SET `Email` = "'.$Email.'", `Language` = "'.$Language.'", `Redirecting` = "'.$Redirecting.'" WHERE `ID` = '.$User->Id);
     30    $System->Database->query('UPDATE `User` SET `Email` = "'.$Email.'", `Language` = "'.$Language.'", `Redirecting` = "'.$Redirecting.'" WHERE `ID` = '.$User->Id);
    3131    echo('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b><br />');
    3232    WriteLog('Úprava nastavení!', LOG_TYPE_USER);
     
    8484
    8585    echo('  <fieldset><legend>Překladatelský tým</legend>');
    86     $ID = $Database->SQLCommand('SELECT * FROM `Team`');
     86    $DbResult = $System->Database->query('SELECT * FROM `Team`');
    8787    echo('<a href="team.php?action=create">Vytvořit tým</a><br />'.
    8888      '<a href="team.php?action=leave">Opustit tým</a><br />'.
     
    9090      '<input type="hidden" name="action" value="gointeam"/>'.
    9191      '<select name="id">');
    92     while($LineTeam = mysql_fetch_assoc($ID))
     92    while($LineTeam = $DbResult->fetch_assoc())
    9393    {
    9494      echo('<option value="'.$LineTeam['Id'].'"');
  • trunk/TranslationList.php

    r446 r455  
    249249function ShowGroupTypeList()
    250250{
    251   global $Database, $User;
    252  
    253   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Group`');
    254   $DbRow = mysql_fetch_row($DbResult);
     251  global $System, $User;
     252 
     253  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Group`');
     254  $DbRow = $DbResult->fetch_row();
    255255  $PageList = GetPageList($DbRow[0]); 
    256256  echo('<h3>Seznam překladových skupin</h3>');
     
    269269  echo($Order['Output']);
    270270
    271   $ID = $Database->SQLCommand('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    272   while($Group = mysql_fetch_assoc($ID))
     271  $DbResult = $System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
     272  while($Group = $DbResult->fetch_assoc())
    273273  {
    274274    echo('<tr><td><a href="?group='.$Group['Id'].'&amp;action=filter">'.$Group['Name'].'</a></td><td>'.$Group['SourceType'].'</td><td>');
     
    285285function ShowMenu()
    286286{
    287   global $Database, $User, $TranslationTree;
     287  global $User, $TranslationTree;
    288288 
    289289  $GroupId = GetParameter('group', 0, true);
  • trunk/action.php

    r436 r455  
    55function Search()
    66{
    7   global $Database, $TranslationTree;
     7  global $System, $TranslationTree;
    88 
    99  if(array_key_exists('search', $_GET)) $Search = $_GET['search'];
     
    2222      if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"';
    2323    }
    24     $Line = mysql_fetch_row($Database->SQLCommand($sql));
     24    $DbResult = $System->Database->query($sql);
     25    $Line = $DbResult->fetch_row();
    2526    echo('<tr><td><a href="TranslationList.php?group='.$Group['Id'].'&amp;user=0&amp;state=0&amp;text='.$Search.'&amp;entry=">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>');
    2627  }
    2728 
    28     $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `User` WHERE `Name` LIKE "%'.$Search.'%"'));
     29  $DbResult = $System->Database->query('SELECT count(*) FROM `User` WHERE `Name` LIKE "%'.$Search.'%"');
     30  $Line = $DbResult->fetch_row();
    2931  echo('<tr><td><a href="userlist.php?search='.$Search.'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>');
    30     $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"'));
     32 
     33  $DbResult = $System->Database->query('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"');
     34  $Line = $DbResult->fetch_row();
    3135  echo('<tr><td><a href="team.php?search='.$Search.'">Týmy</a></td><td>'.$Line[0].'</td></tr>');
    32     $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `CzWoWPackageVersion` WHERE `Text` LIKE "%'.$Search.'%"'));
     36 
     37  $DbResult = $System->Database->query('SELECT count(*) FROM `CzWoWPackageVersion` WHERE `Text` LIKE "%'.$Search.'%"');
     38  $Line = $DbResult->fetch_row();
    3339  echo('<tr><td><a href="download.php?addon">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>');
    3440  echo('<tr><td><a href="aowow/?search='.$Search.'">Vyhledávací databáze AoWoW</a></td></tr>');
    35     $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `Dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = 0'));
     41 
     42  $DbResult = $System->Database->query('SELECT count(*) FROM `Dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = 0');
     43  $Line = $DbResult->fetch_row();
    3644  echo('<tr><td><a href="dictionary.php?search='.$Search.'">Slovníček</a></td><td>'.$Line[0].'</td></tr>');
    3745 
     
    4149function DatabaseKit()
    4250{
    43   global $Database, $TranslationTree, $User;
     51  global $System, $TranslationTree, $User;
    4452 
    4553  if($User->Licence(LICENCE_ADMIN))
     
    6169    {
    6270      $sql = 'DELETE FROM `Log` WHERE `Type` = '.$_POST['Type'];
    63       $Database->SQLCommand($sql);
     71      $System->Database->query($sql);
    6472      WriteLog('Vymazán log '.$_POST['Type'], LOG_TYPE_MODERATOR);
    6573      echo(' Vymazán log '.$_POST['Type']);
     
    8593        $sql .= ')';
    8694     
    87         $ID = $Database->SQLCommand($sql);
    88         while ($Line = mysql_fetch_assoc($ID))
     95        $DbResult = $System->Database->query($sql);
     96        while ($Line = $DbResult->fetch_assoc())
    8997        {
    9098          $sql = 'UPDATE '.$Table.' SET ';
     
    96104          $sql = substr($sql,0,strlen($sql)-1);
    97105          $sql .= ' WHERE `ID` = '.$Line['ID'];
    98           $Database->SQLCommand($sql);
     106          $System->Database->query($sql);
    99107          echo ('.');
    100108        }
     
    123131      FROM `'.$Table.'` AS `Tran` WHERE (`Language` <> 0) AND ((`Take` = 0) OR (`ID` = `Take`) OR NOT EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `ID` = `Tran`.`Take`))';
    124132     
    125         $ID = $Database->SQLCommand($sql);
    126         while($Line = mysql_fetch_assoc($ID))
     133        $DbResult = $System->Database->query($sql);
     134        while($Line = $DbResult->fetch_assoc())
    127135        {
    128136          $sql = 'UPDATE `'.$Table.'` SET `Take` = '.$Line['IDOrig'].' WHERE `ID` = '.$Line['ID'];
    129           $Database->SQLCommand($sql);
     137          $System->Database->query($sql);
    130138          echo('.');
    131139        }
     
    150158        echo ($Table.' ');
    151159        $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         $ID = $Database->SQLCommand($sql);
    153         while ($Line = mysql_fetch_assoc($ID))
     160        $DbResult = $System->Database->query($sql);
     161        while ($Line = $DbResult->fetch_assoc())
    154162        {
    155163          $sql = 'UPDATE `'.$Table.'` SET `ShortCut` = '.$Line['ShortCut_orig'].' WHERE `ID` = '.$Line['ID'];
    156           $Database->SQLCommand($sql);
     164          $System->Database->query($sql);
    157165          echo ('.');
    158166        }
    159167   
    160168        echo (' <strong>Hotovo</strong> <br />');
    161         if(mysql_num_rows($ID) > 0)
    162         {
    163           WriteLog('Použita oprava DB na sloupec ShortCut '.mysql_num_rows($ID).' řádků z tabulky '.$Table, LOG_TYPE_MODERATOR);
    164           echo (' Použita oprava DB na sloupec ShortCut '.mysql_num_rows($ID).' řádků z tabulky '.$Table.'<br />');
     169        if($DbResult->num_rows > 0)
     170        {
     171          WriteLog('Použita oprava DB na sloupec ShortCut '.$DbResult->num_rows.' řádků z tabulky '.$Table, LOG_TYPE_MODERATOR);
     172          echo (' Použita oprava DB na sloupec ShortCut '.$DbResult->num_rows.' řádků z tabulky '.$Table.'<br />');
    165173        }
    166174      }
     
    171179function Delete()
    172180{
    173   global $Database, $User;
     181  global $System, $User;
    174182 
    175183  if($User->Licence(LICENCE_MODERATOR))
    176184  {
    177185    $TextID = $_GET['ID'];       
    178     $Database->SQLCommand('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> 0');
     186    $System->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> 0');
    179187    echo('Překlad byl smazán!');   
    180188    WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&amp;ID='.$TextID.'">'.$TextID.'</a>', LOG_TYPE_MODERATOR);
     
    184192function ShoutBox()
    185193{
    186   global $Database, $User;
    187  
    188   if(array_key_exists('shoutbox', $_GET)) $shoutbox = $_GET['shoutbox'];
    189   else $shoutbox = '';
    190   if($shoutbox == '')
    191   {
    192     echo('<form action="action.php?action=shoutbox&amp;shoutbox=1" method="post"><fieldset><legend>Nová zpráva kecátka</legend>
    193       Uživatel: ');
     194  global $System, $User;
     195 
     196  if(!array_key_exists('add', $_POST))
     197  {
     198    echo('<form action="action.php?action=shoutbox" method="post">'.
     199    '<fieldset><legend>Nová zpráva kecátka</legend>
     200     Uživatel: ');
    194201    if($User->Licence(LICENCE_USER)) echo('<b>'.$User->Name.'</b><br />');
    195   else echo('<input type="text" name="user" /><br />');
     202    else echo('<input type="text" name="user" /><br />');
    196203    echo('Text zprávy: <br>
    197204      <textarea  onkeydown="ResizeTextArea(this)" name="text" cols="40"></textarea> <br />
    198       <input type="submit" value="Odeslat" /><br /></fieldset>
     205      <input type="submit" name="add" value="Odeslat" /><br /></fieldset>
    199206      </form>');
    200207  } else
     
    202209    if($User->Licence(LICENCE_USER))
    203210    {
    204       $Text = $_POST['text'];
    205       $Database->SQLCommand('INSERT INTO `ShoutBox` ( `User` , `Text` , `Date` , `IP` ) '.
     211      if(array_key_exists('text', $_POST))
     212      {
     213        $Text = $_POST['text'];
     214        $System->Database->query('INSERT INTO `ShoutBox` ( `User` , `Text` , `Date` , `IP` ) '.
    206215      ' VALUES ("'.$User->Name.'", "'.$Text.'", NOW(), "'.$_SERVER['REMOTE_ADDR'].'")');
    207       echo('Zpráva vložena!<br>Budete přesměrováni...');   
    208       echo('
    209         <script type="text/javascript" language="JavaScript" charset="utf-8">
    210             setTimeout("parent.location.href=\'index.php\'",1000)
    211         </script>');
    212     } else echo('Pro vkládaní musíte byt registrováni!');
    213   }
     216        echo('Zpráva vložena!<br/>');   
     217      } else echo('Nezadán text pro novou zprávu!<br/>');   
     218    } else echo('Pro vkládaní musíte byt registrováni!<br/>');
     219  }
     220  echo('<br/>');
     221  ShoutBoxView();
    214222}
    215223
    216224function ShoutBoxView()
    217225{
    218   global $Database, $User;
    219  
    220   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ShoutBox`');
    221   $DbRow = mysql_fetch_row($DbResult);
     226  global $System, $User;
     227 
     228  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ShoutBox`');
     229  $DbRow = $DbResult->fetch_row();
    222230  $PageList = GetPageList($DbRow[0]);   
    223231
     
    226234  if($User->Licence(LICENCE_USER)) echo(' <a href="action.php?action=shoutbox">Vložit</a>');
    227235  echo('<div class="shoutbox">');
    228   $ID = $Database->SQLCommand('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    229   while($Line = mysql_fetch_assoc($ID))
     236  $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);
     237  while($Line = $DbResult->fetch_assoc())
    230238    echo('<div><strong>'.$Line['User'].'</strong>: '.htmlspecialchars($Line['Text']).'</div>');
    231239  echo('</div>');
     
    235243function ShowNewsHistory()
    236244{
    237   global $Database, $User;
    238  
    239   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `News`');
    240   $DbRow = mysql_fetch_row($DbResult);
     245  global $System, $User;
     246 
     247  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `News`');
     248  $DbRow = $DbResult->fetch_row();
    241249  $PageList = GetPageList($DbRow[0]);   
    242250
     
    245253  if($User->Licence(LICENCE_USER)) echo(' <a href="admin.php?action=addnew">Vložit</a>');
    246254  echo('<div class="shoutbox">');
    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']);
    248   while($Line = mysql_fetch_assoc($ID))
     255  $dbResult = $System->Database->query('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']);
     256  while($Line = $DbResult->fetch_assoc())
    249257    echo('<div><strong>'.HumanDate($Line['Time']).'</strong> '.$Line['Text'].' ('.$Line['User'].')</div>');
    250258  echo('</div>');
  • trunk/admin.php

    r417 r455  
    4141function SaveNew()
    4242{
    43   global $Database, $Config, $User;
     43  global $System, $Config, $User;
    4444 
    4545  if(array_key_exists('text', $_POST))
    4646  {
    4747    $querty = 'INSERT INTO `News` ( `Time` ,`User` ,`Text`) VALUES ( NOW( ) , '.$User->Id.', "'.$_POST['text'].'")';
    48     $Database->SQLCommand($querty);
     48    $System->Database->query($querty);
    4949    echo('Aktualita uložena!');
    5050    WriteLog('Vložena nová aktualita', LOG_TYPE_ADMINISTRATION);
     
    5454function DeleteOldUsers()
    5555{
    56   global $Database;
     56  global $System;
    5757 
    58   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`');
    59   $DbRow2 = mysql_fetch_row($DbResult);
     58  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `User`');
     59  $DbRow2 = $DbResult->fetch_row();
    6060
    6161  $Condition = ' WHERE (`TranslatedCount`= 0)'. // Without translated texts
     
    6767    ' AND (NOT EXISTS (SELECT `ID` FROM `ShoutBox` WHERE `User`.`Name` = `ShoutBox`.`User`))'. // Without shoutbox messages
    6868    '';
    69   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`'.$Condition);
    70   $DbRow = mysql_fetch_row($DbResult);
    71   $Database->SQLCommand('DELETE FROM `User`'.$Condition);
     69  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `User`'.$Condition);
     70  $DbRow = $DbResult->fetch_row();
     71  $System->Database->query('DELETE FROM `User`'.$Condition);
    7272  echo('Smazáno '.$DbRow[0].' účtů ze všech '.$DbRow2[0].'<br/>');
    7373
    7474  // Delete logs without user
    75   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log`');
    76   $DbRow2 = mysql_fetch_row($DbResult);
    77   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)');
    78   $DbRow = mysql_fetch_row($DbResult);
    79   $Database->SQLCommand('DELETE FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)');
     75  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log`');
     76  $DbRow2 = $DbResult->fetch_row();
     77  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)');
     78  $DbRow = $DbResult->fetch_row();
     79  $System->Database->query('DELETE FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)');
    8080  echo('Smazáno '.$DbRow[0].' položek logu ze všech '.$DbRow2[0].'<br/>');     
    8181     
    8282  // Delete invalid ExportUser
    83   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser`');
    84   $DbRow2 = mysql_fetch_row($DbResult);
    85   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))');
    86   $DbRow = mysql_fetch_row($DbResult);
    87   $Database->SQLCommand('DELETE FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))');
     83  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ExportUser`');
     84  $DbRow2 = $DbResult->fetch_row();
     85  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))');
     86  $DbRow = $DbResult->fetch_row();
     87  $System->Database->query('DELETE FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))');
    8888  echo('Smazáno '.$DbRow[0].' položek výběru překladatelů u exportů ze všech '.$DbRow2[0].'<br/>');     
    8989
    9090  // Delete all teams without users
    91   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team`');
    92   $DbRow2 = mysql_fetch_row($DbResult);
    93   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');
    94   $DbRow = mysql_fetch_row($DbResult);
    95   $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`team` = `Team`.`Id`) = 0');
     91  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team`');
     92  $DbRow2 = $DbResult->fetch_row();
     93  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');
     94  $DbRow = $DbResult->fetch_row();
     95  $System->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`team` = `Team`.`Id`) = 0');
    9696  echo('Smazáno '.$DbRow[0].' týmů ze všech '.$DbRow2[0].'<br/>');     
    9797       
    9898  // Set new leader for teams where old leader went to other team
    99   $Database->SQLCommand('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);');
     99  $System->Database->query('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);');
    100100 
    101101  WriteLog('Smazány staré uživatelské účty', LOG_TYPE_ADMINISTRATION);
     
    104104function DeleteErrorLog()
    105105{
    106   global $Database;
     106  global $System;
    107107 
    108   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR);
    109   $DbRow = mysql_fetch_row($DbResult);
    110   $Database->SQLCommand('DELETE FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR);
     108  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR);
     109  $DbRow = $DbResult->fetch_row();
     110  $System->Database->query('DELETE FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR);
    111111  WriteLog('Vymazány chybové záznamy', LOG_TYPE_ADMINISTRATION); 
    112112  echo('Smazáno všech '.$DbRow[0].' chybových záznamů.<br/>');     
  • trunk/banners.php

    r417 r455  
    1818echo($BannerSmall.' &nbsp;&nbsp;<textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />');
    1919 
    20 $ID = $Database->SQLCommand('SELECT * FROM `Banner` WHERE `Show`=1 AND `DateLast` > (NOW() - INTERVAL 3 MONTH)');
     20$DbResult = $System->Database->query('SELECT * FROM `Banner` WHERE `Show`=1 AND `DateLast` > (NOW() - INTERVAL 3 MONTH)');
    2121 
    2222echo('<br/><strong>Servery odkazující na nás:</strong> <br />
    2323<div style="font-size: 10px;">Seznam je automaticky aktualizován a zobrazeny jsou servery s aktivní bannerem mladším než tři měsíce.</div><br />');
    24 while($Line = mysql_fetch_assoc($ID))
     24while($Line = $DbResult->fetch_assoc())
    2525{
    2626  echo('<a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a> '.$Line['Description'].' <br />');   
  • trunk/comparison.php

    r365 r455  
    5555  } else $WhereID = '';
    5656
    57   $DataID = $Database->SQLCommand('SELECT * FROM '.$Table.' Where entry = '.$Textentry.' '.$WhereID.' ORDER BY Language');
     57  $DataID = $System->Database->query('SELECT * FROM '.$Table.' Where entry = '.$Textentry.' '.$WhereID.' ORDER BY Language');
    5858  $i = 0;
    59   while($Line = mysql_fetch_assoc($DataID))
     59  while($Line = $DataID->fetch_assoc())
    6060  {
    6161    $BuffLine[$i] = $Line;
     
    7272  foreach($Line as $Index => $LineItem)
    7373  {
    74     $LineUser = mysql_fetch_array($Database->SQLCommand('SELECT * FROM `User` WHERE `ID` = '.$LineItem['User']));
     74    $DbResult = $System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$LineItem['User']);
     75    $LineUser = $DbResult->fetch_array();
    7576    echo('<th>'.$LineUser['Name'].'</th>');
    7677  }
  • trunk/dictionary.php

    r393 r455  
    55function WriteTranslatNames($Text,$mode)
    66{
    7        
     7 
    88  if ($mode == 0) echo ('..Nalezené názvy jmen věcí, míst, postav');
    99  if ($mode == 1) echo ('..Všechny přeložené');
     
    2626  $buff = GetTranslatNames($Text,$mode,$TablesColumn);
    2727 
    28         // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     28  // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
    2929  foreach($buff as $Line) {
    3030      if ($mode == 0)
     
    7373  '<a href="?mode=0&amp;group='.$GroupId.'&amp;ID='.$TextID.'" title="Zobrazit pouze přesné výsledky">Přesné</a> '.
    7474  '<a href="?mode=2&amp;group='.$GroupId.'&amp;ID='.$TextID.'" title="Zobrazit všechny nepřeložené">Nepřeložené</a> ');
    75     $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID));
     75    $DbResult = $System->Database->query('SELECT * FROM '.$Table.' Where ID = '.$TextID);
     76    $Line = $DbResult->fetch_assoc();
    7677    if(!$Line) die('Překlad nenalezen.');
    7778   
     
    102103      if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))
    103104      {       
    104         $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`=0');
    105         if(mysql_num_rows($DbResult) > 0)
    106         {
    107           $DbRow = mysql_fetch_assoc($DbResult);
     105        $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`=0');
     106        if($DbResult->num_rows > 0)
     107        {
     108          $DbRow = $DbResult->fetch_assoc();
    108109          $Entry = $DbRow['Entry'];
    109110        } else
    110111        {
    111           $DbResult = $Database->SQLCommand('SELECT MAX(`Entry`) FROM `Dictionary`');
    112           $DbRow = mysql_fetch_row($DbResult);
     112          $DbResult = $System->Database->query('SELECT MAX(`Entry`) FROM `Dictionary`');
     113          $DbRow = $DbResult->fetch_row();
    113114          $Entry = $DbRow[0] + 1;
    114           $Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", 0, 0);');
     115          $System->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", 0, 0);');
    115116        }
    116117     
    117         $DbResult = $Database->SQLCommand('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$User->Id);
     118        $DbResult = $System->Database->query('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$User->Id);
    118119        if(mysql_num_rows($DbResult) > 0)
    119120        {
    120121          $DbRow = mysql_fetch_assoc($DbResult);
    121           $Database->SQLCommand('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']);
     122          $System->Database->query('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']);
    122123        } else     
    123           $Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$User->Id.', '.$_SESSION['language'].')');
     124          $System->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$User->Id.', '.$_SESSION['language'].')');
    124125        echo('Záznam byl uložen!');
    125126      } else echo('Nebyly zaslány všechny položky formuláře.');
     
    127128    if(($_GET['action'] == 'remove') and $User->Licence(LICENCE_USER))
    128129    {
    129       $Database->SQLCommand('DELETE FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']);
     130      $System->Database->query('DELETE FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']);
    130131    } else
    131132    if(($_GET['action'] == 'modify')  and $User->Licence(LICENCE_USER))
    132133    {
    133       $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']);
    134       $DbRow = mysql_fetch_assoc($DbResult);
    135       $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`=0 AND `Entry`='.$_GET['entry'].' AND `Language`=0');
    136       $DbRow2 = mysql_fetch_assoc($DbResult);
     134      $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']);
     135      $DbRow = $DbResult->fetch_assoc();
     136      $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `User`=0 AND `Entry`='.$_GET['entry'].' AND `Language`=0');
     137      $DbRow2 = $DbResult->fetch_assoc();
    137138      echo('<form action="dictionary.php?action=save" method="post">'.
    138139      '<fieldset><legend>Upravení slova</legend>'.
     
    177178  } else $sql = 'SELECT `User`.`Name` AS `UserName`, `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT `T2`.`User`, `T1`.Language, `T1`.`Text` AS `Original`, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].') AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0';
    178179
    179   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');
    180   $DbRow = mysql_fetch_row($DbResult);
     180  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');
     181  $DbRow = $DbResult->fetch_row();
    181182  $PageList = GetPageList($DbRow[0]); 
    182183
     
    195196
    196197  $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit'];
    197   $ID = $Database->SQLCommand($sql_page);
    198   while($Line = mysql_fetch_assoc($ID))
     198  $DbResult = $System->Database->query($sql_page);
     199  while($Line = $DbResult->fetch_assoc())
    199200  {
    200201    echo('<tr>
  • trunk/export/create_addon.php

    r451 r455  
    107107    while($Group = $DbResult->fetch_assoc())
    108108    {
    109           //získání čísla verze pro export
     109    //získání čísla verze pro export
    110110      $ID = $this->Database->query('SELECT LastVersion FROM `Group` WHERE Id = '.$Group['Id']);
    111111      $LastVersion = $ID->fetch_assoc();
     
    163163      {
    164164        $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n";
    165           }
    166          
     165    }
     166   
    167167    file_put_contents($this->TempDir.'CzWoW/'.$CountFiles, $Buffer);
    168168 
     
    242242 
    243243    ';
    244     $DbResult = $Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');
     244    $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');
    245245    while($Line = $DbResult->fetch_assoc())
    246246    {
  • trunk/export/export_output.php

    r413 r455  
    103103function OutputAddon($ExportId)
    104104{
    105   global $Config, $Database, $System;
     105  global $System;
    106106 
    107107  if(function_exists('gzcompress'))
     
    176176function OutputDBCToFile($ExportId)
    177177{
    178   global $Database, $System;
     178  global $System;
    179179 
    180180  echo('<form action="?Action=View&amp;Tab=7&amp;ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />');
    181181  echo('U DBC souborů export textů funguje jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br />DBC soubory je nutné zabalit do souboru patch-enGB-5.MPQ uvnitř složky "DBFilesClient" a hru spouštět přes program wowme.exe (WoW Model Edit) u verzí klienta starší než 3.2.0. Od této verze již wowme není potřeba. Zabalit je můžete pomocí programu <a href="../download/mpqediten32.zip">Ladik\'s MPQ Editor</a>. Stav vygenerování můžete sledovat na této stránce.<br /><br />');
    182182   
    183   $DbResult = $Database->SQLCommand('SELECT * FROM ExportTask WHERE Export = '.$ExportId);
    184   if(mysql_num_rows($DbResult) == 0)
    185   {
    186     $Database->SQLCommand('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())');
     183  $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId);
     184  if($DbResult->num_rows == 0)
     185  {
     186    $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())');
    187187    WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD);
    188188  } 
     
    190190  if(array_key_exists('Regenerate', $_POST))
    191191  {
    192     $Database->SQLCommand('UPDATE ExportTask SET TimeStart = NOW(), TimeFinish = NULL WHERE Export = '.$ExportId);
     192    $System->Database->query('UPDATE ExportTask SET TimeStart = NOW(), TimeFinish = NULL WHERE Export = '.$ExportId);
    193193    echo('Soubor zařazen znovu ke zpracování.<br/><br/>');
    194194  }
    195   $DbResult = $Database->SQLCommand('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId);
    196   $ExportTask = mysql_fetch_assoc($DbResult);
     195  $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId);
     196  $ExportTask = $DbResult->fetch_assoc();
    197197  if($ExportTask['TimeFinish'] > $ExportTask['TimeStart'])
    198198  {
  • 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'));
  • trunk/export/process_aowow_export.php

    r377 r455  
    1616// Rebuild user selection
    1717$UserSelection = array();
    18 $DbResult = $Database->SQLCommand('SELECT `ID`, `XP` FROM `User`');
    19 while($DbRow = mysql_fetch_assoc($DbResult))
     18$DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`');
     19while($DbRow = $DbResult->fetch_assoc())
    2020{
    2121  $UserSelection[$DbRow['ID']] = $DbRow['XP'];
     
    2727foreach($UserSelection as $ID => $XP)
    2828{
    29   $DbResult = $Database->SQLCommand('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID);
    30   if(mysql_num_rows($DbResult) > 0)
     29  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID);
     30  if($DbResult->num_rows > 0)
    3131    $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID;
    3232    else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')';
    33   $Database->SQLCommand($Query);
     33  $System->Database->query($Query);
    3434  $Sequence++;
    3535}
  • trunk/export/process_task.php

    r403 r455  
    1212while(1)
    1313{
    14   $DbResult = $Database->SQLCommand('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask` LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `ExportTask`.`TimeFinish` IS NULL');
    15   while($DbRow = mysql_fetch_assoc($DbResult))
     14  $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask` LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `ExportTask`.`TimeFinish` IS NULL');
     15  while($DbRow = $DbResult->fetch_assoc())
    1616  {
    1717    echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování DBC souborů pro export '.$DbRow['ExportId'].'.. '."\n");
     
    4444          echo('Hotovo'."\n");
    4545        } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n");
    46         $Database->SQLCommand('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id);
     46        $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id);
    4747      } catch (Exception $e)
    4848      {
     
    5151    } else
    5252    {
    53       $Database->SQLCommand('DELETE FROM `ExportTask` WHERE `Export`='.$DbRow['Export']);
     53      $System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$DbRow['Export']);
    5454      echo('Export '.$DbRow['Export'].' nenalezen. Jeho úloha smazána.'."\n");
    5555    }
  • trunk/form.php

    r443 r455  
    3030  $TextID = $_GET['ID'] * 1; 
    3131
    32   $DbResult = $Database->SQLCommand('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID);
    33   $Line = mysql_fetch_assoc($DbResult);
     32  $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID);
     33  $Line = $DbResult->fetch_assoc();
    3434  if(!$Line) ErrorMessage('Překlad nenalezen.');
    3535   
    36   $DbResult = $Database->SQLCommand('SELECT * FROM `'.$Table.'` WHERE (`Language` = 0) AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1');
    37   $LineAJ = mysql_fetch_assoc($DbResult);
     36  $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = 0) AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1');
     37  $LineAJ = $DbResult->fetch_assoc();
    3838  if(!$Line) ErrorMessage('Anglický originál k překladu nenalezen.');
    3939 
    40   $IDUser = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID` = '.$Line['User']);
    41   $LineUser = mysql_fetch_array($IDUser);
     40  $IDUser = $System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']);
     41  $LineUser = $IDUser->fetch_array();
    4242 
    4343  echo('Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />');
     
    4747  if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
    4848  {
    49     $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']));
     49    $DbResult = $System->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']);
     50    $Language = $DbResult->fetch_assoc();
    5051    // echo $Language['Language'].'  '.$Line['Take'];
    5152    if($Language['Language'] <> 0)
     
    6364  echo('<br />');
    6465   
    65   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> 0) AND (`Complete` = 1)');
    66   $Version = mysql_fetch_row($DbResult);
     66  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> 0) AND (`Complete` = 1)');
     67  $Version = $DbResult->fetch_row();
    6768  $Version = $Version[0];
    6869  if($Version > 0)
     
    7576      <option value="-1">Vyberte text k porovnání</option>
    7677      <option value="-1">Zobrazit/porovnat všechny</option>');
    77     $DataID = $Database->SQLCommand('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].') AND (`Complete` = 1)'); 
    78     while($version = mysql_fetch_array($DataID))
     78    $DataID = $System->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].') AND (`Complete` = 1)'); 
     79    while($version = $DataID->fetch_array())
    7980    {     
    8081      if ($version['ID'] == $Line['Take']) echo('<option value="'.$version['ID'].'">'.$version['ID'].' - '.$version['User'].' (převzato)</option>');   
  • trunk/img_level.php

    r404 r455  
    5757function GetXPFromTranslation($UserId)
    5858{
    59   global $Database, $TranslationTree, $xp_from_word, $from_diakrit;
     59  global $System, $TranslationTree, $xp_from_word, $from_diakrit;
    6060 
    6161  $xp = 0;
     
    7171      $GroupBy = substr($GroupBy, 0, -2);
    7272     
    73       $IDtran = $Database->SQLCommand('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`User` = '.$UserId.') AND (`Complete` = 1) '.$GroupBy);
    74       while($Line = mysql_fetch_array($IDtran))
     73      $IDtran = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`User` = '.$UserId.') AND (`Complete` = 1) '.$GroupBy);
     74      while($Line = $IDtran->fetch_array())
    7575      {   
    76         $DbResult = $Database->SQLCommand('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE `ID` = '.$Line['Take']);
    77         $LineComparison = mysql_fetch_assoc($DbResult);
     76        $DbResult = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE `ID` = '.$Line['Take']);
     77        $LineComparison = $DbResult->fetch_assoc();
    7878        $xp_translation = 0;   
    7979        $translated = true;
     
    103103function ImgLevelUpdate()
    104104{
    105   global $Database, $TranslationTree;
     105  global $System, $TranslationTree;
    106106
    107107  // Hlavní kod pro uživatele
    108   $ID = $Database->SQLCommand('SELECT `ID`, `Name` FROM `User` WHERE `NeedUpdate` = 1');
    109   while($LineUser = mysql_fetch_array($ID))
     108  $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `NeedUpdate` = 1');
     109  while($LineUser = $DbResult->fetch_array())
    110110  {
    111111    // Build TranslatedCount query
     
    120120   
    121121    $xp = GetXPFromTranslation($LineUser['ID']);
    122     $Database->SQLCommand('UPDATE `User` SET `XP` = '.$xp.', `TranslatedCount` = '.$TranslatedCount.' WHERE `User`.`ID` = '.$LineUser['ID']);
     122    $System->Database->query('UPDATE `User` SET `XP` = '.$xp.', `TranslatedCount` = '.$TranslatedCount.' WHERE `User`.`ID` = '.$LineUser['ID']);
    123123    CreateImg('user', $LineUser['Name'], $xp);
    124124  }
    125125
    126126  // Hlavní kod pro překladatelské týmy
    127   $ID = $Database->SQLCommand('SELECT `ID`, `Name`, (SELECT AVG(`XP`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `Average` FROM `Team` WHERE `ID` IN (SELECT `Team` FROM `User` WHERE `NeedUpdate` = 1)');
    128   while($LineTeam = mysql_fetch_array($ID))
     127  $DbResult = $System->Database->query('SELECT `ID`, `Name`, (SELECT AVG(`XP`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `Average` FROM `Team` WHERE `ID` IN (SELECT `Team` FROM `User` WHERE `NeedUpdate` = 1)');
     128  while($LineTeam = $DbResult->fetch_array())
    129129  {
    130130    CreateImg('team', $LineTeam['Name'], substr($LineTeam['Average'], 0, strpos($LineTeam['Average'],'.')));  //vytváření obrázku
    131131  }
    132   $Database->SQLCommand('UPDATE `User` SET `NeedUpdate` = 0');
     132  $System->Database->query('UPDATE `User` SET `NeedUpdate` = 0');
    133133}
    134134
    135135function ImgLevelShow()
    136136{
    137   global $Database;
     137  global $System;
    138138 
    139139  // Do update for all users
    140   $Database->SQLCommand('UPDATE `User` SET `NeedUpdate` = 1');
     140  $System->Database->query('UPDATE `User` SET `NeedUpdate` = 1');
    141141  ImgLevelUpdate();
    142142 
    143143  echo('<strong>Uživatelé</strong><br/>');
    144   $ID = $Database->SQLCommand('SELECT `ID`, `Name` FROM `User`');
    145   while($LineUser = mysql_fetch_array($ID))
     144  $ID = $System->Database->query('SELECT `ID`, `Name` FROM `User`');
     145  while($LineUser = $ID->fetch_array())
    146146  {
    147147    echo('<img src="tmp/user/'.$LineUser['Name'].'/level.png" /> '.$LineUser['Name'].'<br />');
     
    149149
    150150  echo('<br/><strong>Týmy</strong><br/>');
    151   $ID = $Database->SQLCommand('SELECT `ID`, `Name` FROM `Team`');
    152   while($LineTeam = mysql_fetch_array($ID))
     151  $ID = $System->Database->query('SELECT `ID`, `Name` FROM `Team`');
     152  while($LineTeam = $ID->fetch_array())
    153153  {
    154154    echo('<img src="tmp/team/'.$LineTeam['Name'].'/level.png" /> '.$LineTeam['Name'].'<br />');
  • trunk/img_statistic.php

    r402 r455  
    1919
    2020
    21 $DbResult = $Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix']);
    22 $ID = mysql_fetch_row($DbResult);
     21$DbResult = $System->Database->query('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix']);
     22$ID = $DbResult->fetch_row();
    2323$BuildNumber_max = $ID[0];
    2424if($BuildNumber_max == '') $BuildNumber_max = 0; // Empty result, no items in this group
    2525
    2626$where = '(`VersionEnd` = '.$BuildNumber_max.') AND (`Language` <> 0) AND (`Complete` = 1) '.$team.$language;
    27 $ID = mysql_fetch_row($Database->SQLCommand('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE '.$where));
     27$DbResult = $System->Database->query('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE '.$where);
     28$ID = $DbResult->fetch_row();
    2829$NumberTranslate = $ID[0];
    2930 
    30 $DbResult = $Database->SQLCommand('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE (`VersionEnd` = '.$BuildNumber_max.') AND (`Language` = 0)');
    31 $ID = mysql_fetch_row($DbResult);
     31$DbResult = $System->Database->query('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE (`VersionEnd` = '.$BuildNumber_max.') AND (`Language` = 0)');
     32$ID = $DbResult->fetch_row();
    3233$NumberAJ = $ID[0];
    3334
  • trunk/import/import.php

    r443 r455  
    66  var $Group;
    77  var $NewItemCount;
     8  var $System;
     9 
     10  function __construct($System)
     11  {
     12    $this->System = &$System;
     13  }
    814 
    915  function SetVersion($Version)
     
    1622 
    1723  function InsertItem($Value)
    18   {
    19     global $Database;
    20  
     24  {   
    2125    $Columns = '';
    2226    foreach($this->Group['Items'] as $GroupItem)
     
    2832    //print_r($Value);
    2933 
    30     $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
     34    $DbResult2 = $this->System->Database->query('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
    3135    //echo('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
    32     if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
     36    if(isset($DbResult2) and ($DbResult2->num_rows > 0))
    3337    {
    3438      // Update existed text
    35       $DbRow2 = mysql_fetch_assoc($DbResult2);
     39      $DbRow2 = $DbResult2->fetch_assoc();
    3640      if($this->HaveSameText($this->Group, $DbRow2, $Value))
    3741      {
    3842        if($DbRow2['VersionEnd'] <> $this->Version['BuildNumber'])
    3943        {
    40           $Database->SQLCommand('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionEnd` = "'.$this->Version['BuildNumber'].'" WHERE `ID`='.$DbRow2['ID']);
     44          $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionEnd` = "'.$this->Version['BuildNumber'].'" WHERE `ID`='.$DbRow2['ID']);
    4145          echo(', ');
    4246        } else echo('. ');
     
    5054          $Values .= ', "'.$Value[$GroupItem['Column']].'"';
    5155        }
    52         $Database->SQLCommand('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
     56        $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    5357        echo('# ');
    54         WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT);
     58        $InsertId = $this->System->Database->insert_id;
     59        WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$DbRow2['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT);
    5560      }       
    5661    } else
     
    6267        // Get new unused Entry for tables without numeric id
    6368        $Value['Entry'] = 1;
    64         $DbResult = $Database->SQLCommand('SELECT MAX(`Entry`) FROM `'.$this->Group['TablePrefix'].'`');
    65         if(mysql_num_rows($DbResult) > 0)
    66         {
    67           $DbRow = mysql_fetch_row($DbResult);
     69        $DbResult = $this->System->Database->query('SELECT MAX(`Entry`) FROM `'.$this->Group['TablePrefix'].'`');
     70        if($DbResult->num_rows > 0)
     71        {
     72          $DbRow = $DbResult->fetch_row();
    6873          $Value['Entry'] += $DbRow[0];
    6974        }           
     
    7681        $Values .= ', "'.$Value[$GroupItem['Column']].'"';
    7782      }
    78       $Database->SQLCommand('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
     83      $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
     84      $InsertId = $this->System->Database->insert_id;
    7985      echo('+ ');
    8086      $this->NewItemCount++;
    81       WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' přidán.', LOG_TYPE_IMPORT);
     87      WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' přidán.', LOG_TYPE_IMPORT);
    8288    }
    8389  }
     
    8591  function ImportLUA()
    8692  {
    87     global $Database, $TranslationTree, $PatchVersion, $Config;
     93    global $TranslationTree, $PatchVersion;
    8894       
    8995    echo('Načítání textů z LUA souboru...');
     
    126132          }
    127133          echo('<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />');
    128           $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     134          $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
    129135        } else echo('Již importován pro verzi '.$this->Version['Version']);
    130136      } else echo('Není definováno jméno zdrojového souboru');
     
    134140  function UpdateTranslated()
    135141  {
    136     global $Database, $TranslationTree, $PatchVersion, $Config;
     142    global $TranslationTree, $PatchVersion, $Config;
    137143 
    138144    echo('<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />');
     
    140146    {
    141147      echo('<br />'.$Group['Name'].' ');     
    142       $DbResult = $Database->SQLCommand('SELECT `gs_tran`.`ID`, `gs_tran`.`VersionEnd` AS `VersionEnd_tran`, `gs_orig`.`VersionEnd` AS `VersionEnd_orig` FROM `'.$Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix'].'` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE `gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd`');
    143       while($DbRow = mysql_fetch_assoc($DbResult))
     148      $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, `gs_tran`.`VersionEnd` AS `VersionEnd_tran`, `gs_orig`.`VersionEnd` AS `VersionEnd_orig` FROM `'.$Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix'].'` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE `gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd`');
     149      while($DbRow = $DbResult->fetch_assoc())
    144150      {
    145         $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].' WHERE `ID` = '.$DbRow['ID']);
     151        $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].' WHERE `ID` = '.$DbRow['ID']);
    146152        echo('. ');
    147153      } 
     
    253259  function ImportSQL()
    254260  {
    255     global $Database, $TranslationTree, $PatchVersion, $Config;
     261    global $TranslationTree, $PatchVersion;
    256262 
    257263    $File = new FileStream();
     
    357363    }
    358364    echo('<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />');
    359   $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     365  $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
    360366  }
    361367}
  • trunk/import/index.php

    r443 r455  
    3434function ShowImportGroup()
    3535{
    36   global $Config;
     36  global $System;
    3737 
    3838  if(array_key_exists('id', $_GET))
     
    4141   
    4242    $GroupId = (int)$_GET['id'];
    43     $Import = new Import();
    44     $Import->SetVersion($Config['Web']['GameVersion']);
     43    $Import = new Import($System);
     44    $Import->SetVersion($System->Config['Web']['GameVersion']);
    4545    $Import->ImportGroup($GroupId);
    4646 
     
    5252function ShowMenu()
    5353{
    54   global $TranslationTree, $Database, $Config;
     54  global $TranslationTree, $System;
    5555 
    5656  echo('</div><div><strong>Import zdrojů:</strong></div>');
     
    5858  echo('<div><a href="?action=instructions">Instrukce pro přípravu zdrojových souborů</a></div>');
    5959  echo('<div><a href="?action=update_translated">Zaktualizovat verze přeložených</a></div><br/>');
    60   echo('Verze klienta použitá pro import: <strong>'.$Config['Web']['GameVersion'].'</strong>');
    61   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Group`');
    62   $DbRow = mysql_fetch_row($DbResult);
     60  echo('Verze klienta použitá pro import: <strong>'.$System->Config['Web']['GameVersion'].'</strong>');
     61  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Group`');
     62  $DbRow = $DbResult->fetch_row();
    6363  $PageList = GetPageList($DbRow[0]); 
    6464  echo('<h3>Seznam překladových skupin</h3>');
     
    7878  echo($Order['Output']);
    7979
    80   $ID = $Database->SQLCommand('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    81   while($Group = mysql_fetch_assoc($ID))
     80  $DbResult = $System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
     81  while($Group = $DbResult->fetch_assoc())
    8282  {
    8383    echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['SourceType'].'</td><td>');
     
    9292function UpdateTranslated()
    9393{
     94  global $System;
     95 
    9496  echo('<div style="font-size: xx-small;">');
    95   $Import = new Import();
     97  $Import = new Import($System);
    9698  $Import->UpdateTranslated();
    9799  echo('</div>');
  • trunk/includes/Database.php

    r420 r455  
    1717  function open()
    1818  {
    19     parent::__construct($this->HostName, $this->UserName, $this->Password, $this->Schema);
     19    parent::real_connect($this->HostName, $this->UserName, $this->Password, $this->Schema);
    2020    $this->charset($this->Charset);
    2121  }
  • trunk/includes/global.php

    r454 r455  
    1515
    1616include_once(dirname(__FILE__).'/config.php');
    17 include_once(dirname(__FILE__).'/error.php');
    18 include_once(dirname(__FILE__).'/databaseconection.php');
     17include_once(dirname(__FILE__).'/Database.php');
    1918include_once(dirname(__FILE__).'/global_function.php');
    2019include_once(dirname(__FILE__).'/rss.php');
     
    2221include_once(dirname(__FILE__).'/user.php');
    2322
    24 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
    25 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    26 $Database->SelectDatabase($Config['Database']['Database']);   
    27 
    28 $TranslationTree = GetTranslationTree();
    29 $LanguageList = GetLanguageList();
    30 
    3123$System = new System();
    3224$System->Init();
    3325$User = new User($System);
    3426
     27include_once(dirname(__FILE__).'/error.php');
     28
     29$TranslationTree = GetTranslationTree();
     30$LanguageList = GetLanguageList();
     31
    3532function GetMicrotime()
    3633{
     
    4138function ShowShoutbox()
    4239{
    43   global $Database, $Config, $User, $System;
     40  global $System, $Config, $User, $System;
    4441 
    4542  echo('<strong><a href="'.$System->Link('/action.php?action=ShoutBoxView').'">Kecátko:</a></strong>');
     
    4744    echo(' <a href="'.$System->Link('/action.php?action=shoutbox').'">Vložit</a>');
    4845  echo('<div class="box"><table>');
    49   $ID = $Database->SQLCommand('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');
    50   while($Line = mysql_fetch_assoc($ID))
     46  $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');
     47  while($Line = $DbResult->fetch_assoc())
    5148    echo('<tr><td><strong>'.$Line['User'].'</strong>: '.htmlspecialchars($Line['Text']).'</td></tr>');
    5249  echo('</table></div>');
     
    5552function ShowTopBar()
    5653{
    57   global $Config, $Database, $User, $System;
     54  global $Config, $System, $User, $System;
    5855 
    5956  echo('<div class="Menu">');
     
    6158  if($User->Licence(LICENCE_USER))
    6259  {
    63     $DbResult = $Database->SQLCommand('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$User->Team);
    64     $Team = mysql_fetch_assoc($DbResult);
     60    $DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$User->Team);
     61    $Team = $DbResult->fetch_assoc();
    6562
    6663    //echo('<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>');
     
    159156function ShowTranslatedMenu()
    160157{
    161   global $TranslationTree, $Config, $Database, $User, $System;
     158  global $TranslationTree, $User, $System;
    162159
    163160  echo('<strong>Překladové skupiny:</strong><br /><div id="TranslationMenu">');
     
    182179function ShowOnlineUserList()
    183180{
    184   global $Database, $Moderators, $User;
     181  global $System, $Moderators, $User;
    185182 
    186183  echo('Online překladatelé:<br />');
    187   $ID = $Database->SQLCommand('SELECT `Name`, `GM`, `ID` FROM `User` WHERE `LastLogin` >= NOW() - 300 AND ((`LastLogout` < `LastLogin`) OR (ISNULL(`LastLogout`)))');
    188   while($DbUser = mysql_fetch_assoc($ID))
     184  $DbResult = $System->Database->query('SELECT `Name`, `GM`, `ID` FROM `User` WHERE `LastLogin` >= NOW() - 300 AND ((`LastLogout` < `LastLogin`) OR (ISNULL(`LastLogout`)))');
     185  while($DbUser = $DbResult->fetch_assoc())
    189186  {
    190187    if($User->Licence(LICENCE_MODERATOR)) $Name = '<a href="user.php?user='.$DbUser['ID'].'">'.$DbUser['Name'].'</a>';
     
    197194function ShowPage()
    198195{
    199   global $User, $Config, $Database, $RSSChannels, $PageFooterRequested, $System; 
    200  
    201   echo('<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?>
     196  global $User, $RSSChannels, $PageFooterRequested, $System; 
     197 
     198  echo('<?xml version="1.0" encoding="'.$System->Config['Web']['Charset'].'"?>
    202199  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    203200<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz">'.
    204201'<head>'.
    205 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$Config['Web']['Charset'].'" />'.
     202'<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$System->Config['Web']['Charset'].'" />'.
    206203'<meta name="keywords" content="wow, quest, questy, questů, preklad, mangos, překlad, překládání, přeložený, přeložení, čeština, world of warcraft, open source, free, addon" />'.
    207 '<meta name="description" content="'.$Config['Web']['Title'].'" />'.
     204'<meta name="description" content="'.$System->Config['Web']['Title'].'" />'.
    208205'<meta name="robots" content="all" />'.
    209206'<link rel="stylesheet" href="'.$System->Link('/style/style.css').'" type="text/css" media="all" />'.
     
    213210  foreach($RSSChannels as $Channel)
    214211    echo(' <link rel="alternate" title="'.$Channel['Title'].'" href="'.$Channel['URL'].'" type="application/rss+xml" />');
    215   echo('<title>'.$Config['Web']['Title'].'</title>
     212  echo('<title>'.$System->Config['Web']['Title'].'</title>
    216213</head>
    217214<body>');
     
    268265function ShowFooter()
    269266{
    270   global $Database, $Config, $ScriptStartTime, $PageFooterRequested, $User;
     267  global $System, $ScriptStartTime, $PageFooterRequested, $User;
    271268
    272269  if(isset($PageFooterRequested))
     
    291288
    292289    echo('</td></tr>');
    293     if($Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s &nbsp;&nbsp; Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B &nbsp;&nbsp; <a href="http://validator.w3.org/check?uri='.htmlentities('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>');
     290    if($System->Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s &nbsp;&nbsp; Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B &nbsp;&nbsp; <a href="http://validator.w3.org/check?uri='.htmlentities('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>');
    294291    echo('</table>'.
    295292      '</body>'.
    296293      '</html>');
    297     $Database->Disconnect();
    298294    $User->Store();
    299295  }
  • trunk/includes/global_function.php

    r443 r455  
    3636function GetPageList($TotalCount)
    3737{
    38   global $Database, $Config;
     38  global $System;
    3939   
    4040  $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    4141 
    42   $ItemPerPage = $Config['Web']['ItemsPerPage'];
    43   $Around = round($Config['Web']['VisiblePagingItems'] / 2);
     42  $ItemPerPage = $System->Config['Web']['ItemsPerPage'];
     43  $Around = round($System->Config['Web']['VisiblePagingItems'] / 2);
    4444  $Result = '';
    4545  $PageCount = floor($TotalCount / $ItemPerPage) + 1;
     
    218218function GetLanguageList()
    219219{
    220   global $Database;
     220  global $System;
    221221 
    222222  $Result = array();
    223   $DbResult = $Database->SQLCommand('SELECT * FROM `Language` WHERE `Enabled` = 1');
    224   while($DbRow = mysql_fetch_assoc($DbResult))
     223  $DbResult = $System->Database->query('SELECT * FROM `Language` WHERE `Enabled` = 1');
     224  while($DbRow = $DbResult->fetch_assoc())
    225225    $Result[$DbRow['Id']] = $DbRow;
    226226  return($Result);
     
    229229function GetTranslationTree()
    230230{
    231   global $Database;
     231  global $System;
    232232 
    233233  $Result = array();
    234   $DbResult = $Database->SQLCommand('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group` ORDER BY `Name`');
    235   while($DbRow = mysql_fetch_assoc($DbResult))
     234  $DbResult = $System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group` ORDER BY `Name`');
     235  while($DbRow = $DbResult->fetch_assoc())
    236236  {
    237237    $DbRow['Items'] = array();
    238238    $Result[$DbRow['Id']] = $DbRow;
    239239  }
    240   $DbResult = $Database->SQLCommand('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
    241   while($DbRow = mysql_fetch_assoc($DbResult))
     240  $DbResult = $System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
     241  while($DbRow = $DbResult->fetch_assoc())
    242242  {
    243243    $Result[$DbRow['Group']]['Items'][] = $DbRow;
     
    250250function WriteLog($Text, $Type)
    251251{
    252   global $Database, $Config, $User;
     252  global $System, $User;
    253253 
    254254  if(!isset($_SERVER['REMOTE_ADDR'])) $IP = 'Konzole';
    255255    else $IP = addslashes($_SERVER['REMOTE_ADDR']);
    256256
    257   $Database->SelectDatabase($Config['Database']['Database']);   
     257  if(isset($User->Id)) $UserId = $User->Id;
     258    else $UserId = 0;
    258259  $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP` )
    259    VALUES ('.$User->Id.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'")';
    260   $Database->SQLCommand($Query);
     260   VALUES ('.$UserId.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'")';
     261  $System->Database->query($Query);
    261262}
    262263
     
    273274function FollowingTran($TextID, $Table, $GroupId, $Prev = false)
    274275{
    275   global $Database;
     276  global $System;
    276277 
    277278  if($Prev)
     
    283284  }
    284285 
    285   $Next = mysql_fetch_assoc($Database->SQLCommand($sql));
     286  $DbResult = $System->Database->query($sql);
     287  $Next = $DbResult->fetch_assoc();
    286288  if($Next)
    287289  {
    288290    if($Prev) echo('<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ');
    289291    else echo('<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> ');
    290       return 'form.php?group='.$GroupId.'&amp;ID='.$Next['ID'];
     292      return('form.php?group='.$GroupId.'&amp;ID='.$Next['ID']);
    291293  }
    292294}
     
    294296function GetBuildNumber($Version)
    295297{
    296   global $Database, $BuildNumbers;
     298  global $System, $BuildNumbers;
    297299 
    298300  if(isset($BuildNumbers[$Version]) == false)
    299301  {
    300302    $sql = 'SELECT `BuildNumber` FROM `ClientVersion` WHERE `Version` = "'.$Version.'"';
    301     $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql));
     303    $DbResult = $System->Database->query($sql);
     304    $DbRow = $DbResult->fetch_assoc();
    302305    $BuildNumbers[$Version] = $DbRow['BuildNumber'];
    303306  }
     
    307310function GetVersionWOW($BuildNumber)
    308311{
    309   global $Database, $VersionsWOW;
     312  global $System, $VersionsWOW;
    310313 
    311314  if(isset($VersionsWOW[$BuildNumber]) == false)
    312315  {
    313316    $sql = 'SELECT `Version` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"';
    314     $Version = mysql_fetch_assoc($Database->SQLCommand($sql));
     317    $DbResult = $System->Database->query($sql);
     318    $Version = $DbResult->fetch_assoc();
    315319    $VersionsWOW[$BuildNumber] = $Version['Version'];
    316320  }
     
    442446}
    443447
    444 
    445448function GetTranslatNames($Text,$mode,$TablesColumn)
    446449{
    447   global $Database;
     450  global $System;
    448451 
    449452 /* $TablesID = array('gameobject' => 5,
     
    482485      }
    483486      }
    484       $where = substr($where,0,strlen($where)-4);
     487      $where = substr($where, 0, strlen($where) - 4);
    485488      $where .= ')';
    486489      if ($SqlOK) {
    487         $ID = $Database->SQLCommand($sql.$where.$groupby);
     490        $DbResult = $System->Database->query($sql.$where.$groupby);
    488491    //  echo ($sql.'|'.$where.'|'.$groupby);
    489         while($Line = mysql_fetch_assoc($ID)) {
    490         $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     492        while($Line = $DbResult->fetch_assoc())
     493        {
     494          $buff[] = array($Line['ID'], GetIDbyName($Table), $Line[$Column], $Line['Tran']);
    491495        }
    492496    }
  • trunk/includes/system.php

    r426 r455  
    11<?php
    22
    3 //include_once('database.php');
     3include_once('Database.php');
    44
    55class Module
     
    2222  var $Config;
    2323 
     24  function __construct()
     25  {
     26    $this->Database = new Database();
     27    $this->Config = array();
     28  }
     29 
    2430  function Init()
    2531  {
    2632    include('config.php');
    2733    $this->Config = $Config;
    28     $this->Database = new mysqli($this->Config['Database']['Host'], $this->Config['Database']['User'], $this->Config['Database']['Password'], $this->Config['Database']['Database']);
    29     $this->Database->query('SET NAMES '.$this->Config['Database']['Charset']);
     34    $this->Database->HostName = $this->Config['Database']['Host'];
     35    $this->Database->UserName = $this->Config['Database']['User'];
     36    $this->Database->Password = $this->Config['Database']['Password'];
     37    $this->Database->Schema = $this->Config['Database']['Database'];
     38    $this->Database->Charset = $this->Config['Database']['Charset'];
     39    $this->Database->ShowSQLQuery = $this->Config['Web']['ShowSQLQuery'];
     40    $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];
     41    $this->Database->open();
    3042  }
    3143 
  • trunk/index.php

    r436 r455  
    1313function ShowNews()
    1414{
    15   global $Database;
     15  global $System;
    1616
    1717  $Output = '<strong>Změny systému:</strong><div class="NewsBox">';
    18   $DbResult = $Database->SQLCommand('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
    19   while($DbRow = mysql_fetch_assoc($DbResult))
     18  $DbResult = $System->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
     19  while($DbRow = $DbResult->fetch_assoc())
    2020    $Output .= '<div><strong>'.$DbRow['Name'].' ('.HumanDate($DbRow['Time']).')</strong> <br />'.$DbRow['Text'].'</div>'; 
    2121  $Output .= '<a href="action.php?action=news">Všechny zprávy</a>';
     
    5656function ShowRSSChannel()
    5757{
    58   global $Database, $Config, $System;
     58  global $System, $Config, $System;
    5959 
    6060  $Items = array(); 
    6161  if($_GET['rss'] == 'news')
    6262  {
    63     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
    64     while($DbRow = mysql_fetch_assoc($DbResult))
     63    $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
     64    while($DbRow = $DbResult->fetch_assoc())
    6565    {
    6666      $Items[] = array
     
    8383  if($_GET['rss'] == 'translation')
    8484  {
    85     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
    86     while($DbRow = mysql_fetch_assoc($DbResult))
     85    $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
     86    while($DbRow = $DbResult->fetch_assoc())
    8787    {
    8888      $Items[] = array
     
    107107    $TitleLength = 50;
    108108    mb_internal_encoding('utf-8');
    109     $DbResult = $Database->SQLCommand('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
    110     while($DbRow = mysql_fetch_assoc($DbResult))
     109    $DbResult = $Sytem->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
     110    while($DbRow = $DbResult->fetch_assoc())
    111111    {
    112112      $Title = mb_substr($DbRow['Text'], 0, $TitleLength);
  • trunk/log.php

    r444 r455  
    99    else $Where = '';
    1010  $sql = 'SELECT *, UNIX_TIMESTAMP(`Date`) AS `TimeCreate`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `User` FROM `Log`'.$Where.' ORDER BY `Date` DESC LIMIT 100';
    11   $ID = $Database->SQLCommand($sql);
    12   while($Line = mysql_fetch_assoc($ID))
     11  $DbResult = $System->Database->query($sql);
     12  while($Line = $DbResult->fetch_assoc())
    1313  {
    14     $DbResult = $Database->SQLCommand('SELECT * FROM `LogType` WHERE `Id`='.$Line['Type']);
    15     $LogType = mysql_fetch_assoc($DbResult);
     14    $DbResult2 = $System->Database->query('SELECT * FROM `LogType` WHERE `Id`='.$Line['Type']);
     15    $LogType = $DbResult2->fetch_assoc();
    1616   
    1717    $Items[] = array
     
    4949    echo('<strong>Filtr: </strong>');
    5050    echo('<span style="color:black"><a href="log.php?type=" title="Bez filtrování">Všechny</a></span> ');
    51     $DbResult = $Database->SQLCommand('SELECT * FROM `LogType`');
    52     while($LogType = mysql_fetch_assoc($DbResult))
     51    $DbResult = $System->Database->query('SELECT * FROM `LogType`');
     52    while($LogType = $DbResult->fetch_assoc())
    5353    {
    5454      echo('<a href="log.php?type='.$LogType['Id'].'" style="color:'.$LogType['Color'].'" title="'.$LogType['Name'].'">'.$LogType['Name'].'</a> ');
     
    6666  //if(($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
    6767
    68   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log` '.$Where);
    69   $DbRow = mysql_fetch_row($DbResult);
     68  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log` '.$Where);
     69  $DbRow = $DbResult->fetch_row();
    7070  $PageList = GetPageList($DbRow[0]);   
    7171 
     
    8484  $sql = 'SELECT *, `LogType`.`Color` AS `LogColor`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `UserName` FROM `Log` LEFT JOIN `LogType` ON `LogType`.`Id`=`Log`.`Type` '.$Where.$Order['SQL'].$PageList['SQLLimit'];
    8585  //echo($sql);
    86   $ID = $Database->SQLCommand($sql);
    87   while($Line = mysql_fetch_assoc($ID))
     86  $DbResult = $System->Database->query($sql);
     87  while($Line = $DbResult->fetch_assoc())
    8888  {
    8989    echo('<tr><td>'.$Line['Date'].'</td><td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td><td>'.$Line['UserName'].'</td><td>'.$Line['IP'].'</td></tr>');
  • trunk/registrace.php

    r420 r455  
    2222        if($Pass == $Pass2)
    2323        {
    24           $Line = mysql_fetch_row($Database->SQLCommand('SELECT * FROM `User` WHERE `Name` = "'.$UserName.'"'));
     24          $DbResult = $System->Database->query('SELECT * FROM `User` WHERE `Name` = "'.$UserName.'"');
     25          $Line = $DbResult->fetch_row();
    2526          if(!$Line)
    2627          {
    2728            $Salt = $User->GetPasswordSalt();
    28             $Database->SQLCommand('INSERT INTO `User` (`Name` , `Pass` , `Salt`, `LastIP` , `LastLogin` , `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime` ) VALUES ("'.$UserName.'", '.$User->CryptPasswordSQL('"'.$Pass.'"', '"'.$Salt.'"').', "'.$Salt.'", "'.$_SERVER['REMOTE_ADDR'].'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW())');
     29            $System->Database->query('INSERT INTO `User` (`Name` , `Pass` , `Salt`, `LastIP` , `LastLogin` , `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime` ) VALUES ("'.$UserName.'", '.$User->CryptPasswordSQL('"'.$Pass.'"', '"'.$Salt.'"').', "'.$Salt.'", "'.$_SERVER['REMOTE_ADDR'].'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW())');
    2930            $Message = 'Registrace proběhla úspěšně.<br /><br/>'.
    30             'Přečtěte si pozorně <a href="'.$System->Link('/info.php').'</a>">pokyny pro překladání</a> a můžete pak hned začít překládat.';
     31            'Přečtěte si pozorně <a href="'.$System->Link('/info.php').'">pokyny pro překladání</a> a můžete pak hned začít překládat.';
    3132            $User->Login($UserName, $Pass);
    3233            WriteLog('Uživatel se zaregistroval: '.$UserName, LOG_TYPE_USER);     
     
    7475      <td><select name="Team"><option value="0">Žádného</option>
    7576      ');
    76     $ID = $Database->SQLCommand('SELECT `Name`, `Id` FROM `Team`');
    77     while($Line = mysql_fetch_assoc($ID))
     77    $DbResult = $System->Database->query('SELECT `Name`, `Id` FROM `Team`');
     78    while($Line = $DbResult->fetch_assoc())
    7879    {
    7980      echo('<option value="0'.$Line['Id'].'">'.$Line['Name'].'</option>');
  • trunk/save.php

    r436 r455  
    155155  $next = FollowingTran($TextID, $Table, $GroupId);
    156156  echo('<br /><br />');
    157   $redirecting = mysql_fetch_assoc($Database->SQLCommand('SELECT `Redirecting` FROM `User` WHERE `ID`='.$User->Id));
     157  $DbResult = $System->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$User->Id)
     158  $redirecting = $DbResult->fetch_assoc();
    158159   
    159160  switch($redirecting['Redirecting'])
     
    181182   
    182183  // Aktualizace informace o nutnosti načíst XP
    183   $Database->SQLCommand('UPDATE `User` SET `NeedUpdate` = 1 WHERE `ID` = '.$User->Id);
     184  $System->Database->query('UPDATE `User` SET `NeedUpdate` = 1 WHERE `ID` = '.$User->Id);
    184185  } else echo('Položka nenalezena');
    185186} else
  • trunk/statistic.php

    r450 r455  
    88function ShowStatTable()
    99{
    10   global $Database, $Config;
     10  global $System;
    1111 
    1212  $LanguageId = LoadLanguageIdParameter();
     
    1515  $GroupListQuery = 'SELECT `Group`.* FROM `Group`';
    1616  $Query = '';
    17   $DbResult = $Database->SQLCommand($GroupListQuery);
    18   while($DbRow = mysql_fetch_assoc($DbResult))
     17  $DbResult = $System->Database->query($GroupListQuery);
     18  while($DbRow = $DbResult->fetch_assoc())
    1919  {
    2020    $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    2929  $Query = substr($Query, 0, - 6);
    3030
    31   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
    32   $DbRow = mysql_fetch_row($DbResult);
     31  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
     32  $DbRow = $DbResult->fetch_row();
    3333  $PageList = GetPageList($DbRow[0]); 
    3434  echo($PageList['Output']);
     
    4747  $Translated = 0;
    4848  $Total = 0;
    49   $ID = $Database->SQLCommand('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    50   while($Group = mysql_fetch_assoc($ID))
     49  $DbResult = $System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
     50  while($Group = $DbResult->fetch_assoc())
    5151  {
    5252    echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>');
     
    8383<div>Počet stáhnutí přeložených textů v SQL souboru: <strong>');
    8484       
    85 $ID = $Database->SQLCommand('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 2');
    86 $Line = mysql_fetch_row($ID);
     85$ID = $System->Database->query('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 2');
     86$Line = $ID->fetch_row();
    8787echo($Line[0]);
    8888
     
    9090<div>Počet stáhnutí: <strong>');
    9191     
    92 $ID = $Database->SQLCommand('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 0');
    93 $Line = mysql_fetch_row($ID);
     92$ID = $System->Database->query('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 0');
     93$Line = $ID->fetch_row();
    9494echo($Line[0]);
    9595
  • trunk/team.php

    r411 r455  
    88function ShowTeamList()
    99
    10   global $Config, $Database, $User;
     10  global $Config, $System, $User;
    1111 
    1212  echo('<h3>Seznam překladatelských týmů</h3>');
    1313  echo('Týmy jsou seskupení překladatelů, kteří se hlásí k něčemu společnému jako např. WoW serveru, způsobu překladu, ke stejnému hernímu spolku, aj. Být členem týmu samo o sobě nemá žádný zásadní důsledek a spíše to může pomoci se lépe orientovat mezi překladateli někomu, kdo sestavuje export.<br/>');
    14   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team`');
    15   $DbRow = mysql_fetch_row($DbResult);
     14  $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team`');
     15  $DbRow = $DbResult->fetch_row();
    1616  $PageList = GetPageList($DbRow[0]);   
    1717
     
    3535    if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
    3636
    37     $ID = $Database->SQLCommand('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` FROM `Team` '.$_SESSION['search'].$Order['SQL'].$PageList['SQLLimit']);
    38     while($Team = mysql_fetch_assoc($ID))
     37    $DbResult = $System->Database->query('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` FROM `Team` '.$_SESSION['search'].$Order['SQL'].$PageList['SQLLimit']);
     38    while($Team = $DbResult->fetch_assoc())
    3939    {
    4040      echo('<tr>'.
     
    6161function TeamJoin()
    6262{
    63   global $Database, $User;
     63  global $System, $User;
    6464 
    6565  if($User->Licence(LICENCE_USER))
     
    6767    if(array_key_exists('id', $_GET))
    6868    {
    69       $Database->SQLCommand('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$User->Id);
     69      $System->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$User->Id);
    7070      echo('<strong>Vstoupil jsi do týmu</strong><br /><br />');   
    7171      WriteLog('Uživatel vstoupil do týmu '.$_GET['id'], LOG_TYPE_USER);
    7272
    7373      // Delete all teams without users
    74       $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');
     74      $System->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');
    7575       
    7676      // Set new leader for teams where old leader went to other team
    77       $Database->SQLCommand('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);');
     77      $System->Database->query('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);');
    7878       
    7979      ShowTeamList();
     
    8484function TeamCreateFinish()
    8585{
    86   global $Database, $User;
     86  global $System, $User;
    8787 
    8888  if($User->Licence(LICENCE_USER))
     
    9090    if(array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST))
    9191    {
    92       $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 
    93       $DbRow = mysql_fetch_row($DbResult);
     92      $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 
     93      $DbRow = $DbResult->fetch_row();
    9494      $Count = $DbRow[0];
    9595      if(($Count == 0) and ($_POST['Name'] != ''))
    9696      {
    97         $Database->SQLCommand('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`,`Leader`) VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.$_POST['URL'].'", NOW(), '.$User->Id.')'); 
    98         $Database->SQLCommand('UPDATE `User` SET `Team` = '.mysql_insert_id().' WHERE `ID` = '.$User->Id);
     97        $System->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`,`Leader`) VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.$_POST['URL'].'", NOW(), '.$User->Id.')'); 
     98        $System->Database->query('UPDATE `User` SET `Team` = '.mysql_insert_id().' WHERE `ID` = '.$User->Id);
    9999        echo('<strong>Překladatelský tým vytvořen</strong><br /><br />');
    100100        WriteLog('Překladatelský tým vytvořen '.$_POST['Name'], LOG_TYPE_USER);
    101101
    102102        // Delete all teams without users
    103         $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');   
     103        $System->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');   
    104104      } else echo('Již existuje tým se stejným jménem');
    105105    } else echo('Chybí údaje formuláře');
     
    110110function TeamModify()
    111111{
    112   global $Database, $User;
     112  global $System, $User;
    113113 
    114114  if($User->Licence(LICENCE_USER))
     
    116116    if(array_key_exists('id', $_GET))
    117117    {
    118       $DbResult = $Database->SQLCommand('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id);
    119       if(mysql_num_rows($DbResult) > 0)
    120       {
    121         $Team = mysql_fetch_assoc($DbResult);
     118      $DbResult = $System->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id);
     119      if($DbResult->num_rows > 0)
     120      {
     121        $Team = $DbResult->fetch_assoc();
    122122        echo('<form action="?action=finish_modify&amp;id='.$_GET['id'].'" method="post">'.
    123123      '<fieldset><legend>Nastavení týmu</legend>'.
     
    134134function TeamModifyFinish()
    135135{
    136   global $Database, $User;
     136  global $System, $User;
    137137 
    138138  if($User->Licence(LICENCE_USER))
     
    140140    if(array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST))
    141141    {
    142       $DbResult = $Database->SQLCommand('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id);
    143       if(mysql_num_rows($DbResult) > 0)
    144       {
    145         $Team = mysql_fetch_assoc($DbResult);
    146         $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 
    147         $DbRow = mysql_fetch_row($DbResult);
     142      $DbResult = $System->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id);
     143      if($DbResult->num_rows > 0)
     144      {
     145        $Team = $DbResult->fetch_assoc();
     146        $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 
     147        $DbRow = $DbResult->fetch_row();
    148148        $Count = $DbRow[0];
    149149        if(($Count == 0) and ($_POST['Name'] != ''))
    150150        {         
    151           $Database->SQLCommand('UPDATE `Team` SET `Name`="'.$_POST['Name'].'", `Description`="'.$_POST['Description'].'", `URL`="'.$_POST['URL'].'" WHERE Id='.$Team['Id']);
     151          $System->Database->query('UPDATE `Team` SET `Name`="'.$_POST['Name'].'", `Description`="'.$_POST['Description'].'", `URL`="'.$_POST['URL'].'" WHERE Id='.$Team['Id']);
    152152          echo('Nastavení týmu uloženo.<br/>');
    153153          WriteLog('Překladatelský tým upraven '.$_POST['Name'], LOG_TYPE_USER);
     
    177177function TeamShow()
    178178{
    179   global $Database, $TranslationTree, $User, $Config;
     179  global $System, $TranslationTree, $User, $Config;
    180180 
    181181  if(array_key_exists('id', $_GET) and is_numeric($_GET['id']))
     
    183183    ImgLevelUpdate();
    184184     
    185     $DbResult = $Database->SQLCommand('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE `team` = `Team`.`Id`) AS `NumberTranslate` FROM `Team` WHERE `Id`='.$_GET['id']);
    186     if(mysql_num_rows($DbResult) > 0)
    187     {
    188       $Team = mysql_fetch_assoc($DbResult);
    189       $DbResult = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID`='.$Team['Leader']);
    190       if(mysql_num_rows($DbResult) > 0)
    191       {
    192         $Leader = mysql_fetch_assoc($DbResult);
     185    $DbResult = $System->Database->query('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE `team` = `Team`.`Id`) AS `NumberTranslate` FROM `Team` WHERE `Id`='.$_GET['id']);
     186    if($DbResult->num_rows > 0)
     187    {
     188      $Team = $DbResult->fetch_assoc();
     189      $DbResult2 = $System->Database->query('SELECT `Name` FROM `User` WHERE `ID`='.$Team['Leader']);
     190      if($DbResult2->num_rows > 0)
     191      {
     192        $Leader = $DbResult2->fetch_assoc();
    193193        $Leader = $Leader['Name'];
    194194      } else $Leader = '';
     
    210210  $GroupListQuery = 'SELECT `Group`.* FROM `Group`';
    211211  $Query = '';
    212   $DbResult = $Database->SQLCommand($GroupListQuery);
    213   while($DbRow = mysql_fetch_assoc($DbResult))
     212  $DbResult = $System->Database->query($GroupListQuery);
     213  while($DbRow = $DbResult->fetch_assoc())
    214214  {
    215215    $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    224224  $Query = substr($Query, 0, - 6);
    225225
    226   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
    227   $DbRow = mysql_fetch_row($DbResult);
     226  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
     227  $DbRow = $DbResult->fetch_row();
    228228  $PageList = GetPageList($DbRow[0]); 
    229229  echo($PageList['Output']);
     
    242242  $Translated = 0;
    243243  $Total = 0;
    244   $ID = $Database->SQLCommand('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    245   while($Group = mysql_fetch_assoc($ID))
     244  $DbResult = $System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
     245  while($Group = $DbResult->fetch_assoc())
    246246  {
    247247    echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>');
     
    259259function TeamLeave()
    260260{
    261   global $Database, $User;
    262  
    263   if($User->Licence(LICENCE_USER))
    264   {   
    265     $Database->SQLCommand('UPDATE `User` SET `Team` = 0 WHERE `ID` = '.$User->Id);
     261  global $System, $User;
     262 
     263  if($User->Licence(LICENCE_USER))
     264  {   
     265    $System->Database->query('UPDATE `User` SET `Team` = 0 WHERE `ID` = '.$User->Id);
    266266    echo('<strong>Nyní nejste členem žádného týmu</strong><br /><br />');   
    267267    WriteLog('Uživatel vystoupil z týmu', LOG_TYPE_USER);
    268268
    269269    // Delete all teams without users
    270     $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');
     270    $System->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');
    271271       
    272272    // Set new leader for teams where old leader went to other team
    273     $Database->SQLCommand('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);');
     273    $System->Database->query('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);');
    274274       
    275275    ShowTeamList();
  • trunk/user.php

    r436 r455  
    2424
    2525  $Query = 'SELECT * FROM `User` WHERE `ID` = '.$_GET['user'];
    26   $UserLine = mysql_fetch_array($Database->SQLCommand($Query));
     26  $DbResult = $System->Database->query($Query);
     27  $UserLine = $DbResult->fetch_array();
    2728   
    2829  echo('ID: <strong>'.$UserLine['ID'].'</strong><br />');
  • trunk/userlist.php

    r436 r455  
    2626//if($_SESSION['Where'] <> '') echo(' <a href="?action=nofilter">Zrušit filtr uživatelů</a><br />');
    2727
    28 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`'.$_SESSION['Where']);
    29 $DbRow = mysql_fetch_row($DbResult);
     28$DbResult = $System->Database->query('SELECT COUNT(*) FROM `User`'.$_SESSION['Where']);
     29$DbRow = $DbResult->fetch_row();
    3030$PageList = GetPageList($DbRow[0]);   
    3131
     
    4848$Query = 'SELECT `ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` FROM `User` '.$_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit'];
    4949
    50 $ID = $Database->SQLCommand($Query);
    51 while($Line = mysql_fetch_assoc($ID))
     50$DbResult = $System->Database->query($Query);
     51while($Line = $DbResult->fetch_assoc())
    5252{
    5353  if($User->Licence(LICENCE_MODERATOR))
  • trunk/version.php

    r366 r455  
    55ShowPage();
    66
    7 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ClientVersion`');
    8 $DbRow = mysql_fetch_row($DbResult);
     7$DbResult = $System->Database->query('SELECT COUNT(*) FROM `ClientVersion`');
     8$DbRow = $DbResult->fetch_row();
    99$PageList = GetPageList($DbRow[0]);   
    1010
     
    2222echo($Order['Output']);
    2323
    24 $DbResult = $Database->SQLCommand('SELECT * FROM ClientVersion '.$Order['SQL'].$PageList['SQLLimit']);
    25 while($Version = mysql_fetch_assoc($DbResult))
     24$DbResult = $System->Database->query('SELECT * FROM ClientVersion '.$Order['SQL'].$PageList['SQLLimit']);
     25while($Version = $DbResult->fetch_assoc())
    2626{
    2727  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></tr>');
Note: See TracChangeset for help on using the changeset viewer.