Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.138.1

Version Description

May 20 2020 = * Fix: Ninja Forms. Spam submissions.

Download this release

Release Info

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

Code changes from version 5.138 to 5.138.1

Files changed (3) hide show
  1. cleantalk.php +21 -7
  2. inc/cleantalk-public.php +11 -0
  3. readme.txt +4 -1
cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://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.138
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk
@@ -98,6 +98,12 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
98
 
99
  $apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
100
 
 
 
 
 
 
 
101
  if(!$apbct->white_label){
102
  require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
103
  }
@@ -577,7 +583,7 @@ function apbct_sfw__check()
577
  $apbct->data['sfw_counter']['all']++;
578
  $apbct->saveData();
579
  if(!headers_sent())
580
- apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', null, false, true, 'Lax' );
581
  }
582
  break;
583
  }else{
@@ -591,8 +597,8 @@ function apbct_sfw__check()
591
  $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
592
  if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
593
  $is_sfw_check = false;
594
- setcookie ('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/');
595
- setcookie ('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/');
596
  }
597
  unset($spbc_settings, $spbc_key);
598
  }
@@ -627,7 +633,7 @@ function apbct_sfw__check()
627
  }else{
628
  reset($sfw->passed_ips);
629
  if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
630
- setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', null,false);
631
  }
632
  }
633
  unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
@@ -821,8 +827,10 @@ function apbct_deactivation( $network ) {
821
  apbct_deactivation__delete_common_tables();
822
  delete_option('cleantalk_cron'); // Deleting cron entries
823
 
824
- if($apbct->settings['complete_deactivation'])
825
  apbct_deactivation__delete_all_options();
 
 
826
 
827
  }
828
  }
@@ -839,6 +847,7 @@ function apbct_deactivation__delete_all_options(){
839
  delete_option('cleantalk_server');
840
  delete_option('cleantalk_stats');
841
  delete_option('cleantalk_timelabel_reg');
 
842
  }
843
 
844
  /**
@@ -862,7 +871,12 @@ function apbct_deactivation__delete_blog_tables() {
862
  $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
863
  $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
864
  $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
865
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_spamscan_logs`;'); // Deleting user/comments scan result table
 
 
 
 
 
866
  }
867
 
868
  /**
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://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.138.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk
98
 
99
  $apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
100
 
101
+ $apbct->cookie_domain = isset( $_SERVER['HTTP_HOST'] )
102
+ ? '.' . $_SERVER['HTTP_HOST']
103
+ : isset( $_SERVER['SERVER_NAME'] )
104
+ ? '.' . $_SERVER['SERVER_NAME']
105
+ : null;
106
+
107
  if(!$apbct->white_label){
108
  require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
109
  }
583
  $apbct->data['sfw_counter']['all']++;
584
  $apbct->saveData();
585
  if(!headers_sent())
586
+ apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', $apbct->cookie_domain, false, true, 'Lax' );
587
  }
588
  break;
589
  }else{
597
  $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
598
  if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
599
  $is_sfw_check = false;
600
+ setcookie ('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/', $apbct->cookie_domain);
601
+ setcookie ('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/', $apbct->cookie_domain);
602
  }
603
  unset($spbc_settings, $spbc_key);
604
  }
633
  }else{
634
  reset($sfw->passed_ips);
635
  if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
636
+ setcookie( 'ct_sfw_pass_key', md5( $sfw->passed_ips[ key( $sfw->passed_ips ) ]['ip'] . $apbct->api_key ), time() + 86400 * 30, '/', '.' . $apbct->cookie_domain, false );
637
  }
638
  }
639
  unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
827
  apbct_deactivation__delete_common_tables();
828
  delete_option('cleantalk_cron'); // Deleting cron entries
829
 
830
+ if($apbct->settings['complete_deactivation']) {
831
  apbct_deactivation__delete_all_options();
832
+ apbct_deactivation__delete_meta();
833
+ }
834
 
835
  }
836
  }
847
  delete_option('cleantalk_server');
848
  delete_option('cleantalk_stats');
849
  delete_option('cleantalk_timelabel_reg');
850
+ delete_option('cleantalk_debug');
851
  }
852
 
853
  /**
871
  $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
872
  $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
873
  $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
874
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_spamscan_logs`;'); // Deleting user/comments scan result table
875
+ }
876
+
877
+ function apbct_deactivation__delete_meta(){
878
+ global $wpdb;
879
+ $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_bad', 'ct_checked', 'ct_checked_now', 'ct_marked_as_spam', 'ct_hash');");
880
  }
881
 
882
  /**
inc/cleantalk-public.php CHANGED
@@ -2462,9 +2462,20 @@ function apbct_form__ninjaForms__testSpam() {
2462
  // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2463
  $apbct->response = $ct_result->comment;
2464
  add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
 
 
2465
  }
2466
  }
2467
 
 
 
 
 
 
 
 
 
 
2468
  function apbct_form__ninjaForms__changeResponse( $data ) {
2469
 
2470
  global $apbct;
2462
  // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2463
  $apbct->response = $ct_result->comment;
2464
  add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
2465
+ add_action( 'ninja_forms_action_email_send', 'apbct_form__ninjaForms__stopEmail', 1, 5 ); // Prevent mail notification
2466
+ add_action( 'ninja_forms_save_submission', 'apbct_form__ninjaForms__preventSubmission', 1, 2 ); // Prevent mail notification
2467
  }
2468
  }
2469
 
2470
+ function apbct_form__ninjaForms__preventSubmission($some, $form_id){
2471
+ return false;
2472
+ }
2473
+
2474
+ function apbct_form__ninjaForms__stopEmail($some, $action_settings, $message, $headers, $attachments){
2475
+ global $apbct;
2476
+ throw new Exception($apbct->response);
2477
+ }
2478
+
2479
  function apbct_form__ninjaForms__changeResponse( $data ) {
2480
 
2481
  global $apbct;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, woocommerce, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
  Requires PHP: 5.4
7
- Stable tag: 5.138
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -574,6 +574,9 @@ If your website has forms that send data to external sources, you can enable opt
574
 
575
  == Changelog ==
576
 
 
 
 
577
  = 5.138 May 14 2020 =
578
  * Fix: Scan users fixed.
579
  * Fix: Notice fixed (Creating default object from empty value).
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
  Requires PHP: 5.4
7
+ Stable tag: 5.138.1
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
574
 
575
  == Changelog ==
576
 
577
+ = 5.138.1 May 20 2020 =
578
+ * Fix: Ninja Forms. Spam submissions.
579
+
580
  = 5.138 May 14 2020 =
581
  * Fix: Scan users fixed.
582
  * Fix: Notice fixed (Creating default object from empty value).