Trim search keywords when searching user - refs BT#13782

pull/2487/head
Angel Fernando Quiroz Campos 7 years ago
parent 957845ba25
commit 49cea679f1
  1. 23
      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().

Loading…
Cancel
Save