Skip to content
Browse files

Customizable export filename

  • Loading branch information...
1 parent 0d5543c commit 5b577068901ab4d76c36c9845c7d485fa9560a0b @vrana committed Jun 29, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −0 adminer/include/adminer.inc.php
  2. +0 −4 adminer/include/functions.inc.php
  3. +1 −0 changes.txt
  4. +1 −0 editor/include/adminer.inc.php
View
3 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);
}
View
4 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;
}
View
1 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
View
1 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;
}

0 comments on commit 5b57706

Please sign in to comment.
Something went wrong with that request. Please try again.