From d601aaad263e19b47865bca56da527f4fdf504e1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Jan 2014 13:38:24 +0100 Subject: [ticket/11201] Remove type related code from build_insert_sql_array() PHPBB3-11201 --- phpBB/phpbb/profilefields/profilefields.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'phpBB/phpbb/profilefields/profilefields.php') diff --git a/phpBB/phpbb/profilefields/profilefields.php b/phpBB/phpbb/profilefields/profilefields.php index ba0baa53f0..e3201712df 100644 --- a/phpBB/phpbb/profilefields/profilefields.php +++ b/phpBB/phpbb/profilefields/profilefields.php @@ -408,18 +408,8 @@ class profilefields while ($row = $this->db->sql_fetchrow($result)) { - if ($row['field_default_value'] == 'now' && $row['field_type'] == FIELD_DATE) - { - $now = getdate(); - $row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']); - } - else if ($row['field_default_value'] === '' && $row['field_type'] == FIELD_INT) - { - // We cannot insert an empty string into an integer column. - $row['field_default_value'] = NULL; - } - - $cp_data['pf_' . $row['field_ident']] = (in_array($row['field_type'], array(FIELD_TEXT, FIELD_STRING))) ? $row['lang_default_value'] : $row['field_default_value']; + $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$row['field_type']]); + $cp_data['pf_' . $row['field_ident']] = $profile_field->get_default_field_value($row); } $this->db->sql_freeresult($result); -- cgit v1.2.1