Ignore:
Timestamp:
Mar 3, 2010, 10:37:40 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Neprovádět prázdné SQL řádky při vykonávání exportu pro AoWoW.
  • Opraveno: Chyba použití globální proměné při generování obrázků XP překladatelů při zobzarení týmu. Nestandardně zde byl vkládán skript přes include uvnitř funkce, což zapříčinilo změnu globálních proměnných na lokální.
  • Upraveno: Doplněny SQL uvozovky v některých dotazech.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r300 r349  
    2323  function LoadFilters()
    2424  { 
    25     $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE Id='.$this->Id);
     25    $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
    2626    $this->Export = $DbResult->fetch_assoc();
    2727
    2828    // Filter selected languages
    2929    $this->WhereLang = '';
    30     $DbResult = $this->Database->query('SELECT * FROM `ExportLanguage` WHERE Export='.$this->Id.' ORDER BY Sequence');
     30    $DbResult = $this->Database->query('SELECT * FROM `ExportLanguage` WHERE `Export`='.$this->Id.' ORDER BY `Sequence`');
    3131    while($Language = $DbResult->fetch_assoc())
    32       $this->WhereLang .= ' OR (Language = '.$Language['Language'].')';
     32      $this->WhereLang .= ' OR (`Language` = '.$Language['Language'].')';
    3333    if($this->WhereLang == '') $this->WhereLang = 1;
    3434      else $this->WhereLang = '('.substr($this->WhereLang, 4).')';
     
    3737    $this->SelectedUsers = ''; 
    3838    $this->UserNames = '';
    39     $DbResult = $this->Database->query('SELECT ExportUser.*, user.user FROM `ExportUser` LEFT JOIN user ON user.ID=ExportUser.User WHERE ExportUser.Export='.$this->Id.' ORDER BY ExportUser.Sequence');
     39    $DbResult = $this->Database->query('SELECT `ExportUser`.*, `user`.`user` FROM `ExportUser` LEFT JOIN `user` ON `user`.`ID`=`ExportUser`.`User` WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`');
    4040    while($User = $DbResult->fetch_assoc())
    4141    {
     
    5252    } else
    5353    {
    54       $this->WhereUsers = '(User IN ('.$this->SelectedUsers.'))';
    55       $this->OrderByUserList = ' ORDER BY FIELD(User, '.$this->SelectedUsers.')';
     54      $this->WhereUsers = '(`User` IN ('.$this->SelectedUsers.'))';
     55      $this->OrderByUserList = ' ORDER BY FIELD(`User`, '.$this->SelectedUsers.')';
    5656    }
    5757   
     
    5959    if(isset($_SESSION) and ($_SESSION['UserID'] != ''))
    6060    {
    61       $DbResult = $this->Database->query('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);
     61      $DbResult = $this->Database->query('SELECT `user` FROM `user` WHERE `ID`='.$_SESSION['UserID']);
    6262      $this->User = $DbResult->fetch_assoc();
    6363    } else $this->User = array('user' => 'Neznámý');
     
    141141      $Buffer .= '--'.$AoWoWTable.', ';
    142142      $Buffer .= "\n\n"; 
    143       $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable;
     143      $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`';
    144144      $DbResult = $Database2->query($Query);
    145145      while($Line = $DbResult->fetch_assoc())
     
    147147        $Ori_text = $Line['name'];
    148148        $DbResult2 = $Database2->query('SELECT text as en,
    149         (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran
    150          WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.'
    151           AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran
    152          FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE
    153           text = "'.addslashes($Ori_text).'" LIMIT 1');
     149        (SELECT `text` FROM `'.$Config['Database']['Database'].'`.`global_strings` AS `tabletran`
     150         WHERE `tableen`.`entry` = `tabletran`.`entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `tran`
     151         FROM `'.$Config['Database']['Database'].'`.`global_strings` AS `tableen` WHERE
     152          `text` = "'.addslashes($Ori_text).'" LIMIT 1');
    154153        $Tran = $DbResult2->fetch_assoc();
    155154        //echo ($Line['name'].'='.$Tran['tran']);
    156155        if($Tran['tran'] == '')
    157156        {
    158           $DbResult2 = $Database2->query('SELECT OptionText as en,
    159           (SELECT OptionText FROM '.$this->Config['Database']['Database'].'.npc_option as tabletran
    160            WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.'
    161             AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran
    162           FROM '.$this->Config['Database']['Database'].'.npc_option as tableen WHERE
    163             OptionText = "'.addslashes($Ori_text).'" LIMIT 1');
     157          $DbResult2 = $Database2->query('SELECT `OptionText` AS `en`,
     158          (SELECT `OptionText` FROM `'.$this->Config['Database']['Database'].'`.`npc_option` AS `tabletran`
     159           WHERE `tableen`.`entry` = `tabletran`.`entry` AND (`Complete` = 1) AND '.$this->WhereLang.'
     160            AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `tran`
     161          FROM `'.$this->Config['Database']['Database'].'`.`npc_option` AS `tableen` WHERE
     162            `OptionText` = "'.addslashes($Ori_text).'" LIMIT 1');
    164163          $Tran = $DbResult2->fetch_assoc();
    165164        }
    166165       
    167166        if($Tran['tran'] <> '')
    168           $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name = "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
     167          $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
    169168      }
    170169      $Buffer .= "\n\n"; 
     
    204203        $Group['MangosTableIndex'] = 'entry';
    205204      }
    206       $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND (VersionStart <= '.$this->ClientVersion['BuildNumber'].') AND (VersionEnd >= '.$this->ClientVersion['BuildNumber'].') AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T GROUP BY T.entry';
     205      $Query = 'SELECT *,(SELECT `user` FROM `user` WHERE `user`.`ID`=`T`.`User`) AS `UserName` FROM (SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].') AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS `T` GROUP BY `T`.`entry`';
    207206      //echo($Query);
    208207      $Buffer .= '    <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
Note: See TracChangeset for help on using the changeset viewer.