diff --git a/module/gitlab/control.php b/module/gitlab/control.php index c8ce7f34ba..077de6ebe7 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -314,7 +314,7 @@ class gitlab extends control } $groups = $this->gitlab->apiGetGroups($gitlabID, $orderBy); - $adminGroups = $this->gitlab->apiGetGroups($gitlabID, $orderBy, $this->gitlab->config->accessLevel['owner']); + $adminGroups = $this->gitlab->apiGetGroups($gitlabID, $orderBy, $this->config->gitlab->accessLevel['owner']); $adminGropuIDList = array(); foreach($adminGroups as $group) $adminGropuIDList[] = $group->id; @@ -871,7 +871,7 @@ class gitlab extends control { $openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account); if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } $keyword = fixer::input('post')->setDefault('keyword', '')->get('keyword'); @@ -912,7 +912,7 @@ class gitlab extends control if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); $project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } /* Fix error when request type is PATH_INFO and the branch name contains '-'.*/ @@ -993,7 +993,7 @@ class gitlab extends control if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); $project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } if($confirm != 'yes') @@ -1037,7 +1037,7 @@ class gitlab extends control $openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account); if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } $this->session->set('gitlabTagList', $this->app->getURI(true)); @@ -1093,7 +1093,7 @@ class gitlab extends control $openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account); if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } $this->session->set('gitlabTagPrivList', $this->app->getURI(true)); @@ -1168,7 +1168,7 @@ class gitlab extends control if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); $project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } if($_POST) @@ -1213,7 +1213,7 @@ class gitlab extends control if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); $project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } /* Fix error when request type is PATH_INFO and the tag name contains '-'.*/ @@ -1255,7 +1255,7 @@ class gitlab extends control if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); $project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID); - if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); + if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } /* Fix error when request type is PATH_INFO and the tag name contains '-'.*/ diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 68afc2c66a..2bef5fad79 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -655,7 +655,8 @@ class gitlabModel extends model /* Parse order string. */ $order = explode('_', $orderBy); - $result = commonModel::httpWithHeader($url . "&&per_page={$pager->recPerPage}&order_by={$order[0]}&sort={$order[1]}&page={$pager->pageID}&search={$keyword}&search_namespaces=true"); + $keyword = urlencode($keyword); + $result = commonModel::httpWithHeader($url . "&per_page={$pager->recPerPage}&order_by={$order[0]}&sort={$order[1]}&page={$pager->pageID}&search={$keyword}&search_namespaces=true"); $header = $result['header']; $recTotal = $header['X-Total']; @@ -2749,19 +2750,18 @@ class gitlabModel extends model * Check user access. * * @param int $gitlabID - * @param int $openID * @param int $projectID * @param object $project * @param string $maxRole * @access public * @return bool */ - public function checkUserAccess($gitlabID, $openID = 0, $projectID = 0, $project = null, $groupIDList = array(), $maxRole = 'maintainer') + public function checkUserAccess($gitlabID, $projectID = 0, $project = null, $groupIDList = array(), $maxRole = 'maintainer') { if($this->app->user->admin) return true; if($project == null) $project = $this->apiGetSingleProject($gitlabID, $projectID); - if(!$openID or !isset($project->id)) return false; + if(!isset($project->id)) return false; $accessLevel = $this->config->gitlab->accessLevel[$maxRole];