Skip to content

Commit

Permalink
Customizable export filename
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Jun 29, 2012
1 parent 0d5543c commit 5b57706
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions adminer/include/adminer.inc.php
Expand Up @@ -730,6 +730,9 @@ function dumpHeaders($identifier, $multi_table = false) {
($ext == "tar" ? "application/x-tar" : ($ext == "tar" ? "application/x-tar" :
($ext == "sql" || $output != "file" ? "text/plain" : "text/csv") . "; charset=utf-8" ($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") { if ($output == "bz2") {
ob_start('bzcompress', 1e6); ob_start('bzcompress', 1e6);
} }
Expand Down
4 changes: 0 additions & 4 deletions adminer/include/functions.inc.php
Expand Up @@ -803,10 +803,6 @@ function search_tables() {
function dump_headers($identifier, $multi_table = false) { function dump_headers($identifier, $multi_table = false) {
global $adminer; global $adminer;
$return = $adminer->dumpHeaders($identifier, $multi_table); $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(); session_write_close();
return $return; return $return;
} }
Expand Down
1 change: 1 addition & 0 deletions changes.txt
Expand Up @@ -14,6 +14,7 @@ PostgreSQL: improve PDO support in SQL command
Oracle: schema, processlist, table overview numbers Oracle: schema, processlist, table overview numbers
Simplify work with NULL values (customization) Simplify work with NULL values (customization)
Use namespace in login form (customization) Use namespace in login form (customization)
Customizable export filename (customization)
Replace JSMin by better JavaScript minifier Replace JSMin by better JavaScript minifier
Don't use AJAX links and forms Don't use AJAX links and forms
Indonesian translation Indonesian translation
Expand Down
1 change: 1 addition & 0 deletions editor/include/adminer.inc.php
Expand Up @@ -508,6 +508,7 @@ function dumpData($table, $style, $query) {
function dumpHeaders($identifier, $multi_table = false) { function dumpHeaders($identifier, $multi_table = false) {
$ext = "csv"; $ext = "csv";
header("Content-Type: text/csv; charset=utf-8"); header("Content-Type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=" . friendly_url($identifier) . ".$ext");
return $ext; return $ext;
} }


Expand Down

0 comments on commit 5b57706

Please sign in to comment.