Move config to its own dir
Move config to its own dir

file:a/config.inc.php (deleted)
<?php  
/*  
* config.inc.php  
* gitphp: A PHP git repository browser  
* Component: Configuration  
*  
* Copyright (C) 2006 Christopher Han <xiphux@gmail.com>  
*  
* This program is free software; you can redistribute it and/or modify  
* it under the terms of the GNU General Public License as published by  
* the Free Software Foundation; either version 2 of the License, or  
* (at your option) any later version.  
*  
* This program is distributed in the hope that it will be useful,  
* but WITHOUT ANY WARRANTY; without even the implied warranty of  
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
* GNU Library General Public License for more details.  
*  
* You should have received a copy of the GNU General Public License  
* along with this program; if not, write to the Free Software  
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
*/  
 
/*  
* stylesheet  
* Path to page stylesheet  
*/  
$gitphp_conf['stylesheet'] = "gitphp.css";  
 
/*  
* projectroot  
* Absolute filesystem path prepended to project paths  
* (don't forget trailing slash!)  
*/  
$gitphp_conf['projectroot'] = "/git/";  
 
/*  
* gitbin  
* Path to git binaries (don't forget trailing slash!)  
* (Leave blank or comment to just use $PATH)  
*/  
$gitphp_conf['gitbin'] = "/usr/bin/";  
 
/*  
* gittmp  
* Location for temporary files for diffs  
* (don't forget trailing slash!)  
*/  
$gitphp_conf['gittmp'] = "/tmp/gitphp/";  
 
/*  
* title  
* The string that will be used as the page title  
* The variable '$gitphp_appstring' will expand to  
* the name (gitphp) and version  
*/  
$gitphp_conf['title'] = "centraldogma :: $gitphp_appstring";  
 
/*  
* self  
* This is the path to the script that will be inserted  
* in urls.  
* If only specifying the directory path (and omitting the  
* index.php filename), make sure to include the trailing  
* slash!  
*/  
$gitphp_conf['self'] = "http://centraldogma/gitphp/";  
 
/*  
* smarty_prefix  
* This is the prefix where smarty is installed.  
* (including trailing slash)  
* If an absolute (starts with /) path is given,  
* Smarty.class.php will be searched for in that directory.  
* If a relative (doesn't start with /) path is given,  
* that subdirectory inside the php include dirs will be  
* searched. So, for example, if you specify the path as  
* "/usr/share/Smarty/" then the script will look for  
* /usr/share/Smarty/Smarty.class.php.  
* If you specify the path as "smarty/" then it will search  
* the include directories in php.ini's include_path directive,  
* so it would search in places like /usr/share/php and /usr/lib/php:  
* /usr/share/php/smarty/Smarty.class.php,  
* /usr/lib/php/smarty/Smarty.class.php, etc.  
* Leave blank to just search in the root of the php include directories  
* like /usr/share/php/Smarty.class.php, /usr/lib/php/Smarty.class.php, etc.  
*/  
$gitphp_conf['smarty_prefix'] = "smarty/";  
 
/*  
* bzsnapshots  
* If set to true, will bzcompress snapshot tars before sending them.  
* Your PHP must have been compiled with bzip2 support!  
*/  
$gitphp_conf['bzsnapshots'] = TRUE;  
 
/*  
* bzblocksize  
* Sets the compression level for bzip2. Ranges from 1-9, with  
* 9 being the most compression but requiring the most processing  
* (bzip defaults to 4)  
*/  
$gitphp_conf['bzblocksize'] = 9;  
 
/*  
* geshi  
* Run blob output through geshi syntax highlighting  
* and line numbering  
*/  
$gitphp_conf['geshi'] = TRUE;  
 
/*  
* geshiroot  
* Directory where geshi is installed  
* NOTE: this is the path to the base geshi.php file to include,  
* NOT the various other geshi php source files!  
* Leave blank if geshi.php is in the gitphp root  
* (don't forget trailing slash!)  
*/  
$gitphp_conf['geshiroot'] = "geshi/";  
 
