From 537d4a93bac1c0ed3da021a78997889b2dbe13d0 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Tue, 5 Mar 2024 21:59:36 +0200 Subject: [PATCH 1/7] Update bouncemgt.php Added &justexisting=true --- public_html/lists/admin/bouncemgt.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public_html/lists/admin/bouncemgt.php b/public_html/lists/admin/bouncemgt.php index d27dcd7b5..d6ba614d9 100755 --- a/public_html/lists/admin/bouncemgt.php +++ b/public_html/lists/admin/bouncemgt.php @@ -14,6 +14,7 @@ echo $spb.PageLink2('checkbouncerules', s('Check Current Bounce Rules')).$spe; echo $spb.PageLink2('processbounces', s('Process Bounces')).$spe; +echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces')).$spe; echo '
'; From 7f461a5088f08ea42b21db016fba0ed7a3f265de Mon Sep 17 00:00:00 2001 From: lwcorp Date: Tue, 5 Mar 2024 22:02:52 +0200 Subject: [PATCH 2/7] Update processbounces.php 1. Added support for &justexisting=true 1. Added support for new bounce rule action --- public_html/lists/admin/processbounces.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/public_html/lists/admin/processbounces.php b/public_html/lists/admin/processbounces.php index 457ac7ec0..b8e264007 100644 --- a/public_html/lists/admin/processbounces.php +++ b/public_html/lists/admin/processbounces.php @@ -505,6 +505,8 @@ function processMessages($link, $max) flushBrowser(); $download_report = ''; +if (isset($_GET['justexisting'])) + goto aftermailbox; switch ($bounce_protocol) { case 'pop': $download_report = processPop($bounce_mailbox_host, $bounce_mailbox_user, $bounce_mailbox_password); @@ -524,7 +526,7 @@ function processMessages($link, $max) return; } // now we have filled database with all available bounces - +aftermailbox: //# reprocess the unidentified ones, as the bounce detection has improved, so it might catch more cl_output('reprocessing'); @@ -648,6 +650,22 @@ function processMessages($link, $max) } deleteBounce($row['bounce']); break; + case 'decreasecountconfirmuseranddeletebounce': + Sql_Query(sprintf('update %s set bouncecount = bouncecount + %d where id = %d', + $GLOBALS['tables']['user'], '-1', $row['user'])); + if (!$confirmed) { + logEvent('User ' . $userdata['email'] . ' confirmed by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], + $rule['id'])); + Sql_Query(sprintf('update %s set confirmed = 1 where id = %d', $GLOBALS['tables']['user'], + $row['user'])); + $advanced_report .= 'User ' . $userdata['email'] . ' made confirmed by bounce rule ' . $rule['id'] . PHP_EOL; + $advanced_report .= 'User: ' . $report_linkroot . '/?page=user&id=' . $userdata['id'] . PHP_EOL; + $advanced_report .= 'Rule: ' . $report_linkroot . '/?page=bouncerule&id=' . $rule['id'] . PHP_EOL; + addUserHistory($userdata['email'], s('Auto confirmed'), + s('Subscriber auto confirmed for') . ' ' . $GLOBALS['I18N']->get('bounce rule') . ' ' . $rule['id']); + } + deleteBounce($row['bounce']); + break; case 'blacklistuser': if (!$blacklisted) { logEvent('User ' . $userdata['email'] . ' blacklisted by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], From 592507f78e06d9ae9921ad80ed4f7005954a04c4 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Tue, 5 Mar 2024 22:07:52 +0200 Subject: [PATCH 3/7] Update lib.php Added support for new bounce action --- public_html/lists/admin/lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public_html/lists/admin/lib.php b/public_html/lists/admin/lib.php index 8862710ef..587739ff3 100644 --- a/public_html/lists/admin/lib.php +++ b/public_html/lists/admin/lib.php @@ -30,6 +30,7 @@ 'unconfirmuseranddeletebounce' => $GLOBALS['I18N']->get('unconfirm subscriber and delete bounce'), 'blacklistuseranddeletebounce' => $GLOBALS['I18N']->get('blacklist subscriber and delete bounce'), 'blacklistemailanddeletebounce' => $GLOBALS['I18N']->get('blacklist email address and delete bounce'), + 'decreasecountconfirmuseranddeletebounce' => $GLOBALS['I18N']->get('decrease count and confirm subscriber and delete bounce'), 'deletebounce' => $GLOBALS['I18N']->get('delete bounce'), ); From 86904ef63f5558e025c9be2e5aef25bcf577cdb3 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Tue, 5 Mar 2024 22:51:28 +0200 Subject: [PATCH 4/7] Update bouncemgt.php Added non default title (otherwise it takes the wrong one) --- public_html/lists/admin/bouncemgt.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public_html/lists/admin/bouncemgt.php b/public_html/lists/admin/bouncemgt.php index d6ba614d9..83cd7d85c 100755 --- a/public_html/lists/admin/bouncemgt.php +++ b/public_html/lists/admin/bouncemgt.php @@ -14,7 +14,7 @@ echo $spb.PageLink2('checkbouncerules', s('Check Current Bounce Rules')).$spe; echo $spb.PageLink2('processbounces', s('Process Bounces')).$spe; -echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces')).$spe; +echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), title: s('Reprocess Only Existing Bounces')).$spe; echo '
'; @@ -25,3 +25,4 @@ echo '

