diff --git a/main/admin/user_list.php b/main/admin/user_list.php index 937c753499..5292150670 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -64,6 +64,8 @@ if (api_get_configuration_value('deny_delete_users')) { $deleteUserAvailable = false; } +trimVariables(); + $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=get_user_courses'; $urlSession = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=get_user_sessions'; $extraField = new ExtraField('user'); @@ -193,6 +195,27 @@ function load_calendar(user_id, month, year) { $this_section = SECTION_PLATFORM_ADMIN; +/** + * Trim variable values to avoid trailing spaces + */ +function trimVariables() +{ + $filterVariables = [ + 'keyword', + 'keyword_firstname', + 'keyword_lastname', + 'keyword_username', + 'keyword_email', + 'keyword_officialcode', + ]; + + foreach ($filterVariables as $variable) { + if (isset($_GET[$variable])) { + $_GET[$variable] = trim($_GET[$variable]); + } + } +} + /** * Prepares the shared SQL query for the user table. * See get_user_data() and get_number_of_users().