Changeset 349 for trunk/export/export.php
- Timestamp:
- Mar 3, 2010, 10:37:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r300 r349 23 23 function LoadFilters() 24 24 { 25 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE Id='.$this->Id);25 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 26 26 $this->Export = $DbResult->fetch_assoc(); 27 27 28 28 // Filter selected languages 29 29 $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`'); 31 31 while($Language = $DbResult->fetch_assoc()) 32 $this->WhereLang .= ' OR ( Language= '.$Language['Language'].')';32 $this->WhereLang .= ' OR (`Language` = '.$Language['Language'].')'; 33 33 if($this->WhereLang == '') $this->WhereLang = 1; 34 34 else $this->WhereLang = '('.substr($this->WhereLang, 4).')'; … … 37 37 $this->SelectedUsers = ''; 38 38 $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`'); 40 40 while($User = $DbResult->fetch_assoc()) 41 41 { … … 52 52 } else 53 53 { 54 $this->WhereUsers = '( UserIN ('.$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.')'; 56 56 } 57 57 … … 59 59 if(isset($_SESSION) and ($_SESSION['UserID'] != '')) 60 60 { 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']); 62 62 $this->User = $DbResult->fetch_assoc(); 63 63 } else $this->User = array('user' => 'Neznámý'); … … 141 141 $Buffer .= '--'.$AoWoWTable.', '; 142 142 $Buffer .= "\n\n"; 143 $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable;143 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 144 144 $DbResult = $Database2->query($Query); 145 145 while($Line = $DbResult->fetch_assoc()) … … 147 147 $Ori_text = $Line['name']; 148 148 $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'); 154 153 $Tran = $DbResult2->fetch_assoc(); 155 154 //echo ($Line['name'].'='.$Tran['tran']); 156 155 if($Tran['tran'] == '') 157 156 { 158 $DbResult2 = $Database2->query('SELECT OptionText as en,159 (SELECT OptionText FROM '.$this->Config['Database']['Database'].'.npc_option as tabletran160 WHERE tableen.entry = tabletran.entry AND (Complete= 1) AND '.$this->WhereLang.'161 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran162 FROM '.$this->Config['Database']['Database'].'.npc_option as tableenWHERE163 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'); 164 163 $Tran = $DbResult2->fetch_assoc(); 165 164 } 166 165 167 166 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"; 169 168 } 170 169 $Buffer .= "\n\n"; … … 204 203 $Group['MangosTableIndex'] = 'entry'; 205 204 } 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`'; 207 206 //echo($Query); 208 207 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
Note:
See TracChangeset
for help on using the changeset viewer.