phpBB

Code Changes

File: includes/acp/acp_profile.php

  Unmodified   Added   Modified   Removed
Line 31Line 31
	{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;

	{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;

		global $request, $phpbb_container;

		global $request, $phpbb_container, $phpbb_dispatcher;





 
		if (!function_exists('generate_smilies'))
{

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

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

 
		}

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(array('ucp', 'acp/profile'));
$this->tpl_name = 'acp_profile';


$user->add_lang(array('ucp', 'acp/profile'));
$this->tpl_name = 'acp_profile';

Line 45Line 52

$error = array();
$s_hidden_fields = '';


$error = array();
$s_hidden_fields = '';

 

$form_key = 'acp_profile';
add_form_key($form_key);


if (!$field_id && in_array($action, array('delete','activate', 'deactivate', 'move_up', 'move_down', 'edit')))
{


if (!$field_id && in_array($action, array('delete','activate', 'deactivate', 'move_up', 'move_down', 'edit')))
{

Line 153Line 163
			break;

case 'activate':

			break;

case 'activate':

 

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


$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "


$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "

Line 193Line 208
			break;

case 'deactivate':

			break;

case 'deactivate':

 

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


$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
SET field_active = 0


$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
SET field_active = 0

Line 222Line 242

case 'move_up':
case 'move_down':


case 'move_up':
case 'move_down':

 

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


$sql = 'SELECT field_order
FROM ' . PROFILE_FIELDS_TABLE . "


$sql = 'SELECT field_order
FROM ' . PROFILE_FIELDS_TABLE . "

Line 368Line 393
					'field_hide',
'field_is_contact',
);

					'field_hide',
'field_is_contact',
);

 

/**
* Event to add initialization for new profile field table fields
*
* @event core.acp_profile_create_edit_init
* @var string action create|edit
* @var int step Configuration step (1|2|3)
* @var bool submit Form has been submitted
* @var bool save Configuration should be saved
* @var string field_type Type of the field we are dealing with
* @var array field_row Array of data about the field
* @var array exclude Array of excluded fields by step
* @var array visibility_ary Array of fields that are visibility related
* @since 3.1.6-RC1
*/
$vars = array(
'action',
'step',
'submit',
'save',
'field_type',
'field_row',
'exclude',
'visibility_ary',
);
extract($phpbb_dispatcher->trigger_event('core.acp_profile_create_edit_init', compact($vars)));


$options = $profile_field->prepare_options_form($exclude, $visibility_ary);



$options = $profile_field->prepare_options_form($exclude, $visibility_ary);


Line 510Line 561
						}
}
}

						}
}
}


$step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step);

 

if (sizeof($error))
{


if (sizeof($error))
{

					$step--;

 
					$submit = false;

					$submit = false;

 
				}
else
{
$step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step);

				}

// Build up the specific hidden fields

				}

// Build up the specific hidden fields

Line 535Line 587
						$var = $profile_field->prepare_hidden_fields($step, $key, $action, $field_data);
if ($var !== null)
{

						$var = $profile_field->prepare_hidden_fields($step, $key, $action, $field_data);
if ($var !== null)
{

							$_new_key_ary[$key] = $profile_field->prepare_hidden_fields($step, $key, $action, $field_data);

							$_new_key_ary[$key] = $var;

						}
}
$cp->vars = $field_data;

						}
}
$cp->vars = $field_data;

Line 545Line 597

if (!sizeof($error))
{


if (!sizeof($error))
{

					if ($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save))

					if (($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save))

					{

					{

						$this->save_profile_field($cp, $field_type, $action);
}
else if ($action == 'edit' && $save)

						if (!check_form_key($form_key))



					{

					{

 
							trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}


						$this->save_profile_field($cp, $field_type, $action);
}
}

						$this->save_profile_field($cp, $field_type, $action);
}
}

Line 643Line 696

break;
}


break;
}

 

