Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.117.1

Version Description

April 5 2019 = * Fix: GDPR notice. * Fix: noCacheJS localization. * Fix: Fatal error when updating.

Download this release

Release Info

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

Code changes from version 5.117 to 5.117.1

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
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.
6
- Version: 5.117
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
@@ -31,6 +31,9 @@ define('APBCT_SETTINGS', 'cleantalk_settings'); //Option name wi
31
  define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
32
  define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
33
 
 
 
 
34
  // Sessions
35
  define('APBCT_SEESION__LIVE_TIME', 86400*3);
36
  define('APBCT_SEESION__CHANCE_TO_CLEAN', 5);
@@ -565,7 +568,7 @@ function apbct_activation( $network ) {
565
  }
566
 
567
  function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
568
- if (is_plugin_active_for_network('security-malware-firewall/security-malware-firewall.php')){
569
  switch_to_blog($blog_id);
570
  global $wpdb;
571
  $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
@@ -1239,6 +1242,15 @@ function apbct_is_ajax() {
1239
 
1240
  }
1241
 
 
 
 
 
 
 
 
 
 
1242
  /**
1243
  * Runs update actions for new version.
1244
  *
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.
6
+ Version: 5.117.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
31
  define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
32
  define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
33
 
34
+ // Multisite
35
+ define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
36
+
37
  // Sessions
38
  define('APBCT_SEESION__LIVE_TIME', 86400*3);
39
  define('APBCT_SEESION__CHANCE_TO_CLEAN', 5);
568
  }
569
 
570
  function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
571
+ if (apbct_is_plugin_active_for_network('security-malware-firewall/security-malware-firewall.php')){
572
  switch_to_blog($blog_id);
573
  global $wpdb;
574
  $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
1242
 
1243
  }
1244
 
1245
+ function apbct_is_plugin_active_for_network(){
1246
+ if ( ! APBCT_WPMS )
1247
+ return false;
1248
+ $plugins = get_site_option( 'active_sitewide_plugins' );
1249
+ return isset( $plugins[ $plugin ] )
1250
+ ? true
1251
+ : false;
1252
+ }
1253
+
1254
  /**
1255
  * Runs update actions for new version.
1256
  *
inc/cleantalk-ajax.php CHANGED
@@ -275,6 +275,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
275
  'simbatfa-init-otp', //Two-Factor Auth
276
  'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
277
  'boss_we_login', //Login form
 
278
  );
279
 
280
  //General post_info for all ajax calls
275
  'simbatfa-init-otp', //Two-Factor Auth
276
  'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
277
  'boss_we_login', //Login form
278
+ 'sidebar_login_process', // Login CF7
279
  );
280
 
281
  //General post_info for all ajax calls
inc/cleantalk-public.php CHANGED
@@ -2579,7 +2579,8 @@ function ct_contact_form_validate() {
2579
  (strpos($_SERVER['REQUEST_URI'],'membership-login')!==false ) || // Skip login form
2580
  (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
2581
  (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'MailChimp' && strpos($_SERVER['REQUEST_URI'], 'mc4wp-sync-api/webhook-listener') !== false) || // Mailchimp webhook skip
2582
- (strpos($_SERVER['REQUEST_URI'],'researcher-log-in')!==false ) // Skip login form
 
2583
  ) {
2584
  return null;
2585
  }
@@ -3059,10 +3060,10 @@ function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
3059
  $out = '';
3060
 
3061
  if(isset($attrs['id']))
3062
- $out .= 'ctPublic.gdpr_forms.push("'.$attrs['id'].'");';
3063
 
3064
  if(isset($attrs['text']))
3065
- $out .= 'ctPublic.gdpr_text = "'.$attrs['text'].'";';
3066
 
3067
  $out = '<script>'.$out.'</script>';
3068
  return $out;
2579
  (strpos($_SERVER['REQUEST_URI'],'membership-login')!==false ) || // Skip login form
2580
  (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
2581
  (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'MailChimp' && strpos($_SERVER['REQUEST_URI'], 'mc4wp-sync-api/webhook-listener') !== false) || // Mailchimp webhook skip
2582
+ (strpos($_SERVER['REQUEST_URI'],'researcher-log-in')!==false ) || // Skip login form
2583
+ (strpos($_SERVER['REQUEST_URI'],'admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves')!==false ) // Skip admin save callback
2584
  ) {
2585
  return null;
2586
  }
3060
  $out = '';
3061
 
3062
  if(isset($attrs['id']))
3063
+ $out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
3064
 
3065
  if(isset($attrs['text']))
3066
+ $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3067
 
3068
  $out = '<script>'.$out.'</script>';
3069
  return $out;
inc/cleantalk-updater.php CHANGED
@@ -114,7 +114,7 @@ function apbct_update_to_5_109_0(){
114
 
115
  global $apbct, $wpdb;
116
 
117
- if(is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
118
 
119
  $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
120
  `network` int(11) unsigned NOT NULL,
114
 
115
  global $apbct, $wpdb;
116
 
117
+ if(apbct_is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
118
 
119
  $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
120
  `network` int(11) unsigned NOT NULL,
inc/cleantalk_nocache.js CHANGED
@@ -1,11 +1,8 @@
1
  /*
2
  Assign default values for backend variables.
3
  */
4
- if (typeof ctNocache.set_cookies_flag === 'undefined') {
5
  ctNocache.set_cookies_flag = true;
6
- }
7
-
8
- if (typeof ctNocache.ajaxurl === 'undefined') {
9
  ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';
10
  }
11
 
1
  /*
2
  Assign default values for backend variables.
3
  */
4
+ if (typeof ctNocache === 'undefined') {
5
  ctNocache.set_cookies_flag = true;
 
 
 
6
  ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';
7
  }
8
 
inc/sfw_die_page.html CHANGED
@@ -53,6 +53,10 @@ function get_current_url() {
53
  <br />
54
  </div>
55
  </div>
 
 
 
 
56
  <div class='footer'>
57
  <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
58
  </div>
@@ -70,5 +74,6 @@ function get_current_url() {
70
  window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
71
  }, reload_timeout);
72
  </script>
 
73
  </body>
74
  </html>
53
  <br />
54
  </div>
55
  </div>
56
+ <div style='position: relative; line-height: 8px; text-align: center;'>
57
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
58
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
59
+ </div>
60
  <div class='footer'>
61
  <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
62
  </div>
74
  window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
75
  }, reload_timeout);
