phpBB

Code Changes

File: memberlist.php

  Unmodified   Added   Modified   Removed
Line 89Line 89
$default_key = 'c';
$sort_key = request_var('sk', $default_key);
$sort_dir = request_var('sd', 'a');

$default_key = 'c';
$sort_key = request_var('sk', $default_key);
$sort_dir = request_var('sd', 'a');

 

$user_types = array(USER_NORMAL, USER_FOUNDER);
if ($auth->acl_get('a_user'))
{
$user_types[] = USER_INACTIVE;
}


// What do you want to do today? ... oops, I think that line is taken ...
switch ($mode)
{
case 'team':
// Display a listing of board admins, moderators


// What do you want to do today? ... oops, I think that line is taken ...
switch ($mode)
{
case 'team':
// Display a listing of board admins, moderators

 
		if (!function_exists('user_get_id_name'))
{

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

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

 
		}


$page_title = $user->lang['THE_TEAM'];
$template_html = 'memberlist_team.html';


$page_title = $user->lang['THE_TEAM'];
$template_html = 'memberlist_team.html';

Line 151Line 160
		$db->sql_freeresult($result);

$sql_ary = array(

		$db->sql_freeresult($result);

$sql_ary = array(

			'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',

			'SELECT'	=> 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_type, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id',


'FROM' => array(
USER_GROUP_TABLE => 'ug',


'FROM' => array(
USER_GROUP_TABLE => 'ug',

Line 313Line 322

'RANK_IMG' => $user_rank_data['img'],
'RANK_IMG_SRC' => $user_rank_data['img_src'],


'RANK_IMG' => $user_rank_data['img'],
'RANK_IMG_SRC' => $user_rank_data['img_src'],

 

'S_INACTIVE' => $row['user_type'] == USER_INACTIVE,


'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']) : '',



'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']) : '',


Line 832Line 843

$sql = 'SELECT username, user_id, user_colour
FROM ' . USERS_TABLE . '


$sql = 'SELECT username, user_id, user_colour
FROM ' . USERS_TABLE . '

			WHERE ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . '

			WHERE ' . $db->sql_in_set('user_type', $user_types) . '

				AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->get_any_char());
$result = $db->sql_query_limit($sql, 10);
$user_list = array();

				AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->get_any_char());
$result = $db->sql_query_limit($sql, 10);
$user_list = array();

Line 1025Line 1036
						FROM ' . POSTS_TABLE . '
WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips)
AND " . $db->sql_in_set('forum_id', $ip_forums);

						FROM ' . POSTS_TABLE . '
WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips)
AND " . $db->sql_in_set('forum_id', $ip_forums);

 

/**
* Modify sql query for members search by ip address / hostname
*
* @event core.memberlist_modify_ip_search_sql_query
* @var string ipdomain The host name
* @var string ips IP address list for the given host name
* @var string sql The SQL query for searching members by IP address
* @since 3.1.7-RC1
*/
$vars = array(
'ipdomain',
'ips',
'sql',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_ip_search_sql_query', compact($vars)));


					$result = $db->sql_query($sql);

if ($row = $db->sql_fetchrow($result))

					$result = $db->sql_query($sql);

if ($row = $db->sql_fetchrow($result))

Line 1069Line 1097
		if ($mode == 'group')
{
// We JOIN here to save a query for determining membership for hidden groups. ;)

		if ($mode == 'group')
{
// We JOIN here to save a query for determining membership for hidden groups. ;)

			$sql = 'SELECT g.*, ug.user_id

			$sql = 'SELECT g.*, ug.user_id, ug.group_leader

				FROM ' . GROUPS_TABLE . ' g
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)
WHERE g.group_id = $group_id";

				FROM ' . GROUPS_TABLE . ' g
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)
WHERE g.group_id = $group_id";

Line 1127Line 1155
				{
$user_rank_data['img'] .= '<br />';
}

				{
$user_rank_data['img'] .= '<br />';
}

 
			}
// include modules for manage groups link display or not
// need to ensure the module is active
$can_manage_group = false;
if ($user->data['is_registered'] && $group_row['group_leader'])
{
if (!class_exists('p_master'))
{
include($phpbb_root_path . 'includes/functions_module.' . $phpEx);
}
$module = new p_master;
$module->list_modules('ucp');

if ($module->is_active('ucp_groups', 'manage'))
{
$can_manage_group = true;
}
unset($module);

			}

$template->assign_vars(array(

			}

$template->assign_vars(array(

Line 1140Line 1186
				'RANK_IMG'		=> $user_rank_data['img'],
'RANK_IMG_SRC' => $user_rank_data['img_src'],


				'RANK_IMG'		=> $user_rank_data['img'],
'RANK_IMG_SRC' => $user_rank_data['img_src'],


				'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&amp;mode=compose&amp;g=' . $group_id) : '',)


				'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&amp;mode=compose&amp;g=' . $group_id) : '',
'U_MANAGE' => ($can_manage_group) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_groups&amp;mode=manage') : false,)

			);

$sql_select = ', ug.group_leader';

			);

$sql_select = ', ug.group_leader';

Line 1164Line 1211
		{
$order_by .= ', u.user_posts DESC';
}

		{
$order_by .= ', u.user_posts DESC';
}

 

