phpBB

Code Changes

File: includes/ucp/ucp_profile.php

  Unmodified   Added   Modified   Removed
Line 78Line 78

$error = validate_data($data, $check_ary);



$error = validate_data($data, $check_ary);


					if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])

					if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email'])

					{

					{

						$error[] = 'NEW_PASSWORD_ERROR';

						$error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY';

					}


					}


					if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password']))

					if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])

					{

					{

						$error[] = 'CUR_PASSWORD_ERROR';

						$error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';

					}

// Only check the new password against the previous password if there have been no errors

					}

// Only check the new password against the previous password if there have been no errors

Line 94Line 94
						$error[] = 'SAME_PASSWORD_ERROR';
}


						$error[] = 'SAME_PASSWORD_ERROR';
}


					if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email'])

					if (!phpbb_check_hash($data['cur_password'], $user->data['user_password']))

					{

					{

						$error[] = 'NEW_EMAIL_ERROR';

						$error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';

					}

if (!check_form_key('ucp_reg_details'))

					}

if (!check_form_key('ucp_reg_details'))

Line 110Line 110
							'username'			=> ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'],
'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'],
'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'],

							'username'			=> ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'],
'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'],
'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'],

							'user_email_hash'	=> ($auth->acl_get('u_chgemail')) ? crc32($data['email']) . strlen($data['email']) : $user->data['user_email_hash'],

							'user_email_hash'	=> ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'],

							'user_password'		=> ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'],
'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0,
);

							'user_password'		=> ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'],
'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0,
);

Line 133Line 133

$message = 'PROFILE_UPDATED';



$message = 'PROFILE_UPDATED';


						if ($config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))

						if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))

						{
$message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';


						{
$message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';


Line 141Line 141

$server_url = generate_board_url();



$server_url = generate_board_url();


							$user_actkey = gen_rand_string(10);
$key_len = 54 - (strlen($server_url));
$key_len = ($key_len > 6) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);

							$user_actkey = gen_rand_string(mt_rand(6, 10));





$messenger = new messenger(false);



$messenger = new messenger(false);


Line 153Line 150

$messenger->to($data['email'], $data['username']);



$messenger->to($data['email'], $data['username']);


							$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);

							$messenger->anti_abuse_headers($config, $user);





$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($data['username']),


$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($data['username']),

Line 315Line 309
						'website'		=> array(
array('string', true, 12, 255),
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),

						'website'		=> array(
array('string', true, 12, 255),
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),

						'location'		=> array('string', true, 2, 255),

						'location'		=> array('string', true, 2, 100),

						'occupation'	=> array('string', true, 2, 500),
'interests' => array('string', true, 2, 500),
);

						'occupation'	=> array('string', true, 2, 500),
'interests' => array('string', true, 2, 500),
);

Line 347Line 341

if (!sizeof($error))
{


if (!sizeof($error))
{

 
						$data['notify'] = $user->data['user_notify_type'];

if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')))
{
// User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled)
// Disable notify by Jabber now for this user.
$data['notify'] = NOTIFY_EMAIL;
}


						$sql_ary = array(
'user_icq' => $data['icq'],
'user_aim' => $data['aim'],

						$sql_ary = array(
'user_icq' => $data['icq'],
'user_aim' => $data['aim'],

Line 357Line 360
							'user_from'		=> $data['location'],
'user_occ' => $data['occupation'],
'user_interests'=> $data['interests'],

							'user_from'		=> $data['location'],
'user_occ' => $data['occupation'],
'user_interests'=> $data['interests'],

 
							'user_notify_type'	=> $data['notify'],

						);

if ($config['allow_birthdays'])

						);

if ($config['allow_birthdays'])

Line 370Line 374
						$db->sql_query($sql);

// Update Custom Fields

						$db->sql_query($sql);

// Update Custom Fields

						if (sizeof($cp_data))
{
$sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $cp_data) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);

if (!$db->sql_affectedrows())
{
$cp_data['user_id'] = (int) $user->data['user_id'];

$db->sql_return_on_error(true);

$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data);
$db->sql_query($sql);

$db->sql_return_on_error(false);
}
}

						$cp->update_profile_field_data($user->data['user_id'], $cp_data);




















meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');


meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');

Line 418Line 404

$now = getdate();
$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';


