7 $_GET[
"baseClass"] =
"ilStartUpGUI";
13 define(
"ILIAS_MODULE", substr($_SERVER[
'PHP_SELF'],
14 strpos($_SERVER[
'PHP_SELF'],
"/data/") + 6));
18 $GLOBALS[
'COOKIE_PATH'] = substr($_SERVER[
'PHP_SELF'], 0,
19 strpos($_SERVER[
'PHP_SELF'],
"/data/"));
31 $GLOBALS[
'WEB_ACCESS_WITHOUT_SESSION'] = (session_id() ==
"");
33 include_once
"Services/Context/classes/class.ilContext.php";
37 require_once
"./include/inc.header.php";
38 require_once
"./Services/Utilities/classes/class.ilUtil.php";
39 require_once
"./Services/Object/classes/class.ilObject.php";
40 require_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
150 $this->params = array();
153 $uri = parse_url($_SERVER[
"REQUEST_URI"]);
154 parse_str($uri[
"query"], $this->params);
157 $this->subpath = urldecode(substr($uri[
"path"], strpos($uri[
"path"], $pattern)));
161 $this->virtual_path = str_replace($pattern,
"virtual-" . $pattern, $uri[
"path"]);
165 if (isset(
$_GET[
'disposition']))
169 if (isset(
$_GET[
'check_ip']))
173 if (isset(
$_GET[
'send_mimetype']))
202 if (!file_exists($this->file))
204 $this->errorcode = 404;
205 $this->errortext = $this->lng->txt(
"url_not_found");
220 $this->check_users = array(
$_SESSION[
"AccountId"]);
230 if (count($this->check_users) == 0)
233 $this->check_users = array(ANONYMOUS_USER_ID);
235 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
236 $ilUser->setId(ANONYMOUS_USER_ID);
239 elseif (count($this->check_users) == 1)
242 $_SESSION[
"AccountId"] = current($this->check_users);
243 $ilUser->setId(current($this->check_users));
250 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
251 $ilUser->setId(ANONYMOUS_USER_ID);
260 $this->check_users = array(ANONYMOUS_USER_ID);
262 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
263 $ilUser->setId(ANONYMOUS_USER_ID);
279 if ($this->errorcode)
288 $pos1 = strpos($this->subpath,
"lm_data/lm_") + 11;
289 $pos2 = strpos($this->subpath,
"mobs/mm_") + 8;
290 $pos3 = strpos($this->subpath,
"usr_images/") + 11;
298 $seperator = strpos($this->subpath,
'/', $pos1);
299 $obj_id = substr($this->subpath, $pos1, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos1);
305 $seperator = strpos($this->subpath,
'/', $pos2);
306 $obj_id = substr($this->subpath, $pos2, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos2);
311 $type =
'user_image';
315 $seperator = strpos($this->subpath,
'_', $pos3);
316 $obj_id = (int) substr($this->subpath, $seperator + 1);
319 if (!$obj_id || $type ==
'none')
321 $this->errorcode = 404;
322 $this->errortext = $this->lng->txt(
"obj_not_found");
354 $this->errorcode = 403;
355 $this->errortext = $this->lng->txt(
'msg_no_perm_read');
369 foreach($usages as $usage)
374 if ($usage[
"type"] ==
"mep:pg")
376 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
378 foreach($usages2 as $usage2)
381 if ($this->checkAccessMobUsage($usage2, $oid2))
389 if ($this->checkAccessMobUsage($usage, $oid))
405 function checkAccessMobUsage($usage, $oid)
410 global $ilObjDataCache;
412 switch($usage[
'type'])
432 include_once(
"./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php");
433 include_once(
"./Services/News/classes/class.ilNewsItem.php");
459 foreach ($this->check_users as $user_id)
461 if ($ilObjDataCache->lookupType($oid) ==
'usr' && $oid == $user_id)
511 include_once
'Services/Imprint/classes/class.ilImprint.php';
546 foreach ($this->check_users as $user_id)
548 if ($this->ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
591 foreach ($this->check_users as $user_id)
593 if ($ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
622 if ($obj_type ==
'qpl')
626 include_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
628 foreach (
$tests as $test_id)
656 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
657 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
660 include_once(
'./Services/COPage/classes/class.ilInternalLink.php');
665 foreach ($sources as $src)
667 switch ($src[
'type'])
672 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
706 include_once
"Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
708 foreach ($this->check_users as $user_id)
710 if ($access_handler->checkAccessOfUser($user_id,
"read",
"view", $obj_id,
"prtf"))
727 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
729 $node_id = $tree->lookupNodeId($obj_id);
739 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
740 foreach ($this->check_users as $user_id)
743 if ($access_handler->checkAccessOfUser($tree, $user_id,
"read",
"view", $node_id,
"blog"))
766 if (
$usr_id == $ilUser->getId())
773 if ($public_upload !=
'y')
781 if ($public_profile ==
'g'
782 and $ilSetting->get(
'enable_global_profiles')
783 and $ilSetting->get(
'pub_section'))
788 elseif (($public_profile ==
'y' or $public_profile ==
'g')
789 and $ilUser->getId() != ANONYMOUS_USER_ID)
809 if (in_array(strtolower($a_disposition), array(
'inline',
'attachment',
'virtual')))
811 $this->disposition = strtolower($a_disposition);
815 $this->disposition =
'inline';
836 if (in_array(strtolower($a_send_mimetype), array(
'',
'0',
'off',
'false')))
838 $this->mimetype = null;
839 $this->send_mimetype =
false;
841 elseif (in_array(strtolower($a_send_mimetype), array(
'1',
'on',
'true')))
843 $this->mimetype = null;
844 $this->send_mimetype =
true;
848 $this->mimetype = $a_send_mimetype;
849 $this->send_mimetype =
true;
870 if (in_array(strtolower($a_check_ip), array(
'',
'0',
'off',
'false')))
872 $this->check_ip =
false;
874 elseif (in_array(strtolower($a_check_ip), array(
'1',
'on',
'true')))
876 $this->check_ip =
true;
898 $xsendfile_available =
false;
910 $this->sendFileVirtual();
916 if ($xsendfile_available)
918 header(
'x-sendfile: ' . $this->file);
919 header(
"Content-Type: application/octet-stream");
928 if (!isset($_SERVER[
"HTTPS"]))
930 header(
"Cache-Control: no-cache, must-revalidate");
931 header(
"Pragma: no-cache");
940 if (isset($_SERVER[
'HTTP_RANGE'])) {
945 header(
"Content-Length: ".(
string)(filesize($this->file)));
947 if (isset($_SERVER[
"HTTPS"]))
949 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
950 header(
'Pragma: public');
953 header(
"Connection: close");
955 if ($xsendfile_available)
957 header(
'x-sendfile: ' . $this->file);
981 public function sendFileVirtual()
988 header(
'Last-Modified: '. date (
"D, j M Y H:i:s", filemtime($this->file)).
" GMT");
989 header(
'ETag: "'. md5(filemtime($this->file).filesize($this->file)).
'"');
990 header(
'Accept-Ranges: bytes');
991 header(
"Content-Length: ".(
string)(filesize($this->file)));
996 if(!apache_setenv(
'ILIAS_CHECKED',
'1'))
998 $ilLog->write(__METHOD__.
' '.__LINE__.
': Could not set the environment variable ILIAS_CHECKED.');
1001 if(!
virtual($this->virtual_path))
1003 $ilLog->write(__METHOD__.
' '.__LINE__.
': Could not perform the required sub-request to deliver the file: '.$this->virtual_path);
1018 switch ($this->errorcode)
1021 header(
"HTTP/1.0 404 Not Found");
1025 header(
"HTTP/1.0 403 Forbidden");
1031 $tpl->setCurrentBlock(
"HeadBaseTag");
1032 $tpl->setVariable(
'BASE', ILIAS_HTTP_PATH .
'/error.php');
1033 $tpl->parseCurrentBlock();
1034 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.error.html");
1037 $anonymous = ($ilUser->getId() == ANONYMOUS_USER_ID);
1043 $tpl->SetCurrentBlock(
"ErrorLink");
1044 $tpl->SetVariable(
"TXT_LINK", $lng->txt(
'login_to_ilias'));
1045 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/login.php?cmd=force_login&client_id='.CLIENT_ID);
1046 $tpl->ParseCurrentBlock();
1052 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1053 $txt = $nd[
'title'] ==
'ILIAS' ? $lng->txt(
'repository') : $nd[
'title'];
1055 $tpl->SetCurrentBlock(
"ErrorLink");
1056 $tpl->SetVariable(
"TXT_LINK", $txt);
1057 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/ilias.php?baseClass=ilRepositoryGUI&client_id='.CLIENT_ID);
1058 $tpl->ParseCurrentBlock();
1061 $tpl->setCurrentBlock(
"content");
1062 $tpl->setVariable(
"ERROR_MESSAGE",($this->errortext));
1064 $tpl->parseCurrentBlock();
1079 if (isset($this->mimetype))
1098 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1104 $this->mimetype = $mime ? $mime : $default;