/**
* Modify sql query data for members search
*
* @event core.memberlist_modify_sql_query_data
* @var string order_by SQL ORDER BY clause condition
* @var string sort_dir The sorting direction
* @var string sort_key The sorting key
* @var array sort_key_sql Arraty with the sorting conditions data
* @var string sql_from SQL FROM clause condition
* @var string sql_select SQL SELECT fields list
* @var string sql_where SQL WHERE clause condition
* @var string sql_where_data SQL WHERE clause additional conditions data
* @since 3.1.7-RC1
*/
$vars = array(
'order_by',
'sort_dir',
'sort_key',
'sort_key_sql',
'sql_from',
'sql_select',
'sql_where',
'sql_where_data',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sql_query_data', compact($vars)));


// Count the users ...


// Count the users ...

		if ($sql_where)
{

 
			$sql = 'SELECT COUNT(u.user_id) AS total_users
FROM ' . USERS_TABLE . " u$sql_from

			$sql = 'SELECT COUNT(u.user_id) AS total_users
FROM ' . USERS_TABLE . " u$sql_from

				WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")

			WHERE " . $db->sql_in_set('u.user_type', $user_types) . "

				$sql_where";
$result = $db->sql_query($sql);
$total_users = (int) $db->sql_fetchfield('total_users');
$db->sql_freeresult($result);

				$sql_where";
$result = $db->sql_query($sql);
$total_users = (int) $db->sql_fetchfield('total_users');
$db->sql_freeresult($result);

		}
else
{
$total_users = $config['num_users'];
}

 

// Build a relevant pagination_url
$params = $sort_params = array();


// Build a relevant pagination_url
$params = $sort_params = array();

Line 1215Line 1281
			}

$param = call_user_func_array('request_var', $call);

			}

$param = call_user_func_array('request_var', $call);

			$param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);


			// Encode strings, convert everything else to int in order to prevent empty parameters.
$param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : (int) $param);

			$params[] = $param;

if ($key != 'first_char')

			$params[] = $param;

if ($key != 'first_char')

Line 1345Line 1412
			);
}


			);
}


		$start = $pagination->validate_start($start, $config['topics_per_page'], $config['num_users']);

		$start = $pagination->validate_start($start, $config['topics_per_page'], $total_users);


// Get us some users :D
$sql = "SELECT u.user_id
FROM " . USERS_TABLE . " u
$sql_from


// Get us some users :D
$sql = "SELECT u.user_id
FROM " . USERS_TABLE . " u
$sql_from

			WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")

			WHERE " . $db->sql_in_set('u.user_type', $user_types) . "

				$sql_where
ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);

				$sql_where
ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);

Line 1447Line 1514
//				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));"));
usort($user_list, 'phpbb_sort_last_active');
}

//				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));"));
usort($user_list, 'phpbb_sort_last_active');
}

 

// do we need to display contact fields as such
$use_contact_fields = false;

/**
* Modify list of users before member row is created
*
* @event core.memberlist_memberrow_before
* @var array user_list Array containing list of users
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.7-RC1
*/
$vars = array('user_list', 'use_contact_fields');
extract($phpbb_dispatcher->trigger_event('core.memberlist_memberrow_before', compact($vars)));


for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
{


for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
{

Line 1458Line 1539
				$cp_row = array();
if ($config['load_cpf_memberlist'])
{

				$cp_row = array();
if ($config['load_cpf_memberlist'])
{

					$cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array();

					$cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], $use_contact_fields) : array();

				}

$memberrow = array_merge(phpbb_show_profile($row, false, false, false), array(

				}

$memberrow = array_merge(phpbb_show_profile($row, false, false, false), array(

Line 1466Line 1547

'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
'S_GROUP_LEADER' => $is_leader,


'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
'S_GROUP_LEADER' => $is_leader,

 
					'S_INACTIVE'		=> $row['user_type'] == USER_INACTIVE,


'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']),
));


'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']),
));

Line 1505Line 1587
			'U_HIDE_FIND_MEMBER'	=> ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '',
'U_LIVE_SEARCH' => ($config['allow_live_searches']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch') : false,
'U_SORT_USERNAME' => $sort_url . '&amp;sk=a&amp;sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),

			'U_HIDE_FIND_MEMBER'	=> ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '',
'U_LIVE_SEARCH' => ($config['allow_live_searches']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch') : false,
'U_SORT_USERNAME' => $sort_url . '&amp;sk=a&amp;sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),

			'U_SORT_JOINED'			=> $sort_url . '&amp;sk=c&amp;sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
'U_SORT_POSTS' => $sort_url . '&amp;sk=d&amp;sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
'U_SORT_EMAIL' => $sort_url . '&amp;sk=e&amp;sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&amp;sk=l&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
'U_SORT_RANK' => $sort_url . '&amp;sk=m&amp;sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
'U_LIST_CHAR' => $sort_url . '&amp;sk=a&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),

			'U_SORT_JOINED'			=> $sort_url . '&amp;sk=c&amp;sd=' . (($sort_key == 'c' && $sort_dir == 'd') ? 'a' : 'd'),
'U_SORT_POSTS' => $sort_url . '&amp;sk=d&amp;sd=' . (($sort_key == 'd' && $sort_dir == 'd') ? 'a' : 'd'),
'U_SORT_EMAIL' => $sort_url . '&amp;sk=e&amp;sd=' . (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'),
'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&amp;sk=l&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd') : '',
'U_SORT_RANK' => $sort_url . '&amp;sk=m&amp;sd=' . (($sort_key == 'm' && $sort_dir == 'd') ? 'a' : 'd'),
'U_LIST_CHAR' => $sort_url . '&amp;sk=a&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd'),


'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
'S_VIEWONLINE' => $auth->acl_get('u_viewonline'),


'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
'S_VIEWONLINE' => $auth->acl_get('u_viewonline'),