Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.113

Version Description

January 16 2019 = * Fix: Fast and Simple Contact Form. * Fix: Settings layout. * Fix: Error with WooCommerce Quickview. * Fix: Bitrix24 contact form. * Fix: Request time decreased. * Fix: Requesting account status when activating for IP licenses. * Add: Precise AJAX request detection. * Spam protection improved.

Download this release

Release Info

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

Code changes from version 5.112 to 5.113

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.112
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
@@ -188,20 +188,19 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
188
  add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
189
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
190
  }
191
-
192
- if(is_admin() || is_network_admin()){
193
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
194
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-users.php');
195
- }
196
 
197
  // Admin panel actions
198
  if (is_admin() || is_network_admin()){
199
 
 
 
200
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
201
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-settings.php');
202
-
203
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
204
 
 
 
205
  add_action('admin_init', 'apbct_admin__init', 1);
206
  add_action('admin_menu', 'apbct_settings__add_page');
207
  add_action('network_admin_menu', 'apbct_settings__add_page');
@@ -213,7 +212,10 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
213
  add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
214
  }
215
 
216
- if (defined( 'DOING_AJAX' ) && DOING_AJAX || isset($_POST['cma-action'])){
 
 
 
217
 
218
  // Feedback for comments
219
  if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment'){
@@ -227,8 +229,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
227
 
228
  $cleantalk_hooked_actions = array();
229
  $cleantalk_ajax_actions_to_check = array();
230
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
231
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
232
 
233
  // Check AJAX requests
234
  // if User is not logged in
@@ -236,7 +236,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
236
  if( defined('LOGGED_IN_COOKIE') && !isset($_COOKIE[LOGGED_IN_COOKIE]) &&
237
  isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
238
  ){
239
- ct_ajax_hook();
240
  }
241
 
242
  //QAEngine Theme answers
@@ -244,9 +244,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
244
  add_filter('et_pre_insert_question', 'ct_ajax_hook', 1, 1); // Questions
245
  add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
246
 
247
- //
248
  // Some of plugins to register a users use AJAX context.
249
- //
250
  add_filter('registration_errors', 'ct_registration_errors', 1, 3);
251
  add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
252
  add_action('user_register', 'ct_user_register');
@@ -258,39 +256,17 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
258
  }
259
 
260
  }
261
-
262
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
263
-
264
  //Bitrix24 contact form
265
- if (ct_is_user_enable()) {
266
-
267
- if ($apbct->settings['general_contact_forms_test'] == 1 &&
268
- !empty($_POST['your-phone']) &&
269
- !empty($_POST['your-email']) &&
270
- !empty($_POST['your-message'])
271
- ){
272
- $ct_check_post_result=false;
273
- ct_contact_form_validate();
274
- }
275
  }
276
-
277
- add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
278
-
279
- // Sends feedback to the cloud about comments
280
- // add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
281
-
282
- // Sends feedback to the cloud about deleted users
283
- global $pagenow;
284
- if($pagenow=='users.php')
285
- add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
286
-
287
- if($pagenow=='plugins.php' || (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'],'plugins.php') !== false)){
288
-
289
- add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
290
- add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
291
-
292
- add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
293
- }
294
 
295
  // Public pages actions
296
  }else{
@@ -501,6 +477,7 @@ function apbct_activation( $network ) {
501
  $wpdb->query(sprintf($sfw_data_query, APBCT_TBL_FIREWALL_DATA)); // Table for SpamFireWall data
502
  $wpdb->query(sprintf($sfw_log_query, APBCT_TBL_FIREWALL_LOG)); // Table for SpamFireWall logs
503
  ct_sfw_update(); // Updating SFW
 
504
  }
505
 
506
  // Additional options
@@ -535,6 +512,7 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
535
  $wpdb->query(sprintf($sfw_data_query, $wpdb->prefx)); // Table for SpamFireWall data
536
  $wpdb->query(sprintf($sfw_log_query, $wpdb->prefx)); // Table for SpamFireWall logs
537
  ct_sfw_update(); // Updating SFW
 
538
  restore_current_blog();
539
  }
540
  }
