diff --git a/module/git/control.php b/module/git/control.php index 570a5aec53..102621c7b0 100644 --- a/module/git/control.php +++ b/module/git/control.php @@ -34,30 +34,30 @@ class git extends control { if(isset($_GET['repoUrl'])) $path = $this->get->repoUrl; - $path = helper::safe64Decode($path); - $repos = $this->loadModel('repo')->getListBySCM('Git,Gitlab,Gogs,Gitea', 'haspriv'); - $oneRepo = null; + $path = helper::safe64Decode($path); + $repos = $this->loadModel('repo')->getListBySCM('Git,Gitlab,Gogs,Gitea', 'haspriv'); + $currentRepo = null; foreach($repos as $repo) { - if(!empty($repo->path) and strpos($path, $repo->path) === 0) $oneRepo = $repo; + if(!empty($repo->path) and strpos($path, $repo->path) === 0) $currentRepo = $repo; } - if($oneRepo and common::hasPriv('repo', 'diff')) + if($currentRepo and common::hasPriv('repo', 'diff')) { - $entry = $this->repo->encodePath(str_replace($oneRepo->path, '', $path)); + $entry = $this->repo->encodePath(str_replace($currentRepo->path, '', $path)); $oldRevision = "$revision^"; - return $this->locate($this->repo->createLink('diff', "repoID=$oneRepo->id&objectID=0&entry=$entry&oldRevision=$oldRevision&revision=$revision", 'html', 'true')); + return $this->locate($this->repo->createLink('diff', "repoID=$currentRepo->id&objectID=0&entry=$entry&oldRevision=$oldRevision&revision=$revision", 'html', 'true')); } - if($oneRepo) + if($currentRepo) { $scm = $this->app->loadClass('scm'); - $scm->setEngine($oneRepo); + $scm->setEngine($currentRepo); } $this->view->path = $path; $this->view->revision = $revision; - $this->view->diff = $oneRepo ? $scm->diff($path, $revision) : ''; + $this->view->diff = $currentRepo ? $scm->diff($path, $revision) : ''; $this->display(); } @@ -74,28 +74,28 @@ class git extends control { if(isset($_GET['repoUrl'])) $path = $this->get->repoUrl; - $path = helper::safe64Decode($path); - $repos = $this->loadModel('repo')->getListBySCM('Git,Gitlab,Gogs,Gitea', 'haspriv'); - $oneRepo = null; + $path = helper::safe64Decode($path); + $repos = $this->loadModel('repo')->getListBySCM('Git,Gitlab,Gogs,Gitea', 'haspriv'); + $currentRepo = null; foreach($repos as $repo) { - if(!empty($repo->path) and strpos($path, $repo->path) === 0) $oneRepo = $repo; + if(!empty($repo->path) and strpos($path, $repo->path) === 0) $currentRepo = $repo; } - if($oneRepo and common::hasPriv('repo', 'view')) + if($currentRepo and common::hasPriv('repo', 'view')) { - $entry = $this->repo->encodePath(str_replace($oneRepo->path, '', $path)); - return $this->locate($this->repo->createLink('view', "repoID=$oneRepo->id&objectID=0&entry=$entry&revision=$revision", 'html', true)); + $entry = $this->repo->encodePath(str_replace($currentRepo->path, '', $path)); + return $this->locate($this->repo->createLink('view', "repoID=$currentRepo->id&objectID=0&entry=$entry&revision=$revision", 'html', true)); } - if($oneRepo) + if($currentRepo) { $scm = $this->app->loadClass('scm'); - $scm->setEngine($oneRepo); + $scm->setEngine($currentRepo); } $this->view->path = $path; $this->view->revision = $revision; - $this->view->code = $oneRepo ? $scm->cat($path, $revision) : ''; + $this->view->code = $currentRepo ? $scm->cat($path, $revision) : ''; $this->display(); }