summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerry Weißbach <gerry.w@gammaproduction.de>2014-01-27 10:22:37 +0100
committerGerry Weißbach <gerry.w@gammaproduction.de>2014-01-27 10:22:37 +0100
commit2fd6745d5fd3a6b5b4b5a0a1952826095e35dac7 (patch)
tree121d044e5979b6a18ea197bbfb7ab733b7e0c75d
parenta0e46368e9ad87d959bd921504ced42bc3d5b4bc (diff)
downloadrpg-2fd6745d5fd3a6b5b4b5a0a1952826095e35dac7.tar.gz
rpg-2fd6745d5fd3a6b5b4b5a0a1952826095e35dac7.tar.bz2
Re-order parameters to not break other callers
Needs a check for null now.
-rw-r--r--inc/fetch.functions.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php
index d36407848..3eacaa2fe 100644
--- a/inc/fetch.functions.php
+++ b/inc/fetch.functions.php
@@ -17,13 +17,13 @@
* @author Ben Coburn <btcoburn@silicodon.net>
* @author Gerry Weissbach <dokuwiki@gammaproduction.de>
* @param string $file local file to send
- * @param string $orig original file to send - the file name will be used for the Content-Disposition
* @param string $mime mime type of the file
* @param bool $dl set to true to force a browser download
* @param int $cache remaining cache time in seconds (-1 for $conf['cache'], 0 for no-cache)
* @param bool $public is this a public ressource or a private one?
+ * @param string $orig original file to send - the file name will be used for the Content-Disposition
*/
-function sendFile($file, $orig, $mime, $dl, $cache, $public = false) {
+function sendFile($file, $mime, $dl, $cache, $public = false, $orig = null) {
global $conf;
// send mime headers
header("Content-Type: $mime");
@@ -64,6 +64,11 @@ function sendFile($file, $orig, $mime, $dl, $cache, $public = false) {
$fmtime = @filemtime($file);
http_conditionalRequest($fmtime);
+ // Use the current $file if is $orig is not set.
+ if ( $orig == null ) {
+ $orig = $file;
+ }
+
//download or display?
if($dl) {
header('Content-Disposition: attachment; filename="'.utf8_basename($orig).'";');