@@ -876,7 +854,7 @@ function apbct_is_user_logged_in(){
876
  * Inner function - Account status check
877
  * Scheduled in 1800 seconds for default!
878
  */
879
- function ct_account_status_check($api_key = null){
880
 
881
  global $apbct;
882
 
@@ -918,7 +896,7 @@ function ct_account_status_check($api_key = null){
918
  $apbct->saveData();
919
  $apbct->error_delete('account_check', 'save');
920
 
921
- }else{
922
  $apbct->error_add('account_check', $result);
923
  }
924
 
@@ -1021,4 +999,18 @@ function apbct_is_user_role_in( $roles, $user = false ){
1021
  }
1022
 
1023
  return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1024
  }
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.113
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
188
  add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
189
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
190
  }
 
 
 
 
 
191
 
192
  // Admin panel actions
193
  if (is_admin() || is_network_admin()){
194
 
195
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
196
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-users.php');
197
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
198
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-settings.php');
199
+
200
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
201
 
202
+ add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
203
+
204
  add_action('admin_init', 'apbct_admin__init', 1);
205
  add_action('admin_menu', 'apbct_settings__add_page');
206
  add_action('network_admin_menu', 'apbct_settings__add_page');
212
  add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
213
  }
214
 
215
+ if(apbct_is_ajax() || isset($_POST['cma-action'])){
216
+
217
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
218
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
219
 
220
  // Feedback for comments
221
  if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment'){
229
 
230
  $cleantalk_hooked_actions = array();
231
  $cleantalk_ajax_actions_to_check = array();
 
 
232
 
233
  // Check AJAX requests
234
  // if User is not logged in
236
  if( defined('LOGGED_IN_COOKIE') && !isset($_COOKIE[LOGGED_IN_COOKIE]) &&
237
  isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
238
  ){
239
+ ct_ajax_hook();
240
  }
241
 
242
  //QAEngine Theme answers
244
  add_filter('et_pre_insert_question', 'ct_ajax_hook', 1, 1); // Questions
245
  add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
246
 
 
247
  // Some of plugins to register a users use AJAX context.
 
248
  add_filter('registration_errors', 'ct_registration_errors', 1, 3);
249
  add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
250
  add_action('user_register', 'ct_user_register');
256
  }
257
 
258
  }
259
+
260
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
 
261
  //Bitrix24 contact form
262
+ if ($apbct->settings['general_contact_forms_test'] == 1 &&
263
+ !empty($_POST['your-phone']) &&
264
+ !empty($_POST['your-email']) &&
265
+ !empty($_POST['your-message'])
266
+ ){
267
+ $ct_check_post_result=false;
268
+ ct_contact_form_validate();
 
 
 
269
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
 
271
  // Public pages actions
272
  }else{
477
  $wpdb->query(sprintf($sfw_data_query, APBCT_TBL_FIREWALL_DATA)); // Table for SpamFireWall data
478
  $wpdb->query(sprintf($sfw_log_query, APBCT_TBL_FIREWALL_LOG)); // Table for SpamFireWall logs
479
  ct_sfw_update(); // Updating SFW
480
+ ct_account_status_check(null, false);
481
  }
482
 
483
  // Additional options
512
  $wpdb->query(sprintf($sfw_data_query, $wpdb->prefx)); // Table for SpamFireWall data
513
  $wpdb->query(sprintf($sfw_log_query, $wpdb->prefx)); // Table for SpamFireWall logs
514
  ct_sfw_update(); // Updating SFW
515
+ ct_account_status_check(null, false);
516
  restore_current_blog();
517
  }
518
  }
854
  * Inner function - Account status check
855
  * Scheduled in 1800 seconds for default!
856
  */
857
+ function ct_account_status_check($api_key = null, $process_errors = true){
858
 
859
  global $apbct;
860
 
896
  $apbct->saveData();
897
  $apbct->error_delete('account_check', 'save');
898
 
899
+ }elseif($process_errors){
900
  $apbct->error_add('account_check', $result);
901
  }
902
 
999
  }
1000
 
1001
  return false;
