23 require_once
"./include/inc.header.php";
24 require_once
"./Services/Utilities/classes/class.ilUtil.php";
25 require_once
"./classes/class.ilObject.php";
26 require_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
113 $this->checked_list = &
$_SESSION[
"WebAccessChecked"];
114 $this->params = array();
119 $_SESSION[
"AccountId"] = ANONYMOUS_USER_ID;
120 $ilUser->setId(ANONYMOUS_USER_ID);
125 $uri = parse_url($_SERVER[
"REQUEST_URI"]);
126 parse_str($uri[
"query"], $this->params);
129 $this->subpath = urldecode(substr($uri[
"path"], strpos($uri[
"path"], $pattern)));
152 if (file_exists($this->file))
159 $this->errorcode = 404;
160 $this->errortext = $this->lng->txt(
"url_not_found");
171 global
$ilLog, $ilUser, $ilObjDataCache;
172 $pos1 = strpos($this->subpath,
"lm_data/lm_") + 11;
173 $pos2 = strpos($this->subpath,
"mobs/mm_") + 8;
174 $pos3 = strpos($this->subpath,
"usr_images/") + 11;
182 $seperator = strpos($this->subpath,
'/', $pos1);
183 $obj_id = substr($this->subpath, $pos1, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos1);
189 $seperator = strpos($this->subpath,
'/', $pos2);
190 $obj_id = substr($this->subpath, $pos2, ($seperator > 0 ? $seperator : strlen($this->subpath))-$pos2);
195 $type =
'user_image';
199 $seperator = strpos($this->subpath,
'_', $pos3);
200 $obj_id = (int) substr($this->subpath, $seperator + 1);
203 if (!$obj_id ||
$type ==
'none')
213 foreach($usages as $usage)
216 switch($usage[
'type'])
228 include_once(
"./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php");
229 include_once(
"./Services/News/classes/class.ilNewsItem.php");
238 if ($ilObjDataCache->lookupType($oid) ==
'usr' && $oid == $ilUser->getId())
248 if ($this->ilAccess->checkAccess(
"read",
"view", $ref_id, $obj_type, $oid))
272 if ($this->ilAccess->checkAccess(
"read",
"", $ref_id))
306 if (
$usr_id == $ilUser->getId())
313 if ($public_upload !=
'y')
321 if ($public_profile ==
'g'
322 and $ilSetting->get(
'enable_global_profiles')
323 and $ilSetting->get(
'pub_section'))
328 elseif (($public_profile ==
'y' or $public_profile ==
'g')
329 and $ilUser->getId() != ANONYMOUS_USER_ID)
349 $this->disposition = $a_disposition;
370 $xsendfile_available =
false;
382 if ($xsendfile_available)
384 header(
'x-sendfile: ' . $this->file);
385 header(
"Content-Type: application/octet-stream");
393 if (!isset($_SERVER[
"HTTPS"]))
395 header(
"Cache-Control: no-cache, must-revalidate");
396 header(
"Pragma: no-cache");
399 header(
"Content-Type: " . $this->mimetype);
400 header(
"Content-Length: ".(
string)(filesize($this->file)));
402 if (isset($_SERVER[
"HTTPS"]))
404 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
405 header(
'Pragma: public');
408 header(
"Connection: close");
410 if ($xsendfile_available)
412 header(
'x-sendfile: ' . $this->file);
413 header(
"Content-Type: " . $this->mimetype);
430 switch ($this->errorcode)
433 header(
"HTTP/1.0: 404 Not Found");
437 header(
"HTTP/1.0: 403 Forbidden");
440 exit($this->errortext);
443 public function getMimeType($default =
'application/octet-stream')
446 if (extension_loaded(
'Fileinfo'))
448 $finfo = finfo_open(FILEINFO_MIME);
449 $mime = finfo_file($finfo, $this->file);
451 if ($pos = strpos($mime,
' '))
453 $mime = substr($mime, 0, $pos);
459 $this->mimetype = $mime ? $mime : $default;