1 | <?php
|
---|
2 |
|
---|
3 | session_start();
|
---|
4 |
|
---|
5 | if(!array_key_exists('ExportSetting', $_SESSION))
|
---|
6 | if(array_key_exists('ExportSetting', $_COOKIE))
|
---|
7 | $_SESSION['ExportSetting'] = $_COOKIE['ExportSetting'];
|
---|
8 | else $_SESSION['ExportSetting'] = '';
|
---|
9 |
|
---|
10 | setcookie('ExportSetting', $_SESSION['ExportSetting'], time() + 60 * 60 * 24 * 100);
|
---|
11 | include('../includes/global.php');
|
---|
12 | include('../includes/zip.lib.php');
|
---|
13 | include('export.php');
|
---|
14 | include('create_addon.php');
|
---|
15 | include('../includes/dbc.php');
|
---|
16 |
|
---|
17 | ShowPage();
|
---|
18 |
|
---|
19 | function CheckBox($Name, $Checked = false, $Id = '', $Class = '')
|
---|
20 | {
|
---|
21 | if($Id) $Id = ' id="'.$Id.'"'; else $Id = '';
|
---|
22 | if($Class) $Class = ' class="'.$Class.'"'; else $Class = '';
|
---|
23 | if($Checked) $Checked = ' checked="checked"'; else $Checked = '';
|
---|
24 | return('<input type="checkbox" value="checked" name="'.$Name.'"'.$Checked.$Id.$Class.' />');
|
---|
25 | }
|
---|
26 |
|
---|
27 | function RadioButton($Name, $Value, $Checked = false, $onclick = '')
|
---|
28 | {
|
---|
29 | if($Checked) $Checked = ' checked="checked"'; else $Checked = '';
|
---|
30 | return('<input onclick="'.$onclick.'" type="radio" name="'.$Name.'" value="'.$Value.'"'.$Checked.' />');
|
---|
31 | }
|
---|
32 |
|
---|
33 | function SelectOption($Name, $Text, $Selected = false)
|
---|
34 | {
|
---|
35 | if($Selected) $Selected = ' selected="selected"'; else $Selected = '';
|
---|
36 | return('<option value="'.$Name.'"'.$Selected.'>'.$Text.'</option>');
|
---|
37 | }
|
---|
38 |
|
---|
39 | function GetVersions($out)
|
---|
40 | {
|
---|
41 | global $Database,$TranslationTree,$Config;
|
---|
42 | $result = 'null';
|
---|
43 | if ($out == 'VerseCZ') $out = 'Addon';
|
---|
44 | if (($out == 'XMLCompressed') or ($out == 'XMLDirect')) $out = 'sources';
|
---|
45 | if (($out == 'MangosSQLCompressed') or ($out == 'MangosSQLDirect') or ($out == 'AoWoWSQLCompressed') or ($out == 'AoWoWSQLDirect') or ($out == 'AoWoWImport')) $out = 'sql';
|
---|
46 | switch($out)
|
---|
47 | {
|
---|
48 | case 'Addon':
|
---|
49 | $Addon_verses = scandir('files', 1);
|
---|
50 | unset($Addon_verses[count($Addon_verses) - 1]);
|
---|
51 | unset($Addon_verses[count($Addon_verses) - 1]);
|
---|
52 | unset($Addon_verses[count($Addon_verses) - 1]);
|
---|
53 | $result = '[';
|
---|
54 | foreach($Addon_verses as $version) {
|
---|
55 | $result .= "'".$version."',";
|
---|
56 | }
|
---|
57 | $result = substr($result,0,strlen($result)-1);
|
---|
58 | $result .= "]";
|
---|
59 | break;
|
---|
60 | case 'sources':
|
---|
61 | $dirs = scandir('../source', 1);
|
---|
62 | unset($dirs[count($dirs) - 1]);
|
---|
63 | unset($dirs[count($dirs) - 1]);
|
---|
64 | unset($dirs[count($dirs) - 1]);
|
---|
65 | $result = '[';
|
---|
66 | foreach($dirs as $dir) {
|
---|
67 | $result .= "'".$dir."',";
|
---|
68 | }
|
---|
69 | $result = substr($result,0,strlen($result)-1);
|
---|
70 | $result .= "]";
|
---|
71 | break;
|
---|
72 | case 'sql':
|
---|
73 | $dirs = scandir('../source', 1);
|
---|
74 | unset($dirs[count($dirs) - 1]);
|
---|
75 | unset($dirs[count($dirs) - 1]);
|
---|
76 | unset($dirs[count($dirs) - 1]);
|
---|
77 | $result = '[';
|
---|
78 | foreach($dirs as $dir) {
|
---|
79 | $result .= "'".$dir."',";
|
---|
80 | }
|
---|
81 | $result = substr($result,0,strlen($result)-1);
|
---|
82 | $result .= "]";
|
---|
83 | break;
|
---|
84 | case 'DBC':
|
---|
85 | $sql = 'SELECT Version FROM wow_client_version WHERE DBCColumns_GameTips <> "" AND DBCColumns_Spell <> "" ';
|
---|
86 | $ID = $Database->SQLCommand($sql);
|
---|
87 | $result = '[';
|
---|
88 | while($Line = mysql_fetch_assoc($ID))
|
---|
89 | {
|
---|
90 | $result .= "'".$Line['Version']."',";
|
---|
91 | }
|
---|
92 | $result = substr($result,0,strlen($result)-1);
|
---|
93 | $result .= "]";
|
---|
94 | break;
|
---|
95 | case 'Lua':
|
---|
96 | $dirs = scandir('../source', 1);
|
---|
97 | $result = '[';
|
---|
98 | foreach($dirs as $dir) {
|
---|
99 | $ok = true;
|
---|
100 | foreach($TranslationTree as $Group)
|
---|
101 | {
|
---|
102 | if(($Group['LuaFileName'] != '') and ($Group['TablePrefix'] != ''))
|
---|
103 | {
|
---|
104 | if ((file_exists('../source/'.$dir.'/lua/'.$Group['LuaFileName'].'.lua') == false))
|
---|
105 | $ok = false;
|
---|
106 | }
|
---|
107 | }
|
---|
108 | if ($ok) $result .= "'".$dir."',";
|
---|
109 | }
|
---|
110 | $result = substr($result,0,strlen($result)-1);
|
---|
111 | $result .= "]";
|
---|
112 | break;
|
---|
113 | }
|
---|
114 | return($result);
|
---|
115 | }
|
---|
116 |
|
---|
117 | function WriteOption($str,$Selected)
|
---|
118 | {
|
---|
119 | if ($str <> 'null')
|
---|
120 | {
|
---|
121 | $str = substr($str,2,strlen($str)-4);
|
---|
122 | $versions = explode("','",$str);
|
---|
123 | foreach($versions as $version)
|
---|
124 | {
|
---|
125 | echo('<option value="'.$version.'"');
|
---|
126 | if($Selected == $version) echo(' selected="selected"'); echo('>'.$version.'</option>');
|
---|
127 | }
|
---|
128 | }
|
---|
129 | }
|
---|
130 |
|
---|
131 | function WriteSetting($ExportSetting)
|
---|
132 | {
|
---|
133 | echo('<textarea rows="10" cols="100">'.serialize($ExportSetting).'</textarea><br />'.
|
---|
134 | 'Odkaz ke stažení s vlastním nastavením: '.
|
---|
135 | '<a href="?action=output&ExportSetting='.htmlspecialchars(serialize($ExportSetting)).'">Odkaz vlastního exportu</a><br />'.
|
---|
136 | 'I když se nastavení ukládá, pro jistotu si jej můžete uložit nebo poslat příteli.');
|
---|
137 | }
|
---|
138 |
|
---|
139 | if(array_key_exists('ExportSetting', $_GET))
|
---|
140 | {
|
---|
141 | $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting'])));
|
---|
142 | } else
|
---|
143 | {
|
---|
144 | if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != ''))
|
---|
145 | {
|
---|
146 | $DbResult = $Database->SQLCommand('SELECT ExportSetting FROM user WHERE ID='.$_SESSION['UserID']);
|
---|
147 | $DbRow = mysql_fetch_assoc($DbResult);
|
---|
148 | $ExportSetting = unserialize($DbRow['ExportSetting']);
|
---|
149 |
|
---|
150 | //print_r($_POST);
|
---|
151 | } else $ExportSetting = unserialize($_SESSION['ExportSetting']);
|
---|
152 | }
|
---|
153 | if(!isset($ExportSetting['users-selection'])) $ExportSetting['users-selection'] = array();
|
---|
154 | if(!isset($ExportSetting['Diacritics'])) $ExportSetting['Diacritics'] = 1;
|
---|
155 | foreach($LanguageList as $Language)
|
---|
156 | if($Language['Enabled'] == 1)
|
---|
157 | if(!isset($ExportSetting['language'.$Language['Id']])) $ExportSetting['language'.$Language['Id']] = 1;
|
---|
158 | if(!isset($ExportSetting['users-order'])) $ExportSetting['users-order'] = '';
|
---|
159 | if(!isset($ExportSetting['Export'])) $ExportSetting['Export'] = $Addon_verses[0];
|
---|
160 | if(!isset($ExportSetting['Version'])) $ExportSetting['Version'] = $Config['Web']['GameVersion'];
|
---|
161 | if(!isset($ExportSetting['groups'])) $ExportSetting['groups'] = array();
|
---|
162 |
|
---|
163 | function CreateZipFromDir(&$Zip, $Path, $ZipPath)
|
---|
164 | {
|
---|
165 | //echo($Path.'<br />');
|
---|
166 | $FileList = scandir($Path);
|
---|
167 | foreach($FileList as $FileName)
|
---|
168 | {
|
---|
169 | if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
|
---|
170 | {
|
---|
171 | //echo($Path.$FileName.'<br />');
|
---|
172 | if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
|
---|
173 | else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName);
|
---|
174 | }
|
---|
175 | }
|
---|
176 | }
|
---|
177 |
|
---|
178 | if(!array_key_exists('action', $_GET)) $_GET['action'] = '';
|
---|
179 | switch($_GET['action'])
|
---|
180 | {
|
---|
181 | case 'result':
|
---|
182 | if (array_key_exists('Version',$_POST)) $ExportSetting['Version'] = $_POST['Version'];
|
---|
183 | if (array_key_exists('Export',$_POST)) $ExportSetting['Export'] = $_POST['Export'];
|
---|
184 | switch($ExportSetting['Export'])
|
---|
185 | {
|
---|
186 | case 'MangosSQLCompressed':
|
---|
187 | if(function_exists('gzcompress'))
|
---|
188 | {
|
---|
189 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/';
|
---|
190 | if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);
|
---|
191 | $SaveFilename = $TempDir.'CzWoW_SQL.zip';
|
---|
192 | $SQLFilename = 'CzWoW_SQL.sql';
|
---|
193 | $BufferZip = ExportToMangosSQL($ExportSetting);
|
---|
194 | $ZipFile = new zipfile();
|
---|
195 | $ZipFile->addFile($BufferZip, $SQLFilename);
|
---|
196 | $Buffer = $ZipFile->file();
|
---|
197 | file_put_contents($SaveFilename, $Buffer);
|
---|
198 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
199 | echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
|
---|
200 | 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'.
|
---|
201 | '</script>');
|
---|
202 |
|
---|
203 | echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
|
---|
204 | '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'.
|
---|
205 | '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.');
|
---|
206 | break;
|
---|
207 | case 'MangosSQLDirect':
|
---|
208 | echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">');
|
---|
209 | echo(htmlspecialchars(ExportToMangosSQL($ExportSetting)));
|
---|
210 | echo('</pre>');
|
---|
211 | break;
|
---|
212 | case 'AoWoWSQLCompressed':
|
---|
213 | if(function_exists('gzcompress'))
|
---|
214 | {
|
---|
215 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/';
|
---|
216 | if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);
|
---|
217 | $SaveFilename = $TempDir.'CzAoWoW_SQL.zip';
|
---|
218 | $SQLFilename = 'CzAoWoW_SQL.sql';
|
---|
219 | $BufferZip = ExportToAoWoWSQL($ExportSetting);
|
---|
220 | $ZipFile = new zipfile();
|
---|
221 | $ZipFile->addFile($BufferZip, $SQLFilename);
|
---|
222 | $Buffer = $ZipFile->file();
|
---|
223 | file_put_contents($SaveFilename, $Buffer);
|
---|
224 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
225 | echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
|
---|
226 | 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'.
|
---|
227 | '</script>');
|
---|
228 |
|
---|
229 | echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
|
---|
230 | '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'.
|
---|
231 | '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.');
|
---|
232 | break;
|
---|
233 | case 'AoWoWSQLDirect':
|
---|
234 | echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">');
|
---|
235 | echo(htmlspecialchars(ExportToAoWoWSQL($ExportSetting)));
|
---|
236 | echo('</pre>');
|
---|
237 | break;
|
---|
238 | case 'AoWoWImport':
|
---|
239 | require_once('../aowow/configs/config.php');
|
---|
240 | echo('<div style="font-size: xx-small;">');
|
---|
241 | echo('Gewneruji SQL kód ');
|
---|
242 | $AoWoWSQL = ExportToAoWoWSQL($ExportSetting);
|
---|
243 | echo('<strong>Hotovo</strong><br />');
|
---|
244 |
|
---|
245 | $Database->SelectDatabase($AoWoWconf['mangos']['db']);
|
---|
246 | $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
|
---|
247 |
|
---|
248 | echo('Aktualizuji aktuality ');
|
---|
249 | $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");
|
---|
250 | echo('<strong>Hotovo</strong><br />');
|
---|
251 |
|
---|
252 | echo('Mažu dočasné soubory ');
|
---|
253 | $files = scandir('../aowow/cache/mangos');
|
---|
254 | foreach($files as $file)
|
---|
255 | {
|
---|
256 | $end = substr($file, strlen($file) - 3);
|
---|
257 | if($end == 'aww') unlink('../aowow/cache/mangos/'.$file);
|
---|
258 | }
|
---|
259 | $files = scandir('../aowow/cache/templates/wowhead');
|
---|
260 | foreach($files as $file)
|
---|
261 | {
|
---|
262 | $end = substr($file, strlen($file) - 3);
|
---|
263 | if ($end == 'php') unlink('../aowow/cache/templates/wowhead/'.$file);
|
---|
264 | }
|
---|
265 | echo ('<strong>Hotovo</strong><br />');
|
---|
266 |
|
---|
267 | echo('Importuji do AoWoW ');
|
---|
268 | $BufferArray = explode(";\n", $AoWoWSQL);
|
---|
269 | foreach($BufferArray as $Line)
|
---|
270 | {
|
---|
271 | if($Line <> '') $Database->SQLCommand($Line);
|
---|
272 | echo('. ');
|
---|
273 | }
|
---|
274 | echo('<strong>Hotovo</strong><br />');
|
---|
275 |
|
---|
276 | // TODO aowow_itemenchantmet, aowow_char_titles, aowow_factions, aowow_itemset, aowow_spelldispeltype, aowow_spellmechanic, aowow_spellrange, aowow_zones
|
---|
277 |
|
---|
278 | $Database->SelectDatabase($Config['Database']['Database']);
|
---|
279 | $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
|
---|
280 | echo('</div>');
|
---|
281 | WriteLog('Plnění AoWoW databáze překladem', 4);
|
---|
282 | break;
|
---|
283 | case 'XMLCompressed':
|
---|
284 | if(function_exists('gzcompress'))
|
---|
285 | {
|
---|
286 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/';
|
---|
287 | if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);
|
---|
288 | $SaveFilename = $TempDir.'CzWoW_XML.zip';
|
---|
289 | $SQLFilename = 'CzWoW_XML.sql';
|
---|
290 | $BufferZip = ExportToXML($ExportSetting);
|
---|
291 | $ZipFile = new zipfile();
|
---|
292 | $ZipFile->addFile($BufferZip, $SQLFilename);
|
---|
293 | $Buffer = $ZipFile->file();
|
---|
294 | file_put_contents($SaveFilename, $Buffer);
|
---|
295 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
296 | echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
|
---|
297 | 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'.
|
---|
298 | '</script>');
|
---|
299 |
|
---|
300 | echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
|
---|
301 | '<a href="'.$SaveFilename.'">CzWoW_SQL.zip</a><br />'.
|
---|
302 | '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.');
|
---|
303 | break;
|
---|
304 | case 'XMLDirect':
|
---|
305 | echo('Vygenerované XML: <br /><pre class="SQLCode">');
|
---|
306 | echo(htmlspecialchars(ExportToXML($ExportSetting)));
|
---|
307 | echo('</pre>');
|
---|
308 | break;
|
---|
309 | /*case 'Server':
|
---|
310 | if(Licence(LICENCE_ADMIN))
|
---|
311 | {
|
---|
312 | $Buffer = ExportToMangosSQL($ExportSetting);
|
---|
313 | $Database->SelectDatabase($Config['Database']['DatabaseMangos']);
|
---|
314 | $BufferArray = explode("\n", $Buffer);
|
---|
315 | echo('Přenášení dat do serveru...<br />');
|
---|
316 | foreach($BufferArray as $Line)
|
---|
317 | {
|
---|
318 | $Database->SQLCommand($Line);
|
---|
319 | echo('.');
|
---|
320 | }
|
---|
321 | echo("<br />Hotovo<br />");
|
---|
322 | } else echo('Nemáte oprávnění.');
|
---|
323 | break;*/
|
---|
324 | case 'Addon':
|
---|
325 | if(function_exists('gzcompress')) {
|
---|
326 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW-'.$ExportSetting['Version'].'/';
|
---|
327 | echo('Generování addonu...'.$ExportSetting['Export'].'<br />');
|
---|
328 | MakeAddon($ExportSetting);
|
---|
329 | $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_Addon-'.$ExportSetting['Version'].'.zip';
|
---|
330 | $Zip = new zipfile();
|
---|
331 | CreateZipFromDir($Zip, $TempDir, 'CzWoW/');
|
---|
332 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml');
|
---|
333 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml');
|
---|
334 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc');
|
---|
335 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua');
|
---|
336 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml');
|
---|
337 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua');
|
---|
338 | $Buffer = $Zip->file();
|
---|
339 | file_put_contents($SaveFilename, $Buffer);
|
---|
340 | echo('Hotovo<br /><br />');
|
---|
341 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
342 | echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
|
---|
343 | 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'.
|
---|
344 | '</script>');
|
---|
345 |
|
---|
346 | echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
|
---|
347 | '<a href="'.$SaveFilename.'">CzWoW_Addon-'.$ExportSetting['Version'].'.zip</a><br />'.
|
---|
348 | '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.');
|
---|
349 | echo('<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.');
|
---|
350 | break;
|
---|
351 | case 'VerseCZ':
|
---|
352 | if(function_exists('gzcompress'))
|
---|
353 | {
|
---|
354 | $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT verse FROM verseclient ORDER BY DATE DESC LIMIT 1'));
|
---|
355 | $TempDir = $Config['Web']['TempFolder'].'Addon/CzWoW/';
|
---|
356 | echo('Generování addonu...<br />');
|
---|
357 | MakeAddon($ExportSetting);
|
---|
358 | MakeReadme($ExportSetting);
|
---|
359 |
|
---|
360 | $SaveFilename = $Config['Web']['TempFolder'].'Addon/CzWoW_'.$Line['verse'].'.zip';
|
---|
361 | $Zip = new zipfile();
|
---|
362 | CreateZipFromDir($Zip, $TempDir, 'Interface/AddOns/CzWoW/');
|
---|
363 | //addon
|
---|
364 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/OptionsFrame.xml'), 'Interface/AddOns/CzWoW/OptionsFrame.xml');
|
---|
365 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.xml'), 'Interface/AddOns/CzWoW/CzWoW.xml');
|
---|
366 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.toc'), 'Interface/AddOns/CzWoW/CzWoW.toc');
|
---|
367 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.lua'), 'Interface/AddOns/CzWoW/CzWoW.lua');
|
---|
368 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/GameMenuFrame.xml'), 'Interface/AddOns/CzWoW/GameMenuFrame.xml');
|
---|
369 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/Localization.lua'), 'Interface/AddOns/CzWoW/Localization.lua');
|
---|
370 | //fonty
|
---|
371 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/FRIZQT__.ttf'), 'Fonts/FRIZQT__.ttf');
|
---|
372 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/MORPHEUS.ttf'), 'Fonts/MORPHEUS.ttf');
|
---|
373 | $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/SKURRI.ttf'), 'Fonts/SKURRI.ttf');
|
---|
374 | //readme
|
---|
375 | $Zip->addFile(file_get_contents($Config['Web']['TempFolder'].'Addon/CzWoW/CZWOW-Readme.txt'), 'CZWOW-Readme.txt');
|
---|
376 |
|
---|
377 | $Buffer = $Zip->file();
|
---|
378 | file_put_contents($SaveFilename, $Buffer);
|
---|
379 | WriteLog('Vytvořena verze češtiny pro clienta '.$Line['verse'], 4);
|
---|
380 |
|
---|
381 | echo('Hotovo<br /><br />');
|
---|
382 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
383 |
|
---|
384 | echo('Odkaz ke stažení: '.
|
---|
385 | '<a href="'.$SaveFilename.'">'.$SaveFilename.'</a><br />');
|
---|
386 | break;
|
---|
387 | case 'DBC':
|
---|
388 | if(function_exists('gzcompress'))
|
---|
389 | {
|
---|
390 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/dbc/';
|
---|
391 | echo('Generování dbc souborů...<br />');
|
---|
392 | ExportToDBC($ExportSetting);
|
---|
393 | $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_DBC.zip';
|
---|
394 | $Zip = new zipfile();
|
---|
395 | CreateZipFromDir($Zip, $TempDir, 'DBCClientFiles/');
|
---|
396 | $Buffer = $Zip->file();
|
---|
397 | file_put_contents($SaveFilename, $Buffer);
|
---|
398 | echo('Hotovo<br /><br />');
|
---|
399 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
400 | echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
|
---|
401 | 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'.
|
---|
402 | '</script>');
|
---|
403 |
|
---|
404 | echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
|
---|
405 | '<a href="'.$SaveFilename.'">CzWoW_DBC.zip</a><br />'.
|
---|
406 | '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.');
|
---|
407 | echo('<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky Data/enUS jako patch-enUS-5.MPQ. Hru spusťte pomocí programu WoWMe.exe (WoW Model Editor Fix).');
|
---|
408 | break;
|
---|
409 | case 'Lua':
|
---|
410 | if(function_exists('gzcompress'))
|
---|
411 | {
|
---|
412 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/lua/';
|
---|
413 | echo('Generování lua souborů...<br />');
|
---|
414 | ExportToLUA($ExportSetting);
|
---|
415 | $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_Lua.zip';
|
---|
416 | $Zip = new zipfile();
|
---|
417 | CreateZipFromDir($Zip, $TempDir, '');
|
---|
418 | $Buffer = $Zip->file();
|
---|
419 | file_put_contents($SaveFilename, $Buffer);
|
---|
420 | echo('Hotovo<br /><br />');
|
---|
421 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
422 | echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
|
---|
423 | 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'.
|
---|
424 | '</script>');
|
---|
425 |
|
---|
426 | echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '.
|
---|
427 | '<a href="'.$SaveFilename.'">CzWoW_Lua.zip</a><br />'.
|
---|
428 | '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.');
|
---|
429 | echo('<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky Data/enUS jako patch-enUS-5.MPQ. Hru spusťte pomocí programu WoWMe.exe (WoW Model Editor Fix).');
|
---|
430 | break;
|
---|
431 | }
|
---|
432 | //statistika výstupu
|
---|
433 | if ($ExportSetting['Export'] <> 'AoWoWSQLDirect' and $ExportSetting['Export'] <> 'XMLDirect' and $ExportSetting['Export'] <> 'AoWoWImport' and $ExportSetting['Export'] <> 'MangosSQLDirect') {
|
---|
434 | echo '<br /><br />';
|
---|
435 | foreach($TranslationTree as $Group)
|
---|
436 | if($Group['TablePrefix'] != '' and (in_array($Group['Id'], $ExportSetting['groups'])))
|
---|
437 | echo('<div class="state-image"><img alt="'.$Group['TablePrefix'].'" src="../img_statistic.php?group='.$Group['Id'].'&user='.$_SESSION['UserID'].'" title="statistika překladů '.$Group['Name'].'"/></div>');
|
---|
438 | }
|
---|
439 |
|
---|
440 | WriteLog('Generování SQL výstupu: Typ exportu: <strong>'.$ExportSetting['Export'].'</strong>, Diakritika: <strong>'.$ExportSetting['Diacritics'].'</strong>', 2);
|
---|
441 | break;
|
---|
442 | case 'output':
|
---|
443 | if(array_key_exists('groups', $_POST)) $ExportSetting['groups'] = $_POST['groups'];
|
---|
444 | $ExportSetting['Diacritics'] = array_key_exists('Diacritics', $_POST);
|
---|
445 | foreach($LanguageList as $Language)
|
---|
446 | if($Language['Enabled'] == 1)
|
---|
447 | $ExportSetting['language'.$Language['Id']] = array_key_exists('language'.$Language['Id'], $_POST);
|
---|
448 |
|
---|
449 | if(array_key_exists('ExportSetting', $_GET))
|
---|
450 | $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting'])));
|
---|
451 |
|
---|
452 | echo('<strong>Krok 3. - Typ výstupu</strong><br /><br />');
|
---|
453 | echo('<form action="?action=result" method="post"><div>'.
|
---|
454 | '<table><tr><td>'.
|
---|
455 | '<fieldset><legend>Forma výstupu</legend>'.
|
---|
456 | RadioButton('Export', 'MangosSQLDirect', $ExportSetting['Export'] == 'MangosSQLDirect', 'UpdateVersion('.GetVersions('MangosSQLDirect').',\''.$ExportSetting['Version'].'\')').'MaNGOS SQL - přímo zobrazit<br />'.
|
---|
457 | RadioButton('Export', 'MangosSQLCompressed', $ExportSetting['Export'] == 'MangosSQLCompressed', 'UpdateVersion('.GetVersions('MangosSQLCompressed').',\''.$ExportSetting['Version'].'\')').'MaNGOS SQL - komprimovaný soubor<br />'.
|
---|
458 | RadioButton('Export', 'AoWoWSQLDirect', $ExportSetting['Export'] == 'AoWoWSQLDirect', 'UpdateVersion('.GetVersions('AoWoWSQLDirect').',\''.$ExportSetting['Version'].'\')').'AoWoW SQL - přímo zobrazit<br />'.
|
---|
459 | RadioButton('Export', 'AoWoWSQLCompressed', $ExportSetting['Export'] == 'AoWoWSQLCompressed', 'UpdateVersion('.GetVersions('AoWoWSQLCompressed').',\''.$ExportSetting['Version'].'\')').'AoWoW SQL - komprimovaný soubor<br />'.
|
---|
460 | RadioButton('Export', 'XMLDirect', $ExportSetting['Export'] == 'XMLDirect', 'UpdateVersion('.GetVersions('XMLDirect').',\''.$ExportSetting['Version'].'\')').'XML - přímo zobrazit<br />'.
|
---|
461 | RadioButton('Export', 'XMLCompressed', $ExportSetting['Export'] == 'XMLCompressed', 'UpdateVersion('.GetVersions('XMLCompressed').',\''.$ExportSetting['Version'].'\')').'XML - komprimovaný soubor<br />'.
|
---|
462 | RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon', 'UpdateVersion('.GetVersions('Addon').',\''.$ExportSetting['Version'].'\')').'Addon - komprimovaný soubor<br />'.
|
---|
463 | RadioButton('Export', 'Lua', $ExportSetting['Export'] == 'Lua', 'UpdateVersion('.GetVersions('Lua').',\''.$ExportSetting['Version'].'\')').'Lua skripty - komprimovaný soubor<br />');
|
---|
464 | if(Licence(LICENCE_ADMIN)) {
|
---|
465 | echo(RadioButton('Export', 'DBC', $ExportSetting['Export'] == 'DBC', 'UpdateVersion('.GetVersions('DBC').',\''.$ExportSetting['Version'].'\')').'DBC - komprimovaný soubor (pouze admin)<br />');
|
---|
466 | echo(RadioButton('Export', 'AoWoWImport', $ExportSetting['Export'] == 'AoWoWImport', 'UpdateVersion('.GetVersions('AoWoWImport').',\''.$ExportSetting['Version'].'\')').'Importovat do AoWoW (pouze admin)<br />');
|
---|
467 | echo(RadioButton('Export', 'VerseCZ', $ExportSetting['Export'] == 'VerseCZ', 'UpdateVersion('.GetVersions('VerseCZ').',\''.$ExportSetting['Version'].'\')').'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 />');
|
---|
468 | }
|
---|
469 | //echo('
|
---|
470 | echo('</fieldset>');
|
---|
471 | echo('<fieldset><legend>Dostupné verze výstupu</legend>');
|
---|
472 | echo('<select id="Version" size="5" name="Version">');
|
---|
473 | WriteOption(GetVersions($ExportSetting['Export']),$ExportSetting['Version']);
|
---|
474 | echo('</select></fieldset>');
|
---|
475 | echo('</td>');
|
---|
476 | echo('<td class="Description">Zvolte způsob, jakým mají být získána výstupní data. V případě přímého zobrazení může být do vašeho prohlížeče přenášeno vysoké množství dat, což může vést k jeho přetížení.<br /><br />Poté zvolte pro kterou verzi hry mají být data získána. Pokud verze není přesná zvolte nejbližší.<br /><br />Addon je potřeba nakopírovat do složky klienta Interface/AddOns a ve hře lze zpřístupnit jeho možnosti pomocí příkazu /czwow.<br />');
|
---|
477 | echo('</td></tr></table>');
|
---|
478 | echo('<br /><input type="submit" value="Dokončit" />');
|
---|
479 | echo('</div></form><br />');
|
---|
480 | echo('<fieldset><legend>Nastavení exportu pro zálohování</legend>');
|
---|
481 | WriteSetting($ExportSetting);
|
---|
482 | echo ('</fieldset>');
|
---|
483 | break;
|
---|
484 | case 'parameters':
|
---|
485 | $ExportSetting['users-order'] = $_POST['users-order'];
|
---|
486 | $ExportSetting['users-selection'] = array();
|
---|
487 | $UsersList = explode(',', $_POST['users-order']);
|
---|
488 | foreach($UsersList as $Index => $Item)
|
---|
489 | {
|
---|
490 | if(array_key_exists('user_'.$Item, $_POST)) $ExportSetting['users-selection'][] = $Item;
|
---|
491 | }
|
---|
492 | //if(array_key_exists('users', $_POST)) $ExportSetting['users'] = $_POST['users'];
|
---|
493 | echo('<strong>Krok 2. - Volba parametrů</strong><br /><br />');
|
---|
494 | echo('<form action="?action=output" method="post"><div>');
|
---|
495 | echo('<table><tr><td>');
|
---|
496 | echo('<fieldset><legend>Jazyk</legend>'.
|
---|
497 | CheckBox('Diacritics', $ExportSetting['Diacritics'] == 'checked').'Včetně diakritiky<br /><br />');
|
---|
498 | //echo('<input type="checkbox" name="Use" checked="true">Přidat výchovýběr databáze.<br />');
|
---|
499 |
|
---|
500 | foreach($LanguageList as $Language)
|
---|
501 | if($Language['Enabled'] == 1)
|
---|
502 | echo(CheckBox('language'.$Language['Id'], $ExportSetting['language'.$Language['Id']] == 'checked').$Language['Name'].'<br />');
|
---|
503 |
|
---|
504 | echo('</fieldset><br /></td><td class="Description">Pro správné zobrazení českých znaků ve hře je nutné používat upravené <a href="download/ceske_fonty_do_wow.zip">počeštěné fonty</a>.<br />Vyberte jaké jazyky se mají uvažovat při exportu.</td></tr><tr><td><fieldset><legend>Skupiny textů</legend>');
|
---|
505 | echo('<select name="groups[]" size="15" multiple="multiple">');
|
---|
506 | foreach($TranslationTree as $Group)
|
---|
507 | if($Group['TablePrefix'] != '')
|
---|
508 | echo(SelectOption($Group['Id'], $Group['Name'].' ('.$Group['TablePrefix'].')', in_array($Group['Id'], $ExportSetting['groups'])));
|
---|
509 |
|
---|
510 | echo('</select></fieldset><br /></td><td class="Description">Vyberte skupiny textů, z kterých bude sestaven export. Přidržením CTRL nebo SHIFT můžete provádět výběr více položek.</td></tr></table><input type="submit" value="Pokračovat" />');
|
---|
511 | echo('</div></form>');
|
---|
512 | break;
|
---|
513 | default:
|
---|
514 | echo('<strong>Krok 1. - Výběr překladatelů</strong><br /><br />');
|
---|
515 | echo('<script type="text/javascript" src="'.$Config['Web']['BaseURL'].'style/jquery.js"></script>
|
---|
516 | <script type="text/javascript" src="'.$Config['Web']['BaseURL'].'style/jquery-ui.js"></script>
|
---|
517 | <script type="text/javascript">
|
---|
518 | $(document).ready(function()
|
---|
519 | {
|
---|
520 | $("#users-table").sortable({ items: "tr", sort: SortComplete });
|
---|
521 | $("#users-order").val($("#users-table").sortable(\'toArray\'));
|
---|
522 | });
|
---|
523 |
|
---|
524 | function SortComplete()
|
---|
525 | {
|
---|
526 | $("#users-order").val($("#users-table").sortable(\'toArray\'));
|
---|
527 | }
|
---|
528 | </script>');
|
---|
529 | echo('<form id="ListUser" action="?action=parameters" method="post"><div>');
|
---|
530 |
|
---|
531 | $Columns = '';
|
---|
532 | $Joins = '';
|
---|
533 |
|
---|
534 | //řezení podle odkazu
|
---|
535 | if(array_key_exists('Order', $_GET)) $order = $_GET['Order'];
|
---|
536 | else $order = 'T.TranslatedCount';
|
---|
537 | if(array_key_exists('Desc', $_GET)) $desc = $_GET['Desc'];
|
---|
538 | else $desc = '';
|
---|
539 | if($desc == '') $desc = 'DESC'; else $desc = '';
|
---|
540 |
|
---|
541 | foreach($TranslationTree as $Group)
|
---|
542 | if($Group['TablePrefix'] != '')
|
---|
543 | {
|
---|
544 | $Columns .= 'COALESCE(T'.$Group['Id'].'.Count, 0) + ';
|
---|
545 | $Joins .= ' LEFT JOIN (SELECT User, COUNT(User) as Count FROM `'.$Group['TablePrefix'].'` WHERE (Complete = 1) AND (Language <> 0) GROUP BY User) as T'.$Group['Id'].' ON user.ID=T'.$Group['Id'].'.User';
|
---|
546 | }
|
---|
547 | $Query = 'SELECT T.ID, T.TranslatedCount, T.user, T.XP FROM (SELECT user.ID, user.user, user.XP, ('.substr($Columns, 0, -3).') as TranslatedCount FROM `user`'.$Joins.') AS T WHERE T.TranslatedCount > 0 ORDER BY '.$order.' '.$desc;
|
---|
548 | $ID = $Database->SQLCommand($Query);
|
---|
549 |
|
---|
550 | // Rebuild user order list
|
---|
551 | $Users = array();
|
---|
552 | while($Line = mysql_fetch_assoc($ID)) {
|
---|
553 | $Users[$Line['ID']] = $Line;
|
---|
554 | $UsersOrder[] = $Line['ID'];
|
---|
555 | }
|
---|
556 | //řazení podle posledního použitého
|
---|
557 | if(!array_key_exists('Order', $_GET)) {
|
---|
558 | $UsersOrder = explode(',', $ExportSetting['users-order']);
|
---|
559 | foreach($Users as $User)
|
---|
560 | if(!in_array($User['ID'], $UsersOrder)) $UsersOrder[] = $User['ID'];
|
---|
561 | foreach($UsersOrder as $Index => $UserId)
|
---|
562 | if(!array_key_exists($UserId, $Users)) unset($UsersOrder[$Index]);
|
---|
563 | }
|
---|
564 | $ExportSetting['users-order'] = implode(',', $UsersOrder);
|
---|
565 |
|
---|
566 | if(array_key_exists('team', $_GET)) {
|
---|
567 | $ExportSetting['users-selection'] = array();
|
---|
568 | $Query = 'SELECT ID FROM user WHERE team = '.$_GET['team'];
|
---|
569 | $ID = $Database->SQLCommand($Query);
|
---|
570 | while($LineTeam = mysql_fetch_assoc($ID))
|
---|
571 | $ExportSetting['users-selection'][] = $LineTeam['ID'];
|
---|
572 | }
|
---|
573 |
|
---|
574 |
|
---|
575 | echo(' <input type="submit" value="Pokračovat" /> <span onclick="CheckAll()">'.CheckBox('CheckAll', False, 'CheckAll').' Zatrhnout vše</span> ');
|
---|
576 |
|
---|
577 | echo('<table><tr><td>'.
|
---|
578 | '<table class="BaseTable" id="users-table"><tr>
|
---|
579 | <th><a href="?Order=user&Desc='.$desc.'">Jméno</a></th>
|
---|
580 | <th><a href="?Order=T.TranslatedCount&Desc='.$desc.'" title="Počet přeložených textů">Překladů</a></th>
|
---|
581 | <th><a href="?Order=XP&Desc='.$desc.'">Úroveň</a></th>
|
---|
582 | <th></th></tr>');
|
---|
583 | //print_r($UsersOrder);
|
---|
584 | // Show ordered user list
|
---|
585 | foreach($UsersOrder as $UserId)
|
---|
586 | echo('<tr id="'.$UserId.'">
|
---|
587 | <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$UserId.'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$Users[$UserId]['user'].'</a></td>
|
---|
588 | <td>'.$Users[$UserId]['TranslatedCount'].'</td>
|
---|
589 | <td><img src="'.$Config['Web']['TempFolder'].$Users[$UserId]['user'].'/level.png" alt="Úroveň uživatele" /></td>
|
---|
590 | <td>'.CheckBox('user_'.$UserId, in_array($UserId, $ExportSetting['users-selection']), '', 'CheckBox').'</td></tr>');
|
---|
591 | echo('</table></td><td class="Description">Zvolte ze seznamu uživatele, od kterých chcete načítat překlady a upravte jejich pořadí, takže od uživatelů výše budou brány překlady přednostně.<br />'.
|
---|
592 | 'Řádky v tabulce můžete přesouvat metodou uchop a táhni.'.
|
---|
593 | '</td></tr></table>'.
|
---|
594 | '<div><input name="users-order" id="users-order" size="100" type="hidden" /><br />');
|
---|
595 | echo('<input type="submit" value="Pokračovat" /></div>');
|
---|
596 | echo('</div></form>');
|
---|
597 | break;
|
---|
598 | }
|
---|
599 |
|
---|
600 | if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != ''))
|
---|
601 | $Database->SQLCommand('UPDATE user SET ExportSetting = "'.addslashes(serialize($ExportSetting)).'" WHERE ID='.$_SESSION['UserID']);
|
---|
602 | else $_SESSION['ExportSetting'] = serialize($ExportSetting);
|
---|
603 |
|
---|
604 | //print_r($ExportSetting);
|
---|
605 |
|
---|
606 | ShowFooter();
|
---|
607 | ?>
|
---|