1002
+ }
1003
+
1004
+ /**
1005
+ * Checks if the request is AJAX
1006
+ *
1007
+ * @return boolean
1008
+ */
1009
+ function apbct_is_ajax() {
1010
+
1011
+ return
1012
+ wp_doing_ajax() || // by standart WP functions
1013
+ (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || // by Request type
1014
+ !empty($_POST['quform_ajax']); // special. QForms
1015
+
1016
  }
css/cleantalk-admin-settings-page.css CHANGED
@@ -4,7 +4,7 @@
4
  #apbctTopWarning h4 span{margin-top: 5px;}
5
 
6
  /* Main title */
7
- .apbct_settings-title{ display: inline-block; }
8
  .apbct_settings-subtitle{
9
  position: relative;
10
  top: -15px;
4
  #apbctTopWarning h4 span{margin-top: 5px;}
5
 
6
  /* Main title */
7
+ /*.apbct_settings-title{ display: inline-block; }*/
8
  .apbct_settings-subtitle{
9
  position: relative;
10
  top: -15px;
inc/cleantalk-admin.php CHANGED
@@ -176,6 +176,22 @@ function apbct_admin__init(){
176
 
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
 
181
  /**
176
 
177
  }
178
 
179
+ // Sends feedback to the cloud about comments
180
+ // add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
181
+
182
+ // Sends feedback to the cloud about deleted users
183
+ global $pagenow;
184
+ if($pagenow=='users.php')
185
+ add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
186
+
187
+ if($pagenow=='plugins.php' || (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'],'plugins.php') !== false)){
188
+
189
+ add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
190
+ add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
191
+
192
+ add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
193
+ }
194
+
195
  }
196
 
197
  /**
inc/cleantalk-ajax.php CHANGED
@@ -246,6 +246,8 @@ function ct_ajax_hook($message_obj = false, $additional = false)
246
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
247
  global $apbct;
248
 
 
 
249
  //
250
  // Skip test if Custom contact forms is disabled.
251
  //
@@ -256,11 +258,12 @@ function ct_ajax_hook($message_obj = false, $additional = false)
256
  //
257
  // Go out because we call it on backend.
258
  //
259
- if( (ct_is_user_enable() === false || (function_exists('get_current_user_id') && get_current_user_id() != 0)) &&
260
- (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
261
- ){
262
- return false;
263
- }
 
264
 
265
  //
266
  // Go out because of not spam data
@@ -431,18 +434,6 @@ function ct_ajax_hook($message_obj = false, $additional = false)
431
  print json_encode($result);
432
  die();
433
  }
434
- else if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform')
435
- {
436
- $message_obj['akismet_result'] = 'true';
437
- $result = array(
438
- 'sent' => false,
439
- 'valid' => 1,
440
- 'errorlist' => array('confirm-email'=>$ct_result->comment)
441
- );
442
- $result = json_encode($result);
443
- echo $result;
444
- return $message_obj;
445
- }
446
  else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
447
  {
448
  print $ct_result->comment;
246
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
247
  global $apbct;
248
 
249
+ $message_obj = (array)$message_obj;
250
+
251
  //
252
  // Skip test if Custom contact forms is disabled.
253
  //
258
  //
259
  // Go out because we call it on backend.
260
  //
261
+ if( ct_is_user_enable() === false || (function_exists('get_current_user_id') && get_current_user_id() != 0)){
262
+ if(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
263
+ {
264
+ return false;
265
+ }
266
+ }
267
 
268
  //
269
  // Go out because of not spam data
434
  print json_encode($result);
435
  die();
436
  }
 
 
 
 
 
 
 
 
 
 
 
 
437
  else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
438
  {
439
  print $ct_result->comment;
inc/cleantalk-common.php CHANGED
@@ -813,4 +813,25 @@ function apbct_api_key__is_correct($api_key = null)
813
  global $apbct;
814
  $api_key = $api_key !== null ? $api_key : $apbct->api_key;
815
  return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  }
813
  global $apbct;
814
  $api_key = $api_key !== null ? $api_key : $apbct->api_key;
815
  return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
816
+ }
817
+
818
+ function apbct_add_async_attribute($tag, $handle, $src) {
819
+
820
+ global $apbct;
821
+
822
+ if(
823
+ $apbct->settings['async_js'] &&
824
+ (
825
+ $handle === 'ct_public'
826
+ || $handle === 'ct_public_gdpr'
827
+ || $handle === 'ct_debug_js'
828
+ || $handle === 'ct_public_admin_js'
829
+ || $handle === 'ct_internal'
830
+ || $handle === 'ct_external'
831
+ || $handle === 'ct_nocache'
832
+ )
833
+ )
834
+ return str_replace( ' src', ' async="async" src', $tag );
835
+ else
836
+ return $tag;
837
  }
inc/cleantalk-public.php CHANGED
@@ -62,6 +62,11 @@ function apbct_init() {
62
  }
63
  }
64
 
 
 
 
 
 
65
  //hook for Anonymous Post
66
  if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
67
  add_action('wp','ct_contact_form_validate_postdata',1);
@@ -580,15 +585,6 @@ function ct_pirate_forms_check(){
580
  wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
581
  }
582
 
583
- function ct_ajaxurl() {
584
- ?>
585
- <script type="text/javascript">
586
- var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
587
- </script>
588
- <?php
589
- wp_enqueue_script('ct_nocache_js',plugins_url( '/cleantalk_nocache.js' , __FILE__ ));
590
- }
591
-
592
  /**
593
  * Adds hidden filed to comment form
594
  */
@@ -736,11 +732,9 @@ function ct_frm_entries_footer_scripts($fields, $form) {
736
  * return @array with errors if spam has found
737
  */
738
  function ct_frm_validate_entry ($errors, $values) {
 
739
  global $wpdb, $current_user, $ct_checkjs_frm, $apbct;
740
 
741
-
742
-
743
-
744
  if ( !$apbct->settings['contact_forms_test']) {
745
  return $errors;
746
  }
@@ -774,7 +768,7 @@ function ct_frm_validate_entry ($errors, $values) {
774
  'message' => $message,
775
  'sender_email' => $sender_email,
776
  'sender_nickname' => $sender_nickname,
777
- 'post_info' => array('comment_type' => 'feedback'),
778
  'checkjs' => $checkjs
779
  )
780
  );
@@ -1414,16 +1408,14 @@ function ct_test_registration($nickname, $email, $ip){
1414
  * @return array with errors
1415
  */
1416
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
 
1417
  global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment;
1418
-
1419
 
1420
-
1421
-
1422
  // Go out if a registrered user action
1423
  if (ct_is_user_enable() === false) {
1424
  return $errors;
1425
  }
1426
-
1427
  if ($apbct->settings['registrations_test'] == 0) {
1428
  return $errors;
1429
  }
@@ -1694,7 +1686,7 @@ function ct_contact_form_is_spam_jetpack($is_spam,$form) {
1694
  'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
1695
  'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
1696
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1697
- 'post_info' => array('comment_type' => 'feedback'),
1698
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1699
  )
1700
  );
@@ -2202,7 +2194,7 @@ function ct_check_wplp(){
2202
  array(
2203
  'message' => $message,
2204
  'sender_email' => $sender_email,
2205
- 'post_info' => array('comment_type' => 'feedback'),
2206
  )
2207
  );
2208
 
@@ -2801,29 +2793,6 @@ function ct_enqueue_scripts_public($hook){
2801
  }
2802
  }
2803
 
2804
- function apbct_add_async_attribute($tag, $handle, $src) {
2805
-
2806
- global $apbct;
2807
-
2808
-
2809
-
2810
- if(
2811
- $apbct->settings['async_js'] &&
2812
- (
2813
- $handle === 'ct_public'
2814
- || $handle === 'ct_public_gdpr'
2815
- || $handle === 'ct_debug_js'
2816
- || $handle === 'ct_public_admin_js'
2817
- || $handle === 'ct_internal'
2818
- || $handle === 'ct_external'
2819
- || $handle === 'ct_nocache'
2820
- )
2821
- )
2822
- return str_replace( ' src', ' async="async" src', $tag );
2823
- else
2824
- return $tag;
2825
- }
2826
-
2827
  /**
2828
  * Reassign callbackback function for the bootom of comment output.
2829
  */
62
  }
63
  }
64
 
65
+ if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
66
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
67
+ ct_ajax_hook();
68
+ }
69
+
70
  //hook for Anonymous Post
71
  if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
72
  add_action('wp','ct_contact_form_validate_postdata',1);
585
  wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
586
  }
587
 
 
 
 
 
 
 
 
 
 
588
  /**
589
  * Adds hidden filed to comment form
590
  */
732
  * return @array with errors if spam has found
733
  */
734
  function ct_frm_validate_entry ($errors, $values) {
735
+
736
  global $wpdb, $current_user, $ct_checkjs_frm, $apbct;
737
 
 
 
 
738
  if ( !$apbct->settings['contact_forms_test']) {
739
  return $errors;
740
  }
768
  'message' => $message,
769
  'sender_email' => $sender_email,
770
  'sender_nickname' => $sender_nickname,
771
+ 'post_info' => array('comment_type' => 'contact_form_formidable'),
772
  'checkjs' => $checkjs
773
  )
774
  );
1408
  * @return array with errors
1409
  */
1410
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1411
+
1412
  global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment;
 
1413
 
 
 
1414
  // Go out if a registrered user action
1415
  if (ct_is_user_enable() === false) {
1416
  return $errors;
1417
  }
1418
+
1419
  if ($apbct->settings['registrations_test'] == 0) {
1420
  return $errors;
1421
  }
1686
  'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
1687
  'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
1688
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1689
+ 'post_info' => array('comment_type' => 'contact_form_grunion'),
1690
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1691
  )
1692
  );
2194
  array(
2195
  'message' => $message,
2196
  'sender_email' => $sender_email,
2197
+ 'post_info' => array('comment_type' => 'contact_form_wplp'),
2198
  )
