Add project index link
Add project index link

--- /dev/null
+++ b/include/display.git_project_index.php
@@ -1,1 +1,27 @@
+<?php
+/*
+ *  display.git_project_index.php
+ *  gitphp: A PHP git repository browser
+ *  Component: Display - project index
+ *
+ *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
+ */
 
+ include_once('gitutil.git_read_projects.php');
+
+function git_project_index($projectroot, $projectlist)
+{
+	$projlist = git_read_projects($projectroot, $projectlist);
+	header("Content-type: text/plain; charset=utf-8");
+	header("Content-Disposition: inline; filename=\"index.aux\"");
+	foreach ($projlist as $cat => $plist) {
+		if (is_array($plist)) {
+			foreach ($plist as $i => $proj)
+				echo $proj . "\n";
+		} else
+			echo $plist . "\n";
+	}
+}
+
+?>
+

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -33,6 +33,10 @@
 	$suppress_headers = TRUE;
 	include_once('include/display.git_opml.php');
 	git_opml($gitphp_conf['projectroot'],$git_projects);
+ } else if (isset($_GET['a']) && $_GET['a'] == "project_index") {
+	$suppress_headers = TRUE;
+	include_once('include/display.git_project_index.php');
+	git_project_index($gitphp_conf['projectroot'],$git_projects);
  } else if (isset($_GET['p'])) {
  	if (!is_dir($gitphp_conf['projectroot'] . $_GET['p']))
 		echo "No such directory";

--- a/templates/footer.tpl
+++ b/templates/footer.tpl
@@ -13,6 +13,7 @@
   <a href="{$SCRIPT_NAME}?p={$project}&a=rss" class="rss_logo">RSS</a>
 {else}
   <a href="{$SCRIPT_NAME}?a=opml" class="rss_logo">OPML</a>
+  <a href="{$SCRIPT_NAME}?a=project_index" class="rss_logo">TXT</a>
 {/if}
 </div>
 </body>

comments