function _DownloadFile($filename = "", $cacheSeconds = 1800, $contentType = "application/zip") { global $AR; $context = pobject::getContext(); $me = $context['arCurrentObject']; $size = filesize($this->_filename); ldSetContent($contentType, $size); $expires = time() + $cacheSeconds; if ($AR->user->data->login == "public" || $me->CheckPublic("read")) { ldSetClientCache(true, $expires); } if ($filename) { ldHeader("Content-Disposition: attachment; filename={$filename}"); ldHeader("Content-length:" . (string) $size); } readfile($this->_filename); }
public function CheckLogin($grant, $modifier = ARTHISTYPE) { global $AR, $ARnls, $ARConfig, $ARCurrent, $ARConfigChecked; if (!$this->store->is_supported("grants")) { debug("pobject: store doesn't support grants"); return true; } if ($modifier == ARTHISTYPE) { $modifier = $this->type; } /* load config cache */ if (!isset($ARConfig->cache[$this->path])) { // since this is usually run before CheckConfig, make sure // it doesn't set cache time $realConfigChecked = $ARConfigChecked; $ARConfigChecked = true; $this->loadConfig(); $ARConfigChecked = $realConfigChecked; } $isadmin = $this->CheckAdmin($AR->user); if (!$isadmin && !$AR->user->grants[$this->path]) { $grants = $this->GetValidGrants(); } else { $grants = $AR->user->grants[$this->path]; } if ($AR->user->data->login != "public") { // Don't remove this or MSIE users won't get uptodate pages... ldSetClientCache(false); } if ((!$grants[$grant] || $modifier && is_array($grants[$grant]) && !$grants[$grant][$modifier]) && !$isadmin) { // do login $arLoginMessage = $ARnls["accessdenied"]; ldAccessDenied($this->path, $arLoginMessage); $result = false; } else { $result = $grants || $isadmin; } $ARCurrent->arLoginSilent = 1; return $result; }