return $ext;
}
-$dump_output = "<select name='output'><option value='text'>" . lang('open') . "<option value='file'>" . lang('save') . "</select>";
-$dump_format = "<select name='format'><option value='sql'>" . lang('SQL') . "<option value='csv'>" . lang('CSV') . "</select>";
+$dump_output = "<select name='output'>" . optionlist(array('text' => lang('open'), 'file' => lang('save'))) . "</select>";
+$dump_output = "<select name='output'>" . optionlist(array('sql' => lang('SQL'), 'csv' => lang('CSV'))) . "</select>";
$max_packet = 1048576; // default, minimum is 1024
if ($_POST["export"]) {
dump_headers($_GET["select"]);
dump_table($_GET["select"], "");
+ if ($_POST["format"] != "sql") { // Editor doesn't send format
+ dump_csv($select ? $select : array_keys($fields));
+ }
if (!is_array($_POST["check"]) || $primary === array()) {
dump_data($_GET["select"], "INSERT", "SELECT $from" . (is_array($_POST["check"]) ? ($where ? " AND " : " WHERE ") . "($where_check)" : "") . $group_by);
} else {
<?php
function dump_table($table) {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
- dump_csv(array_keys(fields($table)));
}
function dump_data($table, $style, $select = "") {