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() ==
"");
35 require_once
"./include/inc.header.php";
36 require_once
"./Services/Utilities/classes/class.ilUtil.php";
37 require_once
"./classes/class.ilObject.php";
38 require_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
148 $this->params = array();
151 $uri = parse_url($_SERVER[
"REQUEST_URI"]);
152 parse_str($uri[
"query"], $this->params);
155 $this->subpath = urldecode(substr($uri[
"path"], strpos($uri[
"path"], $pattern)));
159 $this->virtual_path = str_replace($pattern,
"virtual-" . $pattern, $uri[
"path"]);
163 if (isset(
$_GET[
'disposition']))
167 if (isset(
$_GET[
'check_ip']))
171 if (isset(
$_GET[
'send_mimetype']))
200 if (!file_exists($this->file))
202 $this->errorcode = 404;
203 $this->errortext = $this->lng->txt(
"url_not_found");
218 $this->check_users = array(
$_SESSION[
"AccountId"]);
228 if (count($this->check_users) == 0)
231 $this->check_users = array(ANONYMOUS_USER_ID);
233 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
234 $ilUser->setId(ANONYMOUS_USER_ID);
237 elseif (count($this->check_users) == 1)
240 $_SESSION[
"AccountId"] = current($this->check_users);
241 $ilUser->setId(current($this->check_users));
248 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
249 $ilUser->setId(ANONYMOUS_USER_ID);
258 $this->check_users = array(ANONYMOUS_USER_ID);
260 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
261 $ilUser->setId(ANONYMOUS_USER_ID);
274 global
$ilLog, $ilUser, $ilObjDataCache;
277 if ($this->errorcode)
286 $pos1 = strpos($this->subpath,
"lm_data/lm_") + 11;
287 $pos2 = strpos($this->subpath,
"mobs/mm_") + 8;
288 $pos3 = strpos($this->subpath,
"usr_images/") + 11;
296 $seperator = strpos($this->subpath,
'/', $pos1);
297 $obj_id = substr($this->subpath, $pos1, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos1);
303 $seperator = strpos($this->subpath,
'/', $pos2);
304 $obj_id = substr($this->subpath, $pos2, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos2);
309 $type =
'user_image';
313 $seperator = strpos($this->subpath,
'_', $pos3);
314 $obj_id = (int) substr($this->subpath, $seperator + 1);
317 if (!$obj_id || $type ==
'none')
319 $this->errorcode = 404;
320 $this->errortext = $this->lng->txt(
"obj_not_found");
352 $this->errorcode = 403;
353 $this->errortext = $this->lng->txt(
'msg_no_perm_read');
367 foreach($usages as $usage)
372 if ($usage[
"type"] ==
"mep:pg")
374 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
376 foreach($usages2 as $usage2)
405 switch($usage[
'type'])
418 include_once(
"./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php");
419 include_once(
"./Services/News/classes/class.ilNewsItem.php");
434 foreach ($this->check_users as $user_id)
436 if ($ilObjDataCache->lookupType($oid) ==
'usr' && $oid == $user_id)
514 foreach ($this->check_users as $user_id)
516 if ($this->ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
559 foreach ($this->check_users as $user_id)
561 if ($ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
590 if ($obj_type ==
'qpl')
594 include_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
596 foreach (
$tests as $test_id)
624 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
625 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
628 include_once(
'./Services/COPage/classes/class.ilInternalLink.php');
633 foreach ($sources as $src)
635 switch ($src[
'type'])
640 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
674 include_once
"Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
676 foreach ($this->check_users as $user_id)
678 if ($access_handler->checkAccessOfUser($user_id,
"read",
"view", $obj_id,
"prtf"))
695 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
697 $node_id = $tree->lookupNodeId($obj_id);
707 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
708 foreach ($this->check_users as $user_id)
711 if ($access_handler->checkAccessOfUser($tree, $user_id,
"read",
"view", $node_id,
"blog"))
734 if (
$usr_id == $ilUser->getId())
741 if ($public_upload !=
'y')
749 if ($public_profile ==
'g'
750 and $ilSetting->get(
'enable_global_profiles')
751 and $ilSetting->get(
'pub_section'))
756 elseif (($public_profile ==
'y' or $public_profile ==
'g')
757 and $ilUser->getId() != ANONYMOUS_USER_ID)
777 if (in_array(strtolower($a_disposition), array(
'inline',
'attachment',
'virtual')))
779 $this->disposition = strtolower($a_disposition);
783 $this->disposition =
'inline';
804 if (in_array(strtolower($a_send_mimetype), array(
'',
'0',
'off',
'false')))
806 $this->mimetype = null;
807 $this->send_mimetype =
false;
809 elseif (in_array(strtolower($a_send_mimetype), array(
'1',
'on',
'true')))
811 $this->mimetype = null;
812 $this->send_mimetype =
true;
816 $this->mimetype = $a_send_mimetype;
817 $this->send_mimetype =
true;
838 if (in_array(strtolower($a_check_ip), array(
'',
'0',
'off',
'false')))
840 $this->check_ip =
false;
842 elseif (in_array(strtolower($a_check_ip), array(
'1',
'on',
'true')))
844 $this->check_ip =
true;
865 $xsendfile_available =
false;
885 if ($xsendfile_available)
887 header(
'x-sendfile: ' . $this->file);
888 header(
"Content-Type: application/octet-stream");
897 if (!isset($_SERVER[
"HTTPS"]))
899 header(
"Cache-Control: no-cache, must-revalidate");
900 header(
"Pragma: no-cache");
907 header(
"Content-Length: ".(
string)(filesize($this->file)));
909 if (isset($_SERVER[
"HTTPS"]))
911 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
912 header(
'Pragma: public');
915 header(
"Connection: close");
917 if ($xsendfile_available)
919 header(
'x-sendfile: ' . $this->file);
945 header(
'Last-Modified: '. date (
"D, j M Y H:i:s", filemtime($this->file)).
" GMT");
946 header(
'ETag: "'. md5(filemtime($this->file).filesize($this->file)).
'"');
947 header(
'Accept-Ranges: bytes');
948 header(
"Content-Length: ".(
string)(filesize($this->file)));
954 apache_setenv(
'ILIAS_CHECKED',
'1');
955 virtual($this->virtual_path);
968 switch ($this->errorcode)
971 header(
"HTTP/1.0 404 Not Found");
975 header(
"HTTP/1.0 403 Forbidden");
981 $tpl->setCurrentBlock(
"HeadBaseTag");
982 $tpl->setVariable(
'BASE', ILIAS_HTTP_PATH .
'/error.php');
983 $tpl->parseCurrentBlock();
984 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.error.html");
987 $anonymous = ($ilUser->getId() == ANONYMOUS_USER_ID);
993 $tpl->SetCurrentBlock(
"ErrorLink");
994 $tpl->SetVariable(
"TXT_LINK", $lng->txt(
'login_to_ilias'));
995 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/login.php?cmd=force_login&client_id='.CLIENT_ID);
996 $tpl->ParseCurrentBlock();
1002 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1003 $txt = $nd[
'title'] ==
'ILIAS' ? $lng->txt(
'repository') : $nd[
'title'];
1005 $tpl->SetCurrentBlock(
"ErrorLink");
1006 $tpl->SetVariable(
"TXT_LINK", $txt);
1007 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/repository.php?client_id='.CLIENT_ID);
1008 $tpl->ParseCurrentBlock();
1011 $tpl->setCurrentBlock(
"content");
1012 $tpl->setVariable(
"ERROR_MESSAGE",($this->errortext));
1014 $tpl->parseCurrentBlock();
1029 if (isset($this->mimetype))
1035 if (extension_loaded(
'Fileinfo'))
1037 $finfo = finfo_open(FILEINFO_MIME);
1038 $mime = finfo_file($finfo, $this->file);
1039 finfo_close($finfo);
1040 if ($pos = strpos($mime,
' '))
1042 $mime = substr($mime, 0, $pos);
1051 $this->mimetype = $mime ? $mime : $default;