Changeset 251 for quests/export.php
- Timestamp:
- Jan 20, 2008, 8:44:37 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quests/export.php
r249 r251 23 23 $Vote = $_POST['Vote']; 24 24 $users = @$_POST['users']; 25 26 27 $AddDetails = @$_POST['AddDetails']; 28 $AddObjectives = @$_POST['AddObjectives']; 29 $AddOfferRewardText = @$_POST['AddOfferRewardText']; 30 $AddRequestItemsText = @$_POST['AddRequestItemsText']; 31 $AddEndText = @$_POST['AddEndText']; 32 $AddObjectiveText1 = @$_POST['AddObjectiveText1']; 33 $AddObjectiveText2 = @$_POST['AddObjectiveText2']; 34 $AddObjectiveText3 = @$_POST['AddObjectiveText3']; 35 $AddObjectiveText4 = @$_POST['AddObjectiveText4']; 36 37 if (($Export == 'Mangos') and (Licence(2) == False)) {die('Nemáte oprávnìní');} 38 39 40 $Buffer = ' 25 26 $BufferHeader = ' 41 27 /* File made by maron web aplikacion 42 28 ================================= … … 44 30 WebProject: http://wow.zdechov.net/quests/ 45 31 email: maron2@cetrum.cz 46 DateExport: '.date("m.d.y H:i").' */ 32 DateExport: '.date("m.d.y H:i").' 33 Diakritika: '.$Diacritical.' 34 Poèet nutných hlasù: '.$NumberVote.' 35 Známka vy¾¹í jak: '.$Vote.' 36 Tabluky: Quests: '.@$_POST['Quests'].' , NPC_text: '.@$_POST['NPC_texts'].' */ 47 37 48 38 '; 49 39 50 if (isset($Use)) $Buffer .= 'USE `mangos`;40 if (isset($Use)) $BufferHeader .= 'USE `mangos`; 51 41 52 42 '; 53 43 54 $sql = "SELECT * FROM quests.quests WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'"; 44 55 45 $WhereLang = ''; 56 46 if (isset($CZ)) $WhereLang .= " Language = '1'"; … … 76 66 $WhereUsers .= " User = ".$users[$i]; 77 67 endfor; 68 69 70 if (array_key_exists('Quests', $_POST)) { 71 $AddDetails = @$_POST['AddDetails']; 72 $AddObjectives = @$_POST['AddObjectives']; 73 $AddOfferRewardText = @$_POST['AddOfferRewardText']; 74 $AddRequestItemsText = @$_POST['AddRequestItemsText']; 75 $AddEndText = @$_POST['AddEndText']; 76 $AddObjectiveText1 = @$_POST['AddObjectiveText1']; 77 $AddObjectiveText2 = @$_POST['AddObjectiveText2']; 78 $AddObjectiveText3 = @$_POST['AddObjectiveText3']; 79 $AddObjectiveText4 = @$_POST['AddObjectiveText4']; 80 81 if (($Export == 'Mangos') and (Licence(2) == False)) {die('Nemáte oprávnìní');} 82 83 84 $sql = "SELECT * FROM quests.quests WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'"; 78 85 79 86 if ($WhereLang <> '') $sql .= " AND ($WhereLang)"; … … 82 89 // echo $sql; 83 90 84 91 $i = 0; 85 92 $ID = $Database->SQLCommand($sql." ORDER BY vote"); 86 93 while ($Line = mysql_fetch_array($ID)) { … … 127 134 if ($Diacritical == False) $sql=WithOutDiacritical($sql); 128 135 129 if ($Export == 'Mangos') { 130 $Database->SelectDatabase($Config['Database']['DatabaseMangos']); 131 $Database->SQLCommand($sql); 132 } 133 $Buffer .= $sql." 134 "; 135 136 $Buffer[$i] = $sql; 137 ++$i; 138 139 } 136 140 } 137 141 142 //export npc_textù 143 $x = 0; 144 if (array_key_exists('NPC_texts', $_POST)) { 145 146 $sql = "SELECT * FROM NPC_text WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'"; 147 148 if ($WhereLang <> '') $sql .= " AND ($WhereLang)"; 149 if ($WhereUsers <> '') $sql .= "AND ($WhereUsers)"; 150 151 $ID = $Database->SQLCommand($sql." ORDER BY vote"); 152 while ($Line = mysql_fetch_array($ID)) { 153 154 $sql = "UPDATE npc_text SET "; 155 for ($i=0; $i<count($npc_text); ++$i) { 156 if ($Line[$npc_text[$i]] <> '') 157 $sql .= " ".$npc_text[$i]." = '".$Line[$npc_text[$i]]."' , "; 158 } 159 $sql .= " ID = '".$Line['entry']."' WHERE ID = ".$Line['entry']; 160 if ($Diacritical == False) $sql=WithOutDiacritical($sql); 161 162 $BufferNPC[$x] = $sql; 163 ++$x; 164 } 165 } 166 167 //vypisování 138 168 if ($Export == 'Display') { 139 169 echo 'Vygenerovaný SQL kód: <br /><textarea rows="30" cols="100">'; 140 echo $Buffer; 170 echo $BufferHeader; 171 for ($i=0; $i<count(@$Buffer); ++$i) { 172 echo $Buffer[$i].' 173 '; 174 } 175 for ($i=0; $i<count(@$BufferNPC); ++$i) { 176 echo $BufferNPC[$i].' 177 '; 178 } 141 179 echo '</textarea>'; 142 180 } 143 if ($Export == 'Mangos') { 144 echo 'Hotovo'; 145 } 181 182 if ($Export == 'Mangos') { 183 $Database->SelectDatabase($Config['Database']['DatabaseMangos']); 184 for ($i=0; $i<count(@$Buffer); ++$i) { 185 $Database->SQLCommand($Buffer[$i]); 186 } 187 for ($i=0; $i<count(@$BufferNPC); ++$i) { 188 $Database->SQLCommand($BufferNPC[$i]); 189 } 190 } 146 191 147 192 if ($Export == 'Zip') { … … 149 194 $save_filename = 'SqlTranslate.zip'; 150 195 $SQL_filename = 'SqlTranslate.sql'; 151 196 197 $BufferZip = $BufferHeader; 198 for ($i=0; $i<count(@$Buffer); ++$i) { 199 $BufferZip .= $Buffer[$i]; 200 } 201 for ($i=0; $i<count(@$BufferNPC); ++$i) { 202 $BufferZip .= $BufferNPC[$i]; 203 } 204 205 $Buffer = $BufferZip; 206 152 207 $zipfile = new zipfile(); 153 208 $zipfile -> addFile($Buffer, $SQL_filename); … … 188 243 <input type="checkbox" name="Use" checked="true"> Pøidat Use mangos <br> 189 244 <br /> 245 <input type="checkbox" name="Quests" checked="true"> Questy <br> 246 <input type="checkbox" name="NPC_texts" checked="true"> NPC_texts <br> 190 247 </td><td> 191 248 <input type="text" name="NumberVote" value="3" size="1"> Poèet nutných hlasù <br> … … 197 254 // multiple="multiple" 198 255 $ID = $Database->SQLCommand("SELECT user,ID FROM `user` WHERE 199 EXISTS(SELECT 1 FROM quests WHERE user = user.ID) ORDER BY user"); 256 EXISTS(SELECT 1 FROM quests WHERE user = user.ID) OR 257 EXISTS(SELECT 1 FROM npc_text WHERE user = user.ID) ORDER BY user"); 200 258 while ($Line = mysql_fetch_array($ID)) 201 259 echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>'; … … 225 283 </td></tr> 226 284 </table> 227 <br><input type="submit" value="Generovat SQL soubor Questù"> (Sta¾ení)285 <br><input type="submit" value="Generovat SQL soubor pøekladu"> (Sta¾ení) 228 286 </form> 229 287 <b>Èeský pøeklad MaNGOS Minimanageru:</b><br />
Note:
See TracChangeset
for help on using the changeset viewer.