Changeset 178
- Timestamp:
- Apr 11, 2009, 12:34:37 PM (16 years ago)
- Location:
- trunk/export
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r150 r178 80 80 return($Buffer); 81 81 } 82 83 function ExportToAoWoWSQL($Setting) { 84 global $Database, $Config, $TranslationTree,$AoWoWconf; 85 require_once('../aowow/configs/config.php'); 86 87 $Buffer = ExportToMangosSQL($Setting); 88 89 $AnoNe = array('Ne', 'Ano'); 90 if($_SESSION['UserID'] != '') 91 { 92 $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']); 93 $User = mysql_fetch_assoc($DbResult); 94 } else $User = array('user' => 'Neznámý'); 95 96 $WhereLang = ''; 97 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)"; 98 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)"; 99 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)"; 100 if($WhereLang == '') $WhereLang = 1; 101 else $WhereLang = '('.substr($WhereLang, 4).')'; 102 103 $SelectedUsers = ''; 104 foreach($Setting['users-selection'] as $Item) 105 $SelectedUsers .= ','.$Item; 106 $SelectedUsers = substr($SelectedUsers, 1); 107 108 if($SelectedUsers == '') $Where = 0; 109 else $Where = 'ID IN ('.$SelectedUsers.')'; 110 111 $UserNames = ''; 112 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE '.$Where); 113 while($DbRow = mysql_fetch_assoc($DbResult)) 114 $UserNames .= ','.$DbRow['user']; 115 $UserNames = substr($UserNames, 1); 116 117 if($SelectedUsers == '') $WhereUsers = 1; 118 else $WhereUsers = '(User IN ('.$SelectedUsers.'))'; 119 120 121 //data to aowow 122 123 $Database->SelectDatabase($AoWoWconf['mangos']['db']); 124 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 125 $AoWoWTables = array('aowow_resistances', 'aowow_spelldispeltype', 'aowow_skill'); 126 foreach($AoWoWTables as $AoWoWTable) { 127 $Buffer .= $AoWoWTable.', '; 128 $Buffer .= "\n\n"; 129 $Query = 'SELECT name FROM '.$AoWoWTable; 130 $ID = $Database->SQLCommand($Query); 131 while($Line = mysql_fetch_assoc($ID)) { 132 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en, 133 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran 134 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.' 135 AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.') LIMIT 1) as tran 136 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE 137 text = "'.addslashes($Line['name']).'" LIMIT 1')); 138 //echo ($Line['name'].'='.$Tran['tran']); 139 if ($Tran['tran'] <> '') 140 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name = "'.addslashes($Tran['tran']).'" WHERE name = "'.addslashes($Line['name']).'";'."\n"; 141 } 142 $Buffer .= "\n\n"; 143 } 144 return($Buffer); 145 } 146 82 147 83 148 function ExportToXML($Setting) -
trunk/export/index.php
r177 r178 97 97 98 98 echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 99 '<a href="'.$SaveFilename.'"> CzWoW_SQL.zip</a><br />'.99 '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'. 100 100 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'); 101 101 break; … … 105 105 echo('</pre>'); 106 106 break; 107 case 'AoWoWSQL': 107 case 'AoWoWSQLCompressed': 108 if(function_exists('gzcompress')) 109 { 110 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 111 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 112 $SaveFilename = $TempDir.'CzAoWoW_SQL.zip'; 113 $SQLFilename = 'CzAoWoW_SQL.sql'; 114 $BufferZip = ExportToAoWoWSQL($ExportSetting); 115 $ZipFile = new zipfile(); 116 $ZipFile->addFile($BufferZip, $SQLFilename); 117 $Buffer = $ZipFile->file(); 118 file_put_contents($SaveFilename, $Buffer); 119 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 120 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 121 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 1000)'. 122 '</script>'); 123 124 echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 125 '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'. 126 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'); 127 break; 128 case 'AoWoWSQLDirect': 129 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 130 echo(htmlspecialchars(ExportToAoWoWSQL($ExportSetting))); 131 echo('</pre>'); 132 break; 133 case 'AoWoWImport': 108 134 require_once('../aowow/configs/config.php'); 109 135 echo('Gewneruji SQL kód '); 110 $AoWoWSQL = ExportTo MangosSQL($ExportSetting);136 $AoWoWSQL = ExportToAoWoWSQL($ExportSetting); 111 137 echo ('<strong>Hotovo</strong><br />'); 112 138 113 echo('Importuji do Mangos a spell');139 echo('Importuji do AoWoW '); 114 140 $Database->SelectDatabase($AoWoWconf['mangos']['db']); 115 141 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); … … 120 146 echo('. '); 121 147 } 122 echo ('<strong>Hotovo</strong><br />');123 124 echo('Importuji do AoWoW ');125 $Query = 'SELECT name FROM aowow_resistances';126 $ID = $Database->SQLCommand($Query);127 while($Line = mysql_fetch_assoc($ID)) {128 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en,129 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran130 WHERE tableen.entry = tabletran.entry AND Language <> 0 LIMIT 1) as tran131 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE text = "'.$Line['name'].'" LIMIT 1'));132 //echo ($Line['name'].'='.$Tran['tran']);133 if ($Tran['tran'] <> '')134 $Database->SQLCommand('UPDATE aowow_resistances SET name = "'.$Tran['tran'].'" WHERE name = "'.$Line['name'].'"');135 echo('. ');136 }137 138 $Query = 'SELECT name FROM aowow_skill';139 $ID = $Database->SQLCommand($Query);140 while($Line = mysql_fetch_assoc($ID)) {141 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en,142 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran143 WHERE tableen.entry = tabletran.entry AND Language <> 0 LIMIT 1) as tran144 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE text = "'.$Line['name'].'" LIMIT 1'));145 //echo ($Line['name'].'='.$Tran['tran']);146 if ($Tran['tran'] <> '')147 $Database->SQLCommand('UPDATE aowow_skill SET name = "'.$Tran['tran'].'" WHERE name = "'.$Line['name'].'"');148 echo('. ');149 }150 151 $Query = 'SELECT name FROM aowow_spelldispeltype';152 $ID = $Database->SQLCommand($Query);153 while($Line = mysql_fetch_assoc($ID)) {154 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en,155 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran156 WHERE tableen.entry = tabletran.entry AND Language <> 0 LIMIT 1) as tran157 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE text = "'.$Line['name'].'" LIMIT 1'));158 //echo ($Line['name'].'='.$Tran['tran']);159 if ($Tran['tran'] <> '')160 $Database->SQLCommand('UPDATE aowow_spelldispeltype SET name = "'.$Tran['tran'].'" WHERE name = "'.$Line['name'].'"');161 echo('. ');162 }163 148 echo ('<strong>Hotovo</strong><br />'); 164 149 … … 348 333 RadioButton('Export', 'MangosSQLDirect', $ExportSetting['Export'] == 'MangosSQLDirect').'MaNGOS SQL - přímo zobrazit<br />'. 349 334 RadioButton('Export', 'MangosSQLCompressed', $ExportSetting['Export'] == 'MangosSQLCompressed').'MaNGOS SQL - komprimovaný soubor<br />'. 335 RadioButton('Export', 'AoWoWSQLDirect', $ExportSetting['Export'] == 'AoWoWSQLDirect').'AoWoW SQL - přímo zobrazit<br />'. 336 RadioButton('Export', 'AoWoWSQLCompressed', $ExportSetting['Export'] == 'AoWoWSQLCompressed').'AoWoW SQL - komprimovaný soubor<br />'. 350 337 RadioButton('Export', 'XMLDirect', $ExportSetting['Export'] == 'XMLDirect').'XML - přímo zobrazit<br />'. 351 338 RadioButton('Export', 'XMLCompressed', $ExportSetting['Export'] == 'XMLCompressed').'XML - komprimovaný soubor<br />'. … … 354 341 if(Licence(LICENCE_ADMIN)) { 355 342 echo (RadioButton('Export', 'DBC', $ExportSetting['Export'] == 'DBC').'DBC - komprimovaný soubor (pouze admin)<br />'); 356 echo(RadioButton('Export', 'AoWoW SQL', $ExportSetting['Export'] == 'AoWoWSQL').'Importovat do AoWoW (pouze admin)<br />');343 echo(RadioButton('Export', 'AoWoWImport', $ExportSetting['Export'] == 'AoWoWImport').'Importovat do AoWoW (pouze admin)<br />'); 357 344 echo(RadioButton('Export', 'VerseCZ', $ExportSetting['Export'] == 'VerseCZ').'Vytvoření verze češtiny <a href="../download.php?createverse" Title="Před konečným exportováním napište popis k verzi" Target="_NEW">Popis k verzi</a> (pouze admin)<br />'); 358 345 }
Note:
See TracChangeset
for help on using the changeset viewer.