Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.47

Version Description

September 5 2016 = * WooCommerce: direct integration for checkout form. * WooCommerce Sensei: login form fix. * bbPress: Added the check for topics and comments with stop_words * bbPress: Skip check for admin in comments and topics * UserPro: fixes. Request without field "shortcode" * Contact Form 7: Bug fix. * SpamFireWall: Optimized logs rotation. * Updated inner functions (compatibility fix for PHP 5.4+) * Fixed output of counters (without spamfirewall statistics) * Fixed spelling in settings * Added "Delete from the list" button in comments spam check page * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.46 to 5.47

cleantalk.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Spam Protection 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. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.46
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.46';
11
- $ct_agent_version = 'wordpress-546';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
@@ -354,8 +354,7 @@ function ct_add_event($event_type)
354
  if(!isset($ct_data['array_accepted'])){
355
  $ct_data['array_accepted']=Array();
356
  $ct_data['array_blocked']=Array();
357
- $ct_data['current_hour']=0;
358
-
359
  }
360
  //All time counter
361
  if(!isset($ct_data['all_time_counter'])){
@@ -369,18 +368,24 @@ function ct_add_event($event_type)
369
  $ct_data['user_counter']['since']=date('d M');
370
  }
371
 
 
 
 
 
 
 
372
  //Add 1 to counters
373
  if($event_type=='yes'){
374
- $ct_data['array_accepted'][$current_hour]++;
375
- $ct_data['all_time_counter']['accepted']++;
376
- $ct_data['user_counter']['accepted']++;
377
  }
378
  if($event_type=='no'){
379
- $ct_data['array_blocked'][$current_hour]++;
380
  @$ct_data['all_time_counter']['blocked']++;
381
  @$ct_data['user_counter']['blocked']++;
382
- }
383
-
384
  update_option('cleantalk_data', $ct_data);
385
  $cleantalk_executed=true;
386
  }
@@ -590,4 +595,17 @@ function ct_send_sfw_log()
590
  $sfw = new CleanTalkSFW();
591
  $sfw->send_logs();
592
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  ?>
3
  Plugin Name: Spam Protection 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. Formerly Anti-Spam by CleanTalk.
6
+ Version: 5.47
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.47';
11
+ $ct_agent_version = 'wordpress-547';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
354
  if(!isset($ct_data['array_accepted'])){
355
  $ct_data['array_accepted']=Array();
356
  $ct_data['array_blocked']=Array();
357
+ $ct_data['current_hour']=$current_hour;
 
358
  }
359
  //All time counter
360
  if(!isset($ct_data['all_time_counter'])){
368
  $ct_data['user_counter']['since']=date('d M');
369
  }
370
 
371
+ if($current_hour!=$ct_data['current_hour']){
372
+ @$ct_data['current_hour']=$current_hour;
373
+ @$ct_data['array_accepted'][$current_hour]=0;
374
+ @$ct_data['array_blocked'][$current_hour]=0;
375
+ }
376
+
377
  //Add 1 to counters
378
  if($event_type=='yes'){
379
+ @$ct_data['array_accepted'][$current_hour]++;
380
+ @$ct_data['all_time_counter']['accepted']++;
381
+ @$ct_data['user_counter']['accepted']++;
382
  }
383
  if($event_type=='no'){
384
+ @$ct_data['array_blocked'][$current_hour]++;
385
  @$ct_data['all_time_counter']['blocked']++;
386
  @$ct_data['user_counter']['blocked']++;
387
+ }
388
+
389
  update_option('cleantalk_data', $ct_data);
390
  $cleantalk_executed=true;
391
  }
595
  $sfw = new CleanTalkSFW();
596
  $sfw->send_logs();
597
  }
598
+
599
+ /*
600
+ function myplugin_update_field( $new_value, $old_value ) {
601
+ error_log('cleantalk_data dump: '. strlen(serialize($new_value)));
602
+ return $new_value;
603
+ }
604
+
605
+ function myplugin_init() {
606
+ add_filter( 'pre_update_option_cleantalk_data', 'myplugin_update_field', 10, 2 );
607
+ }
608
+
609
+ add_action( 'init', 'myplugin_init' );
610
+ */
611
  ?>
inc/cleantalk-admin.php CHANGED
@@ -306,6 +306,7 @@ function ct_admin_init()
306
  add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
307
  add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
308
  add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
 
309
  add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
310
 
311
  add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
