bug #2027102 quotes around lang missing
[phpmyadmin/last10db.git] / libraries / display_export.lib.php
blob858c265721f2e2f89b8e157af5ec3c736a407430
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 $GLOBALS['show_error_header'] = TRUE;
42 PMA_showMessage($strCanNotLoadExportPlugins);
43 unset($GLOBALS['show_error_header']);
44 require './libraries/footer.inc.php';
48 <form method="post" action="export.php" name="dump">
50 <?php
51 if ($export_type == 'server') {
52 echo PMA_generate_common_hidden_inputs('', '', 1);
53 } elseif ($export_type == 'database') {
54 echo PMA_generate_common_hidden_inputs($db, '', 1);
55 } else {
56 echo PMA_generate_common_hidden_inputs($db, $table, 1);
59 // just to keep this value for possible next display of this form after saving on server
60 if (isset($single_table)) {
61 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
64 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
66 if (! empty($sql_query)) {
67 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
69 echo PMA_pluginGetJavascript($export_list);
71 <fieldset id="fieldsetexport">
72 <legend><?php echo $export_page_title; ?></legend>
74 <?php
76 * this table is needed to fix rendering in Opera <= 9 and Safari <= 2
77 * normaly just the two fieldset would have float: left
80 <table><tr><td>
82 <div id="div_container_exportoptions">
83 <fieldset id="exportoptions">
84 <legend><?php echo $strExport; ?></legend>
86 <?php if (! empty($multi_values)) { ?>
87 <div class="formelementrow">
88 <?php echo $multi_values; ?>
89 </div>
90 <?php } ?>
91 <?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
92 </fieldset>
93 </div>
95 </td><td>
97 <div id="div_container_sub_exportoptions">
98 <?php echo PMA_pluginGetOptions('Export', $export_list); ?>
99 </div>
100 </td></tr></table>
102 <script type="text/javascript">
103 //<![CDATA[
104 init_options();
105 //]]>
106 </script>
108 <?php if (strlen($table) && ! isset($num_tables)) { ?>
109 <div class="formelementrow">
110 <?php
111 echo sprintf($strDumpXRows,
112 '<input type="text" name="limit_to" size="5" value="'
113 . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table, TRUE))
114 . '" onfocus="this.select()" />',
115 '<input type="text" name="limit_from" value="0" size="5"'
116 .' onfocus="this.select()" /> ');
118 </div>
119 <?php } ?>
120 </fieldset>
122 <fieldset>
123 <legend>
124 <input type="checkbox" name="asfile" value="sendit"
125 id="checkbox_dump_asfile" <?php PMA_exportCheckboxCheck('asfile'); ?> />
126 <label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
127 </legend>
129 <?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
130 <input type="checkbox" name="onserver" value="saveit"
131 id="checkbox_dump_onserver"
132 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
133 <?php PMA_exportCheckboxCheck('onserver'); ?> />
134 <label for="checkbox_dump_onserver">
135 <?php echo sprintf($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
136 </label>,<br />
137 <input type="checkbox" name="onserverover" value="saveitover"
138 id="checkbox_dump_onserverover"
139 onclick="document.getElementById('checkbox_dump_onserver').checked = true;
140 document.getElementById('checkbox_dump_asfile').checked = true;"
141 <?php PMA_exportCheckboxCheck('onserver_overwrite'); ?> />
142 <label for="checkbox_dump_onserverover">
143 <?php echo $strOverwriteExisting; ?></label>
144 <br />
145 <?php } ?>
147 <label for="filename_template">
148 <?php echo $strFileNameTemplate; ?>
149 <sup>(1)</sup></label>:
150 <input type="text" name="filename_template" id="filename_template"
151 <?php
152 echo ' value="';
153 if ($export_type == 'database') {
154 if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
155 echo $_COOKIE['pma_db_filename_template'];
156 } else {
157 echo $GLOBALS['cfg']['Export']['file_template_database'];
159 } elseif ($export_type == 'table') {
160 if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
161 echo $_COOKIE['pma_table_filename_template'];
162 } else {
163 echo $GLOBALS['cfg']['Export']['file_template_table'];
165 } else {
166 if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
167 echo $_COOKIE['pma_server_filename_template'];
168 } else {
169 echo $GLOBALS['cfg']['Export']['file_template_server'];
172 echo '" />';
176 <input type="checkbox" name="remember_template"
177 id="checkbox_remember_template"
178 <?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
179 <label for="checkbox_remember_template">
180 <?php echo $strFileNameTemplateRemember; ?></label>
183 <div class="formelementrow">
184 <?php
185 // charset of file
186 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
187 echo ' <label for="select_charset_of_file">'
188 . $strCharsetOfFile . '</label>' . "\n";
190 $temp_charset = reset($cfg['AvailableCharsets']);
191 echo ' <select id="select_charset_of_file" name="charset_of_file" size="1">' . "\n";
192 foreach ($cfg['AvailableCharsets'] as $key => $temp_charset) {
193 echo ' <option value="' . $temp_charset . '"';
194 if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
195 || $temp_charset == $cfg['Export']['charset']) {
196 echo ' selected="selected"';
198 echo '>' . $temp_charset . '</option>' . "\n";
199 } // end foreach
200 echo ' </select>';
201 } // end if
203 </div>
205 <?php
206 // zip, gzip and bzip2 encode features
207 $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
208 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
209 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
211 if ($is_zip || $is_gzip || $is_bzip) { ?>
212 <div class="formelementrow">
213 <?php echo $strCompression; ?>:
214 <input type="radio" name="compression" value="none"
215 id="radio_compression_none"
216 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
217 <?php PMA_exportIsActive('compression', 'none'); ?> />
218 <label for="radio_compression_none"><?php echo $strNone; ?></label>
219 <?php
220 if ($is_zip) { ?>
221 <input type="radio" name="compression" value="zip"
222 id="radio_compression_zip"
223 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
224 <?php PMA_exportIsActive('compression', 'zip'); ?> />
225 <label for="radio_compression_zip"><?php echo $strZip; ?></label>
226 <?php } if ($is_gzip) { ?>
227 <input type="radio" name="compression" value="gzip"
228 id="radio_compression_gzip"
229 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
230 <?php PMA_exportIsActive('compression', 'gzip'); ?> />
231 <label for="radio_compression_gzip"><?php echo $strGzip; ?></label>
232 <?php } if ($is_bzip) { ?>
233 <input type="radio" name="compression" value="bzip"
234 id="radio_compression_bzip"
235 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
236 <?php PMA_exportIsActive('compression', 'bzip2'); ?> />
237 <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
238 <?php } ?>
239 </div>
240 <?php } else { ?>
241 <input type="hidden" name="compression" value="none" />
242 <?php } ?>
243 </fieldset>
245 <?php if (function_exists('PMA_set_enc_form')) { ?>
246 <!-- Encoding setting form appended by Y.Kawada -->
247 <!-- Japanese encoding setting -->
248 <fieldset>
249 <?php echo PMA_set_enc_form(' '); ?>
250 </fieldset>
251 <?php } ?>
253 <fieldset class="tblFooters">
254 <?php PMA_externalBug($GLOBALS['strSQLCompatibility'], 'mysql', '50027', '14515'); ?>
255 <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
256 </fieldset>
257 </form>
259 <div class="notice">
260 <sup id="FileNameTemplateHelp">(1)</sup>
261 <?php
262 $trans = '__SERVER__/' . $strFileNameTemplateDescriptionServer;
263 if ($export_type == 'database' || $export_type == 'table') {
264 $trans .= ', __DB__/' . $strFileNameTemplateDescriptionDatabase;
266 if ($export_type == 'table') {
267 $trans .= ', __TABLE__/' . $strFileNameTemplateDescriptionTable;
269 echo sprintf($strFileNameTemplateDescription,
270 '<a href="http://www.php.net/strftime" target="documentation" title="'
271 . $strDocu . '">', '</a>', $trans); ?>
272 </div>