Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.134

Version Description

February 27 2020 = * Fix: SpamFireWall update large data issues. * Fix: Auto-update for some banner notifications. * Fix: QuickContactForm protection. * Minor fixes. * Spam protection improved.

Download this release

Release Info

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

Code changes from version 5.133.2 to 5.134

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.133.2
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk
@@ -51,6 +51,7 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
51
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
52
 
53
  // Base classes
 
54
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
55
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
56
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
@@ -184,6 +185,12 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
184
  }
185
 
186
  }
 
 
 
 
 
 
187
 
188
  // Ninja Forms. Making GET action to POST action
189
  if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
@@ -218,6 +225,10 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
218
  }
219
  }, 1, 2);
220
 
 
 
 
 
221
  // Public actions
222
  if(!is_admin() && !apbct_is_ajax()){
223
 
@@ -375,7 +386,9 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
375
  }else{
376
 
377
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
378
-
 
 
379
  add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
380
 
381
  // Init action.
@@ -432,7 +445,7 @@ function apbct_remote_call__perform()
432
  $remote_action = $_GET['spbc_remote_call_action'];
433
 
434
  if( isset( $apbct->remote_calls[$remote_action] ) ){
435
- if(time() - $apbct->remote_calls[$remote_action]['last_call'] > APBCT_REMOTE_CALL_SLEEP){
436
 
437
  $apbct->remote_calls[$remote_action]['last_call'] = time();
438
  $apbct->save('remote_calls');
@@ -442,7 +455,7 @@ function apbct_remote_call__perform()
442
  // Flag to let plugin know that Remote Call is running.
443
  $apbct->rc_running = true;
444
 
445
- switch ($_GET['spbc_remote_call_action']) {
446
 
447
  // Close renew banner
448
  case 'close_renew_banner':
@@ -560,7 +573,7 @@ function apbct_sfw__check()
560
  $apbct->data['sfw_counter']['all']++;
561
  $apbct->saveData();
562
  if(!headers_sent())
563
- apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax' );
564
  }
565
  break;
566
  }else{
@@ -610,7 +623,7 @@ function apbct_sfw__check()
610
  }else{
611
  reset($sfw->passed_ips);
612
  if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
613
- setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false);
614
  }
615
  }
616
  unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
@@ -894,20 +907,54 @@ function ct_sfw_update($immediate = false){
894
 
895
  $sfw = new CleantalkSFW();
896
 
897
- $file_url = isset($_GET['file_url']) ? $_GET['file_url'] : null;
898
- $result = $sfw->sfw_update($apbct->api_key, $file_url, $immediate);
899
 
900
- if(empty($result['error'])){
901
- $apbct->stats['sfw']['last_update_time'] = time();
902
- $apbct->stats['sfw']['entries'] = $result;
 
903
  $apbct->save('stats');
904
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
905
 
906
  return $result;
907
  }
908
 
909
  return array('error' => 'SFW_DISABLED');
910
-
911
  }
912
 
913
  function ct_sfw_send_logs()
@@ -1020,12 +1067,15 @@ function apbct_rc__install_plugin($wp = null, $plugin = null){
1020
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
1021
  include_once( ABSPATH . 'wp-admin/includes/misc.php' );
1022
  include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
1023
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
1024
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
1025
- if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
1026
- $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin() );
1027
- else
1028
- $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated() );
 
 
 
1029
  $installer->install($result->download_link);
1030
 
1031
  if($installer->apbct_result === 'OK'){
@@ -1528,14 +1578,15 @@ function apbct_cookie(){
1528
  }
1529
 
1530
 
1531
- // Cookie names to validate
1532
  $cookie_test_value = array(
1533
  'cookies_names' => array(),
1534
  'check_value' => $apbct->api_key,
1535
  );
1536
 
1537
- $domain = parse_url(get_option('siteurl'),PHP_URL_HOST);
1538
-
 
1539
  // Submit time
1540
  if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
1541
  $apbct_timestamp = time();
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.134
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk
51
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
52
 
53
  // Base classes
54
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/autoloader.php'); // Autoloader
55
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
56
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
57
  require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
185
  }
186
 
187
  }
188
+
189
+ $apbct_active_integrations = array(
190
+ 'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
191
+ 'FluentForm' => array( 'hook' => 'fluentform_validations', 'ajax' => false )
192
+ );
193
+ new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
194
 
195
  // Ninja Forms. Making GET action to POST action
196
  if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
225
  }
226
  }, 1, 2);
227
 
228
+ // INEVIO theme integration
229
+ add_action( 'wp_ajax_contact_form_handler', 'apbct_form__inevio__testSpam', 1 );
230
+ add_action( 'wp_ajax_nopriv_contact_form_handler', 'apbct_form__inevio__testSpam', 1 );
231
+
232
  // Public actions
233
  if(!is_admin() && !apbct_is_ajax()){
234
 
386
  }else{
387
 
388
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
389
+
390
+
391
+
392
  add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
393
 
394
  // Init action.
445
  $remote_action = $_GET['spbc_remote_call_action'];
446
 
447
  if( isset( $apbct->remote_calls[$remote_action] ) ){
448
+ if(time() - $apbct->remote_calls[$remote_action]['last_call'] > APBCT_REMOTE_CALL_SLEEP || ($remote_action == 'sfw_update' && isset($_GET['file_urls']))) {
449
 
450
  $apbct->remote_calls[$remote_action]['last_call'] = time();
451
  $apbct->save('remote_calls');
455
  // Flag to let plugin know that Remote Call is running.
456
  $apbct->rc_running = true;
457
 
458
+ switch ($remote_action) {
459
 
460
  // Close renew banner
461
  case 'close_renew_banner':
573
  $apbct->data['sfw_counter']['all']++;
574
  $apbct->saveData();
575
  if(!headers_sent())
576
+ apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', null, false, true, 'Lax' );
577
  }
578
  break;
579
  }else{
623
  }else{
624
  reset($sfw->passed_ips);
625
  if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
626
+ setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', null,false);
627
  }
628
  }
629
  unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
907
 
908
  $sfw = new CleantalkSFW();
909
 
910
+ $file_urls = isset($_GET['file_urls']) ? explode(',', $_GET['file_urls']) : null;
 
911
 
912
+ if (!$file_urls) {
913
+
914
+ //Reset previous entries count
915
+ $apbct->stats['sfw']['entries'] = 0;
916
  $apbct->save('stats');
917
+
918
+ $result = $sfw->sfw_update($apbct->api_key, null, $immediate);
919
+
920
+ } else {
921
+ if (is_array($file_urls) && count($file_urls)) {
922
+
923
+ $result = $sfw->sfw_update($apbct->api_key, $file_urls[0], $immediate);
924
+
925
+ if(empty($result['error'])){
926
+
927
+ array_shift($file_urls);
928
+
929
+ //Increment sfw entries
930
+ $apbct->stats['sfw']['entries'] += $result;
931
+ $apbct->save('stats');
932
+
933
+ if (count($file_urls)) {
934
+ CleantalkHelper::http__request(
935
+ get_option('siteurl'),
936
+ array(
937
+ 'spbc_remote_call_token' => md5($apbct->api_key),
938
+ 'spbc_remote_call_action' => 'sfw_update',
939
+ 'plugin_name' => 'apbct',
940
+ 'file_urls' => implode(',', $file_urls),
941
+ ),
942
+ array('get', 'async')
943
+ );
944
+ } else {
945
+ //Files array is empty update sfw time
946
+ $apbct->stats['sfw']['last_update_time'] = time();
947
+ $apbct->save('stats');
948
+ }
949
+ } else
950
+ return array('error' => 'ERROR_WHILE_INSERTING_SFW_DATA');
951
+ }
952
+ }
953
 
954
  return $result;
955
  }
956
 
957
  return array('error' => 'SFW_DISABLED');
 
958
  }
959
 
960
  function ct_sfw_send_logs()
1067
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
1068
  include_once( ABSPATH . 'wp-admin/includes/misc.php' );
1069
  include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
1070
+
1071
+ if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0) {
1072
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
1073
+ $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin() );
1074
+ } else {
1075
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
1076
+ $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated() );
1077
+ }
1078
+
1079
  $installer->install($result->download_link);
1080
 
1081
  if($installer->apbct_result === 'OK'){
1578
  }
1579
 
1580
 
1581
+ // Cookie names to validate
1582
  $cookie_test_value = array(
1583
  'cookies_names' => array(),
1584
  'check_value' => $apbct->api_key,
1585
  );
1586
 
1587
+ // We need to skip the domain attribute for prevent including the dot to the cookie's domain on the client.
1588
+ $domain = null;
1589
+
1590
  // Submit time
1591
  if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
1592
  $apbct_timestamp = time();
inc/cleantalk-admin.php CHANGED
@@ -6,6 +6,9 @@ require_once('cleantalk-settings.php');
6
  add_action( 'manage_comments_nav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
7
  add_action( 'manage_users_extra_tablenav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
8
 
 
 
 
9
  function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
10
 
11
  global $apbct;
@@ -392,12 +395,12 @@ function apbct_admin__notice_message(){
392
  //"Trial period ends" notice from apbct_admin__init().api_method__notice_paid_till()
393
  if ($apbct->notice_show && $apbct->notice_trial == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
394
  if(isset($_GET['page']) && in_array($_GET['page'], array('cleantalk', 'ct_check_spam', 'ct_check_users'))){
395
- echo '<div class="error">
396
  <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
397
  "<a href='{$settings_link}'>".$apbct->plugin_name."</a>",
398
  "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") .
399
  '</h3>
400
- <h4 style = "color: gray">If you already paid for the service, please, re-save the plugin settings (WP Dashboard —> Settings —> Anti-Spam by CleanTalk) to dismiss the notice.</h4>
401
  </div>';
402
  $apbct->notice_show = false;
403
  }
@@ -409,10 +412,13 @@ function apbct_admin__notice_message(){
409
  $button_html = sprintf($renew_link, '<input type="button" class="button button-primary" value="'.__('RENEW ANTI-SPAM', 'cleantalk').'" />');
410
  $link_html = sprintf($renew_link, "<b>".__('next year', 'cleantalk')."</b>");
411
 
412
- echo '<div class="updated">
413
  <h3>'.
414
- sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), $link_html). '<br /><br />' . $button_html .
415
  '</h3>
 
 
 
416
  </div>';
417
  $apbct->notice_show = false;
418
  }
@@ -595,12 +601,15 @@ function apbct_comment__send_feedback($comment_id = null, $comment_status = null
595
  check_ajax_referer('ct_secret_nonce', 'security');
596
  }
597
 
598
- $comment_id = !empty($_POST['comment_id']) ? $_POST['comment_id'] : false;
599
- $comment_status = !empty($_POST['comment_status']) ? $_POST['comment_status'] : false;
600
- $change_status = !empty($_POST['change_status']) ? $_POST['change_status'] : false;
 
 
 
601
 
602
  // If enter params is empty exit
603
- if(!$comment_id || !$comment_status)
604
  die();
605
 
606
  // $comment = get_comment($comment_id, 'ARRAY_A');
6
  add_action( 'manage_comments_nav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
7
  add_action( 'manage_users_extra_tablenav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
8
 
9
+ // Check renew banner
10
+ add_action( 'wp_ajax_apbct_settings__check_renew_banner', 'apbct_settings__check_renew_banner');
11
+
12
  function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
13
 
14
  global $apbct;
395
  //"Trial period ends" notice from apbct_admin__init().api_method__notice_paid_till()
396
  if ($apbct->notice_show && $apbct->notice_trial == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
397
  if(isset($_GET['page']) && in_array($_GET['page'], array('cleantalk', 'ct_check_spam', 'ct_check_users'))){
398
+ echo '<div class="error" id="apbct_trial_notice">
399
  <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
400
  "<a href='{$settings_link}'>".$apbct->plugin_name."</a>",
401
  "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") .
402
  '</h3>
403
+ <h4 style = "color: gray">Account status updates every minute.</h4>
404
  </div>';
405
  $apbct->notice_show = false;
406
  }
412
  $button_html = sprintf($renew_link, '<input type="button" class="button button-primary" value="'.__('RENEW ANTI-SPAM', 'cleantalk').'" />');
413
  $link_html = sprintf($renew_link, "<b>".__('next year', 'cleantalk')."</b>");
414
 
415
+ echo '<div class="updated" id="apbct_renew_notice">
416
  <h3>'.
417
+ sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), $link_html).
418
  '</h3>
419
+ <h4 style = "color: gray">Account status updates every minute.</h4>
420
+ '.$button_html.'
421
+ <br/><br/>
422
  </div>';
423
  $apbct->notice_show = false;
424
  }
