diff options
-rw-r--r-- | phpBB/language/lang_english/lang_main.php | 3 | ||||
-rw-r--r-- | phpBB/search.php | 63 | ||||
-rw-r--r-- | phpBB/templates/subSilver/search_username.html | 46 |
3 files changed, 62 insertions, 50 deletions
diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 5a5c277ef6..342226020e 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -760,8 +760,9 @@ $lang['Search_keywords'] = 'Search for Keywords'; $lang['Search_keywords_explain'] = 'You can use <u>AND</u> to define words which must be in the results, <u>OR</u> to define words which may be in the result and <u>NOT</u> 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. Click the username to automatically enter it into the form you are viewing (several usernames may be accepted depending on the form itself).'; +$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). Alternatively you can mark the users required and click the Insert Marked button.'; $lang['Last_active'] = 'Last active'; +$lang['Select_marked'] = 'Select Marked'; $lang['Search_for_any'] = 'Search for any terms or use query as entered'; $lang['Search_for_all'] = 'Search for all terms'; diff --git a/phpBB/search.php b/phpBB/search.php index 04c9487da8..9f4fd4e457 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1307,13 +1307,8 @@ function username_search() $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'] : ( ( !empty($HTTP_GET_VARS['sort_order']) ) ? $HTTP_GET_VARS['sort_order'] : 'd' ); - $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' ); + $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'] : ( ( !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'] : '' ); @@ -1321,6 +1316,10 @@ function username_search() $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_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' ); $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'] : '' ); @@ -1369,28 +1368,21 @@ function username_search() // // // + $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit'); + $where_sql = ''; - if ( isset($HTTP_POST_VARS['submit']) ) - { - $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); - $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_session_time'); - - $where_sql .= ( $username ) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : ''; - $where_sql .= ( $email ) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : ''; - $where_sql .= ( $icq ) ? " AND user_icq LIKE '" . str_replace('*', '%', $icq) ."' " : ''; - $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, 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], intval($active[2]), intval($active[0])) : ''; - - $order_by = $sort_by_types[$sort_by] . " " . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' ); - } - else - { - $order_by = "user_lastvisit DESC "; - } + $where_sql .= ( $username ) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : ''; + $where_sql .= ( $email ) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : ''; + $where_sql .= ( $icq ) ? " AND user_icq LIKE '" . str_replace('*', '%', $icq) ."' " : ''; + $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, 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], intval($active[2]), intval($active[0])) : ''; + + $order_by = $sort_by_types[$sort_by] . ' ' . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' ); $sql = "SELECT COUNT(user_id) AS total_users FROM " . USERS_TABLE . " @@ -1426,9 +1418,9 @@ function username_search() 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )), - 'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_SEARCH_USERNAME' => $lang['Find_username'], 'L_SEARCH_EXPLAIN' => $lang['Find_username_explain'], + 'L_RESET' => $lang['Reset'], 'L_EMAIL' => $lang['Email'], 'L_ICQ_NUMBER' => $lang['ICQ'], 'L_MESSENGER' => $lang['MSNM'], @@ -1439,12 +1431,11 @@ function username_search() 'L_POSTS' => $lang['Posts'], 'L_SORT_BY' => $lang['Sort_by'], 'L_SORT_ASCENDING' => $lang['Sort_Ascending'], - 'L_SORT_DESCENDING' => $lang['Sort_Descending'], - - 'L_UPDATE_USERNAME' => $lang['Select_username'], - 'L_SELECT' => $lang['Select'], - 'L_SEARCH' => $lang['Search'], - 'L_CLOSE_WINDOW' => $lang['Close_window'], + 'L_SORT_DESCENDING' => $lang['Sort_Descending'], + 'L_SELECT_MARKED' => $lang['Select_marked'], + 'L_MARK' => $lang['Mark'], + 'L_MARK_ALL' => $lang['Mark_all'], + 'L_UNMARK_ALL' => $lang['Unmark_all'], 'S_FIELD_NAME' => $field, 'S_COUNT_OPTIONS' => $s_find_count, @@ -1472,7 +1463,6 @@ function username_search() $username = $row['username']; $user_id = $row['user_id']; - $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']); $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; $active = ( !$row['user_lastvisit'] ) ? $lang['Never'] : create_date($lang['DATE_FORMAT'], $row['user_lastvisit'], $board_config['board_timezone']); @@ -1488,8 +1478,7 @@ function username_search() 'POSTS' => $posts, 'ACTIVE' => $active, 'PROFILE_IMG' => $profile_img, - 'PROFILE' => $profile, - 'S_ROW_COUNT' => $i) + 'PROFILE' => $profile) ); $i++; diff --git a/phpBB/templates/subSilver/search_username.html b/phpBB/templates/subSilver/search_username.html index a564b3de3a..bfcf8397f5 100644 --- a/phpBB/templates/subSilver/search_username.html +++ b/phpBB/templates/subSilver/search_username.html @@ -1,17 +1,37 @@ <!-- INCLUDE simple_header.html --> +<!-- You should retain this javascript in your own template! --> <script language="javascript" type="text/javascript"> <!-- -function refresh_username(selected_username) +function insert_user(user) { - opener.document.forms[0].{S_FIELD_NAME}.value = ( opener.document.forms[0].{S_FIELD_NAME}.value.length && opener.document.forms[0].{S_FIELD_NAME}.type == "textarea" ) ? opener.document.forms[0].{S_FIELD_NAME}.value + "\n" + selected_username : selected_username; + opener.document.forms[0].{S_FIELD_NAME}.value = ( opener.document.forms[0].{S_FIELD_NAME}.value.length && opener.document.forms[0].{S_FIELD_NAME}.type == "textarea" ) ? opener.document.forms[0].{S_FIELD_NAME}.value + "\n" + user : user; +} + +function insert_marked(users) +{ + for(i = 0; i < users.length; i++) + { + if ( users[i].checked ) + { + insert_user(users[i].value); + } + } +} + +function marklist(status) +{ + for (i = 0; i < document.results.length; i++) + { + document.results.elements[i].checked = status; + } } //--> </script> -<form method="post" name="search" action="{S_SEARCH_ACTION}"><table width="100%" cellspacing="0" cellpadding="5" border="0"> +<table width="100%" cellspacing="0" cellpadding="5" border="0"> <tr> - <td><table width="100%" class="forumline" cellspacing="1" cellpadding="4" border="0"> + <td><form method="post" name="search" action="{S_SEARCH_ACTION}"><table width="100%" class="forumline" cellspacing="1" cellpadding="4" border="0"> <tr> <th class="thHead" colspan="2" height="25">{L_SEARCH_USERNAME}</th> </tr> @@ -59,18 +79,19 @@ function refresh_username(selected_username) <td class="row2" valign="middle" nowrap="nowrap"><span class="genmed"><select class="post" name="sort_by">{S_SORT_OPTIONS}</select> <select class="post" name="sort_order">{S_SORT_ORDER}</select></span> </td> </tr> <tr> - <td class="catBottom" colspan="2" align="center"><input type="submit" name="submit" value="{L_SEARCH}" class="liteoption" /></td> + <td class="catBottom" colspan="2" align="center"><input class="liteoption" type="submit" name="submit" value="{L_SEARCH}" /> <input class="liteoption" type="reset" value="{L_RESET}" /></td> </tr> - </table></td> + </table></form></td> </tr> <tr> - <td><table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline"> + <td><form method="get" name="results" onsubmit="insert_marked(this.user);return false"><table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline"> <tr> <th width="2%" height="25" class="thCornerL" nowrap="nowrap">#</th> <th class="thTop" nowrap="nowrap">{L_USERNAME}</th> <th class="thTop" nowrap="nowrap">{L_POSTS}</th> <th class="thTop" nowrap="nowrap">{L_JOINED}</th> <th class="thTop" nowrap="nowrap">{L_ACTIVE}</th> + <th width="2%" class="thCornerR" nowrap="nowrap">{L_MARK}</th> </tr> <!-- BEGIN memberrow --> <!-- IF memberrow.S_ROW_COUNT is even --> @@ -79,10 +100,11 @@ function refresh_username(selected_username) <tr class="row1"> <!-- ENDIF --> <td align="center"><span class="gen"> {memberrow.ROW_NUMBER} </span></td> - <td align="center"><span class="gen"><a class="gen" href="javascript:refresh_username('{memberrow.USERNAME}');return false;" onclick="refresh_username('{memberrow.USERNAME}');return false;">{memberrow.USERNAME}</a></span></td> + <td align="center"><span class="gen"><a class="gen" href="javascript:insert_user('{memberrow.USERNAME}');return false;" onclick="insert_user('{memberrow.USERNAME}');return false;">{memberrow.USERNAME}</a></span></td> <td align="center" valign="middle"><span class="gen">{memberrow.POSTS}</span></td> <td align="center" valign="middle"><span class="gensmall">{memberrow.JOINED}</span></td> <td align="center" valign="middle"><span class="gensmall">{memberrow.ACTIVE}</span></td> + <td align="center" valign="middle"><span class="gensmall"><input type="checkbox" name="user" value="{memberrow.USERNAME}" /></span></td> </tr> <!-- BEGINELSE --> <tr> @@ -90,17 +112,17 @@ function refresh_username(selected_username) </tr> <!-- END memberrow --> <tr> - <td class="catbottom" colspan="8" height="28"> </td> + <td class="catbottom" colspan="6" height="28" align="right"><input class="liteoption" type="submit" value="{L_SELECT_MARKED}" /> </td> </tr> </table> <table width="100%" cellspacing="2" cellpadding="0" border="0"> <tr> <td valign="top"><span class="nav">{PAGE_NUMBER}</span></td> - <td align="right"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td> + <td align="right"><span class="gensmall"><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall">{L_MARK_ALL}</a> :: <a href="javascript:marklist(false);" class="gensmall">{L_UNMARK_ALL}</a></span></b><br /><br />{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td> </tr> - </table></td> + </table></form></td> </tr> -</table></form> +</table> <!-- INCLUDE simple_footer.html -->
\ No newline at end of file |