aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/memberlist.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2004-09-01 15:47:46 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2004-09-01 15:47:46 +0000
commit070cbefa461d53031b6fa8a168c3e9c9db539fb0 (patch)
tree9fcb30f2d3360c5805935226aad8234ab254beb5 /phpBB/memberlist.php
parent3c8e36b458742116a41f90421e20251df97c528c (diff)
downloadforums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar
forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar.gz
forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar.bz2
forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar.xz
forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.zip
This is a mass commit ... expect trouble! Changes made here are primarily to how login is handled, schema changes necessary!
git-svn-id: file:///svn/phpbb/trunk@4970 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/memberlist.php')
-rw-r--r--phpBB/memberlist.php357
1 files changed, 220 insertions, 137 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 17efc5757e..67ba4fed46 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -3,20 +3,17 @@
//
// $Id$
//
-// FILENAME : memberlist.php
+// FILENAME : memberlist.php
// STARTED : Sat Feb 13, 2001
// COPYRIGHT : © 2001, 2003 phpBB Group
// WWW : http://www.phpbb.com/
-// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
-//
+// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
+//
// -------------------------------------------------------------
// TODO
// Add permission check for IM clients
-// Combine Jabber and email contact capabilities?
-// When registering a new jabber user the message doesn't get sent first time
-define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
@@ -24,12 +21,13 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
$user->start();
$auth->acl($user->data);
-$user->setup('memberlist');
+$user->setup(array('memberlist', 'groups'));
// Grab data
$mode = request_var('mode', '');
$action = request_var('action', '');
$user_id = request_var('u', ANONYMOUS);
+$group_id = request_var('g', 0);
$topic_id = request_var('t', 0);
switch ($mode)
@@ -46,7 +44,7 @@ switch ($mode)
trigger_error($user->lang['NO_VIEW_USERS']);
}
- login_box($user->cur_page, '', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]);
+ login_box('', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]);
}
break;
}
@@ -68,6 +66,7 @@ obtain_ranks($ranks);
switch ($mode)
{
case 'leaders':
+ // TODO
// Display a listing of board admins, moderators?
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
@@ -80,8 +79,8 @@ switch ($mode)
}
}
- $sql = 'SELECT user_id, username
- FROM ' . USERS_TABLE . '
+ $sql = 'SELECT user_id, username
+ FROM ' . USERS_TABLE . '
WHERE user_id IN (' . implode(', ', $user_id_ary) . ')';
$result = $db->sql_query($sql);
@@ -113,7 +112,7 @@ switch ($mode)
$s_select = 'S_SEND_AIM';
$s_action = '';
break;
-
+
case 'msnm':
$lang = 'MSNM';
$sql_field = 'user_msnm';
@@ -134,8 +133,8 @@ switch ($mode)
}
// Grab relevant data
- $sql = "SELECT user_id, username, user_email, user_lang, $sql_field
- FROM " . USERS_TABLE . "
+ $sql = "SELECT user_id, username, user_email, user_lang, $sql_field
+ FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
$result = $db->sql_query($sql);
@@ -186,18 +185,18 @@ switch ($mode)
// Send vars to the template
$template->assign_vars(array(
- 'IM_CONTACT' => $row[$sql_field],
- 'USERNAME' => addslashes($row['username']),
- 'EMAIL' => $row['user_email'],
- 'CONTACT_NAME' => $row[$sql_field],
+ 'IM_CONTACT' => $row[$sql_field],
+ 'USERNAME' => addslashes($row['username']),
+ 'EMAIL' => $row['user_email'],
+ 'CONTACT_NAME' => $row[$sql_field],
'SITENAME' => addslashes($config['sitename']),
- 'PRESENCE_IMG' => $presence_img,
+ 'PRESENCE_IMG' => $presence_img,
- 'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang],
- 'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']),
+ 'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang],
+ 'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']),
- $s_select => true,
+ $s_select => true,
'S_IM_ACTION' => $s_action)
);
@@ -207,17 +206,17 @@ switch ($mode)
// Display a profile
$page_title = sprintf($user->lang['VIEWING_PROFILE'], $row['username']);
$template_html = 'memberlist_view.html';
-
+
if ($user_id == ANONYMOUS)
{
trigger_error($user->lang['NO_USER']);
}
// Do the SQL thang
- $sql = 'SELECT g.group_id, g.group_name, g.group_type
- FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
- WHERE ug.user_id = $user_id
- AND g.group_id = ug.group_id" . (($auth->acl_get('a_groups'))? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . '
+ $sql = 'SELECT g.group_id, g.group_name, g.group_type
+ FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
+ WHERE ug.user_id = $user_id
+ AND g.group_id = ug.group_id" . (($auth->acl_get('a_groups'))? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . '
ORDER BY group_type, group_name';
$result = $db->sql_query($sql);
@@ -228,8 +227,8 @@ switch ($mode)
}
// We left join on the session table to see if the user is currently online
- $sql = 'SELECT username, user_id, user_colour, user_permissions, user_sig, user_sig_bbcode_uid, user_sig_bbcode_bitfield, user_allow_viewemail, user_posts, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_avatar, user_avatar_width, user_avatar_height, user_avatar_type, user_lastvisit
- FROM ' . USERS_TABLE . "
+ $sql = 'SELECT username, user_id, user_colour, user_permissions, user_sig, user_sig_bbcode_uid, user_sig_bbcode_bitfield, user_allow_viewemail, user_posts, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_avatar, user_avatar_width, user_avatar_height, user_avatar_type, user_lastvisit
+ FROM ' . USERS_TABLE . "
WHERE user_id = $user_id";
$result = $db->sql_query($sql);
@@ -239,7 +238,7 @@ switch ($mode)
}
$db->sql_freeresult($result);
- $sql = 'SELECT MAX(session_time) AS session_time
+ $sql = 'SELECT MAX(session_time) AS session_time
FROM ' . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
$result = $db->sql_query($sql);
@@ -254,7 +253,7 @@ switch ($mode)
$auth2 = new auth();
$auth2->acl($member);
$f_postcount_ary = $auth2->acl_getf('f_postcount');
-
+
$sql_forums = array();
foreach ($f_postcount_ary as $forum_id => $allow)
{
@@ -268,10 +267,10 @@ switch ($mode)
unset($sql_forums, $f_postcount_ary, $auth2);
// Grab all the relevant data
- $sql = 'SELECT COUNT(p.post_id) AS num_posts
+ $sql = 'SELECT COUNT(p.post_id) AS num_posts
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
- WHERE p.poster_id = $user_id
- AND f.forum_id = p.forum_id
+ WHERE p.poster_id = $user_id
+ AND f.forum_id = p.forum_id
$post_count_sql";
$result = $db->sql_query($sql);
@@ -292,28 +291,28 @@ switch ($mode)
$post_count_sql = (sizeof($sql_forums)) ? 'AND f.forum_id IN (' . implode(', ', $sql_forums) . ')' : '';
unset($sql_forums, $f_forum_ary);
-
+
if ($post_count_sql)
{
- $sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
- WHERE p.poster_id = $user_id
- AND f.forum_id = p.forum_id
+ $sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
+ FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
+ WHERE p.poster_id = $user_id
+ AND f.forum_id = p.forum_id
$post_count_sql
- GROUP BY f.forum_id, f.forum_name
- ORDER BY num_posts DESC";
+ GROUP BY f.forum_id, f.forum_name
+ ORDER BY num_posts DESC";
$result = $db->sql_query_limit($sql, 1);
$active_f_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
- WHERE p.poster_id = $user_id
- AND t.topic_id = p.topic_id
- AND f.forum_id = t.forum_id
+ $sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
+ WHERE p.poster_id = $user_id
+ AND t.topic_id = p.topic_id
+ AND f.forum_id = t.forum_id
$post_count_sql
- GROUP BY t.topic_id, t.topic_title
+ GROUP BY t.topic_id, t.topic_title
ORDER BY num_posts DESC";
$result = $db->sql_query_limit($sql, 1);
@@ -325,7 +324,7 @@ switch ($mode)
$active_f_row = $active_t_row = array();
}
- // Do the relevant calculations
+ // Do the relevant calculations
$memberdays = max(1, round((time() - $member['user_regdate']) / 86400));
$posts_per_day = $member['user_posts'] / $memberdays;
$percentage = ($config['num_posts']) ? min(100, ($num_real_posts / $config['num_posts']) * 100) : 0;
@@ -384,16 +383,16 @@ switch ($mode)
$template->assign_vars(array(
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
- 'ACTIVE_FORUM' => $active_f_name,
- 'ACTIVE_FORUM_POSTS'=> ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count),
- 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct),
+ 'ACTIVE_FORUM' => $active_f_name,
+ 'ACTIVE_FORUM_POSTS'=> ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count),
+ 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct),
'ACTIVE_TOPIC' => $active_t_name,
- 'ACTIVE_TOPIC_POSTS'=> ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count),
- 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct),
+ 'ACTIVE_TOPIC_POSTS'=> ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count),
+ 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct),
'OCCUPATION' => (!empty($member['user_occ'])) ? $member['user_occ'] : '',
'INTERESTS' => (!empty($member['user_interests'])) ? $member['user_interests'] : '',
- 'SIGNATURE' => (!empty($member['user_sig'])) ? str_replace("\n", '<br />', $member['user_sig']) : '',
+ 'SIGNATURE' => (!empty($member['user_sig'])) ? str_replace("\n", '<br />', $member['user_sig']) : '',
'AVATAR_IMG' => $poster_avatar,
'PM_IMG' => $user->img('btn_pm', $user->lang['MESSAGE']),
@@ -403,13 +402,13 @@ switch ($mode)
'AIM_IMG' => $user->img('btn_aim', $user->lang['AIM']),
'MSN_IMG' => $user->img('btn_msnm', $user->lang['MSNM']),
'YIM_IMG' => $user->img('btn_yim', $user->lang['YIM']),
- 'JABBER_IMG' => $user->img('btn_jabber', $user->lang['JABBER']),
- 'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
+ 'JABBER_IMG' => $user->img('btn_jabber', $user->lang['JABBER']),
+ 'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
- 'S_PROFILE_ACTION' => "groupcp.$phpEx$SID",
- 'S_GROUP_OPTIONS' => $group_options,
+ 'S_PROFILE_ACTION' => "memberlist.$phpEx$SID&amp;mode=group",
+ 'S_GROUP_OPTIONS' => $group_options,
- 'U_ADD_FRIEND' => "ucp.$phpEx$SID&amp;i=zebra&amp;add=" . urlencode($member['username']),
+ 'U_ADD_FRIEND' => "ucp.$phpEx$SID&amp;i=zebra&amp;add=" . urlencode($member['username']),
'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&amp;f=$active_f_id",
'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&amp;t=$active_t_id",)
);
@@ -453,7 +452,7 @@ switch ($mode)
if (!$topic_id)
{
// Get the appropriate username, etc.
- $sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type
+ $sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . "
WHERE user_id = $user_id
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
@@ -473,7 +472,7 @@ switch ($mode)
}
else
{
- $sql = 'SELECT forum_id, topic_title
+ $sql = 'SELECT forum_id, topic_title
FROM ' . TOPICS_TABLE . "
WHERE topic_id = $topic_id";
$result = $db->sql_query($sql);
@@ -501,24 +500,24 @@ switch ($mode)
{
if (!$topic_id)
{
- if (!$subject)
+ if (!$subject)
{
$error[] = $user->lang['EMPTY_SUBJECT_EMAIL'];
}
- if (!$message)
+ if (!$message)
{
$error[] = $user->lang['EMPTY_MESSAGE_EMAIL'];
}
}
else
{
- if (!$email || !preg_match('#^.*?@(.*?\.)?[a-z0-9\-]+\.[a-z]{2,4}$#i', $email))
+ if (!$email || !preg_match('#^.*?@(.*?\.)?[a-z0-9\-]+\.[a-z]{2,4}$#i', $email))
{
$error[] = $user->lang['EMPTY_ADDRESS_EMAIL'];
}
- if (!$name)
+ if (!$name)
{
$error[] = $user->lang['EMPTY_NAME_EMAIL'];
}
@@ -565,9 +564,9 @@ switch ($mode)
'BOARD_EMAIL' => $config['board_contact'],
'FROM_USERNAME' => $user->data['username'],
'TO_USERNAME' => ($topic_id) ? $name : $row['username'],
- 'MESSAGE' => $message,
- 'TOPIC_NAME' => ($topic_id) ? strtr($row['topic_title'], array_flip(get_html_translation_table(HTML_ENTITIES))) : '',
-
+ 'MESSAGE' => $message,
+ 'TOPIC_NAME' => ($topic_id) ? strtr($row['topic_title'], array_flip(get_html_translation_table(HTML_ENTITIES))) : '',
+
'U_TOPIC' => ($topic_id) ? generate_board_url() . "/viewtopic.$phpEx?f=" . $row['forum_id'] . "&t=$topic_id" : '')
);
@@ -575,7 +574,7 @@ switch ($mode)
$messenger->queue->save();
meta_refresh(3, "index.$phpEx$SID");
- $message = (!$topic_id) ? sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a>') : sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=" . $row['topic_id'] . '">', '</a>');
+ $message = (!$topic_id) ? sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a>') : sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=" . $row['topic_id'] . '">', '</a>');
trigger_error($user->lang['EMAIL_SENT'] . '<br /><br />' . $message);
}
}
@@ -583,26 +582,27 @@ switch ($mode)
if ($topic_id)
{
$template->assign_vars(array(
- 'EMAIL' => htmlspecialchars($email),
- 'NAME' => htmlspecialchars($name),
- 'TOPIC_TITLE' => $row['topic_title'],
+ 'EMAIL' => htmlspecialchars($email),
+ 'NAME' => htmlspecialchars($name),
+ 'TOPIC_TITLE' => $row['topic_title'],
- 'U_TOPIC' => "viewtopic.$phpEx$SID&amp;f=" . $row['forum_id'] . "&amp;t=topic_id",
+ 'U_TOPIC' => "viewtopic.$phpEx$SID&amp;f=" . $row['forum_id'] . "&amp;t=topic_id",
'S_LANG_OPTIONS'=> ($topic_id) ? language_select($email_lang) : '')
);
}
$template->assign_vars(array(
- 'USERNAME' => (!$topic_id) ? addslashes($row['username']) : '',
- 'ERROR_MESSAGE' => (sizeof($error)) ? implode('<br />', $error) : '',
+ 'USERNAME' => (!$topic_id) ? addslashes($row['username']) : '',
+ 'ERROR_MESSAGE' => (sizeof($error)) ? implode('<br />', $error) : '',
- 'L_EMAIL_BODY_EXPLAIN' => (!$topic_id) ? $user->lang['EMAIL_BODY_EXPLAIN'] : $user->lang['EMAIL_TOPIC_EXPLAIN'],
+ 'L_EMAIL_BODY_EXPLAIN' => (!$topic_id) ? $user->lang['EMAIL_BODY_EXPLAIN'] : $user->lang['EMAIL_TOPIC_EXPLAIN'],
'S_POST_ACTION' => (!$topic_id) ? "memberlist.$phpEx$SID&amp;mode=email&amp;u=$user_id" : "memberlist.$phpEx$SID&amp;mode=email&amp;f=$forum_id&amp;t=$topic_id",
'S_SEND_USER' => (!$topic_id) ? true : false)
);
break;
+ case 'group':
default:
// The basic memberlist
$page_title = $user->lang['MEMBERLIST'];
@@ -610,7 +610,7 @@ switch ($mode)
// Sorting
$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'e' => $user->lang['SORT_EMAIL'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['SORT_LAST_ACTIVE'], 'l' => $user->lang['SORT_RANK']);
- $sort_key_sql = array('a' => 'username', 'b' => 'user_from', 'c' => 'user_regdate', 'd' => 'user_posts', 'e' => 'user_email', 'f' => 'user_website', 'g' => 'user_icq', 'h' => 'user_aim', 'i' => 'user_msnm', 'j' => 'user_yim', 'k' => 'user_lastvisit', 'l' => 'user_rank DESC, user_posts');
+ $sort_key_sql = array('a' => 'u.username', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'u.user_email', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_lastvisit', 'l' => 'u.user_rank DESC, u.user_posts');
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
@@ -676,22 +676,22 @@ switch ($mode)
$s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
- $where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $db->sql_escape($username)) ."'" : '';
- $where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $db->sql_escape($email)) ."' " : '';
- $where_sql .= ($icq) ? " AND user_icq LIKE '" . str_replace('*', '%', $db->sql_escape($icq)) ."' " : '';
- $where_sql .= ($aim) ? " AND user_aim LIKE '" . str_replace('*', '%', $db->sql_escape($aim)) ."' " : '';
- $where_sql .= ($yahoo) ? " AND user_yim LIKE '" . str_replace('*', '%', $db->sql_escape($yahoo)) ."' " : '';
- $where_sql .= ($msn) ? " AND user_msnm LIKE '" . str_replace('*', '%', $db->sql_escape($msn)) ."' " : '';
- $where_sql .= ($count) ? " AND user_posts " . $find_key_match[$count_select] . " $count " : '';
- $where_sql .= (sizeof($joined) > 1) ? " AND user_regdate " . $find_key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
- $where_sql .= (sizeof($active) > 1) ? " AND user_lastvisit " . $find_key_match[$active_select] . ' ' . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
+ $sql_where .= ($username) ? " AND u.username LIKE '" . str_replace('*', '%', $db->sql_escape($username)) ."'" : '';
+ $sql_where .= ($email) ? " AND u.user_email LIKE '" . str_replace('*', '%', $db->sql_escape($email)) ."' " : '';
+ $sql_where .= ($icq) ? " AND u.user_icq LIKE '" . str_replace('*', '%', $db->sql_escape($icq)) ."' " : '';
+ $sql_where .= ($aim) ? " AND u.user_aim LIKE '" . str_replace('*', '%', $db->sql_escape($aim)) ."' " : '';
+ $sql_where .= ($yahoo) ? " AND u.user_yim LIKE '" . str_replace('*', '%', $db->sql_escape($yahoo)) ."' " : '';
+ $sql_where .= ($msn) ? " AND u.user_msnm LIKE '" . str_replace('*', '%', $db->sql_escape($msn)) ."' " : '';
+ $sql_where .= ($count) ? " AND u.user_posts " . $find_key_match[$count_select] . " $count " : '';
+ $sql_where .= (sizeof($joined) > 1) ? " AND u.user_regdate " . $find_key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
+ $sql_where .= (sizeof($active) > 1) ? " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
if ($ipdomain)
{
$ips = (preg_match('#[a-z]#', $ipdomain)) ? implode(', ', preg_replace('#([0-9]{1,3}\.[0-9]{1,3}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#', "'\\1'", gethostbynamel($ipdomain))) : "'" . str_replace('*', '%', $ipdomain) . "'";
- $sql = 'SELECT DISTINCT poster_id
- FROM ' . POSTS_TABLE . '
+ $sql = 'SELECT DISTINCT poster_id
+ FROM ' . POSTS_TABLE . '
WHERE poster_ip ' . ((preg_match('#%#', $ips)) ? 'LIKE' : 'IN') . " ($ips)";
$result = $db->sql_query($sql);
@@ -704,26 +704,102 @@ switch ($mode)
}
while ($row = $db->sql_fetchrow($result));
- $where_sql .= ' AND user_id IN (' . implode(', ', $ip_sql) . ')';
+ $sql_where .= ' AND u.user_id IN (' . implode(', ', $ip_sql) . ')';
}
else
{
// A minor fudge but it does the job :D
- $where_sql .= " AND user_id IN ('-1')";
+ $sql_where .= " AND u.user_id IN ('-1')";
+ }
+ }
+ }
+
+ // Are we looking at a usergroup? If so, fetch additional info
+ // and further restrict the user info query
+ $sql_from = '';
+ if ($mode == 'group')
+ {
+ $sql = 'SELECT *
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_id = $group_id";
+ $result = $db->sql_query($sql);
+
+ if (!extract($db->sql_fetchrow($result)))
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
+ $db->sql_freeresult($result);
+
+ switch ($group_type)
+ {
+ case GROUP_OPEN:
+ $group_type = 'OPEN';
+ break;
+ case GROUP_CLOSED:
+ $group_type = 'CLOSED';
+ break;
+ case GROUP_HIDDEN:
+ $group_type = 'HIDDEN';
+ break;
+ case GROUP_SPECIAL:
+ $group_type = 'SPECIAL';
+ break;
+ case GROUP_FREE:
+ $group_type = 'FREE';
+ break;
+ }
+
+ $avatar_img = '';
+ if ($group_avatar)
+ {
+ switch ($group_avatar_type)
+ {
+ case AVATAR_UPLOAD:
+ $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
+ break;
+ case AVATAR_GALLERY:
+ $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
+ break;
}
+ $avatar_img .= $group_avatar;
+
+ $avatar_img = '<img src="' . $avatar_img . '" width="' . $group_avatar_width . '" height="' . $group_avatar_height . '" border="0" alt="" />';
}
+
+ $rank_title = $rank_img = '';
+ if (!empty($group_rank))
+ {
+ $rank_title = $ranks['special'][$group_rank]['rank_title'];
+ $rank_img = (!empty($ranks['special'][$group_rank]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$group_rank]['rank_image'] . '" border="0" alt="' . $ranks['special'][$group_rank]['rank_title'] . '" title="' . $ranks['special'][$group_rank]['rank_title'] . '" /><br />' : '';
+ }
+
+ $template->assign_vars(array(
+ 'GROUP_DESC' => $group_description,
+ 'GROUP_NAME' => $group_name,
+ 'GROUP_COLOR' => $group_colour,
+ 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_type],
+ 'GROUP_RANK' => $rank_title,
+
+ 'AVATAR_IMG' => $avatar_img,
+ 'RANK_IMG' => $rank_img,
+
+ 'U_PM' => ($auth->acl_get('u_sendpm')) ? "ucp.$phpEx$SID&amp;i=pm&amp;mode=compose&amp;address_list[g][$group_id]=to" : '',)
+ );
+
+ $sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
+ $sql_where .= " AND u.user_id = ug.user_id AND ug.group_id = $group_id";
}
// Sorting and order
$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
// Count the users ...
- if ($where_sql)
+ if ($sql_where)
{
- $sql = 'SELECT COUNT(user_id) AS total_users
- FROM ' . USERS_TABLE . '
- WHERE user_type <> ' . USER_IGNORE . "
- $where_sql";
+ $sql = 'SELECT COUNT(u.user_id) AS total_users
+ FROM ' . USERS_TABLE . " u$sql_from
+ WHERE u.user_type <> " . USER_IGNORE . "
+ $sql_where";
$result = $db->sql_query($sql);
$total_users = ($row = $db->sql_fetchrow($result)) ? $row['total_users'] : 0;
@@ -733,6 +809,10 @@ switch ($mode)
$total_users = $config['num_users'];
}
+
+
+
+
// Pagination string
$pagination_url = "memberlist.$phpEx$SID&amp;mode=$mode";
@@ -747,6 +827,9 @@ switch ($mode)
$pagination_url .= '&amp;' . $key . '=' . urlencode(htmlspecialchars($var));
}
+
+
+
// Some search user specific data
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
{
@@ -759,8 +842,8 @@ switch ($mode)
'MSNM' => $msn,
'JOINED' => implode('-', $joined),
'ACTIVE' => implode('-', $active),
- 'COUNT' => $count,
- 'IP' => $ipdomain,
+ 'COUNT' => $count,
+ 'IP' => $ipdomain,
'S_SEARCH_USER' => true,
'S_FORM_NAME' => $form,
@@ -774,10 +857,8 @@ switch ($mode)
);
}
- // TODO
- // ?????????
- $sql = 'SELECT session_user_id, MAX(session_time) AS session_time
- FROM ' . SESSIONS_TABLE . '
+ $sql = 'SELECT session_user_id, MAX(session_time) AS session_time
+ FROM ' . SESSIONS_TABLE . '
WHERE session_time >= ' . (time() - 300) . '
AND session_user_id <> ' . ANONYMOUS . '
GROUP BY session_user_id';
@@ -791,10 +872,10 @@ switch ($mode)
$db->sql_freeresult($result);
// Do the SQL thang
- $sql = 'SELECT username, user_id, user_colour, user_allow_viewemail, user_posts, user_regdate, user_rank, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_lastvisit
- FROM ' . USERS_TABLE . '
- WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ")
- $where_sql
+ $sql = 'SELECT u.username, u.user_id, u.user_colour, u.user_allow_viewemail, u.user_posts, u.user_regdate, u.user_rank, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, u.user_avatar, u.user_avatar_type, u.user_lastvisit
+ FROM ' . USERS_TABLE . " u$sql_from
+ WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
+ $sql_where
ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
@@ -807,6 +888,7 @@ switch ($mode)
$template->assign_block_vars('memberrow', array_merge(show_profile($row), array(
'ROW_NUMBER' => $i + ($start + 1),
+
'U_VIEWPROFILE' => "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id']))
);
@@ -818,10 +900,10 @@ switch ($mode)
// Generate page
$template->assign_vars(array(
'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start),
- 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start),
- 'TOTAL_USERS' => ($total_users == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $total_users),
+ 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start),
+ 'TOTAL_USERS' => ($total_users == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $total_users),
- 'PROFILE_IMG' => $user->img('btn_profile', $user->lang['PROFILE']),
+ 'PROFILE_IMG' => $user->img('btn_profile', $user->lang['PROFILE']),
'PM_IMG' => $user->img('btn_pm', $user->lang['MESSAGE']),
'EMAIL_IMG' => $user->img('btn_email', $user->lang['EMAIL']),
'WWW_IMG' => $user->img('btn_www', $user->lang['WWW']),
@@ -829,26 +911,27 @@ switch ($mode)
'AIM_IMG' => $user->img('btn_aim', $user->lang['AIM']),
'MSN_IMG' => $user->img('btn_msnm', $user->lang['MSNM']),
'YIM_IMG' => $user->img('btn_yim', $user->lang['YIM']),
- 'JABBER_IMG' => $user->img('btn_jabber', $user->lang['JABBER']),
- 'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
-
- 'U_FIND_MEMBER' => (!empty($config['load_search']) || $auth->acl_get('a_')) ? "memberlist.$phpEx$SID&amp;mode=searchuser" : '',
- 'U_SORT_USERNAME' => "memberlist.$phpEx$SID&amp;sk=a&amp;sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_FROM' => "memberlist.$phpEx$SID&amp;sk=b&amp;sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_JOINED' => "memberlist.$phpEx$SID&amp;sk=c&amp;sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_POSTS' => "memberlist.$phpEx$SID&amp;sk=d&amp;sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_EMAIL' => "memberlist.$phpEx$SID&amp;sk=e&amp;sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_WEBSITE' => "memberlist.$phpEx$SID&amp;sk=f&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ICQ' => "memberlist.$phpEx$SID&amp;sk=g&amp;sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_AIM' => "memberlist.$phpEx$SID&amp;sk=h&amp;sd=" . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_MSN' => "memberlist.$phpEx$SID&amp;sk=i&amp;sd=" . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_YIM' => "memberlist.$phpEx$SID&amp;sk=j&amp;sd=" . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ACTIVE' => "memberlist.$phpEx$SID&amp;sk=k&amp;sd=" . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_RANK' => "memberlist.$phpEx$SID&amp;sk=l&amp;sd=" . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
-
- 'S_MODE_SELECT' => $s_sort_key,
- 'S_ORDER_SELECT'=> $s_sort_dir,
- 'S_MODE_ACTION' => "memberlist.$phpEx$SID&amp;mode=$mode&amp;form=$form")
+ 'JABBER_IMG' => $user->img('btn_jabber', $user->lang['JABBER']),
+ 'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
+
+ 'U_FIND_MEMBER' => (!empty($config['load_search']) || $auth->acl_get('a_')) ? "memberlist.$phpEx$SID&amp;mode=searchuser" : '',
+ 'U_SORT_USERNAME' => "memberlist.$phpEx$SID&amp;sk=a&amp;sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FROM' => "memberlist.$phpEx$SID&amp;sk=b&amp;sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_JOINED' => "memberlist.$phpEx$SID&amp;sk=c&amp;sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_POSTS' => "memberlist.$phpEx$SID&amp;sk=d&amp;sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_EMAIL' => "memberlist.$phpEx$SID&amp;sk=e&amp;sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_WEBSITE' => "memberlist.$phpEx$SID&amp;sk=f&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ICQ' => "memberlist.$phpEx$SID&amp;sk=g&amp;sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_AIM' => "memberlist.$phpEx$SID&amp;sk=h&amp;sd=" . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_MSN' => "memberlist.$phpEx$SID&amp;sk=i&amp;sd=" . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_YIM' => "memberlist.$phpEx$SID&amp;sk=j&amp;sd=" . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ACTIVE' => "memberlist.$phpEx$SID&amp;sk=k&amp;sd=" . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_RANK' => "memberlist.$phpEx$SID&amp;sk=l&amp;sd=" . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
+
+ 'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
+ 'S_MODE_SELECT' => $s_sort_key,
+ 'S_ORDER_SELECT' => $s_sort_dir,
+ 'S_MODE_ACTION' => $pagination_url . "&amp;form=$form")
);
}
@@ -865,7 +948,7 @@ page_footer();
// ---------
-// FUNCTIONS
+// FUNCTIONS
//
function show_profile($data)
{
@@ -898,23 +981,23 @@ function show_profile($data)
$last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit'];
// Dump it out to the template
- // TODO
+ // TODO
// Add permission check for IM clients
return array(
- 'USERNAME' => $username,
- 'USER_COLOR' => (!empty($data['user_colour'])) ? $data['user_colour'] : '',
- 'RANK_TITLE' => $rank_title,
+ 'USERNAME' => $username,
+ 'USER_COLOR' => (!empty($data['user_colour'])) ? $data['user_colour'] : '',
+ 'RANK_TITLE' => $rank_title,
'JOINED' => $user->format_date($data['user_regdate'], $user->lang['DATE_FORMAT']),
'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit, $user->lang['DATE_FORMAT']),
'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0,
- 'ONLINE_IMG' => (intval($data['session_time']) >= time() - ($config['load_online_time'] * 60)) ? $user->img('btn_online', $user->lang['USER_ONLINE']) : $user->img('btn_offline', $user->lang['USER_ONLINE']),
+ 'ONLINE_IMG' => (intval($data['session_time']) >= time() - ($config['load_online_time'] * 60)) ? $user->img('btn_online', $user->lang['USER_ONLINE']) : $user->img('btn_offline', $user->lang['USER_ONLINE']),
'RANK_IMG' => $rank_img,
'ICQ_STATUS_IMG'=> (!empty($data['user_icq'])) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" border="0" />' : '',
- 'U_PROFILE' => "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id",
- 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "search.$phpEx$SID&amp;search_author=" . urlencode($username) . "&amp;show_results=posts" : '',
- 'U_PM' => ($auth->acl_get('u_sendpm')) ? "ucp.$phpEx$SID&amp;i=pm&amp;mode=compose&amp;u=$user_id" : '',
+ 'U_PROFILE' => "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id",
+ 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? "search.$phpEx$SID&amp;search_author=" . urlencode($username) . "&amp;show_results=posts" : '',
+ 'U_PM' => ($auth->acl_get('u_sendpm')) ? "ucp.$phpEx$SID&amp;mode=pm&amp;action=send&amp;u=$user_id" : '',
'U_EMAIL' => $email,
'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '',
'U_ICQ' => ($data['user_icq']) ? "memberlist.$phpEx$SID&amp;mode=contact&amp;action=icq&amp;u=$user_id" : '',
@@ -927,7 +1010,7 @@ function show_profile($data)
);
}
//
-// FUNCTIONS
+// FUNCTIONS
// ---------
?> \ No newline at end of file