ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilWACPath Class Reference

Class ilWACPath. More...

+ Collaboration diagram for ilWACPath:

Public Member Functions

 __construct ($path)
 ilWACPath constructor. More...
 
 getDirName ()
 
 isImage ()
 
 isVideo ()
 
 isAudio ()
 
 isStreamable ()
 
 fileExists ()
 
 hasToken ()
 
 hasTimestamp ()
 
 hasTTL ()
 
 getToken ()
 
 setToken ($token)
 
 getTimestamp ()
 
 setTimestamp ($timestamp)
 
 getTTL ()
 
 setTTL ($ttl)
 
 getClient ()
 
 setClient ($client)
 
 getSecurePathId ()
 
 setSecurePathId ($secure_path_id)
 
 getPath ()
 
 setPath ($path)
 
 getSuffix ()
 
 setSuffix ($suffix)
 
 getQuery ()
 
 setQuery ($query)
 
 getParameters ()
 
 setParameters ($parameters)
 
 getFileName ()
 
 setFileName ($file_name)
 
 getOriginalRequest ()
 
 setOriginalRequest ($original_request)
 
 getPathWithoutQuery ()
 
 setPathWithoutQuery ($path_without_query)
 
 getSecurePath ()
 
 setSecurePath ($secure_path)
 
 isInSecFolder ()
 
 setInSecFolder ($in_sec_folder)
 

Static Public Member Functions

static getImageSuffixes ()
 
static setImageSuffixes ($image_suffixes)
 
static getVideoSuffixes ()
 
static setVideoSuffixes ($video_suffixes)
 

Data Fields

const DIR_DATA = "data"
 
const DIR_SEC = "sec"
 

Protected Member Functions

 handleParameters ()
 

Protected Attributes

 $client = ''
 
 $secure_path_id = ''
 
 $secure_path = ''
 
 $path = ''
 
 $suffix = ''
 
 $query = ''
 
 $parameters = array()
 
 $file_name = ''
 
 $original_request = ''
 
 $path_without_query = ''
 
 $in_sec_folder = false
 
 $token = ''
 
 $timestamp = 0
 
 $ttl = 0
 

Static Protected Attributes

static $image_suffixes
 
static $video_suffixes
 
static $audio_suffixes
 

Detailed Description

Class ilWACPath.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 9 of file class.ilWACPath.php.

Constructor & Destructor Documentation

◆ __construct()

ilWACPath::__construct (   $path)

ilWACPath constructor.

Parameters
string$path

Definition at line 105 of file class.ilWACPath.php.

References $path, $query, $results, handleParameters(), setClient(), setFileName(), setInSecFolder(), setOriginalRequest(), setParameters(), setPath(), setPathWithoutQuery(), setQuery(), setSecurePath(), setSecurePathId(), and setSuffix().

105  {
106  $this->setOriginalRequest($path);
107 
108  $regex_client = "[\\w-\\.]*";
109 
110  preg_match("/\\/" . self::DIR_DATA . "\\/({$regex_client})\\/(" . self::DIR_SEC . "\\/|)([\\w]*)\\/(.*)/ui", $path, $results);
111  preg_match("/(\\/" . self::DIR_DATA . "\\/{$regex_client}\\/[\\w]*\\/.*)\\?/ui", $path, $results2);
112  $this->setPathWithoutQuery(isset($results2[1]) ? '.' . $results2[1] : '.' . $results[0]);
113  $this->setPath('.' . $results[0]);
114  $this->setClient($results[1]);
115  $this->setInSecFolder($results[2] == 'sec/');
116  $this->setSecurePathId($results[3]);
117  $parts = parse_url($path);
118  $this->setFileName(basename($parts['path']));
119  if (isset($parts['query'])) {
120  $parts_query = $parts['query'];
121  $this->setQuery($parts_query);
122  parse_str($parts_query, $query);
123  $this->setParameters($query);
124  }
125  $this->setSuffix(pathinfo($parts['path'], PATHINFO_EXTENSION));
126  preg_match("/\\/" . self::DIR_DATA . "\\/({$regex_client})\\/(" . self::DIR_SEC
127  . "\\/[\\w]*\\/[\\d]*\\/|[\\w]*\\/)([\\w]*)\\//ui", $path, $results3);
128  $this->setSecurePath(isset($results3[0]) ? '.' . $results3[0] : null);
129  $this->handleParameters();
130  }
setPathWithoutQuery($path_without_query)
setQuery($query)
setClient($client)
setSuffix($suffix)
setSecurePath($secure_path)
$results
setParameters($parameters)
setSecurePathId($secure_path_id)
setFileName($file_name)
setOriginalRequest($original_request)
setInSecFolder($in_sec_folder)
+ Here is the call graph for this function:

Member Function Documentation

◆ fileExists()

ilWACPath::fileExists ( )
Returns
bool

Definition at line 190 of file class.ilWACPath.php.

References getPathWithoutQuery().

190  {
191  return is_file($this->getPathWithoutQuery());
192  }
+ Here is the call graph for this function:

◆ getClient()

ilWACPath::getClient ( )
Returns
string

Definition at line 273 of file class.ilWACPath.php.

References $client.

273  {
274  return $this->client;
275  }

◆ getDirName()

ilWACPath::getDirName ( )
Returns
string

Definition at line 150 of file class.ilWACPath.php.

References getPathWithoutQuery().

150  {
151  return dirname($this->getPathWithoutQuery());
152  }
+ Here is the call graph for this function:

◆ getFileName()

ilWACPath::getFileName ( )
Returns
string

Definition at line 369 of file class.ilWACPath.php.

References $file_name.

Referenced by ilObjUserAccess\canBeDelivered().

369  {
370  return $this->file_name;
371  }
+ Here is the caller graph for this function:

◆ getImageSuffixes()

static ilWACPath::getImageSuffixes ( )
static
Returns
array

Definition at line 401 of file class.ilWACPath.php.

401  {
402  return self::$image_suffixes;
403  }

◆ getOriginalRequest()

ilWACPath::getOriginalRequest ( )
Returns
string

Definition at line 385 of file class.ilWACPath.php.

References $original_request.

385  {
387  }

◆ getParameters()

ilWACPath::getParameters ( )
Returns
array

Definition at line 353 of file class.ilWACPath.php.

References $parameters.

Referenced by handleParameters().

353  {
354  return $this->parameters;
355  }
+ Here is the caller graph for this function:

◆ getPath()

◆ getPathWithoutQuery()

ilWACPath::getPathWithoutQuery ( )
Returns
string

Definition at line 433 of file class.ilWACPath.php.

References $path_without_query.

Referenced by fileExists(), and getDirName().

433  {
435  }
+ Here is the caller graph for this function:

◆ getQuery()

ilWACPath::getQuery ( )
Returns
string

Definition at line 337 of file class.ilWACPath.php.

References $query.

337  {
338  return $this->query;
339  }

◆ getSecurePath()

ilWACPath::getSecurePath ( )
Returns
string

Definition at line 449 of file class.ilWACPath.php.

References $secure_path.

449  {
450  return $this->secure_path;
451  }

◆ getSecurePathId()

ilWACPath::getSecurePathId ( )
Returns
string

Definition at line 289 of file class.ilWACPath.php.

References $secure_path_id.

Referenced by ilObjFileAccess\canBeDelivered(), and ilWACSecurePath\returnDbTableName().

289  {
290  return $this->secure_path_id;
291  }
+ Here is the caller graph for this function:

◆ getSuffix()

ilWACPath::getSuffix ( )
Returns
string

Definition at line 321 of file class.ilWACPath.php.

References $suffix.

Referenced by isAudio(), isImage(), and isVideo().

321  {
322  return $this->suffix;
323  }
+ Here is the caller graph for this function:

◆ getTimestamp()

ilWACPath::getTimestamp ( )
Returns
int

Definition at line 239 of file class.ilWACPath.php.

References $timestamp.

239  {
240  return $this->timestamp;
241  }

◆ getToken()

ilWACPath::getToken ( )
Returns
string

Definition at line 222 of file class.ilWACPath.php.

References $token.

222  {
223  return $this->token;
224  }

