Pass age in addition to age string for refs
Pass age in addition to age string for refs

<?php <?php
/* /*
* display.git_blob_plain.php * display.git_blob_plain.php
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Display - blob (plaintext) * Component: Display - blob (plaintext)
* *
* Copyright (C) 2008 Christopher Han <xiphux@gmail.com> * Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
*/ */
   
require_once('gitutil.git_cat_file.php'); require_once('gitutil.git_cat_file.php');
require_once('util.file_mime.php'); require_once('util.file_mime.php');
   
function git_blob_plain($projectroot,$project,$hash,$file) function git_blob_plain($projectroot,$project,$hash,$file)
{ {
global $gitphp_conf; global $gitphp_conf, $tpl;
   
if ($file) $cachekey = sha1($project) . "|" . $hash . "|" . sha1($file);
$saveas = $file;  
else  
$saveas = $hash . ".txt";  
   
$buffer = git_cat_file($projectroot . $project, $hash); $buffer = null;
   
if ($gitphp_conf['filemimetype']) // XXX: Nasty hack to cache headers
$mime = file_mime($buffer, $file); if (!$tpl->is_cached('blobheaders.tpl', $cachekey)) {
  if ($file)
  $saveas = $file;
  else
  $saveas = $hash . ".txt";
   
if ($mime) $buffer = git_cat_file($projectroot . $project, $hash);
header("Content-type: " . $mime);  
else  
header("Content-type: text/plain; charset=UTF-8");  
   
header("Content-disposition: inline; filename=\"" . $saveas . "\""); if ($gitphp_conf['filemimetype'])
  $mime = file_mime($buffer, $file);
   
echo $buffer; $headers = array();
   
  if ($mime)
  $headers[] = "Content-type: " . $mime;
  else
  $headers[] = "Content-type: text/plain; charset=UTF-8";
   
  $headers[] = "Content-disposition: inline; filename=\"" . $saveas . "\"";
   
  $tpl->assign("blobheaders", serialize($headers));
  }
  $out = $tpl->fetch('blobheaders.tpl', $cachekey);
   
  $returnedheaders = unserialize($out);
   
  foreach ($returnedheaders as $i => $header)
  header($header);
   
   
  if (!$tpl->is_cached('blobplain.tpl', $cachekey)) {
  if (!$buffer)
  $buffer = git_cat_file($projectroot . $project, $hash);
  $tpl->assign("blob", $buffer);
  }
  $tpl->display('blobplain.tpl', $cachekey);
} }
   
?> ?>
   
<?php <?php
/* /*
* gitutil.git_read_refs.php * gitutil.git_read_refs.php
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Git utility - read refs * Component: Git utility - read refs
* *
* Copyright (C) 2008 Christopher Han <xiphux@gmail.com> * Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
*/ */
   
require_once('util.age_string.php'); require_once('util.age_string.php');
require_once('util.epochcmp.php'); require_once('util.epochcmp.php');
require_once('gitutil.git_get_type.php'); require_once('gitutil.git_get_type.php');
require_once('gitutil.git_read_hash.php'); require_once('gitutil.git_read_hash.php');
require_once('gitutil.git_read_tag.php'); require_once('gitutil.git_read_tag.php');
require_once('gitutil.git_read_commit.php'); require_once('gitutil.git_read_commit.php');
   