/*  
* git_projects  
* Two-dimensional array list of projects  
* First array index is the name of the category the projects  
* belong to, and the second array index is a human-readable  
* name for the project (not used, just for organizational  
* purposes), and the value is the path to the project  
* (minus the projectroot).  
* Any projects belonging to the special category "none"  
* will be listed without a category.  
* Comment out $git_projects (leave null) to attempt to read all  
* projects in the projectroot.  
*/  
$git_projects['Core']['FBX'] = "core/fbx.git";  
$git_projects['Core']['Mvm'] = "core/mvm.git";  
$git_projects['Core']['PySoulforge'] = "core/pysoulforge.git";  
$git_projects['Core']['Scripts'] = "core/scripts.git";  
$git_projects['Core']['Soulforge'] = "core/soulforge.git";  
$git_projects['Core']['XNSS'] = "core/xnss.git";  
$git_projects['Core']['XNSS_old'] = "core/xnss_old.git";  
$git_projects['PHP']['Codex'] = "php/codex.git";  
$git_projects['PHP']['gitphp'] = "php/gitphp.git";  
$git_projects['PHP']['MDB'] = "php/mdb.git";  
$git_projects['Nuclear']['Fusion'] = "nuclear/fusion.git";  
$git_projects['Websites']['lots'] = "websites/lots.git";  
$git_projects['Websites']['bth'] = "websites/bth.git";  
$git_projects['School']['CS135'] = "school/cs135.git";  
$git_projects['School']['CS150'] = "school/cs150.git";  
$git_projects['School']['CS151'] = "school/cs151.git";  
$git_projects['School']['CS156'] = "school/cs156.git";  
$git_projects['School']['CS160'] = "school/cs160.git";  
$git_projects['School']['CS161'] = "school/cs161.git";  
$git_projects['School']['CS169'] = "school/cs169.git";  
$git_projects['School']['CS178'] = "school/cs178.git";  
$git_projects['School']['CS180'] = "school/cs180.git";  
$git_projects['School']['CS189'] = "school/cs189.git";  
$git_projects['School']['CS183'] = "school/cs183.git";  
$git_projects['School']['CS193'] = "school/cs193.git";  
$git_projects['School']['CS195'] = "school/cs195.git";  
$git_projects['School']['CS196'] = "school/cs196.git";  
 
?>  
 
  <?php
  /*
  * config.inc.php
  * gitphp: A PHP git repository browser
  * Component: Configuration
  *
  * Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Library General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
  /*
  * stylesheet
  * Path to page stylesheet
  */
  $gitphp_conf['stylesheet'] = "gitphp.css";
 
  /*
  * projectroot
  * Absolute filesystem path prepended to project paths
  * (don't forget trailing slash!)
  */
  $gitphp_conf['projectroot'] = "/git/";
 
  /*
  * gitbin
  * Path to git binaries (don't forget trailing slash!)
  * (Leave blank or comment to just use $PATH)
  */
  $gitphp_conf['gitbin'] = "/usr/bin/";
 
  /*
  * gittmp
  * Location for temporary files for diffs
  * (don't forget trailing slash!)
  */
  $gitphp_conf['gittmp'] = "/tmp/gitphp/";
 
  /*
  * title
  * The string that will be used as the page title
  * The variable '$gitphp_appstring' will expand to
  * the name (gitphp) and version
  */
  $gitphp_conf['title'] = "centraldogma :: $gitphp_appstring";
 
  /*
  * self
  * This is the path to the script that will be inserted
  * in urls.
  * If only specifying the directory path (and omitting the
  * index.php filename), make sure to include the trailing
  * slash!
  */
  $gitphp_conf['self'] = "http://centraldogma/gitphp/";
 
  /*
  * smarty_prefix
  * This is the prefix where smarty is installed.
  * (including trailing slash)
  * If an absolute (starts with /) path is given,
  * Smarty.class.php will be searched for in that directory.
  * If a relative (doesn't start with /) path is given,
  * that subdirectory inside the php include dirs will be
  * searched. So, for example, if you specify the path as
  * "/usr/share/Smarty/" then the script will look for
  * /usr/share/Smarty/Smarty.class.php.
  * If you specify the path as "smarty/" then it will search
  * the include directories in php.ini's include_path directive,
  * so it would search in places like /usr/share/php and /usr/lib/php:
  * /usr/share/php/smarty/Smarty.class.php,
  * /usr/lib/php/smarty/Smarty.class.php, etc.
  * Leave blank to just search in the root of the php include directories
  * like /usr/share/php/Smarty.class.php, /usr/lib/php/Smarty.class.php, etc.
  */
  $gitphp_conf['smarty_prefix'] = "smarty/";
 
  /*
  * bzsnapshots
  * If set to true, will bzcompress snapshot tars before sending them.
  * Your PHP must have been compiled with bzip2 support!
  */
  $gitphp_conf['bzsnapshots'] = TRUE;
 
  /*
  * bzblocksize
  * Sets the compression level for bzip2. Ranges from 1-9, with
  * 9 being the most compression but requiring the most processing
  * (bzip defaults to 4)
  */
  $gitphp_conf['bzblocksize'] = 9;
 
  /*
  * geshi
  * Run blob output through geshi syntax highlighting
  * and line numbering
  */
  $gitphp_conf['geshi'] = TRUE;
 
  /*
  * geshiroot
  * Directory where geshi is installed
  * NOTE: this is the path to the base geshi.php file to include,
  * NOT the various other geshi php source files!
  * Leave blank if geshi.php is in the gitphp root
  * (don't forget trailing slash!)
  */
  $gitphp_conf['geshiroot'] = "geshi/";
 
  /*
  * git_projects
  * Two-dimensional array list of projects
  * First array index is the name of the category the projects
  * belong to, and the second array index is a human-readable
  * name for the project (not used, just for organizational
  * purposes), and the value is the path to the project
  * (minus the projectroot).
  * Any projects belonging to the special category "none"
  * will be listed without a category.
  * Comment out $git_projects (leave null) to attempt to read all
  * projects in the projectroot.
  */
  $git_projects['Core']['FBX'] = "core/fbx.git";
  $git_projects['Core']['Mvm'] = "core/mvm.git";
  $git_projects['Core']['PySoulforge'] = "core/pysoulforge.git";
  $git_projects['Core']['Scripts'] = "core/scripts.git";
  $git_projects['Core']['Soulforge'] = "core/soulforge.git";
  $git_projects['Core']['XNSS'] = "core/xnss.git";
  $git_projects['Core']['XNSS_old'] = "core/xnss_old.git";
  $git_projects['PHP']['Codex'] = "php/codex.git";
  $git_projects['PHP']['gitphp'] = "php/gitphp.git";
  $git_projects['PHP']['MDB'] = "php/mdb.git";
  $git_projects['Nuclear']['Fusion'] = "nuclear/fusion.git";
  $git_projects['Websites']['lots'] = "websites/lots.git";
  $git_projects['Websites']['bth'] = "websites/bth.git";
  $git_projects['School']['CS135'] = "school/cs135.git";
  $git_projects['School']['CS150'] = "school/cs150.git";
  $git_projects['School']['CS151'] = "school/cs151.git";
  $git_projects['School']['CS156'] = "school/cs156.git";
  $git_projects['School']['CS160'] = "school/cs160.git";
  $git_projects['School']['CS161'] = "school/cs161.git";
  $git_projects['School']['CS169'] = "school/cs169.git";
  $git_projects['School']['CS178'] = "school/cs178.git";
  $git_projects['School']['CS180'] = "school/cs180.git";
  $git_projects['School']['CS189'] = "school/cs189.git";
  $git_projects['School']['CS183'] = "school/cs183.git";
  $git_projects['School']['CS193'] = "school/cs193.git";
  $git_projects['School']['CS195'] = "school/cs195.git";
  $git_projects['School']['CS196'] = "school/cs196.git";
 
  ?>
 