◆ getTTL()

ilWACPath::getTTL ( )
Returns
int

Definition at line 256 of file class.ilWACPath.php.

References $ttl.

256  {
257  return $this->ttl;
258  }

◆ getVideoSuffixes()

static ilWACPath::getVideoSuffixes ( )
static
Returns
array

Definition at line 417 of file class.ilWACPath.php.

417  {
418  return self::$video_suffixes;
419  }

◆ handleParameters()

ilWACPath::handleParameters ( )
protected

Definition at line 133 of file class.ilWACPath.php.

References getParameters(), setTimestamp(), setToken(), setTTL(), ilWACSignedPath\WAC_TIMESTAMP_ID, ilWACSignedPath\WAC_TOKEN_ID, and ilWACSignedPath\WAC_TTL_ID.

Referenced by __construct().

133  {
134  $param = $this->getParameters();
135  if (isset($param[ilWACSignedPath::WAC_TOKEN_ID])) {
136  $this->setToken($param[ilWACSignedPath::WAC_TOKEN_ID]);
137  }
138  if (isset($param[ilWACSignedPath::WAC_TIMESTAMP_ID])) {
139  $this->setTimestamp($param[ilWACSignedPath::WAC_TIMESTAMP_ID]);
140  }
141  if (isset($param[ilWACSignedPath::WAC_TTL_ID])) {
142  $this->setTTL($param[ilWACSignedPath::WAC_TTL_ID]);
143  }
144  }
setToken($token)
setTimestamp($timestamp)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasTimestamp()

ilWACPath::hasTimestamp ( )
Returns
bool

Definition at line 206 of file class.ilWACPath.php.

206  {
207  return ($this->timestamp != 0);
208  }

◆ hasToken()

ilWACPath::hasToken ( )
Returns
bool

Definition at line 198 of file class.ilWACPath.php.

198  {
199  return ($this->token != '');
200  }

◆ hasTTL()

ilWACPath::hasTTL ( )
Returns
bool

Definition at line 214 of file class.ilWACPath.php.

214  {
215  return ($this->ttl != 0);
216  }

◆ isAudio()

ilWACPath::isAudio ( )
Returns
bool

Definition at line 174 of file class.ilWACPath.php.

References getSuffix().

Referenced by isStreamable().