function git_read_refs($projectroot,$project,$refdir) function git_read_refs($projectroot,$project,$refdir)
{ {
if (!is_dir($projectroot . $project . "/" . $refdir)) if (!is_dir($projectroot . $project . "/" . $refdir))
return null; return null;
$refs = array(); $refs = array();
if ($dh = opendir($projectroot . $project . "/" . $refdir)) { if ($dh = opendir($projectroot . $project . "/" . $refdir)) {
while (($dir = readdir($dh)) !== false) { while (($dir = readdir($dh)) !== false) {
if (strpos($dir,'.') !== 0) { if (strpos($dir,'.') !== 0) {
if (is_dir($projectroot . $project . "/" . $refdir . "/" . $dir)) { if (is_dir($projectroot . $project . "/" . $refdir . "/" . $dir)) {
if ($dh2 = opendir($projectroot . $project . "/" . $refdir . "/" . $dir)) { if ($dh2 = opendir($projectroot . $project . "/" . $refdir . "/" . $dir)) {
while (($dir2 = readdir($dh2)) !== false) { while (($dir2 = readdir($dh2)) !== false) {
if (strpos($dir2,'.') !== 0) if (strpos($dir2,'.') !== 0)
$refs[] = $dir . "/" . $dir2; $refs[] = $dir . "/" . $dir2;
} }
closedir($dh2); closedir($dh2);
} }
} }
$refs[] = $dir; $refs[] = $dir;
} }
} }
closedir($dh); closedir($dh);
} else } else
return null; return null;
$reflist = array(); $reflist = array();
foreach ($refs as $i => $ref_file) { foreach ($refs as $i => $ref_file) {
$ref_id = git_read_hash($projectroot . $project . "/" . $refdir . "/" . $ref_file); $ref_id = git_read_hash($projectroot . $project . "/" . $refdir . "/" . $ref_file);
$type = git_get_type($projectroot . $project, $ref_id); $type = git_get_type($projectroot . $project, $ref_id);
if ($type) { if ($type) {
$ref_item = array(); $ref_item = array();
$ref_item['type'] = $type; $ref_item['type'] = $type;
$ref_item['id'] = $ref_id; $ref_item['id'] = $ref_id;
$ref_item['epoch'] = 0; $ref_item['epoch'] = 0;
$ref_item['age'] = "unknown"; $ref_item['age_string'] = "unknown";
   
if ($type == "tag") { if ($type == "tag") {
$tag = git_read_tag($projectroot . $project, $ref_id); $tag = git_read_tag($projectroot . $project, $ref_id);
$ref_item['comment'] = $tag['comment']; $ref_item['comment'] = $tag['comment'];
if ($tag['type'] == "commit") { if ($tag['type'] == "commit") {
$co = git_read_commit($projectroot . $project, $tag['object']); $co = git_read_commit($projectroot . $project, $tag['object']);
$ref_item['epoch'] = $co['committer_epoch']; $ref_item['epoch'] = $co['committer_epoch'];
$ref_item['age'] = $co['age_string']; $ref_item['age_string'] = $co['age_string'];
  $ref_item['age'] = $co['age'];
} else if (isset($tag['epoch'])) { } else if (isset($tag['epoch'])) {
$age = time() - $tag['epoch']; $age = time() - $tag['epoch'];
$ref_item['epoch'] = $tag['epoch']; $ref_item['epoch'] = $tag['epoch'];
$ref_item['age'] = age_string($age); $ref_item['age_string'] = age_string($age);
  $ref_item['age'] = $age;
} }
$ref_item['reftype'] = $tag['type']; $ref_item['reftype'] = $tag['type'];
$ref_item['name'] = $tag['name']; $ref_item['name'] = $tag['name'];
$ref_item['refid'] = $tag['object']; $ref_item['refid'] = $tag['object'];
} else if ($type == "commit") { } else if ($type == "commit") {
$co = git_read_commit($projectroot . $project, $ref_id); $co = git_read_commit($projectroot . $project, $ref_id);
$ref_item['reftype'] = "commit"; $ref_item['reftype'] = "commit";
$ref_item['name'] = $ref_file; $ref_item['name'] = $ref_file;
$ref_item['title'] = $co['title']; $ref_item['title'] = $co['title'];
$ref_item['refid'] = $ref_id; $ref_item['refid'] = $ref_id;
$ref_item['epoch'] = $co['committer_epoch']; $ref_item['epoch'] = $co['committer_epoch'];
$ref_item['age'] = $co['age_string']; $ref_item['age_string'] = $co['age_string'];
  $ref_item['age'] = $co['age'];
} }
$reflist[] = $ref_item; $reflist[] = $ref_item;
} }
} }
usort($reflist,"epochcmp"); usort($reflist,"epochcmp");
return $reflist; return $reflist;
} }
   
?> ?>
   
file:a/index.php -> file:b/index.php
<?php <?php
/* /*
* 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>
*/ */
   
/* /*
* Version * Version
*/ */
include_once('include/version.php'); include_once('include/version.php');
   
