1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
|
<?php
/* $Id: display_export.lib.php 8968 2006-04-26 20:59:09Z nijel $ */
// vim: expandtab sw=4 ts=4 sts=4:
require_once './libraries/Table.class.php';
// Get relations & co. status
require_once('./libraries/relation.lib.php');
$cfgRelation = PMA_getRelationsParam();
require_once('./libraries/file_listing.php');
require_once('./libraries/plugin_interface.lib.php');
function PMA_exportCheckboxCheck($str) {
if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
echo ' checked="checked"';
}
}
function PMA_exportIsActive($what, $val) {
if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
echo ' checked="checked"';
}
}
/* Scan for plugins */
$export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
/* Fail if we didn't find any plugin */
if (empty($export_list)) {
$GLOBALS['show_error_header'] = TRUE;
PMA_showMessage($strCanNotLoadExportPlugins);
unset($GLOBALS['show_error_header']);
require('./libraries/footer.inc.php');
}
?>
<form method="post" action="export.php" name="dump">
<?php
if ($export_type == 'server') {
echo PMA_generate_common_hidden_inputs('', '', 1);
} elseif ($export_type == 'database') {
echo PMA_generate_common_hidden_inputs($db, '', 1);
} else {
echo PMA_generate_common_hidden_inputs($db, $table, 1);
}
// just to keep this value for possible next display of this form after saving on server
if (isset($single_table)) {
echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
}
echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
if (isset($sql_query)) {
echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
}
echo PMA_pluginGetJavascript($export_list);
?>
<fieldset id="fieldsetexport">
<legend><?php echo $export_page_title; ?></legend>
<?php
/*
* this table is needed to fix rendering in Opera <= 9 and Safari <= 2
* normaly just the two fieldset would have float: left
*/
?>
<table><tr><td>
<div id="div_container_exportoptions">
<fieldset id="exportoptions">
<legend><?php echo $strExport; ?></legend>
<?php if ( ! empty( $multi_values ) ) { ?>
<div class="formelementrow">
<?php echo $multi_values; ?>
</div>
<?php } ?>
<?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
</fieldset>
</div>
</td><td>
<div id="div_container_sub_exportoptions">
<?php echo PMA_pluginGetOptions('Export', $export_list); ?>
</div>
</td></tr></table>
<script type="text/javascript" language="javascript">
//<![CDATA[
init_options();
//]]>
</script>
<?php if ( isset($table) && strlen($table) && ! isset( $num_tables ) ) { ?>
<div class="formelementrow">
<?php
echo sprintf( $strDumpXRows,
'<input type="text" name="limit_to" size="5" value="'
. ( isset( $unlim_num_rows ) ? $unlim_num_rows : PMA_Table::countRecords( $db, $table, TRUE ) )
. '" onfocus="this.select()" />',
'<input type="text" name="limit_from" value="0" size="5"'
.' onfocus="this.select()" /> ');
?>
</div>
<?php } ?>
</fieldset>
<fieldset>
<legend>
<input type="checkbox" name="asfile" value="sendit"
id="checkbox_dump_asfile" <?php PMA_exportCheckboxCheck('asfile'); ?> />
<label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
</legend>
<?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
<input type="checkbox" name="onserver" value="saveit"
id="checkbox_dump_onserver"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
<?php PMA_exportCheckboxCheck('onserver'); ?> />
<label for="checkbox_dump_onserver">
<?php echo sprintf($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
</label>,<br />
<input type="checkbox" name="onserverover" value="saveitover"
id="checkbox_dump_onserverover"
onclick="document.getElementById('checkbox_dump_onserver').checked = true;
document.getElementById('checkbox_dump_asfile').checked = true;"
<?php PMA_exportCheckboxCheck('onserver_overwrite'); ?> />
<label for="checkbox_dump_onserverover">
<?php echo $strOverwriteExisting; ?></label>
<br />
<?php } ?>
<label for="filename_template">
<?php echo $strFileNameTemplate; ?>
<sup>(1)</sup></label>:
<input type="text" name="filename_template" id="filename_template"
<?php
echo ' value="';
if ($export_type == 'database') {
if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
echo $_COOKIE['pma_db_filename_template'];
} else {
echo $GLOBALS['cfg']['Export']['file_template_database'];
}
} elseif ($export_type == 'table') {
if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
echo $_COOKIE['pma_table_filename_template'];
} else {
echo $GLOBALS['cfg']['Export']['file_template_table'];
}
} else {
if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
echo $_COOKIE['pma_server_filename_template'];
} else {
echo $GLOBALS['cfg']['Export']['file_template_server'];
}
}
echo '" />';
?>
(
<input type="checkbox" name="remember_template"
id="checkbox_remember_template"
<?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
<label for="checkbox_remember_template">
<?php echo $strFileNameTemplateRemember; ?></label>
)
<div class="formelementrow">
<?php
// charset of file
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
echo ' <label for="select_charset_of_file">'
. $strCharsetOfFile . '</label>' . "\n";
$temp_charset = reset($cfg['AvailableCharsets']);
echo ' <select id="select_charset_of_file" name="charset_of_file" size="1">' . "\n";
foreach ($cfg['AvailableCharsets'] as $key => $temp_charset) {
echo ' <option value="' . $temp_charset . '"';
if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
|| $temp_charset == $cfg['Export']['charset']) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
} // end foreach
echo ' </select>';
} // end if
?>
</div>
<?php
// zip, gzip and bzip2 encode features
$is_zip = ( $cfg['ZipDump'] && @function_exists('gzcompress') );
$is_gzip = ( $cfg['GZipDump'] && @function_exists('gzencode') );
$is_bzip = ( $cfg['BZipDump'] && @function_exists('bzcompress') );
if ( $is_zip || $is_gzip || $is_bzip ) { ?>
<div class="formelementrow">
<?php echo $strCompression; ?>:
<input type="radio" name="compression" value="none"
id="radio_compression_none"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
<?php PMA_exportIsActive('compression', 'none'); ?> />
<label for="radio_compression_none"><?php echo $strNone; ?></label>
<?php
if ($is_zip) { ?>
<input type="radio" name="compression" value="zip"
id="radio_compression_zip"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
<?php PMA_exportIsActive('compression', 'zip'); ?> />
<label for="radio_compression_zip"><?php echo $strZip; ?></label>
<?php } if ($is_gzip) { ?>
<input type="radio" name="compression" value="gzip"
id="radio_compression_gzip"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
<?php PMA_exportIsActive('compression', 'gzip'); ?> />
<label for="radio_compression_gzip"><?php echo $strGzip; ?></label>
<?php } if ($is_bzip) { ?>
<input type="radio" name="compression" value="bzip"
id="radio_compression_bzip"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
<?php PMA_exportIsActive('compression', 'bzip2'); ?> />
<label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
<?php } ?>
</div>
<?php } else { ?>
<input type="hidden" name="compression" value="none" />
<?php } ?>
</fieldset>
<?php if (function_exists('PMA_set_enc_form')) { ?>
<!-- Encoding setting form appended by Y.Kawada -->
<!-- Japanese encoding setting -->
<fieldset>
<?php echo PMA_set_enc_form(' '); ?>
</fieldset>
<?php } ?>
<fieldset class="tblFooters">
<input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
</fieldset>
</form>
<div class="notice">
<sup id="FileNameTemplateHelp">(1)</sup>
<?php
$trans = '__SERVER__/' . $strFileNameTemplateDescriptionServer;
if ($export_type == 'database' || $export_type == 'table') {
$trans .= ', __DB__/' . $strFileNameTemplateDescriptionDatabase;
}
if ($export_type == 'table') {
$trans .= ', __TABLE__/' . $strFileNameTemplateDescriptionTable;
}
echo sprintf($strFileNameTemplateDescription,
'<a href="http://www.php.net/strftime" target="documentation" title="'
. $strDocu . '">', '</a>', $trans); ?>
</div>
|