2199
  );
2200
 
2793
  }
2794
  }
2795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2796
  /**
2797
  * Reassign callbackback function for the bootom of comment output.
2798
  */
inc/cleantalk-settings.php CHANGED
@@ -548,8 +548,7 @@ function apbct_settings__field__state(){
548
  $color="gray";
549
  }
550
 
551
- if($apbct->moderate_ip)
552
- {
553
  $img = $path_to_img."yes.png";
554
  $img_no = $path_to_img."no.png";
555
  $color="black";
@@ -654,12 +653,12 @@ function apbct_settings__field__api_key(){
654
  .'</button>';
655
  // .'&nbsp;'.__('or', 'cleantalk').'&nbsp;';
656
  echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
 
 
657
  }
658
 
659
  // Manual get key
660
  // echo '<a class="apbct_color--gray" target="__blank" href="https://cleantalk.org/register?platform=wordpress&email='.urlencode(ct_get_admin_email()).'&website='.urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST)).'">'.__('Get access key manually', 'cleantalk').'</a>';
661
- echo '<br />';
662
- echo '<br />';
663
 
664
  // Warnings and GDPR
665
  printf(__('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
@@ -667,15 +666,18 @@ function apbct_settings__field__api_key(){
667
  '<a href="https://cleantalk.org/register?platform=wordpress&website='. urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST)) .'">',
668
  '</a>'
669
  );
670
- echo '<div>';
671
- echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'get_key_auto\');"/>';
672
- echo '<label for="spbc_license_agreed">';
673
- printf(
674
- __('I agree with of %sLicense Agreement%s.', 'security-malware-firewall'),
675
- '<a href="https://cleantalk.org/publicoffer" target="_blank" style="color:#66b;">', '</a>'
676
- );
677
- echo "</label>";
678
- echo '</div>';
 
 
 
679
  }
680
 
681
  }
@@ -881,7 +883,7 @@ function apbct_settings__validate($settings) {
881
 
882
  }else{
883
  if(!$apbct->white_label)
884
- $apbct->error_add('key_get', $result);
885
  else
886
  $apbct->error_add('key_get', $result['error_string'] . ' <button id="apbct_setting_get_key_auto" name="submit" type="submit" class="cleantalk_manual_link" value="get_key_auto">'.__('Get access key automatically', 'cleantalk').'</button>'.'<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />');
887
  return $settings;
548
  $color="gray";
549
  }
550
 
551
+ if($apbct->moderate_ip){
 
552
  $img = $path_to_img."yes.png";
553
  $img_no = $path_to_img."no.png";
554
  $color="black";
653
  .'</button>';
654
  // .'&nbsp;'.__('or', 'cleantalk').'&nbsp;';
655
  echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
656
+ echo '<br />';
657
+ echo '<br />';
658
  }
659
 
660
  // Manual get key
661
  // echo '<a class="apbct_color--gray" target="__blank" href="https://cleantalk.org/register?platform=wordpress&email='.urlencode(ct_get_admin_email()).'&website='.urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST)).'">'.__('Get access key manually', 'cleantalk').'</a>';
 
 
662
 
663
  // Warnings and GDPR
664
  printf(__('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
666
  '<a href="https://cleantalk.org/register?platform=wordpress&website='. urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST)) .'">',
667
  '</a>'
668
  );
669
+
670
+ if(!$apbct->ip_license){
671
+ echo '<div>';
672
+ echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'get_key_auto\');"/>';
673
+ echo '<label for="spbc_license_agreed">';
674
+ printf(
675
+ __('I agree with of %sLicense Agreement%s.', 'security-malware-firewall'),
676
+ '<a href="https://cleantalk.org/publicoffer" target="_blank" style="color:#66b;">', '</a>'
677
+ );
678
+ echo "</label>";
679
+ echo '</div>';
680
+ }
681
  }
682
 
683
  }
883
 
