Addded param to escape API url call raw_decode

This commit is contained in:
Calvo 2021-03-16 11:03:15 +01:00
parent eea114e3d1
commit 8ed48776ee
2 changed files with 8 additions and 6 deletions

View File

@ -54,8 +54,9 @@ $api_password = get_parameter('apipass', '');
$password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
$raw_decode = (bool) get_parameter('raw_decode', false);
$other = parseOtherParameter($otherSerialize, $otherMode);
$other = parseOtherParameter($otherSerialize, $otherMode, $raw_decode);
$apiPassword = io_output_password(
db_get_value_filter(
'value',

View File

@ -43,11 +43,12 @@ use PandoraFMS\Enterprise\Cluster;
/**
* Parse the "other" parameter.
*
* @param string $other
* @param mixed $otherType
* @param string $other
* @param mixed $otherType
* @param boolean $rawDecode Decode string in which the sequences with percent (%) signs followed by two hex digits have been replaced with literal characters.
* @return mixed
*/
function parseOtherParameter($other, $otherType)
function parseOtherParameter($other, $otherType, $rawDecode)
{
switch ($otherType) {
case 'url_encode':
@ -65,12 +66,12 @@ function parseOtherParameter($other, $otherType)
'data' => explode($separator, $other),
];
foreach ($returnVar['data'] as $index => $element) {
$returnVar['data'][$index] = urldecode($element);
$returnVar['data'][$index] = $rawDecode ? rawurldecode($element) : urldecode($element);
}
} else {
$returnVar = [
'type' => 'string',
'data' => urldecode($other),
'data' => $rawDecode ? rawurldecode($other) : urldecode($other),
];
}
break;