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

$delete = request_var('delete', 0);
$delete_type = request_var('delete_type', '');
$ip = request_var('ip', 'ip');


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

$delete = request_var('delete', 0);
$delete_type = request_var('delete_type', '');
$ip = request_var('ip', 'ip');

 

/**
* Run code at beginning of ACP users overview
*
* @event core.acp_users_overview_before
* @var array user_row Current user data
* @var string mode Active module
* @var string action Module that should be run
* @var bool submit Do we display the form only
* or did the user press submit
* @var array error Array holding error messages
* @since 3.1.3-RC1
*/
$vars = array('user_row', 'mode', 'action', 'submit', 'error');
extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars)));


if ($submit)
{


if ($submit)
{

Line 206Line 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 323Line 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 406Line 446
									$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 1330Line 1373

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 1361Line 1407
				$data['bday_month']		= request_var('bday_month', $data['bday_month']);
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);

				$data['bday_month']		= request_var('bday_month', $data['bday_month']);
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);

 

/**
* Modify user data on editing profile in ACP
*
* @event core.acp_users_modify_profile
* @var array data Array with user profile data
* @var bool submit Flag indicating if submit button has been pressed
* @var int user_id The user id
* @var array user_row Array with the full user data
* @since 3.1.4-RC1
*/
$vars = array('data', 'submit', 'user_id', 'user_row');
extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_profile', compact($vars)));


if ($submit)
{


if ($submit)
{

Line 1385Line 1444
					{
$error[] = 'FORM_INVALID';
}

					{
$error[] = 'FORM_INVALID';
}

 

/**
* Validate profile data in ACP before submitting to the database
*
* @event core.acp_users_profile_validate
* @var bool submit Flag indicating if submit button has been pressed
* @var array data Array with user profile data
* @var array error Array with the form errors
* @since 3.1.4-RC1
*/
$vars = array('submit', 'data', 'error');
extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars)));


if (!sizeof($error))
{


if (!sizeof($error))
{

Line 1392Line 1463
							'user_jabber'	=> $data['jabber'],
'user_birthday' => $data['user_birthday'],
);

							'user_jabber'	=> $data['jabber'],
'user_birthday' => $data['user_birthday'],
);

 

/**
* Modify profile data in ACP before submitting to the database
*
* @event core.acp_users_profile_modify_sql_ary
* @var array cp_data Array with the user custom profile fields data
* @var array data Array with user profile data
* @var int user_id The user id
* @var array user_row Array with the full user data
* @var array sql_ary Array with sql data
* @since 3.1.4-RC1
*/
$vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars)));


$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "


$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "

Line 1450Line 1535

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 1499Line 1587
				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 1719Line 1807
			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 1786Line 1873
					}

$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 1814Line 1908
					}
}


					}
}


 
				// 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 1876Line 1974

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 1888Line 1993

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 2129Line 2237

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 2163Line 2274
						{
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 2320Line 2437
					{
$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 2345Line 2462

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();