Fixing Request resolve #1

This commit is contained in:
ahwelp
2019-03-28 00:12:02 +00:00
parent 1c7cd68096
commit 12040a2360
+7 -7
View File
@@ -52,7 +52,7 @@ class Request{
} }
if (is_array($param)) { if (is_array($param)) {
return required_param_array($parname, $type); return self::required_param_array($parname, $type);
} }
return self::clean_param($param, $type); return self::clean_param($param, $type);
@@ -79,7 +79,7 @@ class Request{
if (!preg_match('/^[a-z0-9_-]+$/i', $key)) { if (!preg_match('/^[a-z0-9_-]+$/i', $key)) {
continue; continue;
} }
$result[$key] = clean_param($value, $type); $result[$key] = self::clean_param($value, $type);
} }
return $result; return $result;
} }
@@ -137,12 +137,12 @@ class Request{
global $CFG; global $CFG;
if (is_array($param)) { if (is_array($param)) {
throw new coding_exception('clean_param() can not process arrays, please use clean_param_array() instead.'); throw new coding_exception('clean_param() can not process arrays, please use self::clean_param_array() instead.');
} else if (is_object($param)) { } else if (is_object($param)) {
if (method_exists($param, '__toString')) { if (method_exists($param, '__toString')) {
$param = $param->__toString(); $param = $param->__toString();
} else { } else {
throw new coding_exception('clean_param() can not process objects, please use clean_param_array() instead.'); throw new coding_exception('clean_param() can not process objects, please use self::clean_param_array() instead.');
} }
} }
@@ -312,7 +312,7 @@ class Request{
if ($crumb === '.' && $key === 0) { if ($crumb === '.' && $key === 0) {
// Special condition to allow for relative current path such as ./currentdirfile.txt. // Special condition to allow for relative current path such as ./currentdirfile.txt.
} else { } else {
$crumb = clean_param($crumb, PARAM_FILE); $crumb = self::clean_param($crumb, PARAM_FILE);
} }
$breadcrumb[$key] = $crumb; $breadcrumb[$key] = $crumb;
} }
@@ -368,7 +368,7 @@ class Request{
if (preg_match('/^-----BEGIN CERTIFICATE-----([\s\w\/\+=]+)-----END CERTIFICATE-----$/', trim($param), $matches)) { if (preg_match('/^-----BEGIN CERTIFICATE-----([\s\w\/\+=]+)-----END CERTIFICATE-----$/', trim($param), $matches)) {
list($wholething, $body) = $matches; list($wholething, $body) = $matches;
unset($wholething, $matches); unset($wholething, $matches);
$b64 = clean_param($body, PARAM_BASE64); $b64 = self::clean_param($body, PARAM_BASE64);
if (!empty($b64)) { if (!empty($b64)) {
return "-----BEGIN CERTIFICATE-----\n$b64\n-----END CERTIFICATE-----\n"; return "-----BEGIN CERTIFICATE-----\n$b64\n-----END CERTIFICATE-----\n";
} else { } else {
@@ -411,7 +411,7 @@ class Request{
$tags = explode(',', $param); $tags = explode(',', $param);
$result = array(); $result = array();
foreach ($tags as $tag) { foreach ($tags as $tag) {
$res = clean_param($tag, PARAM_TAG); $res = self::clean_param($tag, PARAM_TAG);
if ($res !== '') { if ($res !== '') {
$result[] = $res; $result[] = $res;
} }