2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 if (! defined('PHPMYADMIN')) {
15 require_once './libraries/Table.class.php';
17 // Get relations & co. status
18 require_once './libraries/relation.lib.php';
19 $cfgRelation = PMA_getRelationsParam();
22 require_once './libraries/file_listing.php';
23 require_once './libraries/plugin_interface.lib.php';
25 function PMA_exportCheckboxCheck($str) {
26 if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
27 echo ' checked="checked"';
31 function PMA_exportIsActive($what, $val) {
32 if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
33 echo ' checked="checked"';
37 /* Scan for plugins */
38 $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
40 /* Fail if we didn't find any plugin */
41 if (empty($export_list)) {
42 PMA_Message
::error( __('Could not load export plugins, please check your installation!'))->display();
43 require './libraries/footer.inc.php';
47 <form method
="post" action
="export.php" name
="dump">
50 if ($export_type == 'server') {
51 echo PMA_generate_common_hidden_inputs('', '', 1);
52 } elseif ($export_type == 'database') {
53 echo PMA_generate_common_hidden_inputs($db, '', 1);
55 echo PMA_generate_common_hidden_inputs($db, $table, 1);
58 // just to keep this value for possible next display of this form after saving on server
59 if (isset($single_table)) {
60 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
63 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
65 if (! empty($sql_query)) {
66 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
68 echo PMA_pluginGetJavascript($export_list);
70 <fieldset id
="fieldsetexport">
71 <legend
><?php
echo $export_page_title; ?
></legend
>
75 * this table is needed to fix rendering in Opera <= 9 and Safari <= 2
76 * normaly just the two fieldset would have float: left
81 <div id
="div_container_exportoptions">
82 <fieldset id
="exportoptions">
83 <legend
><?php
echo __('Export'); ?
></legend
>
85 <?php
if (! empty($multi_values)) { ?
>
86 <div
class="formelementrow">
87 <?php
echo $multi_values; ?
>
90 <?php
echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?
>
96 <div id
="div_container_sub_exportoptions">
97 <?php
echo PMA_pluginGetOptions('Export', $export_list); ?
>
102 <?php
if (strlen($table) && ! isset($num_tables) && ! PMA_Table
::isMerge($db, $table)) { ?
>
103 <div
class="formelementrow">
105 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
107 echo sprintf(__('Dump %s row(s) starting at record # %s'),
108 '<input type="text" name="limit_to" size="5" value="'
109 . (isset($unlim_num_rows) ?
$unlim_num_rows : PMA_Table
::countRecords($db, $table))
110 . '" onfocus="this.select()" />',
111 '<input type="text" name="limit_from" value="0" size="5"'
112 .' onfocus="this.select()" /> ');
114 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" />';
115 echo '<label for="radio_allrows_1">' . __('Dump all rows') . '</label>';
123 <input type
="checkbox" name
="asfile" value
="sendit"
124 id
="checkbox_dump_asfile" <?php
PMA_exportCheckboxCheck('asfile'); ?
> />
125 <label
for="checkbox_dump_asfile"><?php
echo __('Save as file'); ?
></label
>
128 <?php
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?
>
129 <input type
="checkbox" name
="onserver" value
="saveit"
130 id
="checkbox_dump_onserver"
131 onclick
="document.getElementById('checkbox_dump_asfile').checked = true;"
132 <?php
PMA_exportCheckboxCheck('onserver'); ?
> />
133 <label
for="checkbox_dump_onserver">
134 <?php
echo sprintf(__('Save on server in %s directory'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?
>
136 <input type
="checkbox" name
="onserverover" value
="saveitover"
137 id
="checkbox_dump_onserverover"
138 onclick
="document.getElementById('checkbox_dump_onserver').checked = true;
139 document.getElementById('checkbox_dump_asfile').checked = true;"
140 <?php
PMA_exportCheckboxCheck('onserver_overwrite'); ?
> />
141 <label
for="checkbox_dump_onserverover">
142 <?php
echo __('Overwrite existing file(s)'); ?
></label
>
146 <label
for="filename_template">
148 echo __('File name template');
150 $trans = new PMA_Message
;
151 $trans->addMessage('__SERVER__/');
152 $trans->addString(__('server name'));
153 if ($export_type == 'database' ||
$export_type == 'table') {
154 $trans->addMessage('__DB__/');
155 $trans->addString(__('database name'));
156 if ($export_type == 'table') {
157 $trans->addMessage('__TABLE__/');
158 $trans->addString(__('table name'));
162 $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.'));
163 $message->addParam('<a href="http://php.net/strftime" target="documentation" title="'
164 . __('Documentation') . '">', false);
165 $message->addParam('</a>', false);
166 $message->addParam($trans);
168 echo PMA_showHint($message);
171 <input type
="text" name
="filename_template" id
="filename_template"
174 if ($export_type == 'database') {
175 if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
176 echo htmlspecialchars($_COOKIE['pma_db_filename_template']);
178 echo $GLOBALS['cfg']['Export']['file_template_database'];
180 } elseif ($export_type == 'table') {
181 if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
182 echo htmlspecialchars($_COOKIE['pma_table_filename_template']);
184 echo $GLOBALS['cfg']['Export']['file_template_table'];
187 if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
188 echo htmlspecialchars($_COOKIE['pma_server_filename_template']);
190 echo $GLOBALS['cfg']['Export']['file_template_server'];
198 <input type
="checkbox" name
="remember_template"
199 id
="checkbox_remember_template"
200 <?php
PMA_exportCheckboxCheck('remember_file_template'); ?
> />
201 <label
for="checkbox_remember_template">
202 <?php
echo __('remember template'); ?
></label
>
205 <div
class="formelementrow">
208 if ($cfg['AllowAnywhereRecoding']) {
209 echo ' <label for="select_charset_of_file">'
210 . __('Character set of the file:') . '</label>' . "\n";
212 reset($cfg['AvailableCharsets']);
213 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
214 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
215 echo '<option value="' . $temp_charset . '"';
216 if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
217 ||
$temp_charset == $cfg['Export']['charset']) {
218 echo ' selected="selected"';
220 echo '>' . $temp_charset . '</option>';
228 // zip, gzip and bzip2 encode features
229 $is_zip = ($cfg['ZipDump'] && @function_exists
('gzcompress'));
230 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzencode'));
231 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzcompress'));
233 if ($is_zip ||
$is_gzip ||
$is_bzip) { ?
>
234 <div
class="formelementrow">
235 <?php
echo __('Compression'); ?
>:
236 <input type
="radio" name
="compression" value
="none"
237 id
="radio_compression_none"
238 onclick
="document.getElementById('checkbox_dump_asfile').checked = true;"
239 <?php
PMA_exportIsActive('compression', 'none'); ?
> />
240 <label
for="radio_compression_none"><?php
echo __('None'); ?
></label
>
243 <input type
="radio" name
="compression" value
="zip"
244 id
="radio_compression_zip"
245 onclick
="document.getElementById('checkbox_dump_asfile').checked = true;"
246 <?php
PMA_exportIsActive('compression', 'zip'); ?
> />
247 <label
for="radio_compression_zip"><?php
echo __('zipped'); ?
></label
>
248 <?php
} if ($is_gzip) { ?
>
249 <input type
="radio" name
="compression" value
="gzip"
250 id
="radio_compression_gzip"
251 onclick
="document.getElementById('checkbox_dump_asfile').checked = true;"
252 <?php
PMA_exportIsActive('compression', 'gzip'); ?
> />
253 <label
for="radio_compression_gzip"><?php
echo __('gzipped'); ?
></label
>
254 <?php
} if ($is_bzip) { ?
>
255 <input type
="radio" name
="compression" value
="bzip"
256 id
="radio_compression_bzip"
257 onclick
="document.getElementById('checkbox_dump_asfile').checked = true;"
258 <?php
PMA_exportIsActive('compression', 'bzip2'); ?
> />
259 <label
for="radio_compression_bzip"><?php
echo __('bzipped'); ?
></label
>
263 <input type
="hidden" name
="compression" value
="none" />
267 <?php
if (function_exists('PMA_set_enc_form')) { ?
>
268 <!-- Encoding setting form appended by Y
.Kawada
-->
269 <!-- Japanese encoding setting
-->
270 <?php
echo PMA_set_enc_form(' '); ?
>
273 <fieldset
class="tblFooters">
274 <?php
PMA_externalBug(__('SQL compatibility mode'), 'mysql', '50027', '14515'); ?
>
275 <input type
="submit" value
="<?php echo __('Go'); ?>" id
="buttonGo" />