Downloaded file name
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@665 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
017ffb51fc
commit
82518960e9
|
@ -1,3 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
header("Content-Type: application/octet-stream");
|
header("Content-Type: application/octet-stream");
|
||||||
|
header("Content-Disposition: attachment; filename=" . friendly_url("$_GET[download]-" . implode("_", $_GET["where"])) . "." . friendly_url($_GET["field"]));
|
||||||
echo $dbh->result($dbh->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where($_GET)) . " LIMIT 1"));
|
echo $dbh->result($dbh->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where($_GET)) . " LIMIT 1"));
|
||||||
|
|
|
@ -164,7 +164,7 @@ function dump_data($table, $style, $from = "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
function dump_headers($identifier, $multi_table = false) {
|
function dump_headers($identifier, $multi_table = false) {
|
||||||
$filename = (strlen($identifier) ? preg_replace('~[^a-z0-9_]~i', '-', $identifier) : "dump");
|
$filename = (strlen($identifier) ? friendly_url($identifier) : "dump");
|
||||||
$ext = ($_POST["format"] == "sql" ? "sql" : ($multi_table ? "tar" : "csv"));
|
$ext = ($_POST["format"] == "sql" ? "sql" : ($multi_table ? "tar" : "csv"));
|
||||||
header("Content-Type: " . ($ext == "tar" ? "application/x-tar" : ($ext == "sql" || $_POST["output"] != "file" ? "text/plain" : "text/csv")) . "; charset=utf-8");
|
header("Content-Type: " . ($ext == "tar" ? "application/x-tar" : ($ext == "sql" || $_POST["output"] != "file" ? "text/plain" : "text/csv")) . "; charset=utf-8");
|
||||||
header("Content-Disposition: " . ($_POST["output"] == "file" ? "attachment" : "inline") . "; filename=$filename.$ext");
|
header("Content-Disposition: " . ($_POST["output"] == "file" ? "attachment" : "inline") . "; filename=$filename.$ext");
|
||||||
|
|
|
@ -200,7 +200,7 @@ function select($result, $dbh2 = null) {
|
||||||
$val = "<i>NULL</i>";
|
$val = "<i>NULL</i>";
|
||||||
} else {
|
} else {
|
||||||
if ($blobs[$key] && !is_utf8($val)) {
|
if ($blobs[$key] && !is_utf8($val)) {
|
||||||
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>";
|
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
|
||||||
} else {
|
} else {
|
||||||
$val = nl2br(htmlspecialchars($val));
|
$val = nl2br(htmlspecialchars($val));
|
||||||
if ($types[$key] == 254) {
|
if ($types[$key] == 254) {
|
||||||
|
@ -233,6 +233,10 @@ function shorten_utf8($string, $length) {
|
||||||
return nl2br(htmlspecialchars($match[1])) . ($match[2] ? "<em>...</em>" : "");
|
return nl2br(htmlspecialchars($match[1])) . ($match[2] ? "<em>...</em>" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function friendly_url($val) {
|
||||||
|
return preg_replace('~[^a-z0-9_]~i', '-', $val);
|
||||||
|
}
|
||||||
|
|
||||||
function hidden_fields($process, $ignore = array()) {
|
function hidden_fields($process, $ignore = array()) {
|
||||||
while (list($key, $val) = each($process)) {
|
while (list($key, $val) = each($process)) {
|
||||||
if (is_array($val)) {
|
if (is_array($val)) {
|
||||||
|
|
Loading…
Reference in a new issue