Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.70.1

Version Description

July 17 2017 = * Fix for SpamFireWall. * Spam detection improved.

Download this release

Release Info

Developer Safronik
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.70.1
Comparing to
See all releases

Code changes from version 5.70 to 5.70.1

cleantalk.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.70
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.70';
11
- $ct_agent_version = 'wordpress-570';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
+ Version: 5.70.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.70.1';
11
+ $ct_agent_version = 'wordpress-5701';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
inc/cleantalk-common.php CHANGED
@@ -796,18 +796,22 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
796
 
797
  // Names
798
  }elseif (preg_match("/name/i", $key)){
799
-
800
- if(preg_match("/first/i", $key) || preg_match("/fore/i", $key) || preg_match("/private/i", $key))
 
 
 
 
801
  $nickname['first'] = $value;
802
- elseif(preg_match("/last/i", $key) || preg_match("/sur/i", $key) || preg_match("/family/i", $key) || preg_match("/second/i", $key))
803
  $nickname['last'] = $value;
804
- elseif(!$nickname['nick'])
805
  $nickname['nick'] = $value;
806
  else
807
  $message[$prev_name.$key] = $value;
808
 
809
  // Subject
810
- }elseif ($subject === null && preg_match("/subj/i", $key)){
811
  $subject = $value;
812
 
813
  // Message
796
 
797
  // Names
798
  }elseif (preg_match("/name/i", $key)){
799
+
800
+ preg_match("/(first.?name)?(name.?first)?(forename)?/", $key, $match_forename);
801
+ preg_match("/(last.?name)?(family.?name)?(second.?name)?(surname)?/", $key, $match_surname);
802
+ preg_match("/(nick.?name)?(user.?name)?(nick)?/", $key, $match_nickname);
803
+
804
+ if(count($match_forename) > 1)
805
  $nickname['first'] = $value;
806
+ elseif(count($match_surname) > 1)
807
  $nickname['last'] = $value;
808
+ elseif(count($match_nickname) > 1)
809
  $nickname['nick'] = $value;
810
  else
811
  $message[$prev_name.$key] = $value;
812
 
813
  // Subject
814
+ }elseif ($subject === null && preg_match("/subject/i", $key)){
815
  $subject = $value;
816
 
817
  // Message
inc/cleantalk-public.php CHANGED
@@ -2422,7 +2422,7 @@ function ct_contact_form_validate() {
2422
  (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
2423
  (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
2424
  (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
2425
- (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'/lostpassword/') !== false) ||
2426
  (strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!== false && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
2427
  strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false||
2428
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
@@ -2481,11 +2481,11 @@ function ct_contact_form_validate() {
2481
 
2482
  $ct_temp_msg_data = ct_get_fields_any($_POST);
2483
 
2484
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2485
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2486
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2487
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2488
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2489
 
2490
  if ($subject != '') {
2491
  $message = array_merge(array('subject' => $subject), $message);
2422
  (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
2423
  (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
2424
  (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
2425
+ (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'lostpassword') !== false) ||
2426
  (strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!== false && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
2427
  strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false||
2428
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
2481
 
2482
  $ct_temp_msg_data = ct_get_fields_any($_POST);
2483
 
2484
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2485
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2486
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2487
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2488
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2489
 
2490
  if ($subject != '') {
2491
  $message = array_merge(array('subject' => $subject), $message);
lib/CleantalkSFW.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  /*
4
  * CleanTalk SpamFireWall base class
5
- * Version 1.2
6
- * Compatible with phpBB 3.1, SMF 2.0+, Wordpress.
7
  */
8
 
9
  namespace cleantalk\antispam;
@@ -27,73 +27,27 @@ class CleantalkSFW
27
 
28
  public function __construct()
29
  {
30
- if(defined("IN_PHPBB")){
31
- global $db, $table_prefix;
32
- $this->table_prefix = $table_prefix;
33
- $this->db = $db;
34
- }
35
- if(defined('SMF')){
36
- global $db_connection, $db_prefix;
37
- if (!isset($db_connection) || $db_connection === false){
38
- loadDatabase();
39
- }
40
- $this->table_prefix = $db_prefix;
41
- }
42
- if(defined("WPINC")){
43
- global $wpdb;
44
- $this->table_prefix = $wpdb->prefix;
45
- $this->db = $wpdb;
46
- }
47
  }
48
 
49
  public function unversal_query($query, $straight_query = false)
50
  {
51
- if(defined("IN_PHPBB")){
52
- $this->db_result = $this->db->sql_query($query);
53
- }
54
- if(defined("WPINC")){
55
- if($straight_query)
56
- $this->db_result = $this->db->query($query);
57
- else
58
- $this->query = $query;
59
- }
60
- if(defined('SMF')){
61
- global $smcFunc;
62
- $query = preg_replace("/\;$/", '', $query);
63
- $this->db_result = $smcFunc['db_query']('', $query, array('db_error_skip' => true));
64
- }
65
  }
66
 
67
  public function unversal_fetch()
68
  {
69
- if(defined("IN_PHPBB")){
70
- $this->db_result_data = $this->db->sql_fetchrow($this->db_result);
71
- $this->db->sql_freeresult($this->db_result);
72
- }
73
- if(defined("WPINC")){
74
- $this->db_result_data = $this->db->get_row($this->query, ARRAY_A);
75
- }
76
- if(defined('SMF')){
77
- global $smcFunc;
78
- $this->db_result_data = $smcFunc['db_fetch_assoc']($this->db_result);
79
- }
80
  }
81
 
82
  public function unversal_fetch_all()
83
  {
84
- if(defined("IN_PHPBB")){
85
- $this->db_result_data = $this->db->sql_fetchrowset($this->db_result);
86
- $this->db->sql_freeresult($this->db_result);
87
- }
88
- if(defined("WPINC")){
89
- $this->db_result_data = $this->db->get_results($this->query, ARRAY_A);
90
- }
91
- if(defined('SMF')){
92
- global $smcFunc;
93
- while ($row = $smcFunc['db_fetch_assoc']($this->db_result)){
94
- $this->db_result_data[] = $row;
95
- }
96
- }
97
  }
98
 
99
 
@@ -109,28 +63,14 @@ class CleantalkSFW
109
  $headers = apache_request_headers();
110
  $headers['X-Forwarded-For'] = isset($headers['X-Forwarded-For']) ? $headers['X-Forwarded-For'] : null;
111
  $headers['HTTP_X_FORWARDED_FOR'] = isset($headers['HTTP_X_FORWARDED_FOR']) ? $headers['HTTP_X_FORWARDED_FOR'] : null;
112
- if(defined("IN_PHPBB")){
113
- global $request;
114
- $headers['REMOTE_ADDR'] = $request->server('REMOTE_ADDR');
115
- $sfw_test_ip = $request->variable('sfw_test_ip', '');
116
- }else{
117
- $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
118
- $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
119
- }
120
  }else{
121
- if(defined("IN_PHPBB")){
122
- global $request;
123
- $headers['REMOTE_ADDR'] = $request->server('REMOTE_ADDR');
124
- $headers['X-Forwarded-For'] = $request->server('X-Forwarded-For');
125
- $headers['HTTP_X_FORWARDED_FOR'] = $request->server('HTTP_X_FORWARDED_FOR');
126
- $sfw_test_ip = $request->variable('sfw_test_ip', '');
127
- }else{
128
- $headers = $_SERVER;
129
- $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
130
- $headers['X-Forwarded-For'] = isset($headers['X-Forwarded-For']) ? $headers['X-Forwarded-For'] : null;
131
- $headers['HTTP_X_FORWARDED_FOR'] = isset($headers['HTTP_X_FORWARDED_FOR']) ? $headers['HTTP_X_FORWARDED_FOR'] : null;
132
- $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
133
- }
134
  }
135
 
136
  if( $headers['X-Forwarded-For'] ){
@@ -302,41 +242,20 @@ class CleantalkSFW
302
  */
303
  public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = ''){
304
 
305
- if(defined("IN_PHPBB")){
306
- global $request, $user;
307
- $user->add_lang_ext('cleantalk/antispam', 'common');
308
- }
309
-
310
  // File exists?
311
  if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
312
  $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
313
  }else{
314
- die($user->lang('SFW_DIE_NO_FILE'));
315
  }
316
 
317
  // Translation
318
- if(defined("IN_PHPBB")){
319
- $request_uri = $request->server('REQUEST_URI');
320
- $sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', $user->lang('SFW_DIE_NOTICE_IP'), $sfw_die_page);
321
- $sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', $user->lang('SFW_DIE_MAKE_SURE_JS_ENABLED'), $sfw_die_page);
322
- $sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', $user->lang('SFW_DIE_CLICK_TO_PASS'), $sfw_die_page);
323
- $sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', $user->lang('SFW_DIE_YOU_WILL_BE_REDIRECTED'), $sfw_die_page);
324
- $sfw_die_page = str_replace('{CLEANTALK_TITLE}', $user->lang('ACP_CLEANTALK_TITLE'), $sfw_die_page);
325
- }elseif(defined("WPINC")){
326
- $request_uri = $_SERVER['REQUEST_URI'];
327
- $sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', __('SpamFireWall is activated for your IP ', 'cleantalk'), $sfw_die_page);
328
- $sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', __('To continue working with web site, please make sure that you have enabled JavaScript.', 'cleantalk'), $sfw_die_page);
329
- $sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', __('Please click bellow to pass protection,', 'cleantalk'), $sfw_die_page);
330
- $sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', __('Or you will be automatically redirected to the requested page after 3 seconds.', 'cleantalk'), $sfw_die_page);
331
- $sfw_die_page = str_replace('{CLEANTALK_TITLE}', __('Antispam by CleanTalk', 'cleantalk'), $sfw_die_page);
332
- }else{
333
- $request_uri = $_SERVER['REQUEST_URI'];
334
- $sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', 'SpamFireWall is activated for your IP ', $sfw_die_page);
335
- $sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', 'To continue working with web site, please make sure that you have enabled JavaScript.', $sfw_die_page);
336
- $sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', 'Please click bellow to pass protection,', $sfw_die_page);
337
- $sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', 'Or you will be automatically redirected to the requested page after 3 seconds.', $sfw_die_page);
338
- $sfw_die_page = str_replace('{CLEANTALK_TITLE}', 'Antispam by CleanTalk', $sfw_die_page);
339
- }
340
 
341
  // Service info
342
  $sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ip, $sfw_die_page);
@@ -357,11 +276,8 @@ class CleantalkSFW
357
  $sfw_die_page = str_replace('{GENERATED}', "<h2 class='second'>The page was generated at&nbsp;".date("D, d M Y H:i:s")."</h2>",$sfw_die_page);
358
  }
359
 
360
- if(defined('WPINC')){
361
- wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
362
- }else{
363
- die($sfw_die_page);
364
- }
365
  }
366
 
367
 
2
 
3
  /*
4
  * CleanTalk SpamFireWall base class
5
+ * Version 1.3
6
+ * Compatible only with Wordpress.
7
  */
8
 
9
  namespace cleantalk\antispam;
27
 
28
  public function __construct()
29
  {
30
+ global $wpdb;
31
+ $this->table_prefix = $wpdb->prefix;
32
+ $this->db = $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  public function unversal_query($query, $straight_query = false)
36
  {
37
+ if($straight_query)
38
+ $this->db_result = $this->db->query($query);
39
+ else
40
+ $this->query = $query;
 
 
 
 
 
 
 
 
 
 
41
  }
42
 
43
  public function unversal_fetch()
44
  {
45
+ $this->db_result_data = $this->db->get_row($this->query, ARRAY_A);
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
  public function unversal_fetch_all()
49
  {
50
+ $this->db_result_data = $this->db->get_results($this->query, ARRAY_A);
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
 
63
  $headers = apache_request_headers();
64
  $headers['X-Forwarded-For'] = isset($headers['X-Forwarded-For']) ? $headers['X-Forwarded-For'] : null;
65
  $headers['HTTP_X_FORWARDED_FOR'] = isset($headers['HTTP_X_FORWARDED_FOR']) ? $headers['HTTP_X_FORWARDED_FOR'] : null;
66
+ $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
67
+ $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
 
 
 
 
 
 
68
  }else{
69
+ $headers = $_SERVER;
70
+ $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
71
+ $headers['X-Forwarded-For'] = isset($headers['X-Forwarded-For']) ? $headers['X-Forwarded-For'] : null;
72
+ $headers['HTTP_X_FORWARDED_FOR'] = isset($headers['HTTP_X_FORWARDED_FOR']) ? $headers['HTTP_X_FORWARDED_FOR'] : null;
73
+ $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
 
 
 
 
 
 
 
 
74
  }
75
 
76
  if( $headers['X-Forwarded-For'] ){
242
  */
243
  public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = ''){
244
 
 
 
 
 
 
245
  // File exists?
246
  if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
247
  $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
248
  }else{
249
+ wp_die("IP BLACKLISTED", "Blacklisted", Array('response'=>403), true);
250
  }
251
 
252
  // Translation
253
+ $request_uri = $_SERVER['REQUEST_URI'];
254
+ $sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', __('SpamFireWall is activated for your IP ', 'cleantalk'), $sfw_die_page);
255
+ $sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', __('To continue working with web site, please make sure that you have enabled JavaScript.', 'cleantalk'), $sfw_die_page);
256
+ $sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', __('Please click bellow to pass protection,', 'cleantalk'), $sfw_die_page);
257
+ $sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', __('Or you will be automatically redirected to the requested page after 3 seconds.', 'cleantalk'), $sfw_die_page);
258
+ $sfw_die_page = str_replace('{CLEANTALK_TITLE}', __('Antispam by CleanTalk', 'cleantalk'), $sfw_die_page);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
260
  // Service info
261
  $sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ip, $sfw_die_page);
276
  $sfw_die_page = str_replace('{GENERATED}', "<h2 class='second'>The page was generated at&nbsp;".date("D, d M Y H:i:s")."</h2>",$sfw_die_page);
277
  }
278
 
279
+ wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
280
+
 
 
 
281
  }
282
 
283
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00, sartemd174, amagsumov
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
- Stable tag: 5.70
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
@@ -504,6 +504,10 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
504
  1. The Dashboard with a map of most spam active countries per your account.
505
 
506
  == Changelog ==
 
 
 
 
507
  = 5.70 July 13 2017 =
508
  * New updater logic.
509
  * Self cron system.
@@ -1392,6 +1396,10 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1392
  * First version
1393
 
1394
  == Upgrade Notice ==
 
 
 
 
1395
  = 5.70 July 13 2017 =
1396
  * New updater logic.
1397
  * Self cron system.
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
+ Stable tag: 5.70.1
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
504
  1. The Dashboard with a map of most spam active countries per your account.
505
 
506
  == Changelog ==
507
+ = 5.70.1 July 17 2017 =
508
+ * Fix for SpamFireWall.
509
+ * Spam detection improved.
510
+
511
  = 5.70 July 13 2017 =
512
  * New updater logic.
513
  * Self cron system.
1396
  * First version
1397
 
1398
  == Upgrade Notice ==
1399
+ = 5.70.1 July 17 2017 =
1400
+ * Fix for SpamFireWall.
1401
+ * Spam detection improved.
1402
+
1403
  = 5.70 July 13 2017 =
1404
  * New updater logic.
1405
  * Self cron system.