aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2006-10-10 21:20:57 +0000
committerrub <rub@piwigo.org>2006-10-10 21:20:57 +0000
commitec6f50bbfb505894529facef2f8c86c7336c7b63 (patch)
tree20953c0c014189a178e6f4eb536d365f7b5f9a6f
parente330841a319d4ae9935101821feab4fb119038b8 (diff)
Resolved Issue ID 0000556:
o Error on Save a High Definition Picture stored on distant site git-svn-id: http://piwigo.org/svn/branches/branch-1_6@1559 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--action.php29
1 files changed, 23 insertions, 6 deletions
diff --git a/action.php b/action.php
index 8aa29fe90..073cbd5ea 100644
--- a/action.php
+++ b/action.php
@@ -25,10 +25,28 @@
// | USA. |
// +-----------------------------------------------------------------------+
+define('PHPWG_ROOT_PATH','./');
+include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
+
+// Check Access and exit when user status is not ok
+check_status(ACCESS_GUEST);
+
function force_download ($filename)
{
//TODO : messages in "lang"
- $filename = realpath($filename);
+ if (!url_is_remote($filename))
+ {
+ $filename = realpath($filename);
+ if (!file_exists($filename))
+ {
+ die("NO FILE HERE");
+ }
+ $file_size = @filesize($filename);
+ }
+ else
+ {
+ $file_size = 0;
+ }
$file_extension = strtolower(substr(strrchr($filename,"."),1));
@@ -45,10 +63,6 @@ function force_download ($filename)
default: $ctype="application/octet-stream";
}
- if (!file_exists($filename)) {
- die("NO FILE HERE");
- }
-
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
@@ -57,7 +71,10 @@ function force_download ($filename)
header("Content-Disposition: attachment; filename=\""
.basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
- header("Content-Length: ".@filesize($filename));
+ if (isset($file_size) and ($file_size != 0))
+ {
+ header("Content-Length: ".@filesize($filename));
+ }
// Looking at the safe_mode configuration for execution time
if (ini_get('safe_mode') == 0)
{