Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.118.3

Version Description

April 29 2019 = * Fix: Spam statistics in dashboard widget. * Fix: IP detection. * Fix: Double check AJAX integrated forms like Ninja Forms. * Fix: Use url exclusions for AJAX forms.

Download this release

Release Info

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

Code changes from version 5.118.2 to 5.118.3

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.118.2
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
@@ -162,9 +162,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
162
  add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
163
  add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
164
  add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
165
- $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
166
- $cleantalk_hooked_actions[]='nf_ajax_submit';
167
- $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
168
 
169
  if(!is_admin() && !defined('DOING_AJAX')){
170
 
@@ -235,6 +232,9 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
235
 
236
  if(apbct_is_ajax() || isset($_POST['cma-action'])){
237
 
 
 
 
238
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
239
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
240
 
@@ -248,9 +248,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
248
  add_action( 'wp_ajax_ct_feedback_user', 'apbct_user__send_feedback',1 );
249
  }
250
 
251
- $cleantalk_hooked_actions = array();
252
- $cleantalk_ajax_actions_to_check = array();
253
-
254
  // Check AJAX requests
255
  // if User is not logged in
256
  // if Unknown action or Known action with mandatory check
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.118.3
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
162
  add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
163
  add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
164
  add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
 
 
 
165
 
166
  if(!is_admin() && !defined('DOING_AJAX')){
167
 
232
 
233
  if(apbct_is_ajax() || isset($_POST['cma-action'])){
234
 
235
+ $cleantalk_hooked_actions = array();
236
+ $cleantalk_ajax_actions_to_check = array();
237
+
238
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
239
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
240
 
248
  add_action( 'wp_ajax_ct_feedback_user', 'apbct_user__send_feedback',1 );
249
  }
250
 
 
 
 
251
  // Check AJAX requests
252
  // if User is not logged in
253
  // if Unknown action or Known action with mandatory check
inc/cleantalk-ajax.php CHANGED
@@ -134,6 +134,11 @@ $cleantalk_hooked_actions[]='rwp-submit-wrap';
134
 
135
  $cleantalk_hooked_actions[]='post_update';
136
 
 
 
 
 
 
137
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
138
 
139
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
@@ -281,11 +286,17 @@ function ct_ajax_hook($message_obj = false, $additional = false)
281
  'wpdUpdateAutomatically', //Comments update
282
  'upload-attachment', // Skip ulpload attachments
283
  'iwj_update_profile', //Skip profile page checker
 
284
  );
285
 
286
  //General post_info for all ajax calls
287
  $post_info = array('comment_type' => 'feedback_ajax');
288
-
 
 
 
 
 
289
  $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
290
  if ($checkjs && // Spammers usually fail the JS test
291
  (isset($_POST['action']) && in_array($_POST['action'], $skip_post))
134
 
135
  $cleantalk_hooked_actions[]='post_update';
136
 
137
+ /* Ninja Forms hoocked actions */
138
+ $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
139
+ $cleantalk_hooked_actions[]='nf_ajax_submit';
140
+ $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
141
+
142
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
143
 
144
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
286
  'wpdUpdateAutomatically', //Comments update
287
  'upload-attachment', // Skip ulpload attachments
288
  'iwj_update_profile', //Skip profile page checker
289
+ 'st_partner_create_service', //Skip add hotel via admin
290
  );
291
 
292
  //General post_info for all ajax calls
293
  $post_info = array('comment_type' => 'feedback_ajax');
294
+
295
+ // Use exclusions
296
+ if(check_url_exclusions()){
297
+ return false;
298
+ }
299
+
300
  $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
301
  if ($checkjs && // Spammers usually fail the JS test
302
  (isset($_POST['action']) && in_array($_POST['action'], $skip_post))
inc/cleantalk-common.php CHANGED
@@ -783,9 +783,15 @@ function check_url_exclusions($exclusions = NULL){
783
  if ((isset($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions) && sizeof($cleantalk_url_exclusions)>0) ||
784
  ($exclusions !== NULL && is_array($exclusions) && sizeof($exclusions)>0)
785
  ){
786
- foreach($cleantalk_url_exclusions as $key => $value){
787
- if(stripos($_SERVER['REQUEST_URI'], $value) !== false){
788
- return true;
 
 
 
 
 
 
789
  }
790
  }
791
  }
783
  if ((isset($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions) && sizeof($cleantalk_url_exclusions)>0) ||
784
  ($exclusions !== NULL && is_array($exclusions) && sizeof($exclusions)>0)
785
  ){
786
+
787
+ // Fix for AJAX forms
788
+ $haystack = $_SERVER['REQUEST_URI'] == '/wp-admin/admin-ajax.php' && !empty($_SERVER['HTTP_REFERER'])
789
+ ? $_SERVER['HTTP_REFERER']
790
+ : $_SERVER['REQUEST_URI'];
791
+
792
+ foreach($cleantalk_url_exclusions as $value){
793
+ if(stripos($haystack, $value) !== false){
794
+ return true;
795
  }
796
  }
797
  }
inc/cleantalk-public.php CHANGED
@@ -2020,8 +2020,9 @@ function apbct_form__ninjaForms__testSpam() {
2020
  global $apbct;
2021
 
2022
  if(
2023
- $apbct->settings['contact_forms_test'] == 0 ||
2024
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
 
2025
  ){
2026
  return;
2027
  }
2020
  global $apbct;
2021
 
2022
  if(
2023
+ $apbct->settings['contact_forms_test'] == 0
2024
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2025
+ || check_url_exclusions()
2026
  ){
2027
  return;
2028
  }
lib/CleantalkAPI_base.php CHANGED
@@ -582,11 +582,17 @@ class CleantalkAPI_base
582
 
583
  // get_antispam_report_breif
584
  case 'get_antispam_report_breif':
 
 
 
 
 
585
  for($tmp = array(), $i = 0; $i < 7; $i++){
586
  $tmp[date('Y-m-d', time() - 86400 * 7 + 86400 * $i)] = 0;
587
  }
588
  $out['spam_stat'] = (array) array_merge( $tmp, isset($out['spam_stat']) ? $out['spam_stat'] : array() );
589
  $out['top5_spam_ip'] = isset($out['top5_spam_ip']) ? $out['top5_spam_ip'] : array();
 
590
  break;
591
 
592
  default:
582
 
583
  // get_antispam_report_breif
584
  case 'get_antispam_report_breif':
585
+
586
+ $out = isset($result['data']) && is_array($result['data'])
587
+ ? $result['data']
588
+ : array('error' => true, 'error_string' => 'NO_DATA');
589
+
590
  for($tmp = array(), $i = 0; $i < 7; $i++){
591
  $tmp[date('Y-m-d', time() - 86400 * 7 + 86400 * $i)] = 0;
592
  }
593
  $out['spam_stat'] = (array) array_merge( $tmp, isset($out['spam_stat']) ? $out['spam_stat'] : array() );
594
  $out['top5_spam_ip'] = isset($out['top5_spam_ip']) ? $out['top5_spam_ip'] : array();
595
+
596
  break;
597
 
598
  default:
lib/CleantalkHelper.php CHANGED
@@ -61,7 +61,7 @@ class CleantalkHelper
61
  // X-Real-Ip
62
  if(isset($ips['x_real_ip'])){
63
  if(isset($headers['X-Real-Ip'])){
64
- $tmp = explode(",", trim($headers['X-Forwarded-For']));
65
  $tmp = trim($tmp[0]);
66
  $ip_type = self::ip__validate($tmp);
67
  if($ip_type){
61
  // X-Real-Ip
62
  if(isset($ips['x_real_ip'])){
63
  if(isset($headers['X-Real-Ip'])){
64
+ $tmp = explode(",", trim($headers['X-Real-Ip']));
65
  $tmp = trim($tmp[0]);
66
  $ip_type = self::ip__validate($tmp);
67
  if($ip_type){
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.118.2
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -558,6 +558,12 @@ 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.118.2 April 25 2019 =
562
  * Mod: Spam filtration quality improved.
563
  * Mod: Store SFW cookie for 30 days.
@@ -1865,6 +1871,12 @@ If your website has forms that send data to external sources, you can enable opt
1865
  * First version
1866
 
1867
  == Upgrade Notice ==
 
 
 
 
 
 
1868
  = 5.118.2 April 25 2019 =
1869
  * Mod: Spam filtration quality improved.
1870
  * Mod: Store SFW cookie for 30 days.
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.2
6
+ Stable tag: 5.118.3
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
558
  10. Website's options.
559
 
560
  == Changelog ==
561
+ = 5.118.3 April 29 2019 =
562
+ * Fix: Spam statistics in dashboard widget.
563
+ * Fix: IP detection.
564
+ * Fix: Double check AJAX integrated forms like Ninja Forms.
565
+ * Fix: Use url exclusions for AJAX forms.
566
+
567
  = 5.118.2 April 25 2019 =
568
  * Mod: Spam filtration quality improved.
569
  * Mod: Store SFW cookie for 30 days.
1871
  * First version
1872
 
1873
  == Upgrade Notice ==
1874
+ = 5.118.3 April 29 2019 =
1875
+ * Fix: Spam statistics in dashboard widget.
1876
+ * Fix: IP detection.
1877
+ * Fix: Double check AJAX integrated forms like Ninja Forms.
1878
+ * Fix: Use url exclusions for AJAX forms.
1879
+
1880
  = 5.118.2 April 25 2019 =
1881
  * Mod: Spam filtration quality improved.
1882
  * Mod: Store SFW cookie for 30 days.