diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php
index 0ae8f52f..9f44930c 100644
--- a/adminer/dump.inc.php
+++ b/adminer/dump.inc.php
@@ -143,9 +143,8 @@ if ($connection->server_info >= 5) {
$db_style[] = 'CREATE+ALTER';
$table_style[] = 'CREATE+ALTER';
}
-echo "
| " . lang('Database') . " | \n";
if ($connection->server_info >= 5) {
$checked = strlen($_GET["dump"]);
diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
index 1cc9b962..03e10362 100644
--- a/adminer/include/adminer.inc.php
+++ b/adminer/include/adminer.inc.php
@@ -430,6 +430,30 @@ class Adminer {
return $return;
}
+ /** Returns export output options
+ * @param bool generate select (otherwise radio)
+ * @return string
+ */
+ function dumpOutput($select) {
+ $return = array('text' => lang('open'), 'file' => lang('save'));
+ if (function_exists('gzencode')) {
+ $return['gz'] = 'gzip';
+ }
+ if (function_exists('bzcompress')) {
+ $return['bz2'] = 'bzip2';
+ }
+ // ZipArchive requires temporary file, ZIP can be created by gzcompress - see PEAR File_Archive
+ return html_select("output", $return, "text", $select);
+ }
+
+ /** Returns export format options
+ * @param bool generate select (otherwise radio)
+ * @return string
+ */
+ function dumpFormat($select) {
+ return html_select("format", array('sql' => 'SQL', 'csv' => 'CSV'), "sql", $select);
+ }
+
/** Prints navigation after Adminer title
* @param string can be "auth" if there is no database connection or "db" if there is no database selected
* @return null
diff --git a/adminer/include/export.inc.php b/adminer/include/export.inc.php
index 9a8a4687..34502ae7 100644
--- a/adminer/include/export.inc.php
+++ b/adminer/include/export.inc.php
@@ -115,7 +115,8 @@ DROP PROCEDURE adminer_alter;
}
function dump_data($table, $style, $select = "") {
- global $connection, $max_packet;
+ global $connection;
+ $max_packet = 1048576; // default, minimum is 1024
if ($style) {
if ($_POST["format"] != "csv" && $style == "TRUNCATE+INSERT") {
dump("TRUNCATE " . idf_escape($table) . ";\n");
@@ -165,31 +166,18 @@ function dump_data($table, $style, $select = "") {
}
function dump_headers($identifier, $multi_table = false) {
- $compress = $_POST["compress"];
$filename = (strlen($identifier) ? friendly_url($identifier) : "dump");
+ $output = $_POST["output"];
$ext = ($_POST["format"] == "sql" ? "sql" : ($multi_table ? "tar" : "csv")); // multiple CSV packed to TAR
header("Content-Type: " .
- ($compress == "bz2" ? "application/x-bzip" :
- ($compress == "gz" ? "application/x-gzip" :
+ ($output == "bz2" ? "application/x-bzip" :
+ ($output == "gz" ? "application/x-gzip" :
($ext == "tar" ? "application/x-tar" :
- ($ext == "sql" || $_POST["output"] != "file" ? "text/plain" : "text/csv") . "; charset=utf-8"
+ ($ext == "sql" || $output != "file" ? "text/plain" : "text/csv") . "; charset=utf-8"
))));
- if ($_POST["output"] == "file" || $compress) {
- header("Content-Disposition: attachment; filename=$filename.$ext" . (ereg('[0-9a-z]', $compress) ? ".$compress" : ""));
+ if ($output != "text") {
+ header("Content-Disposition: attachment; filename=$filename.$ext" . ($output != "file" && !ereg('[^0-9a-z]', $output) ? ".$output" : ""));
}
session_write_close();
return $ext;
}
-
-$compress = array();
-if (function_exists('gzencode')) {
- $compress['gz'] = 'gzip';
-}
-if (function_exists('bzcompress')) {
- $compress['bz2'] = 'bzip2';
-}
-// ZipArchive requires temporary file, ZIP can be created by gzcompress - see PEAR File_Archive
-$dump_output = "";
-$dump_format = "";
-$dump_compress = ($compress ? "" : "");
-$max_packet = 1048576; // default, minimum is 1024
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 516b6364..4dd07bf7 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -74,6 +74,24 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "") {
return (strlen($label) ? "" : $return);
}
+/** Generate HTML radio list
+* @param string
+* @param array
+* @param string
+* @param bool generate select (otherwise radio)
+* @return string
+*/
+function html_select($name, $options, $value, $select = true) {
+ if ($select) {
+ return "";
+ }
+ $return = "";
+ foreach ($options as $key => $val) {
+ $return .= "";
+ }
+ return $return;
+}
+
/** Generate list of HTML options
* @param array array of strings or arrays (creates optgroup)
* @param mixed
@@ -457,10 +475,10 @@ function process_input($field) {
*/
function dump($string = null) { // null $string forces sending of buffer
static $buffer = ""; // used to improve compression and to allow GZ archives unpackable in Total Commander
- if ($_POST["compress"]) {
+ if (!ereg("text|file", $_POST["output"])) {
$buffer .= $string;
if (!isset($string) || strlen($buffer) > 1e6) {
- if ($_POST["compress"] == "bz2") {
+ if ($_POST["output"] == "bz2") {
echo bzcompress($buffer); // should not be called repeatedly but it would require whole buffer in memory or temporary file
} else {
echo gzencode($buffer);
diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php
index 6760815b..cd0bd504 100644
--- a/adminer/lang/cs.inc.php
+++ b/adminer/lang/cs.inc.php
@@ -225,5 +225,4 @@ $translations = array(
'Editor' => 'Editor',
'Webserver file %s' => 'Soubor %s na webovém serveru',
'File does not exist.' => 'Soubor neexistuje.',
- 'Compression' => 'Komprese',
);
diff --git a/adminer/lang/de.inc.php b/adminer/lang/de.inc.php
index 2ea05782..07cf836d 100644
--- a/adminer/lang/de.inc.php
+++ b/adminer/lang/de.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Betreff',
'Send' => 'Abschicken',
'%d e-mail(s) have been sent.' => array('%d e-mail abgeschickt.', '%d e-mails abgeschickt.'),
- 'Compression' => 'Kompression',
'Webserver file %s' => 'Webserver Datei %s',
'File does not exist.' => 'Datei existiert nicht.',
);
diff --git a/adminer/lang/es.inc.php b/adminer/lang/es.inc.php
index ec83bcd6..628f0fda 100644
--- a/adminer/lang/es.inc.php
+++ b/adminer/lang/es.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Asunto',
'Send' => 'Enviar',
'%d e-mail(s) have been sent.' => array('%d email enviado.', '%d emails enviados.'),
- 'Compression' => 'Compresión',
'Webserver file %s' => 'Archivo de servidor web %s',
'File does not exist.' => 'Archivo no existe.',
);
diff --git a/adminer/lang/et.inc.php b/adminer/lang/et.inc.php
index 00e7e097..b61e65fa 100644
--- a/adminer/lang/et.inc.php
+++ b/adminer/lang/et.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Pealkiri',
'Send' => 'Saada',
'%d e-mail(s) have been sent.' => array('Saadetud kirju: %d.', 'Saadetud kirju: %d.'),
- 'Compression' => 'Kokkupakkimine',
'Webserver file %s' => 'Fail serveris: %s',
'File does not exist.' => 'Faili ei leitud.',
);
diff --git a/adminer/lang/fr.inc.php b/adminer/lang/fr.inc.php
index a5c68460..98d63304 100644
--- a/adminer/lang/fr.inc.php
+++ b/adminer/lang/fr.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Sujet',
'Send' => 'Envoyer',
'%d e-mail(s) have been sent.' => array('%d message a été envoyé.', '%d messages ont été envoyés.'),
- 'Compression' => 'Compression',
'Webserver file %s' => '%s fichier du serveur Web',
'File does not exist.' => 'Le fichier est introuvable.',
);
diff --git a/adminer/lang/it.inc.php b/adminer/lang/it.inc.php
index 2788f3cb..a9c964f7 100644
--- a/adminer/lang/it.inc.php
+++ b/adminer/lang/it.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Oggetto',
'Send' => 'Invia',
'%d e-mail(s) have been sent.' => array('%d e-mail inviata.','%d e-mail inviate.'),
- 'Compression' => 'Compressione',
'Webserver file %s' => 'Webserver file %s',
'File does not exist.' => 'Il file non esiste.',
);
diff --git a/adminer/lang/nl.inc.php b/adminer/lang/nl.inc.php
index 8ae51a21..3d082663 100644
--- a/adminer/lang/nl.inc.php
+++ b/adminer/lang/nl.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Onderwerp',
'Send' => 'Verzenden',
'%d e-mail(s) have been sent.' => array('%d e-mail verzonden.', '%d e-mails verzonden.'),
- 'Compression' => 'Compressie',
'Webserver file %s' => 'Webserver bestand %s',
'File does not exist.' => 'Bestand niet gevonden.',
);
diff --git a/adminer/lang/ru.inc.php b/adminer/lang/ru.inc.php
index 3f794bd5..4bafeba2 100644
--- a/adminer/lang/ru.inc.php
+++ b/adminer/lang/ru.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => 'Кому',
'Send' => 'Послать',
'%d e-mail(s) have been sent.' => array('Было отправлено %d письмо.', 'Было отправлено %d письма.', 'Было отправлено %d писем.'),
- 'Compression' => 'Сжатие',
'Webserver file %s' => 'Файл %s на вебсервере',
'File does not exist.' => 'Такого файла не существует.',
);
diff --git a/adminer/lang/sk.inc.php b/adminer/lang/sk.inc.php
index 4b7ba2d0..e68774bb 100644
--- a/adminer/lang/sk.inc.php
+++ b/adminer/lang/sk.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Maximum allowed file size is %sB.' => 'Maximálna povolená veľkosť súboru je %sB.',
'Clear' => 'Vyčistiť',
'Editor' => 'Editor',
- 'Compression' => 'Kompresia',
'Webserver file %s' => 'Súbor %s na webovom serveri',
'File does not exist.' => 'Súbor neexistuje.',
);
diff --git a/adminer/lang/zh-tw.inc.php b/adminer/lang/zh-tw.inc.php
index c00584cb..8fd54fd0 100644
--- a/adminer/lang/zh-tw.inc.php
+++ b/adminer/lang/zh-tw.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => '主題',
'Send' => '發送',
'%d e-mail(s) have been sent.' => '已發送 %d 封郵件。',
- 'Compression' => '壓縮',
'Webserver file %s' => '網頁伺服器檔案 %s',
'File does not exist.' => '檔案不存在',
);
diff --git a/adminer/lang/zh.inc.php b/adminer/lang/zh.inc.php
index b9eb03a2..54993b39 100644
--- a/adminer/lang/zh.inc.php
+++ b/adminer/lang/zh.inc.php
@@ -223,7 +223,6 @@ $translations = array(
'Subject' => '主题',
'Send' => '发送',
'%d e-mail(s) have been sent.' => '%d 封邮件已发送。',
- 'Compression' => '压缩',
'Webserver file %s' => 'Web服务器文件 %s',
'File does not exist.' => '文件不存在',
);
diff --git a/adminer/select.inc.php b/adminer/select.inc.php
index 368b116d..77365d83 100644
--- a/adminer/select.inc.php
+++ b/adminer/select.inc.php
@@ -262,7 +262,8 @@ if (!$columns) {
echo (information_schema(DB) ? "" : "\n");
print_fieldset("export", lang('Export'));
- echo "$dump_output $dump_format $dump_compress \n";
+ echo $adminer->dumpOutput(1) . " " . $adminer->dumpFormat(1); // 1 - select
+ echo " \n";
echo "\n";
}
print_fieldset("import", lang('CSV Import'), !$result->num_rows);
diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php
index c78a03de..e2cd16d8 100644
--- a/adminer/sql.inc.php
+++ b/adminer/sql.inc.php
@@ -48,7 +48,7 @@ if (!$error && $_POST) {
$found = $match[0][0];
$offset = $match[0][1] + strlen($found);
if (!$found && $fp && !feof($fp)) {
- $query .= fread($fp, 1e6);
+ $query .= fread($fp, 1e5);
} else {
if (!$found && !strlen(rtrim($query))) {
break;
diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php
index a4e30a8e..60bc7a36 100644
--- a/editor/include/adminer.inc.php
+++ b/editor/include/adminer.inc.php
@@ -406,6 +406,14 @@ ORDER BY ORDINAL_POSITION");
return $return;
}
+ function dumpOutput($select) {
+ return "";
+ }
+
+ function dumpFormat($select) {
+ return "CSV";
+ }
+
function navigation($missing) {
global $VERSION;
?>
diff --git a/editor/include/export.inc.php b/editor/include/export.inc.php
index 56ec32e2..46a32ddc 100644
--- a/editor/include/export.inc.php
+++ b/editor/include/export.inc.php
@@ -5,7 +5,7 @@ function dump_table($table) {
function dump_data($table, $style, $select = "") {
global $connection;
- $result = $connection->query(($select ? $select : "SELECT * FROM " . idf_escape($table)));
+ $result = $connection->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT
if ($result) {
while ($row = $result->fetch_assoc()) {
dump_csv($row);
@@ -21,7 +21,3 @@ function dump_headers($identifier) {
session_write_close();
return $ext;
}
-
-$dump_output = "";
-$dump_format = "CSV";
-$dump_compress = "";
|
|---|