Merge branch 'devops_cyy_git' into 'master'
* Modify branch encode. See merge request easycorp/zentaopms!1938
This commit is contained in:
@@ -924,7 +924,7 @@ class gitlab extends control
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
if($branch) $branch = str_replace('*', '-', $branch);
|
||||
if($branch) $branch = urldecode(helper::safe64Decode($branch));
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
@@ -935,7 +935,7 @@ class gitlab extends control
|
||||
}
|
||||
|
||||
$branchPriv = new stdClass();
|
||||
$branchPriv->name = '';
|
||||
$branchPriv->name = '';
|
||||
$branchPriv->mergeAccessLevel = 40; // Initialize data, and the operation authority is the maintainers by default.
|
||||
$branchPriv->pushAccessLevel = 40; // Initialize data, and the operation authority is the maintainers by default.
|
||||
|
||||
@@ -945,6 +945,7 @@ class gitlab extends control
|
||||
{
|
||||
$title = $this->lang->gitlab->editBranchPriv;
|
||||
$branchPriv = $this->gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
|
||||
$branchPriv->name = helper::safe64Encode(urlencode($branchPriv->name));
|
||||
$branchPriv->mergeAccessLevel = $this->gitlab->checkAccessLevel($branchPriv->merge_access_levels);
|
||||
$branchPriv->pushAccessLevel = $this->gitlab->checkAccessLevel($branchPriv->push_access_levels);
|
||||
}
|
||||
@@ -956,7 +957,11 @@ class gitlab extends control
|
||||
$branches = array();
|
||||
foreach($gitlabBranches as $oneBranch)
|
||||
{
|
||||
if(!in_array($oneBranch->name, $protectNames) || $oneBranch->name == $branch) $branches[$oneBranch->name] = $oneBranch->name;
|
||||
if(!in_array($oneBranch->name, $protectNames) || $oneBranch->name == $branch)
|
||||
{
|
||||
$branchName = helper::safe64Encode(urlencode($oneBranch->name));
|
||||
$branches[$branchName] = $oneBranch->name;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $title;
|
||||
@@ -1006,12 +1011,11 @@ class gitlab extends control
|
||||
|
||||
if($confirm != 'yes')
|
||||
{
|
||||
$branch = urlencode($branch);
|
||||
die(js::confirm($this->lang->gitlab->branch->confirmDelete , inlink('deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch&confirm=yes")));
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
$branch = str_replace('*', '-', $branch);
|
||||
$branch = urldecode(helper::safe64Decode($branch));
|
||||
$reponse = $this->gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
|
||||
|
||||
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
|
||||
@@ -1223,7 +1227,7 @@ class gitlab extends control
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tag = str_replace('*', '-', $tag);
|
||||
$tag = urldecode(helper::safe64Decode($tag));
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
@@ -1265,7 +1269,7 @@ class gitlab extends control
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tag = str_replace('*', '-', $tag);
|
||||
$tag = urldecode(helper::safe64Decode($tag));
|
||||
$reponse = $this->gitlab->apiDeleteTagPriv($gitlabID, $projectID, $tag);
|
||||
|
||||
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
|
||||
@@ -1677,7 +1681,7 @@ class gitlab extends control
|
||||
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->tag->confirmDelete , inlink('deleteTag', "gitlabID=$gitlabID&projectID=$projectID&tagName=$tagName&confirm=yes")));
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tagName = str_replace('*', '-', $tagName);
|
||||
$tagName = urldecode(helper::safe64Decode($tagName));
|
||||
$reponse = $this->gitlab->apiDeleteTag($gitlabID, $projectID, $tagName);
|
||||
|
||||
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
|
||||
|
||||
@@ -2577,6 +2577,7 @@ class gitlabModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
$priv->name = urldecode(helper::safe64Decode($priv->name));
|
||||
$singleBranch = $this->apiGetSingleBranchPriv($gitlabID, $projectID, $priv->name);
|
||||
if(empty($branch) && !empty($singleBranch->id))
|
||||
{
|
||||
@@ -2611,6 +2612,7 @@ class gitlabModel extends model
|
||||
if(empty($gitlabID)) return false;
|
||||
if(empty($projectID)) return false;
|
||||
if(empty($priv->name)) return false;
|
||||
$priv->name = html_entity_decode($priv->name, ENT_QUOTES);
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/" . $projectID . '/protected_branches');
|
||||
return json_decode(commonModel::http($url, $priv));
|
||||
}
|
||||
@@ -2627,6 +2629,7 @@ class gitlabModel extends model
|
||||
public function apiDeleteBranchPriv($gitlabID, $projectID, $branch)
|
||||
{
|
||||
if(empty($gitlabID)) return false;
|
||||
$branch = urlencode($branch);
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
$url = sprintf($apiRoot, "/projects/{$projectID}/protected_branches/{$branch}");
|
||||
return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
$branchName = str_replace('-', '*', $branch->name);
|
||||
$branchName = helper::safe64Encode(urlencode($branch->name));
|
||||
if(common::hasPriv('gitlab', 'editBranchPriv')) common::printLink('gitlab', 'editBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branchName", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->editBranchPriv} class='btn btn-primary'");
|
||||
if(common::hasPriv('gitlab', 'deleteBranchPriv')) echo html::a($this->createLink('gitlab', 'deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branchName"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteBranchPriv}' class='btn'");
|
||||
?>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tagName = str_replace('-', '*', $gitlabTag->name);
|
||||
$tagName = helper::safe64Encode(urlencode($gitlabTag->name));
|
||||
$isDisabled = $gitlabTag->protected ? 'disabled' : '';
|
||||
common::printLink('gitlab', 'deleteTag', "gitlabID=$gitlabID&projectID={$projectID}&tag_name=$tagName", "<i class='icon icon-trash'></i> ", '', "title='{$lang->gitlab->deleteTag}' class='btn' target='hiddenwin' $isDisabled");
|
||||
?>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tagName = str_replace('-', '*', $gitlabTag->name);
|
||||
$tagName = helper::safe64Encode(urlencode($gitlabTag->name));
|
||||
common::printLink('gitlab', 'editTagPriv', "gitlabID=$gitlabID&projectID=$projectID&tag_name=$tagName", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->editTagPriv} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'deleteTagPriv', "gitlabID=$gitlabID&projectID={$projectID}&tag_name=$tagName", "<i class='icon icon-trash'></i> ", '', "title='{$lang->gitlab->deleteTagPriv}' class='btn btn-primary' target='hiddenwin' onclick='if(confirm(\"{$lang->gitlab->tag->protectConfirmDel}\")==false) return false;'");
|
||||
?>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<h2><?php echo $pageTitle;?></h2>
|
||||
</div>
|
||||
<form id='branchForm' method='post' class='form-ajax' enctype="multipart/form-data">
|
||||
<?php if($branch) echo html::hidden('name', $branch);?>
|
||||
<?php if($branchPriv->name) echo html::hidden('name', $branchPriv->name);?>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->gitlab->branch->name;?></th>
|
||||
|
||||
Reference in New Issue
Block a user