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.php32
1 files changed, 17 insertions, 15 deletions
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index 8573533c2c..10af997bff 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;
@@ -566,9 +565,12 @@ class custom_profile
else if ($day && $month && $year)
{
global $user;
- // Date should display as the same date for every user regardless of timezone, so remove offset
- // to compensate for the offset added by user::format_date()
- return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true);
+ // Date should display as the same date for every user regardless of timezone
+
+ return $user->create_datetime()
+ ->setDate($year, $month, $day)
+ ->setTime(0, 0, 0)
+ ->format($user->lang['DATE_FORMAT'], true);
}
return $value;
@@ -645,6 +647,7 @@ class custom_profile
function get_var($field_validation, &$profile_row, $default_value, $preview)
{
global $user;
+ global $request;
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$user_ident = $profile_row['field_ident'];
@@ -657,7 +660,7 @@ class custom_profile
{
if (isset($_REQUEST[$profile_row['field_ident']]))
{
- $value = ($_REQUEST[$profile_row['field_ident']] === '') ? NULL : request_var($profile_row['field_ident'], $default_value);
+ $value = ($request->variable($profile_row['field_ident'], '') === '') ? NULL : $request->variable($profile_row['field_ident'], $default_value);
}
else
{
@@ -934,6 +937,7 @@ class custom_profile
{
global $phpbb_root_path, $phpEx;
global $config;
+ global $request;
$var_name = 'pf_' . $profile_row['field_ident'];
@@ -978,7 +982,7 @@ class custom_profile
break;
case FIELD_INT:
- if (isset($_REQUEST[$var_name]) && $_REQUEST[$var_name] === '')
+ if (isset($_REQUEST[$var_name]) && $request->variable($var_name, '') === '')
{
$var = NULL;
}
@@ -1181,5 +1185,3 @@ class custom_profile_admin extends custom_profile
return $options;
}
}
-
-?> \ No newline at end of file