diff options
author | Cesar G <prototech91@gmail.com> | 2014-04-08 03:54:10 -0700 |
---|---|---|
committer | Cesar G <prototech91@gmail.com> | 2014-04-23 09:11:40 -0700 |
commit | 1a51ceeabe73423b919266027cc8e86ad47a52e1 (patch) | |
tree | 5a1030aa6930b36e47cb9d5cb7ac7143f56422c0 /phpBB/memberlist.php | |
parent | 652f787abd937fe8254edc1a7f9f2fd6d7114c09 (diff) | |
download | forums-1a51ceeabe73423b919266027cc8e86ad47a52e1.tar forums-1a51ceeabe73423b919266027cc8e86ad47a52e1.tar.gz forums-1a51ceeabe73423b919266027cc8e86ad47a52e1.tar.bz2 forums-1a51ceeabe73423b919266027cc8e86ad47a52e1.tar.xz forums-1a51ceeabe73423b919266027cc8e86ad47a52e1.zip |
[ticket/10737] Clean up memberlist.php.
PHPBB3-10737
Diffstat (limited to 'phpBB/memberlist.php')
-rw-r--r-- | phpBB/memberlist.php | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 0b10c123a1..3cc92b5fe0 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -980,27 +980,35 @@ switch ($mode) ); break; - + case 'livesearch': - $username_chars = $request->variable('q', '', true); - $username_chars = utf8_strtolower($username_chars); - - $sql = 'SELECT username, user_id + + $username_chars = $request->variable('username', '', true); + + $sql = 'SELECT username, user_id, user_colour FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . ' AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->any_char); $result = $db->sql_query_limit($sql, 10); - - $user_list = array(); + $user_list = array(); + while ($row = $db->sql_fetchrow($result)) - { - $user_list[] = array('id' => $row['user_id'], 'name' => $row['username']); + { + $user_list[] = array( + 'user_id' => (int) $row['user_id'], + 'username' => $row['username'], + 'result' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + ); } $db->sql_freeresult($result); $json_response = new \phpbb\json_response(); - $json_response->send($user_list); + $json_response->send(array( + 'keyword' => $username_chars, + 'results' => $user_list, + )); + break; - + case 'group': default: // The basic memberlist @@ -1638,6 +1646,7 @@ switch ($mode) 'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '', 'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '', + 'U_LIVE_SEARCH' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch'), 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), |