Changeset 297 for trunk/export/export.php
- Timestamp:
- Dec 28, 2009, 2:32:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r293 r297 36 36 // Filter selected users 37 37 $this->SelectedUsers = ''; 38 $DbResult = $this->Database->query('SELECT * FROM `ExportUser` WHERE Export='.$this->Id.' ORDER BY Sequence'); 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 40 while($User = $DbResult->fetch_assoc()) 41 { 40 42 $this->SelectedUsers .= ','.$User['User']; 43 $this->UserNames .= ','.$User['user']; 44 } 41 45 $this->SelectedUsers = substr($this->SelectedUsers, 1); 42 43 if($this->SelectedUsers == '') $Where = 0; 44 else $Where = 'ID IN ('.$this->SelectedUsers.')'; 45 46 $this->UserNames = ''; 47 $DbResult = $this->Database->query('SELECT user FROM `user` WHERE '.$Where); 48 while($DbRow = $DbResult->fetch_assoc()) 49 $this->UserNames .= ','.$DbRow['user']; 50 $this->UserNames = substr($this->UserNames, 1); 46 $this->UserNames = substr($this->UserNames, 1); 51 47 52 48 if($this->SelectedUsers == '') 53 49 { 54 $this->WhereUsers = 1;50 $this->WhereUsers = 0; 55 51 $this->OrderByUserList = ''; 56 52 } else … … 60 56 } 61 57 58 // Load logged user 62 59 if(isset($_SESSION) and ($_SESSION['UserID'] != '')) 63 60 { … … 101 98 if($Group['MangosTable'] != '') 102 99 { 103 $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers. ' ORDER BY FIELD(User, '.$this->SelectedUsers.')) AS T GROUP BY T.entry';100 $Query = 'SELECT * 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'; 104 101 //echo($Query); 105 102 $Buffer .= "\n\n-- ".$Group['Name']."\n\n"; … … 129 126 130 127 $Buffer = $this->ExportToMangosSQL(); 131 132 $this->LoadFilters(); 133 128 134 129 // Data to aowow 135 130 … … 137 132 $Database2->query('SET NAMES '.$this->Config['Database']['Charset']); 138 133 $Database2->select_db($AoWoWconf['mangos']['db']); 139 $AoWoWTables = array('aowow_resistances' => 'Id', 'aowow_spelldispeltype' => 'Id', 'aowow_skill' => 'skillID'); 134 $AoWoWTables = array( 135 'aowow_resistances' => 'Id', 136 'aowow_spelldispeltype' => 'Id', 137 'aowow_skill' => 'skillID', 138 ); 140 139 foreach($AoWoWTables as $AoWoWTable => $IndexColum) 141 140 { … … 147 146 { 148 147 $Ori_text = $Line['name']; 149 $DbResult2 = $Dat base2->query('SELECT text as en,148 $DbResult2 = $Database2->query('SELECT text as en, 150 149 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran 151 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$ WhereLang.'152 AND '.$ WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')LIMIT 1) as tran150 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.' 151 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran 153 152 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE 154 153 text = "'.addslashes($Ori_text).'" LIMIT 1'); … … 160 159 (SELECT OptionText FROM '.$this->Config['Database']['Database'].'.npc_option as tabletran 161 160 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.' 162 AND '.$this->WhereUsers. ' ORDER BY FIELD(User, '.$this->SelectedUsers.')LIMIT 1) as tran161 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran 163 162 FROM '.$this->Config['Database']['Database'].'.npc_option as tableen WHERE 164 163 OptionText = "'.addslashes($Ori_text).'" LIMIT 1'); … … 205 204 $Group['MangosTableIndex'] = 'entry'; 206 205 } 207 $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.' ORDER BY FIELD(User, '.$this->SelectedUsers.')) AS T GROUP BY T.entry';208 //echo($Query);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'; 207 echo($Query); 209 208 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 210 209 $DbResult2 = $this->Database->query($Query); … … 239 238 { 240 239 echo($Group['Name'].'... '); 240 if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 241 { 241 242 $DBCFile = new DBCFile(); 242 $DBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($ Setting['Version'], $Group['DBCFileName']));243 $DBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName'])); 243 244 $DBCFile2 = new DBCFile(); 244 $DBCFile2->CreateFile($this->TempDir.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName'])); 245 if(!file_exists($this->TempDir.'dbc/')) mkdir($this->TempDir.'dbc/', 0777, true); 246 $DBCFile2->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName'])); 245 247 $Count = $DBCFile->GetRecordCount(); 246 248 //if($Group['DBCFileName'] == 'Spell') $Count = 1000; … … 267 269 $DBCFile2->Commit(); 268 270 echo('Hotovo <br />'); 271 } else echo('Zdrojový soubor '.'../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n"); 269 272 } 270 273 } … … 283 286 $File->OpenFile('../source/'.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua'); 284 287 $File2 = new FileStream(); 285 $File2->CreateFile($this->TempDir.''.$Group['LuaFileName'].'.lua'); 288 if(!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true); 289 $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua'); 286 290 287 291 while(!$File->EOF()) … … 296 300 $Value['Comment'] = addslashes(substr(trim($LineParts[1]), 3)); 297 301 298 $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (ShortCut="'.$Value['ShortCut'].'") AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' ORDER BY FIELD(User, '.$this->SelectedUsers.')) AS T GROUP BY T.entry';302 $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (ShortCut="'.$Value['ShortCut'].'") AND (VersionStart <= '.$this->ClientVersion['BuildNumber'].') AND (VersionEnd >= '.$this->ClientVersion['BuildNumber'].')'.$this->OrderByUserList.') AS T GROUP BY T.entry'; 299 303 //echo($Query); 300 304 $DbResult2 = $this->Database->query($Query);
Note:
See TracChangeset
for help on using the changeset viewer.