Fixing get_user_data

skala
Julio Montoya 15 years ago
parent 53cb3130df
commit 57bac57c29
  1. 67
      main/admin/user_list.php

@ -325,73 +325,6 @@ function get_user_data($from, $number_of_items, $column, $direction)
{
global $_configuration,$origin;
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".(api_is_western_name_order()
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.username AS col4,
u.email AS col5,
u.status AS col6,
u.active AS col7,
u.user_id AS col8 ".
", u.expiration_date AS exp ".
" FROM $user_table u ";
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR concat(u.firstname,' ',u.lastname) LIKE '%".$keyword."%' OR concat(u.lastname,' ',u.firstname) LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' )";
} elseif (isset ($_GET['keyword_firstname'])) {
$keyword_firstname = Database::escape_string($_GET['keyword_firstname']);
$keyword_lastname = Database::escape_string($_GET['keyword_lastname']);
$keyword_email = Database::escape_string($_GET['keyword_email']);
$keyword_officialcode = Database::escape_string($_GET['keyword_officialcode']);
$keyword_username = Database::escape_string($_GET['keyword_username']);
$keyword_status = Database::escape_string($_GET['keyword_status']);
$query_admin_table = '';
$keyword_admin = '';
if ($keyword_status == SESSIONADMIN) {
$keyword_status = '%';
$query_admin_table = " , $admin_table a ";
$keyword_admin = ' AND a.user_id = u.user_id ';
}
$keyword_active = isset($_GET['keyword_active']);
$keyword_inactive = isset($_GET['keyword_inactive']);
$sql .= $query_admin_table." WHERE (u.firstname LIKE '%".$keyword_firstname."%' " .
"AND u.lastname LIKE '%".$keyword_lastname."%' " .
"AND u.username LIKE '%".$keyword_username."%' " .
"AND u.email LIKE '%".$keyword_email."%' " .
"AND u.official_code LIKE '%".$keyword_officialcode."%' " .
"AND u.status LIKE '".$keyword_status."'" .
$keyword_admin;
if ($keyword_active && !$keyword_inactive) {
$sql .= " AND u.active='1'";
} elseif($keyword_inactive && !$keyword_active) {
$sql .= " AND u.active='0'";
}
$sql .= " ) ";
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
global $_configuration,$origin;
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
$sql = "SELECT

Loading…
Cancel
Save