From 1e36ed1f741631be7c3c097b1a1cdd0db72baccb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:50:19 +0000 Subject: [PATCH] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9389 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_email.php | 10 +++++----- phpBB/includes/acp/acp_jabber.php | 3 ++- phpBB/includes/functions_messenger.php | 27 ++++++++++++++++++++++++-- phpBB/includes/ucp/ucp_profile.php | 4 ++-- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f5baf664e7..426213da8e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -124,6 +124,7 @@
  • [Fix] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485)
  • [Fix] Flash files do not display anymore after update to flash player 10 (Bug #41315)
  • [Fix] Use FQDN for SMTP EHLO/HELO command. (Bug #41025)
  • +
  • [Fix] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755)
  • [Change] Allow download of conflicting file for later reference in automatic updater
  • [Change] Default difference view is now 'inline' instead of 'side by side'
  • [Change] Added new option for merging differences to conflicting files in automatic updater
  • diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 125908c296..350693a630 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -108,7 +108,7 @@ class acp_email $db->sql_freeresult($result); trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } - + $i = $j = 0; // Send with BCC, no more than 50 recipients for one mail (to not exceed the limit) @@ -121,7 +121,7 @@ class acp_email { if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) || ($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) || - ($row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber'])) + ($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber']))) { if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) { @@ -173,7 +173,7 @@ class acp_email $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); - + $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); @@ -181,7 +181,7 @@ class acp_email 'CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => htmlspecialchars_decode($message)) ); - + if (!($messenger->send($used_method))) { $errored = true; @@ -239,7 +239,7 @@ class acp_email $select_list = ''; $select_list .= group_select_options($group_id, $exclude); - + $s_priority_options = ''; $s_priority_options .= ''; $s_priority_options .= ''; diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 499543cc6c..3ab6eb64ed 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -88,7 +88,8 @@ class acp_jabber else { // This feature is disabled. - // We update the user table to be sure all users that have IM as notify type are set to both as notify type + // We update the user table to be sure all users that have IM as notify type are set to both as notify type + // We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled. $sql_ary = array( 'user_notify_type' => NOTIFY_BOTH, ); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 6c8f8aa32d..158d6804e3 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -61,6 +61,11 @@ class messenger { global $config; + if (!trim($address)) + { + return; + } + $pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0; $this->addresses['to'][$pos]['email'] = trim($address); @@ -81,6 +86,11 @@ class messenger */ function cc($address, $realname = '') { + if (!trim($address)) + { + return; + } + $pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0; $this->addresses['cc'][$pos]['email'] = trim($address); $this->addresses['cc'][$pos]['name'] = trim($realname); @@ -91,6 +101,11 @@ class messenger */ function bcc($address, $realname = '') { + if (!trim($address)) + { + return; + } + $pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0; $this->addresses['bcc'][$pos]['email'] = trim($address); $this->addresses['bcc'][$pos]['name'] = trim($realname); @@ -102,7 +117,7 @@ class messenger function im($address, $realname = '') { // IM-Addresses could be empty - if (!$address) + if (!trim($address)) { return; } @@ -363,6 +378,13 @@ class messenger return false; } + // Addresses to send to? + if (empty($this->addresses) || (empty($this->addresses['to']) && empty($this->addresses['cc']) && empty($this->addresses['bcc']))) + { + // Send was successful. ;) + return true; + } + $use_queue = false; if ($config['email_package_size'] && $this->use_queue) { @@ -457,7 +479,8 @@ class messenger if (empty($this->addresses['im'])) { - return false; + // Send was successful. ;) + return true; } $use_queue = false; diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 3e893fb486..30752d8c8a 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -349,11 +349,11 @@ class ucp_profile { $data['notify'] = $user->data['user_notify_type']; - if (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) + if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))) { // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) // Disable notify by Jabber now for this user. - $data['notify'] = NOTIFY_BOTH; + $data['notify'] = NOTIFY_EMAIL; } $sql_ary = array(