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) {
19 if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
20 echo ' checked="checked"';
24 function PMA_exportIsActive($what, $val) {
25 if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
26 echo ' checked="checked"';
30 /* Scan for plugins */
31 $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
33 /* Fail if we didn't find any plugin */
34 if (empty($export_list)) {
35 PMA_Message
::error( __('Could not load export plugins, please check your installation!'))->display();
36 require './libraries/footer.inc.php';
40 <form method
="post" action
="export.php" name
="dump">
43 if ($export_type == 'server') {
44 echo PMA_generate_common_hidden_inputs('', '', 1);
45 } elseif ($export_type == 'database') {
46 echo PMA_generate_common_hidden_inputs($db, '', 1);
48 echo PMA_generate_common_hidden_inputs($db, $table, 1);
51 // just to keep this value for possible next display of this form after saving on server
52 if (isset($single_table)) {
53 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
56 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
58 // If the export method was not set, the default is quick
59 if (isset($_GET['export_method'])) {
60 $cfg['Export']['method'] = $_GET['export_method'];
61 } elseif (! isset($cfg['Export']['method'])) {
62 $cfg['Export']['method'] = 'quick';
64 // The export method (quick, custom or custom-no-form)
65 echo '<input type="hidden" name="export_method" value="' . htmlspecialchars($cfg['Export']['method']) . '" />';
68 if (isset($_GET['sql_query'])) {
69 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
70 } elseif (! empty($sql_query)) {
71 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
75 <div
class="exportoptions" id
="header">
77 <img
class="icon ic_b_export" src
="themes/dot.gif" alt
="export" />
79 if ($export_type == 'server') {
80 echo __('Exporting databases from the current server');
81 } elseif ($export_type == 'database') {
82 printf(__('Exporting tables from "%s" database'), htmlspecialchars($db));
84 printf(__('Exporting rows from "%s" table'), htmlspecialchars($table));
89 <div
class="exportoptions" id
="quick_or_custom">
90 <h3
><?php
echo __('Export Method:'); ?
></h3
>
93 <?php
echo '<input type="radio" name="quick_or_custom" value="quick" id="radio_quick_export"';
94 if (isset($_GET['quick_or_custom'])) {
95 $export_method = $_GET['quick_or_custom'];
96 if ($export_method == 'custom' ||
$export_method == 'custom_no_form') {
99 echo ' checked="checked" />';
101 } elseif ($cfg['Export']['method'] == 'custom' ||
$cfg['Export']['method'] == 'custom-no-form') {
104 echo ' checked="checked" />';
106 echo '<label for ="radio_quick_export">' . __('Quick - display only the minimal options') . '</label>'; ?
>
109 <?php
echo '<input type="radio" name="quick_or_custom" value="custom" id="radio_custom_export"';
110 if (isset($_GET['quick_or_custom'])) {
111 $export_method = $_GET['quick_or_custom'];
112 if ($export_method == 'custom' ||
$export_method == 'custom_no_form') {
113 echo ' checked="checked" />';
117 } elseif ($cfg['Export']['method'] == 'custom' ||
$cfg['Export']['method'] == 'custom-no-form') {
118 echo ' checked="checked" />';
122 echo '<label for="radio_custom_export">' . __('Custom - display all possible options') . '</label>';?
>
127 <div
class="exportoptions" id
="databases_and_tables">
129 if ($export_type == 'server') {
130 echo '<h3>' . __('Database(s):') . '</h3>';
131 } else if ($export_type == 'database') {
132 echo '<h3>' . __('Table(s):') . '</h3>';
134 if (! empty($multi_values)) {
140 <?php
if (strlen($table) && ! isset($num_tables) && ! PMA_Table
::isMerge($db, $table)) { ?
>
141 <div
class="exportoptions" id
="rows">
142 <h3
><?php
echo __('Rows:'); ?
></h3
>
145 <?php
if (isset($_GET['allrows']) && $_GET['allrows'] == 1) {
146 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" />';
148 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
150 echo '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>'; ?
>
152 <li
><label
for="limit_to"><?php
echo __('Number of rows:') . '</label> <input type="text" id="limit_to" name="limit_to" size="5" value="'
153 . ((isset($_GET['limit_to'])) ?
$_GET['limit_to'] : ((isset($unlim_num_rows) ?
$unlim_num_rows : PMA_Table
::countRecords($db, $table))))
154 . '" onfocus="this.select()" />' ?
></li
>
155 <li
><label
for="limit_from"><?php
echo __('Row to begin at:') . '</label> <input type="text" id="limit_from" name="limit_from" value="'
156 . ((isset($_GET['limit_from'])) ?
$_GET['limit_from'] : '0')
157 . '" size="5" onfocus="this.select()" />'; ?
></li
>
161 <?php
if (isset($_GET['allrows']) && $_GET['allrows'] == 0) {
162 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" />';
164 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" checked="checked" />';
166 echo ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';?
>
172 <?php
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?
>
173 <div
class="exportoptions" id
="output_quick_export">
174 <h3
><?php
echo __('Output:'); ?
></h3
>
177 <input type
="checkbox" name
="quick_export_onserver" value
="saveit"
178 id
="checkbox_quick_dump_onserver"
179 <?php
PMA_exportCheckboxCheck('quick_export_onserver'); ?
> />
180 <label
for="checkbox_quick_dump_onserver">
181 <?php
echo sprintf(__('Save on server in the directory <b>%s</b>'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?
>
185 <input type
="checkbox" name
="quick_export_onserverover" value
="saveitover"
186 id
="checkbox_quick_dump_onserverover"
187 <?php
PMA_exportCheckboxCheck('quick_export_onserver_overwrite'); ?
> />
188 <label
for="checkbox_quick_dump_onserverover"><?php
echo __('Overwrite existing file(s)'); ?
></label
>
194 <div
class="exportoptions" id
="output">
195 <h3
><?php
echo __('Output:'); ?
></h3
>
198 <input type
="radio" name
="output_format" value
="sendit" id
="radio_dump_asfile" <?php
isset($_GET['repopulate']) ?
'' : PMA_exportCheckboxCheck('asfile'); ?
> />
199 <label
for="radio_dump_asfile"><?php
echo __('Save output to a file'); ?
></label
>
200 <ul id
="ul_save_asfile">
201 <?php
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?
>
203 <input type
="checkbox" name
="onserver" value
="saveit"
204 id
="checkbox_dump_onserver"
205 <?php
PMA_exportCheckboxCheck('onserver'); ?
> />
206 <label
for="checkbox_dump_onserver">
207 <?php
echo sprintf(__('Save on server in the directory <b>%s</b>'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?
>
211 <input type
="checkbox" name
="onserverover" value
="saveitover"
212 id
="checkbox_dump_onserverover"
213 <?php
PMA_exportCheckboxCheck('onserver_overwrite'); ?
> />
214 <label
for="checkbox_dump_onserverover"><?php
echo __('Overwrite existing file(s)'); ?
></label
>
218 <label
for="filename_template" class="desc">
220 echo __('File name template:');
221 $trans = new PMA_Message
;
222 $trans->addMessage(__('@SERVER@ will become the server name'));
223 if ($export_type == 'database' ||
$export_type == 'table') {
224 $trans->addMessage(__(', @DATABASE@ will become the database name'));
225 if ($export_type == 'table') {
226 $trans->addMessage(__(', @TABLE@ will become the table name'));
230 $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.'));
231 $message->addParam('<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php')). '" target="documentation" title="'
232 . __('Documentation') . '">', false);
233 $message->addParam('</a>', false);
234 $message->addParam($trans);
235 $message->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false);
236 $message->addParam('</a>', false);
238 echo PMA_showHint($message);
241 <input type
="text" name
="filename_template" id
="filename_template"
244 if (isset($_GET['filename_template'])) {
245 echo $_GET['filename_template'];
247 if ($export_type == 'database') {
248 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
249 'pma_db_filename_template',
250 $GLOBALS['cfg']['Export']['file_template_database']));
251 } elseif ($export_type == 'table') {
252 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
253 'pma_table_filename_template',
254 $GLOBALS['cfg']['Export']['file_template_table']));
256 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
257 'pma_server_filename_template',
258 $GLOBALS['cfg']['Export']['file_template_server']));
264 <input type
="checkbox" name
="remember_template"
265 id
="checkbox_remember_template"
266 <?php
PMA_exportCheckboxCheck('remember_file_template'); ?
> />
267 <label
for="checkbox_remember_template">
268 <?php
echo __('use this for future exports'); ?
></label
>
272 if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE
) {
273 echo ' <li><label for="select_charset_of_file" class="desc">'
274 . __('Character set of the file:') . '</label>' . "\n";
275 reset($cfg['AvailableCharsets']);
276 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
277 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
278 echo '<option value="' . $temp_charset . '"';
279 if (isset($_GET['charset_of_file']) && ($_GET['charset_of_file'] != $temp_charset)) {
281 } elseif ((empty($cfg['Export']['charset']) && $temp_charset == 'utf-8')
282 ||
$temp_charset == $cfg['Export']['charset']) {
283 echo ' selected="selected"';
285 echo '>' . $temp_charset . '</option>';
287 echo '</select></li>';
291 if (isset($_GET['compression'])) {
292 $selected_compression = $_GET['compression'];
293 } elseif (isset($cfg['Export']['compression'])) {
294 $selected_compression = $cfg['Export']['compression'];
296 $selected_compression = "none";
298 // zip, gzip and bzip2 encode features
299 $is_zip = ($cfg['ZipDump'] && @function_exists
('gzcompress'));
300 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzencode'));
301 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzcompress'));
302 if ($is_zip ||
$is_gzip ||
$is_bzip) { ?
>
304 <label
for="compression" class="desc"><?php
echo __('Compression:'); ?
></label
>
305 <select id
="compression" name
="compression">
306 <option value
="none"><?php
echo __('None'); ?
></option
>
307 <?php
if ($is_zip) { ?
>
308 <option value
="zip" <?php
echo ($selected_compression == "zip") ?
'selected="selected"' : ''; ?
>><?php
echo __('zipped'); ?
></option
>
309 <?php
} if ($is_gzip) { ?
>
310 <option value
="gzip" <?php
echo ($selected_compression == "gzip") ?
'selected="selected"' : ''; ?
>><?php
echo __('gzipped'); ?
></option
>
311 <?php
} if ($is_bzip) { ?
>
312 <option value
="bzip" <?php
echo ($selected_compression == "bzip") ?
'selected="selected"' : ''; ?
>><?php
echo __('bzipped'); ?
></option
>
317 <input type
="hidden" name
="compression" value
="<?php echo $selected_compression; ?>" />
321 <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
>
325 <div
class="exportoptions" id
="format">
326 <h3
><?php
echo __('Format:'); ?
></h3
>
327 <?php
echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?
>
330 <div
class="exportoptions" id
="format_specific_opts">
331 <h3
><?php
echo __('Format-specific options:'); ?
></h3
>
332 <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
>
333 <?php
echo PMA_pluginGetOptions('Export', $export_list); ?
>
336 <?php
if (function_exists('PMA_set_enc_form')) { ?
>
337 <!-- Encoding setting form appended by Y
.Kawada
-->
338 <!-- Japanese encoding setting
-->
339 <div
class="exportoptions" id
="kanji_encoding">
340 <h3
><?php
echo __('Encoding Conversion:'); ?
></h3
>
341 <?php
echo PMA_set_enc_form(' '); ?
>
345 <div
class="exportoptions" id
="submit">
346 <?php
PMA_externalBug(__('SQL compatibility mode'), 'mysql', '50027', '14515'); ?
>
347 <input type
="submit" value
="<?php echo __('Go'); ?>" id
="buttonGo" />