<?php
/***************************************************************************
* memberlist.php
* -------------------
* begin : Friday, May 11, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: memberlist.php,v 1.36.2.13 2006/12/16 13:11:24 acydburn Exp $
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
define('IN_CASHMOD', true);
define('CM_MEMBERLIST', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
init_userprefs($userdata);
//
// End session management
//
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
//
// Generate page
//
$page_title = $lang['Memberlist'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'buddys.tpl')
);
make_jumpbox('viewforum.'.$phpEx);
$template->assign_vars(array(
'L_EMAIL' => $lang['Email'],
'L_WEBSITE' => $lang['Website'],
'L_FROM' => $lang['Location'],
'L_ORDER' => $lang['Order'],
'L_SORT' => $lang['Sort'],
'L_SUBMIT' => $lang['Sort'],
'L_AIM' => $lang['AIM'],
'L_YIM' => $lang['YIM'],
'L_MSNM' => $lang['MSNM'],
'L_ICQ' => $lang['ICQ'],
'L_JOINED' => $lang['Joined'],
'L_POSTS' => $lang['Posts'],
'L_PM' => $lang['Private_Message'])
);
$sql_buds = "SELECT *
FROM " . BUDDIES_TABLE . "";
$sql_buds = "SELECT b.buddy_id AS user_id, u.username AS buddy_name, u.user_email AS buddy_email, u.user_viewemail
FROM " . BUDDIES_TABLE . " b, " . USERS_TABLE . " u
WHERE b.user_id = " . $userdata['user_id'] . "
AND u.user_id = b.buddy_id
ORDER BY u.username LIMIT $start, " . $board_config['topics_per_page'];
if (!($result = $db->sql_query ($sql_buds))) {
message_die (GENERAL_ERROR, 'Could not query online buddies', '', __LINE__, __FILE__, $sql);
}
$mybuddies = array ();
while ($row = $db->sql_fetchrow ($result)) {
$mybuddies[] = $row;
}
$db->sql_freeresult ($result);
//
// Dump vars to template
//
$template->assign_vars (
array (
'L_USERNAME' => $lang['Username'],
'L_BUDDY_LISTED_YOU' => $lang['Buddy_listed_you'],
'L_PM' => $lang['Private_Messaging'],
'L_EMAIL' => $lang['Email'],
'L_BUDDY_LIST' => $lang['Buddy_list'],
'L_BUDDY' => $lang['Buddy'],
'U_BUDDY_LIST' => append_sid('buddylist.'.$phpEx),
'NUM_COLUMNS' => (7)
)
);
//
// Okay, let's build the buddies list
//
$buddy_id = ( isset($HTTP_GET_VARS['b']) ) ? intval($HTTP_GET_VARS['b']) : 0;
if( $buddy_id )
{
remove_buddy($userdata['user_id'], $buddy_id);
}
$i = 0;
if (count($mybuddies) == 0)
{
$template->assign_block_vars ("switch_no_buddies", array ());
}
else {
for ($i = 0; $i < count($mybuddies); $i++) {
$buddy_id = $mybuddies[$i]['user_id'];
$buddy_name = $mybuddies[$i]['buddy_name'];
$buddy_email = $mybuddies[$i]['buddy_email'];
$buddy_profile = append_sid ("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $buddy_id);
$buddy_url = '<a href="' . $buddy_profile . '">' . $buddy_name . '</a>';
$buddy_temp_url = append_sid ("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $buddy_id);
$buddy_pm_img = '<a href="' . $buddy_temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
$buddy_pm = '<a href="' . $buddy_temp_url . '">' . $lang['Send_private_message'] . '</a>';
if (!empty ($row['user_viewemail']) || ($userdata['user_level'] == ADMIN)) {
$buddy_email_uri = ($board_config['board_email_form']) ? append_sid ("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $buddy_id) : 'mailto:' . $buddy_email;
$buddy_email_img = '<a href="' . $buddy_email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
$buddy_email = '<a href="' . $buddy_email_uri . '">' . $lang['Send_email'] . '</a>';
}
else {
$buddy_email_img = ' ';
$buddy_email = ' ';
}
$row_color = (!($i % 2)) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'];
list($buddy_img, $buddy) = get_buddy_img($userdata['user_id'], $buddy_id);
$template->assign_block_vars ('listrow_buddies',
array (
'ROW_NUMBER' => $i + ( $start + 1 ),
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'BUDDY_URL' => $buddy_url,
'PM_IMG' => $buddy_pm_img,
'PM' => $buddy_pm,
'EMAIL_IMG' => $buddy_email_img,
'EMAIL' => $buddy_email,
'BUDDY_IMG' => $buddy_img,
'BUDDY' => $buddy
)
);
}
}
if ($board_config['topics_per_page'] < 10 )
{
$sql = "SELECT count(*) AS total
FROM " . BUDDIES_TABLE . " b, " . USERS_TABLE . " u
WHERE b.user_id = " . $userdata['user_id'] . "
AND u.user_id = b.buddy_id
ORDER BY u.username";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
}
if ( $total = $db->sql_fetchrow($result) )
{
$total_members = $total['total'];
$pagination = generate_pagination("buddys.$phpEx?order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' ';
}
$db->sql_freeresult($result);
}
else
{
$pagination = ' ';
$total_members = 10;
}
$template->assign_vars(array(
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),
'L_GOTO_PAGE' => $lang['Goto_page'])
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>