From 40c685e6fcbe3e5e9d2626f2b5ce46b6665d8a33 Mon Sep 17 00:00:00 2001 From: Markus Stenudd Date: Sat, 30 Nov 2013 16:01:26 +0100 Subject: [PATCH 1/5] [ticket/8558] Add display name in emails from board PHPBB3-8558 --- phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/functions_messenger.php | 18 ++++++++++++++++-- phpBB/language/en/acp/board.php | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 2c0eb95cd5..731218a835 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -434,6 +434,7 @@ class acp_board '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' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:30:50', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email: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/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 907252f6d8..ddbceae4de 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -486,12 +486,26 @@ class messenger if (empty($this->replyto)) { - $this->replyto = '<' . $config['board_contact'] . '>'; + if ($config['board_contact_name']) + { + $this->replyto = '"' . mail_encode($config['board_contact_name']) . '" <' . $config['board_contact'] . '>'; + } + else + { + $this->replyto = '<' . $config['board_contact'] . '>'; + } } if (empty($this->from)) { - $this->from = '<' . $config['board_contact'] . '>'; + if ($config['board_contact_name']) + { + $this->from = '"' . mail_encode($config['board_contact_name']) . '" <' . $config['board_contact'] . '>'; + } + else + { + $this->from = '<' . $config['board_contact'] . '>'; + } } $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 1d2c979e0c..5ca2c9ea45 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -524,6 +524,8 @@ $lang = array_merge($lang, array( 'BOARD_HIDE_EMAILS_EXPLAIN' => 'This function keeps email addresses completely private.', 'CONTACT_EMAIL' => 'Contact email address', 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the From and Reply-To address in emails.', + 'CONTACT_EMAIL_NAME' => 'Contact name', + 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients see. Leave blank to just send the e-mail address', 'EMAIL_FUNCTION_NAME' => 'Email function name', 'EMAIL_FUNCTION_NAME_EXPLAIN' => 'The email function used to send mails through PHP.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', From 809054abfd18d08cc209e7adfbe99e805276aeb7 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 17 Apr 2014 15:17:54 +0200 Subject: [PATCH 2/5] [ticket/8558] Add config in migrations and schema_data PHPBB3-8558 --- phpBB/install/schemas/schema_data.sql | 1 + .../data/v310/board_contact_name.php | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/board_contact_name.php diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index bc76bf55b9..fbf1374346 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -56,6 +56,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_width', INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path', 'images/avatars/upload'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_salt', 'phpbb_avatar'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact', 'contact@yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact_name', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email', 'address@yourdomain.tld'); diff --git a/phpBB/phpbb/db/migration/data/v310/board_contact_name.php b/phpBB/phpbb/db/migration/data/v310/board_contact_name.php new file mode 100644 index 0000000000..37b4d50545 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/board_contact_name.php @@ -0,0 +1,30 @@ +config['board_contact_name']); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\beta2'); + } + + public function update_data() + { + return array( + array('config.add', array('board_contact_name', '')), + ); + } +} From 59cdc26fb41d2bccb6da42af86125ea7fe2af8c8 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 17 Apr 2014 21:59:23 +0200 Subject: [PATCH 3/5] [ticket/8558] Use only one variable and improve explain string PHPBB3-8558 --- phpBB/includes/functions_messenger.php | 20 ++++---------------- phpBB/language/en/acp/board.php | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ddbceae4de..73604d591b 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -484,28 +484,16 @@ class messenger $use_queue = true; } + $board_contact = (($config['board_contact_name']) ? '"' . mail_encode($config['board_contact_name']) . '" ' : '') . '<' . $config['board_contact'] . '>'; + if (empty($this->replyto)) { - if ($config['board_contact_name']) - { - $this->replyto = '"' . mail_encode($config['board_contact_name']) . '" <' . $config['board_contact'] . '>'; - } - else - { - $this->replyto = '<' . $config['board_contact'] . '>'; - } + $this->replyto = $board_contact; } if (empty($this->from)) { - if ($config['board_contact_name']) - { - $this->from = '"' . mail_encode($config['board_contact_name']) . '" <' . $config['board_contact'] . '>'; - } - else - { - $this->from = '<' . $config['board_contact'] . '>'; - } + $this->from = $board_contact; } $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 5ca2c9ea45..696e82324c 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -525,7 +525,7 @@ $lang = array_merge($lang, array( 'CONTACT_EMAIL' => 'Contact email address', 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the From and Reply-To address in emails.', 'CONTACT_EMAIL_NAME' => 'Contact name', - 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients see. Leave blank to just send the e-mail address', + 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', 'EMAIL_FUNCTION_NAME' => 'Email function name', 'EMAIL_FUNCTION_NAME_EXPLAIN' => 'The email function used to send mails through PHP.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', From 933dcde805faa2cd0c74ba797c65281af65ed3a8 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 17 Apr 2014 23:13:36 +0200 Subject: [PATCH 4/5] [ticket/8558] Fix field length in ACP PHPBB3-8558 --- phpBB/includes/acp/acp_board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 731218a835..6b52fbbdb2 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -434,7 +434,7 @@ class acp_board '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' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), - 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:30:50', 'explain' => true), + 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email: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), From 45e39d0990c01f005a7dccc5a36de3dd0f62c585 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 23 Apr 2014 17:45:09 +0200 Subject: [PATCH 5/5] [ticket/8558] Fix operator PHPBB3-8558 --- phpBB/includes/functions_messenger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 73604d591b..26ec2d7a5f 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -484,7 +484,7 @@ class messenger $use_queue = true; } - $board_contact = (($config['board_contact_name']) ? '"' . mail_encode($config['board_contact_name']) . '" ' : '') . '<' . $config['board_contact'] . '>'; + $board_contact = (($config['board_contact_name'] !== '') ? '"' . mail_encode($config['board_contact_name']) . '" ' : '') . '<' . $config['board_contact'] . '>'; if (empty($this->replyto)) {