/* /*
* Constants * Constants
*/ */
require_once('include/defs.constants.php'); require_once('include/defs.constants.php');
   
/* /*
* Configuration * Configuration
*/ */
require_once('config/gitphp.conf.php'); require_once('config/gitphp.conf.php');
   
$extraoutput = FALSE; $extraoutput = FALSE;
   
/* /*
* Instantiate Smarty * Instantiate Smarty
*/ */
require_once($gitphp_conf['smarty_prefix'] . "Smarty.class.php"); require_once($gitphp_conf['smarty_prefix'] . "Smarty.class.php");
$tpl =& new Smarty; $tpl =& new Smarty;
if ((!isset($_GET['a'])) || ( if ((!isset($_GET['a'])) || (
($_GET['a'] != "commitdiff_plain") && ($_GET['a'] != "commitdiff_plain") &&
($_GET['a'] != "blob_plain") && ($_GET['a'] != "blob_plain") &&
($_GET['a'] != "blobdiff_plain") && ($_GET['a'] != "blobdiff_plain") &&
($_GET['a'] != "rss") && ($_GET['a'] != "rss") &&
($_GET['a'] != "opml") ($_GET['a'] != "opml") &&
($_GET['a'] != "snapshot"))) { ($_GET['a'] != "snapshot"))) {
$tpl->load_filter('output','trimwhitespace'); $tpl->load_filter('output','trimwhitespace');
$extraoutput = TRUE; $extraoutput = TRUE;
} }
   
/* /*
* Debug * Debug
*/ */
if ($gitphp_conf['debug']) { if ($gitphp_conf['debug']) {
if ($extraoutput) { if ($extraoutput) {
define('GITPHP_START_TIME', microtime(true)); define('GITPHP_START_TIME', microtime(true));
error_reporting(E_ALL|E_STRICT); error_reporting(E_ALL|E_STRICT);
} }
} }
   
/* /*
* Caching * Caching
*/ */
if ($gitphp_conf['cache']) { if ($gitphp_conf['cache']) {
$tpl->caching = 2; $tpl->caching = 2;
$tpl->cache_lifetime = $gitphp_conf['cachelifetime']; $tpl->cache_lifetime = $gitphp_conf['cachelifetime'];
} }
   
