ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilWebAccessChecker Class Reference

Class ilWebAccessChecker. More...

+ Collaboration diagram for ilWebAccessChecker:

Public Member Functions

 ilWebAccessChecker ()
 Constructor public.
 determineUser ()
 Determine the current user(s)
 checkAccess ()
 Check access rights of the requested file public.
 checkAccessMob ($obj_id)
 Check access to media object.
 setDisposition ($a_disposition)
 Set the delivery mode for the file.
 getDisposition ()
 Get the delivery mode for the file.
 setSendMimetype ($a_send_mimetype)
 Set the sending of the mime type.
 getSendMimetype ()
 Get if mimetype should be sent for a virtual delivery.
 setCheckIp ($a_check_ip)
 Set the checking of the IP address if no valid session is found.
 getCheckIp ()
 Set the checking of the IP address of no valid session is found.
 sendFile ()
 Send the requested file as if directly delivered from the web server public.
 sendError ()
 Send an error response for the requested file public.
 getMimeType ($default= 'application/octet-stream')
 Get the mime type of the requested file.

Data Fields

 $lng
 $ilAccess
 $subpath
 $file
 $params
 $disposition = "inline"
 $check_ip = false
 $check_users = array()
 $send_mimetype = true
 $mimetype = null
 $errorcode
 $errortext

Private Member Functions

 checkAccessLM ($obj_id, $obj_type, $page=0)
 check access for ILIAS learning modules (obsolete, if checking of page conditions is not activated!)
 checkAccessObject ($obj_id, $obj_type= '')
 Check access rights for an object by its object id.
 checkAccessTestQuestion ($obj_id, $usage_id=0)
 Check access rights for a test question This checks also tests with random selection of questions.
 checkAccessGlossaryTerm ($obj_id, $page_id)
 Check access rights for glossary terms This checks also learning modules linking the term.
 checkAccessPortfolioPage ($obj_id, $page_id)
 Check access rights for portfolio pages.
 checkAccessBlogPage ($obj_id, $page_id)
 Check access rights for blog pages.
 checkAccessLearningObjectivePage ($obj_id, $page_id)
 checkAccessUserImage ($usr_id)
 Check access rights for user images.

Detailed Description

Class ilWebAccessChecker.

Checks the access rights of a directly requested content file. Called from an alias or rewrite rule

  • determines the related learning module and checks the permission
  • either delivers the accessed file (without redirect)
  • or shows an error screen (if too less rights)
Author
Fred Neumann fred..nosp@m.neum.nosp@m.ann@f.nosp@m.im.u.nosp@m.ni-er.nosp@m.lang.nosp@m.en.de
Version
Id:
class.ilWebAccessChecker.php 60260 2015-07-30 14:31:14Z gitmgr

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

Member Function Documentation

ilWebAccessChecker::checkAccess ( )

Check access rights of the requested file public.

Definition at line 274 of file class.ilWebAccessChecker.php.

References $ilLog, $ilUser, $path, ilInitialisation\authenticate(), checkAccessMob(), checkAccessObject(), checkAccessUserImage(), determineUser(), IL_COMP_MODULE, IL_COMP_SERVICE, ilComponent\lookupId(), and ilObjMediaObject\lookupUsages().

