Use blob as template variable for blob objects, rather than hash
Use blob as template variable for blob objects, rather than hash

<?php <?php
/** /**
* GitPHP Controller Blame * GitPHP Controller Blame
* *
* Controller for displaying blame * Controller for displaying blame
* *
* @author Christopher Han <xiphux@gmail.com> * @author Christopher Han <xiphux@gmail.com>
* @copyright Copyright (c) 2010 Christopher Han * @copyright Copyright (c) 2010 Christopher Han
* @package GitPHP * @package GitPHP
* @subpackage Controller * @subpackage Controller
*/ */
   
/** /**
* Blame controller class * Blame controller class
* *
* @package GitPHP * @package GitPHP
* @subpackage Controller * @subpackage Controller
*/ */
class GitPHP_Controller_Blame extends GitPHP_ControllerBase class GitPHP_Controller_Blame extends GitPHP_ControllerBase
{ {
   
/** /**
* __construct * __construct
* *
* Constructor * Constructor
* *
* @access public * @access public
* @return controller * @return controller
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
if (!$this->project) { if (!$this->project) {
throw new GitPHP_MessageException('Project is required for blame', true); throw new GitPHP_MessageException('Project is required for blame', true);
} }
} }
   
/** /**
* GetTemplate * GetTemplate
* *
* Gets the template for this controller * Gets the template for this controller
* *
* @access protected * @access protected
* @return string template filename * @return string template filename
*/ */
protected function GetTemplate() protected function GetTemplate()
{ {
return 'blame.tpl'; return 'blame.tpl';
} }
   
/** /**
* GetCacheKey * GetCacheKey
* *
* Gets the cache key for this controller * Gets the cache key for this controller
* *
* @access protected * @access protected
* @return string cache key * @return string cache key
*/ */
protected function GetCacheKey() protected function GetCacheKey()
{ {
return (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : ''); return (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : '');
} }
   
/** /**
* ReadQuery * ReadQuery
* *
* Read query into parameters * Read query into parameters
* *
* @access protected * @access protected
*/ */
protected function ReadQuery() protected function ReadQuery()
{ {
if (isset($_GET['hb'])) if (isset($_GET['hb']))
$this->params['hashbase'] = $_GET['hb']; $this->params['hashbase'] = $_GET['hb'];
else else
$this->params['hashbase'] = 'HEAD'; $this->params['hashbase'] = 'HEAD';
if (isset($_GET['f'])) if (isset($_GET['f']))
$this->params['file'] = $_GET['f']; $this->params['file'] = $_GET['f'];
if (isset($_GET['h'])) { if (isset($_GET['h'])) {
$this->params['hash'] = $_GET['h']; $this->params['hash'] = $_GET['h'];
} }
} }
   
/** /**
* LoadData * LoadData
* *
* Loads data for this template * Loads data for this template
* *
* @access protected * @access protected
*/ */
protected function LoadData() protected function LoadData()
{ {
$head = $this->project->GetHeadCommit(); $head = $this->project->GetHeadCommit();
$this->tpl->assign('head', $head); $this->tpl->assign('head', $head);
   
$commit = $this->project->GetCommit($this->params['hashbase']); $commit = $this->project->GetCommit($this->params['hashbase']);
$this->tpl->assign('commit', $commit); $this->tpl->assign('commit', $commit);
   
if ((!isset($this->params['hash'])) && (isset($this->params['file']))) { if ((!isset($this->params['hash'])) && (isset($this->params['file']))) {
$this->params['hash'] = $commit->PathToHash($this->params['file']); $this->params['hash'] = $commit->PathToHash($this->params['file']);
} }
$hash = $this->project->GetBlob($this->params['hash']); $blob = $this->project->GetBlob($this->params['hash']);
if ($this->params['file']) if ($this->params['file'])
$hash->SetName($this->params['file']); $blob->SetName($this->params['file']);
$hash->SetCommit($commit); $blob->SetCommit($commit);
$this->tpl->assign('hash', $hash); $this->tpl->assign('blob', $blob);
   
$this->tpl->assign('tree', $commit->GetTree()); $this->tpl->assign('tree', $commit->GetTree());
   
$blame = $hash->GetBlame(); $blame = $blob->GetBlame();
$this->tpl->assign('blame', $hash->GetBlame()); $this->tpl->assign('blame', $blob->GetBlame());
} }
   
} }
   
<?php <?php
/** /**
* GitPHP Controller Blob * GitPHP Controller Blob
* *
* Controller for displaying a blob * Controller for displaying a blob
* *
* @author Christopher Han <xiphux@gmail.com> * @author Christopher Han <xiphux@gmail.com>
* @copyright Copyright (c) 2010 Christopher Han * @copyright Copyright (c) 2010 Christopher Han
* @package GitPHP * @package GitPHP
* @subpackage Controller * @subpackage Controller
*/ */
   
/** /**
* Blob controller class * Blob controller class
* *
* @package GitPHP * @package GitPHP
* @subpackage Controller * @subpackage Controller
*/ */
class GitPHP_Controller_Blob extends GitPHP_ControllerBase class GitPHP_Controller_Blob extends GitPHP_ControllerBase
{ {
   
/** /**
* __construct * __construct
* *
* Constructor * Constructor
* *
* @access public * @access public
* @return controller * @return controller
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
if (!$this->project) { if (!$this->project) {
throw new GitPHP_MessageException('Project is required for blob', true); throw new GitPHP_MessageException('Project is required for blob', true);
} }
} }
   
/** /**
* GetTemplate * GetTemplate
* *
* Gets the template for this controller * Gets the template for this controller
* *
* @access protected * @access protected
* @return string template filename * @return string template filename
*/ */
protected function GetTemplate() protected function GetTemplate()
{ {
if ($this->params['plain']) if ($this->params['plain'])
return 'blobplain.tpl'; return 'blobplain.tpl';
return 'blob.tpl'; return 'blob.tpl';
} }
   
/** /**
* GetCacheKey * GetCacheKey
* *
* Gets the cache key for this controller * Gets the cache key for this controller
* *
* @access protected * @access protected
* @return string cache key * @return string cache key
*/ */
protected function GetCacheKey() protected function GetCacheKey()
{ {
return (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : ''); return (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : '');
} }
   
/** /**
* ReadQuery * ReadQuery
* *
* Read query into parameters * Read query into parameters
* *
* @access protected * @access protected
*/ */
protected function ReadQuery() protected function ReadQuery()
{ {
if (isset($_GET['hb'])) if (isset($_GET['hb']))
$this->params['hashbase'] = $_GET['hb']; $this->params['hashbase'] = $_GET['hb'];
else else
$this->params['hashbase'] = 'HEAD'; $this->params['hashbase'] = 'HEAD';
if (isset($_GET['f'])) if (isset($_GET['f']))
$this->params['file'] = $_GET['f']; $this->params['file'] = $_GET['f'];
if (isset($_GET['h'])) { if (isset($_GET['h'])) {
$this->params['hash'] = $_GET['h']; $this->params['hash'] = $_GET['h'];
} }
} }
   
/** /**
* LoadHeaders * LoadHeaders
* *
* Loads headers for this template * Loads headers for this template
* *
* @access protected * @access protected
*/ */
protected function LoadHeaders() protected function LoadHeaders()
{ {
if ($this->params['plain']) { if ($this->params['plain']) {
// XXX: Nasty hack to cache headers // XXX: Nasty hack to cache headers
if (!$this->tpl->is_cached('blobheaders.tpl', $this->GetFullCacheKey())) { if (!$this->tpl->is_cached('blobheaders.tpl', $this->GetFullCacheKey())) {
if (isset($this->params['file'])) if (isset($this->params['file']))
$saveas = $this->params['file']; $saveas = $this->params['file'];
else else
$saveas = $this->params['hash'] . ".txt"; $saveas = $this->params['hash'] . ".txt";
   
$blob = $this->project->GetBlob($this->params['hash']); $blob = $this->project->GetBlob($this->params['hash']);
$blob->SetName($this->params['file']); $blob->SetName($this->params['file']);
   
$headers = array(); $headers = array();
   
if (GitPHP_Config::GetInstance()->GetValue('filemimetype', true)) if (GitPHP_Config::GetInstance()->GetValue('filemimetype', true))
$mime = $blob->FileMime(); $mime = $blob->FileMime();
   
if ($mime) if ($mime)
$headers[] = "Content-type: " . $mime; $headers[] = "Content-type: " . $mime;
else else
$headers[] = "Content-type: text/plain; charset=UTF-8"; $headers[] = "Content-type: text/plain; charset=UTF-8";
   
$headers[] = "Content-disposition: inline; filename=\"" . $saveas . "\""; $headers[] = "Content-disposition: inline; filename=\"" . $saveas . "\"";
   
$this->tpl->assign("blobheaders", serialize($headers)); $this->tpl->assign("blobheaders", serialize($headers));
} }
$out = $this->tpl->fetch('blobheaders.tpl', $this->GetFullCacheKey()); $out = $this->tpl->fetch('blobheaders.tpl', $this->GetFullCacheKey());
   
$this->headers = unserialize($out); $this->headers = unserialize($out);
} }
   
} }
   
/** /**
* LoadData * LoadData
* *
* Loads data for this template * Loads data for this template
* *
* @access protected * @access protected
*/ */
protected function LoadData() protected function LoadData()
{ {
$commit = $this->project->GetCommit($this->params['hashbase']); $commit = $this->project->GetCommit($this->params['hashbase']);
$this->tpl->assign('commit', $commit); $this->tpl->assign('commit', $commit);
   
if ((!isset($this->params['hash'])) && (isset($this->params['file']))) { if ((!isset($this->params['hash'])) && (isset($this->params['file']))) {
$this->params['hash'] = $commit->PathToHash($this->params['file']); $this->params['hash'] = $commit->PathToHash($this->params['file']);
} }
   
$hash = $this->project->GetBlob($this->params['hash']); $blob = $this->project->GetBlob($this->params['hash']);
if ($this->params['file']) if ($this->params['file'])
$hash->SetName($this->params['file']); $blob->SetName($this->params['file']);
$hash->SetCommit($commit); $blob->SetCommit($commit);
$this->tpl->assign('hash', $hash); $this->tpl->assign('blob', $blob);
   
if ($this->params['plain']) { if ($this->params['plain']) {
$this->tpl->assign('blob', $hash->GetData());  
return; return;
} }
   
$head = $this->project->GetHeadCommit(); $head = $this->project->GetHeadCommit();
$this->tpl->assign('head', $head); $this->tpl->assign('head', $head);
   
$this->tpl->assign('tree', $commit->GetTree()); $this->tpl->assign('tree', $commit->GetTree());
   
if (GitPHP_Config::GetInstance()->GetValue('filemimetype', true)) { if (GitPHP_Config::GetInstance()->GetValue('filemimetype', true)) {
$mime = $hash->FileMime(); $mime = $blob->FileMime();
if ($mime) if ($mime)
$mimetype = strtok($mime, '/'); $mimetype = strtok($mime, '/');
} }
   
if ($mime && (strtok($mime, '/') == 'image')) { if ($mime && (strtok($mime, '/') == 'image')) {
$this->tpl->assign('datatag', true); $this->tpl->assign('datatag', true);
$this->tpl->assign('mime', $mime); $this->tpl->assign('mime', $mime);
$this->tpl->assign('data', base64_encode($hash->GetData())); $this->tpl->assign('data', base64_encode($blob->GetData()));
return; return;
} }
   
if (GitPHP_Config::GetInstance()->GetValue('geshi', true)) { if (GitPHP_Config::GetInstance()->GetValue('geshi', true)) {
include_once(GitPHP_Config::GetInstance()->GetValue('geshiroot', 'lib/geshi/') . "geshi.php"); include_once(GitPHP_Config::GetInstance()->GetValue('geshiroot', 'lib/geshi/') . "geshi.php");
if (class_exists('GeSHi')) { if (class_exists('GeSHi')) {
$geshi = new GeSHi("",'php'); $geshi = new GeSHi("",'php');
if ($geshi) { if ($geshi) {
$lang = $geshi->get_language_name_from_extension(substr(strrchr($hash->GetPath(),'.'),1)); $lang = $geshi->get_language_name_from_extension(substr(strrchr($blob->GetPath(),'.'),1));
if (!empty($lang)) { if (!empty($lang)) {
$geshi->enable_classes(); $geshi->enable_classes();
$geshi->enable_strict_mode(GESHI_MAYBE); $geshi->enable_strict_mode(GESHI_MAYBE);
$geshi->set_source($hash->GetData()); $geshi->set_source($blob->GetData());
$geshi->set_language($lang); $geshi->set_language($lang);
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE); $geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS); $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$this->tpl->assign('geshiout', $geshi->parse_code()); $this->tpl->assign('geshiout', $geshi->parse_code());
$this->tpl->assign('extracss', $geshi->get_stylesheet()); $this->tpl->assign('extracss', $geshi->get_stylesheet());
$this->tpl->assign('geshi', true); $this->tpl->assign('geshi', true);
return; return;
} }
} }
} }
} }
   
$this->tpl->assign('bloblines', $hash->GetData(true)); $this->tpl->assign('bloblines', $blob->GetData(true));
} }
   
} }
   
<?php <?php
/** /**
* GitPHP Controller Blobdiff * GitPHP Controller Blobdiff
* *
* Controller for displaying a blobdiff * Controller for displaying a blobdiff
* *
* @author Christopher Han <xiphux@gmail.com> * @author Christopher Han <xiphux@gmail.com>
* @copyright Copyright (c) 2010 Christopher Han * @copyright Copyright (c) 2010 Christopher Han
* @package GitPHP * @package GitPHP
* @subpackage Controller * @subpackage Controller
*/ */
   
/** /**
* Blobdiff controller class * Blobdiff controller class
* *
* @package GitPHP * @package GitPHP
* @subpackage Controller * @subpackage Controller
*/ */
class GitPHP_Controller_Blobdiff extends GitPHP_ControllerBase class GitPHP_Controller_Blobdiff extends GitPHP_ControllerBase
{ {
   
/** /**
* __construct * __construct
* *
* Constructor * Constructor
* *
* @access public * @access public
* @return controller * @return controller
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
if (!$this->project) { if (!$this->project) {
throw new GitPHP_MessageException('Project is required for blob diff', true); throw new GitPHP_MessageException('Project is required for blob diff', true);
} }
} }
   
/** /**
* GetTemplate * GetTemplate
* *
* Gets the template for this controller * Gets the template for this controller
* *
* @access protected * @access protected
* @return string template filename * @return string template filename
*/ */
protected function GetTemplate() protected function GetTemplate()
{ {
if (isset($this->params['plain']) && ($this->params['plain'] === true)) { if (isset($this->params['plain']) && ($this->params['plain'] === true)) {
return 'blobdiffplain.tpl'; return 'blobdiffplain.tpl';
} }
return 'blobdiff.tpl'; return 'blobdiff.tpl';
} }
   
/** /**
* GetCacheKey * GetCacheKey
* *
* Gets the cache key for this controller * Gets the cache key for this controller
* *
* @access protected * @access protected
* @return string cache key * @return string cache key
*/ */
protected function GetCacheKey() protected function GetCacheKey()
{ {
return (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['hashparent']) ? $this->params['hashparent'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : ''); return (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['hashparent']) ? $this->params['hashparent'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : '');
} }
   
/** /**
* ReadQuery * ReadQuery
* *
* Read query into parameters * Read query into parameters
* *
* @access protected * @access protected
*/ */
protected function ReadQuery() protected function ReadQuery()
{ {
if (isset($_GET['f'])) if (isset($_GET['f']))
$this->params['file'] = $_GET['f']; $this->params['file'] = $_GET['f'];
if (isset($_GET['h'])) if (isset($_GET['h']))
$this->params['hash'] = $_GET['h']; $this->params['hash'] = $_GET['h'];
if (isset($_GET['hb'])) if (isset($_GET['hb']))
$this->params['hashbase'] = $_GET['hb']; $this->params['hashbase'] = $_GET['hb'];
if (isset($_GET['hp'])) if (isset($_GET['hp']))
$this->params['hashparent'] = $_GET['hp']; $this->params['hashparent'] = $_GET['hp'];
} }
   
/** /**
* LoadHeaders * LoadHeaders
* *
* Loads headers for this template * Loads headers for this template
* *
* @access protected * @access protected
*/ */
protected function LoadHeaders() protected function LoadHeaders()
{ {
if (isset($this->params['plain']) && ($this->params['plain'] === true)) { if (isset($this->params['plain']) && ($this->params['plain'] === true)) {
$this->headers[] = 'Content-type: text/plain; charset=UTF-8'; $this->headers[] = 'Content-type: text/plain; charset=UTF-8';
} }
} }
   
/** /**
* LoadData * LoadData
* *
* Loads data for this template * Loads data for this template
* *
* @access protected * @access protected
*/ */
protected function LoadData() protected function LoadData()
{ {
if (isset($this->params['file'])) if (isset($this->params['file']))
$this->tpl->assign('file', $this->params['file']); $this->tpl->assign('file', $this->params['file']);
   
$filediff = new GitPHP_FileDiff($this->project, $this->params['hashparent'], $this->params['hash']); $filediff = new GitPHP_FileDiff($this->project, $this->params['hashparent'], $this->params['hash']);
$this->tpl->assign('filediff', $filediff); $this->tpl->assign('filediff', $filediff);
   
if (isset($this->params['plain']) && ($this->params['plain'] === true)) { if (isset($this->params['plain']) && ($this->params['plain'] === true)) {
return; return;
} }
   
$commit = $this->project->GetCommit($this->params['hashbase']); $commit = $this->project->GetCommit($this->params['hashbase']);
$this->tpl->assign('commit', $commit); $this->tpl->assign('commit', $commit);
   
$hashparent = $this->project->GetBlob($this->params['hashparent']); $blobparent = $this->project->GetBlob($this->params['hashparent']);
$hashparent->SetCommit($commit); $blobparent->SetCommit($commit);
$this->tpl->assign('hashparent', $hashparent); $this->tpl->assign('blobparent', $blobparent);
   
$hash = $this->project->GetBlob($this->params['hash']); $blob = $this->project->GetBlob($this->params['hash']);
$this->tpl->assign('hash', $hash); $this->tpl->assign('blob', $blob);
   
$tree = $commit->GetTree(); $tree = $commit->GetTree();
$this->tpl->assign('tree', $tree); $this->tpl->assign('tree', $tree);
} }
   
} }
   
{* {*
* blame.tpl * blame.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Blame view template * Component: Blame view template
* *
* Copyright (C) 2010 Christopher Han <xiphux@gmail.com> * Copyright (C) 2010 Christopher Han <xiphux@gmail.com>
*} *}
   
{include file='header.tpl'} {include file='header.tpl'}
   
<div class="page_nav"> <div class="page_nav">
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$commit->GetHash()}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commitdiff&h={$commit->GetHash()}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=tree&h={$tree->GetHash()}&hb={$commit->GetHash()}">tree</a><br /> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$commit->GetHash()}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commitdiff&h={$commit->GetHash()}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=tree&h={$tree->GetHash()}&hb={$commit->GetHash()}">tree</a><br />
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob_plain&h={$hash->GetHash()}&f={$hash->GetPath()}">plain</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob_plain&h={$blob->GetHash()}&f={$blob->GetPath()}">plain</a> |
{if $commit->GetHash() != $head->GetHash()} {if $commit->GetHash() != $head->GetHash()}
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blame&hb=HEAD&f={$hash->GetPath()}">HEAD</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blame&hb=HEAD&f={$blob->GetPath()}">HEAD</a>
{else} {else}
HEAD HEAD
{/if} {/if}
| blame | blame
<br /> <br />
</div> </div>
   
