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'])
425 include_once(
"./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php");
426 include_once(
"./Services/News/classes/class.ilNewsItem.php");
439 include_once(
"./Modules/DataCollection/classes/class.ilObjDataCollectionAccess.php");
440 include_once(
"./Services/Object/classes/class.ilObject2.php");
449 foreach ($this->check_users as $user_id)
451 if ($ilObjDataCache->lookupType($oid) ==
'usr' && $oid == $user_id)
500 include_once
'Services/Imprint/classes/class.ilImprint.php';
531 foreach($ref_ids as $ref_id)
533 foreach ($this->check_users as $user_id)
535 if ($this->ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
576 foreach($ref_ids as $ref_id)
578 foreach ($this->check_users as $user_id)
580 if ($ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
609 if ($obj_type ==
'qpl')
613 include_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
615 foreach (
$tests as $test_id)
643 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
644 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
647 include_once(
'./Services/COPage/classes/class.ilInternalLink.php');
652 foreach ($sources as $src)
654 switch ($src[
'type'])
659 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
693 include_once
"Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
695 foreach ($this->check_users as $user_id)
697 if ($access_handler->checkAccessOfUser($user_id,
"read",
"view", $obj_id,
"prtf"))
714 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
716 $node_id = $tree->lookupNodeId($obj_id);
726 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
727 foreach ($this->check_users as $user_id)
730 if ($access_handler->checkAccessOfUser($tree, $user_id,
"read",
"view", $node_id,
"blog"))
753 if (
$usr_id == $ilUser->getId())
760 if ($public_upload !=
'y')
768 if ($public_profile ==
'g'
769 and $ilSetting->get(
'enable_global_profiles')
770 and $ilSetting->get(
'pub_section'))
775 elseif (($public_profile ==
'y' or $public_profile ==
'g')
776 and $ilUser->getId() != ANONYMOUS_USER_ID)
796 if (in_array(strtolower($a_disposition), array(
'inline',
'attachment',
'virtual')))
798 $this->disposition = strtolower($a_disposition);
802 $this->disposition =
'inline';
823 if (in_array(strtolower($a_send_mimetype), array(
'',
'0',
'off',
'false')))
825 $this->mimetype = null;
826 $this->send_mimetype =
false;
828 elseif (in_array(strtolower($a_send_mimetype), array(
'1',
'on',
'true')))
830 $this->mimetype = null;
831 $this->send_mimetype =
true;
835 $this->mimetype = $a_send_mimetype;
836 $this->send_mimetype =
true;
857 if (in_array(strtolower($a_check_ip), array(
'',
'0',
'off',
'false')))
859 $this->check_ip =
false;
861 elseif (in_array(strtolower($a_check_ip), array(
'1',
'on',
'true')))
863 $this->check_ip =
true;
884 $xsendfile_available =
false;
898 $this->sendFileVirtual();
904 if ($xsendfile_available)
906 header(
'x-sendfile: ' . $this->file);
907 header(
"Content-Type: application/octet-stream");
916 if (!isset($_SERVER[
"HTTPS"]))
918 header(
"Cache-Control: no-cache, must-revalidate");
919 header(
"Pragma: no-cache");
926 header(
"Content-Length: ".(
string)(filesize($this->file)));
928 if (isset($_SERVER[
"HTTPS"]))
930 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
931 header(
'Pragma: public');
934 header(
"Connection: close");
936 if ($xsendfile_available)
938 header(
'x-sendfile: ' . $this->file);
962 public function sendFileVirtual()
969 header(
'Last-Modified: '. date (
"D, j M Y H:i:s", filemtime($this->file)).
" GMT");
970 header(
'ETag: "'. md5(filemtime($this->file).filesize($this->file)).
'"');
971 header(
'Accept-Ranges: bytes');
972 header(
"Content-Length: ".(
string)(filesize($this->file)));
978 if(!apache_setenv(
'ILIAS_CHECKED',
'1'))
980 $ilLog->write(__METHOD__.
' '.__LINE__.
': Could not set the environment variable ILIAS_CHECKED.');
983 if(!
virtual($this->virtual_path))
985 $ilLog->write(__METHOD__.
' '.__LINE__.
': Could not perform the required sub-request to deliver the file: '.$this->virtual_path);
999 switch ($this->errorcode)
1002 header(
"HTTP/1.0 404 Not Found");
1006 header(
"HTTP/1.0 403 Forbidden");
1012 $tpl->setCurrentBlock(
"HeadBaseTag");
1013 $tpl->setVariable(
'BASE', ILIAS_HTTP_PATH .
'/error.php');
1014 $tpl->parseCurrentBlock();
1015 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.error.html");
1018 $anonymous = ($ilUser->getId() == ANONYMOUS_USER_ID);
1024 $tpl->SetCurrentBlock(
"ErrorLink");
1025 $tpl->SetVariable(
"TXT_LINK", $lng->txt(
'login_to_ilias'));
1026 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/login.php?cmd=force_login&client_id='.CLIENT_ID);
1027 $tpl->ParseCurrentBlock();
1033 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1034 $txt = $nd[
'title'] ==
'ILIAS' ? $lng->txt(
'repository') : $nd[
'title'];
1036 $tpl->SetCurrentBlock(
"ErrorLink");
1037 $tpl->SetVariable(
"TXT_LINK", $txt);
1038 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/ilias.php?baseClass=ilRepositoryGUI&client_id='.CLIENT_ID);
1039 $tpl->ParseCurrentBlock();
1042 $tpl->setCurrentBlock(
"content");
1043 $tpl->setVariable(
"ERROR_MESSAGE",($this->errortext));
1045 $tpl->parseCurrentBlock();
1060 if (isset($this->mimetype))
1079 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1085 $this->mimetype = $mime ? $mime : $default;