{
global $ilLog, $ilUser, $ilObjDataCache, $objDefinition;
// an error already occurred at class initialisation
if ($this->errorcode)
{
return false;
}
// check for type by subdirectory
$pos1 = strpos($this->subpath, "lm_data/lm_") + 11;
$pos2 = strpos($this->subpath, "mobs/mm_") + 8;
$pos3 = strpos($this->subpath, "usr_images/") + 11;
$pos4 = strpos($this->subpath, "sec") + 3;
$obj_id = 0;
$type = 'none';
// trying to access data within a learning module folder
if ($pos1 > 11)
{
$type = 'lm';
$seperator = strpos($this->subpath, '/', $pos1);
$obj_id = substr($this->subpath, $pos1, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos1);
}
//trying to access media data
else if ($pos2 > 8)
{
$type = 'mob';
$seperator = strpos($this->subpath, '/', $pos2);
$obj_id = substr($this->subpath, $pos2, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos2);
}
// trying to access a user image
elseif ($pos3 > 11)
{
$type = 'user_image';
// user images may be:
// upload_123pic, upload_123
// usr_123.jpg, usr_123_small.jpg, usr_123_xsmall.jpg, usr_123_xxsmall.jpg
$seperator = strpos($this->subpath, '_', $pos3);
$obj_id = (int) substr($this->subpath, $seperator + 1);
}
// component name (generic)
elseif ($pos4 > 3)
{
$plugin = false;
$seperator = strpos($this->subpath, '/', $pos4);
$path = explode("/", substr($this->subpath, $seperator +1));
$component = array_shift($path);
if(substr($component, 0, 2) == "il")
{
$component = substr($component, 2);
$comp_dir = null;
{
$comp_dir = "Modules";
}
else if(ilComponent::lookupId(IL_COMP_SERVICE, $component))
{
$comp_dir = "Services";
}
else if($objDefinition->isPlugin($pl_id = strtolower($component)))
{
$comp_class = $objDefinition->getClassName($pl_id);
$comp_dir = $objDefinition->getLocation($pl_id);
$plugin = true;
}
if($comp_dir)
{
if($plugin)
{
$comp_class = "il".$comp_class."WebAccessChecker";
$comp_include = $comp_dir."/class.".$comp_class.".php";
}
else
{
$comp_class = "il".$component."WebAccessChecker";
$comp_include = $comp_dir."/".$component."/classes/class.".$comp_class.".php";
}
if(file_exists($comp_include))
{
include_once $comp_include;
if(class_exists($comp_class))
{
$comp_inst = new $comp_class();
if($comp_inst instanceof ilComponentWebAccessChecker)
{
if($comp_inst->isValidPath($path))
{
$type = "sec";
}
}
}
}
}
}
}
if ((!$obj_id && $type != "sec") || $type == 'none')
{
$this->errorcode = 404;
$this->errortext = $this->lng->txt("obj_not_found");
return false;
}
// #13237 - if imporint is display on login page we have user id 0
if($type == "mob")
{
$usages = ilObjMediaObject::lookupUsages($obj_id);
foreach($usages as $usage)
{
if($usage['type'] == 'impr:pg')
{
return $this->checkAccessMobUsage($usage, 1);
}
}
}
// get proper user id (could be anonymous)
// do this here because ip based checking may be set after construction
$this->determineUser();
switch($type)
{
// SCORM or HTML learning module
case 'lm':
if ($this->checkAccessObject($obj_id))
{
return true;
}
break;
// media object
case 'mob':
if ($this->checkAccessMob($obj_id))
{
return true;
}
break;
// image in user profile
case 'user_image':
if ($this->checkAccessUserImage($obj_id))
{
return true;
}
break;
case 'sec':
if($obj_id = $comp_inst->getRepositoryObjectId())
{
return $this->checkAccessObject($obj_id);
}
else
{
return $comp_inst->checkAccess($this->check_users);
}
break;
}
// none of the checks above gives access
$this->errorcode = 403;
$this->errortext = $this->lng->txt('msg_no_perm_read');
return false;
}

+ Here is the call graph for this function:

ilWebAccessChecker::checkAccessBlogPage (   $obj_id,
  $page_id 
)
private

Check access rights for blog pages.

Parameters
intobject id (glossary)
intpage id (definition)
Returns
boolean access given (true/false)

Definition at line 820 of file class.ilWebAccessChecker.php.

References checkAccessObject().