file:a/index.php -> file:b/index.php
<?php <?php
ob_start(); ob_start();
$version = "v01d"; $version = "v01d";
$gitphp_appstring = "gitphp $version"; $gitphp_appstring = "gitphp $version";
/* /*
* index.php * index.php
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Index script * Component: Index script
* *
* Copyright (C) 2006 Christopher Han <xiphux@gmail.com> * Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
   
/* /*
* Configuration * Configuration
*/ */
include_once('config.inc.php'); include_once('config/gitphp.conf.php');
   
/* /*
* Instantiate Smarty * Instantiate Smarty
*/ */
include_once($gitphp_conf['smarty_prefix'] . "Smarty.class.php"); include_once($gitphp_conf['smarty_prefix'] . "Smarty.class.php");
$tpl =& new Smarty; $tpl =& new Smarty;
$tpl->load_filter('output','trimwhitespace'); $tpl->load_filter('output','trimwhitespace');
   
/* /*
* Function library * Function library
*/ */
include_once('gitphp.lib.php'); include_once('gitphp.lib.php');
   
$rss_link = FALSE; $rss_link = FALSE;
$suppress_headers = FALSE; $suppress_headers = FALSE;
   
ob_start(); ob_start();
if (isset($_GET['a']) && $_GET['a'] == "opml") { if (isset($_GET['a']) && $_GET['a'] == "opml") {
$suppress_headers = TRUE; $suppress_headers = TRUE;
git_opml($gitphp_conf['projectroot'],$git_projects); git_opml($gitphp_conf['projectroot'],$git_projects);
} else if (isset($_GET['p'])) { } else if (isset($_GET['p'])) {
if (!is_dir($gitphp_conf['projectroot'] . $_GET['p'])) if (!is_dir($gitphp_conf['projectroot'] . $_GET['p']))
echo "No such directory"; echo "No such directory";
else if (!is_file($gitphp_conf['projectroot'] . $_GET['p'] . "/HEAD")) else if (!is_file($gitphp_conf['projectroot'] . $_GET['p'] . "/HEAD"))
echo "No such project"; echo "No such project";
else { else {
$rss_link = TRUE; $rss_link = TRUE;
if (!isset($_GET['a'])) if (!isset($_GET['a']))
git_summary($gitphp_conf['projectroot'],$_GET['p']); git_summary($gitphp_conf['projectroot'],$_GET['p']);
else { else {
switch ($_GET['a']) { switch ($_GET['a']) {
case "summary": case "summary":
git_summary($gitphp_conf['projectroot'],$_GET['p']); git_summary($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "tree": case "tree":
git_tree($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f'],$_GET['hb']); git_tree($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f'],$_GET['hb']);
break; break;
case "shortlog": case "shortlog":
git_shortlog($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['pg']); git_shortlog($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['pg']);
break; break;
case "log": case "log":
git_log($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['pg']); git_log($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['pg']);
break; break;
case "commit": case "commit":
git_commit($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']); git_commit($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']);
break; break;
case "commitdiff": case "commitdiff":
git_commitdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hp']); git_commitdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hp']);
break; break;
case "commitdiff_plain": case "commitdiff_plain":
$suppress_headers = TRUE; $suppress_headers = TRUE;
git_commitdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hp']); git_commitdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hp']);
break; break;
case "heads": case "heads":
git_heads($gitphp_conf['projectroot'],$_GET['p']); git_heads($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "tags": case "tags":
git_tags($gitphp_conf['projectroot'],$_GET['p']); git_tags($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "rss": case "rss":
$suppress_headers = TRUE; $suppress_headers = TRUE;
git_rss($gitphp_conf['projectroot'],$_GET['p']); git_rss($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "blob": case "blob":
git_blob($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f'],$_GET['hb']); git_blob($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f'],$_GET['hb']);
break; break;
case "blob_plain": case "blob_plain":
$suppress_headers = TRUE; $suppress_headers = TRUE;
git_blob_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f']); git_blob_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f']);
break; break;
case "blobdiff": case "blobdiff":
git_blobdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],$_GET['f']); git_blobdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],$_GET['f']);
break; break;
case "blobdiff_plain": case "blobdiff_plain":
$suppress_headers = TRUE; $suppress_headers = TRUE;
git_blobdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],$_GET['f']); git_blobdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],$_GET['f']);
break; break;
case "snapshot": case "snapshot":
$suppress_headers = TRUE; $suppress_headers = TRUE;
git_snapshot($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']); git_snapshot($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']);
break; break;
case "history": case "history":
git_history($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f']); git_history($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['f']);
break; break;
default: default:
echo "Unknown action"; echo "Unknown action";
break; break;
} }
} }
} }
} else { } else {
$tpl->display("hometext.tpl"); $tpl->display("hometext.tpl");
git_project_list($gitphp_conf['projectroot'],$git_projects,$_GET['o']); git_project_list($gitphp_conf['projectroot'],$git_projects,$_GET['o']);
} }
$main = ob_get_contents(); $main = ob_get_contents();
ob_end_clean(); ob_end_clean();
   
