diff --git a/phpBB/admin/admin_ban.php b/phpBB/admin/admin_ban.php index 355c53bd5f..61f85b62ca 100644 --- a/phpBB/admin/admin_ban.php +++ b/phpBB/admin/admin_ban.php @@ -401,7 +401,7 @@ switch ( $mode ) $l_unban_explain = $lang['Unban_username_explain']; $l_ban_cell = $lang['Username']; $l_no_ban_cell = $lang['No_banned_users']; - $s_submit_extra = ''; + $s_submit_extra = ''; break; diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 29a0577888..5a5c277ef6 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -760,7 +760,7 @@ $lang['Search_keywords'] = 'Search for Keywords'; $lang['Search_keywords_explain'] = 'You can use AND to define words which must be in the results, OR to define words which may be in the result and NOT to define words which should not be in the result. Use * as a wildcard for partial matches'; $lang['Search_author'] = 'Search for Author'; $lang['Search_author_explain'] = 'Use * as a wildcard for partial matches'; -$lang['Find_username_explain'] = 'Use this form to search for specific usernames. You do not need to fill out all fields, to partialy match data use * as a wildcard. When entering dates use the format yyyy-mm-dd, e.g. 2002-01-01.'; +$lang['Find_username_explain'] = 'Use this form to search for specific usernames. You do not need to fill out all fields, to partialy match data use * as a wildcard. When entering dates use the format yyyy-mm-dd, e.g. 2002-01-01. Click the username to automatically enter it into the form you are viewing (several usernames may be accepted depending on the form itself).'; $lang['Last_active'] = 'Last active'; $lang['Search_for_any'] = 'Search for any terms or use query as entered'; diff --git a/phpBB/search.php b/phpBB/search.php index bc1b1a1757..04c9487da8 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1304,24 +1304,26 @@ function username_search() global $db, $board_config, $template, $acl, $lang, $theme; global $starttime; - $field_name = ( isset($HTTP_GET_VARS['field']) ) ? $HTTP_GET_VARS['field'] : 'username'; + $field = ( isset($HTTP_GET_VARS['field']) ) ? $HTTP_GET_VARS['field'] : 'username'; $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; - $sort_order = ( !empty($HTTP_POST_VARS['sort_order']) ) ? $HTTP_POST_VARS['sort_order'] : 'd'; - $sort_by = ( !empty($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : 4; - $joined_select = ( !empty($HTTP_POST_VARS['joined_select']) ) ? $HTTP_POST_VARS['joined_select'] : 'lt'; - $active_select = ( !empty($HTTP_POST_VARS['active_select']) ) ? $HTTP_POST_VARS['active_select'] : 'lt'; - $count_select = ( !empty($HTTP_POST_VARS['count_select']) ) ? $HTTP_POST_VARS['count_select'] : 'lt'; + $sort_order = ( !empty($HTTP_POST_VARS['sort_order']) ) ? $HTTP_POST_VARS['sort_order'] : ( ( !empty($HTTP_GET_VARS['sort_order']) ) ? $HTTP_GET_VARS['sort_order'] : 'd' ); - $username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ''; - $email = ( !empty($HTTP_POST_VARS['email']) ) ? $HTTP_POST_VARS['email'] : ''; - $icq = ( !empty($HTTP_POST_VARS['icq']) ) ? intval($HTTP_POST_VARS['icq']) : ''; - $aim = ( !empty($HTTP_POST_VARS['aim']) ) ? $HTTP_POST_VARS['aim'] : ''; - $yahoo = ( !empty($HTTP_POST_VARS['yahoo']) ) ? $HTTP_POST_VARS['yahoo'] : ''; - $msn = ( !empty($HTTP_POST_VARS['msn']) ) ? $HTTP_POST_VARS['msn'] : ''; - $joined = ( !empty($HTTP_POST_VARS['joined']) ) ? explode('-', $HTTP_POST_VARS['joined']) : ''; - $active = ( !empty($HTTP_POST_VARS['active']) ) ? explode('-', $HTTP_POST_VARS['active']) : ''; - $count = ( !empty($HTTP_POST_VARS['count']) ) ? intval($HTTP_POST_VARS['count']) : ''; + $sort_by = ( !empty($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : ( ( !empty($HTTP_GET_VARS['sort_by']) ) ? $HTTP_GET_VARS['sort_by'] : '4' ); + + $joined_select = ( !empty($HTTP_POST_VARS['joined_select']) ) ? $HTTP_POST_VARS['joined_select'] : ( ( !empty($HTTP_GET_VARS['joined_select']) ) ? $HTTP_GET_VARS['joined_select'] : 'lt' ); + $active_select = ( !empty($HTTP_POST_VARS['active_select']) ) ? $HTTP_POST_VARS['active_select'] : ( ( !empty($HTTP_GET_VARS['active_select']) ) ? $HTTP_GET_VARS['active_select'] : 'lt' ); + $count_select = ( !empty($HTTP_POST_VARS['count_select']) ) ? $HTTP_POST_VARS['count_select'] : ( ( !empty($HTTP_GET_VARS['count_select']) ) ? $HTTP_GET_VARS['count_select'] : 'eq' ); + + $username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ( ( !empty($HTTP_GET_VARS['username']) ) ? $HTTP_GET_VARS['username'] : '' ); + $email = ( !empty($HTTP_POST_VARS['email']) ) ? $HTTP_POST_VARS['email'] : ( ( !empty($HTTP_GET_VARS['email']) ) ? $HTTP_GET_VARS['email'] : '' ); + $icq = ( !empty($HTTP_POST_VARS['icq']) ) ? intval($HTTP_POST_VARS['icq']) : ( ( !empty($HTTP_GET_VARS['icq']) ) ? $HTTP_GET_VARS['icq'] : '' ); + $aim = ( !empty($HTTP_POST_VARS['aim']) ) ? $HTTP_POST_VARS['aim'] : ( ( !empty($HTTP_GET_VARS['aim']) ) ? $HTTP_GET_VARS['aim'] : '' ); + $yahoo = ( !empty($HTTP_POST_VARS['yahoo']) ) ? $HTTP_POST_VARS['yahoo'] : ( ( !empty($HTTP_GET_VARS['yahoo']) ) ? $HTTP_GET_VARS['yahoo'] : '' ); + $msn = ( !empty($HTTP_POST_VARS['msn']) ) ? $HTTP_POST_VARS['msn'] : ( ( !empty($HTTP_GET_VARS['msn']) ) ? $HTTP_GET_VARS['msn'] : '' ); + $joined = ( !empty($HTTP_POST_VARS['joined']) ) ? explode('-', $HTTP_POST_VARS['joined']) : ( ( !empty($HTTP_GET_VARS['joined']) ) ? explode('-', $HTTP_GET_VARS['joined']) : array() ); + $active = ( !empty($HTTP_POST_VARS['active']) ) ? explode('-', $HTTP_POST_VARS['active']) : ( ( !empty($HTTP_GET_VARS['active']) ) ? explode('-', $HTTP_GET_VARS['active']) : array() ); + $count = ( !empty($HTTP_POST_VARS['count']) ) ? intval($HTTP_POST_VARS['count']) : ( ( !empty($HTTP_GET_VARS['count']) ) ? $HTTP_GET_VARS['count'] : '' ); // // @@ -1342,8 +1344,6 @@ function username_search() $s_sort_order .= ''; } - $sort_order = ( $sort_order == 'a' ) ? 'ASC' : 'DESC'; - $find_count = array('lt' => $lang['Less_than'], 'eq' => $lang['Equal_to'], 'gt' => $lang['More_than']); $s_find_count = ''; foreach ( $find_count as $key => $value ) @@ -1381,28 +1381,26 @@ function username_search() $where_sql .= ( $aim ) ? " AND user_aim LIKE '" . str_replace('*', '%', $aim) ."' " : ''; $where_sql .= ( $yahoo ) ? " AND user_yim LIKE '" . str_replace('*', '%', $yahoo) ."' " : ''; $where_sql .= ( $msn ) ? " AND user_msnm LIKE '" . str_replace('*', '%', $msn) ."' " : ''; - $where_sql .= ( $joined ) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, $joined[1], $joined[2], $joined[0]) : ''; + $where_sql .= ( $joined ) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : ''; $where_sql .= ( $count ) ? " AND user_posts " . $key_match[$count_select] . " $count " : ''; - $where_sql .= ( $active ) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], $active[2], $active[0]) : ''; + $where_sql .= ( $active ) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : ''; - $order_by = $sort_by_types[$sort_by] . " $sort_order "; + $order_by = $sort_by_types[$sort_by] . " " . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' ); } else { - $order_by = "user_lastvisit $sort_order "; + $order_by = "user_lastvisit DESC "; } $sql = "SELECT COUNT(user_id) AS total_users FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " - $where_sql - ORDER BY $order_by - LIMIT $start, " . $board_config['topics_per_page']; + $where_sql"; $result = $db->sql_query($sql); $total_users = ( $row = $db->sql_fetchrow($result) ) ? $row['total_users'] : 0; - $pagination = generate_pagination("search.$phpEx$SID&mode=searchuser&field=$field&order=$sort_order", $total_users, $board_config['topics_per_page'], $start); + $pagination = generate_pagination("search.$phpEx$SID&mode=searchuser&field=$field&username=" . urlencode($username) . "&email=" . urlencode($email) . "&icq=$icq&aim=" . urlencode($aim) . "&yahoo=" . urlencode($yahoo) . "&msn=" . urlencode($msn) . "&joined=" . urlencode(implode('-', $joined)) . "&active=" . urlencode(implode('-', $active)) . "&count=$count&sort_order=$sort_order&sort_by=$sort_by&joined_select=$joined_select&active_select=$active_select&count_select=$count_select", $total_users, $board_config['topics_per_page'], $start); // // @@ -1421,8 +1419,8 @@ function username_search() 'AIM' => $aim, 'YAHOO' => $yahoo, 'MSNM' => $msn, - 'JOINED' => ( is_array($joined) ) ? implode('-', $joined) : '', - 'ACTIVE' => ( is_array($active) ) ? implode('-', $active) : '', + 'JOINED' => implode('-', $joined), + 'ACTIVE' => implode('-', $active), 'COUNT' => $count, 'PAGINATION' => $pagination, @@ -1448,14 +1446,14 @@ function username_search() 'L_SEARCH' => $lang['Search'], 'L_CLOSE_WINDOW' => $lang['Close_window'], - 'S_FIELD_NAME' => $field_name, + 'S_FIELD_NAME' => $field, 'S_COUNT_OPTIONS' => $s_find_count, 'S_JOINED_TIME_OPTIONS' => $s_find_join_time, 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time, 'S_SORT_OPTIONS' => $s_sort_by, 'S_SORT_ORDER' => $s_sort_order, 'S_USERNAME_OPTIONS' => $username_list, - 'S_SEARCH_ACTION' => "search.$phpEx$SID&mode=searchuser") + 'S_SEARCH_ACTION' => "search.$phpEx$SID&mode=searchuser&field=$field") ); $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_email, user_lastvisit @@ -1486,7 +1484,6 @@ function username_search() $template->assign_block_vars('memberrow', array( 'ROW_NUMBER' => $i + ( $start + 1 ), 'USERNAME' => $username, - 'FROM' => $from, 'JOINED' => $joined, 'POSTS' => $posts, 'ACTIVE' => $active, diff --git a/phpBB/templates/subSilver/search_username.html b/phpBB/templates/subSilver/search_username.html index ed0f3bea22..208a4939c6 100644 --- a/phpBB/templates/subSilver/search_username.html +++ b/phpBB/templates/subSilver/search_username.html @@ -5,12 +5,11 @@ function refresh_username(selected_username) { opener.document.forms[0].{S_FIELD_NAME}.value += ( opener.document.forms[0].{S_FIELD_NAME}.value.length ) ? "\n" + selected_username : selected_username; - opener.focus(); } //--> -