Changeset 200
- Timestamp:
- Jun 9, 2009, 8:04:54 AM (15 years ago)
- Location:
- trunk/export
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/create_addon.php
r193 r200 73 73 function MakeLanguageFiles($Setting) 74 74 { 75 global $Database, $TempDir, $TranslationTree, $CreatedFileList ;75 global $Database, $TempDir, $TranslationTree, $CreatedFileList, $LanguageList; 76 76 77 77 $CreatedFileList = array(); … … 79 79 80 80 $WhereLang = ''; 81 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";82 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";83 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";81 foreach($LanguageList as $Language) 82 if($Language['Enabled'] == 1) 83 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 84 84 if($WhereLang == '') $WhereLang = 1; 85 85 else $WhereLang = '('.substr($WhereLang, 4).')'; … … 149 149 function MakeClientStrings($Setting) 150 150 { 151 global $Database, $TempDir, $TranslationTree ;151 global $Database, $TempDir, $TranslationTree, $LanguageList; 152 152 153 153 $WhereLang = ''; 154 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";155 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";156 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";154 foreach($LanguageList as $Language) 155 if($Language['Enabled'] == 1) 156 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 157 157 if($WhereLang == '') $WhereLang = 1; 158 158 else $WhereLang = '('.substr($WhereLang, 4).')'; … … 632 632 '; 633 633 $ID = $Database->SQLCommand('SELECT * FROM verseclient ORDER BY DATE DESC'); 634 while($Line = mysql_fetch_assoc($ID)) { 635 $Buffer .=' 634 while($Line = mysql_fetch_assoc($ID)) 635 { 636 $Buffer .=' 636 637 Verze: '.$Line['verse'].' 637 638 ============= -
trunk/export/download_console.php
r146 r200 3 3 session_start(); 4 4 5 $_SESSION['ExportSetting'] = 'a:8:{s:11:"users-order";s:567:",459,2,1,547,304,211,400,379,213,407,392,426,289,277,58,208,122,119,337,192,144,281,549,30,399,536,172,159,446,537,503,195,146,370,28,288,174,543,335,445,331,165,319,347,33,243,539,466,486,8,303,152,226,474,161,84,269,318,462,18,262,141,499,188,285,256,394,147,293,186,351,131,325,210,173,76,196,163,268,509,502,320,252,154,250,548,23,140,301,171,16,485,359,348,153,290,369,492,214,143,512,515,352,127,148,473,476,413,416,132,403,405,177,389,448,52,472,378,81,245,338,242,523,518,72,182,221,533,7,307,237,32,535,197,230,68,27,35,409,139,317,5,346,17,71,217,86,264,291";s:15:"users-selection";a:5:{i:0;s:3:"459";i:1;s:1:"2";i:2;s:1:"1";i:3;s:3:"547";i:4;s:3:"304";}s:6:"groups";a:13:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"4";i:4;s:1:"5";i:5;s:1:"6";i:6;s:1:"7";i:7;s:1:"8";i:8;s:1:"9";i:9;s:2:"10";i:10;s:2:"11";i:11;s:2:"12";i:12;s:2:"13";}s:10:"Diacritics";b:1;s:11:"language -cz";b:1;s:11:"language-sk";b:0;s:14:"language-other";b:0;s:6:"Export";s:5:"Addon";}';5 $_SESSION['ExportSetting'] = 'a:8:{s:11:"users-order";s:567:",459,2,1,547,304,211,400,379,213,407,392,426,289,277,58,208,122,119,337,192,144,281,549,30,399,536,172,159,446,537,503,195,146,370,28,288,174,543,335,445,331,165,319,347,33,243,539,466,486,8,303,152,226,474,161,84,269,318,462,18,262,141,499,188,285,256,394,147,293,186,351,131,325,210,173,76,196,163,268,509,502,320,252,154,250,548,23,140,301,171,16,485,359,348,153,290,369,492,214,143,512,515,352,127,148,473,476,413,416,132,403,405,177,389,448,52,472,378,81,245,338,242,523,518,72,182,221,533,7,307,237,32,535,197,230,68,27,35,409,139,317,5,346,17,71,217,86,264,291";s:15:"users-selection";a:5:{i:0;s:3:"459";i:1;s:1:"2";i:2;s:1:"1";i:3;s:3:"547";i:4;s:3:"304";}s:6:"groups";a:13:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"4";i:4;s:1:"5";i:5;s:1:"6";i:6;s:1:"7";i:7;s:1:"8";i:8;s:1:"9";i:9;s:2:"10";i:10;s:2:"11";i:11;s:2:"12";i:12;s:2:"13";}s:10:"Diacritics";b:1;s:11:"language1";b:1;s:11:"language2";b:0;s:14:"language3";b:0;s:6:"Export";s:5:"Addon";}'; 6 6 $_GET['action'] = 'result'; 7 7 $_POST['Export'] = 'DBC'; -
trunk/export/export.php
r180 r200 3 3 function ExportToMangosSQL($Setting) 4 4 { 5 global $Database, $Config, $TranslationTree ;5 global $Database, $Config, $TranslationTree, $LanguageList; 6 6 7 7 $AnoNe = array('Ne', 'Ano'); 8 8 if($_SESSION['UserID'] != '') 9 9 { 10 $DbResult = $Database->SQLCommand( "SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);11 $User = mysql_fetch_assoc($DbResult); 12 } else $User = array('user' => 'Neznámý'); 13 14 $WhereLang = ''; 15 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";16 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";17 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";10 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']); 11 $User = mysql_fetch_assoc($DbResult); 12 } else $User = array('user' => 'Neznámý'); 13 14 $WhereLang = ''; 15 foreach($LanguageList as $Language) 16 if($Language['Enabled'] == 1) 17 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 18 18 if($WhereLang == '') $WhereLang = 1; 19 19 else $WhereLang = '('.substr($WhereLang, 4).')'; … … 81 81 } 82 82 83 function ExportToAoWoWSQL($Setting) { 84 global $Database, $Config, $TranslationTree,$AoWoWconf; 85 require_once('../aowow/configs/config.php'); 83 function ExportToAoWoWSQL($Setting) 84 { 85 global $Database, $Config, $TranslationTree, $AoWoWconf, $LanguageList; 86 87 require_once('../aowow/configs/config.php'); 86 88 87 89 $Buffer = ExportToMangosSQL($Setting); 88 90 89 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)";91 $AnoNe = array('Ne', 'Ano'); 92 if($_SESSION['UserID'] != '') 93 { 94 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']); 95 $User = mysql_fetch_assoc($DbResult); 96 } else $User = array('user' => 'Neznámý'); 97 98 $WhereLang = ''; 99 foreach($LanguageList as $Language) 100 if($Language['Enabled'] == 1) 101 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 100 102 if($WhereLang == '') $WhereLang = 1; 101 103 else $WhereLang = '('.substr($WhereLang, 4).')'; … … 118 120 else $WhereUsers = '(User IN ('.$SelectedUsers.'))'; 119 121 120 // data to aowow122 // Data to aowow 121 123 122 124 $Database->SelectDatabase($AoWoWconf['mangos']['db']); 123 125 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 124 $AoWoWTables = array('aowow_resistances' => 'Id', 'aowow_spelldispeltype' => 'Id', 'aowow_skill' => 'skillID'); 125 foreach($AoWoWTables as $AoWoWTable => $IndexColum) { 126 $Buffer .= '--'.$AoWoWTable.', '; 127 $Buffer .= "\n\n"; 128 $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable; 129 $ID = $Database->SQLCommand($Query); 130 while($Line = mysql_fetch_assoc($ID)) { 126 $AoWoWTables = array('aowow_resistances' => 'Id', 'aowow_spelldispeltype' => 'Id', 'aowow_skill' => 'skillID'); 127 foreach($AoWoWTables as $AoWoWTable => $IndexColum) 128 { 129 $Buffer .= '--'.$AoWoWTable.', '; 130 $Buffer .= "\n\n"; 131 $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable; 132 $ID = $Database->SQLCommand($Query); 133 while($Line = mysql_fetch_assoc($ID)) 134 { 131 135 $Ori_text = $Line['name']; 132 136 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en, 133 137 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran 134 138 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.' … … 137 141 text = "'.addslashes($Ori_text).'" LIMIT 1')); 138 142 //echo ($Line['name'].'='.$Tran['tran']); 139 if ($Tran['tran'] <> '') {} else { 140 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT OptionText as en, 143 if ($Tran['tran'] == '') 144 { 145 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT OptionText as en, 141 146 (SELECT OptionText FROM '.$Config['Database']['Database'].'.npc_option as tabletran 142 147 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.' … … 144 149 FROM '.$Config['Database']['Database'].'.npc_option as tableen WHERE 145 150 OptionText = "'.addslashes($Ori_text).'" LIMIT 1')); 146 147 148 149 150 151 } 152 if ($Tran['tran'] <> '') 153 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name = "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 154 } 155 $Buffer .= "\n\n"; 151 156 } 152 157 if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer); … … 157 162 function ExportToXML($Setting) 158 163 { 159 global $Database, $Config, $TranslationTree ;164 global $Database, $Config, $TranslationTree, $LanguageList; 160 165 161 166 $AnoNe = array('Ne', 'Ano'); 162 167 if($_SESSION['UserID'] != '') 163 168 { 164 $DbResult = $Database->SQLCommand( "SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);165 $User = mysql_fetch_assoc($DbResult); 166 } else $User = array('user' => 'Neznámý'); 167 168 $WhereLang = ''; 169 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";170 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";171 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";169 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']); 170 $User = mysql_fetch_assoc($DbResult); 171 } else $User = array('user' => 'Neznámý'); 172 173 $WhereLang = ''; 174 foreach($LanguageList as $Language) 175 if($Language['Enabled'] == 1) 176 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 172 177 if($WhereLang == '') $WhereLang = 1; 173 178 else $WhereLang = '('.substr($WhereLang, 4).')'; … … 239 244 function ExportToDBC($Setting) 240 245 { 241 global $Database, $Config, $TranslationTree ;246 global $Database, $Config, $TranslationTree, $LanguageList; 242 247 243 248 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/dbc/'; … … 246 251 if($_SESSION['UserID'] != '') 247 252 { 248 $DbResult = $Database->SQLCommand( "SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);249 $User = mysql_fetch_assoc($DbResult); 250 } else $User = array('user' => 'Neznámý'); 251 252 $WhereLang = ''; 253 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";254 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";255 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";253 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']); 254 $User = mysql_fetch_assoc($DbResult); 255 } else $User = array('user' => 'Neznámý'); 256 257 $WhereLang = ''; 258 foreach($LanguageList as $Language) 259 if($Language['Enabled'] == 1) 260 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 256 261 if($WhereLang == '') $WhereLang = 1; 257 262 else $WhereLang = '('.substr($WhereLang, 4).')'; … … 311 316 function ExportToLua($Setting) 312 317 { 313 global $Database, $Config, $TranslationTree ;318 global $Database, $Config, $TranslationTree, $LanguageList; 314 319 315 320 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/lua/'; … … 323 328 324 329 $WhereLang = ''; 325 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";326 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";327 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";330 foreach($LanguageList as $Language) 331 if($Language['Enabled'] == 1) 332 if(isset($Setting['language'.$Language['Id']])) $WhereLang .= ' OR (Language = '.$Language['Id'].')'; 328 333 if($WhereLang == '') $WhereLang = 1; 329 334 else $WhereLang = '('.substr($WhereLang, 4).')'; -
trunk/export/index.php
r197 r200 18 18 19 19 20 $Addon_verses = scandir('files', 1);21 unset($Addon_verses[count($Addon_verses) -1]);22 unset($Addon_verses[count($Addon_verses) -1]);23 unset($Addon_verses[count($Addon_verses) -1]);24 unset($Addon_verses[count($Addon_verses) -1]);20 $Addon_verses = scandir('files', 1); 21 unset($Addon_verses[count($Addon_verses) - 1]); 22 unset($Addon_verses[count($Addon_verses) - 1]); 23 unset($Addon_verses[count($Addon_verses) - 1]); 24 unset($Addon_verses[count($Addon_verses) - 1]); 25 25 26 26 … … 52 52 } 53 53 54 if (array_key_exists('ExportSetting',$_GET)) { 54 if (array_key_exists('ExportSetting',$_GET)) 55 { 55 56 $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting']))); 56 } else { 57 } else 58 { 57 59 if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != '')) 58 60 { … … 93 95 case 'result': 94 96 if (array_key_exists('Export',$_POST)) $ExportSetting['Export'] = $_POST['Export']; 95 switch($ExportSetting['Export'])96 {97 case 'MangosSQLCompressed':98 if(function_exists('gzcompress')) 99 { 100 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/';101 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);97 switch($ExportSetting['Export']) 98 { 99 case 'MangosSQLCompressed': 100 if(function_exists('gzcompress')) 101 { 102 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 103 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 102 104 $SaveFilename = $TempDir.'CzWoW_SQL.zip'; 103 105 $SQLFilename = 'CzWoW_SQL.sql'; … … 115 117 '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'. 116 118 '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.'); 117 break;118 case 'MangosSQLDirect':119 break; 120 case 'MangosSQLDirect': 119 121 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 120 122 echo(htmlspecialchars(ExportToMangosSQL($ExportSetting))); 121 123 echo('</pre>'); 122 124 break; 123 case 'AoWoWSQLCompressed':124 if(function_exists('gzcompress')) 125 { 126 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/';127 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);125 case 'AoWoWSQLCompressed': 126 if(function_exists('gzcompress')) 127 { 128 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 129 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 128 130 $SaveFilename = $TempDir.'CzAoWoW_SQL.zip'; 129 131 $SQLFilename = 'CzAoWoW_SQL.sql'; … … 141 143 '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'. 142 144 '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.'); 143 break;144 case 'AoWoWSQLDirect':145 break; 146 case 'AoWoWSQLDirect': 145 147 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 146 148 echo(htmlspecialchars(ExportToAoWoWSQL($ExportSetting))); 147 149 echo('</pre>'); 148 150 break; 149 case 'AoWoWImport':150 require_once('../aowow/configs/config.php');151 case 'AoWoWImport': 152 require_once('../aowow/configs/config.php'); 151 153 echo('Gewneruji SQL kód '); 152 154 $AoWoWSQL = ExportToAoWoWSQL($ExportSetting); 155 echo('<strong>Hotovo</strong><br />'); 156 157 $Database->SelectDatabase($AoWoWconf['mangos']['db']); 158 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 159 160 echo('Aktualizuji aktuality '); 161 $Database->SQLCommand("UPDATE `aowow_news` SET `text_loc0` = 'Poslední aktualizace dat ".Date ("d. n. Y, H:i:s")." ', `text_loc8` = 'Poslední aktualizace dat ".Date ("d. n. Y, H:i:s")." ' WHERE `aowow_news`.`id` =3"); 162 echo('<strong>Hotovo</strong><br />'); 163 164 echo('Mažu dočasné soubory '); 165 $files = scandir('../aowow/cache/mangos'); 166 foreach($files as $file) 167 { 168 $end = substr($file, strlen($file) - 3); 169 if($end == 'aww') unlink('../aowow/cache/mangos/'.$file); 170 } 171 $files = scandir('../aowow/cache/templates/wowhead'); 172 foreach($files as $file) 173 { 174 $end = substr($file, strlen($file) - 3); 175 if ($end == 'php') unlink('../aowow/cache/templates/wowhead/'.$file); 176 } 153 177 echo ('<strong>Hotovo</strong><br />'); 154 178 155 $Database->SelectDatabase($AoWoWconf['mangos']['db']);156 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);157 158 echo('Aktualizuji aktuality ');159 $Database->SQLCommand("UPDATE `aowow_news` SET `text_loc0` = 'Poslední aktualizace dat ".Date ("d. n. Y, H:i:s")." ',160 `text_loc8` = 'Poslední aktualizace dat ".Date ("d. n. Y, H:i:s")." ' WHERE `aowow_news`.`id` =3");161 echo ('<strong>Hotovo</strong><br />');162 163 echo('Mažu dočasné soubory ');164 $files = scandir('../aowow/cache/mangos');165 foreach($files as $file) {166 $end = substr($file,strlen($file)-3);167 if ($end == 'aww') unlink('../aowow/cache/mangos/'.$file);168 }169 $files = scandir('../aowow/cache/templates/wowhead');170 foreach($files as $file) {171 $end = substr($file,strlen($file)-3);172 if ($end == 'php') unlink('../aowow/cache/templates/wowhead/'.$file);173 }174 echo ('<strong>Hotovo</strong><br />');175 176 179 echo('Importuji do AoWoW '); 177 178 179 180 if($Line <> '') $Database->SQLCommand($Line);181 echo('. ');182 }183 echo 180 $BufferArray = explode(";\n", $AoWoWSQL); 181 foreach($BufferArray as $Line) 182 { 183 if($Line <> '') $Database->SQLCommand($Line); 184 echo('. '); 185 } 186 echo('<strong>Hotovo</strong><br />'); 184 187 185 //TODO aowow_itemenchantmet, aowow_char_titles, aowow_factions, aowow_itemset, aowow_spelldispeltype, aowow_spellmechanic, aowow_spellrange, aowow_zones188 // TODO aowow_itemenchantmet, aowow_char_titles, aowow_factions, aowow_itemset, aowow_spelldispeltype, aowow_spellmechanic, aowow_spellrange, aowow_zones 186 189 187 $Database->SelectDatabase($Config['Database']['Database']);188 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);190 $Database->SelectDatabase($Config['Database']['Database']); 191 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 189 192 WriteLog('Plnění AoWoW databáze překladem', 4); 190 193 break; 191 case 'XMLCompressed':192 if(function_exists('gzcompress')) 193 { 194 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/';195 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);194 case 'XMLCompressed': 195 if(function_exists('gzcompress')) 196 { 197 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 198 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 196 199 $SaveFilename = $TempDir.'CzWoW_XML.zip'; 197 200 $SQLFilename = 'CzWoW_XML.sql'; … … 209 212 '<a href="'.$SaveFilename.'">CzWoW_SQL.zip</a><br />'. 210 213 '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.'); 211 214 break; 212 215 case 'XMLDirect': 213 216 echo('Vygenerované XML: <br /><pre class="SQLCode">');
Note:
See TracChangeset
for help on using the changeset viewer.