phpBB

Code Changes

File: includes/acp/acp_users.php

  Unmodified   Added   Modified   Removed
Line 43Line 43
		$username	= utf8_normalize_nfc(request_var('username', '', true));
$user_id = request_var('u', 0);
$action = request_var('action', '');

		$username	= utf8_normalize_nfc(request_var('username', '', true));
$user_id = request_var('u', 0);
$action = request_var('action', '');

 

// Get referer to redirect user to the appropriate page after delete action
$redirect = request_var('redirect', '');
$redirect_tag = "redirect=$redirect";
$redirect_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$redirect");


$submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false;



$submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false;


Line 51Line 56

// Whois (special case)
if ($action == 'whois')


// Whois (special case)
if ($action == 'whois')

 
		{
if (!function_exists('user_get_id_name'))

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

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

 
			}


$this->page_title = 'WHOIS';
$this->tpl_name = 'simple_body';


$this->page_title = 'WHOIS';
$this->tpl_name = 'simple_body';

Line 146Line 154
		}

$template->assign_vars(array(

		}

$template->assign_vars(array(

			'U_BACK'			=> $this->u_action,

			'U_BACK'			=> (empty($redirect)) ? $this->u_action : $redirect_url,

			'U_MODE_SELECT'		=> append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"),

			'U_MODE_SELECT'		=> append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"),

			'U_ACTION'			=> $this->u_action . '&u=' . $user_id,

			'U_ACTION'			=> $this->u_action . '&u=' . $user_id . ((empty($redirect)) ? '' : '&' . $redirect_tag),

			'S_FORM_OPTIONS'	=> $s_form_options,
'MANAGED_USERNAME' => $user_row['username'])
);

			'S_FORM_OPTIONS'	=> $s_form_options,
'MANAGED_USERNAME' => $user_row['username'])
);

Line 165Line 173
		{
case 'overview':


		{
case 'overview':


 
				if (!function_exists('user_get_id_name'))
{

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

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

 
				}


$user->add_lang('acp/ban');



$user->add_lang('acp/ban');


Line 221Line 232
								user_delete($delete_type, $user_id, $user_row['username']);

add_log('admin', 'LOG_USER_DELETED', $user_row['username']);

								user_delete($delete_type, $user_id, $user_row['username']);

add_log('admin', 'LOG_USER_DELETED', $user_row['username']);

								trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action));




								trigger_error($user->lang['USER_DELETED'] . adm_back_link(
(empty($redirect)) ? $this->u_action : $redirect_url
)
);

							}
else
{

							}
else
{

								confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(

								$delete_confirm_hidden_fields = array(

									'u'				=> $user_id,
'i' => $id,
'mode' => $mode,
'action' => $action,
'update' => true,
'delete' => 1,

									'u'				=> $user_id,
'i' => $id,
'mode' => $mode,
'action' => $action,
'update' => true,
'delete' => 1,

									'delete_type'	=> $delete_type))

									'delete_type'	=> $delete_type,

								);

								);

 

// Checks if the redirection page is specified
if (!empty($redirect))
{
$delete_confirm_hidden_fields['redirect'] = $redirect;
}

confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($delete_confirm_hidden_fields));

							}
}
else

							}
}
else

Line 338Line 360

if ($config['email_enable'])
{


if ($config['email_enable'])
{

								include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);




								if (!class_exists('messenger'))
{
include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
}


$server_url = generate_board_url();



$server_url = generate_board_url();


Line 348Line 373
								if ($user_row['user_type'] == USER_NORMAL)
{
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);

								if ($user_row['user_type'] == USER_NORMAL)
{
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);


$sql = 'UPDATE ' . USERS_TABLE . "
SET user_actkey = '" . $db->sql_escape($user_actkey) . "'
WHERE user_id = $user_id";
$db->sql_query($sql);

 
								}
else
{

								}
else
{

Line 361Line 381
										FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);

										FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);

									$user_actkey = (string) $db->sql_fetchfield('user_actkey');

									$user_activation_key = (string) $db->sql_fetchfield('user_actkey');

									$db->sql_freeresult($result);

									$db->sql_freeresult($result);

 

$user_actkey = empty($user_activation_key) ? $user_actkey : $user_activation_key;
}

if ($user_row['user_type'] == USER_NORMAL || empty($user_activation_key))
{
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_actkey = '" . $db->sql_escape($user_actkey) . "'
WHERE user_id = $user_id";
$db->sql_query($sql);

								}

$messenger = new messenger(false);

								}

$messenger = new messenger(false);

Line 421Line 451
									$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);


									$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);


									include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);




									if (!class_exists('messenger'))
{
include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
}


$messenger = new messenger(false);



$messenger = new messenger(false);


Line 1345Line 1378

case 'profile':



