2 require_once(
'./Services/Utilities/classes/class.ilMimeTypeUtil.php');
3 require_once(
'./Services/Utilities/classes/class.ilUtil.php');
4 require_once(
'./Services/Context/classes/class.ilContext.php');
5 require_once(
'./Services/Http/classes/class.ilHTTPS.php');
6 require_once(
'./Services/WebAccessChecker/classes/class.ilHTTP.php');
7 require_once(
'./Services/WebAccessChecker/classes/class.ilWACLog.php');
33 self::DELIVERY_METHOD_XSENDFILE,
34 self::DELIVERY_METHOD_XACCEL,
120 $obj->setDisposition(self::DISP_ATTACHMENT);
135 $obj->setDisposition(self::DISP_INLINE);
150 $obj->setDisposition(self::DISP_INLINE);
174 if (!in_array($this->
getDeliveryType(), self::$self_streaming_methods)) {
182 $this->cleanDownloadFileName();
190 case self::DELIVERY_METHOD_XSENDFILE:
193 case self::DELIVERY_METHOD_XACCEL:
196 case self::DELIVERY_METHOD_PHP_CHUNKED:
199 case self::DELIVERY_METHOD_VIRTUAL:
202 case self::DELIVERY_METHOD_NONE;
222 && is_dir(
'./' . self::VIRTUAL_DATA)
224 $path_to_file = str_replace(
'./' . self::DATA .
'/',
'/' . self::VIRTUAL_DATA
233 $closure =
function () use ($realpath) {
234 header(
'X-Sendfile: ' . $realpath);
249 $path_to_file = str_replace(
'./' . self::DATA .
'/',
'/' . self::SECURED_DATA
294 header(
'Accept-Ranges: bytes');
300 header(
"Connection: close");
306 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
333 $finfo = finfo_open(FILEINFO_MIME_TYPE);
361 if (self::$delivery_type_static) {
368 if (function_exists(
'apache_get_modules')
369 && in_array(
'mod_xsendfile', apache_get_modules())
374 if (is_file(
'./Services/FileDelivery/classes/override.php')) {
375 $override_delivery_type =
false;
376 require_once(
'./Services/FileDelivery/classes/override.php');
377 if ($override_delivery_type) {
382 require_once(
'./Services/Environment/classes/class.ilRuntime.php');
384 if ((!$ilRuntime->isFPM() && !$ilRuntime->isHHVM())
612 $fp = @fopen(
$file,
'rb');
630 header(
"Accept-Ranges: 0-$length");
634 if (isset(
$_SERVER[
'HTTP_RANGE'])) {
639 list(, $range) = explode(
'=',
$_SERVER[
'HTTP_RANGE'], 2);
641 if (strpos($range,
',') !==
false) {
646 header(
"Content-Range: bytes $start-$end/$size");
653 if ($range{0} ==
'-') {
655 $c_start =
$size - substr($range, 1);
657 $range = explode(
'-', $range);
658 $c_start = $range[0];
659 $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] :
$size;
665 $c_end = ($c_end > $end) ? $end : $c_end;
667 if ($c_start > $c_end || $c_start >
$size - 1 || $c_end >=
$size) {
669 header(
"Content-Range: bytes $start-$end/$size");
676 $length = $end -
$start + 1;
682 header(
"Content-Range: bytes $start-$end/$size");
683 header(
"Content-Length: $length");
687 while (!feof($fp) && ($p = ftell($fp)) <= $end) {
688 if ($p + $buffer > $end) {
691 $buffer = $end - $p + 1;
695 echo fread($fp, $buffer);
726 if (!isset(
$_SERVER[
'HTTP_IF_NONE_MATCH']) || !isset(
$_SERVER[
'HTTP_IF_MODIFIED_SINCE'])) {
730 $http_if_none_match =
$_SERVER[
'HTTP_IF_NONE_MATCH'];
731 $http_if_modified_since =
$_SERVER[
'HTTP_IF_MODIFIED_SINCE'];
734 case ($http_if_none_match != $this->
getEtag()):
736 case (@strtotime($http_if_modified_since) <= filemtime($this->
getPathToFile())):
775 $ob_get_contents = ob_get_contents();
776 if ($ob_get_contents) {
794 public function cleanDownloadFileName() {
799 $ilClientIniFile = $DIC[
'ilClientIniFile'];
801 if ($ilClientIniFile instanceof
ilIniFile 802 && $ilClientIniFile->
readVariable(
'file_access',
'disable_ascii')
866 ignore_user_abort(
true);
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
setHasContext($has_context)
readVariable($a_group, $a_var_name)
reads a single variable from a group public
setPathToFile($path_to_file)
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=false)
$convert_file_name_to_asci
static deliverFileInline($path_to_file, $download_file_name=null)
setSendMimeType($send_mime_type)
setDeleteFile($delete_file)
deliverVirtual()
not supported
const DELIVERY_METHOD_NONE
__construct($path_to_file)
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
setUrlencodeFilename($urlencode_filename)
setDownloadFileName($download_file_name)
determineDownloadFileName()
static deliverFileAttached($path_to_file, $download_file_name=null, $mime_type=null, $delete_file=false)
setHashFilename($hash_filename)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
const DELIVERY_METHOD_PHP
setDeliveryType($delivery_type)
static returnASCIIFileName($original_name)
setDisposition($disposition)
Add a drawing to the header
Create styles array
The data for the language used.
const DELIVERY_METHOD_XSENDFILE
setExitAfter($exit_after)
const APPLICATION__OCTET_STREAM
const DELIVERY_METHOD_VIRTUAL
setConvertFileNameToAsci($convert_file_name_to_asci)
isConvertFileNameToAsci()
sendFileUnbufferedUsingHeaders(\Closure $closure)
const DELIVERY_METHOD_PHP_CHUNKED
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static getType()
Get context type.
const DELIVERY_METHOD_XACCEL
static $delivery_type_static
setShowLastModified($show_last_modified)
static $self_streaming_methods
static streamVideoInline($path_to_file, $download_file_name=null)