BLOB streaming documentation
[phpmyadmin/crack.git] / libraries / display_export.lib.php
blob0d7956df8caaf1b6e8750722803fed2ed35a402b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
14 require_once './libraries/Table.class.php';
16 // Get relations & co. status
17 require_once './libraries/relation.lib.php';
18 $cfgRelation = PMA_getRelationsParam();
21 require_once './libraries/file_listing.php';
22 require_once './libraries/plugin_interface.lib.php';
24 function PMA_exportCheckboxCheck($str) {
25 if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
26 echo ' checked="checked"';
30 function PMA_exportIsActive($what, $val) {
31 if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
32 echo ' checked="checked"';
36 /* Scan for plugins */
37 $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
39 /* Fail if we didn't find any plugin */
40 if (empty($export_list)) {
41 PMA_Message::error('strCanNotLoadExportPlugins')->display();
42 require './libraries/footer.inc.php';
46 <form method="post" action="export.php" name="dump">
48 <?php
49 if ($export_type == 'server') {
50 echo PMA_generate_common_hidden_inputs('', '', 1);
51 } elseif ($export_type == 'database') {
52 echo PMA_generate_common_hidden_inputs($db, '', 1);
53 } else {
54 echo PMA_generate_common_hidden_inputs($db, $table, 1);
57 // just to keep this value for possible next display of this form after saving on server
58 if (isset($single_table)) {
59 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
62 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
64 if (! empty($sql_query)) {
65 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
67 echo PMA_pluginGetJavascript($export_list);
69 <fieldset id="fieldsetexport">
70 <legend><?php echo $export_page_title; ?></legend>
72 <?php
74 * this table is needed to fix rendering in Opera <= 9 and Safari <= 2
75 * normaly just the two fieldset would have float: left
78 <table><tr><td>
80 <div id="div_container_exportoptions">
81 <fieldset id="exportoptions">
82 <legend><?php echo $strExport; ?></legend>
84 <?php if (! empty($multi_values)) { ?>
85 <div class="formelementrow">
86 <?php echo $multi_values; ?>
87 </div>
88 <?php } ?>
89 <?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
90 </fieldset>
91 </div>
93 </td><td>
95 <div id="div_container_sub_exportoptions">
96 <?php echo PMA_pluginGetOptions('Export', $export_list); ?>
97 </div>
98 </td></tr></table>
100 <script type="text/javascript">
101 //<![CDATA[
102 init_options();
103 //]]>
104 </script>
106 <?php if (strlen($table) && ! isset($num_tables)) { ?>
107 <div class="formelementrow">
108 <?php
109 echo sprintf($strDumpXRows,
110 '<input type="text" name="limit_to" size="5" value="'
111 . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table, TRUE))
112 . '" onfocus="this.select()" />',
113 '<input type="text" name="limit_from" value="0" size="5"'
114 .' onfocus="this.select()" /> ');
116 </div>
117 <?php } ?>
118 </fieldset>
120 <fieldset>
121 <legend>
122 <input type="checkbox" name="asfile" value="sendit"
123 id="checkbox_dump_asfile" <?php PMA_exportCheckboxCheck('asfile'); ?> />
124 <label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
125 </legend>
127 <?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
128 <input type="checkbox" name="onserver" value="saveit"
129 id="checkbox_dump_onserver"
130 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
131 <?php PMA_exportCheckboxCheck('onserver'); ?> />
132 <label for="checkbox_dump_onserver">
133 <?php echo sprintf($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
134 </label>,<br />
135 <input type="checkbox" name="onserverover" value="saveitover"
136 id="checkbox_dump_onserverover"
137 onclick="document.getElementById('checkbox_dump_onserver').checked = true;
138 document.getElementById('checkbox_dump_asfile').checked = true;"
139 <?php PMA_exportCheckboxCheck('onserver_overwrite'); ?> />
140 <label for="checkbox_dump_onserverover">
141 <?php echo $strOverwriteExisting; ?></label>
142 <br />
143 <?php } ?>
145 <label for="filename_template">
146 <?php
147 echo $strFileNameTemplate;
149 $trans = new PMA_Message;
150 $trans->addMessage('__SERVER__/');
151 $trans->addString('strFileNameTemplateDescriptionServer');
152 if ($export_type == 'database' || $export_type == 'table') {
153 $trans->addMessage('__DB__/');
154 $trans->addString('strFileNameTemplateDescriptionDatabase');
155 if ($export_type == 'table') {
156 $trans->addMessage('__TABLE__/');
157 $trans->addString('strFileNameTemplateDescriptionTable');
161 $message = new PMA_Message('strFileNameTemplateDescription');
162 $message->addParam('<a href="http://php.net/strftime" target="documentation" title="'
163 . $strDocu . '">', false);
164 $message->addParam('</a>', false);
165 $message->addParam($trans);
167 echo PMA_showHint($message);
169 </label>:
170 <input type="text" name="filename_template" id="filename_template"
171 <?php
172 echo ' value="';
173 if ($export_type == 'database') {
174 if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
175 echo $_COOKIE['pma_db_filename_template'];
176 } else {
177 echo $GLOBALS['cfg']['Export']['file_template_database'];
179 } elseif ($export_type == 'table') {
180 if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
181 echo $_COOKIE['pma_table_filename_template'];
182 } else {
183 echo $GLOBALS['cfg']['Export']['file_template_table'];
185 } else {
186 if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
187 echo $_COOKIE['pma_server_filename_template'];
188 } else {
189 echo $GLOBALS['cfg']['Export']['file_template_server'];
192 echo '" />';
196 <input type="checkbox" name="remember_template"
197 id="checkbox_remember_template"
198 <?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
199 <label for="checkbox_remember_template">
200 <?php echo $strFileNameTemplateRemember; ?></label>
203 <div class="formelementrow">
204 <?php
205 // charset of file
206 if ($cfg['AllowAnywhereRecoding']) {
207 echo ' <label for="select_charset_of_file">'
208 . $strCharsetOfFile . '</label>' . "\n";
210 reset($cfg['AvailableCharsets']);
211 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
212 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
213 echo '<option value="' . $temp_charset . '"';
214 if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
215 || $temp_charset == $cfg['Export']['charset']) {
216 echo ' selected="selected"';
218 echo '>' . $temp_charset . '</option>';
219 } // end foreach
220 echo '</select>';
221 } // end if
223 </div>
225 <?php
226 // zip, gzip and bzip2 encode features
227 $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
228 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
229 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
231 if ($is_zip || $is_gzip || $is_bzip) { ?>
232 <div class="formelementrow">
233 <?php echo $strCompression; ?>:
234 <input type="radio" name="compression" value="none"
235 id="radio_compression_none"
236 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
237 <?php PMA_exportIsActive('compression', 'none'); ?> />
238 <label for="radio_compression_none"><?php echo $strNone; ?></label>
239 <?php
240 if ($is_zip) { ?>
241 <input type="radio" name="compression" value="zip"
242 id="radio_compression_zip"
243 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
244 <?php PMA_exportIsActive('compression', 'zip'); ?> />
245 <label for="radio_compression_zip"><?php echo $strZip; ?></label>
246 <?php } if ($is_gzip) { ?>
247 <input type="radio" name="compression" value="gzip"
248 id="radio_compression_gzip"
249 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
250 <?php PMA_exportIsActive('compression', 'gzip'); ?> />
251 <label for="radio_compression_gzip"><?php echo $strGzip; ?></label>
252 <?php } if ($is_bzip) { ?>
253 <input type="radio" name="compression" value="bzip"
254 id="radio_compression_bzip"
255 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
256 <?php PMA_exportIsActive('compression', 'bzip2'); ?> />
257 <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
258 <?php } ?>
259 </div>
260 <?php } else { ?>
261 <input type="hidden" name="compression" value="none" />
262 <?php } ?>
263 </fieldset>
265 <?php if (function_exists('PMA_set_enc_form')) { ?>
266 <!-- Encoding setting form appended by Y.Kawada -->
267 <!-- Japanese encoding setting -->
268 <fieldset>
269 <?php echo PMA_set_enc_form(' '); ?>
270 </fieldset>
271 <?php } ?>
273 <fieldset class="tblFooters">
274 <?php PMA_externalBug($GLOBALS['strSQLCompatibility'], 'mysql', '50027', '14515'); ?>
275 <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
276 </fieldset>
277 </form>