/**
  * __construct
  *
  * Constructor
  *
  * @access public
  * @return controller
  */
 public function __construct()
 {
     if (isset($_GET['p'])) {
         $this->project = GitPHP_ProjectList::GetInstance()->GetProject(str_replace(chr(0), '', $_GET['p']));
         if (!$this->project) {
             throw new GitPHP_MessageException(sprintf(__('Invalid project %1$s'), $_GET['p']), true);
         }
     }
     if (!$this->project) {
         throw new GitPHP_MessageException(__('Project is required'), true);
     }
     $this->preserveWhitespace = true;
     $this->ReadQuery();
 }
 /**
  * LoadData
  *
  * Loads data for this template
  *
  * @access protected
  */
 protected function LoadData()
 {
     $this->tpl->assign('order', $this->params['order']);
     $projectList = GitPHP_ProjectList::GetInstance();
     $projectList->Sort($this->params['order']);
     if ((empty($this->params['opml']) || $this->params['opml'] !== true) && (empty($this->params['txt']) || $this->params['txt'] !== true) && !empty($this->params['search'])) {
         $this->tpl->assign('search', $this->params['search']);
         $matches = $projectList->Filter($this->params['search']);
         if (count($matches) > 0) {
             $this->tpl->assign('projectlist', $matches);
         }
     } else {
         if ($projectList->Count() > 0) {
             $this->tpl->assign('projectlist', $projectList);
         }
     }
 }
Beispiel #3
0
 /**
  * DereferenceProject
  *
  * Turns the project reference pointer back into an object
  *
  * @access private
  */
 private function DereferenceProject()
 {
     if (!$this->projectReferenced) {
         return;
     }
     $this->project = GitPHP_ProjectList::GetInstance()->GetProject($this->project);
     $this->projectReferenced = false;
 }
 /**
  * GetCacheKeyPrefix
  *
  * Get the prefix for all cache keys
  *
  * @access private
  * @param string $projectKeys include project-specific key pieces
  * @return string cache key prefix
  */
 private function GetCacheKeyPrefix($projectKeys = true)
 {
     $cacheKeyPrefix = GitPHP_Resource::GetLocale();
     $projList = GitPHP_ProjectList::GetInstance();
     if ($projList) {
         $cacheKeyPrefix .= '|' . sha1(serialize($projList->GetConfig())) . '|' . sha1(serialize($projList->GetSettings()));
         unset($projList);
     }
     if ($this->project && $projectKeys) {
         $cacheKeyPrefix .= '|' . sha1($this->project->GetProject());
     }
     return $cacheKeyPrefix;
 }