/* /*
* Setup global assigns used everywhere (such as header/footer) * Setup global assigns used everywhere (such as header/footer)
*/ */
$tpl->assign("stylesheet",$gitphp_conf['stylesheet']); $tpl->assign("stylesheet",$gitphp_conf['stylesheet']);
$tpl->assign("version",$gitphp_version); $tpl->assign("version",$gitphp_version);
$tpl->assign("pagetitle",$gitphp_conf['title']); $tpl->assign("pagetitle",$gitphp_conf['title']);
if (isset($_GET['p'])) { if (isset($_GET['p'])) {
$tpl->assign("validproject",TRUE); $tpl->assign("validproject",TRUE);
$tpl->assign("project",$_GET['p']); $tpl->assign("project",$_GET['p']);
require_once('include/gitutil.git_project_descr.php'); require_once('include/gitutil.git_project_descr.php');
$tpl->assign("projectdescription",git_project_descr($gitphp_conf['projectroot'],$_GET['p'])); $tpl->assign("projectdescription",git_project_descr($gitphp_conf['projectroot'],$_GET['p']));
if (isset($_GET['a'])) { if (isset($_GET['a'])) {
$tpl->assign("action",$_GET['a']); $tpl->assign("action",$_GET['a']);
$tpl->assign("validaction", TRUE); $tpl->assign("validaction", TRUE);
} }
} }
if (isset($_GET['st'])) if (isset($_GET['st']))
$tpl->assign("currentsearchtype",$_GET['st']); $tpl->assign("currentsearchtype",$_GET['st']);
else else
$tpl->assign("currentsearchtype","commit"); $tpl->assign("currentsearchtype","commit");
if (isset($_GET['s'])) if (isset($_GET['s']))
$tpl->assign("currentsearch",$_GET['s']); $tpl->assign("currentsearch",$_GET['s']);
if (isset($_GET['hb'])) if (isset($_GET['hb']))
$tpl->assign("currentsearchhash",$_GET['hb']); $tpl->assign("currentsearchhash",$_GET['hb']);
else if (isset($_GET['h'])) else if (isset($_GET['h']))
$tpl->assign("currentsearchhash",$_GET['h']); $tpl->assign("currentsearchhash",$_GET['h']);
if ($gitphp_conf['search']) if ($gitphp_conf['search'])
$tpl->assign("enablesearch",TRUE); $tpl->assign("enablesearch",TRUE);
if ($gitphp_conf['filesearch']) if ($gitphp_conf['filesearch'])
$tpl->assign("filesearch",TRUE); $tpl->assign("filesearch",TRUE);
   
   
if (isset($_GET['a']) && $_GET['a'] == "opml") { if (isset($_GET['a']) && $_GET['a'] == "opml") {
require_once('include/display.git_opml.php'); require_once('include/display.git_opml.php');
git_opml($gitphp_conf['projectroot'],$git_projects); git_opml($gitphp_conf['projectroot'],$git_projects);
} else if (isset($_GET['a']) && $_GET['a'] == "project_index") { } else if (isset($_GET['a']) && $_GET['a'] == "project_index") {
require_once('include/display.git_project_index.php'); require_once('include/display.git_project_index.php');
git_project_index($gitphp_conf['projectroot'],$git_projects); git_project_index($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'])) {
$tpl->assign("validproject",FALSE); $tpl->assign("validproject",FALSE);
require_once('include/display.git_message.php'); require_once('include/display.git_message.php');
git_message("No such directory",TRUE); git_message("No such directory",TRUE);
} else if (!is_file($gitphp_conf['projectroot'] . $_GET['p'] . "/HEAD")) { } else if (!is_file($gitphp_conf['projectroot'] . $_GET['p'] . "/HEAD")) {
$tpl->assign("validproject",FALSE); $tpl->assign("validproject",FALSE);
require_once('include/display.git_message.php'); require_once('include/display.git_message.php');
git_message("No such project",TRUE); git_message("No such project",TRUE);
} else { } else {
if (!isset($_GET['a'])) { if (!isset($_GET['a'])) {
require_once('include/display.git_summary.php'); require_once('include/display.git_summary.php');
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":
require_once('include/display.git_summary.php'); require_once('include/display.git_summary.php');
git_summary($gitphp_conf['projectroot'],$_GET['p']); git_summary($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "tree": case "tree":
require_once('include/display.git_tree.php'); require_once('include/display.git_tree.php');
git_tree($gitphp_conf['projectroot'], $_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['f']) ? $_GET['f'] : NULL), (isset($_GET['hb']) ? $_GET['hb'] : NULL)); git_tree($gitphp_conf['projectroot'], $_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['f']) ? $_GET['f'] : NULL), (isset($_GET['hb']) ? $_GET['hb'] : NULL));
break; break;
case "shortlog": case "shortlog":
require_once('include/display.git_shortlog.php'); require_once('include/display.git_shortlog.php');
git_shortlog($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['pg']) ? $_GET['pg'] : NULL)); git_shortlog($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['pg']) ? $_GET['pg'] : NULL));
break; break;
case "log": case "log":
require_once('include/display.git_log.php'); require_once('include/display.git_log.php');
git_log($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['pg']) ? $_GET['pg'] : NULL)); git_log($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['pg']) ? $_GET['pg'] : NULL));
break; break;
case "commit": case "commit":
require_once('include/display.git_commit.php'); require_once('include/display.git_commit.php');
git_commit($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']); git_commit($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']);
break; break;
case "commitdiff": case "commitdiff":
require_once('include/display.git_commitdiff.php'); require_once('include/display.git_commitdiff.php');
git_commitdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'], (isset($_GET['hp']) ? $_GET['hp'] : NULL)); git_commitdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'], (isset($_GET['hp']) ? $_GET['hp'] : NULL));
break; break;
case "commitdiff_plain": case "commitdiff_plain":
require_once('include/display.git_commitdiff_plain.php'); require_once('include/display.git_commitdiff_plain.php');
git_commitdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],(isset($_GET['hp']) ? $_GET['hp'] : NULL)); git_commitdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],(isset($_GET['hp']) ? $_GET['hp'] : NULL));
break; break;
case "heads": case "heads":
require_once('include/display.git_heads.php'); require_once('include/display.git_heads.php');
git_heads($gitphp_conf['projectroot'],$_GET['p']); git_heads($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "tags": case "tags":
require_once('include/display.git_tags.php'); require_once('include/display.git_tags.php');
git_tags($gitphp_conf['projectroot'],$_GET['p']); git_tags($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "rss": case "rss":
require_once('include/display.git_rss.php'); require_once('include/display.git_rss.php');
git_rss($gitphp_conf['projectroot'],$_GET['p']); git_rss($gitphp_conf['projectroot'],$_GET['p']);
break; break;
case "blob": case "blob":
require_once('include/display.git_blob.php'); require_once('include/display.git_blob.php');
git_blob($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['f']) ? $_GET['f'] : NULL), (isset($_GET['hb']) ? $_GET['hb'] : NULL)); git_blob($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL), (isset($_GET['f']) ? $_GET['f'] : NULL), (isset($_GET['hb']) ? $_GET['hb'] : NULL));
break; break;
case "blob_plain": case "blob_plain":
require_once('include/display.git_blob_plain.php'); require_once('include/display.git_blob_plain.php');
git_blob_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],(isset($_GET['f']) ? $_GET['f'] : NULL)); git_blob_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],(isset($_GET['f']) ? $_GET['f'] : NULL));
break; break;
case "blobdiff": case "blobdiff":
require_once('include/display.git_blobdiff.php'); require_once('include/display.git_blobdiff.php');
git_blobdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],(isset($_GET['f']) ? $_GET['f'] : NULL)); git_blobdiff($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'],(isset($_GET['f']) ? $_GET['f'] : NULL));
break; break;
case "blobdiff_plain": case "blobdiff_plain":
require_once('include/display.git_blobdiff_plain.php'); require_once('include/display.git_blobdiff_plain.php');
git_blobdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'], (isset($_GET['f']) ? $_GET['f'] : NULL)); git_blobdiff_plain($gitphp_conf['projectroot'],$_GET['p'],$_GET['h'],$_GET['hb'],$_GET['hp'], (isset($_GET['f']) ? $_GET['f'] : NULL));
break; break;
case "snapshot": case "snapshot":
require_once('include/display.git_snapshot.php'); require_once('include/display.git_snapshot.php');
git_snapshot($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL)); git_snapshot($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL));
break; break;
case "history": case "history":
require_once('include/display.git_history.php'); require_once('include/display.git_history.php');
git_history($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL),$_GET['f']); git_history($gitphp_conf['projectroot'],$_GET['p'], (isset($_GET['h']) ? $_GET['h'] : NULL),$_GET['f']);
break; break;
case "search": case "search":
if (isset($_GET['st']) && ($_GET['st'] == 'file')) { if (isset($_GET['st']) && ($_GET['st'] == 'file')) {
require_once('include/display.git_search_files.php'); require_once('include/display.git_search_files.php');
git_search_files($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL),(isset($_GET['s']) ? $_GET['s'] : NULL),(isset($_GET['pg']) ? $_GET['pg'] : 0)); git_search_files($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL),(isset($_GET['s']) ? $_GET['s'] : NULL),(isset($_GET['pg']) ? $_GET['pg'] : 0));
} else { } else {
require_once('include/display.git_search.php'); require_once('include/display.git_search.php');
git_search($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL),(isset($_GET['s']) ? $_GET['s'] : NULL),(isset($_GET['st']) ? $_GET['st'] : "commit"),(isset($_GET['pg']) ? $_GET['pg'] : 0)); git_search($gitphp_conf['projectroot'],$_GET['p'],(isset($_GET['h']) ? $_GET['h'] : NULL),(isset($_GET['s']) ? $_GET['s'] : NULL),(isset($_GET['st']) ? $_GET['st'] : "commit"),(isset($_GET['pg']) ? $_GET['pg'] : 0));
} }
break; break;
case "tag": case "tag":
require_once('include/display.git_tag.php'); require_once('include/display.git_tag.php');
git_tag($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']); git_tag($gitphp_conf['projectroot'],$_GET['p'],$_GET['h']);
break; break;
default: default:
$tpl->assign("validaction", FALSE); $tpl->assign("validaction", FALSE);
require_once('include/display.git_message.php'); require_once('include/display.git_message.php');
git_message("Unknown action", TRUE); git_message("Unknown action", TRUE);
break; break;
} }
} }
} }
} else { } else {
require_once('include/display.git_project_list.php'); require_once('include/display.git_project_list.php');
git_project_list($gitphp_conf['projectroot'],$git_projects,(isset($_GET['o']) ? $_GET['o'] : "project")); git_project_list($gitphp_conf['projectroot'],$git_projects,(isset($_GET['o']) ? $_GET['o'] : "project"));
} }
   