174  {
175  return in_array(strtolower($this->getSuffix()), self::$audio_suffixes);
176  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isImage()

ilWACPath::isImage ( )
Returns
bool

Definition at line 158 of file class.ilWACPath.php.

References getSuffix().

158  {
159  return in_array(strtolower($this->getSuffix()), self::$image_suffixes);
160  }
+ Here is the call graph for this function:

◆ isInSecFolder()

ilWACPath::isInSecFolder ( )
Returns
boolean

Definition at line 465 of file class.ilWACPath.php.

References $in_sec_folder.

465  {
466  return $this->in_sec_folder;
467  }

◆ isStreamable()

ilWACPath::isStreamable ( )
Returns
bool

Definition at line 182 of file class.ilWACPath.php.

References isAudio(), and isVideo().

182  {
183  return ($this->isAudio() || $this->isVideo());
184  }
+ Here is the call graph for this function:

◆ isVideo()

ilWACPath::isVideo ( )
Returns
bool

Definition at line 166 of file class.ilWACPath.php.

References getSuffix().

Referenced by isStreamable().

166  {
167  return in_array(strtolower($this->getSuffix()), self::$video_suffixes);
168  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setClient()

ilWACPath::setClient (   $client)
Parameters
string$client

Definition at line 281 of file class.ilWACPath.php.

References $client.

Referenced by __construct().

281  {
282  $this->client = $client;
283  }
+ Here is the caller graph for this function:

◆ setFileName()

ilWACPath::setFileName (   $file_name)
Parameters
string$file_name

Definition at line 377 of file class.ilWACPath.php.

References $file_name.

Referenced by __construct().

377  {
378  $this->file_name = $file_name;
379  }
+ Here is the caller graph for this function:

◆ setImageSuffixes()

static ilWACPath::setImageSuffixes (   $image_suffixes)
static
Parameters
array$image_suffixes

Definition at line 409 of file class.ilWACPath.php.

References $image_suffixes.

409  {
410  self::$image_suffixes = $image_suffixes;
411  }
static $image_suffixes

◆ setInSecFolder()

ilWACPath::setInSecFolder (   $in_sec_folder)
Parameters
boolean$in_sec_folder

Definition at line 473 of file class.ilWACPath.php.

References $in_sec_folder.

Referenced by __construct().

473  {
474  $this->in_sec_folder = $in_sec_folder;
475  }
+ Here is the caller graph for this function:

◆ setOriginalRequest()

ilWACPath::setOriginalRequest (   $original_request)
Parameters
string$original_request

Definition at line 393 of file class.ilWACPath.php.

References $original_request.

Referenced by __construct().

393  {
394  $this->original_request = $original_request;
395  }
+ Here is the caller graph for this function:

◆ setParameters()

ilWACPath::setParameters (   $parameters)
Parameters
array$parameters

Definition at line 361 of file class.ilWACPath.php.

References $parameters.

Referenced by __construct().

361  {
362  $this->parameters = $parameters;
363  }
+ Here is the caller graph for this function:

◆ setPath()

ilWACPath::setPath (   $path)
Parameters
string$path

Definition at line 313 of file class.ilWACPath.php.

References $path.

Referenced by __construct().

313  {
314  $this->path = $path;
315  }
+ Here is the caller graph for this function:

◆ setPathWithoutQuery()

ilWACPath::setPathWithoutQuery (   $path_without_query)
Parameters
string$path_without_query

Definition at line 441 of file class.ilWACPath.php.

References $path_without_query.

Referenced by __construct().

441  {
442  $this->path_without_query = $path_without_query;
443  }
+ Here is the caller graph for this function:

◆ setQuery()

ilWACPath::setQuery (   $query)
Parameters
string$query

Definition at line 345 of file class.ilWACPath.php.

References $query.

Referenced by __construct().

345  {
346  $this->query = $query;
347  }
+ Here is the caller graph for this function:

◆ setSecurePath()

ilWACPath::setSecurePath (   $secure_path)
Parameters
string$secure_path

Definition at line 457 of file class.ilWACPath.php.

References $secure_path.

Referenced by __construct().

457  {
458  $this->secure_path = $secure_path;
459  }
+ Here is the caller graph for this function:

◆ setSecurePathId()

ilWACPath::setSecurePathId (   $secure_path_id)
Parameters
string$secure_path_id

Definition at line 297 of file class.ilWACPath.php.

References $secure_path_id.

Referenced by __construct().

297  {
298  $this->secure_path_id = $secure_path_id;
299  }
+ Here is the caller graph for this function:

◆ setSuffix()

ilWACPath::setSuffix (   $suffix)
Parameters
string$suffix

Definition at line 329 of file class.ilWACPath.php.

References $suffix.

Referenced by __construct().

329  {
330  $this->suffix = $suffix;
331  }
+ Here is the caller graph for this function:

◆ setTimestamp()

ilWACPath::setTimestamp (   $timestamp)
Parameters
$timestamp

Definition at line 247 of file class.ilWACPath.php.

References $timestamp, and ilWACSignedPath\WAC_TIMESTAMP_ID.

Referenced by handleParameters().

247  {
248  $this->parameters[ilWACSignedPath::WAC_TIMESTAMP_ID] = $timestamp;
249  $this->timestamp = $timestamp;
250  }
+ Here is the caller graph for this function:

◆ setToken()

ilWACPath::setToken (   $token)
Parameters
$token

Definition at line 230 of file class.ilWACPath.php.

References $token, and ilWACSignedPath\WAC_TOKEN_ID.

Referenced by handleParameters().

230  {
231  $this->parameters[ilWACSignedPath::WAC_TOKEN_ID] = $token;
232  $this->token = $token;
233  }
+ Here is the caller graph for this function:

◆ setTTL()

ilWACPath::setTTL (   $ttl)
Parameters
int$ttl

Definition at line 264 of file class.ilWACPath.php.

References $ttl, and ilWACSignedPath\WAC_TTL_ID.

Referenced by handleParameters().

264  {
265  $this->parameters[ilWACSignedPath::WAC_TTL_ID] = $ttl;
266  $this->ttl = $ttl;
267  }
+ Here is the caller graph for this function:

◆ setVideoSuffixes()

static ilWACPath::setVideoSuffixes (   $video_suffixes)
static
Parameters
array$video_suffixes

Definition at line 425 of file class.ilWACPath.php.

References $video_suffixes.

425  {
426  self::$video_suffixes = $video_suffixes;
427  }
static $video_suffixes

Field Documentation

◆ $audio_suffixes

ilWACPath::$audio_suffixes
staticprotected
Initial value:
= array(
'mp3',
'aiff',
'aif',
'wav',
)

Definition at line 92 of file class.ilWACPath.php.

◆ $client

ilWACPath::$client = ''
protected

Definition at line 16 of file class.ilWACPath.php.

Referenced by getClient(), and setClient().

◆ $file_name

ilWACPath::$file_name = ''
protected

Definition at line 44 of file class.ilWACPath.php.

Referenced by getFileName(), and setFileName().

◆ $image_suffixes

ilWACPath::$image_suffixes
staticprotected
Initial value:
= array(
'png',
'jpg',
'jpeg',
'gif',
'svg',
)

Definition at line 72 of file class.ilWACPath.php.

Referenced by setImageSuffixes().

◆ $in_sec_folder

ilWACPath::$in_sec_folder = false
protected

Definition at line 56 of file class.ilWACPath.php.

Referenced by isInSecFolder(), and setInSecFolder().

◆ $original_request

ilWACPath::$original_request = ''
protected

Definition at line 48 of file class.ilWACPath.php.

Referenced by getOriginalRequest(), and setOriginalRequest().

◆ $parameters

ilWACPath::$parameters = array()
protected

Definition at line 40 of file class.ilWACPath.php.

Referenced by getParameters(), and setParameters().

◆ $path

ilWACPath::$path = ''
protected

Definition at line 28 of file class.ilWACPath.php.

Referenced by __construct(), getPath(), and setPath().

◆ $path_without_query

ilWACPath::$path_without_query = ''
protected

Definition at line 52 of file class.ilWACPath.php.

Referenced by getPathWithoutQuery(), and setPathWithoutQuery().

◆ $query

ilWACPath::$query = ''
protected

Definition at line 36 of file class.ilWACPath.php.

Referenced by __construct(), getQuery(), and setQuery().

◆ $secure_path

ilWACPath::$secure_path = ''
protected

Definition at line 24 of file class.ilWACPath.php.

Referenced by getSecurePath(), and setSecurePath().

◆ $secure_path_id

ilWACPath::$secure_path_id = ''
protected

Definition at line 20 of file class.ilWACPath.php.

Referenced by getSecurePathId(), and setSecurePathId().

◆ $suffix

ilWACPath::$suffix = ''
protected

Definition at line 32 of file class.ilWACPath.php.

Referenced by getSuffix(), and setSuffix().

◆ $timestamp

ilWACPath::$timestamp = 0
protected

Definition at line 64 of file class.ilWACPath.php.

Referenced by getTimestamp(), and setTimestamp().

◆ $token

ilWACPath::$token = ''
protected

Definition at line 60 of file class.ilWACPath.php.

Referenced by getToken(), and setToken().

◆ $ttl

ilWACPath::$ttl = 0
protected

Definition at line 68 of file class.ilWACPath.php.

Referenced by getTTL(), and setTTL().

◆ $video_suffixes

ilWACPath::$video_suffixes
staticprotected
Initial value:
= array(
'mp4',
'm4v',
'mov',
'wmv',
'webm',
)

Definition at line 82 of file class.ilWACPath.php.

Referenced by setVideoSuffixes().

◆ DIR_DATA

const ilWACPath::DIR_DATA = "data"

Definition at line 11 of file class.ilWACPath.php.

◆ DIR_SEC

const ilWACPath::DIR_SEC = "sec"

Definition at line 12 of file class.ilWACPath.php.


The documentation for this class was generated from the following file: