Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.107

Version Description

October 29 2018 = * Fix: Ninja Forms integration. * Fix: Cookie usage. * Add: Capturing AJAX responses from non integrated forms. * Spam protection improved. * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.106 to 5.107

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.106
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
@@ -129,6 +129,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
129
  // Set cookie only for unauthorized users and for non-AJAX requests
130
  if (!is_admin()){
131
  add_action('wp','apbct_cookie', 2);
 
 
132
  }
133
 
134
  // Early checks
@@ -145,9 +147,20 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
145
 
146
  }
147
 
 
148
  if(isset($_SERVER['REQUEST_URI']) && stripos($_SERVER['REQUEST_URI'],'admin-ajax.php') !== false && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit')
149
  $_POST['action']='ninja_forms_ajax_submit';
150
 
 
 
 
 
 
 
 
 
 
 
151
  if(!is_admin() && !defined('DOING_AJAX')){
152
 
153
  // Remote calls
@@ -157,7 +170,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
157
  }
158
 
159
  // SpamFireWall check
160
- if( $apbct->settings['spam_firewall'] == 1 && !is_admin() || $apbct->settings['spam_firewall'] ==1 && defined( 'DOING_AJAX' ) && DOING_AJAX && $_SERVER["REQUEST_METHOD"] == 'GET'){
 
161
  apbct_sfw__check();
162
  }
163
 
@@ -640,6 +654,10 @@ function apbct_update(){
640
  $upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
641
  $upgrader->upgrade($plugin);
642
 
 
 
 
 
643
  if($upgrader->apbct_result === 'OK'){
644
 
645
  $result = activate_plugins( $plugin );
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.107
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
129
  // Set cookie only for unauthorized users and for non-AJAX requests
130
  if (!is_admin()){
131
  add_action('wp','apbct_cookie', 2);
132
+ if (empty($_POST) && empty($_GET['action']))
133
+ apbct_cookie();
134
  }
135
 
136
  // Early checks
147
 
148
  }
149
 
150
+ // Ninja Forms. Making GET action to POST action
151
  if(isset($_SERVER['REQUEST_URI']) && stripos($_SERVER['REQUEST_URI'],'admin-ajax.php') !== false && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit')
152
  $_POST['action']='ninja_forms_ajax_submit';
153
 
154
+ add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
155
+ add_action( 'wp_ajax_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
156
+ add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
157
+ add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
158
+ add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
159
+ $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
160
+ $cleantalk_hooked_actions[]='nf_ajax_submit';
161
+ $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
162
+
163
+
164
  if(!is_admin() && !defined('DOING_AJAX')){
165
 
166
  // Remote calls
170
  }
171
 
172
  // SpamFireWall check
173
+ if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
174
+ $apbct->settings['spam_firewall'] == 1 && !is_admin() || $apbct->settings['spam_firewall'] ==1 && defined( 'DOING_AJAX' ) && DOING_AJAX && $_SERVER["REQUEST_METHOD"] == 'GET'){
175
  apbct_sfw__check();
176
  }
177
 
654
  $upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
655
  $upgrader->upgrade($plugin);
656
 
657
+ // Changing response UP_TO_DATE to OK
658
+ if($upgrader->apbct_result === 'UP_TO_DATE')
659
+ $upgrader->apbct_result = 'OK';
660
+
661
  if($upgrader->apbct_result === 'OK'){
662
 
663
  $result = activate_plugins( $plugin );
inc/cleantalk-admin.php CHANGED
@@ -138,9 +138,9 @@ function apbct_admin__init(){
138
  if(is_main_site()){
139
  require_once('cleantalk-updater.php');
140
  $result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
 
141
  //If update is successfull
142
  if($result === true){
143
- ct_send_feedback('0:' . CLEANTALK_AGENT ); // Send feedback to let cloud know about updated version.
144
  $apbct->data['plugin_version'] = APBCT_VERSION;
145
  $apbct->saveData();
146
  }
138
  if(is_main_site()){
139
  require_once('cleantalk-updater.php');
140
  $result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
141
+ ct_send_feedback('0:' . CLEANTALK_AGENT ); // Send feedback to let cloud know about updated version.
142
  //If update is successfull
143
  if($result === true){
 
144
  $apbct->data['plugin_version'] = APBCT_VERSION;
145
  $apbct->saveData();
146
  }
inc/cleantalk-ajax.php CHANGED
@@ -124,13 +124,6 @@ $cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
124
  /**hooks for cm answers pro */
125
  add_action( 'wp', 'ct_ajax_hook',1 );
126
 
127
- /* hooks for ninja forms ajax*/
128
- add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
129
- add_action( 'wp_ajax_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
130
-
131
- add_action( 'ninja_forms_process', 'ct_ajax_hook',1 );
132
- $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
133
-
134
  /* hooks for contact forms by web settler ajax*/
135
  add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
136
  $cleantalk_hooked_actions[]='smuzform_form_submit';
@@ -248,13 +241,7 @@ function ct_mc4wp_ajax_hook( array $errors )
248
  function ct_ajax_hook($message_obj = false, $additional = false)
249
  {
250
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
251
- global $apbct, $ct_checkjs_register_form, $bp, $ct_signup_done, $ct_negative_comment, $current_user;
252
-
253
- $sender_email = null;
254
- $message = '';
255
- $sender_nickname = null;
256
- $contact = true;
257
- $subject = '';
258
 
259
  //
260
  // Skip test if Custom contact forms is disabled.
@@ -267,7 +254,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
267
  // Go out because we call it on backend.
268
  //
269
  if( (ct_is_user_enable() === false || (function_exists('get_current_user_id') && get_current_user_id() != 0)) &&
270
- (strval(current_action()) != 'et_pre_insert_answer' && isset($message_obj['author']) && intval($message_obj['author']) == 0) //QAEngine Theme fix
271
  ){
272
  return false;
273
  }
@@ -294,8 +281,10 @@ function ct_ajax_hook($message_obj = false, $additional = false)
294
  $sender_nickname = '';
295
 
296
  //QAEngine Theme answers
297
- if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['author'], $message_obj['post_content']) ){
298
  $curr_user = get_user_by('id', $message_obj['author']);
 
 
299
  $ct_post_temp['comment'] = $message_obj['post_content'];
300
  $ct_post_temp['email'] = $curr_user->data->user_email;
301
  $ct_post_temp['name'] = $curr_user->data->user_login;
@@ -356,14 +345,6 @@ function ct_ajax_hook($message_obj = false, $additional = false)
356
  } unset($key ,$value);
357
  }
358
 
359
- //Ninja Forms xml fix
360
- if (isset($_POST['action']) && $_POST['action'] === 'nf_ajax_submit'){
361
- foreach ($message as $key => $value){
362
- if (strpos($value, '<xml>') !== false)
363
- unset($message[$key]);
364
- }
365
- }
366
-
367
  $base_call_result = apbct_base_call(
368
  array(
369
  'message' => $message,
@@ -465,19 +446,6 @@ function ct_ajax_hook($message_obj = false, $additional = false)
465
  print $ct_result->comment;
466
  die();
467
  }
468
- else if(isset($_POST['action']) && $_POST['action']=='ninja_forms_ajax_submit')
469
- {
470
- print '{"form_id":'.$_POST['_form_id'].',"errors":false,"success":{"success_msg-Success":"'.$ct_result->comment.'"}}';
471
- die();
472
- }
473
- else if(isset($_POST['action']) && $_POST['action']=='nf_ajax_submit')
474
- {
475
- $nf_data = json_decode($_POST['formData'], true);
476
- // print '{data:{{"form_id":'.$nf_data['id'].',"errors":false,"success":{"success_msg-Success":"'.$ct_result->comment.'"}}}}'; \\Old version
477
- print '{"data":{"form_id":"'.$nf_data['id'].'","settings":{},"extra":[],"fields":{},"processed_actions":[],"actions":{"success_message": "<font style=\"color: red\">'.$ct_result->comment.'</font><br><br>"}},"errors":[],"debug":[]}';
478
- die();
479
- }
480
-
481
  // WooWaitList
482
  // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
483
  else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
@@ -552,8 +520,8 @@ function ct_ajax_hook($message_obj = false, $additional = false)
552
  return 'ct_mc4wp_response';
553
  }
554
  // QAEngine Theme answers
555
- elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['author'], $message_obj['post_content']) ){
556
- return new WP_Error('Spam comment', $ct_result->comment);
557
  }
558
  //Convertplug. Strpos because action value dynamically changes and depends on mailing service
559
  elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
@@ -653,7 +621,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
653
  //Allow == 1
654
  else{
655
  //QAEngine Theme answers
656
- if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['author'], $message_obj['post_content']) ){
657
  return $message_obj;
658
  }
659
  }
124
  /**hooks for cm answers pro */
125
  add_action( 'wp', 'ct_ajax_hook',1 );
126
 
 
 
 
 
 
 
 
127
  /* hooks for contact forms by web settler ajax*/
128
  add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
129
  $cleantalk_hooked_actions[]='smuzform_form_submit';
241
  function ct_ajax_hook($message_obj = false, $additional = false)
242
  {
243
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
244
+ global $apbct;
 
 
 
 
 
 
245
 
246
  //
247
  // Skip test if Custom contact forms is disabled.
254
  // Go out because we call it on backend.
255
  //
256
  if( (ct_is_user_enable() === false || (function_exists('get_current_user_id') && get_current_user_id() != 0)) &&
257
+ (strval(current_action()) != 'et_pre_insert_answer' && (isset($message_obj['author']) && intval($message_obj['author']) == 0) || (isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)) //QAEngine Theme fix
258
  ){
259
  return false;
260
  }
281
  $sender_nickname = '';
282
 
283
  //QAEngine Theme answers
284
+ if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
285
  $curr_user = get_user_by('id', $message_obj['author']);
286
+ if (!$curr_user)
287
+ $curr_user = get_user_by('id', $message_obj['post_author']);
288
  $ct_post_temp['comment'] = $message_obj['post_content'];
289
  $ct_post_temp['email'] = $curr_user->data->user_email;
290
  $ct_post_temp['name'] = $curr_user->data->user_login;
345
  } unset($key ,$value);
346
  }
347
 
 
 
 
 
 
 
 
 
348
  $base_call_result = apbct_base_call(
349
  array(
350
  'message' => $message,
446
  print $ct_result->comment;
447
  die();
448
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  // WooWaitList
450
  // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
451
  else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
520
  return 'ct_mc4wp_response';
521
  }
522
  // QAEngine Theme answers
523
+ elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
524
+ throw new Exception($ct_result->comment);
525
  }
526
  //Convertplug. Strpos because action value dynamically changes and depends on mailing service
527
  elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
621
  //Allow == 1
622
  else{
623
  //QAEngine Theme answers
624
+ if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
625
  return $message_obj;
626
  }
627
  }
inc/cleantalk-common.php CHANGED
@@ -491,7 +491,8 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
491
  foreach($arr as $key => $value){
492
 
493
  if(gettype($value)=='string'){
494
- $decoded_json_value = json_decode($value, true);
 
495
  if($decoded_json_value !== null)
496
  $value = $decoded_json_value;
497
  }
491
  foreach($arr as $key => $value){
492
 
493
  if(gettype($value)=='string'){
494
+ $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
495
+ $decoded_json_value = json_decode($tmp, true);
496
  if($decoded_json_value !== null)
497
  $value = $decoded_json_value;
498
  }
inc/cleantalk-public.php CHANGED
@@ -996,10 +996,8 @@ function ct_die_extended($comment_body) {
996
  *
997
  */
998
  function apbct_js_test($field_name = 'ct_checkjs', $data = null, $random_key = false) {
999
- global $apbct;
1000
-
1001
-
1002
 
 
1003
 
1004
  $checkjs = null;
1005
  $js_post_value = null;
@@ -1008,29 +1006,17 @@ function apbct_js_test($field_name = 'ct_checkjs', $data = null, $random_key = f
1008
  return $checkjs;
1009
 
1010
  if (isset($data[$field_name])) {
 
1011
  $js_post_value = $data[$field_name];
1012
 
1013
- //
1014
  // Random key check
1015
- //
1016
  if ($random_key) {
1017
-
1018
  $keys = $apbct->js_keys;
1019
- if (isset($keys[$js_post_value])) {
1020
- $checkjs = 1;
1021
- } else {
1022
- $checkjs = 0;
1023
- }
1024
  } else {
1025
  $ct_challenge = ct_get_checkjs_value();
1026
-
1027
- if(preg_match("/$ct_challenge/", $js_post_value)) {
1028
- $checkjs = 1;
1029
- } else {
1030
- $checkjs = 0;
1031
- }
1032
  }
1033
-
1034
 
1035
  }
1036
 
@@ -1661,8 +1647,8 @@ function apbct_form__contactForm7__testSpam($param) {
1661
  $ct_result = $base_call_result['ct_result'];
1662
 
1663
  // Change mail notification if license is out of date
1664
- if($apbct->data['moderate'] === 0 &&
1665
- ($ct_result->fast_submit === 0 || $ct_result->blacklisted === 0 || $ct_result->js_disabled === 0)
1666
  ){
1667
  $apbct->sender_email = $sender_email;
1668
  $apbct->sender_ip = CleantalkHelper::ip_get(array('real'));
@@ -1723,6 +1709,101 @@ function apbct_form__contactForm7__changeMailNotification($component){
1723
  return (array) $component;
1724
  }
1725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1726
  /**
1727
  * Inserts anti-spam hidden to Fast Secure contact form
1728
  */
@@ -2359,12 +2440,12 @@ function ct_enqueue_scripts_public($hook){
2359
  if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
2360
 
2361
  // Differnt JS params
2362
- wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.js', array(), APBCT_VERSION, false /*in header*/);
2363
 
2364
  // GDPR script
2365
  if(shortcode_exists( 'cleantalk_gdpr_form')){
2366
 
2367
- wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.js', array('jquery'), APBCT_VERSION);
2368
 
2369
  wp_localize_script('ct_public_gdpr', 'ctPublic', array(
2370
  'gdpr_forms' => $apbct->settings['gdpr_forms_id'] ? explode(', ', $apbct->settings['gdpr_forms_id']) : array(),
996
  *
997
  */
998
  function apbct_js_test($field_name = 'ct_checkjs', $data = null, $random_key = false) {
 
 
 
999
 
1000
+ global $apbct;
1001
 
1002
  $checkjs = null;
1003
  $js_post_value = null;
1006
  return $checkjs;
1007
 
1008
  if (isset($data[$field_name])) {
1009
+
1010
  $js_post_value = $data[$field_name];
1011
 
 
1012
  // Random key check
 
1013
  if ($random_key) {
 
1014
  $keys = $apbct->js_keys;
1015
+ $checkjs = isset($keys[$js_post_value]) ? 1 : 0;
 
 
 
 
1016
  } else {
1017
  $ct_challenge = ct_get_checkjs_value();
1018
+ $checkjs = preg_match("/$ct_challenge/", $js_post_value) ? 1 : 0;
 
 
 
 
 
1019
  }
 
1020
 
1021
  }
1022
 
1647
  $ct_result = $base_call_result['ct_result'];
1648
 
1649
  // Change mail notification if license is out of date
1650
+ if($apbct->data['moderate'] == 0 &&
1651
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
1652
  ){
1653
  $apbct->sender_email = $sender_email;
1654
  $apbct->sender_ip = CleantalkHelper::ip_get(array('real'));
1709
  return (array) $component;
1710
  }
1711
 
1712
+ /**
1713
+ * Test Ninja Forms message for spam
1714
+ */
1715
+ function apbct_form__ninjaForms__testSpam() {
1716
+
1717
+ global $apbct;
1718
+
1719
+ if(
1720
+ $apbct->settings['contact_forms_test'] == 0 ||
1721
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
1722
+ ){
1723
+ return;
1724
+ }
1725
+
1726
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
1727
+
1728
+ // Choosing between POST and GET
1729
+ $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
1730
+
1731
+ $sender_email = ($params['email'] ? $params['email'] : '');
1732
+ $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
1733
+ $subject = ($params['subject'] ? $params['subject'] : '');
1734
+ $message = ($params['message'] ? $params['message'] : array());
1735
+ if ($subject != '') {
1736
+ $message = array_merge(array('subject' => $subject), $message);
1737
+ }
1738
+
1739
+ //Ninja Forms xml fix
1740
+ foreach ($message as $key => $value){
1741
+ if (strpos($value, '<xml>') !== false)
1742
+ unset($message[$key]);
1743
+ }
1744
+
1745
+ $base_call_result = apbct_base_call(
1746
+ array(
1747
+ 'message' => $message,
1748
+ 'sender_email' => $sender_email,
1749
+ 'sender_nickname' => $sender_nickname,
1750
+ 'post_info' => array('comment_type' => 'feedback'),
1751
+ 'checkjs' => $checkjs,
1752
+ )
1753
+ );
1754
+ $ct_result = $base_call_result['ct_result'];
1755
+
1756
+ // Change mail notification if license is out of date
1757
+ if($apbct->data['moderate'] == 0 &&
1758
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
1759
+ ){
1760
+ $apbct->sender_email = $sender_email;
1761
+ $apbct->sender_ip = CleantalkHelper::ip_get(array('real'));
1762
+ add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
1763
+ }
1764
+
1765
+ if ($ct_result->allow == 0) {
1766
+
1767
+ die(json_encode(
1768
+ array(
1769
+ 'apbct' => array(
1770
+ 'blocked' => true,
1771
+ 'comment' => $ct_result->comment,
1772
+ )
1773
+ )
1774
+ ));
1775
+
1776
+ }
1777
+ }
1778
+
1779
+ /**
1780
+ * Changes email notification for succes subscription for Ninja Forms
1781
+ *
1782
+ * @param string $message Body of email notification
1783
+ * @return string Body for email notification
1784
+ */
1785
+ function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
1786
+
1787
+ global $apbct;
1788
+
1789
+ if($action_settings['to'] !== $apbct->sender_email){
1790
+
1791
+ $message .= wpautop(PHP_EOL . '---'
1792
+ .PHP_EOL
1793
+ .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
1794
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1795
+ .PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
1796
+ .PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
1797
+ .PHP_EOL . sprintf(
1798
+ __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
1799
+ '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam" target="_blank">',
1800
+ '</a>'
1801
+ ));
1802
+ }
1803
+
1804
+ return $message;
1805
+ }
1806
+
1807
  /**
1808
  * Inserts anti-spam hidden to Fast Secure contact form
1809
  */
2440
  if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
2441
 
2442
  // Differnt JS params
2443
+ wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.js', array('jquery'), APBCT_VERSION, false /*in header*/);
2444
 
2445
  // GDPR script
2446
  if(shortcode_exists( 'cleantalk_gdpr_form')){
2447
 
2448
+ wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
2449
 
2450
  wp_localize_script('ct_public_gdpr', 'ctPublic', array(
2451
  'gdpr_forms' => $apbct->settings['gdpr_forms_id'] ? explode(', ', $apbct->settings['gdpr_forms_id']) : array(),
inc/cleantalk-settings.php CHANGED
@@ -725,6 +725,7 @@ function apbct_settings__field__draw($params = array()){
725
  global $apbct;
726
 
727
  echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
 
728
  switch($params['type']){
729
 
730
  // Checkbox type
725
  global $apbct;
726
 
727
  echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
728
+
729
  switch($params['type']){
730
 
731
  // Checkbox type
js/apbct-public--gdpr.js CHANGED
@@ -1,4 +1,4 @@
1
- function apbct_gdpr__form_append_notice(){
2
 
3
  if(!ctPublic.gdpr_forms) return;
4
 
@@ -20,14 +20,10 @@ function apbct_gdpr__form_append_notice(){
20
  }
21
 
22
  // Adding notice
23
- if(elem.is('form') || elem.attr('role') == 'form'){
24
  elem.append('<input id="apbct_gdpr_'+i+'" type="checkbox" required="required " style="margin-right: 10px;">')
25
  .append('<label for="apbct_gdpr_'+i+'">'+ctPublic.gdpr_text+'</label>');
26
  }
27
  });
28
 
29
- }
30
-
31
- jQuery(document).ready(function(){
32
- apbct_gdpr__form_append_notice();
33
  });
1
+ jQuery(document).ready(function(){
2
 
3
  if(!ctPublic.gdpr_forms) return;
4
 
20
  }
21
 
22
  // Adding notice
23
+ if(elem.is('form') || elem.attr('role') === 'form'){
24
  elem.append('<input id="apbct_gdpr_'+i+'" type="checkbox" required="required " style="margin-right: 10px;">')
25
  .append('<label for="apbct_gdpr_'+i+'">'+ctPublic.gdpr_text+'</label>');
26
  }
27
  });
28
 
 
 
 
 
29
  });
js/apbct-public.js CHANGED
@@ -92,9 +92,9 @@ function apbct_ready(){
92
 
93
  // Get only fields
94
  var elements = [];
95
- for(var key in document.forms[0].elements){
96
  if(!isNaN(+key))
97
- elements[key] = document.forms[0].elements[key];
98
  }
99
 
100
  // Filter fields
@@ -106,7 +106,7 @@ function apbct_ready(){
106
  if( getComputedStyle(elem).display === "none" || // hidden
107
  getComputedStyle(elem).visibility === "hidden" || // hidden
108
  getComputedStyle(elem).width === "0" || // hidden
109
- getComputedStyle(elem).heigth === "0" || // hidden
110
  getComputedStyle(elem).opacity === "0" || // hidden
111
  elem.getAttribute("type") === "hidden" || // type == hidden
112
  elem.getAttribute("type") === "submit" || // type == submit
@@ -151,4 +151,17 @@ function apbct_ready(){
151
  }
152
  }, 1000);
153
  }
154
- apbct_attach_event_handler(window, "DOMContentLoaded", apbct_ready);
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  // Get only fields
94
  var elements = [];
95
+ for(var key in this.elements){
96
  if(!isNaN(+key))
97
+ elements[key] = this.elements[key];
98
  }
99
 
100
  // Filter fields
106
  if( getComputedStyle(elem).display === "none" || // hidden
107
  getComputedStyle(elem).visibility === "hidden" || // hidden
108
  getComputedStyle(elem).width === "0" || // hidden
109
+ getComputedStyle(elem).height === "0" || // hidden
110
  getComputedStyle(elem).opacity === "0" || // hidden
111
  elem.getAttribute("type") === "hidden" || // type == hidden
112
  elem.getAttribute("type") === "submit" || // type == submit
151
  }
152
  }, 1000);
153
  }
154
+ apbct_attach_event_handler(window, "DOMContentLoaded", apbct_ready);
155
+
156
+ // Capturing responses and output block message for unknown AJAX forms
157
+ jQuery(document).ajaxComplete(function(event, xhr, settings) {
158
+ if(xhr.responseText.indexOf('"apbct') !== -1){
159
+ var response = JSON.parse(xhr.responseText);
160
+ if(typeof response.apbct !== 'undefined'){
161
+ var response = response.apbct;
162
+ if(response.blocked){
163
+ alert(response.comment);
164
+ }
165
+ }
166
+ }
167
+ });
js/cleantalk-dashboard-widget.js CHANGED
@@ -21,7 +21,10 @@ jQuery(document).ready(function(){
21
  var date_formatter = new Intl.DateTimeFormat(locale, {
22
  month: "short",
23
  day: "numeric"
24
- });
 
 
 
25
  date.forEach(function(d){
26
  d[0] = Date.parse(d[0]);
27
  d[0] = date_formatter.format(d[0]);
21
  var date_formatter = new Intl.DateTimeFormat(locale, {
22
  month: "short",
23
  day: "numeric"
24
+ });
25
+ date.sort(function(a,b){
26
+ return new Date(a[0]) - new Date(b[0])
27
+ });
28
  date.forEach(function(d){
29
  d[0] = Date.parse(d[0]);
30
  d[0] = date_formatter.format(d[0]);
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: 4.9
6
- Stable tag: 5.106
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -527,6 +527,13 @@ Yes, it is. Please read this article,
527
  10. Website's options.
528
 
529
  == Changelog ==
 
 
 
 
 
 
 
530
  = 5.106 October 11 2018 =
531
  * Spam filtration improved.
532
  * New: White Label mode.
@@ -1684,6 +1691,13 @@ Yes, it is. Please read this article,
1684
  * First version
1685
 
1686
  == Upgrade Notice ==
 
 
 
 
 
 
 
1687
  = 5.106 October 11 2018 =
1688
  * Spam filtration improved.
1689
  * New: White Label mode.
2
  Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
+ Tested up to: 5.0
6
+ Stable tag: 5.107
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
527
  10. Website's options.
528
 
529
  == Changelog ==
530
+ = 5.107 October 29 2018 =
531
+ * Fix: Ninja Forms integration.
532
+ * Fix: Cookie usage.
533
+ * Add: Capturing AJAX responses from non integrated forms.
534
+ * Spam protection improved.
535
+ * Minor fixes.
536
+
537
  = 5.106 October 11 2018 =
538
  * Spam filtration improved.
539
  * New: White Label mode.
1691
  * First version
1692
 
1693
  == Upgrade Notice ==
1694
+ = 5.107 October 29 2018 =
1695
+ * Fix: Ninja Forms integration.
1696
+ * Fix: Cookie usage.
1697
+ * Add: Capturing AJAX responses from non integrated forms.
1698
+ * Spam protection improved.
1699
+ * Minor fixes.
1700
+
1701
  = 5.106 October 11 2018 =
1702
  * Spam filtration improved.
1703
  * New: White Label mode.