33 public const REGEX =
"(?<prefix>.*?)(?<path>(?<path_without_query>(?<secure_path_id>(?<module_path>\/data\/(?<client>[\w\-\.]*)\/(?<sec>sec\/|)(?<module_type>.*?)\/(?<module_identifier>.*\/|)))(?<appendix>[^\?\n]*)).*)";
93 $re =
'/' . self::REGEX .
'/';
94 preg_match($re, $path, $result);
96 $result[
'path_without_query'] = strstr(
97 parse_url($path)[
'path'],
103 foreach (array_keys(array_keys($result)) as $k) {
104 if (is_numeric($k)) {
110 !isset($result[
'module_identifier']) || is_null($result[
'module_identifier']) ?
'' : $result[
'module_identifier'],
114 $moduleId = $moduleId ===
false ?
'' : $moduleId;
116 $this->
setPrefix(!isset($result[
'prefix']) || is_null($result[
'prefix']) ?
'' : $result[
'prefix']);
117 $this->
setClient(!isset($result[
'client']) || is_null($result[
'client']) ?
'' : $result[
'client']);
118 $this->
setAppendix(!isset($result[
'appendix']) || is_null($result[
'appendix']) ?
'' : $result[
'appendix']);
120 $this->
setModuleType(!isset($result[
'module_type']) || is_null($result[
'module_type']) ?
'' : $result[
'module_type']);
123 $module_path = strstr(
124 !isset($result[
'module_path']) || is_null($result[
'module_path']) ?
'' : $result[
'module_path'],
128 $module_path =
'.' . ($module_path ===
false ?
'' :
$module_path);
130 $module_path = (
'.' . (!isset($result[
'module_path']) || is_null($result[
'module_path']) ?
'' : $result[
'module_path']));
134 $this->
setInSecFolder(isset($result[
'sec']) && $result[
'sec'] ===
'sec/');
136 '.' . (!isset($result[
'path_without_query']) || is_null($result[
'path_without_query']) ?
'' : $result[
'path_without_query'])
138 $this->
setPath(
'.' . (!isset($result[
'path']) || is_null($result[
'path']) ?
'' : $result[
'path']));
140 '.' . (!isset($result[
'secure_path_id']) || is_null($result[
'secure_path_id']) ?
'' : $result[
'secure_path_id'])
142 $this->
setSecurePathId(!isset($result[
'module_type']) || is_null($result[
'module_type']) ?
'' : $result[
'module_type']);
144 $parts = parse_url($path);
146 if (isset(
$parts[
'query'])) {
147 $parts_query =
$parts[
'query'];
149 parse_str($parts_query, $query);
166 $this->
setTTL((
int)
$param[ilWACSignedPath::WAC_TTL_ID]);
191 return self::$audio_suffixes;
207 return self::$image_suffixes;
223 return self::$video_suffixes;
236 $path = ltrim($path,
'.');
237 $path = rawurldecode($path);
240 $path = strstr($path,
'/' . self::DIR_DATA .
'/') ?:
$path;
241 $path = ltrim($path,
'/');
243 $original_path = parse_url($path, PHP_URL_PATH);
244 $query = parse_url($path, PHP_URL_QUERY);
246 $real_data_dir = realpath(
"./" . self::DIR_DATA);
247 $realpath = realpath(
"./" . $original_path);
249 if (!str_starts_with($realpath, $real_data_dir)) {
253 $normalized_path = ltrim(
262 return "/" . self::DIR_DATA .
'/' . $normalized_path . (empty($query) ?
'' :
'?' .
$query);
312 return in_array(strtolower($this->
getSuffix()), self::$image_suffixes);
335 return in_array(strtolower($this->
getSuffix()), self::$audio_suffixes);
340 return in_array(strtolower($this->
getSuffix()), self::$video_suffixes);
350 return ($this->token !==
'');
355 return ($this->timestamp !== 0);
360 return ($this->ttl !== 0);
427 return rawurldecode($string);
static array $video_suffixes
setOriginalRequest(string $original_request)
setClient(string $client)
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
static setAudioSuffixes(array $audio_suffixes)
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
string $module_identifier
static setVideoSuffixes(array $video_suffixes)
setParameters(array $parameters)
setModulePath(string $module_path)
static array $audio_suffixes
setPathWithoutQuery(string $path_without_query)
string $path_without_query
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAudioSuffixes()
setSecurePath(string $secure_path)
__construct(string $path)
setTimestamp(int $timestamp)
setSuffix(string $suffix)
static getVideoSuffixes()
static setImageSuffixes(array $image_suffixes)
normalizePath(string $path)
static getImageSuffixes()
setAppendix(string $appendix)
setInSecFolder(bool $in_sec_folder)
setPrefix(string $prefix)
client()
description: > This example shows how a Progress Bar can be rendered and used on the client...
const REGEX
Copy this without to regex101.com and test with some URL of files.
setSecurePathId(string $secure_path_id)
getCleanURLdecodedPath()
Returns a clean (everything behind ? is removed and rawurldecoded path.
setModuleIdentifier(string $module_identifier)
setModuleType(string $module_type)
static array $image_suffixes
setFileName(string $file_name)