Another mechanism against stupid people who use the translator list as a list of...
[phpmyadmin/crack.git] / tbl_properties_export.php3
blob5e04132da36cc0039c02345bf8d3016ef070b69f
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Gets tables informations and displays top links
8 */
9 require('./tbl_properties_common.php3');
10 $url_query .= '&amp;goto=tbl_properties_export.php3&amp;back=tbl_properties_export.php3';
11 require('./tbl_properties_table_info.php3');
14 <!-- Dump of a table -->
15 <h2>
16 <?php echo $strViewDump . "\n"; ?>
17 </h2>
19 <?php
20 if (isset($sql_query)) {
21 // I don't want the LIMIT clause, so I use the analyzer
22 // to reconstruct the query with only some parts
23 // because the LIMIT clause may come from us (sql.php3, sql_limit_to_append
24 // or may come from the user.
25 // Then, the limits set in the form will be added.
26 // TODO: do we need some other parts here, like PROCEDURE or FOR UPDATE?
28 $parsed_sql = PMA_SQP_parse($sql_query);
29 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
30 $sql_query = 'SELECT ' . $analyzed_sql[0]['select_expr_clause'];
32 if (!empty($analyzed_sql[0]['from_clause'])) {
33 $sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
35 if (!empty($analyzed_sql[0]['where_clause'])) {
36 $sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause'];
38 if (!empty($analyzed_sql[0]['group_by_clause'])) {
39 $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause'];
41 if (!empty($analyzed_sql[0]['having_clause'])) {
42 $sql_query .= ' HAVING ' . $analyzed_sql[0]['having_clause'];
44 if (!empty($analyzed_sql[0]['order_by_clause'])) {
45 $sql_query .= ' ORDER BY ' . $analyzed_sql[0]['order_by_clause'];
48 // TODO: can we avoid reparsing the query here?
49 PMA_showMessage($GLOBALS['strSQLQuery']);
52 <form method="post" action="tbl_dump.php3" name="tbl_dump">
53 <?php
54 echo ' ' . PMA_generate_common_hidden_inputs($db, $table);
55 if (isset($sql_query)) {
56 echo ' <input type="hidden" name="sql_query" value="' . urlencode($sql_query) . '" />';
60 <script type="text/javascript">
61 <!--
62 /* DHTML functions */
63 d=document;l=(d.layers)?1:0;op=navigator.userAgent.toLowerCase().indexOf('opera')!=-1;
64 /* Get Element */ function gE(e,f){if(l){f=(f)?f:self;V=f.document.layers;if(V[e])return V[e];for(W=0;i<W.length;W++)return(gE(e,V[W]));}if(d.all)return d.all[e];return d.getElementById(e);}
65 /* Show Element */ function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}
66 /* Hide Element */ function hE(e){if(l)e.visibility='hide';else e.style.visibility='hidden';}
67 /* Set Position X */ function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x+'px';}
68 /* Get Position X */ function gX(e){if(l)return e.left;else if(op)return e.style.pixelLeft;else return parseInt(e.style.left);}
69 /* Set Position Y */ function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y+'px';}
70 /* Get Position Y */ function gY(e){if(l)return e.top;else if(op)return e.style.pixelTop;else return parseInt(e.style.top);}
71 /* Set Width */ function sW(e,w){if(l)e.clip.width=w;else if(op)e.style.pixelWidth=w;else e.style.width=w;}
72 /* Get Width */ function gW(e){if(l)return e.clip.width;else if(op)return e.style.pixelWidth;else return parseInt(e.style.width);}
73 /* Set Height */ function sH(e,h){if(l)e.clip.height=h;else if(op)e.style.pixelHeight=h;else e.style.height=h;}
74 /* Get Height */ function gH(e){if(l)return e.clip.height;else if(op)return e.style.pixelHeight;else return parseInt(e.style.height);}
75 /* Write h to e */ function wH(e,h){if(l){Y=e.document;Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;}
77 function hide_them_all() {
78 gE("csv_options").style.display = 'none';
79 gE("sql_options").style.display = 'none';
80 gE("none_options").style.display = 'none';
82 //-->
83 </script>
85 <table cellpadding="5" border="0" cellspacing="0" align="center">
86 <tr>
88 <!-- Formats to export to -->
89 <td nowrap="nowrap" valign="top">
90 <fieldset style="height: 220px;">
91 <legend><?php echo $strExport; ?></legend>
92 <br>
93 <!-- SQL -->
94 <input type="radio" name="what" value="sql" id="radio_dump_sql" checked="checked" onclick="if(this.checked) { hide_them_all(); gE('sql_options').style.display = 'block'; }; return true" />
95 <label for="radio_dump_sql"><?php echo $strSQL; ?></label>
96 <br /><br />
98 <!-- LaTeX table -->
99 <input type="radio" name="what" value="latex" id="radio_dump_latex" onclick="if(this.checked) { hide_them_all(); gE('none_options').style.display = 'block'; }; return true" />
100 <label for="radio_dump_latex"><?php echo $strLaTeX; ?></label>
101 <!-- for now we have only one environment supported -->
102 <?php
104 <select name="environment">
105 <option value="longtable" selected><?php echo $strLaTeXMultipageTable; ?></option>
106 <option value="sideways"><?php echo $strLaTeXSidewaysTable; ?></option>
107 <option value="table"><?php echo $strLaTeXStandardTable; ?></option>
108 </select>
111 <input type="hidden" name="environment" value="longtable" />
112 <br /><br />
114 <!-- Excel CSV -->
115 <input type="radio" name="what" value="excel" id="radio_dump_excel" onclick="if(this.checked) { hide_them_all(); gE('none_options').style.display = 'block'; }; return true" />
116 <label for="radio_dump_excel"><?php echo $strStrucExcelCSV; ?></label>
117 <br /><br />
118 <!-- General CSV -->
119 <input type="radio" name="what" value="csv" id="radio_dump_csv" onclick="if(this.checked) { hide_them_all(); gE('csv_options').style.display = 'block'; }; return true" />
120 <label for="radio_dump_csv"><?php echo $strStrucCSV;?></label>
121 <br /><br />
122 <!-- XML -->
123 <input type="radio" name="what" value="xml" id="radio_dump_xml" onclick="if(this.checked) { hide_them_all(); gE('none_options').style.display = 'block'; }; return true" />
124 <label for="radio_dump_xml"><?php echo $strXML; ?></label>&nbsp;&nbsp;
125 </fieldset>
126 </td>
127 <!-- Options -->
128 <td valign="top" id="options_td" width="400">
129 <fieldset id="sql_options">
130 <legend><?php echo $strSQLOptions; ?> (<a href="./Documentation.html#faqexport" target="documentation"><?php echo $strDocu; ?></a>)</legend>
132 <!-- For structure -->
133 <fieldset>
134 <legend>
135 <input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked="checked" onclick="if(!this.checked && !gE('checkbox_sql_data').checked) return false; else return true;" />
136 <label for="checkbox_sql_structure"><?php echo $strStructure; ?></label><br />
137 </legend>
138 <input type="checkbox" name="drop" value="1" id="checkbox_dump_drop" />
139 <label for="checkbox_dump_drop"><?php echo $strStrucDrop; ?></label><br />
140 <?php
141 // Add backquotes checkbox
142 if (PMA_MYSQL_INT_VERSION >= 32306) {
144 <input type="checkbox" name="use_backquotes" value="1" id="checkbox_dump_use_backquotes" checked="checked" />
145 <label for="checkbox_dump_use_backquotes"><?php echo $strUseBackquotes; ?></label><br />
146 <?php
147 } // end backquotes feature
148 echo "\n";
150 // garvin: whether to show column comments
151 require('./libraries/relation.lib.php3');
152 $cfgRelation = PMA_getRelationsParam();
154 if ($cfgRelation['commwork']) {
156 <input type="checkbox" name="use_comments" value="1" id="checkbox_dump_use_comments" />
157 <label for="checkbox_dump_use_comments"><?php echo $strDumpComments; ?></label><br />
158 <?php
159 } // end dump comments
160 echo "\n";
162 </fieldset>
164 <!-- For data -->
165 <fieldset>
166 <legend>
167 <input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked="checked" onclick="if(!this.checked && !gE('checkbox_sql_structure').checked) return false; else return true;" />
168 <label for="checkbox_sql_data"><?php echo $strData; ?></label><br />
169 </legend>
170 <input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" />
171 <label for="checkbox_dump_showcolumns"><?php echo $strCompleteInserts; ?></label><br />
172 <input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" />
173 <label for="checkbox_dump_extended_ins"><?php echo $strExtendedInserts; ?></label><br />
174 </fieldset>
175 </fieldset>
176 <fieldset id="csv_options">
177 <legend><?php echo $strCSVOptions; ?></legend>
178 <table border="0" cellspacing="1" cellpadding="0">
179 <tr>
180 <td>
181 <?php echo $strFieldsTerminatedBy; ?>&nbsp;
182 </td>
183 <td>
184 <input type="text" name="separator" size="2" value=";" class="textfield" />
185 </td>
186 </tr>
187 <tr>
188 <td>
189 <?php echo $strFieldsEnclosedBy; ?>&nbsp;
190 </td>
191 <td>
192 <input type="text" name="enclosed" size="2" value="&quot;" class="textfield" />
193 </td>
194 </tr>
195 <tr>
196 <td>
197 <?php echo $strFieldsEscapedBy; ?>&nbsp;
198 </td>
199 <td>
200 <input type="text" name="escaped" size="2" value="\" class="textfield" />
201 </td>
202 </tr>
203 <tr>
204 <td>
205 <?php echo $strFieldsTerminatedBy; ?>&nbsp;
206 </td>
207 <td>
208 <input type="text" name="add_character" size="2" value="<?php echo ((PMA_whichCrlf() == "\n") ? '\n' : '\r\n'); ?>" class="textfield" />
209 </td>
210 </tr>
211 </table>
212 <input type="checkbox" name="showcsvnames" value="yes" id="checkbox_dump_showcsvnames" />
213 <label for="checkbox_dump_showcsvnames"><?php echo $strPutColNames; ?></label>
214 </fieldset>
215 <fieldset id="none_options">
216 <legend><?php echo $strNoOptions; ?></legend>
217 </fieldset>
218 <script type="text/javascript">
219 <!--
220 gE('csv_options').style.display = 'none';
221 gE('sql_options').style.display = 'none';
222 gE('none_options').style.display = 'none';
223 if (document.getElementById('radio_dump_sql').checked) {
224 gE('sql_options').style.display = 'block';
225 } else if (document.getElementById('radio_dump_csv').checked) {
226 gE('csv_options').style.display = 'block';
227 } else {
228 gE('none_options').style.display = 'block';
230 //-->
231 </script>
232 </td>
233 </tr>
235 <tr>
236 <td colspan="2" align="center">
237 <fieldset>
238 <?php echo sprintf($strDumpXRows , '<input type="text" name="limit_to" size="5" value="' . (isset($unlim_num_rows)?$unlim_num_rows: PMA_countRecords($db, $table, TRUE)) . '" class="textfield" style="vertical-align: middle" onfocus="this.select()" />' , '<input type="text" name="limit_from" value="0" size="5" class="textfield" style="vertical-align: middle" onfocus="this.select()" />') . "\n"; ?>
239 </fieldset>
240 </td>
241 </tr>
243 <tr>
244 <!-- Export to screen or to file -->
245 <td colspan="2">
246 <fieldset>
247 <legend>
248 <input type="checkbox" name="asfile" value="sendit" id="checkbox_dump_asfile" />
249 <label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
250 </legend>
252 <?php
253 // charset of file
254 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
255 echo '<label for="select_charset_of_file">' . $strCharsetOfFile . '</label>';
256 echo "\n";
258 $temp_charset = reset($cfg['AvailableCharsets']);
259 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">' . "\n"
260 . ' <option value="' . $temp_charset . '"';
261 if ($temp_charset == $charset) {
262 echo ' selected="selected"';
264 echo '>' . $temp_charset . '</option>' . "\n";
265 while ($temp_charset = next($cfg['AvailableCharsets'])) {
266 echo ' <option value="' . $temp_charset . '"';
267 if ($temp_charset == $charset) {
268 echo ' selected="selected"';
270 echo '>' . $temp_charset . '</option>' . "\n";
271 } // end while
272 echo ' </select>';
273 } // end if
274 echo "\n";
277 <fieldset>
278 <legend><?php echo $strCompression; ?></legend>
280 <input type="radio" name="compression" value="none" id="radio_compression_none" checked="checked" />
281 <label for="radio_compression_none"><?php echo $strNone; ?></label>&nbsp;
283 <?php
285 // zip, gzip and bzip2 encode features
286 if (PMA_PHP_INT_VERSION >= 40004) {
287 $is_zip = (isset($cfg['ZipDump']) && $cfg['ZipDump'] && @function_exists('gzcompress'));
288 $is_gzip = (isset($cfg['GZipDump']) && $cfg['GZipDump'] && @function_exists('gzencode'));
289 $is_bzip = (isset($cfg['BZipDump']) && $cfg['BZipDump'] && @function_exists('bzcompress'));
290 if ($is_zip || $is_gzip || $is_bzip) {
291 if ($is_zip) {
293 <input type="radio" name="compression" value="zip" id="radio_compression_zip" />
294 <label for="radio_compression_zip"><?php echo $strZip; ?></label><?php echo (($is_gzip || $is_bzip) ? '&nbsp;' : ''); ?>
295 <?php
297 if ($is_gzip) {
298 echo "\n"
300 <input type="radio" name="compression" value="gzip" id="radio_compression_gzip" />
301 <label for="radio_compression_gzip"><?php echo $strGzip; ?></label><?php echo ($is_bzip ? '&nbsp;' : ''); ?>
302 <?php
304 if ($is_bzip) {
305 echo "\n"
307 <input type="radio" name="compression" value="bzip" id="radio_compression_bzip" />
308 <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
309 <?php
313 echo "\n";
315 </fieldset>
316 </td>
317 </tr>
319 <?php
320 // Encoding setting form appended by Y.Kawada
321 if (function_exists('PMA_set_enc_form')) {
323 <tr>
324 <!-- Japanese encoding setting -->
325 <td colspan="2" align="center">
326 <?php
327 echo PMA_set_enc_form(' ');
329 </td>
330 </tr>
331 <?php
333 echo "\n";
335 <tr>
336 <td colspan="2" align="center">
337 <input type="submit" value="<?php echo $strGo; ?>" />
338 </td>
339 </tr>
340 </table>
341 </form>
343 <?php
345 * Displays the footer
347 require('./footer.inc.php3');