$now = getdate();
$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';

					for ($i = $now['year'] - 100; $i < $now['year']; $i++)

					for ($i = $now['year'] - 100; $i <= $now['year']; $i++)

					{
$selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";

					{
$selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";

Line 464Line 450
				include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);


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


				$enable_bbcode	= ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false;
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;

				$enable_bbcode	= ($config['allow_sig_bbcode']) ? (bool) $user->optionget('sig_bbcode') : false;
$enable_smilies = ($config['allow_sig_smilies']) ? (bool) $user->optionget('sig_smilies') : false;
$enable_urls = ($config['allow_sig_links']) ? (bool) $user->optionget('sig_links') : false;


$signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));



$signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));


Line 475Line 461
				if ($submit || $preview)
{
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);

				if ($submit || $preview)
{
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_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;


if (!sizeof($error))
{


if (!sizeof($error))
{

Line 495Line 485

if (!sizeof($error) && $submit)
{


if (!sizeof($error) && $submit)
{

 
							$user->optionset('sig_bbcode', $enable_bbcode);
$user->optionset('sig_smilies', $enable_smilies);
$user->optionset('sig_links', $enable_urls);


							$sql_ary = array(
'user_sig' => (string) $message_parser->message,

							$sql_ary = array(
'user_sig' => (string) $message_parser->message,

 
								'user_options'				=> $user->data['user_options'],

								'user_sig_bbcode_uid'		=> (string) $message_parser->bbcode_uid,
'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
);

								'user_sig_bbcode_uid'		=> (string) $message_parser->bbcode_uid,
'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
);

Line 539Line 534
					'IMG_STATUS'			=> ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],

					'IMG_STATUS'			=> ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],

 
					'MAX_FONT_SIZE'			=> (int) $config['max_sig_font_size'],


'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),



'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),


Line 551Line 547

// Build custom bbcodes array
display_custom_bbcodes();


// Build custom bbcodes array
display_custom_bbcodes();

 

// Generate smiley listing
generate_smilies('inline', 0);


break;



break;


Line 562Line 561
				$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));


				$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));


				$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;

				$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;


add_form_key('ucp_avatar');



add_form_key('ucp_avatar');


Line 570Line 569
				{
if (check_form_key('ucp_avatar'))
{

				{
if (check_form_key('ucp_avatar'))
{

						if (avatar_process_user($error))

						if (avatar_process_user($error, false, $can_upload))

						{
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');

						{
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');

Line 583Line 582
					}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);

					}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);

 
				}

if (!$config['allow_avatar'] && $user->data['user_avatar_type'])
{
$error[] = $user->lang['AVATAR_NOT_ALLOWED'];
}
else if ((($user->data['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) ||
(($user->data['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) ||
(($user->data['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local']))
{
$error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];

				}

$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',

				}

$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',

					'AVATAR'		=> get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),

					'AVATAR'		=> get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true),

					'AVATAR_SIZE'	=> $config['avatar_filesize'],

'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&amp;mode=avatar&amp;display_gallery=1'),


					'AVATAR_SIZE'	=> $config['avatar_filesize'],

'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&amp;mode=avatar&amp;display_gallery=1'),


					'S_FORM_ENCTYPE'	=> ($can_upload) ? ' enctype="multipart/form-data"' : '',

					'S_FORM_ENCTYPE'	=> ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' 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' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
));


				if ($display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])

				if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])

				{
avatar_gallery($category, $avatar_select, 4);
}

				{
avatar_gallery($category, $avatar_select, 4);
}

				else

				else if ($config['allow_avatar'])

				{

				{

					$avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;

					$avatars_enabled = (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;

					
$template->assign_vars(array(
'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']),
'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']),

'S_AVATARS_ENABLED' => $avatars_enabled,

					
$template->assign_vars(array(
'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']),
'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']),

'S_AVATARS_ENABLED' => $avatars_enabled,

						'S_UPLOAD_AVATAR_FILE'	=> $can_upload,
'S_UPLOAD_AVATAR_URL' => $can_upload,

						'S_UPLOAD_AVATAR_FILE'	=> ($can_upload && $config['allow_avatar_upload']) ? true : false,
'S_UPLOAD_AVATAR_URL' => ($can_upload && $config['allow_avatar_remote_upload']) ? true : false,

						'S_LINK_AVATAR'			=> ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
);

						'S_LINK_AVATAR'			=> ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
);