$field_data = $cp->vars;
/**
* Event to add template variables for new profile field table fields
*
* @event core.acp_profile_create_edit_after
* @var string action create|edit
* @var int step Configuration step (1|2|3)
* @var bool submit Form has been submitted
* @var bool save Configuration should be saved
* @var string field_type Type of the field we are dealing with
* @var array field_data Array of data about the field
* @var array s_hidden_fields Array of hidden fields in case this needs modification
* @var array options Array of options specific to this step
* @since 3.1.6-RC1
*/
$vars = array(
'action',
'step',
'submit',
'save',
'field_type',
'field_data',
's_hidden_fields',
'options',
);
extract($phpbb_dispatcher->trigger_event('core.acp_profile_create_edit_after', compact($vars)));


$template->assign_vars(array(
'S_HIDDEN_FIELDS' => $s_hidden_fields)


$template->assign_vars(array(
'S_HIDDEN_FIELDS' => $s_hidden_fields)

Line 672Line 752
				$s_one_need_edit = true;
}


				$s_one_need_edit = true;
}


 
			if (!isset($this->type_collection[$row['field_type']]))
{
continue;
}

			$profile_field = $this->type_collection[$row['field_type']];
$template->assign_block_vars('fields', array(
'FIELD_IDENT' => $row['field_ident'],
'FIELD_TYPE' => $profile_field->get_name(),

'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang],

			$profile_field = $this->type_collection[$row['field_type']];
$template->assign_block_vars('fields', array(
'FIELD_IDENT' => $row['field_ident'],
'FIELD_TYPE' => $profile_field->get_name(),

'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang],

				'U_ACTIVATE_DEACTIVATE'		=> $this->u_action . "&action=$active_value&field_id=$id",

				'U_ACTIVATE_DEACTIVATE'		=> $this->u_action . "&action=$active_value&field_id=$id" . '&hash=' . generate_link_hash('acp_profile'),

				'U_EDIT'					=> $this->u_action . "&action=edit&field_id=$id",
'U_TRANSLATE' => $this->u_action . "&action=edit&field_id=$id&step=3",
'U_DELETE' => $this->u_action . "&action=delete&field_id=$id",

				'U_EDIT'					=> $this->u_action . "&action=edit&field_id=$id",
'U_TRANSLATE' => $this->u_action . "&action=edit&field_id=$id&step=3",
'U_DELETE' => $this->u_action . "&action=delete&field_id=$id",

				'U_MOVE_UP'					=> $this->u_action . "&action=move_up&field_id=$id",
'U_MOVE_DOWN' => $this->u_action . "&action=move_down&field_id=$id",

				'U_MOVE_UP'					=> $this->u_action . "&action=move_up&field_id=$id" . '&hash=' . generate_link_hash('acp_profile'),
'U_MOVE_DOWN' => $this->u_action . "&action=move_down&field_id=$id" . '&hash=' . generate_link_hash('acp_profile'),


'S_NEED_EDIT' => $s_need_edit)
);


'S_NEED_EDIT' => $s_need_edit)
);

Line 810Line 894
	*/
function save_profile_field(&$cp, $field_type, $action = 'create')
{

	*/
function save_profile_field(&$cp, $field_type, $action = 'create')
{

		global $db, $config, $user, $phpbb_container;

		global $db, $config, $user, $phpbb_container, $phpbb_dispatcher;


$field_id = request_var('field_id', 0);



$field_id = request_var('field_id', 0);


Line 851Line 935
			'field_contact_desc'	=> $cp->vars['field_contact_desc'],
'field_contact_url' => $cp->vars['field_contact_url'],
);

			'field_contact_desc'	=> $cp->vars['field_contact_desc'],
'field_contact_url' => $cp->vars['field_contact_url'],
);

 

$field_data = $cp->vars;
/**
* Event to modify profile field configuration data before saving to database
*
* @event core.acp_profile_create_edit_save_before
* @var string action create|edit
* @var string field_type Type of the field we are dealing with
* @var array field_data Array of data about the field
* @var array profile_fields Array of fields to be sent to the database
* @since 3.1.6-RC1
*/
$vars = array(
'action',
'field_type',
'field_data',
'profile_fields',
);
extract($phpbb_dispatcher->trigger_event('core.acp_profile_create_edit_save_before', compact($vars)));


if ($action == 'create')
{


if ($action == 'create')
{