Add rss link and other bugfixes
Add rss link and other bugfixes

--- a/gitphp.lib.php
+++ b/gitphp.lib.php
@@ -138,7 +138,7 @@
 		}
 	}
 	/*
-	 * Store title and comment
+	 * TODO: Store title and comment
 	 */
 	$age = time() - $commit['committer_epoch'];
 	$commit['age'] = $age;

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -41,12 +41,32 @@
   */
  include_once('gitphp.lib.php');
 
+ $rss_link = FALSE;
+
+ ob_start();
+ if (isset($_GET['p'])) {
+ 	if (!is_dir($gitphp_conf['projectroot'] . $_GET['p']))
+		echo "No such directory";
+	else if (!is_file($gitphp_conf['projectroot'] . $_GET['p'] . "/HEAD"))
+		echo "No such project";
+	else {
+		$rss_link = TRUE;
+	}
+ } else
+ 	git_project_list($gitphp_conf['projectroot'],$git_projects);
+ $main = ob_get_contents();
+ ob_end_clean();
+
  $tpl->clear_all_assign();
  $tpl->assign("version",$version);
  $tpl->assign("title",$gitphp_conf['title']);
+ if ($rss_link) {
+ 	$tpl->assign("rss_link",TRUE);
+	$tpl->assign("project",$_GET['p']);
+ }
  $tpl->display("header.tpl");
 
- git_project_list($gitphp_conf['projectroot'],$git_projects);
+ echo $main;
 
  $tpl->display("footer.tpl");
 

--- a/templates/header.tpl
+++ b/templates/header.tpl
@@ -27,6 +27,9 @@
 <!-- gitphp web interface {$version}, (C) 2006 Christopher Han <xiphux@gmail.com> -->
 <head>
 <title>{$title}</title>
+{if $rss_link}
+<link rel="alternate" title="{$project} log" href="{$SCRIPT_NAME}?p={$project}&a=rss" type="application/rss+xml" />
+{/if}
 {literal}<style type="text/css">/*<![CDATA[[*/<!--
  .italic {font-style:italic;}
  .bold {font-weight:bold;}
@@ -97,7 +100,7 @@
 <a href="http://www.kernel.org/pub/software/scm/git/docs/" title="git documentation">
 <img src="images/git-logo.png" width="72" height="27" alt="git" style="float:right; border-width:0px;" />
 </a>
-<a href="{$SCRIPT_NAME}">projects</a> / 
+<a href="index.php">projects</a> / 
 {if $project}
   <a href="{$SCRIPT_NAME}?p={$project}&a=summary">{$project}</a>
   {if $action}

comments