View file memberlist.php

File size: 2.63Kb
<?php
/***************************************************************************
 *                  memberlist.php  (phpBB-WAP v4)
 *                            -------------------
 *      Разработка: phpBB Group.
 *      Оптимизация под WAP: Гутник Игорь ( чел ).
 *          2007 год
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
init_userprefs($userdata);
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'memberlist_body.tpl')
);

$order_by = "user_posts DESC LIMIT $start, " . $board_config['topics_per_page'];

$sql = "SELECT username, user_id, user_level, user_posts 
	FROM " . USERS_TABLE . "
	WHERE user_id <> " . ANONYMOUS . "
	ORDER BY $order_by";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{
	$i = 0;
	do
	{
		$username = $row['username'];

			if ( $row['user_level'] == ADMIN )
			{
				$username = '<span style="color:#ffcc00">' . $row['username'] . '</span>';
			}
			else if ( $row['user_level'] == MOD )
			{
				$username = '<span style="color:#943043">' . $row['username'] . '</span>';
			}

		$user_id = $row['user_id'];
		$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;

		$template->assign_block_vars('memberrow', array(
			'USERNAME' => $username,
			'POSTS' => $posts,
			'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"))
		);

		$i++;
	}
	while ( $row = $db->sql_fetchrow($result) );
	$db->sql_freeresult($result);
}

if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
{
	$sql = "SELECT count(*) AS total
		FROM " . USERS_TABLE . "
		WHERE user_id <> " . ANONYMOUS;

	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("memberlist.$phpEx?mode=$mode&amp;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)
);

$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>