aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/memberlist.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-10-04 13:09:10 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-10-04 13:09:10 +0000
commit30aeac65dccceab18e19318e5981118f150c0647 (patch)
tree409e1a742796ff1c988593c43f19a9533c258742 /phpBB/memberlist.php
parentb5bbc005a51658c7496abdcad9b23e978fb7db68 (diff)
downloadforums-30aeac65dccceab18e19318e5981118f150c0647.tar
forums-30aeac65dccceab18e19318e5981118f150c0647.tar.gz
forums-30aeac65dccceab18e19318e5981118f150c0647.tar.bz2
forums-30aeac65dccceab18e19318e5981118f150c0647.tar.xz
forums-30aeac65dccceab18e19318e5981118f150c0647.zip
Well, here are all my changes ... don't blame me if things break :D
git-svn-id: file:///svn/phpbb/trunk@2923 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/memberlist.php')
-rw-r--r--phpBB/memberlist.php201
1 files changed, 199 insertions, 2 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index b4833be052..4c0d7dd2a1 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
//
$userdata = $session->start();
-$acl = new acl($userdata);
+$auth->acl($userdata);
$session->configure($userdata);
//
@@ -201,7 +201,7 @@ if ( $row = $db->sql_fetchrow($result) )
}
}
- if ( $row['user_viewemail'] || $acl->get_acl_admin() )
+ if ( $row['user_viewemail'] || $auth->get_acl_admin() )
{
$email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $user_id : 'mailto:' . $row['user_email'];
@@ -299,4 +299,201 @@ make_jumpbox('viewforum.'.$phpEx);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+// Username search
+function username_search()
+{
+ global $SID, $HTTP_GET_VARS, $HTTP_POST_VARS, $phpEx, $phpbb_root_path;
+ global $db, $board_config, $template, $auth, $lang, $theme;
+ global $starttime;
+
+ $form = ( !empty($HTTP_GET_VARS['form']) ) ? $HTTP_GET_VARS['form'] : 0;
+ $field = ( isset($HTTP_GET_VARS['field']) ) ? $HTTP_GET_VARS['field'] : 'username';
+ $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
+
+ $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' );
+ $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'] : '' );
+ $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_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'] : '' );
+
+ //
+ //
+ //
+ $sort_by_types_text = array($lang['Sort_Username'], $lang['Sort_Email'], $lang['Sort_Post_count'], $lang['Sort_Joined'], $lang['Sort_Last_active']);
+ $s_sort_by = '';
+ for($i = 0; $i < count($sort_by_types_text); $i++)
+ {
+ $selected = ( $sort_by == $i ) ? ' selected="selected"' : '';
+ $s_sort_by .= '<option value="' . $i . '"' . $selected . '>' . $sort_by_types_text[$i] . '</option>';
+ }
+
+ $sort_order_text = array('a' => $lang['Ascending'], 'd' => $lang['Descending']);
+ $s_sort_order = '';
+ foreach ( $sort_order_text as $key => $value )
+ {
+ $selected = ( $sort_order == $key ) ? ' selected="selected"' : '';
+ $s_sort_order .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
+ }
+
+ $find_count = array('lt' => $lang['Less_than'], 'eq' => $lang['Equal_to'], 'gt' => $lang['More_than']);
+ $s_find_count = '';
+ foreach ( $find_count as $key => $value )
+ {
+ $selected = ( $count_select == $key ) ? ' selected="selected"' : '';
+ $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
+ }
+
+ $find_time = array('lt' => $lang['Before'], 'gt' => $lang['After']);
+ $s_find_join_time = '';
+ foreach ( $find_time as $key => $value )
+ {
+ $selected = ( $joined_select == $key ) ? ' selected="selected"' : '';
+ $s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
+ }
+ $s_find_active_time = '';
+ foreach ( $find_time as $key => $value )
+ {
+ $selected = ( $active_select == $key ) ? ' selected="selected"' : '';
+ $s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
+ }
+
+ //
+ //
+ //
+ $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
+ $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit');
+
+ $where_sql = '';
+ $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 . "
+ WHERE user_id <> " . ANONYMOUS . "
+ $where_sql";
+ $result = $db->sql_query($sql);
+
+ $total_users = ( $row = $db->sql_fetchrow($result) ) ? $row['total_users'] : 0;
+
+ $pagination = generate_pagination("search.$phpEx$SID&amp;mode=searchuser&amp;form=$form&amp;field=$field&amp;username=" . urlencode($username) . "&amp;email=" . urlencode($email) . "&amp;icq=$icq&amp;aim=" . urlencode($aim) . "&amp;yahoo=" . urlencode($yahoo) . "&amp;msn=" . urlencode($msn) . "&amp;joined=" . urlencode(implode('-', $joined)) . "&amp;active=" . urlencode(implode('-', $active)) . "&amp;count=$count&amp;sort_order=$sort_order&amp;sort_by=$sort_by&amp;joined_select=$joined_select&amp;active_select=$active_select&amp;count_select=$count_select", $total_users, $board_config['topics_per_page'], $start);
+
+ //
+ //
+ //
+ $page_title = $lang['Search'];
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+ $template->set_filenames(array(
+ 'search_user_body' => 'search_username.html')
+ );
+
+ $template->assign_vars(array(
+ 'USERNAME' => $username,
+ 'EMAIL' => $email,
+ 'ICQ' => $icq,
+ 'AIM' => $aim,
+ 'YAHOO' => $yahoo,
+ 'MSNM' => $msn,
+ 'JOINED' => implode('-', $joined),
+ 'ACTIVE' => implode('-', $active),
+ 'COUNT' => $count,
+
+ '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_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'],
+ 'L_YAHOO' => $lang['YIM'],
+ 'L_AIM' => $lang['AIM'],
+ 'L_JOINED' => $lang['Joined'],
+ 'L_ACTIVE' => $lang['Last_active'],
+ 'L_POSTS' => $lang['Posts'],
+ 'L_SORT_BY' => $lang['Sort_by'],
+ 'L_SORT_ASCENDING' => $lang['Sort_Ascending'],
+ '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_FORM_NAME' => $form,
+ '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&amp;mode=searchuser&amp;field=$field")
+ );
+
+ $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_email, user_lastvisit
+ FROM " . USERS_TABLE . "
+ WHERE user_id <> " . ANONYMOUS . "
+ $where_sql
+ ORDER BY $order_by
+ LIMIT $start, " . $board_config['topics_per_page'];
+ $result = $db->sql_query($sql);
+
+ if ( $row = $db->sql_fetchrow($result) )
+ {
+ $i = 0;
+ do
+ {
+ $username = $row['username'];
+ $user_id = $row['user_id'];
+
+ $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']);
+
+ $temp_url = "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id";
+ $profile_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_profile'], $lang['Read_profile']) . '</a>';
+ $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
+
+ $template->assign_block_vars('memberrow', array(
+ 'ROW_NUMBER' => $i + ( $start + 1 ),
+ 'USERNAME' => $username,
+ 'JOINED' => $joined,
+ 'POSTS' => $posts,
+ 'ACTIVE' => $active,
+ 'PROFILE_IMG' => $profile_img,
+ 'PROFILE' => $profile)
+ );
+
+ $i++;
+ }
+ while ( $row = $db->sql_fetchrow($result) );
+ }
+
+ $template->display('search_user_body');
+
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+ exit;
+}
+
?> \ No newline at end of file