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)


// What do you want to do today? ... oops, I think that line is taken ...
switch ($mode)

Line 151Line 157
		$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 172Line 178

'ORDER_BY' => 'u.username_clean ASC',
);


'ORDER_BY' => 'u.username_clean ASC',
);

 

/**
* Modify the query used to get the users for the team page
*
* @event core.memberlist_team_modify_query
* @var array sql_ary Array containing the query
* @var array group_ids Array of group ids
* @var array teampage_data The teampage data
* @since 3.1.3-RC1
*/
$vars = array(
'sql_ary',
'group_ids',
'teampage_data',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_query', compact($vars)));


$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));



$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));


Line 285Line 307

$user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']));



$user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']));


						$template->assign_block_vars('group.user', array(

						$template_vars = array(

							'USER_ID'		=> $row['user_id'],
'FORUMS' => $row['forums'],
'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false,

							'USER_ID'		=> $row['user_id'],
'FORUMS' => $row['forums'],
'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false,

Line 297Line 319

'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 304Line 328
							'USERNAME'			=> get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),

							'USERNAME'			=> get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),

						));



















						);

/**
* Modify the template vars for displaying the user in the groups on the teampage
*
* @event core.memberlist_team_modify_template_vars
* @var array template_vars Array containing the query
* @var array row Array containing the action user row
* @var array groups_ary Array of groups with all users that should be displayed
* @since 3.1.3-RC1
*/
$vars = array(
'template_vars',
'row',
'groups_ary',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_template_vars', compact($vars)));

$template->assign_block_vars('group.user', $template_vars);


if ($config['teampage_memberships'] != 2)
{


if ($config['teampage_memberships'] != 2)
{

Line 681Line 723
			'U_MCP_QUEUE'			=> ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',

'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}&hash=" . generate_link_hash('switchperm')) : '',

			'U_MCP_QUEUE'			=> ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',

'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}&hash=" . generate_link_hash('switchperm')) : '',

			'U_EDIT_SELF'			=> ($user_id == $user->data['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '',

			'U_EDIT_SELF'			=> ($user_id == $user->data['user_id'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '',


'S_USER_NOTES' => ($user_notes_enabled) ? true : false,
'S_WARN_USER' => ($warn_user_enabled) ? true : false,


'S_USER_NOTES' => ($user_notes_enabled) ? true : false,
'S_WARN_USER' => ($warn_user_enabled) ? true : false,

Line 798Line 840

$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 991Line 1033
						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 1035Line 1094
		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 1093Line 1152
				{
$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 1106Line 1183
				'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 1130Line 1208
		{
$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 1181Line 1278
			}

$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 1311Line 1409
			);
}


			);
}


		$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 1413Line 1511
//				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 1424Line 1536
				$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 1432Line 1544

'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 1471Line 1584
			'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'),