From 293b65e3efbf94f6521acebe1b9f3e7bbca20286 Mon Sep 17 00:00:00 2001 From: David Tobin Date: Thu, 5 Jul 2012 02:47:49 +0100 Subject: [PATCH 1/2] [ticket/10896] Adds email validation to email settings in ACP Adds a new validation type to the ACP validate_config_vars function and implements it on the board_contact and board_email settings. PHPBB3-10896 --- phpBB/adm/index.php | 7 +++++++ phpBB/includes/acp/acp_board.php | 4 ++-- phpBB/language/en/common.php | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 2e4089c02e..2da8a130cc 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -449,6 +449,13 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) } break; + case 'email': + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $cfg_array[$config_name])) + { + $error[] = $user->lang['EMAIL_INVALID']; + } + break; + // Absolute path case 'script_path': if (!$cfg_array[$config_name]) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index f437dca8f9..ebbf66657e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -408,8 +408,8 @@ class acp_board 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), - 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), - 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), + 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'text:25:100', 'explain' => true), + 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'text:25:100', 'explain' => true), 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 844d5ef3ef..9f8799b6d6 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -160,6 +160,7 @@ $lang = array_merge($lang, array( 'EDIT_POST' => 'Edit post', 'EMAIL' => 'E-mail', // Short form for EMAIL_ADDRESS 'EMAIL_ADDRESS' => 'E-mail address', + 'EMAIL_INVALID' => 'The email address you entered is invalid.', 'EMAIL_SMTP_ERROR_RESPONSE' => 'Ran into problems sending e-mail at Line %1$s. Response: %2$s.', 'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic.', 'EMPTY_MESSAGE_SUBJECT' => 'You must specify a subject when composing a new message.', From 5aec7600a68adb9466fb7ce034ba22070ac8a244 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 4 Feb 2013 23:13:47 -0600 Subject: [PATCH 2/2] [ticket/10896] Move EMAIL_INVALID_EMAIL to common, replace EMAIL_INVALID PHPBB3-10896 --- phpBB/adm/index.php | 2 +- phpBB/language/en/common.php | 2 +- phpBB/language/en/ucp.php | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 2da8a130cc..85908476a1 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -452,7 +452,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) case 'email': if (!preg_match('/^' . get_preg_expression('email') . '$/i', $cfg_array[$config_name])) { - $error[] = $user->lang['EMAIL_INVALID']; + $error[] = $user->lang['EMAIL_INVALID_EMAIL']; } break; diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 9f8799b6d6..6dd390ed24 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -160,7 +160,7 @@ $lang = array_merge($lang, array( 'EDIT_POST' => 'Edit post', 'EMAIL' => 'E-mail', // Short form for EMAIL_ADDRESS 'EMAIL_ADDRESS' => 'E-mail address', - 'EMAIL_INVALID' => 'The email address you entered is invalid.', + 'EMAIL_INVALID_EMAIL' => 'The e-mail address you entered is invalid.', 'EMAIL_SMTP_ERROR_RESPONSE' => 'Ran into problems sending e-mail at Line %1$s. Response: %2$s.', 'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic.', 'EMPTY_MESSAGE_SUBJECT' => 'You must specify a subject when composing a new message.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 5152c4b50b..0dce2961e5 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -176,7 +176,6 @@ $lang = array_merge($lang, array( 'EDIT_DRAFT_EXPLAIN' => 'Here you are able to edit your draft. Drafts do not contain attachment and poll information.', 'EMAIL_BANNED_EMAIL' => 'The e-mail address you entered is not allowed to be used.', - 'EMAIL_INVALID_EMAIL' => 'The e-mail address you entered is invalid.', 'EMAIL_REMIND' => 'This must be the e-mail address associated with your account. If you have not changed this via your user control panel then it is the e-mail address you registered your account with.', 'EMAIL_TAKEN_EMAIL' => 'The entered e-mail address is already in use.', 'EMPTY_DRAFT' => 'You must enter a message to submit your changes.',