if (!$suppress_headers) { if (!$suppress_headers) {
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("stylesheet",$gitphp_conf['stylesheet']); $tpl->assign("stylesheet",$gitphp_conf['stylesheet']);
$tpl->assign("version",$version); $tpl->assign("version",$version);
$title = $gitphp_conf['title']; $title = $gitphp_conf['title'];
if ($rss_link) { if ($rss_link) {
$tpl->assign("rss_link",TRUE); $tpl->assign("rss_link",TRUE);
$tpl->assign("project",$_GET['p']); $tpl->assign("project",$_GET['p']);
$title .= " :: " . $_GET['p']; $title .= " :: " . $_GET['p'];
if (isset($_GET['a'])) { if (isset($_GET['a'])) {
$tpl->assign("action",$_GET['a']); $tpl->assign("action",$_GET['a']);
$title .= "/" . $_GET['a']; $title .= "/" . $_GET['a'];
} }
} }
$tpl->assign("title",$title); $tpl->assign("title",$title);
$tpl->display("header.tpl"); $tpl->display("header.tpl");
} }
   
echo $main; echo $main;
   
if (!$suppress_headers) { if (!$suppress_headers) {
if ($rss_link) { if ($rss_link) {
$tpl->assign("project",$_GET['p']); $tpl->assign("project",$_GET['p']);
$tpl->assign("descr",git_project_descr($gitphp_conf['projectroot'],$_GET['p'])); $tpl->assign("descr",git_project_descr($gitphp_conf['projectroot'],$_GET['p']));
} }
$tpl->display("footer.tpl"); $tpl->display("footer.tpl");
} }
   
ob_end_flush(); ob_end_flush();
   
?> ?>
   
comments