ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilWebAccessCheckerDelivery Class Reference

Class ilWebAccessCheckerDelivery. More...

+ Collaboration diagram for ilWebAccessCheckerDelivery:

Public Member Functions

 __construct ($raw_path)
 ilWebAccessCheckerDelivery constructor. More...
 

Static Public Member Functions

static run ($raw_path)
 

Protected Member Functions

 handleRequest ()
 
 deny ()
 
 deliverDummyImage ()
 
 deliverDummyVideo ()
 
 handleAccessErrors (ilWACException $e)
 
 handleErrors (ilWACException $e)
 
 deliver ()
 

Protected Attributes

 $ilWebAccessChecker = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebAccessCheckerDelivery::__construct (   $raw_path)

ilWebAccessCheckerDelivery constructor.

Parameters
string$raw_path

Definition at line 33 of file class.ilWebAccessCheckerDelivery.php.

33  {
34  $this->ilWebAccessChecker = new ilWebAccessChecker(rawurldecode($raw_path));
35  }
Class ilWebAccessChecker.

Member Function Documentation

◆ deliver()

ilWebAccessCheckerDelivery::deliver ( )
protected

Definition at line 138 of file class.ilWebAccessCheckerDelivery.php.

References ilWACException\ACCESS_WITHOUT_CHECK, ilWebAccessChecker\getDisposition(), ilWACLog\getInstance(), ilWebAccessChecker\getPathObject(), ilWebAccessChecker\isChecked(), and ilFileDelivery\setCache().

Referenced by handleRequest().

138  {
139  if (!$this->ilWebAccessChecker->isChecked()) {
141  }
142 
143  $ilFileDelivery = new ilFileDelivery($this->ilWebAccessChecker->getPathObject()->getPath());
144  $ilFileDelivery->setCache(false);
145  $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
146  ilWACLog::getInstance()->write('Deliver file using ' . $ilFileDelivery->getDeliveryType());
147  if ($this->ilWebAccessChecker->getPathObject()->isStreamable()) { // fixed 0016468
148  ilWACLog::getInstance()->write('begin streaming');
149  $ilFileDelivery->stream();
150  } else {
151  $ilFileDelivery->deliver();
152  }
153  }
Class ilWACException.
static getInstance()
Class ilWebAccessChecker.
Class ilFileDelivery.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverDummyImage()

ilWebAccessCheckerDelivery::deliverDummyImage ( )
protected

Definition at line 86 of file class.ilWebAccessCheckerDelivery.php.

References ilWebAccessChecker\getDisposition(), ilWebAccessChecker\getPathObject(), and ilFileDelivery\setDisposition().

Referenced by handleAccessErrors().

86  {
87  $ilFileDelivery = new ilFileDelivery('./Services/WebAccessChecker/templates/images/access_denied.png', $this->ilWebAccessChecker->getPathObject()
88  ->getFileName());
89  $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
90  $ilFileDelivery->deliver();
91  }
Class ilWebAccessChecker.
setDisposition($disposition)
Class ilFileDelivery.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverDummyVideo()

ilWebAccessCheckerDelivery::deliverDummyVideo ( )
protected

Definition at line 94 of file class.ilWebAccessCheckerDelivery.php.

References ilWebAccessChecker\getDisposition(), ilWebAccessChecker\getPathObject(), and ilFileDelivery\setDisposition().

Referenced by handleAccessErrors().

94  {
95  $ilFileDelivery = new ilFileDelivery('./Services/WebAccessChecker/templates/images/access_denied.mp4', $this->ilWebAccessChecker->getPathObject()
96  ->getFileName());
97  $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
98  $ilFileDelivery->stream();
99  }
Class ilWebAccessChecker.
setDisposition($disposition)
Class ilFileDelivery.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deny()

ilWebAccessCheckerDelivery::deny ( )
protected

Definition at line 78 of file class.ilWebAccessCheckerDelivery.php.

References ilWACException\ACCESS_DENIED, ilWACException\ACCESS_WITHOUT_CHECK, and ilWebAccessChecker\isChecked().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAccessErrors()

ilWebAccessCheckerDelivery::handleAccessErrors ( ilWACException  $e)
protected
Parameters
ilWACException$e

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

