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");
 
  371                                                         foreach ($this->check_users as $user_id)
 
  373                                                                 if ($ilObjDataCache->lookupType($oid) == 
'usr' && $oid == $user_id)
 
  426                 $this->errorcode = 403;
 
  427                 $this->errortext = $this->lng->txt(
'msg_no_perm_read');
 
  448                                 foreach ($this->check_users as $user_id)
 
  450                                         if ($this->ilAccess->checkAccessOfUser($user_id, 
"read", 
"view", $ref_id, $obj_id, $obj_type))
 
  493                         foreach ($this->check_users as $user_id)
 
  495                                 if ($ilAccess->checkAccessOfUser($user_id, 
"read", 
"view", $ref_id, $obj_type, $obj_id))
 
  524                 if ($obj_type == 
'qpl')
 
  528                         include_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
 
  530                         foreach (
$tests as $test_id)
 
  558                 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
 
  559                 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
  562                 include_once(
'./Services/COPage/classes/class.ilInternalLink.php');
 
  567                         foreach ($sources as $src)
 
  569                                 switch ($src[
'type'])
 
  574                                                 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
  614                 if (
$usr_id == $ilUser->getId())
 
  621                 if ($public_upload != 
'y')
 
  629                 if ($public_profile == 
'g'  
  630                         and $ilSetting->get(
'enable_global_profiles')
 
  631                         and $ilSetting->get(
'pub_section'))
 
  636                 elseif (($public_profile == 
'y' or $public_profile == 
'g')
 
  637                         and $ilUser->getId() != ANONYMOUS_USER_ID)
 
  657                 if (in_array(strtolower($a_disposition), array(
'inline',
'attachment',
'virtual')))
 
  659                         $this->disposition = strtolower($a_disposition);
 
  663                         $this->disposition = 
'inline';
 
  684                 if (in_array(strtolower($a_send_mimetype), array(
'',
'0',
'off',
'false')))
 
  686                         $this->mimetype = null;
 
  687                         $this->send_mimetype = 
false;
 
  689                 elseif (in_array(strtolower($a_send_mimetype), array(
'1',
'on',
'true')))
 
  691                         $this->mimetype = null;
 
  692                         $this->send_mimetype = 
true;
 
  696                         $this->mimetype = $a_send_mimetype;
 
  697                         $this->send_mimetype = 
true;
 
  718                 if (in_array(strtolower($a_check_ip), array(
'',
'0',
'off',
'false')))
 
  720                         $this->check_ip = 
false;
 
  722                 elseif (in_array(strtolower($a_check_ip), array(
'1',
'on',
'true')))
 
  724                         $this->check_ip = 
true;
 
  745                 $xsendfile_available = 
false;
 
  765                         if ($xsendfile_available)
 
  767                                 header(
'x-sendfile: ' . $this->file);
 
  768                                 header(
"Content-Type: application/octet-stream");
 
  777                         if (!isset($_SERVER[
"HTTPS"]))
 
  779                                 header(
"Cache-Control: no-cache, must-revalidate");
 
  780                                 header(
"Pragma: no-cache");
 
  787                         header(
"Content-Length: ".(
string)(filesize($this->file)));
 
  789                         if (isset($_SERVER[
"HTTPS"]))
 
  791                                 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
 
  792                                 header(
'Pragma: public');
 
  795                         header(
"Connection: close");
 
  797                         if ($xsendfile_available)
 
  799                                 header(
'x-sendfile: ' . $this->file);
 
  825                 header(
'Last-Modified: '. date (
"D, j M Y H:i:s", filemtime($this->file)). 
" GMT");
 
  826                 header(
'ETag: "'. md5(filemtime($this->file).filesize($this->file)).
'"');
 
  827                 header(
'Accept-Ranges: bytes');
 
  828                 header(
"Content-Length: ".(
string)(filesize($this->file)));
 
  834                 apache_setenv(
'ILIAS_CHECKED',
'1');     
 
  835                 virtual($this->virtual_path);
 
  848                 switch ($this->errorcode)
 
  851                                 header(
"HTTP/1.0 404 Not Found");
 
  855                                 header(
"HTTP/1.0 403 Forbidden");
 
  861                 $tpl->setCurrentBlock(
"HeadBaseTag");
 
  862                 $tpl->setVariable(
'BASE', ILIAS_HTTP_PATH . 
'/error.php');
 
  863                 $tpl->parseCurrentBlock();
 
  864         $tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.error.html");
 
  867                 $anonymous = ($ilUser->getId() == ANONYMOUS_USER_ID);
 
  873                         $tpl->SetCurrentBlock(
"ErrorLink");
 
  874                         $tpl->SetVariable(
"TXT_LINK", $lng->txt(
'login_to_ilias'));
 
  875                         $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH. 
'/login.php?cmd=force_login&client_id='.CLIENT_ID);
 
  876                         $tpl->ParseCurrentBlock();
 
  882                         $nd = $tree->getNodeData(ROOT_FOLDER_ID);
 
  883                         $txt = $nd[
'title'] == 
'ILIAS' ? $lng->txt(
'repository') : $nd[
'title'];
 
  885                         $tpl->SetCurrentBlock(
"ErrorLink");
 
  886                         $tpl->SetVariable(
"TXT_LINK", $txt);
 
  887                         $tpl->SetVariable(
"LINK", ILIAS_HTTP_PATH. 
'/repository.php?client_id='.CLIENT_ID);
 
  888                         $tpl->ParseCurrentBlock();
 
  891                 $tpl->setCurrentBlock(
"content");
 
  892                 $tpl->setVariable(
"ERROR_MESSAGE",($this->errortext));
 
  894                 $tpl->parseCurrentBlock();
 
  906         public function getMimeType($default = 
'application/octet-stream')
 
  909                 if (isset($this->mimetype))
 
  915                 if (extension_loaded(
'Fileinfo'))
 
  917                         $finfo = finfo_open(FILEINFO_MIME);
 
  918                         $mime = finfo_file($finfo, $this->file);
 
  920                         if ($pos = strpos($mime, 
' '))
 
  922                                 $mime = substr($mime, 0, $pos);
 
  931                 $this->mimetype = $mime ? $mime : $default;