case 'profile':


 
				if (!function_exists('user_get_id_name'))
{

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

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

 
				}


$cp = $phpbb_container->get('profilefields.manager');



$cp = $phpbb_container->get('profilefields.manager');


Line 1504Line 1540

case 'prefs':



case 'prefs':


 
				if (!function_exists('user_get_id_name'))
{

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

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

 
				}


$data = array(
'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)),


$data = array(
'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)),

Line 1553Line 1592
				if ($submit)
{
$error = validate_data($data, array(

				if ($submit)
{
$error = validate_data($data, array(

						'dateformat'	=> array('string', false, 1, 30),

						'dateformat'	=> array('string', false, 1, 64),

						'lang'			=> array('match', false, '#^[a-z_\-]{2,}$#i'),
'tz' => array('timezone'),


						'lang'			=> array('match', false, '#^[a-z_\-]{2,}$#i'),
'tz' => array('timezone'),


Line 1773Line 1812
			break;

case 'avatar':

			break;

case 'avatar':


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

 

$avatars_enabled = false;


$avatars_enabled = false;

 
				/** @var \phpbb\avatar\manager $phpbb_avatar_manager */
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');


if ($config['allow_avatar'])
{


if ($config['allow_avatar'])
{

					$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');

 
					$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();

// This is normalised data, without the user_ prefix

					$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();

// This is normalised data, without the user_ prefix

Line 1840Line 1878
					}

$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type']));

					}

$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type']));

 

// Assign min and max values before generating avatar driver html
$template->assign_vars(array(
'AVATAR_MIN_WIDTH' => $config['avatar_min_width'],
'AVATAR_MAX_WIDTH' => $config['avatar_max_width'],
'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'],
'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'],
));


foreach ($avatar_drivers as $current_driver)
{
$driver = $phpbb_avatar_manager->get_driver($current_driver);

$avatars_enabled = true;


foreach ($avatar_drivers as $current_driver)
{
$driver = $phpbb_avatar_manager->get_driver($current_driver);

$avatars_enabled = true;

						$config_name = $phpbb_avatar_manager->get_driver_config_name($driver);

 
						$template->set_filenames(array(

						$template->set_filenames(array(

							'avatar' => "acp_avatar_options_{$config_name}.html",

							'avatar' => $driver->get_acp_template_name(),

						));

if ($driver->prepare_form($request, $template, $user, $avatar_data, $error))

						));

if ($driver->prepare_form($request, $template, $user, $avatar_data, $error))

Line 1868Line 1913
					}
}


					}
}


 
				// Avatar manager is not initialized if avatars are disabled
if (isset($phpbb_avatar_manager))
{

				// Replace "error" strings with their real, localised form
$error = $phpbb_avatar_manager->localize_errors($user, $error);

				// Replace "error" strings with their real, localised form
$error = $phpbb_avatar_manager->localize_errors($user, $error);

 
				}


$avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true);



$avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true);


Line 1880Line 1929

'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',



'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',


					'L_AVATAR_EXPLAIN'	=> sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),

					'L_AVATAR_EXPLAIN'	=> $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),


'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
));


'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
));

Line 1930Line 1979

case 'sig':



case 'sig':


				include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);








				if (!function_exists('generate_smilies'))
{
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
}

if (!function_exists('display_custom_bbcodes'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}


$enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false;
$enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false;


$enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false;
$enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false;

Line 1942Line 1998

if ($submit || $preview)
{


if ($submit || $preview)
{

					include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);




					if (!class_exists('messenger'))
{
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
}


$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;


$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;

Line 2183Line 2242

case 'groups':



case 'groups':


 
				if (!function_exists('group_user_attributes'))
{

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

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

 
				}


$user->add_lang(array('groups', 'acp/groups'));
$group_id = request_var('g', 0);


$user->add_lang(array('groups', 'acp/groups'));
$group_id = request_var('g', 0);

Line 2217Line 2279
						{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}

						{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}

 

if (!check_link_hash($request->variable('hash', ''), 'acp_users'))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}


						group_user_attributes($action, $group_id, $user_id);

if ($action == 'default')

						group_user_attributes($action, $group_id, $user_id);

if ($action == 'default')

Line 2374Line 2442
					{
$template->assign_block_vars('group', array(
'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"),

					{
$template->assign_block_vars('group', array(
'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"),

							'U_DEFAULT'			=> $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'],
'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'],

							'U_DEFAULT'			=> $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'),
'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'),

							'U_DELETE'			=> $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'],
'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '',


							'U_DELETE'			=> $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'],
'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '',


Line 2399Line 2467

case 'perm':



case 'perm':


				include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);




				if (!class_exists('auth_admin'))
{
include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
}


$auth_admin = new auth_admin();



$auth_admin = new auth_admin();