{include file='title.tpl' titlecommit=$commit} {include file='title.tpl' titlecommit=$commit}
   
{include file='path.tpl' pathobject=$hash target='blob'} {include file='path.tpl' pathobject=$blob target='blob'}
<div class="page_body"> <div class="page_body">
<table class="code"> <table class="code">
{foreach from=$hash->GetData(true) item=blobline name=blob} {foreach from=$blob->GetData(true) item=blobline name=blob}
{assign var=blamecommit value=$blame[$smarty.foreach.blob.iteration]} {assign var=blamecommit value=$blame[$smarty.foreach.blob.iteration]}
{if $blamecommit} {if $blamecommit}
{cycle values="light,dark" assign=rowclass} {cycle values="light,dark" assign=rowclass}
{/if} {/if}
<tr class="{$rowclass}"> <tr class="{$rowclass}">
<td class="date"> <td class="date">
{if $blamecommit} {if $blamecommit}
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$blamecommit->GetHash()}" title="{$blamecommit->GetTitle()}">{$blamecommit->GetAuthorEpoch()|date_format:"%F %X"}</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$blamecommit->GetHash()}" title="{$blamecommit->GetTitle()}">{$blamecommit->GetAuthorEpoch()|date_format:"%F %X"}</a>
{/if} {/if}
</td> </td>
<td class="author"> <td class="author">
{if $blamecommit} {if $blamecommit}
{$blamecommit->GetAuthor()} {$blamecommit->GetAuthor()}
{/if} {/if}
</td> </td>
<td class="num"><a id="l{$smarty.foreach.blob.iteration}" href="#l{$smarty.foreach.blob.iteration}" class="linenr">{$smarty.foreach.blob.iteration}</a></td> <td class="num"><a id="l{$smarty.foreach.blob.iteration}" href="#l{$smarty.foreach.blob.iteration}" class="linenr">{$smarty.foreach.blob.iteration}</a></td>
<td class="codeline">{$blobline|escape}</td> <td class="codeline">{$blobline|escape}</td>
</tr> </tr>
{/foreach} {/foreach}
</table> </table>
</div> </div>
   
