MDL-60738 webservice: Clean theme and lang properly
Sometimes the "theme" and "lang" fields in the user and course tables in the database are set to incorrect values (uninstalled or non-existent themes and language packs). This makes Web Services functions to fail because the WS server validate the returned data using the validate_param function that clean parameters.
This commit is contained in:
@@ -564,6 +564,14 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
}
|
||||
}
|
||||
|
||||
// Clean lang and auth fields for external functions (it may content uninstalled themes or language packs).
|
||||
if (isset($userdetails['lang'])) {
|
||||
$userdetails['lang'] = clean_param($userdetails['lang'], PARAM_LANG);
|
||||
}
|
||||
if (isset($userdetails['theme'])) {
|
||||
$userdetails['theme'] = clean_param($userdetails['theme'], PARAM_THEME);
|
||||
}
|
||||
|
||||
return $userdetails;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user