76
  </script>
77
+ {DEBUG}
78
  </body>
79
  </html>
lib/CleantalkSFW.php CHANGED
@@ -21,6 +21,8 @@ class CleantalkSFW extends CleantalkSFW_Base
21
  // Use default tables if not specified
22
  $this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
23
  $this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
 
 
24
  }
25
 
26
  /*
@@ -30,6 +32,8 @@ class CleantalkSFW extends CleantalkSFW_Base
30
  */
31
  public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = ''){
32
 
 
 
33
  // File exists?
34
  if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
35
  $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
@@ -47,11 +51,23 @@ class CleantalkSFW extends CleantalkSFW_Base
47
  $sfw_die_page = str_replace('{TEST_TITLE}', ($this->is_test ? __('This is the testing page for SpamFireWall', 'cleantalk') : ''), $sfw_die_page);
48
 
49
  // Service info
50
- $sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ip, $sfw_die_page);
51
- $sfw_die_page = str_replace('{REQUEST_URI}', $request_uri, $sfw_die_page);
52
- $sfw_die_page = str_replace('{COOKIE_PREFIX}', $cookie_prefix, $sfw_die_page);
53
- $sfw_die_page = str_replace('{COOKIE_DOMAIN}', $cookie_domain, $sfw_die_page);
54
- $sfw_die_page = str_replace('{SFW_COOKIE}', md5($this->blocked_ip.$api_key), $sfw_die_page);
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  // Headers
57
  if(headers_sent() === false){
21
  // Use default tables if not specified
22
  $this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
23
  $this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
24
+
25
+ $this->debug = isset($_GET['show_debug']) && intval($_GET['show_debug']) === 1 ? true : false;
26
  }
27
 
28
  /*
32
  */
