Version Description
- Fixed delivery fatal error management
- Fixed link to the schduler dianostica panel
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 7.3.4 |
Comparing to | |
See all releases |
Code changes from version 7.3.3 to 7.3.4
- includes/antispam.php +202 -198
- includes/mailer.php +1 -0
- plugin.php +5 -7
- readme.txt +6 -1
- tnp-header.php +1 -1
includes/antispam.php
CHANGED
@@ -1,198 +1,202 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class NewsletterAntispam {
|
4 |
-
|
5 |
-
var $options;
|
6 |
-
var $logger;
|
7 |
-
|
8 |
-
public static function instance() {
|
9 |
-
static $instance;
|
10 |
-
if (!$instance) {
|
11 |
-
$instance = new NewsletterAntispam();
|
12 |
-
}
|
13 |
-
return $instance;
|
14 |
-
}
|
15 |
-
|
16 |
-
public function __construct() {
|
17 |
-
$this->options = NewsletterSubscription::instance()->get_options('antibot');
|
18 |
-
$this->logger = new NewsletterLogger('antispam');
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* $email must be cleaned using the is_email() function.
|
23 |
-
*
|
24 |
-
* @param TNP_Subscription $subscription
|
25 |
-
*/
|
26 |
-
function is_spam($subscription) {
|
27 |
-
|
28 |
-
$email = $subscription->data->email;
|
29 |
-
$ip = $subscription->data->ip;
|
30 |
-
|
31 |
-
|
32 |
-
$full_name = $subscription->data->name . ' ' . $subscription->data->surname;
|
33 |
-
if ($this->is_spam_text($full_name)) {
|
34 |
-
$this->logger->fatal($email . ' - ' . $ip . ' - Name with http: ' . $full_name);
|
35 |
-
return true;
|
36 |
-
}
|
37 |
-
|
38 |
-
if ($this->is_ip_blacklisted($ip)) {
|
39 |
-
$this->logger->fatal($email . ' - ' . $ip . ' - IP blacklisted');
|
40 |
-
return true;
|
41 |
-
}
|
42 |
-
|
43 |
-
if ($this->is_address_blacklisted($email)) {
|
44 |
-
$this->logger->fatal($email . ' - ' . $ip . ' - Address blacklisted');
|
45 |
-
return true;
|
46 |
-
}
|
47 |
-
|
48 |
-
// Akismet check
|
49 |
-
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
50 |
-
$referrer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '';
|
51 |
-
if ( $this->is_spam_by_akismet( $email, $full_name, $ip, $user_agent, $referrer ) ) {
|
52 |
-
$this->logger->fatal( $email . ' - ' . $ip . ' - Akismet blocked' );
|
53 |
-
|
54 |
-
return true;
|
55 |
-
}
|
56 |
-
|
57 |
-
// Flood check
|
58 |
-
if ($this->is_flood($email, $ip)) {
|
59 |
-
$this->logger->fatal($email . ' - ' . $ip . ' - Antiflood triggered');
|
60 |
-
return true;
|
61 |
-
}
|
62 |
-
|
63 |
-
// if ($this->is_missing_domain_mx($email)) {
|
64 |
-
// $this->logger->fatal($email . ' - ' . $ip . ' - MX check failed');
|
65 |
-
// header("HTTP/1.0 404 Not Found");
|
66 |
-
// return true;
|
67 |
-
// }
|
68 |
-
|
69 |
-
return false;
|
70 |
-
}
|
71 |
-
|
72 |
-
function is_address_blacklisted($email) {
|
73 |
-
|
74 |
-
if (empty($this->options['address_blacklist'])) {
|
75 |
-
return false;
|
76 |
-
}
|
77 |
-
|
78 |
-
$this->logger->debug('Address blacklist check');
|
79 |
-
$rev_email = strrev($email);
|
80 |
-
foreach ($this->options['address_blacklist'] as $item) {
|
81 |
-
if (strpos($rev_email, strrev($item)) === 0) {
|
82 |
-
return true;
|
83 |
-
}
|
84 |
-
}
|
85 |
-
return false;
|
86 |
-
}
|
87 |
-
|
88 |
-
function is_ip_blacklisted($ip) {
|
89 |
-
|
90 |
-
if (
|
91 |
-
return false;
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
$this->
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
$this->
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
if (
|
162 |
-
return false;
|
163 |
-
}
|
164 |
-
|
165 |
-
$this->
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
$subnet
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class NewsletterAntispam {
|
4 |
+
|
5 |
+
var $options;
|
6 |
+
var $logger;
|
7 |
+
|
8 |
+
public static function instance() {
|
9 |
+
static $instance;
|
10 |
+
if (!$instance) {
|
11 |
+
$instance = new NewsletterAntispam();
|
12 |
+
}
|
13 |
+
return $instance;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function __construct() {
|
17 |
+
$this->options = NewsletterSubscription::instance()->get_options('antibot');
|
18 |
+
$this->logger = new NewsletterLogger('antispam');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* $email must be cleaned using the is_email() function.
|
23 |
+
*
|
24 |
+
* @param TNP_Subscription $subscription
|
25 |
+
*/
|
26 |
+
function is_spam($subscription) {
|
27 |
+
|
28 |
+
$email = $subscription->data->email;
|
29 |
+
$ip = $subscription->data->ip;
|
30 |
+
|
31 |
+
|
32 |
+
$full_name = $subscription->data->name . ' ' . $subscription->data->surname;
|
33 |
+
if ($this->is_spam_text($full_name)) {
|
34 |
+
$this->logger->fatal($email . ' - ' . $ip . ' - Name with http: ' . $full_name);
|
35 |
+
return true;
|
36 |
+
}
|
37 |
+
|
38 |
+
if ($this->is_ip_blacklisted($ip)) {
|
39 |
+
$this->logger->fatal($email . ' - ' . $ip . ' - IP blacklisted');
|
40 |
+
return true;
|
41 |
+
}
|
42 |
+
|
43 |
+
if ($this->is_address_blacklisted($email)) {
|
44 |
+
$this->logger->fatal($email . ' - ' . $ip . ' - Address blacklisted');
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
|
48 |
+
// Akismet check
|
49 |
+
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
50 |
+
$referrer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '';
|
51 |
+
if ( $this->is_spam_by_akismet( $email, $full_name, $ip, $user_agent, $referrer ) ) {
|
52 |
+
$this->logger->fatal( $email . ' - ' . $ip . ' - Akismet blocked' );
|
53 |
+
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
|
57 |
+
// Flood check
|
58 |
+
if ($this->is_flood($email, $ip)) {
|
59 |
+
$this->logger->fatal($email . ' - ' . $ip . ' - Antiflood triggered');
|
60 |
+
return true;
|
61 |
+
}
|
62 |
+
|
63 |
+
// if ($this->is_missing_domain_mx($email)) {
|
64 |
+
// $this->logger->fatal($email . ' - ' . $ip . ' - MX check failed');
|
65 |
+
// header("HTTP/1.0 404 Not Found");
|
66 |
+
// return true;
|
67 |
+
// }
|
68 |
+
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
function is_address_blacklisted($email) {
|
73 |
+
|
74 |
+
if (empty($this->options['address_blacklist'])) {
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->logger->debug('Address blacklist check');
|
79 |
+
$rev_email = strrev($email);
|
80 |
+
foreach ($this->options['address_blacklist'] as $item) {
|
81 |
+
if (strpos($rev_email, strrev($item)) === 0) {
|
82 |
+
return true;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
|
88 |
+
function is_ip_blacklisted($ip) {
|
89 |
+
|
90 |
+
if ($ip === '::1' || $ip === '127.0.0.1') {
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
if (empty($this->options['ip_blacklist'])) {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
$this->logger->debug('IP blacklist check');
|
98 |
+
foreach ($this->options['ip_blacklist'] as $item) {
|
99 |
+
if (substr($item, 0, 1) === '#') {
|
100 |
+
continue;
|
101 |
+
}
|
102 |
+
if ($this->ip_match($ip, $item)) {
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
function is_missing_domain_mx($email) {
|
110 |
+
// Actually not fully implemented
|
111 |
+
return false;
|
112 |
+
|
113 |
+
if (empty($this->options['domain_check'])) {
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
|
117 |
+
$this->logger->debug('Domain MX check');
|
118 |
+
list($local, $domain) = explode('@', $email);
|
119 |
+
|
120 |
+
$hosts = array();
|
121 |
+
if (!getmxrr($domain, $hosts)) {
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
|
127 |
+
function is_flood($email, $ip) {
|
128 |
+
global $wpdb;
|
129 |
+
|
130 |
+
if (empty($this->options['antiflood'])) {
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
|
134 |
+
$this->logger->debug('Antiflood check');
|
135 |
+
|
136 |
+
$updated = $wpdb->get_var($wpdb->prepare("select updated from " . NEWSLETTER_USERS_TABLE . " where ip=%s or email=%s order by updated desc limit 1", $ip, $email));
|
137 |
+
|
138 |
+
if ($updated && time() - $updated < $this->options['antiflood']) {
|
139 |
+
return true;
|
140 |
+
}
|
141 |
+
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
function is_spam_text($text) {
|
146 |
+
if (stripos($text, 'http:') !== false || stripos($text, 'https:') !== false) {
|
147 |
+
return true;
|
148 |
+
}
|
149 |
+
if (stripos($text, 'www.') !== false) {
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
if (preg_match('|[^\s\.]+\.[^\s\.]+\.[^\s\.]{2,}|', $text)) {
|
153 |
+
return true;
|
154 |
+
}
|
155 |
+
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
|
159 |
+
function is_spam_by_akismet($email, $name, $ip, $agent, $referrer) {
|
160 |
+
|
161 |
+
if (!class_exists('Akismet')) {
|
162 |
+
return false;
|
163 |
+
}
|
164 |
+
|
165 |
+
if (empty($this->options['akismet'])) {
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
|
169 |
+
$this->logger->debug('Akismet check');
|
170 |
+
$request = 'blog=' . urlencode(home_url()) . '&referrer=' . urlencode($referrer) .
|
171 |
+
'&user_agent=' . urlencode($agent) .
|
172 |
+
'&comment_type=signup' .
|
173 |
+
'&comment_author_email=' . urlencode($email) .
|
174 |
+
'&user_ip=' . urlencode($ip);
|
175 |
+
if (!empty($name)) {
|
176 |
+
$request .= '&comment_author=' . urlencode($name);
|
177 |
+
}
|
178 |
+
|
179 |
+
$response = Akismet::http_post($request, 'comment-check');
|
180 |
+
|
181 |
+
if ($response && $response[1] == 'true') {
|
182 |
+
return true;
|
183 |
+
}
|
184 |
+
return false;
|
185 |
+
}
|
186 |
+
|
187 |
+
function ip_match($ip, $range) {
|
188 |
+
if (empty($ip))
|
189 |
+
return false;
|
190 |
+
if (strpos($range, '/')) {
|
191 |
+
list ($subnet, $bits) = explode('/', $range);
|
192 |
+
$ip = ip2long($ip);
|
193 |
+
$subnet = ip2long($subnet);
|
194 |
+
$mask = -1 << (32 - $bits);
|
195 |
+
$subnet &= $mask; # nb: in case the supplied subnet wasn't correctly aligned
|
196 |
+
return ($ip & $mask) == $subnet;
|
197 |
+
} else {
|
198 |
+
return strpos($range, $ip) === 0;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
}
|
includes/mailer.php
CHANGED
@@ -309,6 +309,7 @@ class NewsletterDefaultMailer extends NewsletterMailer {
|
|
309 |
}
|
310 |
|
311 |
$this->current_message = $message;
|
|
|
312 |
$r = wp_mail($message->to, $message->subject, $body, $wp_mail_headers);
|
313 |
$this->current_message = null;
|
314 |
|
309 |
}
|
310 |
|
311 |
$this->current_message = $message;
|
312 |
+
|
313 |
$r = wp_mail($message->to, $message->subject, $body, $wp_mail_headers);
|
314 |
$this->current_message = null;
|
315 |
|
plugin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
-
Version: 7.3.
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
@@ -37,7 +37,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
|
|
37 |
return;
|
38 |
}
|
39 |
|
40 |
-
define('NEWSLETTER_VERSION', '7.3.
|
41 |
|
42 |
global $newsletter, $wpdb;
|
43 |
|
@@ -741,9 +741,8 @@ class Newsletter extends NewsletterModule {
|
|
741 |
// For fatal error, the newsletter status i changed to error (and the delivery stopped)
|
742 |
if (!$test && $r->get_error_code() == NewsletterMailer::ERROR_FATAL) {
|
743 |
$this->set_error_state_of_email($email, $r->get_error_message());
|
|
|
744 |
}
|
745 |
-
|
746 |
-
return $r;
|
747 |
}
|
748 |
|
749 |
if (!$supplied_users && !$test && $this->time_exceeded()) {
|
@@ -788,13 +787,12 @@ class Newsletter extends NewsletterModule {
|
|
788 |
|
789 |
// The batch went in error
|
790 |
if (is_wp_error($r)) {
|
|
|
791 |
|
792 |
if (!$test && $r->get_error_code() == NewsletterMailer::ERROR_FATAL) {
|
793 |
$this->set_error_state_of_email($email, $r->get_error_message());
|
|
|
794 |
}
|
795 |
-
|
796 |
-
$this->logger->error($r);
|
797 |
-
return $r;
|
798 |
}
|
799 |
|
800 |
if (!$supplied_users && !$test && $this->time_exceeded()) {
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
+
Version: 7.3.4
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
37 |
return;
|
38 |
}
|
39 |
|
40 |
+
define('NEWSLETTER_VERSION', '7.3.4');
|
41 |
|
42 |
global $newsletter, $wpdb;
|
43 |
|
741 |
// For fatal error, the newsletter status i changed to error (and the delivery stopped)
|
742 |
if (!$test && $r->get_error_code() == NewsletterMailer::ERROR_FATAL) {
|
743 |
$this->set_error_state_of_email($email, $r->get_error_message());
|
744 |
+
return $r;
|
745 |
}
|
|
|
|
|
746 |
}
|
747 |
|
748 |
if (!$supplied_users && !$test && $this->time_exceeded()) {
|
787 |
|
788 |
// The batch went in error
|
789 |
if (is_wp_error($r)) {
|
790 |
+
$this->logger->error($r);
|
791 |
|
792 |
if (!$test && $r->get_error_code() == NewsletterMailer::ERROR_FATAL) {
|
793 |
$this->set_error_state_of_email($email, $r->get_error_message());
|
794 |
+
return $r;
|
795 |
}
|
|
|
|
|
|
|
796 |
}
|
797 |
|
798 |
if (!$supplied_users && !$test && $this->time_exceeded()) {
|
readme.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
=== Newsletter ===
|
2 |
Tags: newsletter, email marketing, welcome email, signup forms, contact, lead generation, marketing automation
|
3 |
Tested up to: 5.8.2
|
4 |
-
Stable tag: 7.3.
|
5 |
Contributors: satollo,webagile,michael-travan
|
6 |
License: GPLv2 or later
|
7 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -118,6 +118,11 @@ Thank you, The Newsletter Team
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
121 |
= 7.3.3 =
|
122 |
|
123 |
* Added "complained" status to subscriber filters
|
1 |
=== Newsletter ===
|
2 |
Tags: newsletter, email marketing, welcome email, signup forms, contact, lead generation, marketing automation
|
3 |
Tested up to: 5.8.2
|
4 |
+
Stable tag: 7.3.4
|
5 |
Contributors: satollo,webagile,michael-travan
|
6 |
License: GPLv2 or later
|
7 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 7.3.4 =
|
122 |
+
|
123 |
+
* Fixed delivery fatal error management
|
124 |
+
* Fixed link to the schduler dianostica panel
|
125 |
+
|
126 |
= 7.3.3 =
|
127 |
|
128 |
* Added "complained" status to subscriber filters
|
tnp-header.php
CHANGED
@@ -301,7 +301,7 @@ $warning |= empty($status_options['mail']);
|
|
301 |
if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
|
302 |
$x = NewsletterSystem::instance()->get_job_status();
|
303 |
if ($x !== NewsletterSystem::JOB_OK) {
|
304 |
-
echo '<div class="tnpc-warning">The are issues with the delivery engine. Please <a href="?page=
|
305 |
}
|
306 |
}
|
307 |
?>
|
301 |
if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
|
302 |
$x = NewsletterSystem::instance()->get_job_status();
|
303 |
if ($x !== NewsletterSystem::JOB_OK) {
|
304 |
+
echo '<div class="tnpc-warning">The are issues with the delivery engine. Please <a href="?page=newsletter_system_scheduler">check them here</a>.</div>';
|
305 |
}
|
306 |
}
|
307 |
?>
|