'.s('You have already defined bounce rules in your system. Be careful with generating new ones, because these may interfere with the ones that exist.').'

'; } echo '

'.PageLink2('generatebouncerules', s('Generate Bounce Rules')).'

'; + From 20682f7ef41a7a315ce7f3e7cfdeddfa698155f9 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Sat, 9 Mar 2024 21:18:33 +0200 Subject: [PATCH 5/7] Update processbounces.php 1. Replaced goto with if-else 1. Hardcoded "-1" instead of supplying it in a sprintf value --- public_html/lists/admin/processbounces.php | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/public_html/lists/admin/processbounces.php b/public_html/lists/admin/processbounces.php index b8e264007..39fbdcdfa 100644 --- a/public_html/lists/admin/processbounces.php +++ b/public_html/lists/admin/processbounces.php @@ -505,28 +505,27 @@ function processMessages($link, $max) flushBrowser(); $download_report = ''; -if (isset($_GET['justexisting'])) - goto aftermailbox; -switch ($bounce_protocol) { - case 'pop': - $download_report = processPop($bounce_mailbox_host, $bounce_mailbox_user, $bounce_mailbox_password); - break; - case 'mbox': - $download_report = processMbox($bounce_mailbox); - break; - default: - Error($GLOBALS['I18N']->get('bounce_protocol not supported')); +if (!isset($_GET['justexisting'])) { + switch ($bounce_protocol) { + case 'pop': + $download_report = processPop($bounce_mailbox_host, $bounce_mailbox_user, $bounce_mailbox_password); + break; + case 'mbox': + $download_report = processMbox($bounce_mailbox); + break; + default: + Error($GLOBALS['I18N']->get('bounce_protocol not supported')); - return; -} + return; + } -if ($GLOBALS['commandline'] && $download_report === false) { - cl_output(s('Download failed, exiting')); + if ($GLOBALS['commandline'] && $download_report === false) { + cl_output(s('Download failed, exiting')); - return; -} + return; + } // now we have filled database with all available bounces -aftermailbox: +} //# reprocess the unidentified ones, as the bounce detection has improved, so it might catch more cl_output('reprocessing'); @@ -651,8 +650,8 @@ function processMessages($link, $max) deleteBounce($row['bounce']); break; case 'decreasecountconfirmuseranddeletebounce': - Sql_Query(sprintf('update %s set bouncecount = bouncecount + %d where id = %d', - $GLOBALS['tables']['user'], '-1', $row['user'])); + Sql_Query(sprintf('update %s set bouncecount = bouncecount -1 where id = %d', + $GLOBALS['tables']['user'], $row['user'])); if (!$confirmed) { logEvent('User ' . $userdata['email'] . ' confirmed by bounce rule ' . PageLink2('bouncerule&id=' . $rule['id'], $rule['id'])); From f7796bc0b93545d18ef22e5c39d58c86b036fd88 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Mon, 11 Mar 2024 02:18:33 +0200 Subject: [PATCH 6/7] Hardcoding defaults for older PHP versions --- public_html/lists/admin/bouncemgt.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public_html/lists/admin/bouncemgt.php b/public_html/lists/admin/bouncemgt.php index 83cd7d85c..67f6b51ee 100755 --- a/public_html/lists/admin/bouncemgt.php +++ b/public_html/lists/admin/bouncemgt.php @@ -14,7 +14,11 @@ echo $spb.PageLink2('checkbouncerules', s('Check Current Bounce Rules')).$spe; echo $spb.PageLink2('processbounces', s('Process Bounces')).$spe; -echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), title: s('Reprocess Only Existing Bounces')).$spe; +if (version_compare(PHP_VERSION, '8.0.0', '<') { // Hardcoding defaults when not supporting Named Arguments + echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), '', false, s('Reprocess Only Existing Bounces')).$spe; +} else { + echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), title: s('Reprocess Only Existing Bounces')).$spe; +} echo '
'; From 04da0fe31038f6f9c65be1c647cc152b277e18ae Mon Sep 17 00:00:00 2001 From: lwcorp Date: Mon, 11 Mar 2024 20:29:35 +0200 Subject: [PATCH 7/7] Removed modern solution --- public_html/lists/admin/bouncemgt.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/public_html/lists/admin/bouncemgt.php b/public_html/lists/admin/bouncemgt.php index 67f6b51ee..734661f1a 100755 --- a/public_html/lists/admin/bouncemgt.php +++ b/public_html/lists/admin/bouncemgt.php @@ -14,11 +14,7 @@ echo $spb.PageLink2('checkbouncerules', s('Check Current Bounce Rules')).$spe; echo $spb.PageLink2('processbounces', s('Process Bounces')).$spe; -if (version_compare(PHP_VERSION, '8.0.0', '<') { // Hardcoding defaults when not supporting Named Arguments - echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), '', false, s('Reprocess Only Existing Bounces')).$spe; -} else { - echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), title: s('Reprocess Only Existing Bounces')).$spe; -} +echo $spb.PageLink2('processbounces&justexisting=true', s('Reprocess Only Existing Bounces'), '', false, s('Reprocess Only Existing Bounces')).$spe; echo '
';