added hash_base system (base refs gets stored in the _SESSION)
[phpgitweb.git] / htdocs / lib / PHPGitWeb.class.php
index 5789d1f098152191c09d38bd4d2f013fd9451d1f..dee929252a051562fee362740df486deb5a7f512 100644 (file)
@@ -31,6 +31,7 @@ class PHPGitWeb {
        
     public function __construct() {
                $this->rendertime = microtime(true);
+               session_start();
                $this->page = new ContentProvider('main', 'main');
                set_error_handler(array($this, "error_handler"));
                $this->append_header_nav('projects', '?a=projects', false);
@@ -51,7 +52,8 @@ class PHPGitWeb {
                        $this->page->append('content', new ContentProvider('main', 'err404_project'));
                else {
                        ContentProvider::overall_set('project', $this->project['name']);
-                       ContentProvider::overall_set('project_head', "HEAD");
+                       ContentProvider::overall_set('commit_base_id', "all");
+                       ContentProvider::overall_set('commit_id', "HEAD");
                        $this->append_header_nav($this->project['name'], '?p='.$this->project['name'].'&a=summary', true);
                        $this->append_title(" - ".$this->project['name'], false);
                        $this->project_header = new ContentProvider('main', 'project_header');
@@ -77,12 +79,12 @@ class PHPGitWeb {
                } else
                        $this->page->append('content', file_get_contents('pages/404.html'));
                if($this->project_header) {
-                       $this->project_header->set('nav_summary',    new ContentProvider('main', ($page == 'summary'    ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "summary",    'link' => "summary")));
-                       $this->project_header->set('nav_shortlog',   new ContentProvider('main', ($page == 'shortlog'   ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "shortlog",   'link' => "shortlog")));
-                       $this->project_header->set('nav_log',        new ContentProvider('main', ($page == 'log'        ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "log",        'link' => "log")));
-                       $this->project_header->set('nav_commit',     new ContentProvider('main', ($page == 'commit'     ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commit",     'link' => "commit")));
-                       $this->project_header->set('nav_commitdiff', new ContentProvider('main', ($page == 'commitdiff' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commitdiff", 'link' => "commitdiff")));
-                       $this->project_header->set('nav_tree',       new ContentProvider('main', ($page == 'tree'       ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "tree",       'link' => "tree")));
+                       $this->project_header->set('nav_summary',    new ContentProvider('main', ($page == 'summary'    ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "summary",    'link' => "summary",    'link_add' => "")));
+                       $this->project_header->set('nav_shortlog',   new ContentProvider('main', ($page == 'shortlog'   ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "shortlog",   'link' => "shortlog",   'link_add' => "&h=%commit_base_id%")));
+                       $this->project_header->set('nav_log',        new ContentProvider('main', ($page == 'log'        ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "log",        'link' => "log",        'link_add' => "&h=%commit_base_id%")));
+                       $this->project_header->set('nav_commit',     new ContentProvider('main', ($page == 'commit'     ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commit",     'link' => "commit",     'link_add' => "&h=%commit_id%")));
+                       $this->project_header->set('nav_commitdiff', new ContentProvider('main', ($page == 'commitdiff' ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "commitdiff", 'link' => "commitdiff", 'link_add' => "&h=%commit_id%")));
+                       $this->project_header->set('nav_tree',       new ContentProvider('main', ($page == 'tree'       ? 'project_header_nav_active' : 'project_header_nav_link'), array('name' => "tree",       'link' => "tree",       'link_add' => "&h=%commit_id%")));
                }
        }