19declare(strict_types=1);
84 $this->resource = $input;
85 $this->path_to_file = $input->getMetadata(
'uri');
86 } elseif ($input === self::DIRECT_PHP_OUTPUT) {
103 if (!$this->
delivery()->supportsStreaming()) {
123 !$this->
delivery()->doesFileExists($this->path_to_file)
124 && $this->path_to_file !== self::DIRECT_PHP_OUTPUT
128 $this->
http->sendResponse();
192 $this->
http->close();
204 $finfo = finfo_open(FILEINFO_MIME_TYPE);
226 if (self::$delivery_type_static) {
232 if (function_exists(
'apache_get_modules')
233 && in_array(
'mod_xsendfile', apache_get_modules(),
true)
242 if (is_file(
'./components/ILIAS/FileDelivery/classes/override.php')) {
243 $override_delivery_type =
false;
245 require_once(
'./components/ILIAS/FileDelivery/classes/override.php');
246 if ($override_delivery_type) {
251 if ((!$ilRuntime->isFPM() && !$ilRuntime->isHHVM())
473 $ob_get_contents = ob_get_contents();
474 if ($ob_get_contents) {
480 }
catch (\Throwable) {
524 foreach ($umlaut_mapping as $src => $tgt) {
525 $original_filename = str_replace($src, $tgt, $original_filename);
528 $ascii_filename = htmlentities($original_filename, ENT_NOQUOTES,
'UTF-8');
529 $ascii_filename = preg_replace(
'/\&(.)[^;]*;/',
'\\1', $ascii_filename);
530 $ascii_filename = preg_replace(
'/[\x7f-\xff]/',
'_', (
string) $ascii_filename);
533 $ascii_filename = preg_replace(
534 '/[:\x5c\/\*\?\"<>\|]/',
536 (
string) $ascii_filename
538 return $ascii_filename;
static string $delivery_type_static
__construct($input, private Services $http)
setSendMimeType(bool $send_mime_type)
FileDeliveryTypeFactory $factory
cleanDownloadFileName()
Converts the filename to ASCII.
string $download_file_name
bool $convert_file_name_to_asci
setExitAfter(bool $exit_after)
setConvertFileNameToAsci(bool $convert_file_name_to_asci)
setShowLastModified(bool $show_last_modified)
static setDEBUG(bool $DEBUG)
setMimeType(string $mime_type)
setDisposition(string $disposition)
setHasContext(bool $has_context)
setHashFilename(bool $hash_filename)
isConvertFileNameToAsci()
setDeliveryType(string $delivery_type)
setPathToFile(string $path_to_file)
determineDownloadFileName()
static returnASCIIFileName(string $original_filename)
Converts a UTF-8 filename to ASCII.
setDeleteFile(bool $delete_file)
setDownloadFileName(string $download_file_name)
Class FileDeliveryTypeFactory.
const APPLICATION__OCTET_STREAM
static lookupMimeType(string $path_to_file, string $fallback=self::APPLICATION__OCTET_STREAM, bool $a_external=false)
static getType()
Get context type.
Interface ilFileDeliveryType.
The base interface for all filesystem streams.
static http()
Fetches the global http state from ILIAS.