mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 01:24:17 +02:00
Plugin for including date in export filename
This commit is contained in:
@@ -716,6 +716,14 @@ DROP PROCEDURE adminer_alter;
|
||||
}
|
||||
}
|
||||
|
||||
/** Set export filename
|
||||
* @param string
|
||||
* @return string filename without extension
|
||||
*/
|
||||
function dumpFilename($identifier) {
|
||||
return friendly_url($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost"));
|
||||
}
|
||||
|
||||
/** Send headers for export
|
||||
* @param string
|
||||
* @param bool
|
||||
@@ -730,9 +738,6 @@ DROP PROCEDURE adminer_alter;
|
||||
($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);
|
||||
}
|
||||
|
@@ -803,6 +803,10 @@ 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=" . $adminer->dumpFilename($identifier) . ".$return" . ($output != "file" && !ereg('[^0-9a-z]', $output) ? ".$output" : ""));
|
||||
}
|
||||
session_write_close();
|
||||
return $return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user