Do not output unescaped chars to generated configuration file.
[phpmyadmin/madhuracj.git] / libraries / display_export.lib.php
blobad07a404bc63cabb0ccc68863cb021200519e3ad
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
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('strCanNotLoadExportPlugins')->display();
43 require './libraries/footer.inc.php';
47 <form method="post" action="export.php" name="dump">
49 <?php
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);
54 } else {
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>
73 <?php
75 * this table is needed to fix rendering in Opera <= 9 and Safari <= 2
76 * normaly just the two fieldset would have float: left
79 <table><tr><td>
81 <div id="div_container_exportoptions">
82 <fieldset id="exportoptions">
83 <legend><?php echo $strExport; ?></legend>
85 <?php if (! empty($multi_values)) { ?>
86 <div class="formelementrow">
87 <?php echo $multi_values; ?>
88 </div>
89 <?php } ?>
90 <?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
91 </fieldset>
92 </div>
94 </td><td>
96 <div id="div_container_sub_exportoptions">
97 <?php echo PMA_pluginGetOptions('Export', $export_list); ?>
98 </div>
99 </td></tr></table>
101 <script type="text/javascript">
102 //<![CDATA[
103 init_options();
104 //]]>
105 </script>
107 <?php if (strlen($table) && ! isset($num_tables)) { ?>
108 <div class="formelementrow">
109 <?php
110 echo sprintf($strDumpXRows,
111 '<input type="text" name="limit_to" size="5" value="'
112 . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table, TRUE))
113 . '" onfocus="this.select()" />',
114 '<input type="text" name="limit_from" value="0" size="5"'
115 .' onfocus="this.select()" /> ');
117 </div>
118 <?php } ?>
119 </fieldset>
121 <fieldset>
122 <legend>
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 $strSend; ?></label>
126 </legend>
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($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
135 </label>,<br />
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 $strOverwriteExisting; ?></label>
143 <br />
144 <?php } ?>
146 <label for="filename_template">
147 <?php
148 echo $strFileNameTemplate;
150 $trans = new PMA_Message;
151 $trans->addMessage('__SERVER__/');
152 $trans->addString('strFileNameTemplateDescriptionServer');
153 if ($export_type == 'database' || $export_type == 'table') {
154 $trans->addMessage('__DB__/');
155 $trans->addString('strFileNameTemplateDescriptionDatabase');
156 if ($export_type == 'table') {
157 $trans->addMessage('__TABLE__/');
158 $trans->addString('strFileNameTemplateDescriptionTable');
162 $message = new PMA_Message('strFileNameTemplateDescription');
163 $message->addParam('<a href="http://php.net/strftime" target="documentation" title="'
164 . $strDocu . '">', false);
165 $message->addParam('</a>', false);
166 $message->addParam($trans);
168 echo PMA_showHint($message);
170 </label>:
171 <input type="text" name="filename_template" id="filename_template"
172 <?php
173 echo ' value="';
174 if ($export_type == 'database') {
175 if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
176 echo $_COOKIE['pma_db_filename_template'];
177 } else {
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 $_COOKIE['pma_table_filename_template'];
183 } else {
184 echo $GLOBALS['cfg']['Export']['file_template_table'];
186 } else {
187 if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
188 echo $_COOKIE['pma_server_filename_template'];
189 } else {
190 echo $GLOBALS['cfg']['Export']['file_template_server'];
193 echo '" />';
197 <input type="checkbox" name="remember_template"
198 id="checkbox_remember_template"
199 <?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
200 <label for="checkbox_remember_template">
201 <?php echo $strFileNameTemplateRemember; ?></label>
204 <div class="formelementrow">
205 <?php
206 // charset of file
207 if ($cfg['AllowAnywhereRecoding']) {
208 echo ' <label for="select_charset_of_file">'
209 . $strCharsetOfFile . '</label>' . "\n";
211 reset($cfg['AvailableCharsets']);
212 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
213 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
214 echo '<option value="' . $temp_charset . '"';
215 if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
216 || $temp_charset == $cfg['Export']['charset']) {
217 echo ' selected="selected"';
219 echo '>' . $temp_charset . '</option>';
220 } // end foreach
221 echo '</select>';
222 } // end if
224 </div>
226 <?php
227 // zip, gzip and bzip2 encode features
228 $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
229 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
230 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
232 if ($is_zip || $is_gzip || $is_bzip) { ?>
233 <div class="formelementrow">
234 <?php echo $strCompression; ?>:
235 <input type="radio" name="compression" value="none"
236 id="radio_compression_none"
237 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
238 <?php PMA_exportIsActive('compression', 'none'); ?> />
239 <label for="radio_compression_none"><?php echo $strNone; ?></label>
240 <?php
241 if ($is_zip) { ?>
242 <input type="radio" name="compression" value="zip"
243 id="radio_compression_zip"
244 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
245 <?php PMA_exportIsActive('compression', 'zip'); ?> />
246 <label for="radio_compression_zip"><?php echo $strZip; ?></label>
247 <?php } if ($is_gzip) { ?>
248 <input type="radio" name="compression" value="gzip"
249 id="radio_compression_gzip"
250 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
251 <?php PMA_exportIsActive('compression', 'gzip'); ?> />
252 <label for="radio_compression_gzip"><?php echo $strGzip; ?></label>
253 <?php } if ($is_bzip) { ?>
254 <input type="radio" name="compression" value="bzip"
255 id="radio_compression_bzip"
256 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
257 <?php PMA_exportIsActive('compression', 'bzip2'); ?> />
258 <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
259 <?php } ?>
260 </div>
261 <?php } else { ?>
262 <input type="hidden" name="compression" value="none" />
263 <?php } ?>
264 </fieldset>
266 <?php if (function_exists('PMA_set_enc_form')) { ?>
267 <!-- Encoding setting form appended by Y.Kawada -->
268 <!-- Japanese encoding setting -->
269 <fieldset>
270 <?php echo PMA_set_enc_form(' '); ?>
271 </fieldset>
272 <?php } ?>
274 <fieldset class="tblFooters">
275 <?php PMA_externalBug($GLOBALS['strSQLCompatibility'], 'mysql', '50027', '14515'); ?>
276 <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
277 </fieldset>
278 </form>