Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.97

Version Description

June 7 2018 = * Fix: Update system. * Fix: Feedback from public page (admin only). * Fix: Users and comment check: API error. * Fix: Too many negative reports. (Too big ct_data option) * Fix: SpamFireWall: Infinite redirection on the blocking page. * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.96 to 5.97

cleantalk.php CHANGED
@@ -3,15 +3,15 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.96
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  $cleantalk_executed = false;
12
 
13
- define('APBCT_VERSION', '5.96');
14
- define('APBCT_AGENT', 'wordpress-596');
15
 
16
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
17
  define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt')
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.97
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  $cleantalk_executed = false;
12
 
13
+ define('APBCT_VERSION', '5.97');
14
+ define('APBCT_AGENT', 'wordpress-597');
15
 
16
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
17
  define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt')
inc/cleantalk-admin.php CHANGED
@@ -388,7 +388,7 @@ function apbct_admin_init(){
388
  if($current_version != APBCT_VERSION){
389
  if(is_main_site()){
390
  require_once('cleantalk-updater.php');
391
- $result = ct_run_update_actions($current_version, APBCT_VERSION);
392
  //If update is successfull
393
  if($result === true){
394
  ct_send_feedback(
@@ -1089,7 +1089,7 @@ function ct_input_apikey() {
1089
  echo "&nbsp;" . __("or") . "&nbsp;";
1090
  echo '<input id="get_key_auto" name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
1091
  }
1092
- echo '<input id="ct_admin_timezone" name="ct_admin_timezone" type="hidden" value="null" />';
1093
  echo "<br />";
1094
  echo "<br />";
1095
 
388
  if($current_version != APBCT_VERSION){
389
  if(is_main_site()){
390
  require_once('cleantalk-updater.php');
391
+ $result = apbct_run_update_actions($current_version, APBCT_VERSION);
392
  //If update is successfull
393
  if($result === true){
394
  ct_send_feedback(
1089
  echo "&nbsp;" . __("or") . "&nbsp;";
1090
  echo '<input id="get_key_auto" name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
1091
  }
1092
+ echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
1093
  echo "<br />";
1094
  echo "<br />";
1095
 
inc/cleantalk-common.php CHANGED
@@ -166,6 +166,10 @@ function apbct_base_call($params = array(), $reg_flag = false){
166
  {
167
  $ct_data['connection_reports']['negative']++;
168
  $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);
 
 
 
 
169
  }
170
  if ($ct->server_change) {
171
  update_option(
166
  {
167
  $ct_data['connection_reports']['negative']++;
168
  $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);
169
+
170
+ if(count($ct_data['connection_reports']['negative_report']) > 20)
171
+ $ct_data['connection_reports']['negative_report'] = array_slice($ct_data['connection_reports']['negative_report'], -20, 20);
172
+
173
  }
174
  if ($ct->server_change) {
175
  update_option(
inc/cleantalk-public.php CHANGED
@@ -99,8 +99,8 @@ function apbct_init() {
99
 
100
  // Fast Secure contact form
101
  if(defined('FSCF_VERSION')){
102
- add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
103
- add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
104
  }
105
 
106
  // WooCoomerse signups
99
 
100
  // Fast Secure contact form
101
  if(defined('FSCF_VERSION')){
102
+ add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
103
+ add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
104
  }
105
 
106
  // WooCoomerse signups
inc/cleantalk-updater.php CHANGED
@@ -1,68 +1,30 @@
1
  <?php
2
 
3
- function ct_run_update_actions($current_version, $new_version){
4
-
5
- global $ct_data, $wpdb;
6
-
7
- $current_version = ct_version_standartization($current_version);
8
- $new_version = ct_version_standartization($new_version);
9
-
10
- //Update actions
11
- if($current_version[0] <= 5){
12
- if($current_version[1] <= 49){
13
- if($current_version[2] <= 1){
14
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
15
- `network` int(11) unsigned NOT NULL,
16
- `mask` int(11) unsigned NOT NULL,
17
- INDEX ( `network` , `mask` )
18
- ) ENGINE = MYISAM ;");
19
-
20
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs` (
21
- `ip` VARCHAR(15) NOT NULL ,
22
- `all` INT NOT NULL ,
23
- `blocked` INT NOT NULL ,
24
- `timestamp` INT NOT NULL ,
25
- PRIMARY KEY (`ip`))
26
- ENGINE = MYISAM;");
27
- }
28
- }
29
- if($current_version[1] <= 55){
30
- if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
31
- wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
32
- }
33
- if($current_version[1] <= 69){
34
-
35
- if(!in_array('all_entries', $wpdb->get_col("DESC " . $wpdb->base_prefix."cleantalk_sfw_logs", 0))){
36
- $wpdb->query("ALTER TABLE `".$wpdb->base_prefix."cleantalk_sfw_logs`
37
- CHANGE `all` `all_entries` INT(11) NOT NULL,
38
- CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
39
- CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;"
40
- );
41
  }
42
-
43
- // Deleting usless data
44
- unset($ct_data['db_refreshed'], $ct_data['last_sfw_send'], $ct_data['next_account_status_check']);
45
- update_option('cleantalk_data', $ct_data);
46
- delete_option('cleantalk_sends_reports_till');
47
- delete_option('cleantalk_activation_timestamp');
48
-
49
- // Disabling WP_Cron tasks
50
- wp_clear_scheduled_hook('cleantalk_send_daily_report_hook');
51
- wp_clear_scheduled_hook('ct_hourly_event_hook');
52
- wp_clear_scheduled_hook('ct_send_sfw_log');
53
- wp_clear_scheduled_hook('cleantalk_update_sfw_hook');
54
- wp_clear_scheduled_hook('cleantalk_get_brief_data_hook');
55
-
56
- // Adding Self cron system tasks
57
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // New
58
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500);
59
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500);
60
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);
61
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // New
62
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500);
63
- }
64
- if($current_version[1] <= 73){
65
- CleantalkCron::removeTask('send_daily_request');
66
  }
67
  }
68
 
@@ -70,7 +32,7 @@ function ct_run_update_actions($current_version, $new_version){
70
 
71
  }
72
 
73
- function ct_version_standartization($version){
74
 
75
  $version = explode('.', $version);
76
  $version = !empty($version) ? $version : array();
@@ -82,4 +44,72 @@ function ct_version_standartization($version){
82
  return $version;
83
  }
84
 
85
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ function apbct_run_update_actions($current_version, $new_version){
4
+
5
+ $current_version = apbct_version_standartization($current_version);
6
+ $new_version = apbct_version_standartization($new_version);
7
+
8
+ $current_version_str = implode('.', $current_version);
9
+ $new_version_str = implode('.', $new_version);
10
+
11
+ for($ver_major = $current_version[0]; $ver_major <= $new_version[0]; $ver_major++){
12
+ for($ver_minor = 0; $ver_minor <= 200; $ver_minor++){
13
+ for($ver_fix = 0; $ver_fix <= 10; $ver_fix++){
14
+
15
+ if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $current_version_str, '<='))
16
+ continue;
17
+
18
+ if(function_exists("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}")){
19
+ $result = call_user_func("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}");
20
+ if(!empty($result['error']))
21
+ break;
22
+ }
23
+
24
+ if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $new_version_str, '>='))
25
+ break(2);
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
  }
30
 
32
 
33
  }
34
 
35
+ function apbct_version_standartization($version){
36
 
37
  $version = explode('.', $version);
38
  $version = !empty($version) ? $version : array();
44
  return $version;
45
  }
46
 
47
+ function apbct_update_to_5_50_0(){
48
+ global $wpdb;
49
+ $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
50
+ `network` int(11) unsigned NOT NULL,
51
+ `mask` int(11) unsigned NOT NULL,
52
+ INDEX ( `network` , `mask` )
53
+ ) ENGINE = MYISAM ;");
54
+
55
+ $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs` (
56
+ `ip` VARCHAR(15) NOT NULL ,
57
+ `all` INT NOT NULL ,
58
+ `blocked` INT NOT NULL ,
59
+ `timestamp` INT NOT NULL ,
60
+ PRIMARY KEY (`ip`))
61
+ ENGINE = MYISAM;");
62
+ }
63
+
64
+ function apbct_update_to_5_56_0(){
65
+ if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
66
+ wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
67
+ }
68
+ function apbct_update_to_5_70_0(){
69
+
70
+ global $wpdb;
71
+
72
+ if(!in_array('all_entries', $wpdb->get_col("DESC " . $wpdb->base_prefix."cleantalk_sfw_logs", 0))){
73
+ $wpdb->query("ALTER TABLE `".$wpdb->base_prefix."cleantalk_sfw_logs`
74
+ CHANGE `all` `all_entries` INT(11) NOT NULL,
75
+ CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
76
+ CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;"
77
+ );
78
+ }
79
+
80
+ // Deleting usless data
81
+ unset($ct_data['db_refreshed'], $ct_data['last_sfw_send'], $ct_data['next_account_status_check']);
82
+ update_option('cleantalk_data', $ct_data);
83
+ delete_option('cleantalk_sends_reports_till');
84
+ delete_option('cleantalk_activation_timestamp');
85
+
86
+ // Disabling WP_Cron tasks
87
+ wp_clear_scheduled_hook('cleantalk_send_daily_report_hook');
88
+ wp_clear_scheduled_hook('ct_hourly_event_hook');
89
+ wp_clear_scheduled_hook('ct_send_sfw_log');
90
+ wp_clear_scheduled_hook('cleantalk_update_sfw_hook');
91
+ wp_clear_scheduled_hook('cleantalk_get_brief_data_hook');
92
+
93
+ // Adding Self cron system tasks
94
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // New
95
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500);
96
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500);
97
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);
98
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // New
99
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500);
100
+ }
101
+ function apbct_update_to_5_74_0(){
102
+ CleantalkCron::removeTask('send_daily_request');
103
+ }
104
+
105
+ function apbct_update_to_5_97_0(){
106
+
107
+ global $ct_data;
108
+
109
+ $ct_data = ct_get_data();
110
+
111
+ if(count($ct_data['connection_reports']['negative_report']) >= 20)
112
+ $ct_data['connection_reports']['negative_report'] = array_slice($ct_data['connection_reports']['negative_report'], -20, 20);
113
+
114
+ update_option('cleantalk_data', $ct_data);
115
+ }
inc/sfw_die_page.html CHANGED
@@ -67,7 +67,7 @@ function get_current_url() {
67
  }, 50);
68
  setTimeout(function(){
69
  var ct_date = new Date;
70
- window.location.href=window.location.href + (window.location.search === '' ? '?sfw=pass' : '&sfw=pass') + Math.round(ct_date.getTime()/1000);
71
  }, reload_timeout);
72
  </script>
73
  </body>
67
  }, 50);
68
  setTimeout(function(){
69
  var ct_date = new Date;
70
+ window.location.href=window.location.origin + window.location.pathname + (window.location.search === '' ? '?sfw=pass' : '&sfw=pass') + Math.round(ct_date.getTime()/1000);
71
  }, reload_timeout);
72
  </script>
73
  </body>
js/cleantalk-comments-checkspam.js CHANGED
@@ -20,9 +20,9 @@ var ct_working = false,
20
  ct_prev_from = ctCommentsCheck.ct_prev_from,
21
  ct_prev_till = ctCommentsCheck.ct_prev_till;
22
  // Settings
23
- var ct_cool_down_time = 65000,
24
  ct_requests_counter = 0,
25
- ct_max_requests = 80;
26
  // Variables
27
  var ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,
28
  ct_comments_total = 0,
20
  ct_prev_from = ctCommentsCheck.ct_prev_from,
21
  ct_prev_till = ctCommentsCheck.ct_prev_till;
22
  // Settings
23
+ var ct_cool_down_time = 90000,
24
  ct_requests_counter = 0,
25
+ ct_max_requests = 60;
26
  // Variables
27
  var ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,
28
  ct_comments_total = 0,
js/cleantalk-public-admin.js CHANGED
@@ -38,7 +38,7 @@ jQuery(document).ready(function(){
38
 
39
  var data = {
40
  'action': 'ct_feedback_comment',
41
- 'security': ctPublic.ct_ajax_nonce,
42
  'comment_id': ct_current_button.attr('commentid'),
43
  'comment_status': ct_comment_status,
44
  'change_status': 1
@@ -82,7 +82,9 @@ jQuery(document).ready(function(){
82
  ct_feedback_wrap.data('interval_id', ct_timeout_id);
83
  },
84
  error: function(jqXHR, textStatus, errorThrown) {
85
-
 
 
86
  },
87
  timeout: 5000
88
  });
38
 
39
  var data = {
40
  'action': 'ct_feedback_comment',
41
+ 'security': ctPublicAdmin.ct_ajax_nonce,
42
  'comment_id': ct_current_button.attr('commentid'),
43
  'comment_status': ct_comment_status,
44
  'change_status': 1
82
  ct_feedback_wrap.data('interval_id', ct_timeout_id);
83
  },
84
  error: function(jqXHR, textStatus, errorThrown) {
85
+ console.log(jqXHR);
86
+ console.log(textStatus);
87
+ console.log(errorThrown);
88
  },
89
  timeout: 5000
90
  });
js/cleantalk-users-checkspam.js CHANGED
@@ -20,9 +20,9 @@ var ct_working = false,
20
  ct_prev_from = ctUsersCheck.ct_prev_from,
21
  ct_prev_till = ctUsersCheck.ct_prev_till;
22
  // Settings
23
- var ct_cool_down_time = 65000,
24
  ct_requests_counter = 0,
25
- ct_max_requests = 95;
26
  // Variables
27
  var ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,
28
  ct_users_total = 0,
20
  ct_prev_from = ctUsersCheck.ct_prev_from,
21
  ct_prev_till = ctUsersCheck.ct_prev_till;
22
  // Settings
23
+ var ct_cool_down_time = 90000,
24
  ct_requests_counter = 0,
25
+ ct_max_requests = 60;
26
  // Variables
27
  var ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,
28
  ct_users_total = 0,
lib/CleantalkHelper.php CHANGED
@@ -209,16 +209,18 @@ class CleantalkHelper
209
  * @param string website platform
210
  * @return type
211
  */
212
- static public function api_method__get_api_key($email, $host, $platform, $timezone = null, $do_check = true)
213
  {
214
  $request = array(
215
- 'method_name' => 'get_api_key',
216
- 'agent' => APBCT_AGENT,
217
- 'email' => $email,
218
- 'website' => $host,
219
- 'platform' => $platform,
220
- 'timezone' => $timezone,
221
- 'product_name' => 'antispam',
 
 
222
  );
223
 
224
  $result = self::api_send_request($request);
209
  * @param string website platform
210
  * @return type
211
  */
212
+ static public function api_method__get_api_key($email, $host, $platform, $timezone = null, $language = null, $ip = null, $do_check = true)
213
  {
214
  $request = array(
215
+ 'method_name' => 'get_api_key',
216
+ 'product_name' => 'antispam',
217
+ 'agent' => APBCT_AGENT,
218
+ 'email' => $email,
219
+ 'website' => $host,
220
+ 'platform' => $platform,
221
+ 'timezone' => $timezone,
222
+ 'http_accept_language' => !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null,
223
+ 'user_ip' => $ip ? $ip : self::ip_get(array('real'), false),
224
  );
225
 
226
  $result = self::api_send_request($request);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
- Stable tag: 5.96
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -516,6 +516,14 @@ Yes, it is. Please read this article,
516
  10. Website's options.
517
 
518
  == Changelog ==
 
 
 
 
 
 
 
 
519
  = 5.96 May 22 2018 =
520
  * Fix: Update system.
521
  * Mod: Reset all counters button in admin bar.
@@ -1593,6 +1601,14 @@ Yes, it is. Please read this article,
1593
  * First version
1594
 
1595
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
1596
  = 5.96 May 22 2018 =
1597
  * Fix: Update system.
1598
  * Mod: Reset all counters button in admin bar.
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
+ Stable tag: 5.97
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
516
  10. Website's options.
517
 
518
  == Changelog ==
519
+ = 5.97 June 7 2018 =
520
+ * Fix: Update system.
521
+ * Fix: Feedback from public page (admin only).
522
+ * Fix: Users and comment check: API error.
523
+ * Fix: Too many negative reports. (Too big ct_data option)
524
+ * Fix: SpamFireWall: Infinite redirection on the blocking page.
525
+ * Minor fixes.
526
+
527
  = 5.96 May 22 2018 =
528
  * Fix: Update system.
529
  * Mod: Reset all counters button in admin bar.
1601
  * First version
1602
 
1603
  == Upgrade Notice ==
1604
+ = 5.97 June 7 2018 =
1605
+ * Fix: Update system.
1606
+ * Fix: Feedback from public page (admin only).
1607
+ * Fix: Users and comment check: API error.
1608
+ * Fix: Too many negative reports. (Too big ct_data option)
1609
+ * Fix: SpamFireWall: Infinite redirection on the blocking page.
1610
+ * Minor fixes.
1611
+
1612
  = 5.96 May 22 2018 =
1613
  * Fix: Update system.
1614
  * Mod: Reset all counters button in admin bar.