phpBB

Code Changes

File: memberlist.php

  Unmodified   Added   Modified   Removed
Line 489Line 489
		}

// Get user...

		}

// Get user...

		$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");























		$sql_array = array(
'SELECT' => 'u.*',
'FROM' => array(
USERS_TABLE => 'u'
),
'WHERE' => (($username) ? "u.username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "u.user_id = $user_id"),
);

/**
* Modify user data SQL before member profile row is created
*
* @event core.memberlist_modify_viewprofile_sql
* @var int user_id The user ID
* @var string username The username
* @var array sql_array Array containing the main query
* @since 3.2.6-RC1
*/
$vars = array(
'user_id',
'username',
'sql_array',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_viewprofile_sql', compact($vars)));

$sql = $db->sql_build_query('SELECT', $sql_array);

		$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

		$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

Line 523Line 545
		$sql_uid_ary = ($auth_hidden_groups) ? array($user_id) : array($user_id, (int) $user->data['user_id']);

// Do the SQL thang

		$sql_uid_ary = ($auth_hidden_groups) ? array($user_id) : array($user_id, (int) $user->data['user_id']);

// Do the SQL thang

		$sql = 'SELECT g.group_id, g.group_name, g.group_type, ug.user_id
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ' . $db->sql_in_set('ug.user_id', $sql_uid_ary) . '
AND g.group_id = ug.group_id
AND ug.user_pending = 0';
$result = $db->sql_query($sql);


























		$sql_ary = [
'SELECT' => 'g.group_id, g.group_name, g.group_type, ug.user_id',

'FROM' => [
GROUPS_TABLE => 'g',
],

'LEFT_JOIN' => [
[
'FROM' => [USER_GROUP_TABLE => 'ug'],
'ON' => 'g.group_id = ug.group_id',
],
],

'WHERE' => $db->sql_in_set('ug.user_id', $sql_uid_ary) . '
AND ug.user_pending = 0',
];

/**
* Modify the query used to get the group data
*
* @event core.modify_memberlist_viewprofile_group_sql
* @var array sql_ary Array containing the query
* @since 3.2.6-RC1
*/
$vars = array(
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_sql', compact($vars)));

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


// Divide data into profile data and current user data
$profile_groups = $user_groups = array();


// Divide data into profile data and current user data
$profile_groups = $user_groups = array();

Line 566Line 613
		unset($profile_groups);
unset($user_groups);
asort($group_sort);

		unset($profile_groups);
unset($user_groups);
asort($group_sort);

 

/**
* Modify group data before options is created and data is unset
*
* @event core.modify_memberlist_viewprofile_group_data
* @var array group_data Array containing the group data
* @var array group_sort Array containing the sorted group data
* @since 3.2.6-RC1
*/
$vars = array(
'group_data',
'group_sort',
);
extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_data', compact($vars)));


$group_options = '';
foreach ($group_sort as $group_id => $null)


$group_options = '';
foreach ($group_sort as $group_id => $null)

Line 702Line 763
			$member['posts_in_queue'] = 0;
}


			$member['posts_in_queue'] = 0;
}


		$template->assign_vars(array(
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']),


		// Define the main array of vars to assign to memberlist_view.html
$template_ary = array(
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']),





			'POSTS_DAY'			=> $user->lang('POST_DAY', $posts_per_day),
'POSTS_PCT' => $user->lang('POST_PCT', $percentage),

			'POSTS_DAY'					=> $user->lang('POST_DAY', $posts_per_day),
'POSTS_PCT' => $user->lang('POST_PCT', $percentage),





			'SIGNATURE'		=> $member['user_sig'],
'POSTS_IN_QUEUE'=> $member['posts_in_queue'],

			'SIGNATURE'					=> $member['user_sig'],
'POSTS_IN_QUEUE' => $member['posts_in_queue'],





			'PM_IMG'		=> $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $member['username']),
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),

			'PM_IMG'					=> $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $member['username']),
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),





			'S_PROFILE_ACTION'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'),
'S_GROUP_OPTIONS' => $group_options,
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && count($profile_fields['row'])) ? true : false,

			'S_PROFILE_ACTION'			=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'),
'S_GROUP_OPTIONS' => $group_options,
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && count($profile_fields['row'])) ? true : false,





			'U_USER_ADMIN'			=> ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