{include file='footer.tpl'} {include file='footer.tpl'}
   
{* {*
* blob.tpl * blob.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Blob view template * Component: Blob 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'}
   
<div class="page_nav"> <div class="page_nav">
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$commit->GetHash()}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commitdiff&h={$commit->GetHash()}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=tree&h={$tree->GetHash()}&hb={$commit->GetHash()}">tree</a><br /> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$commit->GetHash()}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commitdiff&h={$commit->GetHash()}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=tree&h={$tree->GetHash()}&hb={$commit->GetHash()}">tree</a><br />
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob_plain&h={$hash->GetHash()}&f={$file}">plain</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob_plain&h={$blob->GetHash()}&f={$file}">plain</a> |
{if $commit->GetHash() != $head->GetHash()} {if $commit->GetHash() != $head->GetHash()}
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob&hb=HEAD&f={$file}">HEAD</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob&hb=HEAD&f={$file}">HEAD</a>
{else} {else}
HEAD HEAD
{/if} {/if}
{if !$datatag} | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blame&h={$hash->GetHash()}&f={$file}&hb={$commit->GetHash()}">blame</a>{/if} {if !$datatag} | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blame&h={$blob->GetHash()}&f={$file}&hb={$commit->GetHash()}">blame</a>{/if}
<br /> <br />
</div> </div>
   
{include file='title.tpl' titlecommit=$commit} {include file='title.tpl' titlecommit=$commit}
   
{include file='path.tpl' pathobject=$hash target='blobplain'} {include file='path.tpl' pathobject=$blob target='blobplain'}
   
<div class="page_body"> <div class="page_body">
{if $datatag} {if $datatag}
{* We're trying to display an image *} {* We're trying to display an image *}
<div> <div>
<img src="data:{$mime};base64,{$data}" /> <img src="data:{$mime};base64,{$data}" />
</div> </div>
{elseif $geshi} {elseif $geshi}
{* We're using the highlighted output from geshi *} {* We're using the highlighted output from geshi *}
{$geshiout} {$geshiout}
{else} {else}
{* Just plain display *} {* Just plain display *}
<table class="code"> <table class="code">
{foreach from=$bloblines item=line name=bloblines} {foreach from=$bloblines item=line name=bloblines}
<tr> <tr>
<td class="num"><a id="l{$smarty.foreach.bloblines.iteration}" href="#l{$smarty.foreach.bloblines.iteration}" class="linenr">{$smarty.foreach.bloblines.iteration}</a></td> <td class="num"><a id="l{$smarty.foreach.bloblines.iteration}" href="#l{$smarty.foreach.bloblines.iteration}" class="linenr">{$smarty.foreach.bloblines.iteration}</a></td>
<td class="codeline">{$line|escape}</td> <td class="codeline">{$line|escape}</td>
</tr> </tr>
{/foreach} {/foreach}
</table> </table>
{/if} {/if}
</div> </div>
   
{include file='footer.tpl'} {include file='footer.tpl'}
   
{* {*
* blobdiff.tpl * blobdiff.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Blobdiff view template * Component: Blobdiff 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'}
   
{* If we managed to look up commit info, we have enough info to display the full header - othewise just use a simple header *} {* If we managed to look up commit info, we have enough info to display the full header - othewise just use a simple header *}
<div class="page_nav"> <div class="page_nav">
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$commit->GetHash()}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commitdiff&h={$commit->GetHash()}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=tree&h={$tree->GetHash()}&hb={$commit->GetHash()}">tree</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">summary</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=shortlog">shortlog</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=log">log</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commit&h={$commit->GetHash()}">commit</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=commitdiff&h={$commit->GetHash()}">commitdiff</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=tree&h={$tree->GetHash()}&hb={$commit->GetHash()}">tree</a>
<br /> <br />
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blobdiff_plain&h={$hash->GetHash()}&hp={$hashparent->GetHash()}&f={$file}">plain</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blobdiff_plain&h={$blob->GetHash()}&hp={$blobparent->GetHash()}&f={$file}">plain</a>
</div> </div>
   
{include file='title.tpl' titlecommit=$commit} {include file='title.tpl' titlecommit=$commit}
   
{include file='path.tpl' pathobject=$hashparent target='blob'} {include file='path.tpl' pathobject=$blobparent target='blob'}
<div class="page_body"> <div class="page_body">
<div class="diff_info"> <div class="diff_info">
{* Display the from -> to diff header *} {* Display the from -> to diff header *}
blob:<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob&h={$hashparent->GetHash()}&hb={$commit->GetHash()}&f={$file}">{if $file}a/{$file}{else}{$hashparent->GetHash()}{/if}</a> -&gt; blob:<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob&h={$hash->GetHash()}&hb={$commit->GetHash()}&f={$file}">{if $file}b/{$file}{else}{$hash->GetHash()}{/if}</a> blob:<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob&h={$blobparent->GetHash()}&hb={$commit->GetHash()}&f={$file}">{if $file}a/{$file}{else}{$blobparent->GetHash()}{/if}</a> -&gt; blob:<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=blob&h={$blob->GetHash()}&hb={$commit->GetHash()}&f={$file}">{if $file}b/{$file}{else}{$blob->GetHash()}{/if}</a>
</div> </div>
{* Display the diff *} {* Display the diff *}
{include file='filediff.tpl' diff=$filediff->GetDiff($file, false, true)} {include file='filediff.tpl' diff=$filediff->GetDiff($file, false, true)}
</div> </div>
   
{include file='footer.tpl'} {include file='footer.tpl'}
   
   
{* {*
* blobplain.tpl * blobplain.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Blob plain template * Component: Blob plain template
* *
* Copyright (C) 2009 Christopher Han <xiphux@gmail.com> * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
*} *}
{$blob} {$blob->GetData()}
   
{* {*
* header.tpl * header.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Page header template * Component: Page header template
* *
* Copyright (C) 2006 Christopher Han <xiphux@gmail.com> * Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
*} *}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<!-- gitphp web interface {$version}, (C) 2006 Christopher Han <xiphux@gmail.com> --> <!-- gitphp web interface {$version}, (C) 2006 Christopher Han <xiphux@gmail.com> -->
<head> <head>
<title>{$pagetitle}{if $project} :: {$project->GetProject()}{if $action && $validaction}/{$action}{/if}{/if}</title> <title>{$pagetitle}{if $project} :: {$project->GetProject()}{if $action && $validaction}/{$action}{/if}{/if}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
{if $project} {if $project}
<link rel="alternate" title="{$project->GetProject()} log" href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=rss" type="application/rss+xml" /> <link rel="alternate" title="{$project->GetProject()} log" href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=rss" type="application/rss+xml" />
{/if} {/if}
<link rel="stylesheet" href="css/{$stylesheet}" type="text/css" /> <link rel="stylesheet" href="css/{$stylesheet}" type="text/css" />
<style type="text/css"> <style type="text/css">
<!-- <!--
{$extracss} {$extracss}
--> -->
</style></head> </style></head>
{$smarty.capture.header} {$smarty.capture.header}
</head> </head>
<body> <body>
<div class="page_header"> <div class="page_header">
<a href="http://www.kernel.org/pub/software/scm/git/docs/" title="git documentation"> <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" class="logo" /> <img src="images/git-logo.png" width="72" height="27" alt="git" class="logo" />
</a> </a>
<a href="index.php">projects</a> / <a href="index.php">projects</a> /
{if $project} {if $project}
<a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">{$project->GetProject()}</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()}&a=summary">{$project->GetProject()}</a>
{if $action && $validaction} {if $action && $validaction}
/ {$action} / {$action}
{/if} {/if}
{if $enablesearch} {if $enablesearch}
<form method="get" action="index.php" enctype="application/x-www-form-urlencoded"> <form method="get" action="index.php" enctype="application/x-www-form-urlencoded">
<div class="search"> <div class="search">
<input type="hidden" name="p" value="{$project->GetProject()}" /> <input type="hidden" name="p" value="{$project->GetProject()}" />
<input type="hidden" name="a" value="search" /> <input type="hidden" name="a" value="search" />
<input type ="hidden" name="h" value="{if $commit}{$commit->GetHash()}{elseif $hash instanceof GitPHP_Commit}{$hash->GetHash()}{elseif $hash}{$hash}{else}HEAD{/if}" /> <input type ="hidden" name="h" value="{if $commit}{$commit->GetHash()}{else}HEAD{/if}" />
<select name="st"> <select name="st">
<option {if $searchtype == 'commit'}selected="selected"{/if} value="commit">commit</option> <option {if $searchtype == 'commit'}selected="selected"{/if} value="commit">commit</option>
<option {if $searchtype == 'author'}selected="selected"{/if} value="author">author</option> <option {if $searchtype == 'author'}selected="selected"{/if} value="author">author</option>
<option {if $searchtype == 'committer'}selected="selected"{/if} value="committer">committer</option> <option {if $searchtype == 'committer'}selected="selected"{/if} value="committer">committer</option>
{if $filesearch} {if $filesearch}
<option {if $searchtype == 'file'}selected="selected"{/if} value="file">file</option> <option {if $searchtype == 'file'}selected="selected"{/if} value="file">file</option>
{/if} {/if}
</select> search: <input type="text" name="s" {if $search}value="{$search}"{/if} /> </select> search: <input type="text" name="s" {if $search}value="{$search}"{/if} />
</div> </div>
</form> </form>
{/if} {/if}
{/if} {/if}
</div> </div>
   
comments