Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.77

Version Description

October 2 2017 = * Connection report's system. * Integration for CouponXXL Theme. * Fixed issue with mb_* functions. * Banners logic updated.

Download this release

Release Info

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

Code changes from version 5.76 to 5.77

assets/css/cleantalk-admin.css CHANGED
@@ -15,4 +15,8 @@
15
  float: none !important;
16
  margin: 0 2px;
17
  border: 0;
 
 
 
 
18
  }
15
  float: none !important;
16
  margin: 0 2px;
17
  border: 0;
18
+ }
19
+
20
+ #negative_reports_table tr td{
21
+ padding: 7px 5px !important;
22
  }
assets/js/cleantalk-admin-settings-page.js CHANGED
@@ -45,7 +45,16 @@ jQuery(document).ready(function(){
45
  jQuery('.form-table').first().show();
46
  }
47
  });
48
-
 
 
 
 
 
 
 
 
 
49
  ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
50
  ct_adv_settings.hide();
51
  ct_adv_settings_title=ct_adv_settings.prev();
45
  jQuery('.form-table').first().show();
46
  }
47
  });
48
+ jQuery('#cleantalk_negative_report_link').click(function(){
49
+ if(jQuery('.form-table').first().is(":visible")){
50
+ jQuery('.form-table').first().hide();
51
+ }else{
52
+ jQuery('.form-table').first().show();
53
+ jQuery('.form-table tr').eq(1).show();
54
+ jQuery('.form-table tr').eq(0).hide();
55
+
56
+ }
57
+ });
58
  ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
59
  ct_adv_settings.hide();
60
  ct_adv_settings_title=ct_adv_settings.prev();