601
  check_ajax_referer('ct_secret_nonce', 'security');
602
  }
603
 
604
+ if( is_null( $comment_id ) )
605
+ $comment_id = !empty($_POST['comment_id']) ? $_POST['comment_id'] : false;
606
+ if( is_null( $comment_status ) )
607
+ $comment_status = !empty($_POST['comment_status']) ? $_POST['comment_status'] : false;
608
+ if( ! $change_status )
609
+ $change_status = !empty($_POST['change_status']) ? $_POST['change_status'] : false;
610
 
611
  // If enter params is empty exit
612
+ if( ! $comment_id || ! $comment_status )
613
  die();
614
 
615
  // $comment = get_comment($comment_id, 'ARRAY_A');
inc/cleantalk-ajax.php CHANGED
@@ -143,6 +143,9 @@ $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via
143
  /* Follow-Up Emails */
144
  $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
145
 
 
 
 
146
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
147
 
148
  $email = is_null( $email ) ? $email : $_POST['email'];
@@ -286,12 +289,13 @@ function ct_ajax_hook($message_obj = false, $additional = false)
286
  'edit-comment', // Edit comments by admin ??? that shouldn't happen
287
  'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
288
  'wpdmpp_save_settings', // PayPal save settings.
289
- 'give_process_donation', // GiveWP will be checked by feedback_general_contact_form
290
  'iwj_login', // Fix for unknown plugin for user #133315
291
  'custom_user_login', // Fix for unknown plugin for user #466875
292
  'wordfence_ls_authenticate', //Fix for wordfence auth
293
  'frm_strp_amount', //Admin stripe form
294
  'wouCheckOnlineUsers', //Skip updraft admin checking users
 
 
295
  );
296
 
297
  // Skip test if
@@ -314,9 +318,13 @@ function ct_ajax_hook($message_obj = false, $additional = false)
314
  {
315
  return false;
316
  }
317
-
318
- //General post_info for all ajax calls
319
- $post_info = array('comment_type' => 'feedback_ajax');
 
 
 
 
320
  $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
321
 
322
  if(isset($_POST['user_login']))
@@ -559,8 +567,8 @@ function ct_ajax_hook($message_obj = false, $additional = false)
559
  'display' => "Oops, got a few problems here",
560
  'errors' => array(
561
  0 => array(
562
- error => 'error',
563
- name => 'name'
564
  ),
565
  ),
566
  'success' => 'false',
143
  /* Follow-Up Emails */
144
  $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
145
 
146
+ /* The Fluent Form have the direct integration */
147
+ $cleantalk_hooked_actions[] = 'fluentform_submit';
148
+
149
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
150
 
151
  $email = is_null( $email ) ? $email : $_POST['email'];
289
  'edit-comment', // Edit comments by admin ??? that shouldn't happen
290
  'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
291
  'wpdmpp_save_settings', // PayPal save settings.
 
292
  'iwj_login', // Fix for unknown plugin for user #133315
293
  'custom_user_login', // Fix for unknown plugin for user #466875
294
  'wordfence_ls_authenticate', //Fix for wordfence auth
295
  'frm_strp_amount', //Admin stripe form
296
  'wouCheckOnlineUsers', //Skip updraft admin checking users
297
+ 'et_fb_get_shortcode_from_fb_object', //Skip generate shortcode
298
+ 'pp_lf_process_login', //Skip login form
299
  );
300
 
301
  // Skip test if
318
  {
319
  return false;
320
  }
321
+
322
+ //General post_info for all ajax calls
323
+ $post_info = array(
324
+ 'comment_type' => 'feedback_ajax',
325
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
326
+ );
327
+
328
  $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
329
 
330
  if(isset($_POST['user_login']))
567
  'display' => "Oops, got a few problems here",
568
  'errors' => array(
569
  0 => array(
570
+ 'error' => 'error',
571
+ 'name' => 'name'
572
  ),
573
  ),
574
  'success' => 'false',
inc/cleantalk-public.php CHANGED
@@ -3059,6 +3059,49 @@ function apbct_form__elementor_pro__testSpam() {
3059
 
3060
  }
3061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3062
  /**
3063
  * General test for any contact form
3064
  */