References $_SERVER, $ilLog, $tpl, deliverDummyImage(), deliverDummyVideo(), ilWebAccessChecker\getPathObject(), ilWebAccessChecker\initILIAS(), ilWebAccessChecker\isSendStatusCode(), ilUtil\sendFailure(), and ilHTTP\status().

Referenced by handleRequest().

105  {
106  if ($this->ilWebAccessChecker->isSendStatusCode()) {
107  ilHTTP::status(401);
108  }
109  if ($this->ilWebAccessChecker->getPathObject()->isImage()) {
110  $this->deliverDummyImage();
111  }
112  if ($this->ilWebAccessChecker->getPathObject()->isVideo()) {
113  $this->deliverDummyVideo();
114  }
115  try {
116  $this->ilWebAccessChecker->initILIAS();
117  } catch (ilWACException $ilWACException) {
118  }
119 
120  global $tpl, $ilLog;
121  $ilLog->write($e->getMessage());
122  $tpl->setVariable('BASE', strstr($_SERVER['REQUEST_URI'], '/data', true) . '/');
123  ilUtil::sendFailure($e->getMessage());
124  $tpl->getStandardTemplate();
125  $tpl->show();
126  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
Class ilWACException.
static status($status)
global $tpl
Definition: ilias.php:8
Class ilWebAccessChecker.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleErrors()

ilWebAccessCheckerDelivery::handleErrors ( ilWACException  $e)
protected
Parameters
ilWACException$e

Definition at line 132 of file class.ilWebAccessCheckerDelivery.php.

References ilHTTP\status().

Referenced by handleRequest().

132  {
133  ilHTTP::status(500);
134  echo $e->getMessage();
135  }
static status($status)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRequest()

ilWebAccessCheckerDelivery::handleRequest ( )
protected

Definition at line 38 of file class.ilWebAccessCheckerDelivery.php.

References $_GET, ilWACException\ACCESS_DENIED, ilWACException\ACCESS_DENIED_NO_LOGIN, ilWACException\ACCESS_DENIED_NO_PUB, ilWACException\ACCESS_WITHOUT_CHECK, ilWebAccessChecker\check(), deliver(), deny(), ilWebAccessChecker\DISPOSITION, handleAccessErrors(), ilInitialisation\handleErrorReporting(), handleErrors(), ilWACException\INITIALISATION_FAILED, ilWACException\NO_CHECKING_INSTANCE, ilWebAccessChecker\REVALIDATE, ilWebAccessChecker\setDisposition(), ilWebAccessChecker\setRevalidateFolderTokens(), ilWebAccessChecker\setSendStatusCode(), and ilWebAccessChecker\STATUS_CODE.

38  {
39  // Set errorreporting
41 
42  // Set customizing
44  $this->ilWebAccessChecker->setDisposition($_GET[ilWebAccessChecker::DISPOSITION]);
45  }
47  $this->ilWebAccessChecker->setSendStatusCode($_GET[ilWebAccessChecker::STATUS_CODE]);
48  }
50  $this->ilWebAccessChecker->setRevalidateFolderTokens($_GET[ilWebAccessChecker::REVALIDATE]);
51  }
52 
53  // Check if File can be delivered
54  try {
55  if ($this->ilWebAccessChecker->check()) {
56  $this->deliver();
57  } else {
58  $this->deny();
59  }
60  } catch (ilWACException $e) {
61  switch ($e->getCode()) {
65  $this->handleAccessErrors($e);
66  break;
70  default:
71  $this->handleErrors($e);
72  break;
73  }
74  }
75  }
Class ilWACException.
$_GET["client_id"]
setRevalidateFolderTokens($revalidate_folder_tokens)
Class ilWebAccessChecker.
setSendStatusCode($send_status_code)
static handleErrorReporting()
Set error reporting level.
+ Here is the call graph for this function:

◆ run()

static ilWebAccessCheckerDelivery::run (   $raw_path)
static
Parameters
$raw_path

Definition at line 22 of file class.ilWebAccessCheckerDelivery.php.

Referenced by ilWACCheckingInstanceTest\tetDeliver().

22  {
23  $obj = new self($raw_path);
24  $obj->handleRequest();
25  }
+ Here is the caller graph for this function:

Field Documentation

◆ $ilWebAccessChecker

ilWebAccessCheckerDelivery::$ilWebAccessChecker = null
protected

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


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