assets/js/cleantalk-debug-ajax.js CHANGED
@@ -3,11 +3,15 @@ jQuery(document).ready(function(){
3
  console.log('CT debug');
4
 
5
  // Debug. Console all AJAX requests.
6
- jQuery(document).ajaxComplete(function(e, xhr, settings, data) {
7
- console.log("Success:")
8
- console.log(e);
 
 
9
  console.log(xhr);
 
10
  console.log(settings);
 
11
  console.log(data);
12
  });
13
 
3
  console.log('CT debug');
4
 
5
  // Debug. Console all AJAX requests.
6
+ jQuery(document).ajaxComplete(function(event, xhr, settings, data) {
7
+ console.log("Success!")
8
+ console.log('Event:\n');
9
+ console.log(event);
10
+ console.log('Response:\n');
11
  console.log(xhr);
12
+ console.log('Request settings:\n');
13
  console.log(settings);
14
+ console.log('Data:\n');
15
  console.log(data);
16
  });
17
 
cleantalk.php CHANGED
@@ -3,13 +3,13 @@
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. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.76
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
- $cleantalk_plugin_version='5.76';
12
- $ct_agent_version = 'wordpress-576';
13
  $cleantalk_executed=false;
14
 
15
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
@@ -44,6 +44,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
44
 
45
  //Delete cookie for admin trial notice
46
  add_action('wp_logout', 'ct_wp_logout');
 
 
47
 
48
  // Early checks
49
  // Facebook
@@ -373,6 +375,7 @@ if (!function_exists ( 'ct_activation')) {
373
  CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
374
  CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
375
  // CleantalkCron::addTask('send_daily_request', 'ct_send_daily_request', 86400); // Daily sends request to servers
 
376
 
377
  // Additional options
378
  add_option('ct_plugin_do_activation_redirect', true);
@@ -548,6 +551,53 @@ function ct_send_daily_request(){
548
  return true;
549
 
550
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  /*
552
  function myplugin_update_field( $new_value, $old_value ) {
553
  error_log('cleantalk_data dump: '. strlen(serialize($new_value)));
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. Formerly Anti-Spam by CleanTalk.
6
+ Version: 5.77
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
+ $cleantalk_plugin_version='5.77';
12
+ $ct_agent_version = 'wordpress-577';
13
  $cleantalk_executed=false;
14
 
15
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
44
 
45
  //Delete cookie for admin trial notice
46
  add_action('wp_logout', 'ct_wp_logout');
47
+
48
+ add_action('template_redirect','apbct_cookie', 1000);
49
 
50
  // Early checks
51
  // Facebook
375
  CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
376
  CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
377
  // CleantalkCron::addTask('send_daily_request', 'ct_send_daily_request', 86400); // Daily sends request to servers
378
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
379
 
380
  // Additional options
381
  add_option('ct_plugin_do_activation_redirect', true);
551
  return true;
552
 
553
  }
554
+
555
+ /*
556
+ * Set Cookies test for cookie test
557
+ */
558
+ function apbct_cookie(){
559
+
560
+ global $ct_options;
561
+ $ct_options=ct_get_options();
562
+
563
+ $apbct_timestamp = time();
564
+ setcookie('apbct_timestamp', $apbct_timestamp, 0, '/');
565
+ setcookie('apbct_cookies_test', md5($ct_options['apikey'].$apbct_timestamp), 0, '/');
566
+ }
567
+
568
+ /**
569
+ * Cookies test for sender
570
+ * Also checks for valid timestamp in $_COOKIE['apbct_timestamp']
571
+ * @return null|0|1;
572
+ */
573
+ function apbct_cookies_test()
574
+ {
575
+ global $ct_options;
576
+ $ct_options=ct_get_options();
577
+
578
+ if(isset($_COOKIE['apbct_cookies_test'], $_COOKIE['apbct_timestamp'])){
579
+ if($_COOKIE['apbct_cookies_test'] == md5($ct_options['apikey'].$_COOKIE['apbct_timestamp']))
580
+ return 1;
581
+ else
582
+ return 0;
583
+ }else
584
+ return null;
585
+ }
586
+
587
+ /**
588
+ * Gets submit time
589
+ * Uses Cookies with check via apbct_cookies_test()
590
+ * @return null|int;
591
+ */
592
+ function apbct_get_submit_time()
593
+ {
594
+ if(apbct_cookies_test() == 1){
595
+ return time() - $_COOKIE['apbct_timestamp'];
596
+ }else{
597
+ return null;
598
+ }
599
+ }
600
+
601
  /*
602
  function myplugin_update_field( $new_value, $old_value ) {
603
  error_log('cleantalk_data dump: '. strlen(serialize($new_value)));
inc/cleantalk-admin.php CHANGED
@@ -542,6 +542,8 @@ function ct_admin_init(){
542
  add_settings_field('cleantalk_apikey', '', 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
543
  }
544
 
 
 
545
  //Forms for protection
546
  add_settings_field('cleantalk_title_fiels_for_protect', "", 'ct_input_what_fields_should_be_protected', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
547
  add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
@@ -577,6 +579,7 @@ function ct_admin_init(){
577
 
578
 
579
  add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
 
580
  add_settings_field('cleantalk_show_link', __('Tell others about CleanTalk', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
581
  add_settings_field('cleantalk_spam_firewall', __('SpamFireWall', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
582
  }
@@ -690,7 +693,25 @@ function ct_input_sfw_counter() {
690
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_sfw_counter0' name='cleantalk_settings[sfw_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_sfw_counter0'> ".__('No')."</label>";
691
  ct_add_descriptions_to_fields(__('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'));
692
  }
 
 
 
 
 
693
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
  function ct_add_admin_menu( $wp_admin_bar ) {
695
  // add a parent item
696
  global $ct_options, $ct_data;
@@ -707,7 +728,9 @@ function ct_add_admin_menu( $wp_admin_bar ) {
707
  $ct_data['user_counter']['since'] = date('d M');
708
  update_option('cleantalk_data', $ct_data);
709
  }
710
-
 
 
711
  //Compile user's counter string
712
  $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']);
713
  //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>';
@@ -908,6 +931,84 @@ function ct_section_settings_autodel() {
908
  return true;
909
  }
910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  /**
912
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
913
  */
@@ -985,6 +1086,9 @@ function ct_input_apikey() {
985
  $cleantalk_support_links .= "&nbsp;&nbsp;";
986
  $cleantalk_support_links .= "<a href='edit-comments.php?page=ct_check_spam' class='ct_support_link'>" . __("Check comments for spam", 'cleantalk') . "</a>";
987
  $cleantalk_support_links .= "<a href='users.php?page=ct_check_users' class='ct_support_link'>" . __("Check users for spam", 'cleantalk') . "</a>";
 
 
 
988
  $cleantalk_support_links .= "</div>";
989
  echo "<script type=\"text/javascript\">var cleantalk_good_key=true; var cleantalk_support_links = \"$cleantalk_support_links\";</script>";
990
  }
542
  add_settings_field('cleantalk_apikey', '', 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
543
  }
544
 
545
+ add_settings_field('cleantalk_connection_reports', '', 'ct_report_builder', 'cleantalk', 'cleantalk_settings_main');
546
+
547
  //Forms for protection
548
  add_settings_field('cleantalk_title_fiels_for_protect', "", 'ct_input_what_fields_should_be_protected', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
549
  add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
579
 
580
 
581
  add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
582
+ add_settings_field('cleantalk_connection_reports', __('Send connection reports', 'cleantalk'), 'ct_send_connection_reports', 'cleantalk', 'cleantalk_settings_anti_spam');
583
  add_settings_field('cleantalk_show_link', __('Tell others about CleanTalk', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
584
  add_settings_field('cleantalk_spam_firewall', __('SpamFireWall', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
585
  }
693
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_sfw_counter0' name='cleantalk_settings[sfw_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_sfw_counter0'> ".__('No')."</label>";
694
  ct_add_descriptions_to_fields(__('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'));
695
  }
696
+ function ct_send_connection_reports() {
697
+ global $ct_options, $ct_data;
698
+
699
+ $ct_options = ct_get_options();
700
+ $ct_data = ct_get_data();
701
 
702
+ $value = $value=(isset($ct_options['send_connection_reports']) ? @intval($ct_options['send_connection_reports']) : 0);
703
+ echo "<div id='cleantalk_anchor3' style='display:none'></div><input type=hidden name='cleantalk_settings[send_connection_reports]' value='0' />";
704
+ echo "<input type='checkbox' id='connection_reports1' name='cleantalk_settings[send_connection_reports]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='connection_reports1'> " . __('Send connection reports', 'cleantalk') . "</label>";
705
+ ct_add_descriptions_to_fields(sprintf(__("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'), $ct_options['spam_firewall']));
706
+ echo "<script>
707
+ jQuery(document).ready(function(){
708
+ jQuery('#cleantalk_anchor3').parent().parent().children().first().hide();
709
+ jQuery('#cleantalk_anchor3').parent().css('padding-left','0px');
710
+ jQuery('#cleantalk_anchor3').parent().attr('colspan', '2');
711
+ });
712
+ </script>";
713
+
714
+ }
715
  function ct_add_admin_menu( $wp_admin_bar ) {
716
  // add a parent item
717
  global $ct_options, $ct_data;
728
  $ct_data['user_counter']['since'] = date('d M');
729
  update_option('cleantalk_data', $ct_data);
730
  }
731
+ if (!empty($_GET['ct_send_connection_report'])){
732
+ ct_mail_send_connection_report();
733
+ }
734
  //Compile user's counter string
735
  $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']);
736
  //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>';
931
  return true;
932
  }
933
 
934
+ function ct_report_builder() {
935
+
936
+ global $ct_options, $ct_data;
937
+
938
+ $ct_options=ct_get_options();
939
+ $ct_data=ct_get_data();
940
+
941
+ if (isset($ct_data['connection_reports'])){
942
+
943
+ if ($ct_data['connection_reports']['negative'] == 0){
944
+ echo "There are no failed connections to CleanTalk servers.";
945
+ }else{
946
+
947
+ echo "<table id='negative_reports_table'>
948
+ <tr>
949
+ <td>#</td>
950
+ <td><b>Date</b></td>
951
+ <td><b>Page URL</b></td>
952
+ <td><b>Report</b></td>
953
+ </tr>";
954
+ foreach($ct_data['connection_reports']['negative_report'] as $key => $report){
955
+ echo "<tr><td>".($key+1).".</td><td>".$report['date']."</td><td>".$report['page_url']."</td><td>".$report['lib_report']."</td></tr>";
956
+ }
957
+ echo "</table>";
958
+ echo "<br/><a class='cleantalk_manual_link' href='?page=cleantalk&ct_send_connection_report=1'>".__('Send report', 'cleantalk')."</a>";
959
+ }
960
+
961
+ }
962
+ echo "<script>
963
+ jQuery(document).ready(function(){
964
+ jQuery('.form-table tr').eq(1).children().first().hide();
965
+ });
966
+ </script>";
967
+ }
968
+
969
+ function ct_mail_send_connection_report() {
970
+ global $ct_options, $ct_data;
971
+
972
+ $ct_options = ct_get_options();
973
+ $ct_data=ct_get_data();
974
+ if ((isset($ct_options['send_connection_reports']) && @intval($ct_options['send_connection_reports']) == 1 && $ct_data['connection_reports']['negative']>0) || !empty($_GET['ct_send_connection_report']))
975
+ {
976
+ $to = "welcome@cleantalk.org" ;
977
+ $subject = "Connection report for ".$_SERVER['HTTP_HOST'];
978
+ $message = '
979
+ <html>
980
+ <head>
981
+ <title></title>
982
+ </head>
983
+ <body>
984
+ <p>From '.$ct_data['connection_reports']['since'].' to '.date('d M').' has been made '.($ct_data['connection_reports']['success']+$ct_data['connection_reports']['negative']).' calls, where '.$ct_data['connection_reports']['success'].' were success and '.$ct_data['connection_reports']['negative'].' were negative</p>
985
+ <p>Negative report:</p>
986
+ <table> <tr>
987
+ <td>&nbsp;</td>
988
+ <td><b>Date</b></td>
989
+ <td><b>Page URL</b></td>
990
+ <td><b>Library report</b></td>
991
+ </tr>
992
+ ';
993
+ foreach ($ct_data['connection_reports']['negative_report'] as $key=>$report)
994
+ {
995
+ $message.= "<tr><td>".($key+1).".</td><td>".$report['date']."</td><td>".$report['page_url']."</td><td>".$report['lib_report']."</td></tr>";
996
+ }
997
+ $message.='</table></body></html>';
998
+
999
+ $headers = "Content-type: text/html; charset=windows-1251 \r\n";
1000
+ $headers .= "From: ".get_option('admin_email');
1001
+ mail($to, $subject, $message, $headers);
1002
+ }
1003
+
1004
+ $ct_data['connection_reports']['success'] = 0;
1005
+ $ct_data['connection_reports']['negative'] = 0;
1006
+ $ct_data['connection_reports']['negative_report'] = array();
1007
+ $ct_data['connection_reports']['since'] = date('d M');
1008
+ update_option('cleantalk_data', $ct_data);
1009
+ CleantalkCron::updateTask('send_connection_report', 'ct_mail_send_connection_report', 3600);
1010
+
1011
+ }
1012
  /**
1013
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
1014
  */
1086
  $cleantalk_support_links .= "&nbsp;&nbsp;";
1087
  $cleantalk_support_links .= "<a href='edit-comments.php?page=ct_check_spam' class='ct_support_link'>" . __("Check comments for spam", 'cleantalk') . "</a>";
1088
  $cleantalk_support_links .= "<a href='users.php?page=ct_check_users' class='ct_support_link'>" . __("Check users for spam", 'cleantalk') . "</a>";
1089
+ $cleantalk_support_links .= "&nbsp;&nbsp;";
1090
+ $cleantalk_support_links .= "&nbsp;&nbsp;";
1091
+ $cleantalk_support_links .= "<a href='#' id='cleantalk_negative_report_link' class='ct_support_link'>" . __("Negative report", 'cleantalk') . "</a>";
1092
  $cleantalk_support_links .= "</div>";
1093
  echo "<script type=\"text/javascript\">var cleantalk_good_key=true; var cleantalk_support_links = \"$cleantalk_support_links\";</script>";
1094
  }
inc/cleantalk-ajax.php CHANGED
@@ -197,7 +197,14 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
197
  $ct_request->submit_time = $submit_time;
198
 
199
  $ct_result = $ct->isAllowUser($ct_request);
200
-
 
 
 
 
 
 
 
201
  if ($ct->server_change)
202
  {
203
  update_option(
@@ -283,7 +290,14 @@ function ct_user_register_ajaxlogin($user_id)
283
  $ct_request->submit_time = $submit_time;
284
 
285
  $ct_result = $ct->isAllowUser($ct_request);
286
-
 
 
 
 
 
 
 
287
  if ($ct->server_change)
288
  {
289
  update_option(
@@ -702,7 +716,14 @@ function ct_ajax_hook($message_obj = false, $additional = false)
702
  );
703
  print json_encode($result);
704
  die();
705
- }
 
 
 
 
 
 
 
706
  else
707
  {
708
  print $ct_result->comment;
197
  $ct_request->submit_time = $submit_time;
198
 
199
  $ct_result = $ct->isAllowUser($ct_request);
200
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
201
+ $ct_data['connection_reports']['success']++;
202
+ else
203
+ {
204
+ $ct_data['connection_reports']['negative']++;
205
+ $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
206
+ }
207
+ update_option('cleantalk_data', $ct_data);
208
  if ($ct->server_change)
209
  {
210
  update_option(
290
  $ct_request->submit_time = $submit_time;
291
 
292
  $ct_result = $ct->isAllowUser($ct_request);
293
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
294
+ $ct_data['connection_reports']['success']++;
295
+ else
296
+ {
297
+ $ct_data['connection_reports']['negative']++;
298
+ $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
299
+ }
300
+ update_option('cleantalk_data', $ct_data);
301
  if ($ct->server_change)
302
  {
303
  update_option(
716
  );
717
  print json_encode($result);
718
  die();
719
+ }
720
+ // CouponXXL Theme
721
+ elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
722
+ $result = array(
723
+ 'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
724
+ );
725
+ die(json_encode($result));
726
+ }
727
  else
728
  {
729
  print $ct_result->comment;
inc/cleantalk-comments.php CHANGED
@@ -396,7 +396,7 @@ function ct_ajax_check_comments(){
396
  $mark_spam_email = false;
397
 
398
  $check_result['checked']++;
399
- add_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
400
  $uip=$c[$i]->comment_author_IP;
401
  $uim=$c[$i]->comment_author_email;
402
 
@@ -408,7 +408,7 @@ function ct_ajax_check_comments(){
408
 
409
  if ($mark_spam_ip || $mark_spam_email){
410
  $check_result['spam']++;
411
- add_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
412
  }
413
  }
414
  print json_encode($check_result);
396
  $mark_spam_email = false;
397
 
398
  $check_result['checked']++;
399
+ update_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
400
  $uip=$c[$i]->comment_author_IP;
401
  $uim=$c[$i]->comment_author_email;
402
 
408
 
409
  if ($mark_spam_ip || $mark_spam_email){
410
  $check_result['spam']++;
411
+ update_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
412
  }
413
  }
414
  print json_encode($check_result);
inc/cleantalk-common.php CHANGED
@@ -138,21 +138,21 @@ function ct_init_session() {
138
  * 'post_info' - string
139
  * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
140
  */
141
- function ct_base_call($params = array()) {
142
  global $wpdb, $ct_agent_version, $ct_formtime_label, $ct_options, $ct_data;
143
-
144
  $ct_options=ct_get_options();
145
  $ct_data=ct_get_data();
146
 
147
  require_once('cleantalk.class.php');
148
 
149
- $submit_time = submit_time_test();
150
 
151
- $sender_info = get_sender_info();
152
  if (array_key_exists('sender_info', $params)) {
153
  $sender_info = array_merge($sender_info, (array) $params['sender_info']);
154
  }
155
-
156
  $sender_info['page_hits'] = (isset($_SESSION['ct_page_hits']) ? $_SESSION['ct_page_hits'] : 0);
157
 
158
  $sender_info = json_encode($sender_info);
@@ -171,27 +171,34 @@ function ct_base_call($params = array()) {
171
 
172
  $ct_request = new CleantalkRequest();
173
 
174
- $ct_request->auth_key = $ct_options['apikey'];
175
- $ct_request->message = $params['message'];
176
- $ct_request->example = $params['example'];
177
- $ct_request->sender_email = $params['sender_email'];
178
  $ct_request->sender_nickname = $params['sender_nickname'];
179
- // $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
180
- $ct_request->sender_ip = cleantalk_get_real_ip();
181
- $ct_request->agent = $ct_agent_version;
182
- $ct_request->sender_info = $sender_info;
183
- $ct_request->js_on = $params['checkjs'];
184
- $ct_request->submit_time = $submit_time;
185
- $ct_request->post_info = $params['post_info'];
186
  if(isset($ct_data['last_error_no']))
187
  {
188
- $ct_request->last_error_no=$ct_data['last_error_no'];
189
- $ct_request->last_error_time=$ct_data['last_error_time'];
190
- $ct_request->last_error_text=$ct_data['last_error_text'];
191
  }
192
 
193
 
194
  $ct_result = @$ct->isAllowMessage($ct_request);
 
 
 
 
 
 
 
195
  if ($ct->server_change) {
196
  update_option(
197
  'cleantalk_server', array(
@@ -239,9 +246,9 @@ function submit_time_test() {
239
  * Inner function - Default data array for senders
240
  * @return array
241
  */
242
- function get_sender_info() {
243
  global $ct_direct_post, $ct_options, $ct_data, $wp_rewrite, $ct_formtime_label;
244
-
245
  $ct_options = ct_get_options();
246
  $ct_data = ct_get_data();
247
 
@@ -280,12 +287,12 @@ function get_sender_info() {
280
  }
281
 
282
  return $sender_info = array(
283
- 'page_url' => htmlspecialchars(@$_SERVER['SERVER_NAME'].@$_SERVER['REQUEST_URI']),
284
  'cms_lang' => substr(get_locale(), 0, 2),
285
  'REFFERRER' => htmlspecialchars(@$_SERVER['HTTP_REFERER']),
286
  'USER_AGENT' => htmlspecialchars(@$_SERVER['HTTP_USER_AGENT']),
287
  'php_session' => $php_session,
288
- 'cookies_enabled' => ct_cookies_test(true),
289
  'direct_post' => $ct_direct_post,
290
  'checkjs_data_post' => $checkjs_data_post,
291
  'checkjs_data_cookies' => $checkjs_data_cookies,
@@ -493,6 +500,7 @@ function ct_def_options() {
493
  'notice_api_errors' => 0, // Send API error notices to WP admin
494
  'user_token'=>'', //user token for auto login into spam statistics
495
  'collect_details' => 0, // Collect details about browser of the visitor.
 
496
  'show_link' => 0
497
  );
498
  }
@@ -546,7 +554,13 @@ function ct_def_data() {
546
  'accepted' => 0,
547
  'blocked' => 0,
548
  'since' => date('d M')
549
- )
 
 
 
 
 
 
550
  );
551
  }
552
 
138
  * 'post_info' - string
139
  * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
140
  */
141
+ function ct_base_call($params = array(), $tmp = false) {
142
  global $wpdb, $ct_agent_version, $ct_formtime_label, $ct_options, $ct_data;
143
+
144
  $ct_options=ct_get_options();
145
  $ct_data=ct_get_data();
146
 
147
  require_once('cleantalk.class.php');
148
 
149
+ $submit_time = $tmp ? $params['submit_time'] : submit_time_test();
150
 
151
+ $sender_info = get_sender_info($tmp);
152
  if (array_key_exists('sender_info', $params)) {
153
  $sender_info = array_merge($sender_info, (array) $params['sender_info']);
154
  }
155
+
156
  $sender_info['page_hits'] = (isset($_SESSION['ct_page_hits']) ? $_SESSION['ct_page_hits'] : 0);
157
 
158
  $sender_info = json_encode($sender_info);
171
 
172
  $ct_request = new CleantalkRequest();
173
 
174
+ $ct_request->auth_key = $ct_options['apikey'];
175
+ $ct_request->message = $params['message'];
176
+ $ct_request->example = $params['example'];
177
+ $ct_request->sender_email = $params['sender_email'];
178
  $ct_request->sender_nickname = $params['sender_nickname'];
179
+ $ct_request->sender_ip = cleantalk_get_real_ip();
180
+ $ct_request->agent = $ct_agent_version;
181
+ $ct_request->sender_info = $sender_info;
182
+ $ct_request->js_on = $params['checkjs'];
183
+ $ct_request->submit_time = $submit_time;
184
+ $ct_request->post_info = $params['post_info'];
185
+
186
  if(isset($ct_data['last_error_no']))
187
  {
188
+ $ct_request->last_error_no = $ct_data['last_error_no'];
189
+ $ct_request->last_error_time = $ct_data['last_error_time'];
190
+ $ct_request->last_error_text = $ct_data['last_error_text'];
191
  }
192
 
193
 
194
  $ct_result = @$ct->isAllowMessage($ct_request);
195
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
196
+ $ct_data['connection_reports']['success']++;
197
+ else
198
+ {
199
+ $ct_data['connection_reports']['negative']++;
200
+ $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
201
+ }
202
  if ($ct->server_change) {
203
  update_option(
204
  'cleantalk_server', array(
246
  * Inner function - Default data array for senders
247
  * @return array
248
  */
249
+ function get_sender_info($tmp = false) {
250
  global $ct_direct_post, $ct_options, $ct_data, $wp_rewrite, $ct_formtime_label;
251
+
252
  $ct_options = ct_get_options();
253
  $ct_data = ct_get_data();
254
 
287
  }
288
 
289
  return $sender_info = array(
290
+ 'page_url' => htmlspecialchars(@$_SERVER['SERVER_NAME'].@$_SERVER['REQUEST_URI']),
291
  'cms_lang' => substr(get_locale(), 0, 2),
292
  'REFFERRER' => htmlspecialchars(@$_SERVER['HTTP_REFERER']),
293
  'USER_AGENT' => htmlspecialchars(@$_SERVER['HTTP_USER_AGENT']),
294
  'php_session' => $php_session,
295
+ 'cookies_enabled' => $tmp ? apbct_cookies_test() : ct_cookies_test(true),
296
  'direct_post' => $ct_direct_post,
297
  'checkjs_data_post' => $checkjs_data_post,
298
  'checkjs_data_cookies' => $checkjs_data_cookies,
500
  'notice_api_errors' => 0, // Send API error notices to WP admin
501
  'user_token'=>'', //user token for auto login into spam statistics
502
  'collect_details' => 0, // Collect details about browser of the visitor.
503
+ 'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
504
  'show_link' => 0
505
  );
506
  }
554
  'accepted' => 0,
555
  'blocked' => 0,
556
  'since' => date('d M')
557
+ ),
558
+ 'connection_reports' => array(
559
+ 'success' => 0,
560
+ 'negative' => 0,
561
+ 'negative_report' => array(),
562
+ 'since' => date('d M')
563
+ )
564
  );
565
  }
566
 
inc/cleantalk-public.php CHANGED
@@ -1549,7 +1549,14 @@ function ct_test_registration($nickname, $email, $ip){
1549
  $ct_request->submit_time = $submit_time;
1550
 
1551
  $ct_result = $ct->isAllowUser($ct_request);
1552
-
 
 
 
 
 
 
 
1553
  $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1554
 
1555
  ct_add_event($ct_result->allow);
@@ -1677,6 +1684,14 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1677
  $ct_request->submit_time = $submit_time;
1678
 
1679
  $ct_result = $ct->isAllowUser($ct_request);
 
 
 
 
 
 
 
 
1680
  if ($ct->server_change) {
1681
  update_option(
1682
  'cleantalk_server', array(
@@ -2015,13 +2030,14 @@ function ct_wpcf7_spam($param) {
2015
  }
2016
 
2017
  $ct_base_call_result = ct_base_call(array(
 
2018
  'message' => $message,
2019
  'example' => null,
2020
  'sender_email' => $sender_email,
2021
  'sender_nickname' => $sender_nickname,
2022
  'post_info' => $post_info,
2023
  'checkjs' => $checkjs
2024
- ));
2025
  $ct = $ct_base_call_result['ct'];
2026
  $ct_result = $ct_base_call_result['ct_result'];
2027
 
@@ -2378,6 +2394,14 @@ function ct_s2member_registration_test() {
2378
  $ct_request->submit_time = $submit_time;
2379
 
2380
  $ct_result = $ct->isAllowUser($ct_request);
 
 
 
 
 
 
 
 
2381
  if ($ct->server_change) {
2382
  update_option(
2383
  'cleantalk_server', array(
@@ -2642,7 +2666,7 @@ function ct_contact_form_validate() {
2642
  // Enfold Theme Contact Form. Using $contact_form
2643
  }elseif(!empty($contact_form) && $contact_form == 'enfold_theme_contact_form'){
2644
  echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
2645
- die();
2646
  }else{
2647
  ct_die(null, null);
2648
  }
1549
  $ct_request->submit_time = $submit_time;
1550
 
1551
  $ct_result = $ct->isAllowUser($ct_request);
1552
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
1553
+ $ct_data['connection_reports']['success']++;
1554
+ else
1555
+ {
1556
+ $ct_data['connection_reports']['negative']++;
1557
+ $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
1558
+ }
1559
+ update_option('cleantalk_data', $ct_data);
1560
  $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1561
 
1562
  ct_add_event($ct_result->allow);
1684
  $ct_request->submit_time = $submit_time;
1685
 
1686
  $ct_result = $ct->isAllowUser($ct_request);
1687
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
1688
+ $ct_data['connection_reports']['success']++;
1689
+ else
1690
+ {
1691
+ $ct_data['connection_reports']['negative']++;
1692
+ $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
1693
+ }
1694
+ update_option('cleantalk_data', $ct_data);
1695
  if ($ct->server_change) {
1696
  update_option(
1697
  'cleantalk_server', array(
2030
  }
2031
 
2032
  $ct_base_call_result = ct_base_call(array(
2033
+ 'submit_time' => apbct_get_submit_time(),
2034
  'message' => $message,
2035
  'example' => null,
2036
  'sender_email' => $sender_email,
2037
  'sender_nickname' => $sender_nickname,
2038
  'post_info' => $post_info,
2039
  'checkjs' => $checkjs
2040
+ ), true);
2041
  $ct = $ct_base_call_result['ct'];
2042
  $ct_result = $ct_base_call_result['ct_result'];
2043
 
2394
  $ct_request->submit_time = $submit_time;
2395
 
2396
  $ct_result = $ct->isAllowUser($ct_request);
2397
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
2398
+ $ct_data['connection_reports']['success']++;
2399
+ else
2400
+ {
2401
+ $ct_data['connection_reports']['negative']++;
2402
+ $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
2403
+ }
2404
+ update_option('cleantalk_data', $ct_data);
2405
  if ($ct->server_change) {
2406
  update_option(
2407
  'cleantalk_server', array(
2666
  // Enfold Theme Contact Form. Using $contact_form
2667
  }elseif(!empty($contact_form) && $contact_form == 'enfold_theme_contact_form'){
2668
  echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
2669
+ die();
2670
  }else{
2671
  ct_die(null, null);
2672
  }
inc/sfw_die_page.html CHANGED
@@ -56,7 +56,7 @@ function get_current_url() {
56
  </div>
57
  </div>
58
  <div class='footer'>
59
- <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
60
  </div>
61
  <script type='text/javascript'>
62
  document.getElementById('js_info').style.display = 'none';
56
  </div>
57
  </div>
58
  <div class='footer'>
59
+ <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
60
  </div>
61
  <script type='text/javascript'>
62
  document.getElementById('js_info').style.display = 'none';
lib/CleantalkSFW.php CHANGED
@@ -422,7 +422,7 @@ class CleantalkSFW
422
  $key_parts = explode('_', $server_key);
423
  if(count($key_parts) > 0 and strlen($server_key) > 2){
424
  foreach($key_parts as $part_index => $part){
425
- $key_parts[$part_index] = mb_strtolower($part);
426
  $key_parts[$part_index][0] = strtoupper($key_parts[$part_index][0]);
427
  }
428
  $server_key = implode('-', $key_parts);
422
  $key_parts = explode('_', $server_key);
423
  if(count($key_parts) > 0 and strlen($server_key) > 2){
424
  foreach($key_parts as $part_index => $part){
425
+ $key_parts[$part_index] = function_exists('mb_strtolower') ? mb_strtolower($part) : strtolower($part);
426
  $key_parts[$part_index][0] = strtoupper($key_parts[$part_index][0]);
427
  }
428
  $server_key = implode('-', $key_parts);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, sartemd174
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
- Stable tag: 5.76
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
@@ -506,6 +506,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
506
  1. The plugin deletes/removes the existing spam comments and users accounts.
507
 
508
  == Changelog ==
 
 
 
 
 
 
509
  = 5.76 September 20 2017 =
510
  * Fixed issue with SpamFireWall and caching plugins.
511
  * Banners logic updated.
@@ -1437,6 +1443,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1437
  * First version
1438
 
1439
  == Upgrade Notice ==
 
 
 
 
 
 
1440
  = 5.76 September 20 2017 =
1441
  * Fixed issue with SpamFireWall and caching plugins.
1442
  * Banners logic updated.
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
+ Stable tag: 5.77
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
506
  1. The plugin deletes/removes the existing spam comments and users accounts.
507
 
508
  == Changelog ==
509
+ = 5.77 October 2 2017 =
510
+ * Connection report's system.
511
+ * Integration for CouponXXL Theme.
512
+ * Fixed issue with mb_* functions.
513
+ * Banners logic updated.
514
+
515
  = 5.76 September 20 2017 =
516
  * Fixed issue with SpamFireWall and caching plugins.
517
  * Banners logic updated.
1443
  * First version
1444
 
1445
  == Upgrade Notice ==
1446
+ = 5.77 October 2 2017 =
1447
+ * Connection report's system.
1448
+ * Integration for CouponXXL Theme.
1449
+ * Fixed issue with mb_* functions.
1450
+ * Banners logic updated.
1451
+
1452
  = 5.76 September 20 2017 =
1453
  * Fixed issue with SpamFireWall and caching plugins.
1454
  * Banners logic updated.