From 427d70d1387090befbff4b0d2f24efd84cfc0392 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 5 May 2014 17:01:13 +0200 Subject: [PATCH] [ticket/10073] Use phpbb_validate_email to verify email address PHPBB3-10073 --- phpBB/phpbb/message/admin_form.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/message/admin_form.php b/phpBB/phpbb/message/admin_form.php index 7bab96eec2..aa185da740 100644 --- a/phpBB/phpbb/message/admin_form.php +++ b/phpBB/phpbb/message/admin_form.php @@ -101,9 +101,27 @@ class admin_form extends form { $this->errors[] = $this->user->lang['EMPTY_SENDER_NAME']; } - if (!$this->sender_address || !preg_match('/^' . get_preg_expression('email') . '$/i', $this->sender_address)) + + if (!function_exists('validate_data')) { - $this->errors[] = $this->user->lang['EMPTY_SENDER_EMAIL']; + require($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx); + } + + $validate_array = validate_data( + array( + 'email' => $this->sender_address, + ), + array( + 'email' => array( + array('string', false, 6, 60), + array('email'), + ), + ) + ); + + foreach ($validate_array as $error) + { + $this->errors[] = $this->user->lang[$error]; } $this->message->set_sender($this->user->ip, $this->sender_name, $this->sender_address, $this->user->lang_name);