Changeset 376 for trunk/export/export.php
- Timestamp:
- Mar 11, 2010, 8:40:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r375 r376 11 11 var $SelectedUsers; 12 12 var $UserNames; 13 var $User;14 13 var $ClientVersion; 15 14 var $OrderByUserList; … … 38 37 $this->UserNames = ''; 39 38 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 40 while($User = $DbResult->fetch_assoc())41 { 42 $this->SelectedUsers .= ','.$User ['ID'];43 $this->UserNames .= ','.$User ['Name'];39 while($UserLine = $DbResult->fetch_assoc()) 40 { 41 $this->SelectedUsers .= ','.$UserLine['ID']; 42 $this->UserNames .= ','.$UserLine['Name']; 44 43 } 45 44 $this->SelectedUsers = substr($this->SelectedUsers, 1); … … 56 55 } 57 56 58 // Load logged user59 if(isset($_SESSION) and ($_SESSION['UserID'] != ''))60 {61 $DbResult = $this->Database->query('SELECT `Name` FROM `User` WHERE `ID`='.$_SESSION['UserID']);62 $this->User = $DbResult->fetch_assoc();63 } else $this->User = array('User' => 'Neznámý');64 65 66 57 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); 67 58 $this->ClientVersion = $DbResult->fetch_assoc(); … … 70 61 function ExportToMangosSQL() 71 62 { 72 global $TranslationTree, $LanguageList ;63 global $TranslationTree, $LanguageList, $User, $Config; 73 64 74 65 $this->LoadFilters(); … … 82 73 "-- Znaková sada: ".$this->Config['Database']['Charset']." / ".$this->Config['Web']['Charset']."\n". 83 74 "-- Diakritika: ".$this->AnoNe[$this->Export['WithDiacritic']]."\n". 84 "-- Vygeneroval uživatel: ".$ this->User['Name']."\n".75 "-- Vygeneroval uživatel: ".$User->Name."\n". 85 76 "-- Vzato od uživatelů: ".$this->UserNames."\n". 86 77 "-- Generované tabulky: "; … … 89 80 while($Group = $DbResult->fetch_assoc()) 90 81 { 91 $Buffer .= $Group['MangosTable'].', ';82 $Buffer .= $Group['TablePrefix'].', '; 92 83 } 93 84 $Buffer .= "\n\n"; … … 146 137 { 147 138 $Ori_text = $Line['name']; 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.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `tran`151 FROM `'.$Config['Database']['Database'].'`.` global_strings` AS `tableen` WHERE152 ` text` = "'.addslashes($Ori_text).'" LIMIT 1');139 $DbResult2 = $Database2->query('SELECT `Text` AS `En`, 140 (SELECT `Text` FROM `'.$Config['Database']['Database'].'`.`TextGlobalString` AS `TableTran` 141 WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran` 142 FROM `'.$Config['Database']['Database'].'`.`TextGlobalString` AS `TableEn` WHERE 143 `Text` = "'.addslashes($Ori_text).'" LIMIT 1'); 153 144 $Tran = $DbResult2->fetch_assoc(); 154 145 //echo ($Line['name'].'='.$Tran['tran']); 155 if($Tran[' tran'] == '')146 if($Tran['Tran'] == '') 156 147 { 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` WHERE148 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, 149 (SELECT `OptionText` FROM `'.$this->Config['Database']['Database'].'`.`TextNPCOption` 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 `'.$this->Config['Database']['Database'].'`.`TextNPCOption` AS `TableEn` WHERE 162 153 `OptionText` = "'.addslashes($Ori_text).'" LIMIT 1'); 163 154 $Tran = $DbResult2->fetch_assoc(); 164 155 } 165 156 166 if($Tran[' tran'] <> '')167 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran[' tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";157 if($Tran['Tran'] <> '') 158 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 168 159 } 169 160 $Buffer .= "\n\n"; … … 176 167 function ExportToXML() 177 168 { 178 global $TranslationTree, $LanguageList ;169 global $TranslationTree, $LanguageList, $User; 179 170 180 171 $this->LoadFilters($this->Id); … … 186 177 " <time>".date('r')."</time>\n". 187 178 " <diacritics mode=".'"'.$this->Export['WithDiacritic'].'"'." />\n". 188 " <author>".$ this->User['Name']."</author>\n".179 " <author>".$User->Name."</author>\n". 189 180 " <contributors>\n"; 190 181 foreach(explode(',', $this->UserNames) as $UserName) … … 209 200 while($Line = $DbResult2->fetch_assoc()) 210 201 { 211 $Buffer .= ' <item id="'.$Line[' entry'].'" user="'.$Line['UserName'].'">'."\n";202 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 212 203 $Values = ''; 213 204 foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem) … … 242 233 $columns = ''; 243 234 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 244 $columns .= ' T.'.$Column['Column'].' as text'.$i.',';235 $columns .= ' `T`.`'.$Column['Column'].'` AS `Text`'.$i.','; 245 236 $i = $i+1; 246 237 } 247 238 248 $querty = '"SELECT '.$columns.' T.Entry as entry FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].') AS T GROUP BY T.Entry"';239 $querty = '"SELECT '.$columns.' `T`.`Entry` AS `Entry` FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')) AS `T` GROUP BY `T`.`Entry`"'; 249 240 250 241 $params = '-u '.$Config['Database']['User'].' -p '.$Config['Database']['Password'].' -f ../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc -n '.$this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc -c '.GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']).' -q '.$querty;
Note:
See TracChangeset
for help on using the changeset viewer.