aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_profile_fields.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_profile_fields.php')
-rw-r--r--phpBB/includes/functions_profile_fields.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index aacfa82c54..1c15ef897f 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -315,32 +314,32 @@ class custom_profile
case 'FIELD_INVALID_DATE':
case 'FIELD_INVALID_VALUE':
case 'FIELD_REQUIRED':
- $error = sprintf($user->lang[$cp_result], $row['lang_name']);
+ $error = $user->lang($cp_result, $row['lang_name']);
break;
case 'FIELD_TOO_SHORT':
case 'FIELD_TOO_SMALL':
- $error = sprintf($user->lang[$cp_result], $row['lang_name'], $row['field_minlen']);
+ $error = $user->lang($cp_result, (int) $row['field_minlen'], $row['lang_name']);
break;
case 'FIELD_TOO_LONG':
case 'FIELD_TOO_LARGE':
- $error = sprintf($user->lang[$cp_result], $row['lang_name'], $row['field_maxlen']);
+ $error = $user->lang($cp_result, (int) $row['field_maxlen'], $row['lang_name']);
break;
case 'FIELD_INVALID_CHARS':
switch ($row['field_validation'])
{
case '[0-9]+':
- $error = sprintf($user->lang[$cp_result . '_NUMBERS_ONLY'], $row['lang_name']);
+ $error = $user->lang($cp_result . '_NUMBERS_ONLY', $row['lang_name']);
break;
case '[\w]+':
- $error = sprintf($user->lang[$cp_result . '_ALPHA_ONLY'], $row['lang_name']);
+ $error = $user->lang($cp_result . '_ALPHA_ONLY', $row['lang_name']);
break;
case '[\w_\+\. \-\[\]]+':
- $error = sprintf($user->lang[$cp_result . '_SPACERS_ONLY'], $row['lang_name']);
+ $error = $user->lang($cp_result . '_SPACERS_ONLY', $row['lang_name']);
break;
}
break;
@@ -574,7 +573,12 @@ class custom_profile
$this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false);
}
- if ($value == $ident_ary['data']['field_novalue'])
+ // If a dropdown field is required, users
+ // cannot choose the "no value" option.
+ // They must choose one of the other options.
+ // Therefore, here we treat a value equal to
+ // the "no value" as a lack of value, i.e. NULL.
+ if ($value == $ident_ary['data']['field_novalue'] && $ident_ary['data']['field_required'])
{
return NULL;
}
@@ -629,10 +633,10 @@ class custom_profile
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$user_ident = $profile_row['field_ident'];
- // checkbox - only testing for isset
+ // checkbox - set the value to "true" if it has been set to 1
if ($profile_row['field_type'] == FIELD_BOOL && $profile_row['field_length'] == 2)
{
- $value = (isset($_REQUEST[$profile_row['field_ident']])) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
+ $value = (isset($_REQUEST[$profile_row['field_ident']]) && request_var($profile_row['field_ident'], $default_value) == 1) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
}
else if ($profile_row['field_type'] == FIELD_INT)
{