@@ -401,7 +402,7 @@ function ct_input_all_time_counter() {
401
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter1' name='cleantalk_settings[all_time_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter1'> ".__('Yes')."</label>";
402
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
403
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter0' name='cleantalk_settings[all_time_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter0'> ".__('No')."</label>";
404
- @admin_addDescriptionsFields(sprintf(__('Display all-time requests counter in the admin bar. Counter dispalays number of requests since plugin installation.', 'cleantalk'), $ct_options['all_time_counter']));
405
  }
406
 
407
  function ct_input_daily_counter() {
@@ -416,7 +417,7 @@ function ct_input_daily_counter() {
416
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter1' name='cleantalk_settings[daily_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter1'> ".__('Yes')."</label>";
417
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
418
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter0' name='cleantalk_settings[daily_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter0'> ".__('No')."</label>";
419
- @admin_addDescriptionsFields(sprintf(__('Display daily requests counter in the admin bar. Counter dispalays number of requests of the past 24 hours.', 'cleantalk'), $ct_options['all_time_counter']));
420
  }
421
 
422
  function ct_add_admin_menu( $wp_admin_bar ) {
@@ -451,7 +452,7 @@ function ct_add_admin_menu( $wp_admin_bar ) {
451
  update_option('cleantalk_data', $ct_data);
452
  }
453
 
454
- //Reset or create counter
455
  if(!isset($ct_data['user_counter']) || (isset($_GET['ct_reset_user_counter']) && $_GET['ct_reset_user_counter'] == 1)){
456
  $ct_data['user_counter']['accepted']=0;
457
  $ct_data['user_counter']['blocked']=0;
@@ -461,25 +462,28 @@ function ct_add_admin_menu( $wp_admin_bar ) {
461
 
462
  //Compile user's counter string
463
  $user_counter=Array('accepted'=>$ct_data['user_counter']['accepted'], 'blocked'=>$ct_data['user_counter']['blocked'], 'all'=>$ct_data['user_counter']['accepted'] + $ct_data['user_counter']['blocked'], 'since'=>$ct_data['user_counter']['since']);
464
- $user_counter_str='<span style="color: white;">User: ' .$user_counter['all']. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
 
 
465
  $all_time_counter_str='';
466
  $daily_counter_str='';
467
 
468
- //Don't compile if daily counter disabled
469
  if(isset($ct_options['all_time_counter']) && $ct_options['all_time_counter']=='1'){
470
  $all_time_counter=Array('accepted'=>$ct_data['all_time_counter']['accepted'], 'blocked'=>$ct_data['all_time_counter']['blocked'], 'all'=>$ct_data['all_time_counter']['accepted'] + $ct_data['all_time_counter']['blocked']);
471
  $all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | All: ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
472
  }
473
 
474
- //Don't compile if all time counter disabled
475
  if(isset($ct_options['daily_counter']) && $ct_options['daily_counter']=='1'){
476
  $daily_counter=Array('accepted'=>array_sum($ct_data['array_accepted']), 'blocked'=>array_sum($ct_data['array_blocked']), 'all'=>array_sum($ct_data['array_accepted']) + array_sum($ct_data['array_blocked']));
477
- $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
 
478
  }
479
 
480
  $args = array(
481
  'id' => 'ct_parent_node',
482
- 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.'</div></div>' //You could change widget string here by simply deleting variables
483
  );
484
  $wp_admin_bar->add_node( $args );
485
 
@@ -613,6 +617,14 @@ function ct_section_settings_state() {
613
  {
614
  print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
615
  }
 
 
 
 
 
 
 
 
616
  if($ct_data['moderate_ip'] == 1)
617
  {
618
  print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
@@ -777,6 +789,22 @@ function ct_input_general_contact_forms_test() {
777
  admin_addDescriptionsFields(__('Anti spam test for any WordPress or themes contacts forms.', 'cleantalk'));
778
  }
779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  /**
781
  * @author Artem Leontiev
782
  * Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
@@ -1495,25 +1523,23 @@ function ct_update_option($option_name) {
1495
  $ct_options['apikey'] = $api_key;
1496
  }
1497
 
1498
- if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1)
1499
- {
1500
- cleantalk_update_sfw();
1501
- }
1502
-
1503
  if (!ct_valid_key($api_key)) {
1504
  return;
1505
  }
 
 
 
 
 
 
 
 
 
1506
 
1507
  $key_valid = true;
1508
  $app_server_error = false;
1509
  $ct_data['testing_failed']=0;
1510
 
1511
-
1512
- if(!function_exists('sendRawRequest'))
1513
- {
1514
- require_once('cleantalk.class.php');
1515
- }
1516
-
1517
  $request=Array();
1518
  $request['method_name'] = 'notice_validate_key';
1519
  $request['auth_key'] = $api_key;
@@ -1537,7 +1563,7 @@ function ct_update_option($option_name) {
1537
  $app_server_error = true;
1538
  $ct_data['testing_failed']=1;
1539
  }
1540
-
1541
  update_option('cleantalk_data', $ct_data);
1542
 
1543
  if ($key_valid) {
306
  add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
307
  add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
308
  add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
309
+ add_settings_field('cleantalk_wc_checkout_test', __('WooCommerce checkout form', 'cleantalk'), 'ct_input_wc_chekout_test', 'cleantalk', 'cleantalk_settings_anti_spam');
310
  add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
311
 
312
  add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
402
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter1' name='cleantalk_settings[all_time_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter1'> ".__('Yes')."</label>";
403
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
404
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter0' name='cleantalk_settings[all_time_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter0'> ".__('No')."</label>";
405
+ @admin_addDescriptionsFields(sprintf(__('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'), $ct_options['all_time_counter']));
406
  }
407
 
408
  function ct_input_daily_counter() {
417
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter1' name='cleantalk_settings[daily_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter1'> ".__('Yes')."</label>";
418
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
419
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_all_time_counter0' name='cleantalk_settings[daily_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_all_time_counter0'> ".__('No')."</label>";
420
+ @admin_addDescriptionsFields(sprintf(__('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'), $ct_options['all_time_counter']));
421
  }
422
 
423
  function ct_add_admin_menu( $wp_admin_bar ) {
452
  update_option('cleantalk_data', $ct_data);
453
  }
454
 
455
+ //Reset or create user counter
456
  if(!isset($ct_data['user_counter']) || (isset($_GET['ct_reset_user_counter']) && $_GET['ct_reset_user_counter'] == 1)){
457
  $ct_data['user_counter']['accepted']=0;
458
  $ct_data['user_counter']['blocked']=0;
462
 
463
  //Compile user's counter string
464
  $user_counter=Array('accepted'=>$ct_data['user_counter']['accepted'], 'blocked'=>$ct_data['user_counter']['blocked'], 'all'=>$ct_data['user_counter']['accepted'] + $ct_data['user_counter']['blocked'], 'since'=>$ct_data['user_counter']['since']);
465
+ //Previous version $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': ' .$user_counter['all']*/. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
466
+ $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': </span><span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
467
+
468
  $all_time_counter_str='';
469
  $daily_counter_str='';
470
 
471
+ //Don't compile if all time counter disabled
472
  if(isset($ct_options['all_time_counter']) && $ct_options['all_time_counter']=='1'){
473
  $all_time_counter=Array('accepted'=>$ct_data['all_time_counter']['accepted'], 'blocked'=>$ct_data['all_time_counter']['blocked'], 'all'=>$ct_data['all_time_counter']['accepted'] + $ct_data['all_time_counter']['blocked']);
474
  $all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | All: ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
475
  }
476
 
477
+ //Don't compile if daily counter disabled
478
  if(isset($ct_options['daily_counter']) && $ct_options['daily_counter']=='1'){
479
  $daily_counter=Array('accepted'=>array_sum($ct_data['array_accepted']), 'blocked'=>array_sum($ct_data['array_blocked']), 'all'=>array_sum($ct_data['array_accepted']) + array_sum($ct_data['array_blocked']));
480
+ //Previous version $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
481
+ $daily_counter_str='<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: </span><span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
482
  }
483
 
484
  $args = array(
485
  'id' => 'ct_parent_node',
486
+ 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.'</div></div>' //You could change widget string here by simply deleting variables
487
  );
488
  $wp_admin_bar->add_node( $args );
489
 
617
  {
618
  print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
619
  }
620
+ if($ct_options['wc_checkout_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
621
+ {
622
+ print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
623
+ }
624
+ else
625
+ {
626
+ print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
627
+ }
628
  if($ct_data['moderate_ip'] == 1)
629
  {
630
  print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
789
  admin_addDescriptionsFields(__('Anti spam test for any WordPress or themes contacts forms.', 'cleantalk'));
790
  }
791
 
792
+ /**
793
+ * Admin callback function - Displays inputs of 'wc_checkout_test' plugin parameter
794
+ */
795
+ function ct_input_wc_chekout_test() {
796
+ global $ct_options, $ct_data;
797
+
798
+ $ct_options = ct_get_options();
799
+ $ct_data = ct_get_data();
800
+
801
+ $value = $ct_options['wc_checkout_test'];
802
+ echo "<input type='radio' id='cleantalk_wc_checkout_test1' name='cleantalk_settings[wc_checkout_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_wc_checkout_test1'> " . __('Yes') . "</label>";
803
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
804
+ echo "<input type='radio' id='cleantalk_wc_checkout_test0' name='cleantalk_settings[wc_checkout_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_wc_checkout_test0'> " . __('No') . "</label>";
805
+ admin_addDescriptionsFields(__('Anti spam test for WooCommerce checkout form.', 'cleantalk'));
806
+ }
807
+
808
  /**
809
  * @author Artem Leontiev
810
  * Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
1523
  $ct_options['apikey'] = $api_key;
1524
  }
1525
 
 
 
 
 
 
1526
  if (!ct_valid_key($api_key)) {
1527
  return;
1528
  }
1529
+
1530
+ if (isset($_POST['cleantalk_settings']['spam_firewall'])) {
1531
+ if ($_POST['cleantalk_settings']['spam_firewall'] == 1) {
1532
+ cleantalk_update_sfw();
1533
+ } else {
1534
+ // Reseting SFW logs to do not keep huge ammount of data.
1535
+ $ct_data['sfw_log']= array();
1536
+ }
1537
+ }
1538
 
1539
  $key_valid = true;
1540
  $app_server_error = false;
1541
  $ct_data['testing_failed']=0;
1542
 
 
 
 
 
 
 
1543
  $request=Array();
1544
  $request['method_name'] = 'notice_validate_key';
1545
  $request['auth_key'] = $api_key;
1563
  $app_server_error = true;
1564
  $ct_data['testing_failed']=1;
1565
  }
1566
+
1567
  update_option('cleantalk_data', $ct_data);
1568
 
1569
  if ($key_valid) {
inc/cleantalk-ajax.php CHANGED
@@ -334,12 +334,20 @@ function ct_ajax_hook()
334
  $_POST['target']=1;
335
  }
336
 
337
- $temp = ct_get_fields_any2($_POST);
338
-
339
- $sender_email = ($temp['email'] ? $temp['email'] : '');
340
- $nickname = ($temp['nickname'] ? $temp['nickname'] : '');
341
- $subject = ($temp['subject'] ? $temp['subject'] : '');
342
- $message = ($temp['message'] ? $temp['message'] : array());
 
 
 
 
 
 
 
 
343
  if ($subject != '') {
344
  $message = array_merge(array('subject' => $subject), $message);
345
  }
334
  $_POST['target']=1;
335
  }
336
 
337
+ //UserPro fix
338
+ if($_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
339
+ $ct_post_temp = $_POST;
340
+ $ct_post_temp['shortcode'] = '';
341
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
342
+ }else
343
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
344
+
345
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
346
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
347
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
348
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
349
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
350
+
351
  if ($subject != '') {
352
  $message = array_merge(array('subject' => $subject), $message);
353
  }
inc/cleantalk-comments-checkspam.js CHANGED
@@ -217,11 +217,11 @@ jQuery("#ct_delete_checked").click(function(){
217
  });
218
  jQuery(".cleantalk_comment").mouseover(function(){
219
  id = jQuery(this).attr("data-id");
220
- jQuery("#cleantalk_delete_"+id).show();
221
  });
222
  jQuery(".cleantalk_comment").mouseout(function(){
223
  id = jQuery(this).attr("data-id");
224
- jQuery("#cleantalk_delete_"+id).hide();
225
  });
226
  jQuery(".cleantalk_delete_button").click(function(){
227
  id = jQuery(this).attr("data-id");
@@ -248,7 +248,24 @@ jQuery(".cleantalk_delete_button").click(function(){
248
  id = jQuery(this).attr("data-id");
249
  animate_comment(0.3, id);
250
  });
251
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  jQuery(document).ready(function(){
253
  working=true;
254
  ct_show_info();
217
  });
218
  jQuery(".cleantalk_comment").mouseover(function(){
219
  id = jQuery(this).attr("data-id");
220
+ jQuery("#cleantalk_button_set_"+id).show();
221
  });
222
  jQuery(".cleantalk_comment").mouseout(function(){
223
  id = jQuery(this).attr("data-id");
224
+ jQuery("#cleantalk_button_set_"+id).hide();
225
  });
226
  jQuery(".cleantalk_delete_button").click(function(){
227
  id = jQuery(this).attr("data-id");
248
  id = jQuery(this).attr("data-id");
249
  animate_comment(0.3, id);
250
  });
251
+ jQuery(".cleantalk_delete_from_list_button").click(function(){
252
+ ct_id = jQuery(this).attr("data-id");
253
+ var data = {
254
+ 'action': 'ajax_ct_delete_from_list',
255
+ 'security': ajax_nonce,
256
+ 'id': ct_id
257
+ };
258
+ jQuery.ajax({
259
+ type: "POST",
260
+ url: ajaxurl,
261
+ data: data,
262
+ success: function(msg){
263
+ jQuery("#comment-"+ct_id).fadeOut('slow', function(){
264
+ jQuery("#comment-"+ct_id).remove();
265
+ });
266
+ },
267
+ });
268
+ });
269
  jQuery(document).ready(function(){
270
  working=true;
271
  ct_show_info();
inc/cleantalk-comments.php CHANGED
@@ -105,8 +105,10 @@ function ct_show_checkspam_page()
105
  <p>
106
  <?php print $c_spam[$i]->comment_content; ?>
107
  </p>
108
- <div style="height:16px;">
109
- <a href="#" class="cleantalk_delete_button" id="cleantalk_delete_<?php print $c_spam[$i]->comment_ID; ?>" data-id="<?php print $c_spam[$i]->comment_ID; ?>" style="color:#a00;display:none;" onclick="return false;">Delete</a>
 
 
110
  </div>
111
  </td>
112
  <td class="response column-response">
@@ -498,7 +500,7 @@ function ct_ajax_delete_all()
498
  )
499
  );
500
  $c_spam=get_comments($args_spam);
501
- // error_log($c_spam);
502
  $cnt=sizeof($c_spam);
503
 
504
  $args_spam = array(
@@ -512,7 +514,7 @@ function ct_ajax_delete_all()
512
  )
513
  );
514
  $cnt_all=get_comments($args_spam);
515
- // error_log($cnt_all);
516
  for($i=0;$i<sizeof($c_spam);$i++)
517
  {
518
  wp_delete_comment($c_spam[$i]->comment_ID, false);
@@ -530,4 +532,22 @@ function ct_ajax_clear_comments()
530
  $wpdb->query("delete from $wpdb->commentmeta where meta_key='ct_hash' or meta_key='ct_checked' or meta_key='ct_marked_as_spam';");
531
  die();
532
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  ?>
105
  <p>
106
  <?php print $c_spam[$i]->comment_content; ?>
107
  </p>
108
+ <div style="height:16px; display: none;" id='cleantalk_button_set_<?php print $c_spam[$i]->comment_ID; ?>'>
109
+ <a href="#" class="cleantalk_delete_button" data-id="<?php print $c_spam[$i]->comment_ID; ?>" style="color:#a00;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';">Delete</a>
110
+ &nbsp;|&nbsp;
111
+ <a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $c_spam[$i]->comment_ID; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';">Approve and delete from the list</a>
112
  </div>
113
  </td>
114
  <td class="response column-response">
500
  )
501
  );
502
  $c_spam=get_comments($args_spam);
503
+
504
  $cnt=sizeof($c_spam);
505
 
506
  $args_spam = array(
514
  )
515
  );
516
  $cnt_all=get_comments($args_spam);
517
+
518
  for($i=0;$i<sizeof($c_spam);$i++)
519
  {
520
  wp_delete_comment($c_spam[$i]->comment_ID, false);
532
  $wpdb->query("delete from $wpdb->commentmeta where meta_key='ct_hash' or meta_key='ct_checked' or meta_key='ct_marked_as_spam';");
533
  die();
534
  }
535
+
536
+ /**
537
+ * Admin action 'comment_unapproved_to_approved' - Approve comment, delete from the deleting list
538
+ */
539
+ add_action( 'wp_ajax_ajax_ct_delete_from_list', 'ct_ajax_delete_from_list' );
540
+ function ct_ajax_delete_from_list() {
541
+
542
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
543
+
544
+ $id=$_POST['id'];
545
+ $comment = get_comment($id, 'ARRAY_A');
546
+ $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
547
+ $comment['comment_approved'] = 1;
548
+ update_comment_meta($id, 'ct_marked_as_spam', 0);
549
+ wp_update_comment($comment);
550
+
551
+ die();
552
+ }
553
  ?>
inc/cleantalk-common.php CHANGED
@@ -469,6 +469,7 @@ function ct_def_options() {
469
  'comments_test' => '1',
470
  'contact_forms_test' => '1',
471
  'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
 
472
  'remove_old_spam' => '0',
473
  'spam_store_days' => '15', // Days before delete comments from folder Spam
474
  'ssl_on' => 0, // Secure connection to servers
@@ -678,6 +679,7 @@ function delete_spam_comments() {
678
  /*
679
  * Get data from submit recursively
680
  */
 
681
  function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$arr)
682
  {
683
  $skip_params = array(
@@ -750,12 +752,14 @@ function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$ar
750
  }
751
  }
752
  }
 
753
 
754
  /*
755
  * Get data from an ARRAY recursively
756
  * @return array
757
- */
758
- function ct_get_fields_any2($arr, $message=array(), $email=NULL, $nickname=NULL, $subject=NULL, $contact=true) {
 
759
  $skip_params = array(
760
  'ipn_track_id', // PayPal IPN #
761
  'txn_type', // PayPal transaction type
@@ -771,51 +775,40 @@ function ct_get_fields_any2($arr, $message=array(), $email=NULL, $nickname=NULL,
771
  'pwd',
772
  'user_pass'
773
  );
774
- foreach($skip_params as $key=>$value)
775
- {
776
  if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
777
- {
778
  $contact = false;
779
- }
780
  }
781
- foreach($arr as $key=>$value)
782
- {
783
- if(!is_array($value)&&!is_object($value)&&@get_class($value)!='WP_User')
784
- {
785
- //
 
 
 
 
 
 
786
  // Removes shortcodes to do better spam filtration on server side.
787
- //
788
  $value = strip_shortcodes($value);
789
-
790
- if (in_array($key, $skip_params) && $key!=0 && $key!='' || preg_match("/^ct_checkjs/", $key)) {
791
  $contact = false;
792
- }
793
- if (!$email && @preg_match("/^\S+@\S+\.\S+$/", $value))
794
- {
795
  $email = $value;
796
- }
797
- else if ($nickname === '' && ct_get_data_from_submit($key, 'name'))
798
- {
799
- $nickname = $value;
800
- }
801
- else if ($subject === '' && ct_get_data_from_submit($key, 'subject'))
802
- {
803
  $subject = $value;
804
- }
805
- else
806
- {
807
- //
808
- // Obfuscate private data
809
- //
810
- if (in_array($key, $obfuscate_params)) {
811
- $value = ct_obfuscate_param($value);
812
- }
813
  $message[$key] = $value;
814
  }
815
  }
816
- else if(!is_object($value)&&@get_class($value)!='WP_User')
817
- {
818
- $temp = ct_get_fields_any2($value);
819
 
820
  $email = ($temp['email'] ? $temp['email'] : '');
821
  $nickname = ($temp['nickname'] ? $temp['nickname'] : '');
@@ -824,9 +817,7 @@ function ct_get_fields_any2($arr, $message=array(), $email=NULL, $nickname=NULL,
824
  $message = (count($temp['message']) == 0 ? $message : array_merge($message, $temp['message']));
825
  }
826
  }
827
- //
828
- // Reset $message if we have a sign-up data
829
- //
830
  $skip_message_post = array(
831
  'edd_action', // Easy Digital Downloads
832
  );
@@ -836,6 +827,7 @@ function ct_get_fields_any2($arr, $message=array(), $email=NULL, $nickname=NULL,
836
  break;
837
  }
838
  }
 
839
  $return_param = array(
840
  'email' => $email,
841
  'nickname' => $nickname,
@@ -843,7 +835,6 @@ function ct_get_fields_any2($arr, $message=array(), $email=NULL, $nickname=NULL,
843
  'contact' => $contact,
844
  'message' => $message
845
  );
846
-
847
  return $return_param;
848
  }
849
 
@@ -859,7 +850,7 @@ function ct_obfuscate_param ($value = null) {
859
 
860
  return $value;
861
  }
862
-
863
  function ct_get_fields_any_postdata(&$message,$arr)
864
  {
865
  $skip_params = array(
@@ -885,6 +876,23 @@ function ct_get_fields_any_postdata(&$message,$arr)
885
  }
886
  }
887
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
 
889
  /*
890
  * Check if Array has keys with restricted names
469
  'comments_test' => '1',
470
  'contact_forms_test' => '1',
471
  'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
472
+ 'wc_checkout_test' => '0', //WooCommerce checkout default test => OFF
473
  'remove_old_spam' => '0',
474
  'spam_store_days' => '15', // Days before delete comments from folder Spam
475
  'ssl_on' => 0, // Secure connection to servers
679
  /*
680
  * Get data from submit recursively
681
  */
682
+ /* Old one
683
  function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$arr)
684
  {
685
  $skip_params = array(
752
  }
753
  }
754
  }
755
+ //*/
756
 
757
  /*
758
  * Get data from an ARRAY recursively
759
  * @return array
760
+ * New one
761
+ */
762
+ function ct_get_fields_any($arr, $message=array(), $email=NULL, $nickname=NULL, $subject=NULL, $contact=true) {
763
  $skip_params = array(
764
  'ipn_track_id', // PayPal IPN #
765
  'txn_type', // PayPal transaction type
775
  'pwd',
776
  'user_pass'
777
  );
778
+ foreach($skip_params as $key=>$value){
 
779
  if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
 
780
  $contact = false;
 
781
  }
782
+ foreach($arr as $key=>$value){
783
+ if(!is_array($value)&&!is_object($value)&&@get_class($value)!='WP_User'){
784
+ // Skip empty fields
785
+ if($value==='')
786
+ continue;
787
+ // Obfuscate private data
788
+ if (in_array($key, $obfuscate_params)){
789
+ $value = ct_obfuscate_param($value);
790
+ $message[$key] = $value;
791
+ continue;
792
+ }
793
  // Removes shortcodes to do better spam filtration on server side.
 
794
  $value = strip_shortcodes($value);
795
+
796
+ if (in_array($key, $skip_params) && $key!=0 && $key!='' || preg_match("/^ct_checkjs/", $key))
797
  $contact = false;
798
+
799
+ if (!$email && @preg_match("/^\S+@\S+\.\S+$/", $value)){
 
800
  $email = $value;
801
+ }elseif ($nickname === '' && ct_get_data_from_submit($key, 'name')){
802
+ $nickname .= " ".$value;
803
+ }elseif ($subject === '' && ct_get_data_from_submit($key, 'subject')){
 
 
 
 
804
  $subject = $value;
805
+ }else{
 
 
 
 
 
 
 
 
806
  $message[$key] = $value;
807
  }
808
  }
809
+ else if(!is_object($value)&&@get_class($value)!='WP_User'){
810
+
811
+ $temp = ct_get_fields_any($value);
812
 
813
  $email = ($temp['email'] ? $temp['email'] : '');
814
  $nickname = ($temp['nickname'] ? $temp['nickname'] : '');
817
  $message = (count($temp['message']) == 0 ? $message : array_merge($message, $temp['message']));
818
  }
819
  }
820
+ // Reset $message if we have a sign-up data
 
 
821
  $skip_message_post = array(
822
  'edd_action', // Easy Digital Downloads
823
  );
827
  break;
828
  }
829
  }
830
+
831
  $return_param = array(
832
  'email' => $email,
833
  'nickname' => $nickname,
835
  'contact' => $contact,
836
  'message' => $message
837
  );
 
838
  return $return_param;
839
  }
840
 
850
 
851
  return $value;
852
  }
853
+ /* //OLD ct_get_fields_any_postdata
854
  function ct_get_fields_any_postdata(&$message,$arr)
855
  {
856
  $skip_params = array(
876
  }
877
  }
878
  }
879
+ //*/
880
+ //New ct_get_fields_any_postdata
881
+ function ct_get_fields_any_postdata($arr, $message=''){
882
+ $skip_params = array(
883
+ 'ipn_track_id', // PayPal IPN #
884
+ 'txn_type', // PayPal transaction type
885
+ 'payment_status', // PayPal payment status
886
+ );
887
+ foreach($arr as $key => $value){
888
+ if(!is_array($value))
889
+ if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
890
+ $message .= "$value\n";
891
+ else
892
+ $message .= ct_get_fields_any_postdata($value, $message)."\n";
893
+ }
894
+ return $message;
895
+ }
896
 
897
  /*
898
  * Check if Array has keys with restricted names
inc/cleantalk-public.php CHANGED
@@ -9,7 +9,7 @@ function ct_init() {
9
 
10
  $ct_options = ct_get_options();
11
  $ct_data=ct_get_data();
12
-
13
  //fix for EPM registration form
14
  if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
15
  {
@@ -133,6 +133,7 @@ function ct_init() {
133
 
134
  // bbPress
135
  if(class_exists('bbPress')){
 
136
  add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
137
  add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
138
  add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
@@ -413,13 +414,13 @@ function ct_frm_validate_entry ($errors, $values) {
413
  if ($post_info === false)
414
  $post_info = '';
415
 
416
- $temp = ct_get_fields_any2($values['item_meta']);
417
-
418
- $sender_email = ($temp['email'] ? $temp['email'] : '');
419
- $sender_nickname = ($temp['nickname'] ? $temp['nickname'] : '');
420
- $subject = ($temp['subject'] ? $temp['subject'] : '');
421
- $contact_form = ($temp['contact'] ? $temp['contact'] : true);
422
- $message = ($temp['message'] ? $temp['message'] : array());
423
 
424
  $message = json_encode($message);
425
 
@@ -441,13 +442,26 @@ function ct_frm_validate_entry ($errors, $values) {
441
  return $errors;
442
  }
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  /**
445
  * Public filter 'bbp_*' - Checks topics, replies by cleantalk
446
  * @param mixed[] $comment Comment string
447
  * @return mixed[] $comment Comment string
448
  */
449
  function ct_bbp_new_pre_content ($comment) {
450
- global $ct_options, $ct_data;
451
 
452
  $ct_options = ct_get_options();
453
  $ct_data = ct_get_data();
@@ -455,11 +469,11 @@ function ct_bbp_new_pre_content ($comment) {
455
  if ($ct_options['comments_test'] == 0 ) {
456
  return $comment;
457
  }
458
-
459
- // Skip processing for logged in users.
460
- if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
 
461
  return $comment;
462
- }
463
 
464
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
465
  if ($checkjs === null) {
@@ -479,7 +493,12 @@ function ct_bbp_new_pre_content ($comment) {
479
  if ($post_info === false) {
480
  $post_info = '';
481
  }
482
-
 
 
 
 
 
483
  $ct_base_call_result = ct_base_call(array(
484
  'message' => $comment,
485
  'example' => $example,
@@ -492,7 +511,7 @@ function ct_bbp_new_pre_content ($comment) {
492
  $ct = $ct_base_call_result['ct'];
493
  $ct_result = $ct_base_call_result['ct_result'];
494
 
495
- if ($ct_result->stop_queue == 1 || $ct_result->spam == 1 || ($ct_result->allow == 0 && $ct_result->stop_words !== null)) {
496
  bbp_add_error('bbp_reply_content', $ct_result->comment);
497
  }
498
 
@@ -512,6 +531,10 @@ function ct_preprocess_comment($comment) {
512
 
513
  $ct_options = ct_get_options();
514
  $ct_data = ct_get_data();
 
 
 
 
515
 
516
  if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
517
  {
@@ -1529,15 +1552,16 @@ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
1529
  if ($post_info === false)
1530
  $post_info = '';
1531
 
1532
- $sender_email = null;
1533
- $sender_nickname = null;
1534
- $subject = '';
1535
- $message = array();
1536
- $contact_form = null;
1537
- //getting info from custom fields
1538
- @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
1539
- //setting fields if they with defaults names
1540
-
 
1541
  if ($subject != '') {
1542
  $message = array_merge(array('subject' => $subject), $message);
1543
  }
@@ -1706,13 +1730,14 @@ function ct_gforms_spam_test ($is_spam, $form, $entry) {
1706
  if ($post_info === false)
1707
  $post_info = '';
1708
 
1709
- $sender_email = null;
1710
- $sender_nickname = null;
1711
- $subject = '';
1712
- $message = '';
1713
-
1714
- @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
1715
-
 
1716
  if ($subject != '') {
1717
  $message = array_merge(array('subject' => $subject), $message);
1718
  }
@@ -1852,7 +1877,6 @@ function ct_contact_form_validate () {
1852
  (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
1853
  (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
1854
  (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
1855
- strpos($_SERVER['REQUEST_URI'],'/checkout/')!==false ||
1856
  strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false ||
1857
  strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false||
1858
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
@@ -1869,17 +1893,23 @@ function ct_contact_form_validate () {
1869
  isset($_POST['fscf_submitted']) ||
1870
  strpos($_SERVER['REQUEST_URI'],'/wc-api/')!==false ||
1871
  isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
1872
- isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) // Formidable forms
1873
- || isset($_POST['comment_post_ID']) // The comment form
1874
- || isset($_GET['for'])
1875
- ) {
 
 
1876
  return null;
1877
  }
1878
  // Do not execute anti-spam test for logged in users.
1879
  if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $ct_options['protect_logged_in'] != 1) {
1880
  return null;
1881
  }
1882
-
 
 
 
 
1883
  //@header("CtConditions: Passed");
1884
  cleantalk_debug("CtConditions", "Passed");
1885
 
@@ -1895,13 +1925,13 @@ function ct_contact_form_validate () {
1895
  $post_info = '';
1896
  }
1897
 
1898
- $sender_email = '';
1899
- $sender_nickname = '';
1900
- $subject = '';
1901
- $contact_form = true;
1902
- $message = array();
1903
-
1904
- @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
1905
 
1906
  if ($subject != '') {
1907
  $message = array_merge(array('subject' => $subject), $message);
@@ -2004,6 +2034,18 @@ function ct_contact_form_validate () {
2004
  echo $response;
2005
  die();
2006
  }
 
 
 
 
 
 
 
 
 
 
 
 
2007
  else
2008
  {
2009
  ct_die(null, null);
@@ -2080,8 +2122,8 @@ function ct_contact_form_validate_postdata () {
2080
  $post_info = '';
2081
  }
2082
 
2083
- @ct_get_fields_any_postdata($message, $_POST);
2084
-
2085
  $message = json_encode($message);
2086
 
2087
  if(strlen(trim($message))<10)
9
 
10
  $ct_options = ct_get_options();
11
  $ct_data=ct_get_data();
12
+
13
  //fix for EPM registration form
14
  if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
15
  {
133
 
134
  // bbPress
135
  if(class_exists('bbPress')){
136
+ add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
137
  add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
138
  add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
139
  add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
414
  if ($post_info === false)
415
  $post_info = '';
416
 
417
+ $ct_temp_msg_data = ct_get_fields_any($values['item_meta']);
418
+
419
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
420
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
421
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
422
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
423
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
424
 
425
  $message = json_encode($message);
426
 
442
  return $errors;
443
  }
444
 
445
+ /**
446
+ * Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
447
+ * @param mixed[] $comment Comment string
448
+ * @return mixed[] $comment Comment string
449
+ */
450
+ function ct_bbp_get_topic($topic){
451
+ global $ct_bbp_topic;
452
+
453
+ $ct_bbp_topic=$topic;
454
+
455
+ return $topic;
456
+ }
457
+
458
  /**
459
  * Public filter 'bbp_*' - Checks topics, replies by cleantalk
460
  * @param mixed[] $comment Comment string
461
  * @return mixed[] $comment Comment string
462
  */
463
  function ct_bbp_new_pre_content ($comment) {
464
+ global $ct_options, $ct_data, $current_user, $ct_bbp_topic;
465
 
466
  $ct_options = ct_get_options();
467
  $ct_data = ct_get_data();
469
  if ($ct_options['comments_test'] == 0 ) {
470
  return $comment;
471
  }
472
+
473
+ // Skip processing for logged in users and admin.
474
+ if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in() ||
475
+ in_array("administrator", $current_user->roles))
476
  return $comment;
 
477
 
478
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
479
  if ($checkjs === null) {
493
  if ($post_info === false) {
494
  $post_info = '';
495
  }
496
+
497
+ if(isset($ct_bbp_topic))
498
+ $message = $ct_bbp_topic." ".$comment;
499
+ else
500
+ $message = $comment;
501
+
502
  $ct_base_call_result = ct_base_call(array(
503
  'message' => $comment,
504
  'example' => $example,
511
  $ct = $ct_base_call_result['ct'];
512
  $ct_result = $ct_base_call_result['ct_result'];
513
 
514
+ if ($ct_result->stop_queue == 1 || $ct_result->spam == 1 || $ct_result->allow == 0) {
515
  bbp_add_error('bbp_reply_content', $ct_result->comment);
516
  }
517
 
531
 
532
  $ct_options = ct_get_options();
533
  $ct_data = ct_get_data();
534
+
535
+ // Skip processing admin.
536
+ if (in_array("administrator", $current_user->roles))
537
+ return $comment;
538
 
539
  if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
540
  {
1552
  if ($post_info === false)
1553
  $post_info = '';
1554
 
1555
+ //getting info from custom fields
1556
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
1557
+
1558
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
1559
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
1560
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
1561
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
1562
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
1563
+
1564
+ //setting fields if they with defaults names
1565
  if ($subject != '') {
1566
  $message = array_merge(array('subject' => $subject), $message);
1567
  }
1730
  if ($post_info === false)
1731
  $post_info = '';
1732
 
1733
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
1734
+
1735
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
1736
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
1737
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
1738
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
1739
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
1740
+
1741
  if ($subject != '') {
1742
  $message = array_merge(array('subject' => $subject), $message);
1743
  }
1877
  (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
1878
  (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
1879
  (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
 
1880
  strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false ||
1881
  strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false||
1882
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1893
  isset($_POST['fscf_submitted']) ||
1894
  strpos($_SERVER['REQUEST_URI'],'/wc-api/')!==false ||
1895
  isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
1896
+ isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) ||// Formidable forms
1897
+ isset($_POST['comment_post_ID']) || // The comment form
1898
+ isset($_GET['for']) ||
1899
+ (isset($_POST['log']) && isset($_POST['pwd'])) || //WooCommerce Sensei login form fix
1900
+ (isset($_POST['_wpcf7']) && isset($_POST['_wpcf7_version']) && isset($_POST['_wpcf7_locale'])) //CF7 fix)
1901
+ ) {
1902
  return null;
1903
  }
1904
  // Do not execute anti-spam test for logged in users.
1905
  if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $ct_options['protect_logged_in'] != 1) {
1906
  return null;
1907
  }
1908
+
1909
+ //Skip the test if the checkout setting is unset && and it's not WooCommerce
1910
+ if($ct_options['wc_checkout_test'] == 0 && strpos($_SERVER['REQUEST_URI'],'wc-ajax=checkout') && strpos($_POST['_wp_http_referer'],'wc-ajax=update_order_review'))
1911
+ return null;
1912
+
1913
  //@header("CtConditions: Passed");
1914
  cleantalk_debug("CtConditions", "Passed");
1915
 
1925
  $post_info = '';
1926
  }
1927
 
1928
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
1929
+
1930
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
1931
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
1932
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
1933
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
1934
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
1935
 
1936
  if ($subject != '') {
1937
  $message = array_merge(array('subject' => $subject), $message);
2034
  echo $response;
2035
  die();
2036
  }
2037
+ //WooCommerce checkout ("Place Oreder button")
2038
+ elseif(strpos($_POST['_wp_http_referer'],'wc-ajax=update_order_review'))
2039
+ {
2040
+ $result = Array(
2041
+ result => 'failure',
2042
+ messages => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
2043
+ refresh => 'false',
2044
+ reload => 'false'
2045
+ );
2046
+ print json_encode($result);
2047
+ die();
2048
+ }
2049
  else
2050
  {
2051
  ct_die(null, null);
2122
  $post_info = '';
2123
  }
2124
 
2125
+ $message = ct_get_fields_any_postdata($_POST);
2126
+
2127
  $message = json_encode($message);
2128
 
2129
  if(strlen(trim($message))<10)
inc/cleantalk.class.php CHANGED
@@ -475,7 +475,7 @@ class Cleantalk {
475
  * @return type
476
  */
477
  public function isAllowMessage(CleantalkRequest $request) {
478
- $this->filterRequest($request);
479
  $msg = $this->createMsg('check_message', $request);
480
  return $this->httpRequest($msg);
481
  }
@@ -486,7 +486,7 @@ class Cleantalk {
486
  * @return type
487
  */
488
  public function isAllowUser(CleantalkRequest $request) {
489
- $this->filterRequest($request);
490
  $msg = $this->createMsg('check_newuser', $request);
491
  return $this->httpRequest($msg);
492
  }
@@ -498,7 +498,7 @@ class Cleantalk {
498
  * @return type
499
  */
500
  public function sendFeedback(CleantalkRequest $request) {
501
- $this->filterRequest($request);
502
  $msg = $this->createMsg('send_feedback', $request);
503
  return $this->httpRequest($msg);
504
  }
@@ -508,7 +508,7 @@ class Cleantalk {
508
  * @param CleantalkRequest $request
509
  * @return type
510
  */
511
- private function filterRequest(CleantalkRequest &$request) {
512
  // general and optional
513
  foreach ($request as $param => $value) {
514
  if (in_array($param, array('message', 'example', 'agent',
@@ -548,6 +548,7 @@ class Cleantalk {
548
  }
549
  }
550
  }
 
551
  }
552
 
553
  /**
475
  * @return type
476
  */
477
  public function isAllowMessage(CleantalkRequest $request) {
478
+ $request = $this->filterRequest($request);
479
  $msg = $this->createMsg('check_message', $request);
480
  return $this->httpRequest($msg);
481
  }
486
  * @return type
487
  */
488
  public function isAllowUser(CleantalkRequest $request) {
489
+ $request = $this->filterRequest($request);
490
  $msg = $this->createMsg('check_newuser', $request);
491
  return $this->httpRequest($msg);
492
  }
498
  * @return type
499
  */
500
  public function sendFeedback(CleantalkRequest $request) {
501
+ $request = $this->filterRequest($request);
502
  $msg = $this->createMsg('send_feedback', $request);
503
  return $this->httpRequest($msg);
504
  }
508
  * @param CleantalkRequest $request
509
  * @return type
510
  */
511
+ private function filterRequest(CleantalkRequest $request) {
512
  // general and optional
513
  foreach ($request as $param => $value) {
514
  if (in_array($param, array('message', 'example', 'agent',
548
  }
549
  }
550
  }
551
+ return $request;
552
  }
553
 
554
  /**
readme.txt CHANGED
@@ -1,16 +1,16 @@
1
- === Spam Protection by CleanTalk (no Captcha AntiSpam) ===
2
  Contributors: znaeff, shagimuratov, serge00
3
- Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro
4
  Requires at least: 3.0
5
- Tested up to: 4.6
6
- Stable tag: 5.46
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Spam protection, antispam, all-in-one, premium plug-in. No comments spam & registrations spam, no email spam, protects any forms. Forget spam.
11
 
12
  == Description ==
13
- AntiSpam for WordPress. No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal AntiSpam plugin. Formerly "Anti-Spam by CleanTalk".
14
 
15
  = Anti-Spam features =
16
  1. Stops spam comments.
@@ -42,7 +42,7 @@ Supports native WordPress, JetPack comments and any other comment plugins. The p
42
  Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
43
 
44
  = Protection from contact form spam =
45
- The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms and any other themes/custom contact forms.
46
 
47
  = WooCommerce spam filter =
48
  Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
@@ -478,6 +478,20 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
478
  1. CleanTalk works faster than most of other anti-spam plugins.
479
 
480
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  = 5.46 August 17 2016 =
482
  * Fixed issue with admin bar links in WP Multi Network mode.
483
  * Added "All time counter" and "Daily counter" into admin bar.
@@ -1117,6 +1131,20 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
1117
  * First version
1118
 
1119
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1120
  = 5.46 August 17 2016 =
1121
  * Fixed issue with admin bar links in WP Multi Network mode.
1122
  * Added "All time counter" and "Daily counter" into admin bar.
1
+ === Spam Protection by CleanTalk (no Captcha Anti-Spam) ===
2
  Contributors: znaeff, shagimuratov, serge00
3
+ Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,PirateForms, BestWebSoft, WebDorado
4
  Requires at least: 3.0
5
+ Tested up to: 4.6.1
6
+ Stable tag: 5.47
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Spam protection, anti-spam, all-in-one, premium plug-in. No comments spam & registrations spam, no email spam, protects any forms. Forget spam.
11
 
12
  == Description ==
13
+ Anti-Spam for WordPress. No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal AntiSpam plugin. Formerly "Anti-Spam by CleanTalk".
14
 
15
  = Anti-Spam features =
16
  1. Stops spam comments.
42
  Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
43
 
44
  = Protection from contact form spam =
45
+ The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin - WPForms Lite and any other themes/custom contact forms.
46
 
47
  = WooCommerce spam filter =
48
  Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
478
  1. CleanTalk works faster than most of other anti-spam plugins.
479
 
480
  == Changelog ==
481
+ = 5.47 September 5 2016 =
482
+ * WooCommerce: direct integration for checkout form.
483
+ * WooCommerce Sensei: login form fix.
484
+ * bbPress: Added the check for topics and comments with stop_words
485
+ * bbPress: Skip check for admin in comments and topics
486
+ * UserPro: fixes. Request without field "shortcode"
487
+ * Contact Form 7: Bug fix.
488
+ * SpamFireWall: Optimized logs rotation.
489
+ * Updated inner functions (compatibility fix for PHP 5.4+)
490
+ * Fixed output of counters (without spamfirewall statistics)
491
+ * Fixed spelling in settings
492
+ * Added "Delete from the list" button in comments spam check page
493
+ * Minor fixes.
494
+
495
  = 5.46 August 17 2016 =
496
  * Fixed issue with admin bar links in WP Multi Network mode.
497
  * Added "All time counter" and "Daily counter" into admin bar.
1131
  * First version
1132
 
1133
  == Upgrade Notice ==
1134
+ = 5.47 September 5 2016 =
1135
+ * WooCommerce: direct integration for checkout form.
1136
+ * WooCommerce Sensei: login form fix.
1137
+ * bbPress: Added the check for topics and comments with stop_words
1138
+ * bbPress: Skip check for admin in comments and topics
1139
+ * UserPro: fixes. Request without field "shortcode"
1140
+ * Contact Form 7: Bug fix.
1141
+ * SpamFireWall: Optimized logs rotation.
1142
+ * Updated inner functions (compatibility fix for PHP 5.4+)
1143
+ * Fixed output of counters (without spamfirewall statistics)
1144
+ * Fixed spelling in settings
1145
+ * Added "Delete from the list" button in comments spam check page
1146
+ * Minor fixes.
1147
+
1148
  = 5.46 August 17 2016 =
1149
  * Fixed issue with admin bar links in WP Multi Network mode.
1150
  * Added "All time counter" and "Daily counter" into admin bar.