/** * Loads headers for this template */ protected function LoadHeaders() { parent::LoadHeaders(); if ($this->params['exception'] instanceof GitPHP_MessageException && $this->params['exception']->StatusCode) { $partialHeader = $this->StatusCodeHeader($this->params['exception']->StatusCode); if (!empty($partialHeader)) { if (substr(php_sapi_name(), 0, 8) == 'cgi-fcgi') { /* * FastCGI requires a different header */ $this->headers[] = 'Status: ' . $partialHeader; } else { $this->headers[] = 'HTTP/1.1 ' . $partialHeader; } } } }
/** * Loads headers for this template */ protected function LoadHeaders() { if ($this->Plain()) { $this->DisableLogging(); $this->headers[] = 'Content-type: text/plain; charset=UTF-8'; } else { parent::LoadHeaders(); } }
/** * Loads headers for this template */ protected function LoadHeaders() { if ($this->Plain()) { $this->DisableLogging(); $this->preserveWhitespace = true; // XXX: Nasty hack to cache headers if (!$this->tpl->isCached('blobheaders.tpl', $this->GetFullCacheKey())) { if (isset($this->params['file'])) { $saveas = GitPHP_Util::BaseName($this->params['file']); } else { $saveas = $this->params['hash'] . ".txt"; } $headers = array(); $mime = null; if ($this->config->GetValue('filemimetype')) { if (!isset($this->params['hash']) && isset($this->params['file'])) { $commit = $this->GetProject()->GetCommit($this->params['hashbase']); $this->params['hash'] = $commit->GetTree()->PathToHash($this->params['file']); if (empty($this->params['hash'])) { throw new GitPHP_FileNotFoundException($this->params['file']); } } $blob = $this->GetProject()->GetObjectManager()->GetBlob($this->params['hash']); if (!empty($this->params['file'])) { $blob->SetPath($this->params['file']); } $mimeReader = new GitPHP_FileMimeTypeReader($blob, $this->GetMimeStrategy()); $mime = trim($mimeReader->GetMimeType()); } if ($mime) { $headers[] = "Content-type: {$mime}; charset=UTF-8"; } else { $headers[] = "Content-type: text/plain; charset=UTF-8"; } $headers[] = "Content-disposition: inline; filename=\"" . $saveas . "\""; $this->tpl->assign("blobheaders", serialize($headers)); } $out = $this->tpl->fetch('blobheaders.tpl', $this->GetFullCacheKey()); $this->headers = unserialize(trim($out)); } else { parent::LoadHeaders(); } }
/** * Loads headers for this template */ protected function LoadHeaders() { if (isset($this->params['opml']) && $this->params['opml'] === true) { $this->headers[] = "Content-type: text/xml; charset=UTF-8"; $this->DisableLogging(); $this->preserveWhitespace = true; } else { if (isset($this->params['txt']) && $this->params['txt'] === true) { $this->headers[] = "Content-type: text/plain; charset=utf-8"; $this->headers[] = "Content-Disposition: inline; filename=\"index.aux\""; $this->DisableLogging(); } else { parent::LoadHeaders(); } } }