1 | <?php
|
---|
2 |
|
---|
3 | include('includes/global.php');
|
---|
4 |
|
---|
5 | include 'includes/zip.lib.php';
|
---|
6 |
|
---|
7 | function WithOutDiacritical($teststring){
|
---|
8 | $teststring=StrTr($teststring, "áäèïéìëíòóöø¹»úùüý¾ÁÄÈÏÉÌËÍÒÓÖØ©«ÚÙÜÝ®", "aacdeeeinoorstuuuyzAACDEEEINOORSTUUUYZ");
|
---|
9 |
|
---|
10 | return $teststring;
|
---|
11 | }
|
---|
12 |
|
---|
13 | if (array_key_exists('Type', $_POST)) {
|
---|
14 | $Diacritical = @$_POST['Diacritical'];
|
---|
15 | if (array_key_exists('CZ', $_POST)) $CZ = $_POST['CZ'];
|
---|
16 | if (array_key_exists('SK', $_POST)) $SK = $_POST['SK'];
|
---|
17 | if (array_key_exists('OtherLanguage', $_POST)) $OtherLanguage = $_POST['OtherLanguage'];
|
---|
18 | if (array_key_exists('Use', $_POST)) $Use = $_POST['Use'];
|
---|
19 | $Type = $_POST['Type'];
|
---|
20 | $Export = $_POST['Export'];
|
---|
21 | $AddTitle = $_POST['AddTitle'];
|
---|
22 | $NumberVote = $_POST['NumberVote'];
|
---|
23 | $Vote = $_POST['Vote'];
|
---|
24 | $users = @$_POST['users'];
|
---|
25 |
|
---|
26 | $BufferHeader = '
|
---|
27 | /* File made by maron web aplikacion
|
---|
28 | =================================
|
---|
29 |
|
---|
30 | WebProject: http://wow.zdechov.net/quests/
|
---|
31 | email: maron2@cetrum.cz
|
---|
32 | DateExport: '.date("m.d.y H:i").'
|
---|
33 | Znaková sada: '.$Config['Database']['Charset'].' / '.$Config['Web']['Charset'].'
|
---|
34 | Diakritika: '.$Diacritical.'
|
---|
35 | Poèet nutných hlasù: '.$NumberVote.'
|
---|
36 | Známka vy¾¹í jak: '.$Vote.'
|
---|
37 | Tabluky: Quests: '.@$_POST['Quests'].' , NPC_text: '.@$_POST['NPC_texts'].' */
|
---|
38 |
|
---|
39 | ';
|
---|
40 |
|
---|
41 | if (isset($Use)) $BufferHeader .= 'USE `mangos`;
|
---|
42 |
|
---|
43 | ';
|
---|
44 |
|
---|
45 |
|
---|
46 | $WhereLang = '';
|
---|
47 | if (isset($CZ)) $WhereLang .= " Language = '1'";
|
---|
48 | if (isset($SK)) {
|
---|
49 | if ($WhereLang <> '')
|
---|
50 | $WhereLang .= " OR Language = '2'";
|
---|
51 | else
|
---|
52 | $WhereLang .= "Language = '2'";
|
---|
53 | }
|
---|
54 | if (isset($OtherLanguage)) {
|
---|
55 | if ($WhereLang <> '')
|
---|
56 | $WhereLang .= " OR Language = '3'";
|
---|
57 | else
|
---|
58 | $WhereLang .= "Language = '3'";
|
---|
59 | }
|
---|
60 |
|
---|
61 | $WhereUsers = '';
|
---|
62 |
|
---|
63 | for ($i=0; $i<Count($users); $i++):
|
---|
64 | if ($WhereUsers <> '')
|
---|
65 | $WhereUsers .= " OR User = ".$users[$i];
|
---|
66 | else
|
---|
67 | $WhereUsers .= " User = ".$users[$i];
|
---|
68 | endfor;
|
---|
69 |
|
---|
70 |
|
---|
71 | if (array_key_exists('Quests', $_POST)) {
|
---|
72 | $AddDetails = @$_POST['AddDetails'];
|
---|
73 | $AddObjectives = @$_POST['AddObjectives'];
|
---|
74 | $AddOfferRewardText = @$_POST['AddOfferRewardText'];
|
---|
75 | $AddRequestItemsText = @$_POST['AddRequestItemsText'];
|
---|
76 | $AddEndText = @$_POST['AddEndText'];
|
---|
77 | $AddObjectiveText1 = @$_POST['AddObjectiveText1'];
|
---|
78 | $AddObjectiveText2 = @$_POST['AddObjectiveText2'];
|
---|
79 | $AddObjectiveText3 = @$_POST['AddObjectiveText3'];
|
---|
80 | $AddObjectiveText4 = @$_POST['AddObjectiveText4'];
|
---|
81 |
|
---|
82 | if (($Export == 'Mangos') and (Licence(2) == False)) {die('Nemáte oprávnìní');}
|
---|
83 |
|
---|
84 |
|
---|
85 | $sql = "SELECT * FROM quests.quests WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'";
|
---|
86 |
|
---|
87 | if ($WhereLang <> '') $sql .= " AND ($WhereLang)";
|
---|
88 | if ($WhereUsers <> '') $sql .= "AND ($WhereUsers)";
|
---|
89 |
|
---|
90 | // echo $sql;
|
---|
91 |
|
---|
92 | $i = 0;
|
---|
93 | $ID = $Database->SQLCommand($sql." ORDER BY vote");
|
---|
94 | while ($Line = mysql_fetch_array($ID)) {
|
---|
95 | $entry = $Line['entry'];
|
---|
96 | $Title = mysql_escape_string($Line['Title']);
|
---|
97 | $Details = mysql_escape_string($Line['Details']);
|
---|
98 | $Objectives = mysql_escape_string($Line['Objectives']);
|
---|
99 | $OfferRewardText = mysql_escape_string($Line['OfferRewardText']);
|
---|
100 | $RequestItemsText = mysql_escape_string($Line['RequestItemsText']);
|
---|
101 | $EndText = mysql_escape_string($Line['EndText']);
|
---|
102 | $ObjectiveText1 = mysql_escape_string($Line['ObjectiveText1']);
|
---|
103 | $ObjectiveText2 = mysql_escape_string($Line['ObjectiveText2']);
|
---|
104 | $ObjectiveText3 = mysql_escape_string($Line['ObjectiveText3']);
|
---|
105 | $ObjectiveText4 = mysql_escape_string($Line['ObjectiveText4']);
|
---|
106 |
|
---|
107 | if ($AddTitle == 'Translate')
|
---|
108 | $Title = "Title = '$Title'";
|
---|
109 | else {
|
---|
110 | $IDtitle = $Database->SQLCommand("SELECT Title FROM quests.quests WHERE entry = '$entry' AND Language = '0'");
|
---|
111 | $Linetitle = mysql_fetch_array($IDtitle);
|
---|
112 |
|
---|
113 | if ($AddTitle == 'EN') {
|
---|
114 | $Title = "Title = '".$Linetitle['Title']."'";
|
---|
115 | }
|
---|
116 | if ($AddTitle == 'Both') {
|
---|
117 | $Title = "Title = '$Title (".$Linetitle['Title'].")'";
|
---|
118 | }
|
---|
119 | }
|
---|
120 | if (($Details <> '') and ($AddDetails))
|
---|
121 | $Details = "Details = '$Details', ";
|
---|
122 | else $Details = '';
|
---|
123 | if ($Objectives <> '' and $AddObjectives)
|
---|
124 | $Objectives = 'Objectives = \''.$Objectives.'\', ';
|
---|
125 | else $Objectives= '';
|
---|
126 | if ($OfferRewardText <> '' and $AddOfferRewardText)
|
---|
127 | $OfferRewardText = 'OfferRewardText = \''.$OfferRewardText.'\', ';
|
---|
128 | else $OfferRewardText = '';
|
---|
129 | if ($RequestItemsText <> '' and $AddRequestItemsText)
|
---|
130 | $RequestItemsText = 'RequestItemsText = \''.$RequestItemsText.'\', ';
|
---|
131 | else $RequestItemsText = '';
|
---|
132 | // echo $entry.$Details;
|
---|
133 | // UPDATE SET Title = '', Title = '$Title', Details = '$Details', Objectives = '$Objectives', OfferRewardText = '$OfferRewardText', RequestItemsText = '$RequestItemsText' WHWRE entry = '$entry'
|
---|
134 | $sql = "UPDATE quest_template SET $Details $Objectives $OfferRewardText $RequestItemsText $Title WHERE entry = '$entry';";
|
---|
135 | if ($Diacritical == False) $sql=WithOutDiacritical($sql);
|
---|
136 |
|
---|
137 | $Buffer[$i] = $sql;
|
---|
138 | ++$i;
|
---|
139 |
|
---|
140 | }
|
---|
141 | }
|
---|
142 |
|
---|
143 | //export npc_textù
|
---|
144 | $x = 0;
|
---|
145 | if (array_key_exists('NPC_texts', $_POST)) {
|
---|
146 |
|
---|
147 | $sql = "SELECT * FROM npc_text WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'";
|
---|
148 |
|
---|
149 | if ($WhereLang <> '') $sql .= " AND ($WhereLang)";
|
---|
150 | if ($WhereUsers <> '') $sql .= "AND ($WhereUsers)";
|
---|
151 |
|
---|
152 | $ID = $Database->SQLCommand($sql." ORDER BY vote");
|
---|
153 | while ($Line = mysql_fetch_array($ID)) {
|
---|
154 |
|
---|
155 | $sql = "UPDATE npc_text SET ";
|
---|
156 | for ($i=0; $i<count($npc_text); ++$i) {
|
---|
157 | if ($Line[$npc_text[$i]] <> '')
|
---|
158 | $sql .= " ".$npc_text[$i]." = '".mysql_escape_string($Line[$npc_text[$i]])."' , ";
|
---|
159 | }
|
---|
160 | $sql .= " ID = '".$Line['entry']."' WHERE ID = ".$Line['entry'].";";
|
---|
161 |
|
---|
162 | if ($Diacritical == False) $sql=WithOutDiacritical($sql);
|
---|
163 |
|
---|
164 | $BufferNPC[$x] = $sql;
|
---|
165 | ++$x;
|
---|
166 | }
|
---|
167 | }
|
---|
168 |
|
---|
169 | //vypisování
|
---|
170 | if ($Export == 'Display') {
|
---|
171 | echo 'Vygenerovaný SQL kód: <br /><textarea rows="30" cols="100">';
|
---|
172 | echo $BufferHeader;
|
---|
173 | for ($i=0; $i<count(@$Buffer); ++$i) {
|
---|
174 | echo $Buffer[$i].'
|
---|
175 | ';
|
---|
176 | }
|
---|
177 | for ($i=0; $i<count(@$BufferNPC); ++$i) {
|
---|
178 | echo $BufferNPC[$i].'
|
---|
179 | ';
|
---|
180 | }
|
---|
181 | echo '</textarea>';
|
---|
182 | }
|
---|
183 |
|
---|
184 | if ($Export == 'Mangos') {
|
---|
185 | $Database->SelectDatabase($Config['Database']['DatabaseMangos']);
|
---|
186 | for ($i=0; $i<count(@$Buffer); ++$i) {
|
---|
187 | $Database->SQLCommand($Buffer[$i]);
|
---|
188 | }
|
---|
189 | for ($i=0; $i<count(@$BufferNPC); ++$i) {
|
---|
190 | $Database->SQLCommand($BufferNPC[$i]);
|
---|
191 | }
|
---|
192 | }
|
---|
193 |
|
---|
194 | if ($Export == 'Zip') {
|
---|
195 | if (function_exists('gzcompress')) {
|
---|
196 | $save_filename = 'SqlTranslate.zip';
|
---|
197 | $SQL_filename = 'SqlTranslate.sql';
|
---|
198 |
|
---|
199 | $BufferZip = $BufferHeader;
|
---|
200 | for ($i=0; $i<count(@$Buffer); ++$i) {
|
---|
201 | $BufferZip .= $Buffer[$i].'
|
---|
202 | ';
|
---|
203 | }
|
---|
204 | for ($i=0; $i<count(@$BufferNPC); ++$i) {
|
---|
205 | $BufferZip .= $BufferNPC[$i].'
|
---|
206 | ';
|
---|
207 | }
|
---|
208 |
|
---|
209 | // echo $BufferZip.'<br><br><br>';
|
---|
210 |
|
---|
211 | $zipfile = new zipfile();
|
---|
212 | $zipfile -> addFile($BufferZip, $SQL_filename);
|
---|
213 | $Buffer = $zipfile -> file();
|
---|
214 |
|
---|
215 | // echo $Buffer.'<br><br><br>';
|
---|
216 |
|
---|
217 | $file_handle = fopen($save_filename, 'w');
|
---|
218 | $write_result = fwrite($file_handle, $Buffer);
|
---|
219 | fclose($file_handle);
|
---|
220 | header("Location: ".$save_filename);
|
---|
221 |
|
---|
222 | } else echo 'Vyskitla se chyba!';
|
---|
223 | echo 'Pokud nezaèalo stahování soubor by mìlo jít stáhnout z tohoto odkazu:<br>
|
---|
224 | <a href="'.$save_filename.'">'.$save_filename.'</a>';
|
---|
225 | }
|
---|
226 |
|
---|
227 | WriteLog('Sta¾ení SQL souboru: Typ Exportu: <b>'.$Export.'</b> Diakritika: <b>'.$Diacritical.'</b>
|
---|
228 | Poèet nutných hlasù: <b>'.$NumberVote.'</b> Známka vy¾¹í jak: <b>'.$Vote.'</b>', 2);
|
---|
229 |
|
---|
230 |
|
---|
231 | } else {
|
---|
232 | ?>
|
---|
233 | <div style=" border: 2px dotted black; padding: 0px 5px 5px 5px;">
|
---|
234 | <big><b><i>Pro server:</i></b></big><br>
|
---|
235 | <b>Export Questù:</b><br />
|
---|
236 | <form action="export.php" method="POST">
|
---|
237 | <table border="1" cellpadding="1" cellspacing="0">
|
---|
238 | <tr><th>Sql</th><th>Filtr</th><th>Jazyk</th><th>Texty</th></tr>
|
---|
239 | <tr><td>
|
---|
240 | <input type="radio" name="Export" value="Zip" checked="true"> Exportovat do zip<br>
|
---|
241 | <input type="radio" name="Export" value="Display"> Export zobrazit<br>
|
---|
242 | <?php
|
---|
243 | if (Licence(2)) {
|
---|
244 | echo '<input type="radio" name="Export" value="Mangos"> Import na server (Admin only)<br>';
|
---|
245 | }
|
---|
246 | ?>
|
---|
247 | <br />
|
---|
248 | <input type="radio" name="Type" value="Insert"> Insert (zatím nefunguje)<br>
|
---|
249 | <input type="radio" name="Type" value="Update" checked="true"> Update <br>
|
---|
250 | <br />
|
---|
251 | <input type="checkbox" name="Use" checked="true"> Pøidat Use mangos <br>
|
---|
252 | <br />
|
---|
253 | <input type="checkbox" name="Quests" checked="true"> Questy <br>
|
---|
254 | <input type="checkbox" name="NPC_texts" checked="true"> NPC_texts <br>
|
---|
255 | </td><td>
|
---|
256 | <input type="text" name="NumberVote" value="3" size="1"> Poèet nutných hlasù <br>
|
---|
257 | <input type="text" name="Vote" value="4" size="1"> Známka lep¹í nebo stejná jak <br>
|
---|
258 | <br />
|
---|
259 | <select name="users[]" size="10" multiple>
|
---|
260 |
|
---|
261 | <?php
|
---|
262 | // multiple="multiple"
|
---|
263 | $ID = $Database->SQLCommand("SELECT user,ID FROM `user` WHERE
|
---|
264 | EXISTS(SELECT 1 FROM quests WHERE user = user.ID) OR
|
---|
265 | EXISTS(SELECT 1 FROM npc_text WHERE user = user.ID) ORDER BY user");
|
---|
266 | while ($Line = mysql_fetch_array($ID))
|
---|
267 | echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>';
|
---|
268 |
|
---|
269 | ?>
|
---|
270 |
|
---|
271 | </select><br> Exportovat pouze od tìchto u¾ivatalù<br>
|
---|
272 | Vybrat více u¾ivatelù mù¾ete pomocí CTRL+click
|
---|
273 |
|
---|
274 |
|
---|
275 | </td><td>
|
---|
276 | <input type="checkbox" name="Diacritical" checked="true"> Vèetnì diakritiky <br>
|
---|
277 | <br />
|
---|
278 | <input type="checkbox" name="CZ" checked="true"> Èeský pøeklad <br>
|
---|
279 | <input type="checkbox" name="SK" checked="true"> Slovenský pøeklad <br>
|
---|
280 | <input type="checkbox" name="OtherLanguage"> Jiné jazyky <br>
|
---|
281 | </td><td>
|
---|
282 | <b>Title questu:</b><br>
|
---|
283 | <input type="radio" name="AddTitle" value="Translate" checked="true"> Pøelo¾ený název <br>
|
---|
284 | <input type="radio" name="AddTitle" value="EN"> Pùvodní název <br>
|
---|
285 | <input type="radio" name="AddTitle" value="Both"> Pøelo¾ený název (Anglický název) <br>
|
---|
286 | <br>
|
---|
287 | <?php
|
---|
288 | foreach($Texts as $Index => $TextItem)
|
---|
289 | echo '<input type="checkbox" name="Add'.$TextItem[0].'" checked="true"> '.$TextItem[0].'<br>';
|
---|
290 | ?>
|
---|
291 | </td></tr>
|
---|
292 | </table>
|
---|
293 | <br><input type="submit" value="Generovat SQL soubor pøekladu"> (Sta¾ení)
|
---|
294 | </form>
|
---|
295 | <b>Èeský pøeklad MaNGOS Minimanageru:</b><br />
|
---|
296 | - Stránky projektu: <a href="http://sourceforge.net/projects/mmfpm/">http://sourceforge.net/projects/mmfpm/</a><br>
|
---|
297 | - Pøeklad: <a href="http://wow.zdechov.net/minimanager/lang/csCZ.zip">Èe¹tina do minimanageru</a><br>
|
---|
298 | - Diskusní forum pro pøípadné pøipomínky k pøekladu: <a href="http://wow.zdechov.net/forum/viewtopic.php?p=5533">Forum</a>
|
---|
299 |
|
---|
300 | </div>
|
---|
301 | <br>
|
---|
302 | <div style=" border: 2px dotted black; padding: 0px 5px 5px 5px;">
|
---|
303 | <big><b><i>Pro klinta:</i></b></big><br>
|
---|
304 | <b>Diakritika ve World of Warcraft</b><br />
|
---|
305 | - Pro správné zobrazování diakrity ve høe si stáhnìte <a href="http://wow.zdechov.net/download_soubory/ceske_fonty_do_wow.zip">Èeské fonty do hry</a><br />
|
---|
306 | </div>
|
---|
307 | <?php
|
---|
308 | }
|
---|
309 |
|
---|
310 |
|
---|
311 | ShowFooter();
|
---|
312 | ?>
|
---|