{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
$tree = new ilWorkspaceTree(0);
$node_id = $tree->lookupNodeId($obj_id);
// repository
if(!$node_id)
{
return $this->checkAccessObject($obj_id);
}
// workspace
else
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
foreach ($this->check_users as $user_id)
{
$access_handler = new ilWorkspaceAccessHandler($tree);
if ($access_handler->checkAccessOfUser($tree, $user_id, "read", "view", $node_id, "blog"))
{
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

ilWebAccessChecker::checkAccessGlossaryTerm (   $obj_id,
  $page_id 
)
private

Check access rights for glossary terms This checks also learning modules linking the term.

Parameters
intobject id (glossary)
intpage id (definition)
Returns
boolean access given (true/false)

Definition at line 743 of file class.ilWebAccessChecker.php.

References ilInternalLink\_getSourcesOfTarget(), ilLMObject\_lookupContObjID(), ilGlossaryDefinition\_lookupTermId(), and checkAccessObject().

{
// give access if glossary is readable
if ($this->checkAccessObject($obj_id))
{
return true;
}
include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
include_once('./Services/Link/classes/class.ilInternalLink.php');
$sources = ilInternalLink::_getSourcesOfTarget('git',$term_id, 0);
if ($sources)
{
foreach ($sources as $src)
{
switch ($src['type'])
{
// Give access if term is linked by a learning module with read access.
// The term including media is shown by the learning module presentation!
case 'lm:pg':
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
$src_obj_id = ilLMObject::_lookupContObjID($src['id']);
if ($this->checkAccessObject($src_obj_id, 'lm'))
{
return true;
}
break;
// Don't yet give access if the term is linked by another glossary
// The link will lead to the origin glossary which is already checked
/*
case 'gdf:pg':
$src_term_id = ilGlossaryDefinition::_lookupTermId($src['id']);
$src_obj_id = ilGlossaryTerm::_lookGlossaryID($src_term_id);
if ($this->checkAccessObject($src_obj_id, 'glo'))
{
return true;
}
break;
*/
}
}
}
}

+ Here is the call graph for this function:

ilWebAccessChecker::checkAccessLearningObjectivePage (   $obj_id,
  $page_id 
)
private

Definition at line 847 of file class.ilWebAccessChecker.php.

References ilCourseObjective\_lookupContainerIdByObjectiveId(), and checkAccessObject().

{
include_once "Modules/Course/classes/class.ilCourseObjective.php";
return $this->checkAccessObject($crs_obj_id, 'crs');
}

+ Here is the call graph for this function:

ilWebAccessChecker::checkAccessLM (   $obj_id,
  $obj_type,
  $page = 0 
)
private

check access for ILIAS learning modules (obsolete, if checking of page conditions is not activated!)

Parameters
intobject id
stringobject type
intpage id

Definition at line 630 of file class.ilWebAccessChecker.php.

References $lng, $ref_id, and ilObject\_getAllReferences().

{
global $lng;
// OBSOLETE (see above)
//if (!$page)
//{
$ref_ids = ilObject::_getAllReferences($obj_id);
foreach($ref_ids as $ref_id)
{
foreach ($this->check_users as $user_id)
{
if ($this->ilAccess->checkAccessOfUser($user_id, "read", "view", $ref_id, $obj_type, $obj_id))
{
return true;
}
}
}
return false;
//}
//else
//{
// $ref_ids = ilObject::_getAllReferences($obj_id);
// foreach($ref_ids as $ref_id)
// {
// if ($this->ilAccess->checkAccess("read", "", $ref_id))
// {
// require_once 'Modules/LearningModule/classes/class.ilObjLearningModule.php';
// $lm = new ilObjLearningModule($obj_id,false);
// if ($lm->_checkPreconditionsOfPage($ref_id, $obj_id, $page))
// return true;
// }
// }
// return false;
//}
}

+ Here is the call graph for this function:

ilWebAccessChecker::checkAccessMob (   $obj_id)

Check access to media object.

Parameters
@return

Definition at line 452 of file class.ilWebAccessChecker.php.

References ilObjMediaObject\getParentObjectIdForUsage(), ilMediaPoolPage\lookupUsages(), and ilObjMediaObject\lookupUsages().

Referenced by checkAccess().

{
$usages = ilObjMediaObject::lookupUsages($obj_id);
foreach($usages as $usage)
{
// for content snippets we must get their usages and check them
if ($usage["type"] == "mep:pg")
{
include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
$usages2 = ilMediaPoolPage::lookupUsages($usage["id"]);
foreach($usages2 as $usage2)
{
if ($this->checkAccessMobUsage($usage2, $oid2))
{
return true;
}
}
}
else // none content snippets just go the usual way
{
if ($this->checkAccessMobUsage($usage, $oid))
{
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWebAccessChecker::checkAccessObject (   $obj_id,
  $obj_type = '' 
)
private

Check access rights for an object by its object id.

Parameters
intobject id
Returns
boolean access given (true/false)

Definition at line 674 of file class.ilWebAccessChecker.php.

References $ilAccess, $ref_id, ilObject\_getAllReferences(), and ilObject\_lookupType().

Referenced by checkAccess(), checkAccessBlogPage(), checkAccessGlossaryTerm(), checkAccessLearningObjectivePage(), and checkAccessTestQuestion().

{
global $ilAccess;
if (!$obj_type)
{
$obj_type = ilObject::_lookupType($obj_id);
}
$ref_ids = ilObject::_getAllReferences($obj_id);
foreach($ref_ids as $ref_id)
{
foreach ($this->check_users as $user_id)
{
if ($ilAccess->checkAccessOfUser($user_id, "read", "view", $ref_id, $obj_type, $obj_id))
{
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWebAccessChecker::checkAccessPortfolioPage (   $obj_id,
  $page_id 
)
private

Check access rights for portfolio pages.

Parameters
intobject id (glossary)
intpage id (definition)
Returns
boolean access given (true/false)

Definition at line 799 of file class.ilWebAccessChecker.php.

{
include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
$access_handler = new ilPortfolioAccessHandler();
foreach ($this->check_users as $user_id)
{
if ($access_handler->checkAccessOfUser($user_id, "read", "view", $obj_id, "prtf"))
{
return true;
}
}
return false;
}
ilWebAccessChecker::checkAccessTestQuestion (   $obj_id,
  $usage_id = 0 
)
private

Check access rights for a test question This checks also tests with random selection of questions.

Parameters
intobject id (question pool or test)
intusage id (not yet used)
Returns
boolean access given (true/false)

Definition at line 706 of file class.ilWebAccessChecker.php.

References $ilAccess, $tests, ilObjTestAccess\_getRandomTestsForQuestionPool(), ilObject\_lookupType(), and checkAccessObject().

{
global $ilAccess;
// give access if direct usage is readable
if ($this->checkAccessObject($obj_id))
{
return true;
}
$obj_type = ilObject::_lookupType($obj_id);
if ($obj_type == 'qpl')
{
// give access if question pool is used by readable test
// for random selection of questions
include_once('./Modules/Test/classes/class.ilObjTestAccess.php');
foreach ($tests as $test_id)
{
if ($this->checkAccessObject($test_id, 'tst'))
{
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

ilWebAccessChecker::checkAccessUserImage (   $usr_id)
private

Check access rights for user images.

Due to privacy this will be checked for a truly identified user (IP based checking is not recommended user images)

Parameters
intusr_id
Returns
boolean access given (true/false)

Definition at line 864 of file class.ilWebAccessChecker.php.

References $ilSetting, $ilUser, and ilObjUser\_lookupPref().

Referenced by checkAccess().

{
// check if own image is viewed
if ($usr_id == $ilUser->getId())
{
return true;
}
// check if image is in the public profile
$public_upload = ilObjUser::_lookupPref($usr_id, 'public_upload');
if ($public_upload != 'y')
{
return false;
}
// check the publication status of the profile
$public_profile = ilObjUser::_lookupPref($usr_id, 'public_profile');
if ($public_profile == 'g'
and $ilSetting->get('enable_global_profiles')
and $ilSetting->get('pub_section'))
{
// globally public
return true;
}
elseif (($public_profile == 'y' or $public_profile == 'g')
and $ilUser->getId() != ANONYMOUS_USER_ID)
{
// public for logged in users
return true;
}
else
{
// not public
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWebAccessChecker::determineUser ( )

Determine the current user(s)

Definition at line 213 of file class.ilWebAccessChecker.php.

References $_SESSION, $GLOBALS, $ilUser, ilSession\_getUsersWithIp(), and getCheckIp().

Referenced by checkAccess().

{
global $ilUser;
// a valid user session is found
if ($_SESSION["AccountId"])
{
$this->check_users = array($_SESSION["AccountId"]);
return;
}
// no session cookie was delivered
// user identification by ip address is allowed
elseif ($GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] and $this->getCheckIp())
{
$this->check_users = ilSession::_getUsersWithIp($_SERVER['REMOTE_ADDR']);
if (count($this->check_users) == 0)
{
// no user was found for the ip address
$this->check_users = array(ANONYMOUS_USER_ID);
$_SESSION["AccountId"] = ANONYMOUS_USER_ID;
$ilUser->setId(ANONYMOUS_USER_ID);
$ilUser->read();
}
elseif (count($this->check_users) == 1)
{
// exactly one user is found with an active session
$_SESSION["AccountId"] = current($this->check_users);
$ilUser->setId(current($this->check_users));
$ilUser->read();
}
else
{
// more than one user found for the ip address
// take the anonymous user for the session
$_SESSION["AccountId"] = ANONYMOUS_USER_ID;
$ilUser->setId(ANONYMOUS_USER_ID);
$ilUser->read();
}
return;
}
// take the anonymous user as fallback
else
{
$this->check_users = array(ANONYMOUS_USER_ID);
$_SESSION["AccountId"] = ANONYMOUS_USER_ID;
$ilUser->setId(ANONYMOUS_USER_ID);
$ilUser->read();
return;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWebAccessChecker::getCheckIp ( )

Set the checking of the IP address of no valid session is found.

Returns
boolean

Definition at line 987 of file class.ilWebAccessChecker.php.

References $check_ip.

Referenced by determineUser().

{
}

+ Here is the caller graph for this function:

ilWebAccessChecker::getDisposition ( )

Get the delivery mode for the file.

Returns
string "inline", "attachment" or "virtual" public

Definition at line 927 of file class.ilWebAccessChecker.php.

References $disposition.

Referenced by sendFile().

{
}

+ Here is the caller graph for this function:

ilWebAccessChecker::getMimeType (   $default = 'application/octet-stream')

Get the mime type of the requested file.

Parameters
stringdefault type
Returns
string mime type public

Definition at line 1181 of file class.ilWebAccessChecker.php.

References $mimetype.

Referenced by sendFile().

{
// take a previously set mimetype
if (isset($this->mimetype))
{
}
$mime = '';
// alex: changed due to bug http://www.ilias.de/mantis/view.php?id=9332
/* if (extension_loaded('Fileinfo'))
{
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_file($finfo, $this->file);
finfo_close($finfo);
if ($pos = strpos($mime, ' '))
{
$mime = substr($mime, 0, $pos);
}
}
else
{*/
include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
$mime = ilMimeTypeUtil::getMimeType($this->file);
//$mime = ilObjMediaObject::getMimeType($this->file);
// }
// set and return the mime type
$this->mimetype = $mime ? $mime : $default;
}

+ Here is the caller graph for this function:

ilWebAccessChecker::getSendMimetype ( )

Get if mimetype should be sent for a virtual delivery.

Returns
boolean

Definition at line 960 of file class.ilWebAccessChecker.php.

References $send_mimetype.

Referenced by sendFile().

{
}

+ Here is the caller graph for this function:

ilWebAccessChecker::ilWebAccessChecker ( )

Constructor public.

Definition at line 144 of file class.ilWebAccessChecker.php.

References $_GET, $ilAccess, $ilLog, $ilUser, $lng, ILIAS_ABSOLUTE_PATH, ILIAS_WEB_DIR, setCheckIp(), setDisposition(), and setSendMimetype().

{
$this->lng =& $lng;
$this->ilAccess =& $ilAccess;
$this->params = array();
// get the requested file and its type
$uri = parse_url($_SERVER["REQUEST_URI"]);
parse_str($uri["query"], $this->params);
$pattern = ILIAS_WEB_DIR . "/" . CLIENT_ID;
$this->subpath = urldecode(substr($uri["path"], strpos($uri["path"], $pattern)));
$this->file = realpath(ILIAS_ABSOLUTE_PATH . "/". $this->subpath);
// build url path for virtual function
$this->virtual_path = str_replace($pattern, "virtual-" . $pattern, $uri["path"]);
// set the parameters provided with the checker call
if (isset($_GET['disposition']))
{
$this->setDisposition($_GET['disposition']);
}
if (isset($_GET['check_ip']))
{
$this->setCheckIp($_GET['check_ip']);
}
if (isset($_GET['send_mimetype']))
{
$this->setSendMimetype($_GET['send_mimetype']);
}
// debugging
/*echo "<pre>";
echo "REQUEST_URI: ". $_SERVER["REQUEST_URI"]. "\n";
echo "Parsed URI: ". $uri["path"]. "\n";
echo "DOCUMENT_ROOT: ". $_SERVER["DOCUMENT_ROOT"]. "\n";
echo "PHP_SELF: ". $_SERVER["PHP_SELF"]. "\n";
echo "SCRIPT_NAME: ". $_SERVER["SCRIPT_NAME"]. "\n";
echo "SCRIPT_FILENAME: ". $_SERVER["SCRIPT_FILENAME"]. "\n";
echo "PATH_TRANSLATED: ". $_SERVER["PATH_TRANSLATED"]. "\n";
echo "ILIAS_WEB_DIR: ". ILIAS_WEB_DIR. "\n";
echo "ILIAS_HTTP_PATH: ". ILIAS_HTTP_PATH. "\n";
echo "ILIAS_ABSOLUTE_PATH: ". ILIAS_ABSOLUTE_PATH. "\n";
echo "CLIENT_ID: ". CLIENT_ID. "\n";
echo "CLIENT_WEB_DIR: ". CLIENT_WEB_DIR. "\n";
echo "subpath: ". $this->subpath. "\n";
echo "file: ". $this->file. "\n";
echo "disposition: ". $this->disposition. "\n";
echo "ckeck_ip: ". $this->check_ip. "\n";
echo "send_mimetype: ". $this->send_mimetype. "\n";
echo "</pre>";
echo phpinfo();
exit;*/
if (!file_exists($this->file))
{
$this->errorcode = 404;
$this->errortext = $this->lng->txt("url_not_found");
return false;
}
}

+ Here is the call graph for this function:

ilWebAccessChecker::sendError ( )

Send an error response for the requested file public.

Definition at line 1117 of file class.ilWebAccessChecker.php.

References $ilSetting, $ilUser, $lng, $nd, $tpl, $txt, and exit.

{
global $ilSetting, $ilUser, $tpl, $lng, $tree;
switch ($this->errorcode)
{
case 404:
header("HTTP/1.0 404 Not Found");
break;
case 403:
default:
header("HTTP/1.0 403 Forbidden");
break;
}
// set the page base to the ILIAS directory
// to get correct references for images and css files
$tpl->setCurrentBlock("HeadBaseTag");
$tpl->setVariable('BASE', ILIAS_HTTP_PATH . '/error.php');
$tpl->parseCurrentBlock();
$tpl->addBlockFile("CONTENT", "content", "tpl.error.html");
$lng->loadLanguageModule("error");
// Check if user is logged in
$anonymous = ($ilUser->getId() == ANONYMOUS_USER_ID);
if ($anonymous)
{
// Provide a link to the login screen for anonymous users
$tpl->SetCurrentBlock("ErrorLink");
$tpl->SetVariable("TXT_LINK", $lng->txt('login_to_ilias'));
$tpl->SetVariable("LINK", ILIAS_HTTP_PATH. '/login.php?cmd=force_login&client_id='.CLIENT_ID);
$tpl->ParseCurrentBlock();
}
else
{
// Provide a link to the repository for authentified users
$nd = $tree->getNodeData(ROOT_FOLDER_ID);
$txt = $lng->txt('error_back_to_repository');
$tpl->SetCurrentBlock("ErrorLink");
$tpl->SetVariable("TXT_LINK", $txt);
$tpl->SetVariable("LINK", ILIAS_HTTP_PATH. '/ilias.php?baseClass=ilRepositoryGUI&amp;client_id='.CLIENT_ID);
$tpl->ParseCurrentBlock();
}
$tpl->setCurrentBlock("content");
$tpl->setVariable("ERROR_MESSAGE",($this->errortext));
$tpl->setVariable("MESSAGE_HEADING", $lng->txt('error_sry_error'));
//$tpl->parseCurrentBlock();
$tpl->show();
}
ilWebAccessChecker::sendFile ( )

Send the requested file as if directly delivered from the web server public.

Definition at line 997 of file class.ilWebAccessChecker.php.

References ilUtil\deliverFile(), exit, getDisposition(), getMimeType(), getSendMimetype(), ilUtil\rangeDownload(), and ilUtil\readFile().

{
//$system_use_xsendfile = true;
//$xsendfile_available = (boolean) $_GET["xsendfile"];
$xsendfile_available = false;
//if (function_exists('apache_get_modules'))
//{
// $modules = apache_get_modules();
// $xsendfile_available = in_array('mod_xsendfile', $modules);
//}
//$xsendfile_available = $system_use_xsendfile & $xsendfile_available;
// delivery via apache virtual function
if ($this->getDisposition() == "virtual")
{
$this->sendFileVirtual();
}
// delivery for download dialogue
elseif ($this->getDisposition() == "attachment")
{
if ($xsendfile_available)
{
header('x-sendfile: ' . $this->file);
header("Content-Type: application/octet-stream");
}
else
ilUtil::deliverFile($this->file, basename($this->file));
}
// inline delivery
else
{
if (!isset($_SERVER["HTTPS"]))
{
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}
if ($this->getSendMimetype())
{
header("Content-Type: " . $this->getMimeType());
}
// see bug 12622 and 12124
if (isset($_SERVER['HTTP_RANGE'])) { // do it for any device that supports byte-ranges not only iPhone
ilUtil::rangeDownload($this->file);
}
header("Content-Length: ".(string)(filesize($this->file)));
if (isset($_SERVER["HTTPS"]))
{
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
header("Connection: close");
if ($xsendfile_available)
{
header('x-sendfile: ' . $this->file);
if ($this->getSendMimetype())
{
header("Content-Type: " . $this->getMimeType());
}
}
else
{
ilUtil::readFile( $this->file);
}
}
}

+ Here is the call graph for this function:

ilWebAccessChecker::setCheckIp (   $a_check_ip)

Set the checking of the IP address if no valid session is found.

Parameters
booleanpublic

Definition at line 971 of file class.ilWebAccessChecker.php.

Referenced by ilWebAccessChecker().

{
if (in_array(strtolower($a_check_ip), array('','0','off','false')))
{
$this->check_ip = false;
}
elseif (in_array(strtolower($a_check_ip), array('1','on','true')))
{
$this->check_ip = true;
}
}

+ Here is the caller graph for this function:

ilWebAccessChecker::setDisposition (   $a_disposition)

Set the delivery mode for the file.

Parameters
string"inline", "attachment" or "virtual" public

Definition at line 910 of file class.ilWebAccessChecker.php.

Referenced by ilWebAccessChecker().

{
if (in_array(strtolower($a_disposition), array('inline','attachment','virtual')))
{
$this->disposition = strtolower($a_disposition);
}
else
{
$this->disposition = 'inline';
}
}

+ Here is the caller graph for this function:

ilWebAccessChecker::setSendMimetype (   $a_send_mimetype)

Set the sending of the mime type.

Parameters
string(boolean switch or mimetype) public

Definition at line 937 of file class.ilWebAccessChecker.php.

Referenced by ilWebAccessChecker().

{
if (in_array(strtolower($a_send_mimetype), array('','0','off','false')))
{
$this->mimetype = null;
$this->send_mimetype = false;
}
elseif (in_array(strtolower($a_send_mimetype), array('1','on','true')))
{
$this->mimetype = null;
$this->send_mimetype = true;
}
else
{
$this->mimetype = $a_send_mimetype;
$this->send_mimetype = true;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilWebAccessChecker::$check_ip = false

Definition at line 95 of file class.ilWebAccessChecker.php.

Referenced by getCheckIp().

ilWebAccessChecker::$check_users = array()

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

ilWebAccessChecker::$disposition = "inline"

Definition at line 88 of file class.ilWebAccessChecker.php.

Referenced by getDisposition().

ilWebAccessChecker::$errorcode

Definition at line 129 of file class.ilWebAccessChecker.php.

ilWebAccessChecker::$errortext

Definition at line 137 of file class.ilWebAccessChecker.php.

ilWebAccessChecker::$file

Definition at line 73 of file class.ilWebAccessChecker.php.

ilWebAccessChecker::$ilAccess
ilWebAccessChecker::$lng

Definition at line 58 of file class.ilWebAccessChecker.php.

Referenced by checkAccessLM(), ilWebAccessChecker(), and sendError().

ilWebAccessChecker::$mimetype = null

Definition at line 121 of file class.ilWebAccessChecker.php.

Referenced by getMimeType().

ilWebAccessChecker::$params

Definition at line 80 of file class.ilWebAccessChecker.php.

ilWebAccessChecker::$send_mimetype = true

Definition at line 112 of file class.ilWebAccessChecker.php.

Referenced by getSendMimetype().

ilWebAccessChecker::$subpath

Definition at line 66 of file class.ilWebAccessChecker.php.


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