/**
  * __construct
  *
  * Constructor
  *
  * @access public
  * @return controller
  */
 public function __construct()
 {
     try {
         parent::__construct();
     } catch (Exception $e) {
     }
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     if (empty($this->params['page'])) {
         $this->params['page'] = 0;
     }
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     if (!empty($this->params['output']) && $this->params['output'] == 'jstip') {
         $this->DisableLogging();
     }
 }
 /**
  * __construct
  *
  * Constructor
  *
  * @access public
  * @return controller
  */
 public function __construct()
 {
     parent::__construct();
     if (!$this->project) {
         throw new GitPHP_MessageException(__('Project is required'), true);
     }
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     if (!$this->config->GetValue('search')) {
         throw new GitPHP_SearchDisabledException();
     }
     if (empty($this->params['hash'])) {
         $this->params['hash'] = 'HEAD';
     }
     if (empty($this->params['page'])) {
         $this->params['page'] = 0;
     }
     if (!isset($this->params['searchtype'])) {
         $this->params['searchtype'] = GitPHP_Controller_Search::CommitSearch;
     }
     if ($this->params['searchtype'] == GitPHP_Controller_Search::FileSearch) {
         if (!$this->config->GetValue('filesearch')) {
             throw new GitPHP_SearchDisabledException(true);
         }
     }
     if ($this->params['searchtype'] !== GitPHP_Controller_Search::AuthorSearch && $this->params['searchtype'] !== GitPHP_Controller_Search::CommitterSearch && $this->params['searchtype'] !== GitPHP_Controller_Search::CommitSearch && $this->params['searchtype'] !== GitPHP_Controller_Search::FileSearch) {
         throw new GitPHP_InvalidSearchTypeException();
     }
     if (!isset($this->params['search']) || strlen($this->params['search']) < 2) {
         throw new GitPHP_SearchLengthException(2);
     }
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     if (!$this->config->GetValue('graphs')) {
         throw new Exception('Graphing has been disabled');
     }
     $this->preserveWhitespace = true;
     $this->DisableLogging();
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     if (!$this->config->GetValue('graphs')) {
         throw new Exception('Graphing has been disabled');
     }
     if (empty($this->params['graphtype'])) {
         $this->params['graphtype'] = 'commitactivity';
     }
 }
 /**
  * __construct
  *
  * Constructor
  *
  * @access public
  * @return controller
  */
 public function __construct()
 {
     if (!GitPHP_Config::GetInstance()->GetValue('search', true)) {
         throw new GitPHP_MessageException(__('Search has been disabled'), true);
     }
     parent::__construct();
     if (!$this->project) {
         throw new GitPHP_MessageException(__('Project is required'), true);
     }
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     if (empty($this->params['hashbase'])) {
         $this->params['hashbase'] = 'HEAD';
     }
     if (!empty($this->params['output']) && $this->params['output'] == 'js') {
         $this->DisableLogging();
     }
 }
 /**
  * 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;
             }
         }
     }
 }
 /**
  * __construct
  *
  * Constructor
  *
  * @access public
  * @return controller
  */
 public function __construct()
 {
     parent::__construct();
 }
 /**
  * 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();
     }
 }
 /**
  * Renders the output
  */
 public function Render()
 {
     if (isset($this->params['output']) && $this->params['output'] == 'js') {
         $result = array();
         if ($this->loginSuccess === true) {
             $result['success'] = true;
         } else {
             $result['success'] = false;
             if ($this->loginSuccess === false) {
                 if ($this->resource) {
                     $result['message'] = $this->resource->translate('Invalid username or password');
                 } else {
                     $result['message'] = 'Invalid username or password';
                 }
             }
         }
         echo json_encode($result);
         return;
     }
     if ($this->loginSuccess === true) {
         return;
     }
     // logged in and redirected, don't render
     return parent::Render();
 }
 /**
  * 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();
         }
     }
 }
 /**
  * Initialize controller
  */
 public function Initialize()
 {
     parent::Initialize();
     $this->preserveWhitespace = true;
     $this->DisableLogging();
 }