'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) : '',
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',

			'U_USER_ADMIN'				=> ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
'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) : '',
'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'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '',

			'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'] && $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_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false,
'U_ADD_FRIEND' => (!$friend && !$foe && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '',
'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '',

			'S_USER_NOTES'				=> ($user_notes_enabled) ? true : false,
'S_WARN_USER' => ($warn_user_enabled) ? true : false,
'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false,
'U_ADD_FRIEND' => (!$friend && !$foe && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '',
'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '',





			'U_CANONICAL'	=> generate_board_url() . '/' . append_sid("memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id, true, ''),
));
















			'U_CANONICAL'				=> generate_board_url() . '/' . append_sid("memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id, true, ''),
);

/**
* Modify user's template vars before we display the profile
*
* @event core.memberlist_modify_view_profile_template_vars
* @var array template_ary Array with user's template vars
* @since 3.2.6-RC1
*/
$vars = array(
'template_ary',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_view_profile_template_vars', compact($vars)));

// Assign vars to memberlist_view.html
$template->assign_vars($template_ary);


if (!empty($profile_fields['row']))
{


if (!empty($profile_fields['row']))
{

Line 996Line 1073

if ($active_time !== false)
{


if ($active_time !== false)
{

					$sql_where .= " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . $active_time;












					if ($active_select === 'lt' && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0)
{
$sql_where .= ' AND u.user_lastvisit = 0';
}
else if ($active_select === 'gt')
{
$sql_where .= ' AND u.user_lastvisit ' . $find_key_match[$active_select] . ' ' . $active_time;
}
else
{
$sql_where .= ' AND (u.user_lastvisit > 0 AND u.user_lastvisit < ' . $active_time . ')';
}

				}
}


				}
}


Line 1146Line 1234
			$avatar_img = phpbb_get_group_avatar($group_row);

// ... same for group rank

			$avatar_img = phpbb_get_group_avatar($group_row);

// ... same for group rank

			$user_rank_data = array(

			$group_rank_data = array(

				'title'		=> null,
'img' => null,
'img_src' => null,
);
if ($group_row['group_rank'])
{

				'title'		=> null,
'img' => null,
'img_src' => null,
);
if ($group_row['group_rank'])
{

				$user_rank_data = phpbb_get_user_rank($group_row, false);

				$group_rank_data = $group_helper->get_rank($group_row);





				if ($user_rank_data['img'])

				if ($group_rank_data['img'])

				{

				{

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

					$group_rank_data['img'] .= '<br />';

				}
}
// include modules for manage groups link display or not

				}
}
// include modules for manage groups link display or not

Line 1184Line 1272
				'GROUP_NAME'	=> $group_helper->get_name($group_row['group_name']),
'GROUP_COLOR' => $group_row['group_colour'],
'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']],

				'GROUP_NAME'	=> $group_helper->get_name($group_row['group_name']),
'GROUP_COLOR' => $group_row['group_colour'],
'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']],

				'GROUP_RANK'	=> $user_rank_data['title'],

				'GROUP_RANK'	=> $group_rank_data['title'],


'AVATAR_IMG' => $avatar_img,


'AVATAR_IMG' => $avatar_img,

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

				'RANK_IMG'		=> $group_rank_data['img'],
'RANK_IMG_SRC' => $group_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_MANAGE' => ($can_manage_group) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_groups&amp;mode=manage') : false,)


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

Line 1307Line 1395
			$u_first_char_params[] = "mode=$mode";
}
$sort_params[] = "mode=$mode";

			$u_first_char_params[] = "mode=$mode";
}
$sort_params[] = "mode=$mode";


$pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&amp;', $params));
$sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&amp;', $sort_params));

unset($search_params, $sort_params);

 

$u_first_char_params = implode('&amp;', $u_first_char_params);
$u_first_char_params .= ($u_first_char_params) ? '&amp;' : '';


$u_first_char_params = implode('&amp;', $u_first_char_params);
$u_first_char_params .= ($u_first_char_params) ? '&amp;' : '';

Line 1323Line 1406
			$first_characters[chr($i)] = chr($i - 32);
}
$first_characters['other'] = $user->lang['OTHER'];

			$first_characters[chr($i)] = chr($i - 32);
}
$first_characters['other'] = $user->lang['OTHER'];

 

