From 5b577068901ab4d76c36c9845c7d485fa9560a0b Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 29 Jun 2012 12:25:05 -0700 Subject: [PATCH] Customizable export filename --- adminer/include/adminer.inc.php | 3 +++ adminer/include/functions.inc.php | 4 ---- changes.txt | 1 + editor/include/adminer.inc.php | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 868deb787..db6513701 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -730,6 +730,9 @@ function dumpHeaders($identifier, $multi_table = false) { ($ext == "tar" ? "application/x-tar" : ($ext == "sql" || $output != "file" ? "text/plain" : "text/csv") . "; charset=utf-8" )))); + if ($output != "text") { + header("Content-Disposition: attachment; filename=" . friendly_url($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost")) . ".$ext" . ($output != "file" && !ereg('[^0-9a-z]', $output) ? ".$output" : "")); + } if ($output == "bz2") { ob_start('bzcompress', 1e6); } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index e86be6275..476513393 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -803,10 +803,6 @@ function search_tables() { function dump_headers($identifier, $multi_table = false) { global $adminer; $return = $adminer->dumpHeaders($identifier, $multi_table); - $output = $_POST["output"]; - if ($output != "text") { - header("Content-Disposition: attachment; filename=" . friendly_url($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost")) . ".$return" . ($output != "file" && !ereg('[^0-9a-z]', $output) ? ".$output" : "")); - } session_write_close(); return $return; } diff --git a/changes.txt b/changes.txt index 9a1fcb5e8..a4d16e165 100644 --- a/changes.txt +++ b/changes.txt @@ -14,6 +14,7 @@ PostgreSQL: improve PDO support in SQL command Oracle: schema, processlist, table overview numbers Simplify work with NULL values (customization) Use namespace in login form (customization) +Customizable export filename (customization) Replace JSMin by better JavaScript minifier Don't use AJAX links and forms Indonesian translation diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 1fc415743..f99e45f2e 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -508,6 +508,7 @@ function dumpData($table, $style, $query) { function dumpHeaders($identifier, $multi_table = false) { $ext = "csv"; header("Content-Type: text/csv; charset=utf-8"); + header("Content-Disposition: attachment; filename=" . friendly_url($identifier) . ".$ext"); return $ext; }