@@ -3103,6 +3146,7 @@ function ct_contact_form_validate() {
3103
  (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
3104
  ((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
3105
  (isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
 
3106
  (isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
3107
  (isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
3108
  isset($_POST['gform_submit']) || //Gravity form
@@ -3135,7 +3179,9 @@ function ct_contact_form_validate() {
3135
  apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') || //Skip Tin Canny plugin
3136
  ( isset( $_POST['na'], $_POST['ts'], $_POST['nhr'] ) && !apbct_is_in_uri( '?na=s' ) ) || // The Newsletter Plugin double requests fix. Ticket #14772
3137
  (isset($_POST['spl_action']) && $_POST['spl_action'] == 'register') || //Skip interal action with empty params
3138
- (isset($_POST['action']) && $_POST['action'] == 'bwfan_insert_abandoned_cart' && apbct_is_in_uri( 'my-account/edit-address' )) //Skip edit account
 
 
3139
  ) {
3140
  return null;
3141
  }
@@ -3321,7 +3367,8 @@ function ct_contact_form_validate_postdata() {
3321
  (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
3322
  (isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
3323
  isset($_POST['gform_submit']) || //Skip gravity checking because of direct integration
3324
- (isset($_POST['lrm_action']) && $_POST['lrm_action'] == 'login') //Skip login form
 
3325
  ) {
3326
  return null;
3327
  }
3059
 
3060
  }
3061
 
3062
+ // INEVIO theme integration
3063
+ function apbct_form__inevio__testSpam() {
3064
+
3065
+ global $apbct, $cleantalk_executed;
3066
+
3067
+ $theme = wp_get_theme();
3068
+ if(
3069
+ stripos( $theme->get( 'Name' ), 'INEVIO' ) === false ||
3070
+ $apbct->settings['contact_forms_test'] == 0 ||
3071
+ ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) || // Skip processing for logged in users.
3072
+ apbct_exclusions_check__url()
3073
+ ) {
3074
+ return false;
3075
+ }
3076
+ $form_data = array();
3077
+ parse_str($_POST['data'], $form_data);
3078
+
3079
+ $name = isset($form_data['name']) ? $form_data['name'] : '';
3080
+ $email = isset($form_data['email']) ? $form_data['email'] : '';
3081
+ $message = isset($form_data['message']) ? $form_data['message'] : '';
3082
+
3083
+ $post_info['comment_type'] = 'contact_form_wordpress_inevio_theme';
3084
+
3085
+ $cleantalk_executed = true;
3086
+ $base_call_result = apbct_base_call(
3087
+ array(
3088
+ 'message' => $message,
3089
+ 'sender_email' => $email,
3090
+ 'sender_nickname' => $name,
3091
+ 'post_info' => $post_info,
3092
+ )
3093
+ );
3094
+
3095
+ $ct_result = $base_call_result['ct_result'];
3096
+
3097
+ if ( $ct_result->allow == 0 ) {
3098
+ die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
3099
+ }
3100
+
3101
+ return true;
3102
+
3103
+ }
3104
+
3105
  /**
3106
  * General test for any contact form
3107
  */
3146
  (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
3147
  ((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
3148
  (isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
3149
+ apbct_is_in_uri( 'wc-api=WC_Gateway_Realex_Redirect') || // Woo Realex payment Gateway plugin
3150
  (isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
3151
  (isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
3152
  isset($_POST['gform_submit']) || //Gravity form
3179
  apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') || //Skip Tin Canny plugin
3180
  ( isset( $_POST['na'], $_POST['ts'], $_POST['nhr'] ) && !apbct_is_in_uri( '?na=s' ) ) || // The Newsletter Plugin double requests fix. Ticket #14772
3181
  (isset($_POST['spl_action']) && $_POST['spl_action'] == 'register') || //Skip interal action with empty params
3182
+ (isset($_POST['action']) && $_POST['action'] == 'bwfan_insert_abandoned_cart' && apbct_is_in_uri( 'my-account/edit-address' )) || //Skip edit account
3183
+ apbct_is_in_uri('login-1') || //Skip login form
3184
+ apbct_is_in_uri('recuperacao-de-senha-2') //Skip form reset password
3185
  ) {
3186
  return null;
3187
  }
3367
  (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
3368
  (isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
3369
  isset($_POST['gform_submit']) || //Skip gravity checking because of direct integration
3370
+ (isset($_POST['lrm_action']) && $_POST['lrm_action'] == 'login') || //Skip login form
3371
+ apbct_is_in_uri( 'xmlrpc.php?for=jetpack' )
3372
  ) {
3373
  return null;
3374
  }
inc/cleantalk-settings.php CHANGED
@@ -1493,4 +1493,12 @@ function apbct_settings__get__long_description(){
1493
  );
1494
 
1495
  die(json_encode($descriptions[$setting_id]));
 
 
 
 
 
 
 
 
1496
  }
1493
  );
1494
 
1495
  die(json_encode($descriptions[$setting_id]));
1496
+ }
1497
+
1498
+ function apbct_settings__check_renew_banner() {
1499
+ global $apbct;
1500
+
1501
+ check_ajax_referer('ct_secret_nonce' );
1502
+
1503
+ die(json_encode(array('close_renew_banner' => ($apbct->data['notice_trial'] == 0 && $apbct->data['notice_renew'] == 0) ? true : false)));
1504
  }
inc/find-spam/ClassCleantalkCommentsListTable.php CHANGED
@@ -191,14 +191,19 @@ class ABPCTCommentsListTable extends ABPCT_List_Table
191
  // LOGIC //
192
  //*******************************************//
193
 
194
- function approveSpam( $ids ) {
195
 
196
- $comment = get_comment($id, 'ARRAY_A');
197
- $comment['comment_approved'] = 1;
198
- delete_comment_meta( $id, 'ct_marked_as_spam' );
199
- wp_update_comment( $comment );
200
 
201
- apbct_comment__send_feedback( $id, 'approve', false, true );
 
 
 
 
 
 
 
 
202
 
203
  }
204
 
191
  // LOGIC //
192
  //*******************************************//
193
 
194
+ function approveSpam( $id ) {
195
 
196
+ $comment_meta = delete_comment_meta( $id, 'ct_marked_as_spam' );
 
 
 
197
 
198
+ if( $comment_meta ) {
199
+
200
+ $comment = get_comment($id, 'ARRAY_A');
201
+ $comment['comment_approved'] = 1;
202
+
203
+ wp_update_comment( $comment );
204
+ apbct_comment__send_feedback( $id, 'approve', false, true );
205
+
206
+ }
207
 
208
  }
209
 
js/cleantalk-admin-settings-page.min.js CHANGED
@@ -1,2 +1 @@
1
- function apbct_get_elems(e){for(var t,n=0,i=(e=e.split(",")).length;n<i;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_get_elems__native(e){"string"==typeof e&&(e=e.split(","));var c=[];return e.forEach(function(e,t,n){var i=document.getElementById(e);if(null===i){if(null!==(i=document.getElementsByClassName(e))&&0!==i.length)for(key in i)0<=+key&&c.push(i[key])}else c.push(i[key])}),c}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e,a){a=+a||null,apbct_get_elems__native(e).forEach(function(e,t,n){function i(){console.log(e),e.setAttribute("disabled","disabled")}function c(){e.removeAttribute("disabled")}null!==a?1===a?c():i():null===e.getAttribute("disabled")?i():c()})}function apbct_settings__showDescription(e,t){var c=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))};c(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,i){i.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",c)}},n)}jQuery(document).ready(function(){jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))})});
2
- //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
1
+ function apbct_banner_check(){var i=setInterval(function(){apbct_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(e,t,n,c){e.close_renew_banner&&(jQuery("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(i))}})},6e4)}function apbct_get_elems(e){for(var t,n=0,c=(e=e.split(",")).length;n<c;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_get_elems__native(e){"string"==typeof e&&(e=e.split(","));var i=[];return e.forEach(function(e,t,n){var c=document.getElementById(e);if(null===c){if(null!==(c=document.getElementsByClassName(e))&&0!==c.length)for(key in c)0<=+key&&i.push(c[key])}else i.push(c[key])}),i}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e,a){a=+a||null,apbct_get_elems__native(e).forEach(function(e,t,n){function c(){console.log(e),e.setAttribute("disabled","disabled")}function i(){e.removeAttribute("disabled")}(null!==a?1===a?i:c:null===e.getAttribute("disabled")?c:i)()})}function apbct_settings__showDescription(e,t){var i=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",i))};i(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,c){c.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",i)}},n)}jQuery(document).ready(function(){jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").length)&&apbct_banner_check()});
 
js/cleantalk-admin-settings-page.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-admin-settings-page.js"],"names":["apbct_get_elems","elems","tmp","i","len","split","length","jQuery","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","hide","show","apbctSettingsDependencies","ids","enable","do_disable","console","log","setAttribute","do_enable","removeAttribute","getAttribute","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","obj","append","css","top","position","left","apbct_sendAJAX","action","spinner","children","callback","result","data","params","empty","title","desc","on","ready","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","self"],"mappings":"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","file":"cleantalk-admin-settings-page.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\r\n // Show/Hide access key\r\n jQuery('#apbct_showApiKey').on('click', function(){\r\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\r\n jQuery('.apbct_setting---apikey+div').show();\r\n jQuery(this).fadeOut(300);\r\n });\r\n\r\n\tvar d = new Date();\r\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\r\n\t\r\n\t// GDPR modal window\r\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\r\n\t\tjQuery('#gdpr_dialog').dialog({\r\n\t\t\tmodal:true, \r\n\t\t\tshow: true,\r\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\r\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\r\n\t\t\theight: 'auto',\r\n\t\t\ttitle: 'GDPR compliance',\r\n\t\t\tdraggable: false,\r\n\t\t\tresizable: false,\r\n\t\t\tcloseText: \"Close\",\r\n\t\t});\r\n\t});\r\n\r\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\r\n\t\tself = jQuery(this);\r\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\r\n\t});\r\n\r\n});\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector passed in string separated by ,\r\n *\r\n * @param elems\r\n * @returns {*}\r\n */\r\nfunction apbct_get_elems(elems){\r\n elems = elems.split(',');\r\n for( var i=0, len = elems.length, tmp; i < len; i++){\r\n tmp = jQuery('#'+elems[i]);\r\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\r\n }\r\n return elems;\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\r\n *\r\n * @param elems string|array\r\n * @returns array\r\n */\r\nfunction apbct_get_elems__native(elems){\r\n\r\n\t// Make array from a string\r\n\tif(typeof elems === 'string')\r\n\t\telems = elems.split(',');\r\n\r\n\tvar out = [];\r\n\r\n\telems.forEach(function(elem, i, arr) {\r\n\r\n\t\t// try to get elements with such IDs\r\n\t\tvar tmp = document.getElementById(elem);\r\n\t\tif (tmp !== null){\r\n\t\t\tout.push( tmp[key] );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// try to get elements with such class name\r\n\t\t// write each elem from collection to new element of outpur array\r\n\t\ttmp = document.getElementsByClassName(elem);\r\n\t\tif (tmp !== null && tmp.length !==0 ){\r\n\t\t\tfor(key in tmp){\r\n\t\t\t\tif( +key >= 0 ){\r\n\t\t\t\t\tout.push( tmp[key] );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\treturn out;\r\n}\r\n\r\nfunction apbct_show_hide_elem(elems){\r\n\telems = apbct_get_elems(elems);\r\n for( var i=0, len = elems.length; i < len; i++){\r\n elems[i].each(function (i, elem) {\r\n elem = jQuery(elem);\r\n var label = elem.next('label') || elem.prev('label') || null;\r\n if (elem.is(\":visible\")) {\r\n elem.hide();\r\n if (label) label.hide();\r\n } else {\r\n elem.show();\r\n if (label) label.show();\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\r\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\r\n *\r\n * @param ids string|array Selectors\r\n * @param enable\r\n */\r\nfunction apbctSettingsDependencies(ids, enable){\r\n\r\n\tenable = +enable || null;\r\n\r\n\t// Get elements\r\n\tvar elems = apbct_get_elems__native( ids );\r\n\r\n\telems.forEach(function(elem, i, arr){\r\n\r\n\t\tvar do_disable = function(){console.log( elem ); elem.setAttribute('disabled', 'disabled');},\r\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\r\n\r\n\t\t// Set defined state\r\n\t\tif(enable !== null) // Set\r\n\t\t\tenable === 1 ? do_enable() : do_disable();\r\n\r\n\t\t// Toggle\r\n\t\telse{\r\n\t\t\telem.getAttribute('disabled') === null ? do_disable() : do_enable();\r\n\t\t}\r\n\r\n\t});\r\n}\r\n\r\nfunction apbct_settings__showDescription(label, setting_id){\r\n\r\n\tvar remove_desc_func = function(e){\r\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\r\n\t\t\tjQuery('.apbct_long_desc').remove();\r\n\t\t\tjQuery(document).off('click', remove_desc_func);\r\n\t\t}\r\n\t};\r\n\r\n\tremove_desc_func();\r\n\r\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\r\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\r\n\tobj.append(\"<i class='icon-spin1 animate-spin'></i>\")\r\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t.css({\r\n\t\t\ttop: label.position().top - 5,\r\n\t\t\tleft: label.position().left + 25\r\n\t\t});\r\n\r\n\r\n\tapbct_sendAJAX(\r\n\t\t{action: 'apbct_settings__get_description', setting_id: setting_id},\r\n\t\t{\r\n\t\t\tspinner: obj.children('img'),\r\n\t\t\tcallback: function(result, data, params, obj){\r\n\r\n\t\t\t\tobj.empty()\r\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel icon-cancel'></i>\")\r\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\r\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\r\n\r\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\r\n\t\t\t}\r\n\t\t},\r\n\t\tobj\r\n\t);\r\n}"]}
1
+ {"version":3,"sources":["cleantalk-admin-settings-page.js"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","do_disable","console","log","setAttribute","do_enable","removeAttribute","getAttribute","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","ready","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","self"],"mappings":"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"}
js/cleantalk_external.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_protect_external(){for(var e=0;e<document.forms.length;e++)if("string"==typeof document.forms[e].action){var t=document.forms[e].action;if(-1!==t.indexOf("http://")||-1!==t.indexOf("https://")){var o=t.split("//");if((o=o[1].split("/"))[0].toLowerCase()!==location.hostname.toLowerCase()){var n=document.createElement("input");n.name="cleantalk_hidden_action",n.value=t,n.type="hidden",document.forms[e].appendChild(n);var a=document.createElement("input");a.name="cleantalk_hidden_method",a.value=document.forms[e].method,a.type="hidden",document.forms[e].method="POST",document.forms[e].appendChild(a),document.forms[e].action=ctNocache.blog_home}}}}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
1
+ function ct_protect_external(){for(var t=0;t<document.forms.length;t++)if("string"==typeof document.forms[t].action){var e=document.forms[t].action;if(-1!==e.indexOf("http://")||-1!==e.indexOf("https://")){var n=e.split("//");if((n=n[1].split("/"))[0].toLowerCase()!==location.hostname.toLowerCase()){var o=document.createElement("input");o.name="cleantalk_hidden_action",o.value=e,o.type="hidden",document.forms[t].appendChild(o);var d=document.createElement("input");d.name="cleantalk_hidden_method",d.value=document.forms[t].method,d.type="hidden",document.forms[t].method="POST",document.forms[t].appendChild(d),document.forms[t].action=document.location}}}}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
js/cleantalk_external.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk_external.js"],"names":["ct_protect_external","i","document","forms","length","action","indexOf","tmp","split","toLowerCase","location","hostname","ct_action","createElement","name","value","type","appendChild","ct_method","method","ctNocache","blog_home","window","onload","setTimeout"],"mappings":"AAAA,SAASA,sBAER,IAAI,IAAIC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAEzC,GAAuC,iBAA7BC,SAASC,MAAMF,GAAS,OAAc,CAE/C,IAAII,EAASH,SAASC,MAAMF,GAAGI,OAE/B,IAAkC,IAA/BA,EAAOC,QAAQ,aAAqD,IAAhCD,EAAOC,QAAQ,YAAmB,CAExE,IAAIC,EAAMF,EAAOG,MAAM,MAIvB,IAHAD,EAAMA,EAAI,GAAGC,MAAM,MACJ,GAAGC,gBAENC,SAASC,SAASF,cAAc,CAE5B,IAAIG,EAAYV,SAASW,cAAc,SACvCD,EAAUE,KAAO,0BAChCF,EAAUG,MAAQV,EAClBO,EAAUI,KAAO,SACjBd,SAASC,MAAMF,GAAGgB,YAAYL,GAEf,IAAIM,EAAYhB,SAASW,cAAc,SACvCK,EAAUJ,KAAO,0BAChCI,EAAUH,MAAQb,SAASC,MAAMF,GAAGkB,OACpCD,EAAUF,KAAO,SAEjBd,SAASC,MAAMF,GAAGkB,OAAS,OAC3BjB,SAASC,MAAMF,GAAGgB,YAAYC,GAE9BhB,SAASC,MAAMF,GAAGI,OAASe,UAAUC,aAO1CC,OAAOC,OAAS,WACZC,WAAW,WACPxB,uBACD","file":"cleantalk_external.min.js","sourcesContent":["function ct_protect_external(){\r\n\t\t\t\r\n\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\r\n\t\tif(typeof(document.forms[i].action) == 'string'){\r\n\t\t\t\r\n\t\t\tvar action = document.forms[i].action;\r\n\r\n\t\t\tif(action.indexOf('http://') !== -1 || action.indexOf('https://') !== -1){\r\n\t\t\t\t\r\n\t\t\t\tvar tmp = action.split('//');\r\n\t\t\t\ttmp = tmp[1].split('/');\r\n\t\t\t\tvar host = tmp[0].toLowerCase();\r\n\r\n\t\t\t\tif(host !== location.hostname.toLowerCase()){\r\n\r\n var ct_action = document.createElement(\"input\");\r\n ct_action.name = 'cleantalk_hidden_action';\r\n\t\t\t\t\tct_action.value = action;\r\n\t\t\t\t\tct_action.type = 'hidden';\r\n\t\t\t\t\tdocument.forms[i].appendChild(ct_action);\r\n\r\n var ct_method = document.createElement(\"input\");\r\n ct_method.name = 'cleantalk_hidden_method';\r\n\t\t\t\t\tct_method.value = document.forms[i].method;\r\n\t\t\t\t\tct_method.type = 'hidden';\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tdocument.forms[i].method = 'POST';\r\n\t\t\t\t\tdocument.forms[i].appendChild(ct_method);\r\n\t\t\t\t\t\r\n\t\t\t\t\tdocument.forms[i].action = ctNocache.blog_home;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nwindow.onload = function () {\r\n setTimeout(function () {\r\n ct_protect_external()\r\n }, 1500);\r\n};"]}
1
+ {"version":3,"sources":["cleantalk_external.js"],"names":["ct_protect_external","i","document","forms","length","action","indexOf","tmp","split","toLowerCase","location","hostname","ct_action","createElement","name","value","type","appendChild","ct_method","method","window","onload","setTimeout"],"mappings":"AAAA,SAASA,sBAER,IAAI,IAAIC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAEzC,GAAuC,iBAA7BC,SAASC,MAAMF,GAAS,OAAc,CAE/C,IAAII,EAASH,SAASC,MAAMF,GAAGI,OAE/B,IAAkC,IAA/BA,EAAOC,QAAQ,aAAqD,IAAhCD,EAAOC,QAAQ,YAAmB,CAExE,IAAIC,EAAMF,EAAOG,MAAM,MAIvB,IAHAD,EAAMA,EAAI,GAAGC,MAAM,MACJ,GAAGC,gBAENC,SAASC,SAASF,cAAc,CAE5B,IAAIG,EAAYV,SAASW,cAAc,SACvCD,EAAUE,KAAO,0BAChCF,EAAUG,MAAQV,EAClBO,EAAUI,KAAO,SACjBd,SAASC,MAAMF,GAAGgB,YAAYL,GAEf,IAAIM,EAAYhB,SAASW,cAAc,SACvCK,EAAUJ,KAAO,0BAChCI,EAAUH,MAAQb,SAASC,MAAMF,GAAGkB,OACpCD,EAAUF,KAAO,SAEjBd,SAASC,MAAMF,GAAGkB,OAAS,OAC3BjB,SAASC,MAAMF,GAAGgB,YAAYC,GAE9BhB,SAASC,MAAMF,GAAGI,OAASH,SAASQ,YAOzCU,OAAOC,OAAS,WACZC,WAAW,WACPtB,uBACD","file":"cleantalk_external.min.js","sourcesContent":["function ct_protect_external(){\r\n\t\t\t\r\n\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\r\n\t\tif(typeof(document.forms[i].action) == 'string'){\r\n\t\t\t\r\n\t\t\tvar action = document.forms[i].action;\r\n\r\n\t\t\tif(action.indexOf('http://') !== -1 || action.indexOf('https://') !== -1){\r\n\t\t\t\t\r\n\t\t\t\tvar tmp = action.split('//');\r\n\t\t\t\ttmp = tmp[1].split('/');\r\n\t\t\t\tvar host = tmp[0].toLowerCase();\r\n\r\n\t\t\t\tif(host !== location.hostname.toLowerCase()){\r\n\r\n var ct_action = document.createElement(\"input\");\r\n ct_action.name = 'cleantalk_hidden_action';\r\n\t\t\t\t\tct_action.value = action;\r\n\t\t\t\t\tct_action.type = 'hidden';\r\n\t\t\t\t\tdocument.forms[i].appendChild(ct_action);\r\n\r\n var ct_method = document.createElement(\"input\");\r\n ct_method.name = 'cleantalk_hidden_method';\r\n\t\t\t\t\tct_method.value = document.forms[i].method;\r\n\t\t\t\t\tct_method.type = 'hidden';\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tdocument.forms[i].method = 'POST';\r\n\t\t\t\t\tdocument.forms[i].appendChild(ct_method);\r\n\t\t\t\t\t\r\n\t\t\t\t\tdocument.forms[i].action = document.location;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nwindow.onload = function () {\r\n setTimeout(function () {\r\n ct_protect_external()\r\n }, 1500);\r\n};"]}
lib/Cleantalk/Antispam/Integrations.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam;
5
+
6
+
7
+ class Integrations
8
+ {
9
+
10
+ private $integrations = array();
11
+
12
+ private $integration;
13
+
14
+ public function __construct( $integrations )
15
+ {
16
+ $this->integrations = $integrations;
17
+
18
+ foreach( $this->integrations as $integration_name => $integration_info ) {
19
+ if( $integration_info['ajax'] ) {
20
+ add_action( 'wp_ajax_' . $integration_info['hook'], array( $this, 'checkSpam' ), 1 );
21
+ add_action( 'wp_ajax_nopriv_' . $integration_info['hook'], array( $this, 'checkSpam' ), 1 );
22
+ } else {
23
+ add_action( $integration_info['hook'], array( $this, 'checkSpam' ) );
24
+ }
25
+ }
26
+ }
27
+
28
+ public function checkSpam()
29
+ {
30
+ global $cleantalk_executed;
31
+
32
+ // Getting current integration name
33
+ $current_integration = $this->get_current_integration_triggered( current_action() );
34
+ if( $current_integration ) {
35
+ // Instantiate the integration object
36
+ $class = '\\Cleantalk\\Antispam\\Integrations\\' . $current_integration;
37
+ if( class_exists( $class )) {
38
+ $this->integration = new $class();
39
+ if( ! ( $this->integration instanceof \Cleantalk\Antispam\Integrations\IntegrationBase ) ) {
40
+ // @ToDo have to handle an error
41
+ return;
42
+ }
43
+ // Run data collecting for spam checking
44
+ $data = $this->integration->getDataForChecking();
45
+ if( ! is_null( $data ) ) {
46
+ // Go spam checking
47
+ $base_call_result = apbct_base_call(
48
+ array(
49
+ 'message' => !empty( $data['message'] ) ? json_encode( $data['message'] ) : '',
50
+ 'sender_email' => !empty( $data['email'] ) ? $data['email'] : '',
51
+ 'sender_nickname' => !empty( $data['nickname'] ) ? $data['nickname'] : '',
52
+ 'post_info' => array(
53
+ 'comment_type' => 'contact_form_wordpress_' . strtolower($current_integration),
54
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
55
+ ),
56
+ )
57
+ );
58
+
59
+ $ct_result = $base_call_result['ct_result'];
60
+
61
+ $cleantalk_executed = true;
62
+
63
+ if ($ct_result->allow == 0) {
64
+ // Do blocking if it is a spam
65
+ $this->integration->doBlock( $ct_result->comment );
66
+ }
67
+ } else {
68
+ // @ToDo have to handle an error
69
+ return;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ private function get_current_integration_triggered( $hook )
76
+ {
77
+ if( $hook !== false ) {
78
+ foreach( $this->integrations as $integration_name => $integration_info ) {
79
+ if( strpos( $hook, $integration_info['hook'] ) !== false ) {
80
+ return $integration_name;
81
+ }
82
+ }
83
+ }
84
+ return false;
85
+ }
86
+ }
lib/Cleantalk/Antispam/Integrations/ContactBank.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ class ContactBank extends IntegrationBase
8
+ {
9
+
10
+ function getDataForChecking()
11
+ {
12
+ if( isset( $_REQUEST['param'] ) ) {
13
+ parse_str( isset( $_REQUEST['data'] ) ? base64_decode( $_REQUEST['data'] ) : '', $form_data );
14
+ return ct_get_fields_any($form_data);
15
+ }
16
+ return null;
17
+ }
18
+
19
+ function doBlock( $message )
20
+ {
21
+ die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $message,))));
22
+ }
23
+ }
lib/Cleantalk/Antispam/Integrations/FluentForm.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ class FluentForm extends IntegrationBase
8
+ {
9
+
10
+ function getDataForChecking()
11
+ {
12
+ if( isset( $_POST['data'] ) ) {
13
+ parse_str( $_POST['data'], $form_data );
14
+ return ct_get_fields_any($form_data);
15
+ }
16
+ return null;
17
+ }
18
+
19
+ function doBlock($message)
20
+ {
21
+ wp_send_json(
22
+ array(
23
+ 'errors' => array(
24
+ 'restricted' => array(
25
+ $message
26
+ )
27
+ )
28
+ ), 422
29
+ );
30
+ }
31
+ }
lib/Cleantalk/Antispam/Integrations/IntegrationBase.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ abstract class IntegrationBase
8
+ {
9
+ abstract function getDataForChecking();
10
+ abstract function doBlock( $message );
11
+ }
lib/Cleantalk/Antispam/SFW.php CHANGED
@@ -228,33 +228,68 @@ class SFW
228
  * @return array|bool array('error' => STRING)
229
  */
230
  public function sfw_update($ct_key, $file_url = null, $immediate = false){
231
-
232
  // Getting remote file name
233
  if(!$file_url){
234
-
235
  sleep(6);
236
-
237
- $result = API::method__get_2s_blacklists_db($ct_key, 'file');
238
-
239
  if(empty($result['error'])){
240
 
241
  if( !empty($result['file_url']) ){
242
-
243
- $pattenrs = array();
244
- $pattenrs[] = 'get';
245
- if(!$immediate) $pattenrs[] = 'async';
246
-
247
- return Helper::http__request(
248
- get_option('siteurl'),
249
- array(
250
- 'spbc_remote_call_token' => md5($ct_key),
251
- 'spbc_remote_call_action' => 'sfw_update',
252
- 'plugin_name' => 'apbct',
253
- 'file_url' => $result['file_url'],
254
- ),
255
- $pattenrs
256
- );
257
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  }else
259
  return array('error' => 'BAD_RESPONSE');
260
  }else
@@ -262,17 +297,13 @@ class SFW
262
  }else{
263
 
264
  if(Helper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
265
-
266
- if(ini_get('allow_url_fopen')){
267
-
268
  $gf = gzopen($file_url, 'rb');
269
-
270
  if($gf){
271
 
272
  if(!gzeof($gf)){
273
 
274
- $this->db->execute("DELETE FROM ".$this->data_table.";");
275
-
276
  for($count_result = 0; !gzeof($gf); ){
277
 
278
  $query = "INSERT INTO ".$this->data_table." VALUES %s";
@@ -309,8 +340,6 @@ class SFW
309
  return array('error' => 'ERROR_GZ_EMPTY');
310
  }else
311
  return array('error' => 'ERROR_OPEN_GZ_FILE');
312
- }else
313
- return array('error' => 'ERROR_ALLOW_URL_FOPEN_DISABLED');
314
  }else
315
  return array('error' => 'NO_REMOTE_FILE_FOUND');
316
  }
228
  * @return array|bool array('error' => STRING)
229
  */
230
  public function sfw_update($ct_key, $file_url = null, $immediate = false){
231
+
232
  // Getting remote file name
233
  if(!$file_url){
234
+
235
  sleep(6);
236
+
237
+ $result = API::method__get_2s_blacklists_db($ct_key, 'multifiles');
238
+
239
  if(empty($result['error'])){
240
 
241
  if( !empty($result['file_url']) ){
242
+
243
+ if(Helper::http__request($result['file_url'], array(), 'get_code') === 200) {
244
+
245
+ if(ini_get('allow_url_fopen')) {
246
+
247
+ $pattenrs = array();
248
+ $pattenrs[] = 'get';
249
+
250
+ if(!$immediate) $pattenrs[] = 'async';
251
+
252
+ $this->db->execute("DELETE FROM ".$this->data_table.";");
253
+
254
+ if (preg_match('/multifiles/', $result['file_url'])) {
255
+
256
+ $gf = gzopen($result['file_url'], 'rb');
257
+
258
+ if ($gf) {
259
+
260
+ $file_urls = array();
261
+
262
+ while(!gzeof($gf))
263
+ $file_urls[] = trim(gzgets($gf, 1024));
264
+
265
+ gzclose($gf);
266
+
267
+ return Helper::http__request(
268
+ get_option('siteurl'),
269
+ array(
270
+ 'spbc_remote_call_token' => md5($ct_key),
271
+ 'spbc_remote_call_action' => 'sfw_update',
272
+ 'plugin_name' => 'apbct',
273
+ 'file_urls' => implode(',', $file_urls),
274
+ ),
275
+ $pattenrs
276
+ );
277
+ }
278
+ }else {
279
+ return Helper::http__request(
280
+ get_option('siteurl'),
281
+ array(
282
+ 'spbc_remote_call_token' => md5($ct_key),
283
+ 'spbc_remote_call_action' => 'sfw_update',
284
+ 'plugin_name' => 'apbct',
285
+ 'file_urls' => $result['file_url'],
286
+ ),
287
+ $pattenrs
288
+ );
289
+ }
290
+ }else
291
+ return array('error' => 'ERROR_ALLOW_URL_FOPEN_DISABLED');
292
+ }
293
  }else
294
  return array('error' => 'BAD_RESPONSE');
295
  }else
297
  }else{
298
 
299
  if(Helper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
300
+
 
 
301
  $gf = gzopen($file_url, 'rb');
302
+
303
  if($gf){
304
 
305
  if(!gzeof($gf)){
306
 
 
 
307
  for($count_result = 0; !gzeof($gf); ){
308
 
309
  $query = "INSERT INTO ".$this->data_table." VALUES %s";
340
  return array('error' => 'ERROR_GZ_EMPTY');
341
  }else
342
  return array('error' => 'ERROR_OPEN_GZ_FILE');
 
 
343
  }else
344
  return array('error' => 'NO_REMOTE_FILE_FOUND');
345
  }
lib/CleantalkState.php CHANGED
@@ -83,7 +83,7 @@ class CleantalkState
83
  'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
84
  'set_cookies__sessions'=> 0, // Use alt sessions for cookies.
85
  'ssl_on' => 0, // Secure connection to servers
86
- 'use_buitin_http_api' => 0, // Using Wordpress HTTP built in API
87
 
88
  // Exclusions
89
  'exclusions__urls' => '',
83
  'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
84
  'set_cookies__sessions'=> 0, // Use alt sessions for cookies.
85
  'ssl_on' => 0, // Secure connection to servers
86
+ 'use_buitin_http_api' => 1, // Using Wordpress HTTP built in API
87
 
88
  // Exclusions
89
  'exclusions__urls' => '',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, woocommerce, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
  Requires PHP: 5.4
7
- Stable tag: 5.133.2
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -566,6 +566,13 @@ If your website has forms that send data to external sources, you can enable opt
566
 
567
  == Changelog ==
568
 
 
 
 
 
 
 
 
569
  = 5.133.2 February 10 2020 =
570
  * Fix: Add no-index meta tag to search page only.
571
  * Fix: Namespace issues.
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
  Requires PHP: 5.4
7
+ Stable tag: 5.134
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
566
 
567
  == Changelog ==
568
 
569
+ = 5.134 February 27 2020 =
570
+ * Fix: SpamFireWall update large data issues.
571
+ * Fix: Auto-update for some banner notifications.
572
+ * Fix: QuickContactForm protection.
573
+ * Minor fixes.
574
+ * Spam protection improved.
575
+
576
  = 5.133.2 February 10 2020 =
577
  * Fix: Add no-index meta tag to search page only.
578
  * Fix: Namespace issues.