33
  public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = ''){
34
 
35
+ global $apbct;
36
+
37
  // File exists?
38
  if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
39
  $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
51
  $sfw_die_page = str_replace('{TEST_TITLE}', ($this->is_test ? __('This is the testing page for SpamFireWall', 'cleantalk') : ''), $sfw_die_page);
52
 
53
  // Service info
54
+ $sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ip, $sfw_die_page);
55
+ $sfw_die_page = str_replace('{REQUEST_URI}', $request_uri, $sfw_die_page);
56
+ $sfw_die_page = str_replace('{COOKIE_PREFIX}', $cookie_prefix, $sfw_die_page);
57
+ $sfw_die_page = str_replace('{COOKIE_DOMAIN}', $cookie_domain, $sfw_die_page);
58
+ $sfw_die_page = str_replace('{SFW_COOKIE}', md5($this->blocked_ip.$api_key), $sfw_die_page);
59
+ $sfw_die_page = str_replace( "{SERVICE_ID}", $apbct->data['service_id'], $sfw_die_page );
60
+ $sfw_die_page = str_replace( "{HOST}", $_SERVER['HTTP_HOST'], $sfw_die_page );
61
+
62
+ if($this->debug){
63
+ $debug = '<h1>Networks</h1>'
64
+ . var_export($this->debug_networks, true)
65
+ . '<h1>Headers</h1>'
66
+ . var_export(apache_request_headers(), true);
67
+ }else
68
+ $debug = '';
69
+
70
+ $sfw_die_page = str_replace( "{DEBUG}", $debug, $sfw_die_page );
71
 
72
  // Headers
