* code for task #6708.

This commit is contained in:
wangyidong
2019-12-10 15:45:06 +08:00
parent 2d979228eb
commit 52460dd80d
12 changed files with 110 additions and 13 deletions
+29
View File
@@ -33,7 +33,22 @@ class git extends control
public function diff($path, $revision)
{
if(isset($_GET['repoUrl'])) $path = $this->get->repoUrl;
$path = helper::safe64Decode($path);
if(common::hasPriv('repo', 'diff'))
{
$repos = $this->loadModel('repo')->getAllRepos();
foreach($repos as $repo)
{
if($repo->SCM != 'Git') continue;
if(strpos($path, $repo->path) === 0)
{
$entry = $this->repo->encodePath(str_replace($repo->path, '', $path));
$oldRevision = "$revision^";
$this->locate($this->repo->createLink('diff', "repoID=$repo->id&entry=&oldRevision=$oldRevision&revision=$revision", "entry=$entry", 'html', 'true'));
}
}
}
$this->view->path = $path;
$this->view->revision = $revision;
@@ -53,7 +68,21 @@ class git extends control
public function cat($path, $revision)
{
if(isset($_GET['repoUrl'])) $path = $this->get->repoUrl;
$path = helper::safe64Decode($path);
if(common::hasPriv('repo', 'view'))
{
$repos = $this->loadModel('repo')->getAllRepos();
foreach($repos as $repo)
{
if($repo->SCM != 'Git') continue;
if(strpos($path, $repo->path) === 0)
{
$entry = $this->repo->encodePath(str_replace($repo->path, '', $path));
$this->locate($this->repo->createLink('view', "repoID=$repo->id&entry=&revision=$revision", "entry=$entry", 'html', true));
}
}
}
$this->view->path = $path;
$this->view->revision = $revision;