2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 if (! defined('PHPMYADMIN')) {
11 // Get relations & co. status
12 $cfgRelation = PMA_getRelationsParam();
15 require_once './libraries/file_listing.php';
16 require_once './libraries/plugin_interface.lib.php';
18 function PMA_exportCheckboxCheck($str)
20 if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
21 echo ' checked="checked"';
25 function PMA_exportIsActive($what, $val)
27 if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
28 echo ' checked="checked"';
32 /* Scan for plugins */
33 $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
35 /* Fail if we didn't find any plugin */
36 if (empty($export_list)) {
37 PMA_Message
::error( __('Could not load export plugins, please check your installation!'))->display();
38 include './libraries/footer.inc.php';
42 <form method
="post" action
="export.php" name
="dump">
45 if ($export_type == 'server') {
46 echo PMA_generate_common_hidden_inputs('', '', 1);
47 } elseif ($export_type == 'database') {
48 echo PMA_generate_common_hidden_inputs($db, '', 1);
50 echo PMA_generate_common_hidden_inputs($db, $table, 1);
53 // just to keep this value for possible next display of this form after saving on server
54 if (isset($single_table)) {
55 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
58 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
60 // If the export method was not set, the default is quick
61 if (isset($_GET['export_method'])) {
62 $cfg['Export']['method'] = $_GET['export_method'];
63 } elseif (! isset($cfg['Export']['method'])) {
64 $cfg['Export']['method'] = 'quick';
66 // The export method (quick, custom or custom-no-form)
67 echo '<input type="hidden" name="export_method" value="' . htmlspecialchars($cfg['Export']['method']) . '" />';
70 if (isset($_GET['sql_query'])) {
71 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
72 } elseif (! empty($sql_query)) {
73 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
77 <div
class="exportoptions" id
="header">
79 <?php
echo PMA_getImage('b_export.png', __('Export')); ?
>
81 if ($export_type == 'server') {
82 echo __('Exporting databases from the current server');
83 } elseif ($export_type == 'database') {
84 printf(__('Exporting tables from "%s" database'), htmlspecialchars($db));
86 printf(__('Exporting rows from "%s" table'), htmlspecialchars($table));
91 <div
class="exportoptions" id
="quick_or_custom">
92 <h3
><?php
echo __('Export Method:'); ?
></h3
>
95 <?php
echo '<input type="radio" name="quick_or_custom" value="quick" id="radio_quick_export"';
96 if (isset($_GET['quick_or_custom'])) {
97 $export_method = $_GET['quick_or_custom'];
98 if ($export_method == 'custom' ||
$export_method == 'custom_no_form') {
101 echo ' checked="checked" />';
103 } elseif ($cfg['Export']['method'] == 'custom' ||
$cfg['Export']['method'] == 'custom-no-form') {
106 echo ' checked="checked" />';
108 echo '<label for ="radio_quick_export">' . __('Quick - display only the minimal options') . '</label>'; ?
>
111 <?php
echo '<input type="radio" name="quick_or_custom" value="custom" id="radio_custom_export"';
112 if (isset($_GET['quick_or_custom'])) {
113 $export_method = $_GET['quick_or_custom'];
114 if ($export_method == 'custom' ||
$export_method == 'custom_no_form') {
115 echo ' checked="checked" />';
119 } elseif ($cfg['Export']['method'] == 'custom' ||
$cfg['Export']['method'] == 'custom-no-form') {
120 echo ' checked="checked" />';
124 echo '<label for="radio_custom_export">' . __('Custom - display all possible options') . '</label>';?
>
129 <div
class="exportoptions" id
="databases_and_tables">
131 if ($export_type == 'server') {
132 echo '<h3>' . __('Database(s):') . '</h3>';
133 } else if ($export_type == 'database') {
134 echo '<h3>' . __('Table(s):') . '</h3>';
136 if (! empty($multi_values)) {
142 <?php
if (strlen($table) && ! isset($num_tables) && ! PMA_Table
::isMerge($db, $table)) { ?
>
143 <div
class="exportoptions" id
="rows">
144 <h3
><?php
echo __('Rows:'); ?
></h3
>
147 <?php
if (isset($_GET['allrows']) && $_GET['allrows'] == 1) {
148 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" />';
150 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
152 echo '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>'; ?
>
154 <li
><label
for="limit_to"><?php
echo __('Number of rows:') . '</label> <input type="text" id="limit_to" name="limit_to" size="5" value="'
155 . ((isset($_GET['limit_to'])) ?
$_GET['limit_to'] : ((isset($unlim_num_rows) ?
$unlim_num_rows : PMA_Table
::countRecords($db, $table))))
156 . '" onfocus="this.select()" />' ?
></li
>
157 <li
><label
for="limit_from"><?php
echo __('Row to begin at:') . '</label> <input type="text" id="limit_from" name="limit_from" value="'
158 . ((isset($_GET['limit_from'])) ?
$_GET['limit_from'] : '0')
159 . '" size="5" onfocus="this.select()" />'; ?
></li
>
163 <?php
if (isset($_GET['allrows']) && $_GET['allrows'] == 0) {
164 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" />';
166 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" checked="checked" />';
168 echo ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';?
>
174 <?php
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?
>
175 <div
class="exportoptions" id
="output_quick_export">
176 <h3
><?php
echo __('Output:'); ?
></h3
>
179 <input type
="checkbox" name
="quick_export_onserver" value
="saveit"
180 id
="checkbox_quick_dump_onserver"
181 <?php
PMA_exportCheckboxCheck('quick_export_onserver'); ?
> />
182 <label
for="checkbox_quick_dump_onserver">
183 <?php
echo sprintf(__('Save on server in the directory <b>%s</b>'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?
>
187 <input type
="checkbox" name
="quick_export_onserverover" value
="saveitover"
188 id
="checkbox_quick_dump_onserverover"
189 <?php
PMA_exportCheckboxCheck('quick_export_onserver_overwrite'); ?
> />
190 <label
for="checkbox_quick_dump_onserverover"><?php
echo __('Overwrite existing file(s)'); ?
></label
>
196 <div
class="exportoptions" id
="output">
197 <h3
><?php
echo __('Output:'); ?
></h3
>
200 <input type
="radio" name
="output_format" value
="sendit" id
="radio_dump_asfile" <?php
isset($_GET['repopulate']) ?
'' : PMA_exportCheckboxCheck('asfile'); ?
> />
201 <label
for="radio_dump_asfile"><?php
echo __('Save output to a file'); ?
></label
>
202 <ul id
="ul_save_asfile">
203 <?php
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?
>
205 <input type
="checkbox" name
="onserver" value
="saveit"
206 id
="checkbox_dump_onserver"
207 <?php
PMA_exportCheckboxCheck('onserver'); ?
> />
208 <label
for="checkbox_dump_onserver">
209 <?php
echo sprintf(__('Save on server in the directory <b>%s</b>'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?
>
213 <input type
="checkbox" name
="onserverover" value
="saveitover"
214 id
="checkbox_dump_onserverover"
215 <?php
PMA_exportCheckboxCheck('onserver_overwrite'); ?
> />
216 <label
for="checkbox_dump_onserverover"><?php
echo __('Overwrite existing file(s)'); ?
></label
>
220 <label
for="filename_template" class="desc">
222 echo __('File name template:');
223 $trans = new PMA_Message
;
224 $trans->addMessage(__('@SERVER@ will become the server name'));
225 if ($export_type == 'database' ||
$export_type == 'table') {
226 $trans->addMessage(__(', @DATABASE@ will become the database name'));
227 if ($export_type == 'table') {
228 $trans->addMessage(__(', @TABLE@ will become the table name'));
232 $message = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.'));
233 $message->addParam('<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php')). '" target="documentation" title="'
234 . __('Documentation') . '">', false);
235 $message->addParam('</a>', false);
236 $message->addParam($trans);
237 $message->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false);
238 $message->addParam('</a>', false);
240 echo PMA_showHint($message);
243 <input type
="text" name
="filename_template" id
="filename_template"
246 if (isset($_GET['filename_template'])) {
247 echo $_GET['filename_template'];
249 if ($export_type == 'database') {
250 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
251 'pma_db_filename_template',
252 $GLOBALS['cfg']['Export']['file_template_database']));
253 } elseif ($export_type == 'table') {
254 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
255 'pma_table_filename_template',
256 $GLOBALS['cfg']['Export']['file_template_table']));
258 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
259 'pma_server_filename_template',
260 $GLOBALS['cfg']['Export']['file_template_server']));
266 <input type
="checkbox" name
="remember_template"
267 id
="checkbox_remember_template"
268 <?php
PMA_exportCheckboxCheck('remember_file_template'); ?
> />
269 <label
for="checkbox_remember_template">
270 <?php
echo __('use this for future exports'); ?
></label
>
274 if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE
) {
275 echo ' <li><label for="select_charset_of_file" class="desc">'
276 . __('Character set of the file:') . '</label>' . "\n";
277 reset($cfg['AvailableCharsets']);
278 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
279 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
280 echo '<option value="' . $temp_charset . '"';
281 if (isset($_GET['charset_of_file']) && ($_GET['charset_of_file'] != $temp_charset)) {
283 } elseif ((empty($cfg['Export']['charset']) && $temp_charset == 'utf-8')
284 ||
$temp_charset == $cfg['Export']['charset']) {
285 echo ' selected="selected"';
287 echo '>' . $temp_charset . '</option>';
289 echo '</select></li>';
293 if (isset($_GET['compression'])) {
294 $selected_compression = $_GET['compression'];
295 } elseif (isset($cfg['Export']['compression'])) {
296 $selected_compression = $cfg['Export']['compression'];
298 $selected_compression = "none";
300 // zip, gzip and bzip2 encode features
301 $is_zip = ($cfg['ZipDump'] && @function_exists
('gzcompress'));
302 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzencode'));
303 $is_bzip2 = ($cfg['BZipDump'] && @function_exists
('bzcompress'));
304 if ($is_zip ||
$is_gzip ||
$is_bzip2) { ?
>
306 <label
for="compression" class="desc"><?php
echo __('Compression:'); ?
></label
>
307 <select id
="compression" name
="compression">
308 <option value
="none"><?php
echo __('None'); ?
></option
>
309 <?php
if ($is_zip) { ?
>
310 <option value
="zip" <?php
echo ($selected_compression == "zip") ?
'selected="selected"' : ''; ?
>><?php
echo __('zipped'); ?
></option
>
311 <?php
} if ($is_gzip) { ?
>
312 <option value
="gzip" <?php
echo ($selected_compression == "gzip") ?
'selected="selected"' : ''; ?
>><?php
echo __('gzipped'); ?
></option
>
313 <?php
} if ($is_bzip2) { ?
>
314 <option value
="bzip2" <?php
echo ($selected_compression == "bzip2") ?
'selected="selected"' : ''; ?
>><?php
echo __('bzipped'); ?
></option
>
319 <input type
="hidden" name
="compression" value
="<?php echo $selected_compression; ?>" />
323 <li
><input type
="radio" id
="radio_view_as_text" name
="output_format" value
="astext" <?php
echo (isset($_GET['repopulate']) ||
$GLOBALS['cfg']['Export']['asfile'] == false) ?
'checked="checked"' : '' ?
>/><label
for="radio_view_as_text"><?php
echo __('View output as text'); ?
></label
></li
>
327 <div
class="exportoptions" id
="format">
328 <h3
><?php
echo __('Format:'); ?
></h3
>
329 <?php
echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?
>
332 <div
class="exportoptions" id
="format_specific_opts">
333 <h3
><?php
echo __('Format-specific options:'); ?
></h3
>
334 <p
class="no_js_msg" id
="scroll_to_options_msg"><?php
echo __('Scroll down to fill in the options for the selected format and ignore the options for other formats.'); ?
></p
>
335 <?php
echo PMA_pluginGetOptions('Export', $export_list); ?
>
338 <?php
if (function_exists('PMA_set_enc_form')) { ?
>
339 <!-- Encoding setting form appended by Y
.Kawada
-->
340 <!-- Japanese encoding setting
-->
341 <div
class="exportoptions" id
="kanji_encoding">
342 <h3
><?php
echo __('Encoding Conversion:'); ?
></h3
>
343 <?php
echo PMA_set_enc_form(' '); ?
>
347 <div
class="exportoptions" id
="submit">
348 <?php
PMA_externalBug(__('SQL compatibility mode'), 'mysql', '50027', '14515'); ?
>
349 <input type
="submit" value
="<?php echo __('Go'); ?>" id
="buttonGo" />