73
  if(headers_sent() === false){
lib/CleantalkSFW_Base.php CHANGED
@@ -28,6 +28,9 @@ class CleantalkSFW_Base
28
  protected $data_table;
29
  protected $log_table;
30
 
 
 
 
31
  /**
32
  * Creates connection to database
33
  *
@@ -40,7 +43,6 @@ class CleantalkSFW_Base
40
  */
41
  public function __construct($params, $username, $password)
42
  {
43
-
44
  // Creating database object
45
  $this->db = new ClentalkDB();
46
 
@@ -78,13 +80,14 @@ class CleantalkSFW_Base
78
  foreach($this->ip_array as $current_ip){
79
 
80
  $query = "SELECT
81
- COUNT(network) AS cnt
82
  FROM ".$this->data_table."
83
  WHERE network = ".sprintf("%u", ip2long($current_ip))." & mask;";
84
  $this->db->query($query)->fetch();
85
  if($this->db->result['cnt']){
86
  $this->result = true;
87
  $this->blocked_ip = $current_ip;
 
88
  }else{
89
  $this->passed_ip = $current_ip;
90
  }
@@ -208,9 +211,10 @@ class CleantalkSFW_Base
208
 
209
  for($count_result = 0; !gzeof($gf); ){
210
 
211
- $query = "INSERT INTO ".$this->data_table." VALUES ";
212
 
213
- for($i=0; APBCT_WRITE_LIMIT !== $i && !gzeof($gf); $i++, $count_result++){
 
 
214
 
215
  $entry = trim(gzgets($gf, 1024));
216
 
@@ -223,12 +227,12 @@ class CleantalkSFW_Base
223
  $mask = preg_replace('/[^\d]*/', '', $entry[1]);
224
 
225
  if(!$ip || !$mask) continue;
226
-
227
- $query.="(". $ip .",". $mask ."),";
228
 
229
  }
230
 
231
- $query = substr($query, 0, -1).';';
232
  $this->db->query($query, true);
233
 
234
  }
28
  protected $data_table;
29
  protected $log_table;
30
 
31
+ public $debug;
32
+ public $debug_networks = array();
33
+
34
  /**
35
  * Creates connection to database
36
  *
43
  */
44
  public function __construct($params, $username, $password)
45
  {
 
46
  // Creating database object
47
  $this->db = new ClentalkDB();
48
 
80
  foreach($this->ip_array as $current_ip){
81
 
82
  $query = "SELECT
83
+ COUNT(network) AS cnt, network, mask
84
  FROM ".$this->data_table."
85
  WHERE network = ".sprintf("%u", ip2long($current_ip))." & mask;";
86
  $this->db->query($query)->fetch();
87
  if($this->db->result['cnt']){
88
  $this->result = true;
89
  $this->blocked_ip = $current_ip;
90
+ $this->debug_networks[] = $this->db->result['network'].'/'.$this->db->result['mask'];
91
  }else{
92
  $this->passed_ip = $current_ip;
93
  }
211
 
212
  for($count_result = 0; !gzeof($gf); ){
213
 
 
214
 
215
+ $query = "INSERT INTO ".$this->data_table." VALUES %s";
216
+
217
+ for($i=0, $values = array(); APBCT_WRITE_LIMIT !== $i && !gzeof($gf); $i++, $count_result++){
218
 
219
  $entry = trim(gzgets($gf, 1024));
220
 
227
  $mask = preg_replace('/[^\d]*/', '', $entry[1]);
228
 
229
  if(!$ip || !$mask) continue;
230
+
231
+ $values[] = '('. $ip .','. $mask .')';
232
 
233
  }
234
 
235
+ $query = sprintf($query, implode(',', $values).';');
236
  $this->db->query($query, true);
237
 
238
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
- Tested up to: 5.1
6
- Stable tag: 5.117
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -55,7 +55,7 @@ Native spam protection for WordPress, JetPack comments and any other comment plu
55
  Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
56
 
57
  = Protection from contact form spam =
58
- The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin, WPForms Lite, Custom Contact, Forms, Amo Forms, Caldera Forms, Visual Form Builder, Contact Form Clean and Simple, Divi by Elegant Themes and any other themes or custom contact forms, amoForms, Custom Contact Form, Ultimate Form Builder, Contact Bank - Contact Forms Builder, Forms easily built with Smart Forms, Quick Contact Form, Usernoise contact form, cformsII - contact form, Contact Form by Web-Settler, HubSpot Marketing Free.
59
 
60
  = WooCommerce spam filter =
61
  Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
@@ -558,6 +558,11 @@ If your website has forms that send data to external sources, you can enable opt
558
  10. Website's options.
559
 
560
  == Changelog ==
 
 
 
 
 
561
  = 5.117 March 27 2019 =
562
  * New: Update logic runs on all pages.
563
  * New: Integration for Ajax Contact Forms plugin.
@@ -1833,6 +1838,11 @@ If your website has forms that send data to external sources, you can enable opt
1833
  * First version
1834
 
1835
  == Upgrade Notice ==
 
 
 
 
 
1836
  = 5.117 March 27 2019 =
1837
  * New: Update logic runs on all pages.
1838
  * New: Integration for Ajax Contact Forms plugin.
2
  Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
+ Tested up to: 5.2
6
+ Stable tag: 5.117.1
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
55
  Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
56
 
57
  = Protection from contact form spam =
58
+ The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin, WPForms Lite, Custom Contact, Forms, Amo Forms, Caldera Forms, Visual Form Builder, Contact Form Clean and Simple, Divi by Elegant Themes, The7 theme and any other themes or custom contact forms, amoForms, Custom Contact Form, Ultimate Form Builder, Contact Bank - Contact Forms Builder, Forms easily built with Smart Forms, Quick Contact Form, Usernoise contact form, cformsII - contact form, Contact Form by Web-Settler, HubSpot Marketing Free.
59
 
60
  = WooCommerce spam filter =
61
  Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
558
  10. Website's options.
559
 
560
  == Changelog ==
561
+ = 5.117.1 April 5 2019 =
562
+ * Fix: GDPR notice.
563
+ * Fix: noCacheJS localization.
564
+ * Fix: Fatal error when updating.
565
+
566
  = 5.117 March 27 2019 =
567
  * New: Update logic runs on all pages.
568
  * New: Integration for Ajax Contact Forms plugin.
1838
  * First version
1839
 
1840
  == Upgrade Notice ==
1841
+ = 5.117.1 April 5 2019 =
1842
+ * Fix: GDPR notice.
1843
+ * Fix: noCacheJS localization.
1844
+ * Fix: Fatal error when updating.
1845
+
1846
  = 5.117 March 27 2019 =
1847
  * New: Update logic runs on all pages.
1848
  * New: Integration for Ajax Contact Forms plugin.