$first_char_block_vars = [];


foreach ($first_characters as $char => $desc)
{


foreach ($first_characters as $char => $desc)
{

			$template->assign_block_vars('first_char', array(

			$first_char_block_vars[] = [

				'DESC'			=> $desc,
'VALUE' => $char,
'S_SELECTED' => ($first_char == $char) ? true : false,
'U_SORT' => append_sid("{$phpbb_root_path}memberlist.$phpEx", $u_first_char_params . 'first_char=' . $char) . '#memberlist',

				'DESC'			=> $desc,
'VALUE' => $char,
'S_SELECTED' => ($first_char == $char) ? true : false,
'U_SORT' => append_sid("{$phpbb_root_path}memberlist.$phpEx", $u_first_char_params . 'first_char=' . $char) . '#memberlist',

			));

			];

		}

		}

 

/**
* Modify memberlist sort and pagination parameters
*
* @event core.memberlist_modify_sort_pagination_params
* @var array sort_params Array with URL parameters for sorting
* @var array params Array with URL parameters for pagination
* @var array first_characters Array that maps each letter in a-z, 'other' and the empty string to their display representation
* @var string u_first_char_params Concatenated URL parameters for first character search links
* @var array first_char_block_vars Template block variables for each first character
* @var int total_users Total number of users found in this search
* @since 3.2.6-RC1
*/
$vars = [
'sort_params',
'params',
'first_characters',
'u_first_char_params',
'first_char_block_vars',
'total_users',
];
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sort_pagination_params', compact($vars)));

$template->assign_block_vars_array('first_char', $first_char_block_vars);

$pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&amp;', $params));
$sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&amp;', $sort_params));

unset($search_params, $sort_params);


// Some search user specific data
if (($mode == '' || $mode == 'searchuser') && ($config['load_search'] || $auth->acl_get('a_')))


// Some search user specific data
if (($mode == '' || $mode == 'searchuser') && ($config['load_search'] || $auth->acl_get('a_')))

Line 1469Line 1583
			// Do the SQL thang
if ($mode == 'group')
{

			// Do the SQL thang
if ($mode == 'group')
{

				$sql = "SELECT u.*
$sql_select
FROM " . USERS_TABLE . " u
$sql_from
WHERE " . $db->sql_in_set('u.user_id', $user_list) . "
$sql_where_data";














				$sql_from_ary = explode(',', $sql_from);
$extra_tables = [];
foreach ($sql_from_ary as $entry)
{
$table_data = explode(' ', trim($entry));

if (empty($table_data[0]) || empty($table_data[1]))
{
continue;
}

$extra_tables[$table_data[0]] = $table_data[1];
}

$sql_array = array(
'SELECT' => 'u.*' . $sql_select,
'FROM' => array_merge([USERS_TABLE => 'u'], $extra_tables),
'WHERE' => $db->sql_in_set('u.user_id', $user_list) . $sql_where_data . '',
);

			}
else
{

			}
else
{

				$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $user_list);





				$sql_array = array(
'SELECT' => 'u.*',
'FROM' => array(
USERS_TABLE => 'u'
),
'WHERE' => $db->sql_in_set('u.user_id', $user_list),
);

			}

			}

 

/**
* Modify user data SQL before member row is created
*
* @event core.memberlist_modify_memberrow_sql
* @var string mode Memberlist mode
* @var string sql_select Additional select statement
* @var string sql_from Additional from statement
* @var array sql_array Array containing the main query
* @var array user_list Array containing list of users
* @since 3.2.6-RC1
*/
$vars = array(
'mode',
'sql_select',
'sql_from',
'sql_array',
'user_list',
);
extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_memberrow_sql', compact($vars)));

$sql = $db->sql_build_query('SELECT', $sql_array);

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

$id_cache = array();

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

$id_cache = array();

Line 1492Line 1645

$id_cache[$row['user_id']] = $row;
}


$id_cache[$row['user_id']] = $row;
}

 


			$db->sql_freeresult($result);


			$db->sql_freeresult($result);


			// Load custom profile fields

			// Load custom profile fields if required

			if ($config['load_cpf_memberlist'])
{
// Grab all profile fields from users in id cache for later use - similar to the poster cache

			if ($config['load_cpf_memberlist'])
{
// Grab all profile fields from users in id cache for later use - similar to the poster cache