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");
338 foreach($usages as $usage)
342 switch($usage[
'type'])
355 include_once(
"./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php");
356 include_once(
"./Services/News/classes/class.ilNewsItem.php");
414 $this->errorcode = 403;
415 $this->errortext = $this->lng->txt(
'msg_no_perm_read');
436 foreach ($this->check_users as $user_id)
438 if ($this->ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_id, $obj_type))
480 foreach ($this->check_users as $user_id)
482 if ($ilAccess->checkAccessOfUser($user_id,
"read",
"view", $ref_id, $obj_type, $obj_id))
511 if ($obj_type ==
'qpl')
515 include_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
517 foreach (
$tests as $test_id)
545 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
546 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
549 include_once(
'./Services/COPage/classes/class.ilInternalLink.php');
554 foreach ($sources as $src)
556 switch ($src[
'type'])
561 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
601 if (
$usr_id == $ilUser->getId())
608 if ($public_upload !=
'y')
616 if ($public_profile ==
'g'
617 and $ilSetting->get(
'enable_global_profiles')
618 and $ilSetting->get(
'pub_section'))
623 elseif (($public_profile ==
'y' or $public_profile ==
'g')
624 and $ilUser->getId() != ANONYMOUS_USER_ID)
644 if (in_array(strtolower($a_disposition), array(
'inline',
'attachment',
'virtual')))
646 $this->disposition = strtolower($a_disposition);
650 $this->disposition =
'inline';
671 if (in_array(strtolower($a_send_mimetype), array(
'',
'0',
'off',
'false')))
673 $this->mimetype = null;
674 $this->send_mimetype =
false;
676 elseif (in_array(strtolower($a_send_mimetype), array(
'1',
'on',
'true')))
678 $this->mimetype = null;
679 $this->send_mimetype =
true;
683 $this->mimetype = $a_send_mimetype;
684 $this->send_mimetype =
true;
705 if (in_array(strtolower($a_check_ip), array(
'',
'0',
'off',
'false')))
707 $this->check_ip =
false;
709 elseif (in_array(strtolower($a_check_ip), array(
'1',
'on',
'true')))
711 $this->check_ip =
true;
732 $xsendfile_available =
false;
752 if ($xsendfile_available)
754 header(
'x-sendfile: ' . $this->file);
755 header(
"Content-Type: application/octet-stream");
764 if (!isset($_SERVER[
"HTTPS"]))
766 header(
"Cache-Control: no-cache, must-revalidate");
767 header(
"Pragma: no-cache");
774 header(
"Content-Length: ".(
string)(filesize($this->file)));
776 if (isset($_SERVER[
"HTTPS"]))
778 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
779 header(
'Pragma: public');
782 header(
"Connection: close");
784 if ($xsendfile_available)
786 header(
'x-sendfile: ' . $this->file);
812 header(
'Last-Modified: '. date (
"D, j M Y H:i:s", filemtime($this->file)).
" GMT");
813 header(
'ETag: "'. md5(filemtime($this->file).filesize($this->file)).
'"');
814 header(
'Accept-Ranges: bytes');
815 header(
"Content-Length: ".(
string)(filesize($this->file)));
821 apache_setenv(
'ILIAS_CHECKED',
'1');
822 virtual($this->virtual_path);
835 switch ($this->errorcode)
838 header(
"HTTP/1.0 404 Not Found");
842 header(
"HTTP/1.0 403 Forbidden");
848 $tpl->setCurrentBlock(
"HeadBaseTag");
849 $tpl->setVariable(
'BASE', ILIAS_HTTP_PATH .
'/error.php');
850 $tpl->parseCurrentBlock();
851 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.error.html");
854 $anonymous = ($ilUser->getId() == ANONYMOUS_USER_ID);
860 $tpl->SetCurrentBlock(
"ErrorLink");
861 $tpl->SetVariable(
"TXT_LINK", $lng->txt(
'login_to_ilias'));
862 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/login.php?cmd=force_login&client_id='.CLIENT_ID);
863 $tpl->ParseCurrentBlock();
869 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
870 $txt = $nd[
'title'] ==
'ILIAS' ? $lng->txt(
'repository') : $nd[
'title'];
872 $tpl->SetCurrentBlock(
"ErrorLink");
873 $tpl->SetVariable(
"TXT_LINK", $txt);
874 $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH.
'/repository.php?client_id='.CLIENT_ID);
875 $tpl->ParseCurrentBlock();
878 $tpl->setCurrentBlock(
"content");
879 $tpl->setVariable(
"ERROR_MESSAGE",($this->errortext));
881 $tpl->parseCurrentBlock();
893 public function getMimeType($default =
'application/octet-stream')
896 if (isset($this->mimetype))
902 if (extension_loaded(
'Fileinfo'))
904 $finfo = finfo_open(FILEINFO_MIME);
905 $mime = finfo_file($finfo, $this->file);
907 if (
$pos = strpos($mime,
' '))
909 $mime = substr($mime, 0,
$pos);
918 $this->mimetype = $mime ? $mime : $default;