MDL-83357 question: Additional cleaning of filter params

This commit is contained in:
Mark Johnson 2024-10-04 14:55:36 +01:00 committed by Jenkins
parent 0ff35dc282
commit c5f78e9bd3

View File

@ -217,7 +217,20 @@ function question_build_edit_resources($edittab, $baseurl, $params,
if (!is_array($params['filter'])) {
$params['filter'] = json_decode($params['filter'], true);
}
$cleanparams['filter'] = $params['filter'];
$cleanparams['filter'] = [];
foreach ($params['filter'] as $filterkey => $filtervalue) {
if ($filterkey == 'jointype') {
$cleanparams['filter']['jointype'] = clean_param($filtervalue, PARAM_INT);
} else {
$cleanfilter = [
'name' => clean_param($filtervalue['name'], PARAM_ALPHANUM),
'jointype' => clean_param($filtervalue['jointype'], PARAM_INT),
'values' => $filtervalue['values'],
'filteroptions' => $filtervalue['filteroptions'],
];
$cleanparams['filter'][$filterkey] = $cleanfilter;
}
}
}
if (isset($params['sortdata'])) {