884
  }else{
885
  if(!$apbct->white_label)
886
+ $apbct->error_add('key_get', $result);
887
  else
888
  $apbct->error_add('key_get', $result['error_string'] . ' <button id="apbct_setting_get_key_auto" name="submit" type="submit" class="cleantalk_manual_link" value="get_key_auto">'.__('Get access key automatically', 'cleantalk').'</button>'.'<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />');
889
  return $settings;
lib/Cleantalk.php CHANGED
@@ -379,7 +379,7 @@ class Cleantalk {
379
  $msg->all_headers = json_encode($msg->all_headers);
380
 
381
  // Using current server without changing it
382
- if (false && (!empty($this->work_url) && ($this->server_changed + $this->server_ttl > time()))){
383
 
384
  $url = !empty($this->work_url) ? $this->work_url : $this->server_url;
385
  $result = $this->sendRequest($msg, $url, $this->server_timeout);
@@ -389,7 +389,7 @@ class Cleantalk {
389
  }
390
 
391
  // Changing server
392
- if (true || ($result === false || $result->errno != 0)) {
393
 
394
  // Split server url to parts
395
  preg_match("@^(https?://)([^/:]+)(.*)@i", $this->server_url, $matches);
379
  $msg->all_headers = json_encode($msg->all_headers);
380
 
381
  // Using current server without changing it
382
+ if (!empty($this->work_url) && ($this->server_changed + $this->server_ttl > time())){
383
 
384
  $url = !empty($this->work_url) ? $this->work_url : $this->server_url;
385
  $result = $this->sendRequest($msg, $url, $this->server_timeout);
389
  }
390
 
391
  // Changing server
392
+ if ($result === false || $result->errno != 0) {
393
 
394
  // Split server url to parts
395
  preg_match("@^(https?://)([^/:]+)(.*)@i", $this->server_url, $matches);
lib/CleantalkAPI.php CHANGED
@@ -49,6 +49,29 @@ class CleantalkAPI
49
  return $result;
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  /*
53
  * Wrapper for 2s_blacklists_db API method
54
  *
@@ -408,9 +431,9 @@ class CleantalkAPI
408
  )
409
  );
410
  $context = stream_context_create($opts);
411
- $result = file_get_contents($url, 0, $context);
412
 
413
- }else
414
  $errors .= '_AND_ALLOW_URL_FOPEN_IS_DISABLED';
415
 
416
  if(empty($result) && !empty($errors))
49
  return $result;
50
  }
51
 
52
+ /**
53
+ * Function gets spam report
54
+ *
55
+ * @param string website host
56
+ * @param integer report days
57
+ * @return type
58
+ */
59
+ static public function method__spam_check($api_key, $data, $date = null, $do_check = true)
60
+ {
61
+ $request=Array(
62
+ 'method_name' => 'spam_check',
63
+ 'auth_key' => $api_key,
64
+ 'data' => is_array($data) ? implode(',',$data) : $data,
65
+ );
66
+
67
+ if($date) $request['date'] = $date;
68
+
69
+ $result = self::send_request($request, self::URL, 15);
70
+ $result = $do_check ? self::check_response($result, 'spam_check') : $result;
71
+
72
+ return $result;
73
+ }
74
+
75
  /*
76
  * Wrapper for 2s_blacklists_db API method
77
  *
431
  )
432
  );
433
  $context = stream_context_create($opts);
434
+ $result = @file_get_contents($url, 0, $context);
435
 
436
+ }elseif(!ini_get('allow_url_fopen'))
437
  $errors .= '_AND_ALLOW_URL_FOPEN_IS_DISABLED';
438
 
439
  if(empty($result) && !empty($errors))
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.0
6
- Stable tag: 5.112
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -539,6 +539,9 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
539
  Yes, it is. Please read this article,
540
  <a href="https://cleantalk.org/help/CleanTalk-GDPR-Compliance">https://cleantalk.org/help/CleanTalk-GDPR-Compliance</a>
541
 
 
 
 
542
  == Screenshots ==
543
  1. AntiSpam settings are easy to use.
544
  2. AntiSpam plugin rejected a spam bot at the CAPTCHA less registration form. The plugin provides explanation to visitor and websites about each rejected comment/registration or contact message.
@@ -552,6 +555,16 @@ Yes, it is. Please read this article,
552
  10. Website's options.
553
 
554
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
555
  = 5.112 December 21 2018 =
556
  * Fix: Woocommerce AJAX checkout form.
557
  * Fix: Profile Builder Pro.
@@ -1756,6 +1769,16 @@ Yes, it is. Please read this article,
1756
  * First version
1757
 
1758
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
 
1759
  = 5.112 December 21 2018 =
1760
  * Fix: Woocommerce AJAX checkout form.
1761
  * Fix: Profile Builder Pro.
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
+ Stable tag: 5.113
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
539
  Yes, it is. Please read this article,
540
  <a href="https://cleantalk.org/help/CleanTalk-GDPR-Compliance">https://cleantalk.org/help/CleanTalk-GDPR-Compliance</a>
541
 
542
+ = Check external forms =
543
+ If your website has forms that send data to external sources, you can enable option to "Protect external forms". In this case, if plugin determinates that the current message is spam, your form action will be temporary replaced to your current hostname to prevent sending false data to an external source.
544
+
545
  == Screenshots ==
546
  1. AntiSpam settings are easy to use.
547
  2. AntiSpam plugin rejected a spam bot at the CAPTCHA less registration form. The plugin provides explanation to visitor and websites about each rejected comment/registration or contact message.
555
  10. Website's options.
556
 
557
  == Changelog ==
558
+ = 5.113 January 16 2019 =
559
+ * Fix: Fast and Simple Contact Form.
560
+ * Fix: Settings layout.
561
+ * Fix: Error with WooCommerce Quickview.
562
+ * Fix: Bitrix24 contact form.
563
+ * Fix: Request time decreased.
564
+ * Fix: Requesting account status when activating for IP licenses.
565
+ * Add: Precise AJAX request detection.
566
+ * Spam protection improved.
567
+
568
  = 5.112 December 21 2018 =
569
  * Fix: Woocommerce AJAX checkout form.
570
  * Fix: Profile Builder Pro.
1769
  * First version
1770
 
1771
  == Upgrade Notice ==
1772
+ = 5.113 January 16 2019 =
1773
+ * Fix: Fast and Simple Contact Form.
1774
+ * Fix: Settings layout.
1775
+ * Fix: Error with WooCommerce Quickview.
1776
+ * Fix: Bitrix24 contact form.
1777
+ * Fix: Request time decreased.
1778
+ * Fix: Requesting account status when activating for IP licenses.
1779
+ * Add: Precise AJAX request detection.
1780
+ * Spam protection improved.
1781
+
1782
  = 5.112 December 21 2018 =
1783
  * Fix: Woocommerce AJAX checkout form.
1784
  * Fix: Profile Builder Pro.