phpBB

Code Changes

File: includes/acp/acp_profile.php

  Unmodified   Added   Modified   Removed
Line 446Line 446
				{
$exploded_options = (is_array($options)) ? $options : explode("\n", $options);


				{
$exploded_options = (is_array($options)) ? $options : explode("\n", $options);


					if (sizeof($exploded_options) == sizeof($lang_options) || $action == 'create')

					if (count($exploded_options) == count($lang_options) || $action == 'create')

					{
// The number of options in the field is equal to the number of options already in the database
// Or we are creating a new dropdown list.

					{
// The number of options in the field is equal to the number of options already in the database
// Or we are creating a new dropdown list.

Line 567Line 567
					}
}


					}
}


				if (sizeof($error))

				if (count($error))

				{
$submit = false;
}

				{
$submit = false;
}

Line 600Line 600
					$s_hidden_fields .= build_hidden_fields($_new_key_ary);
}


					$s_hidden_fields .= build_hidden_fields($_new_key_ary);
}


				if (!sizeof($error))

				if (!count($error))

				{

				{

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

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

					{
if (!check_form_key($form_key))
{

					{
if (!check_form_key($form_key))
{

Line 616Line 616
				$template->assign_vars(array(
'S_EDIT' => true,
'S_EDIT_MODE' => ($action == 'edit') ? true : false,

				$template->assign_vars(array(
'S_EDIT' => true,
'S_EDIT_MODE' => ($action == 'edit') ? true : false,

					'ERROR_MSG'			=> (sizeof($error)) ? implode('<br />', $error) : '',

					'ERROR_MSG'			=> (count($error)) ? implode('<br />', $error) : '',


'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)],
'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)],


'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)],
'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)],

Line 664Line 664

$template->assign_vars(array(
'S_STEP_TWO' => true,


$template->assign_vars(array(
'S_STEP_TWO' => true,

							'L_NEXT_STEP'			=> (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS'])

							'L_NEXT_STEP'			=> (count($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS'])

						);

// Build options based on profile type

						);

// Build options based on profile type

Line 737Line 737

break;
}


break;
}

 

$tpl_name = $this->tpl_name;
$page_title = $this->page_title;
$u_action = $this->u_action;

/**
* Event to handle actions on the ACP profile fields page
*
* @event core.acp_profile_action
* @var string action Action that is being performed
* @var string tpl_name Template file to load
* @var string page_title Page title
* @var string u_action The URL we are at, read only
* @since 3.2.2-RC1
*/
$vars = array(
'action',
'tpl_name',
'page_title',
'u_action',
);
extract($phpbb_dispatcher->trigger_event('core.acp_profile_action', compact($vars)));

$this->tpl_name = $tpl_name;
$this->page_title = $page_title;
unset($u_action);


$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_TABLE . '


$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_TABLE . '

Line 750Line 776
			$active_value = (!$row['field_active']) ? 'activate' : 'deactivate';
$id = $row['field_id'];


			$active_value = (!$row['field_active']) ? 'activate' : 'deactivate';
$id = $row['field_id'];


			$s_need_edit = (sizeof($this->lang_defs['diff'][$row['field_id']])) ? true : false;

			$s_need_edit = (count($this->lang_defs['diff'][$row['field_id']])) ? true : false;


if ($s_need_edit)
{


if ($s_need_edit)
{

Line 762Line 788
				continue;
}
$profile_field = $this->type_collection[$row['field_type']];

				continue;
}
$profile_field = $this->type_collection[$row['field_type']];

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



$field_block = array(

				'FIELD_IDENT'		=> $row['field_ident'],
'FIELD_TYPE' => $profile_field->get_name(),


				'FIELD_IDENT'		=> $row['field_ident'],
'FIELD_TYPE' => $profile_field->get_name(),


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


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


				'S_NEED_EDIT'				=> $s_need_edit)

				'S_NEED_EDIT'				=> $s_need_edit,

			);

			);

 

/**
* Event to modify profile field data before it is assigned to the template
*
* @event core.acp_profile_modify_profile_row
* @var array row Array with data for the current profile field
* @var array field_block Template data that is being assigned to the 'fields' block
* @var object profile_field A profile field instance, implements \phpbb\profilefields\type\type_base
* @since 3.2.2-RC1
*/
$vars = array(
'row',
'field_block',
'profile_field',
);
extract($phpbb_dispatcher->trigger_event('core.acp_profile_modify_profile_row', compact($vars)));

$template->assign_block_vars('fields', $field_block);

		}
$db->sql_freeresult($result);


		}
$db->sql_freeresult($result);


Line 1011Line 1056
			$this->update_insert(PROFILE_LANG_TABLE, $sql_ary, array('field_id' => $field_id, 'lang_id' => $default_lang_id));
}


			$this->update_insert(PROFILE_LANG_TABLE, $sql_ary, array('field_id' => $field_id, 'lang_id' => $default_lang_id));
}


		if (is_array($cp->vars['l_lang_name']) && sizeof($cp->vars['l_lang_name']))

		if (is_array($cp->vars['l_lang_name']) && count($cp->vars['l_lang_name']))

		{
foreach ($cp->vars['l_lang_name'] as $lang_id => $data)
{

		{
foreach ($cp->vars['l_lang_name'] as $lang_id => $data)
{

Line 1087Line 1132
			}
}


			}
}


		if (is_array($cp->vars['l_lang_options']) && sizeof($cp->vars['l_lang_options']))

		if (is_array($cp->vars['l_lang_options']) && count($cp->vars['l_lang_options']))

		{
$empty_lang = array();


		{
$empty_lang = array();


Line 1098Line 1143
					$lang_ary = explode("\n", $lang_ary);
}


					$lang_ary = explode("\n", $lang_ary);
}


				if (sizeof($lang_ary) != sizeof($cp->vars['lang_options']))

				if (count($lang_ary) != count($cp->vars['lang_options']))

				{
$empty_lang[$lang_id] = true;
}

				{
$empty_lang[$lang_id] = true;
}

Line 1150Line 1195
			}
}


			}
}


		if (sizeof($profile_lang_fields))

		if (count($profile_lang_fields))

		{
foreach ($profile_lang_fields as $sql)
{

		{
foreach ($profile_lang_fields as $sql)
{

Line 1213Line 1258
			$where_sql[] = $key . ' = ' . ((is_string($value)) ? "'" . $db->sql_escape($value) . "'" : (int) $value);
}


			$where_sql[] = $key . ' = ' . ((is_string($value)) ? "'" . $db->sql_escape($value) . "'" : (int) $value);
}


		if (!sizeof($where_sql))

		if (!count($where_sql))

		{
return;
}

		{
return;
}

Line 1229Line 1274
		{
$sql_ary = array_merge($where_fields, $sql_ary);


		{
$sql_ary = array_merge($where_fields, $sql_ary);


			if (sizeof($sql_ary))

			if (count($sql_ary))

			{
$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary));
}
}
else
{

			{
$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary));
}
}
else
{

			if (sizeof($sql_ary))

			if (count($sql_ary))

			{
$sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE ' . implode(' AND ', $where_sql);

			{
$sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE ' . implode(' AND ', $where_sql);