if ($gitphp_conf['debug'] && $extraoutput) if ($gitphp_conf['debug'] && $extraoutput)
echo "Execution time: " . round(microtime(true) - GITPHP_START_TIME, 8) . " sec"; echo "Execution time: " . round(microtime(true) - GITPHP_START_TIME, 8) . " sec";
   
?> ?>
   
  {*
  * blobheaders.tpl
  * gitphp: A PHP git repository browser
  * Component: Blob header dummy template
  *
  * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
  {$blobheaders}
 
  {*
  * blobplain.tpl
  * gitphp: A PHP git repository browser
  * Component: Blob plain template
  *
  * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
  {$blob}
 
{* {*
* heads_nav.tpl * heads_nav.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Head view template * Component: Head view template
* *
* Copyright (C) 2009 Christopher Han <xiphux@gmail.com> * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
*} *}
   
{include file='header.tpl'} {include file='header.tpl'}
   
{* Nav *} {* Nav *}
<div class="page_nav"> <div class="page_nav">
<a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$head}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$head}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&hb={$head}">tree</a> <a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$head}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$head}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&hb={$head}">tree</a>
<br /><br /> <br /><br />
</div> </div>
<div> <div>
<a href="{$SCRIPT_NAME}?p={$project}&a=summary" class="title">&nbsp;</a> <a href="{$SCRIPT_NAME}?p={$project}&a=summary" class="title">&nbsp;</a>
</div> </div>
<table cellspacing="0"> <table cellspacing="0">
{* Loop and display each head *} {* Loop and display each head *}
{foreach from=$headlist item=head} {foreach from=$headlist item=head}
<tr class="{cycle values="light,dark"}"> <tr class="{cycle values="light,dark"}">
<td><i>{$head.age}</i></td> <td><i>{$head.age_string}</i></td>
<td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$head.name}" class="list"><b>{$head.name}</b></a></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$head.name}" class="list"><b>{$head.name}</b></a></td>
<td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$head.name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/heads/{$head.name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h=refs/heads/{$head.name}&hb={$head.name}">tree</a></td> <td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$head.name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/heads/{$head.name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h=refs/heads/{$head.name}&hb={$head.name}">tree</a></td>
</tr> </tr>
{/foreach} {/foreach}
</table> </table>
   
{include file='footer.tpl'} {include file='footer.tpl'}
   
   
{* {*
* project.tpl * project.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Project summary template * Component: Project summary template
* *
* Copyright (C) 2009 Christopher Han <xiphux@gmail.com> * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
*} *}
   
{include file='header.tpl'} {include file='header.tpl'}
   
{* Nav *} {* Nav *}
<div class="page_nav"> <div class="page_nav">
summary | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$head}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$head}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree">tree</a> summary | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$head}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$head}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree">tree</a>
<br /><br /> <br /><br />
</div> </div>
<div class="title">&nbsp;</div> <div class="title">&nbsp;</div>
{* Project brief *} {* Project brief *}
<table cellspacing="0"> <table cellspacing="0">
<tr><td>description</td><td>{$description}</td></tr> <tr><td>description</td><td>{$description}</td></tr>
<tr><td>owner</td><td>{$owner}</td></tr> <tr><td>owner</td><td>{$owner}</td></tr>
<tr><td>last change</td><td>{$lastchange}</td></tr> <tr><td>last change</td><td>{$lastchange}</td></tr>
</table> </table>
<div> <div>
<a class="title" href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> <a class="title" href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a>
</div> </div>
<table cellspacing="0"> <table cellspacing="0">
{* Recent revisions *} {* Recent revisions *}
{section name=rev max=17 loop=$revlist} {section name=rev max=17 loop=$revlist}
{if $smarty.section.rev.index == 16} {if $smarty.section.rev.index == 16}
<tr class="light"> <tr class="light">
<td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">...</a></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">...</a></td>
</tr> </tr>
{else} {else}
<tr class="{cycle name=revs values="light,dark"}"> <tr class="{cycle name=revs values="light,dark"}">
<td><i>{$revlist[rev].commitage}</i></td> <td><i>{$revlist[rev].commitage}</i></td>
<td><i>{$revlist[rev].commitauthor}</i></td> <td><i>{$revlist[rev].commitauthor}</i></td>
<td> <td>
<a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$revlist[rev].commit}" class="list" {if $revlist[rev].title}title="{$revlist[rev].title}"{/if}><b>{$revlist[rev].title_short} <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$revlist[rev].commit}" class="list" {if $revlist[rev].title}title="{$revlist[rev].title}"{/if}><b>{$revlist[rev].title_short}
{if $revlist[rev].commitref} {if $revlist[rev].commitref}
<span class="tag">{$revlist[rev].commitref}</span> <span class="tag">{$revlist[rev].commitref}</span>
{/if} {/if}
</b> </b>
</td> </td>
<td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$revlist[rev].commit}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$revlist[rev].commit}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$revlist[rev].commit}&hb={$revlist[rev].commit}">tree</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$revlist[rev].commit}">snapshot</a></td> <td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$revlist[rev].commit}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$revlist[rev].commit}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h={$revlist[rev].commit}&hb={$revlist[rev].commit}">tree</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$revlist[rev].commit}">snapshot</a></td>
</tr> </tr>
{/if} {/if}
{/section} {/section}
</table> </table>
{if $taglist} {if $taglist}
{* Tags *} {* Tags *}
<div> <div>
<a href="{$SCRIPT_NAME}?p={$project}&a=tags" class="title">tags</a> <a href="{$SCRIPT_NAME}?p={$project}&a=tags" class="title">tags</a>
</div> </div>
<table cellspacing="0"> <table cellspacing="0">
{section name=tag max=17 loop=$taglist} {section name=tag max=17 loop=$taglist}
<tr class="{cycle name=tags values="light,dark"}"> <tr class="{cycle name=tags values="light,dark"}">
{if $smarty.section.tag.index == 16} {if $smarty.section.tag.index == 16}
<td><a href="{$SCRIPT_NAME}?p={$project}&a=tags">...</a></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a=tags">...</a></td>
{else} {else}
<td><i>{$taglist[tag].age}</i></td> <td><i>{$taglist[tag].age_string}</i></td>
<td><a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}" class="list"><b>{$taglist[tag].name}</b></a></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}" class="list"><b>{$taglist[tag].name}</b></a></td>
<td> <td>
{if $taglist[tag].comment} {if $taglist[tag].comment}
<a class="list" href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}">{$taglist[tag].comment}</a> <a class="list" href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}">{$taglist[tag].comment}</a>
{/if} {/if}
</td> </td>
<td class="link"> <td class="link">
{if $taglist[tag].type == "tag"} {if $taglist[tag].type == "tag"}
<a href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}">tag</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}">tag</a> |
{/if} {/if}
<a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}">{$taglist[tag].reftype}</a>{if $taglist[tag].reftype == "commit"} | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/tags/{$taglist[tag].name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/tags/{$taglist[tag].name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$taglist[tag].refid}">snapshot</a>{/if} <a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}">{$taglist[tag].reftype}</a>{if $taglist[tag].reftype == "commit"} | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/tags/{$taglist[tag].name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/tags/{$taglist[tag].name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$taglist[tag].refid}">snapshot</a>{/if}
</td> </td>
{/if} {/if}
</tr> </tr>
{/section} {/section}
</table> </table>
{/if} {/if}
{if $headlist} {if $headlist}
{* Heads *} {* Heads *}
<div> <div>
<a href="{$SCRIPT_NAME}?p={$project}&a=heads" class="title">heads</a> <a href="{$SCRIPT_NAME}?p={$project}&a=heads" class="title">heads</a>
</div> </div>
<table cellspacing="0"> <table cellspacing="0">
{section name=head max=17 loop=$headlist} {section name=head max=17 loop=$headlist}
<tr class="{cycle name=heads values="light,dark"}"> <tr class="{cycle name=heads values="light,dark"}">
{if $smarty.section.head.index == 16} {if $smarty.section.head.index == 16}
<td><a href="{$SCRIPT_NAME}?p={$project}&a=heads">...</a></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a=heads">...</a></td>
{else} {else}
<td><i>{$headlist[head].age}</i></td> <td><i>{$headlist[head].age_string}</i></td>
<td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$headlist[head].name}" class="list"><b>{$headlist[head].name}</b></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$headlist[head].name}" class="list"><b>{$headlist[head].name}</b></td>
<td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$headlist[head].name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/heads/{$headlist[head].name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h=refs/heads/{$headlist[head].name}&hb={$headlist[head].name}">tree</a></td> <td class="link"><a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/heads/{$headlist[head].name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/heads/{$headlist[head].name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&h=refs/heads/{$headlist[head].name}&hb={$headlist[head].name}">tree</a></td>
{/if} {/if}
</tr> </tr>
{/section} {/section}
</table> </table>
{/if} {/if}
   
{include file='footer.tpl'} {include file='footer.tpl'}
   
   
{* {*
* tags.tpl * tags.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Tag view template * Component: Tag view template
* *
* Copyright (C) 2009 Christopher Han <xiphux@gmail.com> * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
*} *}
   
{include file='header.tpl'} {include file='header.tpl'}
   
{* Nav *} {* Nav *}
<div class="page_nav"> <div class="page_nav">
<a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$head}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$head}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&hb={$head}">tree</a> <a href="{$SCRIPT_NAME}?p={$project}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commit&h={$head}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=commitdiff&h={$head}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tree&hb={$head}">tree</a>
<br /><br /> <br /><br />
</div> </div>
<div> <div>
<a href="{$SCRIPT_NAME}?p={$project}&a=summary" class="title">&nbsp;</a> <a href="{$SCRIPT_NAME}?p={$project}&a=summary" class="title">&nbsp;</a>
</div> </div>
{* Display tags *} {* Display tags *}
<table cellspacing="0"> <table cellspacing="0">
{section name=tag loop=$taglist} {section name=tag loop=$taglist}
<tr class="{cycle values="light,dark"}"> <tr class="{cycle values="light,dark"}">
<td><i>{$taglist[tag].age}</i></td> <td><i>{$taglist[tag].age_string}</i></td>
<td><a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}" class="list"><b>{$taglist[tag].name}</b></a></td> <td><a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}" class="list"><b>{$taglist[tag].name}</b></a></td>
<td> <td>
{if count($taglist[tag].comment) > 0} {if count($taglist[tag].comment) > 0}
<a href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}" class="list">{$taglist[tag].comment[0]}</a> <a href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}" class="list">{$taglist[tag].comment[0]}</a>
{/if} {/if}
</td> </td>
<td class="link"> <td class="link">
{if $taglist[tag].type == "tag"} {if $taglist[tag].type == "tag"}
<a href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}">tag</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=tag&h={$taglist[tag].id}">tag</a> |
{/if} {/if}
<a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}">{$taglist[tag].reftype}</a> <a href="{$SCRIPT_NAME}?p={$project}&a={$taglist[tag].reftype}&h={$taglist[tag].refid}">{$taglist[tag].reftype}</a>
{if $taglist[tag].reftype == "commit"} {if $taglist[tag].reftype == "commit"}
| <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/tags/{$taglist[tag].name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/tags/{$taglist[tag].name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$taglist[tag].refid}">snapshot</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=shortlog&h=refs/tags/{$taglist[tag].name}">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=log&h=refs/tags/{$taglist[tag].name}">log</a> | <a href="{$SCRIPT_NAME}?p={$project}&a=snapshot&h={$taglist[tag].refid}">snapshot</a>
{/if} {/if}
</td> </td>
</tr> </tr>
{/section} {/section}
</table> </table>
   
{include file='footer.tpl'} {include file='footer.tpl'}
   
   
comments