|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
*
|
|
|
ef5584 |
* @package phpBB3
|
|
|
ef5584 |
* @version $Id: memberlist.php 9156 2008-12-02 18:48:25Z toonarmy $
|
|
|
ef5584 |
* @copyright (c) 2005 phpBB Group
|
|
|
ef5584 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
ef5584 |
*
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @ignore
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
define('IN_PHPBB', true);
|
|
|
ef5584 |
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
|
|
ef5584 |
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
|
ef5584 |
include($phpbb_root_path . 'common.' . $phpEx);
|
|
|
ef5584 |
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Start session management
|
|
|
ef5584 |
$user->session_begin();
|
|
|
ef5584 |
$auth->acl($user->data);
|
|
|
ef5584 |
$user->setup(array('memberlist', 'groups'));
|
|
|
ef5584 |
|
|
|
ef5584 |
// Grab data
|
|
|
ef5584 |
$mode = request_var('mode', '');
|
|
|
ef5584 |
$action = request_var('action', '');
|
|
|
ef5584 |
$user_id = request_var('u', ANONYMOUS);
|
|
|
ef5584 |
$username = request_var('un', '', true);
|
|
|
ef5584 |
$group_id = request_var('g', 0);
|
|
|
ef5584 |
$topic_id = request_var('t', 0);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Check our mode...
|
|
|
ef5584 |
if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'searchuser', 'leaders')))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_MODE');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
switch ($mode)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
case 'email':
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
default:
|
|
|
ef5584 |
// Can this user view profiles/memberlist?
|
|
|
ef5584 |
if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if ($user->data['user_id'] != ANONYMOUS)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_VIEW_USERS');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST']));
|
|
|
ef5584 |
}
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$start = request_var('start', 0);
|
|
|
ef5584 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
|
ef5584 |
|
|
|
ef5584 |
$default_key = 'c';
|
|
|
ef5584 |
$sort_key = request_var('sk', $default_key);
|
|
|
ef5584 |
$sort_dir = request_var('sd', 'a');
|
|
|
ef5584 |
|
|
|
ef5584 |
|
|
|
ef5584 |
// Grab rank information for later
|
|
|
ef5584 |
$ranks = $cache->obtain_ranks();
|
|
|
ef5584 |
|
|
|
ef5584 |
|
|
|
ef5584 |
// What do you want to do today? ... oops, I think that line is taken ...
|
|
|
ef5584 |
switch ($mode)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
case 'leaders':
|
|
|
ef5584 |
// Display a listing of board admins, moderators
|
|
|
ef5584 |
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
|
ef5584 |
|
|
|
ef5584 |
$page_title = $user->lang['THE_TEAM'];
|
|
|
ef5584 |
$template_html = 'memberlist_leaders.html';
|
|
|
ef5584 |
|
|
|
ef5584 |
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
|
|
|
ef5584 |
|
|
|
ef5584 |
$admin_id_ary = $global_mod_id_ary = $mod_id_ary = $forum_id_ary = array();
|
|
|
ef5584 |
foreach ($user_ary as $forum_id => $forum_ary)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
foreach ($forum_ary as $auth_option => $id_ary)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (!$forum_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if ($auth_option == 'a_')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$admin_id_ary = array_merge($admin_id_ary, $id_ary);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$global_mod_id_ary = array_merge($global_mod_id_ary, $id_ary);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
continue;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$mod_id_ary = array_merge($mod_id_ary, $id_ary);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($forum_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
foreach ($id_ary as $id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$forum_id_ary[$id][] = $forum_id;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$admin_id_ary = array_unique($admin_id_ary);
|
|
|
ef5584 |
$global_mod_id_ary = array_unique($global_mod_id_ary);
|
|
|
ef5584 |
|
|
|
ef5584 |
$mod_id_ary = array_merge($mod_id_ary, $global_mod_id_ary);
|
|
|
ef5584 |
$mod_id_ary = array_unique($mod_id_ary);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Admin group id...
|
|
|
ef5584 |
$sql = 'SELECT group_id
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE . "
|
|
|
ef5584 |
WHERE group_name = 'ADMINISTRATORS'";
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$admin_group_id = (int) $db->sql_fetchfield('group_id');
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Get group memberships for the admin id ary...
|
|
|
ef5584 |
$admin_memberships = group_memberships($admin_group_id, $admin_id_ary);
|
|
|
ef5584 |
|
|
|
ef5584 |
$admin_user_ids = array();
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!empty($admin_memberships))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// ok, we only need the user ids...
|
|
|
ef5584 |
foreach ($admin_memberships as $row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$admin_user_ids[$row['user_id']] = true;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
unset($admin_memberships);
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql = 'SELECT forum_id, forum_name
|
|
|
ef5584 |
FROM ' . FORUMS_TABLE;
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
$forums = array();
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$forums[$row['forum_id']] = $row['forum_name'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql = $db->sql_build_query('SELECT', array(
|
|
|
ef5584 |
'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id',
|
|
|
ef5584 |
|
|
|
ef5584 |
'FROM' => array(
|
|
|
ef5584 |
USERS_TABLE => 'u',
|
|
|
ef5584 |
GROUPS_TABLE => 'g'
|
|
|
ef5584 |
),
|
|
|
ef5584 |
|
|
|
ef5584 |
'LEFT_JOIN' => array(
|
|
|
ef5584 |
array(
|
|
|
ef5584 |
'FROM' => array(USER_GROUP_TABLE => 'ug'),
|
|
|
ef5584 |
'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id']
|
|
|
ef5584 |
)
|
|
|
ef5584 |
),
|
|
|
ef5584 |
|
|
|
ef5584 |
'WHERE' => $db->sql_in_set('u.user_id', array_unique(array_merge($admin_id_ary, $mod_id_ary)), false, true) . '
|
|
|
ef5584 |
AND u.group_id = g.group_id',
|
|
|
ef5584 |
|
|
|
ef5584 |
'ORDER_BY' => 'g.group_name ASC, u.username_clean ASC'
|
|
|
ef5584 |
));
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$which_row = (in_array($row['user_id'], $admin_id_ary)) ? 'admin' : 'mod';
|
|
|
ef5584 |
|
|
|
ef5584 |
// We sort out admins not within the 'Administrators' group.
|
|
|
ef5584 |
// Else, we will list those as admin only having the permission to view logs for example.
|
|
|
ef5584 |
if ($which_row == 'admin' && empty($admin_user_ids[$row['user_id']]))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// Remove from admin_id_ary, because the user may be a mod instead
|
|
|
ef5584 |
unset($admin_id_ary[array_search($row['user_id'], $admin_id_ary)]);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!in_array($row['user_id'], $mod_id_ary) && !in_array($row['user_id'], $global_mod_id_ary))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
continue;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$which_row = 'mod';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_forum_select = '';
|
|
|
ef5584 |
$undisclosed_forum = false;
|
|
|
ef5584 |
|
|
|
ef5584 |
if (isset($forum_id_ary[$row['user_id']]) && !in_array($row['user_id'], $global_mod_id_ary))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if ($which_row == 'mod' && sizeof(array_diff(array_keys($forums), $forum_id_ary[$row['user_id']])))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
foreach ($forum_id_ary[$row['user_id']] as $forum_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (isset($forums[$forum_id]))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if ($auth->acl_get('f_list', $forum_id))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$s_forum_select .= '<option value="">' . $forums[$forum_id] . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$undisclosed_forum = true;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// If the mod is only moderating non-viewable forums we skip the user. There is no gain in displaying the person then...
|
|
|
ef5584 |
if (!$s_forum_select && $undisclosed_forum)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// $s_forum_select = '<option value="">' . $user->lang['FORUM_UNDISCLOSED'] . '</option>';
|
|
|
ef5584 |
continue;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// The person is moderating several "public" forums, therefore the person should be listed, but not giving the real group name if hidden.
|
|
|
ef5584 |
if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$group_name = $user->lang['GROUP_UNDISCLOSED'];
|
|
|
ef5584 |
$u_group = '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
|
|
ef5584 |
$u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$rank_title = $rank_img = '';
|
|
|
ef5584 |
get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_block_vars($which_row, array(
|
|
|
ef5584 |
'USER_ID' => $row['user_id'],
|
|
|
ef5584 |
'FORUMS' => $s_forum_select,
|
|
|
ef5584 |
'RANK_TITLE' => $rank_title,
|
|
|
ef5584 |
'GROUP_NAME' => $group_name,
|
|
|
ef5584 |
'GROUP_COLOR' => $row['group_colour'],
|
|
|
ef5584 |
|
|
|
ef5584 |
'RANK_IMG' => $rank_img,
|
|
|
ef5584 |
'RANK_IMG_SRC' => $rank_img_src,
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_GROUP' => $u_group,
|
|
|
ef5584 |
'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
ef5584 |
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
ef5584 |
'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
ef5584 |
'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
ef5584 |
));
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case 'contact':
|
|
|
ef5584 |
|
|
|
ef5584 |
$page_title = $user->lang['IM_USER'];
|
|
|
ef5584 |
$template_html = 'memberlist_im.html';
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$auth->acl_get('u_sendim'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NOT_AUTHORISED');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$presence_img = '';
|
|
|
ef5584 |
switch ($action)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
case 'aim':
|
|
|
ef5584 |
$lang = 'AIM';
|
|
|
ef5584 |
$sql_field = 'user_aim';
|
|
|
ef5584 |
$s_select = 'S_SEND_AIM';
|
|
|
ef5584 |
$s_action = '';
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case 'msnm':
|
|
|
ef5584 |
$lang = 'MSNM';
|
|
|
ef5584 |
$sql_field = 'user_msnm';
|
|
|
ef5584 |
$s_select = 'S_SEND_MSNM';
|
|
|
ef5584 |
$s_action = '';
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case 'jabber':
|
|
|
ef5584 |
$lang = 'JABBER';
|
|
|
ef5584 |
$sql_field = 'user_jabber';
|
|
|
ef5584 |
$s_select = (@extension_loaded('xml') && $config['jab_enable']) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER';
|
|
|
ef5584 |
$s_action = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=$action&u=$user_id");
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
default:
|
|
|
ef5584 |
trigger_error('NO_MODE', E_USER_ERROR);
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Grab relevant data
|
|
|
ef5584 |
$sql = "SELECT user_id, username, user_email, user_lang, $sql_field
|
|
|
ef5584 |
FROM " . USERS_TABLE . "
|
|
|
ef5584 |
WHERE user_id = $user_id
|
|
|
ef5584 |
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$row = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_USER');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else if (empty($row[$sql_field]))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('IM_NO_DATA');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Post data grab actions
|
|
|
ef5584 |
switch ($action)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
case 'jabber':
|
|
|
ef5584 |
add_form_key('memberlist_messaging');
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($submit && @extension_loaded('xml') && $config['jab_enable'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (check_form_key('memberlist_messaging'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
|
|
|
ef5584 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
|
ef5584 |
|
|
|
ef5584 |
$subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], $config['server_name']);
|
|
|
ef5584 |
$message = utf8_normalize_nfc(request_var('message', '', true));
|
|
|
ef5584 |
|
|
|
ef5584 |
if (empty($message))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('EMPTY_MESSAGE_IM');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger = new messenger(false);
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->template('profile_send_im', $row['user_lang']);
|
|
|
ef5584 |
$messenger->subject(htmlspecialchars_decode($subject));
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->replyto($user->data['user_email']);
|
|
|
ef5584 |
$messenger->im($row['user_jabber'], $row['username']);
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->assign_vars(array(
|
|
|
ef5584 |
'BOARD_CONTACT' => $config['board_contact'],
|
|
|
ef5584 |
'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']),
|
|
|
ef5584 |
'TO_USERNAME' => htmlspecialchars_decode($row['username']),
|
|
|
ef5584 |
'MESSAGE' => htmlspecialchars_decode($message))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->send(NOTIFY_IM);
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_select = 'S_SENT_JABBER';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('FORM_INVALID');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Send vars to the template
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'IM_CONTACT' => $row[$sql_field],
|
|
|
ef5584 |
'A_IM_CONTACT' => addslashes($row[$sql_field]),
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_AIM_CONTACT' => ($action == 'aim') ? 'aim:addbuddy?screenname=' . urlencode($row[$sql_field]) : '',
|
|
|
ef5584 |
'U_AIM_MESSAGE' => ($action == 'aim') ? 'aim:goim?screenname=' . urlencode($row[$sql_field]) . '&message=' . urlencode($config['sitename']) : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'USERNAME' => $row['username'],
|
|
|
ef5584 |
'CONTACT_NAME' => $row[$sql_field],
|
|
|
ef5584 |
'SITENAME' => $config['sitename'],
|
|
|
ef5584 |
|
|
|
ef5584 |
'PRESENCE_IMG' => $presence_img,
|
|
|
ef5584 |
|
|
|
ef5584 |
'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang],
|
|
|
ef5584 |
'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']),
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_select => true,
|
|
|
ef5584 |
'S_IM_ACTION' => $s_action)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case 'viewprofile':
|
|
|
ef5584 |
// Display a profile
|
|
|
ef5584 |
if ($user_id == ANONYMOUS && !$username)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_USER');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Get user...
|
|
|
ef5584 |
$sql = 'SELECT *
|
|
|
ef5584 |
FROM ' . USERS_TABLE . '
|
|
|
ef5584 |
WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$member = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$member)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_USER');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
|
|
|
ef5584 |
// Normal users are able to see at least users having only changed their profile settings but not yet reactivated.
|
|
|
ef5584 |
if (!$auth->acl_get('a_user') && $user->data['user_type'] != USER_FOUNDER)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if ($member['user_type'] == USER_IGNORE)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_USER');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else if ($member['user_type'] == USER_INACTIVE && $member['user_inactive_reason'] != INACTIVE_PROFILE)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_USER');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$user_id = (int) $member['user_id'];
|
|
|
ef5584 |
|
|
|
ef5584 |
// Do the SQL thang
|
|
|
ef5584 |
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
|
|
|
ef5584 |
WHERE ug.user_id = $user_id
|
|
|
ef5584 |
AND g.group_id = ug.group_id" . ((!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . '
|
|
|
ef5584 |
AND ug.user_pending = 0
|
|
|
ef5584 |
ORDER BY g.group_type, g.group_name';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
$group_options = '';
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
// What colour is the zebra
|
|
|
ef5584 |
$sql = 'SELECT friend, foe
|
|
|
ef5584 |
FROM ' . ZEBRA_TABLE . "
|
|
|
ef5584 |
WHERE zebra_id = $user_id
|
|
|
ef5584 |
AND user_id = {$user->data['user_id']}";
|
|
|
ef5584 |
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$row = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$foe = ($row['foe']) ? true : false;
|
|
|
ef5584 |
$friend = ($row['friend']) ? true : false;
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($config['load_onlinetrack'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
|
|
|
ef5584 |
FROM ' . SESSIONS_TABLE . "
|
|
|
ef5584 |
WHERE session_user_id = $user_id";
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$row = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
$member['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0;
|
|
|
ef5584 |
$member['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0;
|
|
|
ef5584 |
unset($row);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($config['load_user_activity'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
display_user_activity($member);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Do the relevant calculations
|
|
|
ef5584 |
$memberdays = max(1, round((time() - $member['user_regdate']) / 86400));
|
|
|
ef5584 |
$posts_per_day = $member['user_posts'] / $memberdays;
|
|
|
ef5584 |
$percentage = ($config['num_posts']) ? min(100, ($member['user_posts'] / $config['num_posts']) * 100) : 0;
|
|
|
ef5584 |
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($member['user_sig'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$member['user_sig'] = censor_text($member['user_sig']);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($member['user_sig_bbcode_bitfield'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
|
|
ef5584 |
$bbcode = new bbcode();
|
|
|
ef5584 |
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$member['user_sig'] = bbcode_nl2br($member['user_sig']);
|
|
|
ef5584 |
$member['user_sig'] = smiley_text($member['user_sig']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(show_profile($member));
|
|
|
ef5584 |
|
|
|
ef5584 |
// Custom Profile Fields
|
|
|
ef5584 |
$profile_fields = array();
|
|
|
ef5584 |
if ($config['load_cpf_viewprofile'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
|
|
ef5584 |
$cp = new custom_profile();
|
|
|
ef5584 |
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
|
|
|
ef5584 |
$profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// We need to check if the module 'zebra' is accessible
|
|
|
ef5584 |
$zebra_enabled = false;
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($user->data['user_id'] != $user_id && $user->data['is_registered'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
include_once($phpbb_root_path . 'includes/functions_module.' . $phpEx);
|
|
|
ef5584 |
$module = new p_master();
|
|
|
ef5584 |
$module->list_modules('ucp');
|
|
|
ef5584 |
$module->set_active('zebra');
|
|
|
ef5584 |
|
|
|
ef5584 |
$zebra_enabled = ($module->active_module === false) ? false : true;
|
|
|
ef5584 |
|
|
|
ef5584 |
unset($module);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
|
|
|
ef5584 |
if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT COUNT(post_id) as posts_in_queue
|
|
|
ef5584 |
FROM ' . POSTS_TABLE . '
|
|
|
ef5584 |
WHERE poster_id = ' . $user_id . '
|
|
|
ef5584 |
AND post_approved = 0';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$member['posts_in_queue'] = 0;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']),
|
|
|
ef5584 |
|
|
|
ef5584 |
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
|
|
|
ef5584 |
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
|
|
|
ef5584 |
|
|
|
ef5584 |
'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '',
|
|
|
ef5584 |
'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
|
|
|
ef5584 |
'SIGNATURE' => $member['user_sig'],
|
|
|
ef5584 |
'POSTS_IN_QUEUE'=> $member['posts_in_queue'],
|
|
|
ef5584 |
|
|
|
ef5584 |
'AVATAR_IMG' => $poster_avatar,
|
|
|
ef5584 |
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
|
|
|
ef5584 |
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
|
|
|
ef5584 |
'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']),
|
|
|
ef5584 |
'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']),
|
|
|
ef5584 |
'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']),
|
|
|
ef5584 |
'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']),
|
|
|
ef5584 |
'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']),
|
|
|
ef5584 |
'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
|
|
|
ef5584 |
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'),
|
|
|
ef5584 |
'S_GROUP_OPTIONS' => $group_options,
|
|
|
ef5584 |
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
|
|
|
ef5584 |
'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '',
|
|
|
ef5584 |
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}") : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false,
|
|
|
ef5584 |
'U_ADD_FRIEND' => (!$friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
|
|
|
ef5584 |
'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
|
|
|
ef5584 |
'U_REMOVE_FRIEND' => ($friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '',
|
|
|
ef5584 |
'U_REMOVE_FOE' => ($foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '',
|
|
|
ef5584 |
));
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!empty($profile_fields['row']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$template->assign_vars($profile_fields['row']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!empty($profile_fields['blockrow']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
foreach ($profile_fields['blockrow'] as $field_data)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$template->assign_block_vars('custom_fields', $field_data);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Inactive reason/account?
|
|
|
ef5584 |
if ($member['user_type'] == USER_INACTIVE)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$user->add_lang('acp/common');
|
|
|
ef5584 |
|
|
|
ef5584 |
$inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
|
|
|
ef5584 |
|
|
|
ef5584 |
switch ($member['user_inactive_reason'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
case INACTIVE_REGISTER:
|
|
|
ef5584 |
$inactive_reason = $user->lang['INACTIVE_REASON_REGISTER'];
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case INACTIVE_PROFILE:
|
|
|
ef5584 |
$inactive_reason = $user->lang['INACTIVE_REASON_PROFILE'];
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case INACTIVE_MANUAL:
|
|
|
ef5584 |
$inactive_reason = $user->lang['INACTIVE_REASON_MANUAL'];
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case INACTIVE_REMIND:
|
|
|
ef5584 |
$inactive_reason = $user->lang['INACTIVE_REASON_REMIND'];
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'S_USER_INACTIVE' => true,
|
|
|
ef5584 |
'USER_INACTIVE_REASON' => $inactive_reason)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Now generate page title
|
|
|
ef5584 |
$page_title = sprintf($user->lang['VIEWING_PROFILE'], $member['username']);
|
|
|
ef5584 |
$template_html = 'memberlist_view.html';
|
|
|
ef5584 |
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case 'email':
|
|
|
ef5584 |
|
|
|
ef5584 |
// Send an email
|
|
|
ef5584 |
$page_title = $user->lang['SEND_EMAIL'];
|
|
|
ef5584 |
$template_html = 'memberlist_email.html';
|
|
|
ef5584 |
|
|
|
ef5584 |
add_form_key('memberlist_email');
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$config['email_enable'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('EMAIL_DISABLED');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$auth->acl_get('u_sendemail'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_EMAIL');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Are we trying to abuse the facility?
|
|
|
ef5584 |
if (time() - $user->data['user_emailtime'] < $config['flood_interval'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('FLOOD_EMAIL_LIMIT');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Determine action...
|
|
|
ef5584 |
$user_id = request_var('u', 0);
|
|
|
ef5584 |
$topic_id = request_var('t', 0);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Send email to user...
|
|
|
ef5584 |
if ($user_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if ($user_id == ANONYMOUS || !$config['board_email_form'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_EMAIL');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Get the appropriate username, etc.
|
|
|
ef5584 |
$sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type
|
|
|
ef5584 |
FROM ' . USERS_TABLE . "
|
|
|
ef5584 |
WHERE user_id = $user_id
|
|
|
ef5584 |
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$row = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_USER');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Can we send email to this user?
|
|
|
ef5584 |
if (!$row['user_allow_viewemail'] && !$auth->acl_get('a_user'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_EMAIL');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else if ($topic_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// Send topic heads-up to email address
|
|
|
ef5584 |
$sql = 'SELECT forum_id, topic_title
|
|
|
ef5584 |
FROM ' . TOPICS_TABLE . "
|
|
|
ef5584 |
WHERE topic_id = $topic_id";
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$row = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_TOPIC');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($row['forum_id'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (!$auth->acl_get('f_read', $row['forum_id']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('SORRY_AUTH_READ');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$auth->acl_get('f_email', $row['forum_id']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_EMAIL');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// If global announcement, we need to check if the user is able to at least read and email in one forum...
|
|
|
ef5584 |
if (!$auth->acl_getf_global('f_read'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('SORRY_AUTH_READ');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$auth->acl_getf_global('f_email'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_EMAIL');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_EMAIL');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$error = array();
|
|
|
ef5584 |
|
|
|
ef5584 |
$name = utf8_normalize_nfc(request_var('name', '', true));
|
|
|
ef5584 |
$email = request_var('email', '');
|
|
|
ef5584 |
$email_lang = request_var('lang', $config['default_lang']);
|
|
|
ef5584 |
$subject = utf8_normalize_nfc(request_var('subject', '', true));
|
|
|
ef5584 |
$message = utf8_normalize_nfc(request_var('message', '', true));
|
|
|
ef5584 |
$cc = (isset($_POST['cc_email'])) ? true : false;
|
|
|
ef5584 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($submit)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (!check_form_key('memberlist_email'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$error[] = 'FORM_INVALID';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
if ($user_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (!$subject)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$error[] = $user->lang['EMPTY_SUBJECT_EMAIL'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$message)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$error[] = $user->lang['EMPTY_MESSAGE_EMAIL'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$name = $row['username'];
|
|
|
ef5584 |
$email_lang = $row['user_lang'];
|
|
|
ef5584 |
$email = $row['user_email'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$error[] = $user->lang['EMPTY_ADDRESS_EMAIL'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$name)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$error[] = $user->lang['EMPTY_NAME_EMAIL'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!sizeof($error))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
ef5584 |
SET user_emailtime = ' . time() . '
|
|
|
ef5584 |
WHERE user_id = ' . $user->data['user_id'];
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
|
ef5584 |
$messenger = new messenger(false);
|
|
|
ef5584 |
$email_tpl = ($user_id) ? 'profile_send_email' : 'email_notify';
|
|
|
ef5584 |
|
|
|
ef5584 |
$mail_to_users = array();
|
|
|
ef5584 |
|
|
|
ef5584 |
$mail_to_users[] = array(
|
|
|
ef5584 |
'email_lang' => $email_lang,
|
|
|
ef5584 |
'email' => $email,
|
|
|
ef5584 |
'name' => $name,
|
|
|
ef5584 |
'username' => ($user_id) ? $row['username'] : '',
|
|
|
ef5584 |
'to_name' => $name,
|
|
|
ef5584 |
'user_jabber' => ($user_id) ? $row['user_jabber'] : '',
|
|
|
ef5584 |
'user_notify_type' => ($user_id) ? $row['user_notify_type'] : NOTIFY_EMAIL,
|
|
|
ef5584 |
'topic_title' => (!$user_id) ? $row['topic_title'] : '',
|
|
|
ef5584 |
'forum_id' => (!$user_id) ? $row['forum_id'] : 0,
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Ok, now the same email if CC specified, but without exposing the users email address
|
|
|
ef5584 |
if ($cc)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$mail_to_users[] = array(
|
|
|
ef5584 |
'email_lang' => $user->data['user_lang'],
|
|
|
ef5584 |
'email' => $user->data['user_email'],
|
|
|
ef5584 |
'name' => $user->data['username'],
|
|
|
ef5584 |
'username' => $user->data['username'],
|
|
|
ef5584 |
'to_name' => $name,
|
|
|
ef5584 |
'user_jabber' => $user->data['user_jabber'],
|
|
|
ef5584 |
'user_notify_type' => ($user_id) ? $user->data['user_notify_type'] : NOTIFY_EMAIL,
|
|
|
ef5584 |
'topic_title' => (!$user_id) ? $row['topic_title'] : '',
|
|
|
ef5584 |
'forum_id' => (!$user_id) ? $row['forum_id'] : 0,
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
foreach ($mail_to_users as $row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$messenger->template($email_tpl, $row['email_lang']);
|
|
|
ef5584 |
$messenger->replyto($user->data['user_email']);
|
|
|
ef5584 |
$messenger->to($row['email'], $row['name']);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($user_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$messenger->subject(htmlspecialchars_decode($subject));
|
|
|
ef5584 |
$messenger->im($row['user_jabber'], $row['username']);
|
|
|
ef5584 |
$notify_type = $row['user_notify_type'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$notify_type = NOTIFY_EMAIL;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
|
|
ef5584 |
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
|
|
|
ef5584 |
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
|
|
|
ef5584 |
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->assign_vars(array(
|
|
|
ef5584 |
'BOARD_CONTACT' => $config['board_contact'],
|
|
|
ef5584 |
'TO_USERNAME' => htmlspecialchars_decode($row['to_name']),
|
|
|
ef5584 |
'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']),
|
|
|
ef5584 |
'MESSAGE' => htmlspecialchars_decode($message))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($topic_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$messenger->assign_vars(array(
|
|
|
ef5584 |
'TOPIC_NAME' => htmlspecialchars_decode($row['topic_title']),
|
|
|
ef5584 |
'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=" . $row['forum_id'] . "&t=$topic_id")
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$messenger->send($notify_type);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
|
|
|
ef5584 |
$message = ($user_id) ? sprintf($user->lang['RETURN_INDEX'], '', '') : sprintf($user->lang['RETURN_TOPIC'], '', '');
|
|
|
ef5584 |
trigger_error($user->lang['EMAIL_SENT'] . '
' . $message);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($user_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'S_SEND_USER' => true,
|
|
|
ef5584 |
'USERNAME' => $row['username'],
|
|
|
ef5584 |
|
|
|
ef5584 |
'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_BODY_EXPLAIN'],
|
|
|
ef5584 |
'S_POST_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'EMAIL' => $email,
|
|
|
ef5584 |
'NAME' => $name,
|
|
|
ef5584 |
'S_LANG_OPTIONS' => language_select($email_lang),
|
|
|
ef5584 |
|
|
|
ef5584 |
'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_TOPIC_EXPLAIN'],
|
|
|
ef5584 |
'S_POST_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&t=' . $topic_id))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'ERROR_MESSAGE' => (sizeof($error)) ? implode(' ', $error) : '')
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case 'group':
|
|
|
ef5584 |
default:
|
|
|
ef5584 |
// The basic memberlist
|
|
|
ef5584 |
$page_title = $user->lang['MEMBERLIST'];
|
|
|
ef5584 |
$template_html = 'memberlist_body.html';
|
|
|
ef5584 |
|
|
|
ef5584 |
// Sorting
|
|
|
ef5584 |
$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'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER']);
|
|
|
ef5584 |
$sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber');
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($auth->acl_get('a_user'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sort_key_text['e'] = $user->lang['SORT_EMAIL'];
|
|
|
ef5584 |
$sort_key_sql['e'] = 'u.user_email';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($auth->acl_get('u_viewonline'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE'];
|
|
|
ef5584 |
$sort_key_sql['l'] = 'u.user_lastvisit';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$sort_key_text['m'] = $user->lang['SORT_RANK'];
|
|
|
ef5584 |
$sort_key_sql['m'] = 'u.user_rank';
|
|
|
ef5584 |
|
|
|
ef5584 |
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_sort_key = '';
|
|
|
ef5584 |
foreach ($sort_key_text as $key => $value)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$selected = ($sort_key == $key) ? ' selected="selected"' : '';
|
|
|
ef5584 |
$s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_sort_dir = '';
|
|
|
ef5584 |
foreach ($sort_dir_text as $key => $value)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$selected = ($sort_dir == $key) ? ' selected="selected"' : '';
|
|
|
ef5584 |
$s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Additional sorting options for user search ... if search is enabled, if not
|
|
|
ef5584 |
// then only admins can make use of this (for ACP functionality)
|
|
|
ef5584 |
$sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = '';
|
|
|
ef5584 |
|
|
|
ef5584 |
|
|
|
ef5584 |
$form = request_var('form', '');
|
|
|
ef5584 |
$field = request_var('field', '');
|
|
|
ef5584 |
$select_single = request_var('select_single', false);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Search URL parameters, if any of these are in the URL we do a search
|
|
|
ef5584 |
$search_params = array('username', 'email', 'icq', 'aim', 'yahoo', 'msn', 'jabber', 'search_group_id', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'ip');
|
|
|
ef5584 |
|
|
|
ef5584 |
// We validate form and field here, only id/class allowed
|
|
|
ef5584 |
$form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form;
|
|
|
ef5584 |
$field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field;
|
|
|
ef5584 |
if (($mode == 'searchuser' || sizeof(array_intersect(array_keys($_GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_')))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$username = request_var('username', '', true);
|
|
|
ef5584 |
$email = strtolower(request_var('email', ''));
|
|
|
ef5584 |
$icq = request_var('icq', '');
|
|
|
ef5584 |
$aim = request_var('aim', '');
|
|
|
ef5584 |
$yahoo = request_var('yahoo', '');
|
|
|
ef5584 |
$msn = request_var('msn', '');
|
|
|
ef5584 |
$jabber = request_var('jabber', '');
|
|
|
ef5584 |
$search_group_id = request_var('search_group_id', 0);
|
|
|
ef5584 |
|
|
|
ef5584 |
$joined_select = request_var('joined_select', 'lt');
|
|
|
ef5584 |
$active_select = request_var('active_select', 'lt');
|
|
|
ef5584 |
$count_select = request_var('count_select', 'eq');
|
|
|
ef5584 |
$joined = explode('-', request_var('joined', ''));
|
|
|
ef5584 |
$active = explode('-', request_var('active', ''));
|
|
|
ef5584 |
$count = (request_var('count', '') !== '') ? request_var('count', 0) : '';
|
|
|
ef5584 |
$ipdomain = request_var('ip', '');
|
|
|
ef5584 |
|
|
|
ef5584 |
$find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
|
|
|
ef5584 |
|
|
|
ef5584 |
$find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']);
|
|
|
ef5584 |
$s_find_count = '';
|
|
|
ef5584 |
foreach ($find_count as $key => $value)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$selected = ($count_select == $key) ? ' selected="selected"' : '';
|
|
|
ef5584 |
$s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']);
|
|
|
ef5584 |
$s_find_join_time = '';
|
|
|
ef5584 |
foreach ($find_time as $key => $value)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$selected = ($joined_select == $key) ? ' selected="selected"' : '';
|
|
|
ef5584 |
$s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_find_active_time = '';
|
|
|
ef5584 |
foreach ($find_time as $key => $value)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$selected = ($active_select == $key) ? ' selected="selected"' : '';
|
|
|
ef5584 |
$s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
|
|
|
ef5584 |
$sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
|
|
|
ef5584 |
$sql_where .= ($icq) ? ' AND u.user_icq ' . $db->sql_like_expression(str_replace('*', $db->any_char, $icq)) . ' ' : '';
|
|
|
ef5584 |
$sql_where .= ($aim) ? ' AND u.user_aim ' . $db->sql_like_expression(str_replace('*', $db->any_char, $aim)) . ' ' : '';
|
|
|
ef5584 |
$sql_where .= ($yahoo) ? ' AND u.user_yim ' . $db->sql_like_expression(str_replace('*', $db->any_char, $yahoo)) . ' ' : '';
|
|
|
ef5584 |
$sql_where .= ($msn) ? ' AND u.user_msnm ' . $db->sql_like_expression(str_replace('*', $db->any_char, $msn)) . ' ' : '';
|
|
|
ef5584 |
$sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->any_char, $jabber)) . ' ' : '';
|
|
|
ef5584 |
$sql_where .= (is_numeric($count)) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : '';
|
|
|
ef5584 |
$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])) : '';
|
|
|
ef5584 |
$sql_where .= ($auth->acl_get('u_viewonline') && sizeof($active) > 1) ? " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
|
|
|
ef5584 |
$sql_where .= ($search_group_id) ? " AND u.user_id = ug.user_id AND ug.group_id = $search_group_id AND ug.user_pending = 0 " : '';
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($search_group_id)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($ipdomain && $auth->acl_getf_global('m_info'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (strspn($ipdomain, 'abcdefghijklmnopqrstuvwxyz'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$hostnames = gethostbynamel($ipdomain);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($hostnames !== false)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$ips = "'" . implode('\', \'', array_map(array($db, 'sql_escape'), 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)))) . "'";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$ips = false;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$ips = "'" . str_replace('*', '%', $db->sql_escape($ipdomain)) . "'";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($ips === false)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// A minor fudge but it does the job :D
|
|
|
ef5584 |
$sql_where .= " AND u.user_id = 0";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$ip_forums = array_keys($auth->acl_getf('m_info', true));
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql = 'SELECT DISTINCT poster_id
|
|
|
ef5584 |
FROM ' . POSTS_TABLE . '
|
|
|
ef5584 |
WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips)
|
|
|
ef5584 |
AND forum_id IN (0, " . implode(', ', $ip_forums) . ')';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$ip_sql = array();
|
|
|
ef5584 |
do
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$ip_sql[] = $row['poster_id'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result));
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql_where .= ' AND ' . $db->sql_in_set('u.user_id', $ip_sql);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// A minor fudge but it does the job :D
|
|
|
ef5584 |
$sql_where .= " AND u.user_id = 0";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
unset($ip_forums);
|
|
|
ef5584 |
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$first_char = request_var('first_char', '');
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($first_char == 'other')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
for ($i = 97; $i < 123; $i++)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->any_char);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else if ($first_char)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->any_char);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Are we looking at a usergroup? If so, fetch additional info
|
|
|
ef5584 |
// and further restrict the user info query
|
|
|
ef5584 |
if ($mode == 'group')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// We JOIN here to save a query for determining membership for hidden groups. ;)
|
|
|
ef5584 |
$sql = 'SELECT g.*, ug.user_id
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE . ' g
|
|
|
ef5584 |
LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] . " AND ug.group_id = $group_id)
|
|
|
ef5584 |
WHERE g.group_id = $group_id";
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$group_row = $db->sql_fetchrow($result);
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$group_row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_GROUP');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
switch ($group_row['group_type'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
case GROUP_OPEN:
|
|
|
ef5584 |
$group_row['l_group_type'] = 'OPEN';
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case GROUP_CLOSED:
|
|
|
ef5584 |
$group_row['l_group_type'] = 'CLOSED';
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case GROUP_HIDDEN:
|
|
|
ef5584 |
$group_row['l_group_type'] = 'HIDDEN';
|
|
|
ef5584 |
|
|
|
ef5584 |
// Check for membership or special permissions
|
|
|
ef5584 |
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != $user->data['user_id'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_GROUP');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case GROUP_SPECIAL:
|
|
|
ef5584 |
$group_row['l_group_type'] = 'SPECIAL';
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
|
|
|
ef5584 |
case GROUP_FREE:
|
|
|
ef5584 |
$group_row['l_group_type'] = 'FREE';
|
|
|
ef5584 |
break;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Misusing the avatar function for displaying group avatars...
|
|
|
ef5584 |
$avatar_img = get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR');
|
|
|
ef5584 |
|
|
|
ef5584 |
$rank_title = $rank_img = $rank_img_src = '';
|
|
|
ef5584 |
if ($group_row['group_rank'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (isset($ranks['special'][$group_row['group_rank']]))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$rank_title = $ranks['special'][$group_row['group_rank']]['rank_title'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? ' ' : '';
|
|
|
ef5584 |
$rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$rank_title = '';
|
|
|
ef5584 |
$rank_img = '';
|
|
|
ef5584 |
$rank_img_src = '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']),
|
|
|
ef5584 |
'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'],
|
|
|
ef5584 |
'GROUP_COLOR' => $group_row['group_colour'],
|
|
|
ef5584 |
'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']],
|
|
|
ef5584 |
'GROUP_RANK' => $rank_title,
|
|
|
ef5584 |
|
|
|
ef5584 |
'AVATAR_IMG' => $avatar_img,
|
|
|
ef5584 |
'RANK_IMG' => $rank_img,
|
|
|
ef5584 |
'RANK_IMG_SRC' => $rank_img_src,
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '',)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql_select = ', ug.group_leader';
|
|
|
ef5584 |
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
|
|
|
ef5584 |
$order_by = 'ug.group_leader DESC, ';
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
|
|
ef5584 |
$sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Sorting and order
|
|
|
ef5584 |
if (!isset($sort_key_sql[$sort_key]))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sort_key = $default_key;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
|
|
|
ef5584 |
|
|
|
ef5584 |
// Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly
|
|
|
ef5584 |
if ($sort_key == 'm')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$order_by .= ', u.user_posts DESC';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Count the users ...
|
|
|
ef5584 |
if ($sql_where)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT COUNT(u.user_id) AS total_users
|
|
|
ef5584 |
FROM ' . USERS_TABLE . " u$sql_from
|
|
|
ef5584 |
WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
|
|
ef5584 |
$sql_where";
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$total_users = (int) $db->sql_fetchfield('total_users');
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$total_users = $config['num_users'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_char_options = '<option value=""' . ((!$first_char) ? ' selected="selected"' : '') . '> </option>';
|
|
|
ef5584 |
for ($i = 97; $i < 123; $i++)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$s_char_options .= '<option value="' . chr($i) . '"' . (($first_char == chr($i)) ? ' selected="selected"' : '') . '>' . chr($i-32) . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$s_char_options .= '<option value="other"' . (($first_char == 'other') ? ' selected="selected"' : '') . '>' . $user->lang['OTHER'] . '</option>';
|
|
|
ef5584 |
|
|
|
ef5584 |
// Build a relevant pagination_url
|
|
|
ef5584 |
$params = $sort_params = array();
|
|
|
ef5584 |
|
|
|
ef5584 |
// We do not use request_var() here directly to save some calls (not all variables are set)
|
|
|
ef5584 |
$check_params = array(
|
|
|
ef5584 |
'g' => array('g', 0),
|
|
|
ef5584 |
'sk' => array('sk', $default_key),
|
|
|
ef5584 |
'sd' => array('sd', 'a'),
|
|
|
ef5584 |
'form' => array('form', ''),
|
|
|
ef5584 |
'field' => array('field', ''),
|
|
|
ef5584 |
'select_single' => array('select_single', $select_single),
|
|
|
ef5584 |
'username' => array('username', '', true),
|
|
|
ef5584 |
'email' => array('email', ''),
|
|
|
ef5584 |
'icq' => array('icq', ''),
|
|
|
ef5584 |
'aim' => array('aim', ''),
|
|
|
ef5584 |
'yahoo' => array('yahoo', ''),
|
|
|
ef5584 |
'msn' => array('msn', ''),
|
|
|
ef5584 |
'jabber' => array('jabber', ''),
|
|
|
ef5584 |
'search_group_id' => array('search_group_id', 0),
|
|
|
ef5584 |
'joined_select' => array('joined_select', 'lt'),
|
|
|
ef5584 |
'active_select' => array('active_select', 'lt'),
|
|
|
ef5584 |
'count_select' => array('count_select', 'eq'),
|
|
|
ef5584 |
'joined' => array('joined', ''),
|
|
|
ef5584 |
'active' => array('active', ''),
|
|
|
ef5584 |
'count' => (request_var('count', '') !== '') ? array('count', 0) : array('count', ''),
|
|
|
ef5584 |
'ipdomain' => array('ip', ''),
|
|
|
ef5584 |
'first_char' => array('first_char', ''),
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
foreach ($check_params as $key => $call)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (!isset($_REQUEST[$key]))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
continue;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$param = call_user_func_array('request_var', $call);
|
|
|
ef5584 |
$param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);
|
|
|
ef5584 |
$params[] = $param;
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($key != 'sk' && $key != 'sd')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sort_params[] = $param;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$u_hide_find_member = append_sid("{$phpbb_root_path}memberlist.$phpEx", "start=$start" . (!empty($params) ? '&' . implode('&', $params) : ''));
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($mode)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$params[] = "mode=$mode";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$sort_params[] = "mode=$mode";
|
|
|
ef5584 |
|
|
|
ef5584 |
$pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $params));
|
|
|
ef5584 |
$sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $sort_params));
|
|
|
ef5584 |
|
|
|
ef5584 |
unset($search_params, $sort_params);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Some search user specific data
|
|
|
ef5584 |
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$group_selected = request_var('search_group_id', 0);
|
|
|
ef5584 |
$s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>';
|
|
|
ef5584 |
$group_ids = array();
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @todo add this to a separate function (function is responsible for returning the groups the user is able to see based on the users group membership)
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT group_id, group_name, group_type
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE;
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$config['coppa_enable'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql .= " WHERE group_name <> 'REGISTERED_COPPA'";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql .= ' ORDER BY group_name ASC';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE . ' g
|
|
|
ef5584 |
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
|
|
ef5584 |
ON (
|
|
|
ef5584 |
g.group_id = ug.group_id
|
|
|
ef5584 |
AND ug.user_id = ' . $user->data['user_id'] . '
|
|
|
ef5584 |
AND ug.user_pending = 0
|
|
|
ef5584 |
)
|
|
|
ef5584 |
WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')';
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!$config['coppa_enable'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql .= " AND g.group_name <> 'REGISTERED_COPPA'";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$sql .= ' ORDER BY g.group_name ASC';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$group_ids[] = $row['group_id'];
|
|
|
ef5584 |
$s_group_select .= '<option value="' . $row['group_id'] . '"' . (($group_selected == $row['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($group_selected !== 0 && !in_array($group_selected, $group_ids))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error('NO_GROUP');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'USERNAME' => $username,
|
|
|
ef5584 |
'EMAIL' => $email,
|
|
|
ef5584 |
'ICQ' => $icq,
|
|
|
ef5584 |
'AIM' => $aim,
|
|
|
ef5584 |
'YAHOO' => $yahoo,
|
|
|
ef5584 |
'MSNM' => $msn,
|
|
|
ef5584 |
'JABBER' => $jabber,
|
|
|
ef5584 |
'JOINED' => implode('-', $joined),
|
|
|
ef5584 |
'ACTIVE' => implode('-', $active),
|
|
|
ef5584 |
'COUNT' => $count,
|
|
|
ef5584 |
'IP' => $ipdomain,
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_IP_SEARCH_ALLOWED' => ($auth->acl_getf_global('m_info')) ? true : false,
|
|
|
ef5584 |
'S_EMAIL_SEARCH_ALLOWED'=> ($auth->acl_get('a_user')) ? true : false,
|
|
|
ef5584 |
'S_IN_SEARCH_POPUP' => ($form && $field) ? true : false,
|
|
|
ef5584 |
'S_SEARCH_USER' => true,
|
|
|
ef5584 |
'S_FORM_NAME' => $form,
|
|
|
ef5584 |
'S_FIELD_NAME' => $field,
|
|
|
ef5584 |
'S_SELECT_SINGLE' => $select_single,
|
|
|
ef5584 |
'S_COUNT_OPTIONS' => $s_find_count,
|
|
|
ef5584 |
'S_SORT_OPTIONS' => $s_sort_key,
|
|
|
ef5584 |
'S_JOINED_TIME_OPTIONS' => $s_find_join_time,
|
|
|
ef5584 |
'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time,
|
|
|
ef5584 |
'S_GROUP_SELECT' => $s_group_select,
|
|
|
ef5584 |
'S_USER_SEARCH_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=$form&field=$field"))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Get us some users :D
|
|
|
ef5584 |
$sql = "SELECT u.user_id
|
|
|
ef5584 |
FROM " . USERS_TABLE . " u
|
|
|
ef5584 |
$sql_from
|
|
|
ef5584 |
WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
|
|
ef5584 |
$sql_where
|
|
|
ef5584 |
ORDER BY $order_by";
|
|
|
ef5584 |
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
|
|
ef5584 |
|
|
|
ef5584 |
$user_list = array();
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$user_list[] = (int) $row['user_id'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
$leaders_set = false;
|
|
|
ef5584 |
// So, did we get any users?
|
|
|
ef5584 |
if (sizeof($user_list))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// Session time?! Session time...
|
|
|
ef5584 |
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
|
|
|
ef5584 |
FROM ' . SESSIONS_TABLE . '
|
|
|
ef5584 |
WHERE session_time >= ' . (time() - $config['session_length']) . '
|
|
|
ef5584 |
AND ' . $db->sql_in_set('session_user_id', $user_list) . '
|
|
|
ef5584 |
GROUP BY session_user_id';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
$session_times = array();
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$session_times[$row['session_user_id']] = $row['session_time'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Do the SQL thang
|
|
|
ef5584 |
if ($mode == 'group')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = "SELECT u.*
|
|
|
ef5584 |
$sql_select
|
|
|
ef5584 |
FROM " . USERS_TABLE . " u
|
|
|
ef5584 |
$sql_from
|
|
|
ef5584 |
WHERE " . $db->sql_in_set('u.user_id', $user_list) . "
|
|
|
ef5584 |
$sql_where_data";
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT *
|
|
|
ef5584 |
FROM ' . USERS_TABLE . '
|
|
|
ef5584 |
WHERE ' . $db->sql_in_set('user_id', $user_list);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
$id_cache = array();
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0;
|
|
|
ef5584 |
$row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit'];
|
|
|
ef5584 |
|
|
|
ef5584 |
$id_cache[$row['user_id']] = $row;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Load custom profile fields
|
|
|
ef5584 |
if ($config['load_cpf_memberlist'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
|
|
ef5584 |
$cp = new custom_profile();
|
|
|
ef5584 |
|
|
|
ef5584 |
// Grab all profile fields from users in id cache for later use - similar to the poster cache
|
|
|
ef5584 |
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $user_list);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
|
|
|
ef5584 |
if ($sort_key == 'l')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
// uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
|
|
|
ef5584 |
usort($user_list, '_sort_last_active');
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$user_id = $user_list[$i];
|
|
|
ef5584 |
$row =& $id_cache[$user_id];
|
|
|
ef5584 |
$is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false;
|
|
|
ef5584 |
$leaders_set = ($leaders_set || $is_leader);
|
|
|
ef5584 |
|
|
|
ef5584 |
$cp_row = array();
|
|
|
ef5584 |
if ($config['load_cpf_memberlist'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array();
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$memberrow = array_merge(show_profile($row), array(
|
|
|
ef5584 |
'ROW_NUMBER' => $i + ($start + 1),
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
|
|
|
ef5584 |
'S_GROUP_LEADER' => $is_leader,
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_VIEW_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (isset($cp_row['row']) && sizeof($cp_row['row']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$memberrow = array_merge($memberrow, $cp_row['row']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_block_vars('memberrow', $memberrow);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
foreach ($cp_row['blockrow'] as $field_data)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$template->assign_block_vars('memberrow.custom_fields', $field_data);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
unset($id_cache[$user_id]);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Generate page
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start),
|
|
|
ef5584 |
'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start),
|
|
|
ef5584 |
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $total_users),
|
|
|
ef5584 |
|
|
|
ef5584 |
'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']),
|
|
|
ef5584 |
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
|
|
|
ef5584 |
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
|
|
|
ef5584 |
'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']),
|
|
|
ef5584 |
'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']),
|
|
|
ef5584 |
'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']),
|
|
|
ef5584 |
'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']),
|
|
|
ef5584 |
'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']),
|
|
|
ef5584 |
'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
|
|
|
ef5584 |
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
|
|
|
ef5584 |
|
|
|
ef5584 |
'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) : '')) : '',
|
|
|
ef5584 |
'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser') ? $u_hide_find_member : '',
|
|
|
ef5584 |
'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_FROM' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_WEBSITE' => $sort_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_LOCATION' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_ICQ' => $sort_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_AIM' => $sort_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_MSN' => $sort_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_YIM' => $sort_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
|
|
|
ef5584 |
'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
|
|
|
ef5584 |
'S_VIEWONLINE' => $auth->acl_get('u_viewonline'),
|
|
|
ef5584 |
'S_LEADERS_SET' => $leaders_set,
|
|
|
ef5584 |
'S_MODE_SELECT' => $s_sort_key,
|
|
|
ef5584 |
'S_ORDER_SELECT' => $s_sort_dir,
|
|
|
ef5584 |
'S_CHAR_OPTIONS' => $s_char_options,
|
|
|
ef5584 |
'S_MODE_ACTION' => $pagination_url)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Output the page
|
|
|
ef5584 |
page_header($page_title);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->set_filenames(array(
|
|
|
ef5584 |
'body' => $template_html)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
|
|
|
ef5584 |
|
|
|
ef5584 |
page_footer();
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* Prepare profile data
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
function show_profile($data)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
global $config, $auth, $template, $user, $phpEx, $phpbb_root_path;
|
|
|
ef5584 |
|
|
|
ef5584 |
$username = $data['username'];
|
|
|
ef5584 |
$user_id = $data['user_id'];
|
|
|
ef5584 |
|
|
|
ef5584 |
$rank_title = $rank_img = $rank_img_src = '';
|
|
|
ef5584 |
get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);
|
|
|
ef5584 |
|
|
|
ef5584 |
if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_user'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$email = '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($config['load_onlinetrack'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$update_time = $config['load_online_time'] * 60;
|
|
|
ef5584 |
$online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$online = false;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit'];
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$last_visit = '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$age = '';
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($config['allow_birthdays'] && $data['user_birthday'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday']));
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($bday_year)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
|
|
ef5584 |
|
|
|
ef5584 |
$diff = $now['mon'] - $bday_month;
|
|
|
ef5584 |
if ($diff == 0)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$diff = ($now['mday'] - $bday_day < 0) ? 1 : 0;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$diff = ($diff < 0) ? 1 : 0;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$age = (int) ($now['year'] - $bday_year - $diff);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Dump it out to the template
|
|
|
ef5584 |
return array(
|
|
|
ef5584 |
'AGE' => $age,
|
|
|
ef5584 |
'RANK_TITLE' => $rank_title,
|
|
|
ef5584 |
'JOINED' => $user->format_date($data['user_regdate']),
|
|
|
ef5584 |
'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit),
|
|
|
ef5584 |
'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0,
|
|
|
ef5584 |
'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0,
|
|
|
ef5584 |
|
|
|
ef5584 |
'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']),
|
|
|
ef5584 |
'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']),
|
|
|
ef5584 |
'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']),
|
|
|
ef5584 |
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']),
|
|
|
ef5584 |
|
|
|
ef5584 |
'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])),
|
|
|
ef5584 |
|
|
|
ef5584 |
'AVATAR_IMG' => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
|
|
|
ef5584 |
'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
|
|
|
ef5584 |
'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false,
|
|
|
ef5584 |
'RANK_IMG' => $rank_img,
|
|
|
ef5584 |
'RANK_IMG_SRC' => $rank_img_src,
|
|
|
ef5584 |
'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '' : '',
|
|
|
ef5584 |
'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false,
|
|
|
ef5584 |
|
|
|
ef5584 |
'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '',
|
|
|
ef5584 |
'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '',
|
|
|
ef5584 |
'U_WARN' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '',
|
|
|
ef5584 |
'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '',
|
|
|
ef5584 |
'U_EMAIL' => $email,
|
|
|
ef5584 |
'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '',
|
|
|
ef5584 |
'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '',
|
|
|
ef5584 |
'U_AIM' => ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $user_id) : '',
|
|
|
ef5584 |
'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&.src=pg' : '',
|
|
|
ef5584 |
'U_MSN' => ($data['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $user_id) : '',
|
|
|
ef5584 |
'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '',
|
|
|
ef5584 |
'LOCATION' => ($data['user_from']) ? $data['user_from'] : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'USER_ICQ' => $data['user_icq'],
|
|
|
ef5584 |
'USER_AIM' => $data['user_aim'],
|
|
|
ef5584 |
'USER_YIM' => $data['user_yim'],
|
|
|
ef5584 |
'USER_MSN' => $data['user_msnm'],
|
|
|
ef5584 |
'USER_JABBER' => $data['user_jabber'],
|
|
|
ef5584 |
'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username),
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
function _sort_last_active($first, $second)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
global $id_cache, $sort_dir;
|
|
|
ef5584 |
|
|
|
ef5584 |
$lesser_than = ($sort_dir === 'd') ? -1 : 1;
|
|
|
ef5584 |
|
|
|
ef5584 |
if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader']))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
return -1;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
return 1;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
?>
|