Changeset 1560 for trunk/action.php


Ignore:
Timestamp:
Oct 10, 2006, 11:23:06 PM (17 years ago)
Author:
rub
Message:

Resolved Issue ID 0000556:

o Error on Save a High Definition Picture stored on distant site

Merge branch-1_6 1558:1559 into BSF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/action.php

    r1552 r1560  
    2626// +-----------------------------------------------------------------------+
    2727
     28define('PHPWG_ROOT_PATH','./');
     29include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     30
     31// Check Access and exit when user status is not ok
     32check_status(ACCESS_GUEST);
     33
    2834function force_download ($filename)
    2935{
    3036//TODO : messages in "lang"
    31   $filename = realpath($filename);
     37  if (!url_is_remote($filename))
     38  {
     39    $filename = realpath($filename);
     40    if (!file_exists($filename))
     41    {
     42      die("NO FILE HERE");
     43    }
     44    $file_size = @filesize($filename);
     45  }
     46  else
     47  {
     48    $file_size = 0;
     49  }
    3250
    3351  $file_extension = strtolower(substr(strrchr($filename,"."),1));
     
    4664  }
    4765
    48   if (!file_exists($filename)) {
    49       die("NO FILE HERE");
    50   }
    51 
    5266  header("Pragma: public");
    5367  header("Expires: 0");
     
    5872         .basename($filename)."\";");
    5973  header("Content-Transfer-Encoding: binary");
    60   header("Content-Length: ".@filesize($filename));
     74  if (isset($file_size) and ($file_size != 0))
     75  {
     76    header("Content-Length: ".@filesize($filename));
     77  }
    6178
    6279  // Looking at the safe_mode configuration for execution time
Note: See TracChangeset for help on using the changeset viewer.