diff --git a/download.inc.php b/download.inc.php index 1fd2179f..ff1f7862 100644 --- a/download.inc.php +++ b/download.inc.php @@ -1,3 +1,4 @@ result($dbh->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where($_GET)) . " LIMIT 1")); diff --git a/include/export.inc.php b/include/export.inc.php index 65b68f3a..f9fdf58d 100644 --- a/include/export.inc.php +++ b/include/export.inc.php @@ -164,7 +164,7 @@ function dump_data($table, $style, $from = "") { } 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")); 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"); diff --git a/include/functions.inc.php b/include/functions.inc.php index 1dc34933..330b06cf 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -200,7 +200,7 @@ function select($result, $dbh2 = null) { $val = "NULL"; } else { if ($blobs[$key] && !is_utf8($val)) { - $val = "" . lang('%d byte(s)', strlen($val)) . ""; + $val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download } else { $val = nl2br(htmlspecialchars($val)); if ($types[$key] == 254) { @@ -233,6 +233,10 @@ function shorten_utf8($string, $length) { return nl2br(htmlspecialchars($match[1])) . ($match[2] ? "..." : ""); } +function friendly_url($val) { + return preg_replace('~[^a-z0-9_]~i', '-', $val); +} + function hidden_fields($process, $ignore = array()) { while (list($key, $val) = each($process)) { if (is_array($val)) {