Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.74

Version Description

August 31 2017 = * Users and comments spam check: Two check types (fast and accurate). * Fix for WooCommerce checkout test. * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.73 to 5.74

assets/css/cleantalk-public.css CHANGED
@@ -5,23 +5,23 @@
5
  .ct_comment_info{
6
  position: relative;
7
  top: 10px;
8
- padding: 2px 1% 2px 1%;
9
- margin-bottom: 20px;
10
- border: 1px solid gray !important;
11
- border-radius: 8px;
12
  font-size: 11px;
13
  line-height: 17px;
14
  }
15
  .ct_comment_info_title{
16
  position: absolute;
17
- top: -10px; left: 15px;
18
  margin: 0; padding: 0 5px;
19
  background: inherit;
20
  line-height: 12px;
21
  }
22
  p.ct_comment_logo_title{
23
  position: absolute;
24
- bottom: -12px; right: 10px;
25
  margin: 0; padding: 0 7px;
26
  background: inherit;
27
  line-height: 12px;
@@ -34,7 +34,7 @@
34
  }
35
 
36
  .ct_this_is{
37
- padding: 0px 2px;
38
  cursor: pointer;
39
  white-space: nowrap;
40
  color: black !important;
@@ -48,8 +48,8 @@
48
  p.ct_feedback_wrap{
49
  display: none;
50
  position: absolute;
51
- top: 0px; left: 1%;
52
- width: 98%;
53
  background: white;
54
  padding: 2px 6px;
55
  border-radius: 3px;
5
  .ct_comment_info{
6
  position: relative;
7
  top: 10px;
8
+ left: -30px;
9
+ padding-top: 10px;
10
+ margin: 15px 0 15px 0;
11
+ border-top: 1px solid gray !important;
12
  font-size: 11px;
13
  line-height: 17px;
14
  }
15
  .ct_comment_info_title{
16
  position: absolute;
17
+ top: -7px; left: 15px;
18
  margin: 0; padding: 0 5px;
19
  background: inherit;
20
  line-height: 12px;
21
  }
22
  p.ct_comment_logo_title{
23
  position: absolute;
24
+ top: -7px; right: 10px;
25
  margin: 0; padding: 0 7px;
26
  background: inherit;
27
  line-height: 12px;
34
  }
35
 
36
  .ct_this_is{
37
+ padding: 2px 3px;
38
  cursor: pointer;
39
  white-space: nowrap;
40
  color: black !important;
48
  p.ct_feedback_wrap{
49
  display: none;
50
  position: absolute;
51
+ top: 5px; left: 0px;
52
+ height: 100%;
53
  background: white;
54
  padding: 2px 6px;
55
  border-radius: 3px;
assets/js/cleantalk-comments-checkspam.js CHANGED
@@ -17,14 +17,15 @@ var ct_working = false,
17
  // Settings
18
  var ct_cool_down_time = 65000,
19
  ct_requests_counter = 0,
20
- ct_max_requests = 95;
21
  // Variables
22
  var ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,
23
  ct_comments_total = 0,
24
  ct_comments_checked = 0,
25
  ct_comments_spam = 0,
26
  ct_comments_bad = 0,
27
- ct_unchecked = 'unset';
 
28
 
29
  function animate_comment(to,id){
30
  if(ct_close_animate){
@@ -87,6 +88,9 @@ function ct_send_comments(){
87
  'unchecked': ct_unchecked
88
  };
89
 
 
 
 
90
  jQuery.ajax({
91
  type: "POST",
92
  url: ajaxurl,
@@ -146,6 +150,7 @@ function ct_show_info(){
146
  setTimeout(ct_show_info, 3000);
147
 
148
  if(!ct_comments_total){
 
149
  var data = {
150
  'action': 'ajax_info_comments',
151
  'security': ct_ajax_nonce
@@ -170,18 +175,25 @@ function ct_show_info(){
170
  }
171
  }
172
  }
173
- function ct_insert_comments(){
 
174
  var data = {
175
  'action': 'ajax_insert_comments',
176
  'security': ct_ajax_nonce
177
  };
178
 
 
 
 
179
  jQuery.ajax({
180
  type: "POST",
181
  url: ajaxurl,
182
  data: data,
183
  success: function(msg){
184
- alert(ctCommentsCheck.ct_comments_added + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);
 
 
 
185
  }
186
  });
187
  }
@@ -246,8 +258,17 @@ function ct_delete_checked(){
246
 
247
  jQuery(document).ready(function(){
248
 
 
 
 
 
 
 
 
249
  jQuery("#ct_check_spam_button").click(function(){
250
- jQuery('#ct_check_spam_button').hide();
 
 
251
  jQuery('#ct_info_message').hide();
252
  jQuery('#ct_check_comments_table').hide();
253
  jQuery('#ct_delete_all').hide();
@@ -264,10 +285,17 @@ jQuery(document).ready(function(){
264
  jQuery("#ct_insert_comments").click(function(){
265
  ct_insert_comments();
266
  });
 
 
 
 
 
267
  jQuery("#ct_delete_all").click(function(){
 
268
  if (!confirm(ctCommentsCheck.ct_confirm_deletion_all))
269
  return false;
270
-
 
271
  jQuery('#ct_checking_status').hide();
272
  jQuery('#ct_tools_buttons').hide();
273
  jQuery('#ct_search_info').hide();
17
  // Settings
18
  var ct_cool_down_time = 65000,
19
  ct_requests_counter = 0,
20
+ ct_max_requests = 80;
21
  // Variables
22
  var ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,
23
  ct_comments_total = 0,
24
  ct_comments_checked = 0,
25
  ct_comments_spam = 0,
26
  ct_comments_bad = 0,
27
+ ct_unchecked = 'unset',
28
+ ct_accurate_check = false;
29
 
30
  function animate_comment(to,id){
31
  if(ct_close_animate){
88
  'unchecked': ct_unchecked
89
  };
90
 
91
+ if(ct_accurate_check)
92
+ data['accurate_check'] = true;
93
+
94
  jQuery.ajax({
95
  type: "POST",
96
  url: ajaxurl,
150
  setTimeout(ct_show_info, 3000);
151
 
152
  if(!ct_comments_total){
153
+
154
  var data = {
155
  'action': 'ajax_info_comments',
156
  'security': ct_ajax_nonce
175
  }
176
  }
177
  }
178
+ function ct_insert_comments(delete_comments = false){
179
+
180
  var data = {
181
  'action': 'ajax_insert_comments',
182
  'security': ct_ajax_nonce
183
  };
184
 
185
+ if(delete_comments)
186
+ data['delete'] = true;
187
+
188
  jQuery.ajax({
189
  type: "POST",
190
  url: ajaxurl,
191
  data: data,
192
  success: function(msg){
193
+ if(delete_comments)
194
+ alert(ctCommentsCheck.ct_comments_deleted + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);
195
+ else
196
+ alert(ctCommentsCheck.ct_comments_added + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);
197
  }
198
  });
199
  }
258
 
259
  jQuery(document).ready(function(){
260
 
261
+ jQuery("#ct_accurate_check").click(function(){
262
+ if(ct_accurate_check)
263
+ ct_accurate_check = false;
264
+ else
265
+ ct_accurate_check = true;
266
+ });
267
+
268
  jQuery("#ct_check_spam_button").click(function(){
269
+ // jQuery('#ct_check_spam_button').hide();
270
+
271
+ jQuery('#ct_check_button_table').hide();
272
  jQuery('#ct_info_message').hide();
273
  jQuery('#ct_check_comments_table').hide();
274
  jQuery('#ct_delete_all').hide();
285
  jQuery("#ct_insert_comments").click(function(){
286
  ct_insert_comments();
287
  });
288
+
289
+ jQuery("#ct_delete_comments").click(function(){
290
+ ct_insert_comments(true);
291
+ });
292
+
293
  jQuery("#ct_delete_all").click(function(){
294
+
295
  if (!confirm(ctCommentsCheck.ct_confirm_deletion_all))
296
  return false;
297
+
298
+ jQuery('#ct_check_button_table').hide();
299
  jQuery('#ct_checking_status').hide();
300
  jQuery('#ct_tools_buttons').hide();
301
  jQuery('#ct_search_info').hide();
assets/js/cleantalk-public.js CHANGED
@@ -16,6 +16,13 @@ jQuery(document).ready(function(){
16
  var ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');
17
  jQuery('.ct_comment_info').css('float', ct_post_float);
18
 
 
 
 
 
 
 
 
19
  // Handler for buttons
20
  jQuery('.ct_this_is').on('click', function(){
21
 
16
  var ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');
17
  jQuery('.ct_comment_info').css('float', ct_post_float);
18
 
19
+ var ct_posts = jQuery('.ct_comment_info');
20
+
21
+ jQuery(ct_posts).each(function(indx, elem){
22
+ curr_elem = jQuery(elem);
23
+ curr_elem.prev().before(curr_elem);
24
+ });
25
+
26
  // Handler for buttons
27
  jQuery('.ct_this_is').on('click', function(){
28
 
assets/js/cleantalk-users-checkspam.js CHANGED
@@ -24,7 +24,8 @@ var ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,
24
  ct_users_checked = 0,
25
  ct_users_spam = 0,
26
  ct_users_bad = 0,
27
- ct_unchecked = 'unset';
 
28
 
29
  function animate_comment(to,id){
30
  if(ct_close_animate){
@@ -87,6 +88,9 @@ function ct_send_users(){
87
  'unchecked': ct_unchecked
88
  };
89
 
 
 
 
90
  jQuery.ajax({
91
  type: "POST",
92
  url: ajaxurl,
@@ -170,19 +174,25 @@ function ct_show_users_info(){
170
  }
171
  }
172
  }
173
- function ct_insert_users(){
174
 
175
  var data = {
176
  'action': 'ajax_insert_users',
177
  'security': ct_ajax_nonce
178
  };
179
 
 
 
 
180
  jQuery.ajax({
181
  type: "POST",
182
  url: ajaxurl,
183
  data: data,
184
  success: function(msg){
185
- alert(ctUsersCheck.ct_inserted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);
 
 
 
186
  }
187
  });
188
  }
@@ -278,13 +288,21 @@ jQuery(document).ready(function(){
278
  id = jQuery(this).attr("data-id");
279
  animate_comment(0.3, id);
280
  });
281
-
 
 
 
 
 
 
 
282
  // Check users
283
  jQuery("#ct_check_users_button").click(function(){
284
- // jQuery('#ct_checking_users_status').html('');
 
 
285
  jQuery('#ct_delete_checked_users').hide();
286
  jQuery('#ct_check_users_table').hide();
287
- jQuery('#ct_check_users_button').hide();
288
  jQuery('#ct_delete_all_users').hide();
289
  jQuery('#ct_get_csv_file').hide();
290
  jQuery('div.pagination').hide();
@@ -299,6 +317,10 @@ jQuery(document).ready(function(){
299
  jQuery("#ct_insert_users").click(function(){
300
  ct_insert_users();
301
  });
 
 
 
 
302
 
303
  jQuery("#ct_stop_deletion").click(function(){
304
  //window.location.reload();
@@ -307,14 +329,17 @@ jQuery(document).ready(function(){
307
 
308
  // Delete all spam users
309
  jQuery("#ct_delete_all_users").click(function(){
 
310
  if (!confirm(ctUsersCheck.ct_confirm_deletion_all))
311
  return false;
312
- jQuery('#ct_checking_users_status').hide();
 
 
313
  jQuery('#ct_check_users_table').hide();
 
314
  jQuery('#ct_tools_buttons').hide();
315
  jQuery('#ct_info_message').hide();
316
  jQuery('#ct_ajax_info_users').hide();
317
- jQuery('#ct_check_users_button').hide();
318
  jQuery('#ct_search_info').hide();
319
  jQuery('div.pagination').hide();
320
  jQuery('#ct_deleting_message').show();
24
  ct_users_checked = 0,
25
  ct_users_spam = 0,
26
  ct_users_bad = 0,
27
+ ct_unchecked = 'unset',
28
+ ct_accurate_check = false;
29
 
30
  function animate_comment(to,id){
31
  if(ct_close_animate){
88
  'unchecked': ct_unchecked
89
  };
90
 
91
+ if(ct_accurate_check)
92
+ data['accurate_check'] = true;
93
+
94
  jQuery.ajax({
95
  type: "POST",
96
  url: ajaxurl,
174
  }
175
  }
176
  }
177
+ function ct_insert_users(delete_accounts = false){
178
 
179
  var data = {
180
  'action': 'ajax_insert_users',
181
  'security': ct_ajax_nonce
182
  };
183
 
184
+ if(delete_accounts)
185
+ data['delete'] = true;
186
+
187
  jQuery.ajax({
188
  type: "POST",
189
  url: ajaxurl,
190
  data: data,
191
  success: function(msg){
192
+ if(delete_accounts)
193
+ alert(ctUsersCheck.ct_deleted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);
194
+ else
195
+ alert(ctUsersCheck.ct_inserted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);
196
  }
197
  });
198
  }
288
  id = jQuery(this).attr("data-id");
289
  animate_comment(0.3, id);
290
  });
291
+
292
+ jQuery("#ct_accurate_check").click(function(){
293
+ if(ct_accurate_check)
294
+ ct_accurate_check = false;
295
+ else
296
+ ct_accurate_check = true;
297
+ });
298
+
299
  // Check users
300
  jQuery("#ct_check_users_button").click(function(){
301
+ // jQuery('#ct_checking_users_status').html('');
302
+ // jQuery('#ct_check_users_button').hide();
303
+ jQuery('#ct_check_button_table').hide();
304
  jQuery('#ct_delete_checked_users').hide();
305
  jQuery('#ct_check_users_table').hide();
 
306
  jQuery('#ct_delete_all_users').hide();
307
  jQuery('#ct_get_csv_file').hide();
308
  jQuery('div.pagination').hide();
317
  jQuery("#ct_insert_users").click(function(){
318
  ct_insert_users();
319
  });
320
+
321
+ jQuery("#ct_delete_users").click(function(){
322
+ ct_insert_users(true);
323
+ });
324
 
325
  jQuery("#ct_stop_deletion").click(function(){
326
  //window.location.reload();
329
 
330
  // Delete all spam users
331
  jQuery("#ct_delete_all_users").click(function(){
332
+
333
  if (!confirm(ctUsersCheck.ct_confirm_deletion_all))
334
  return false;
335
+
336
+ // jQuery('#ct_check_users_button').hide();
337
+ jQuery('#ct_check_button_table').hide();
338
  jQuery('#ct_check_users_table').hide();
339
+ jQuery('#ct_checking_users_status').hide();
340
  jQuery('#ct_tools_buttons').hide();
341
  jQuery('#ct_info_message').hide();
342
  jQuery('#ct_ajax_info_users').hide();
 
343
  jQuery('#ct_search_info').hide();
344
  jQuery('div.pagination').hide();
345
  jQuery('#ct_deleting_message').show();
cleantalk.php CHANGED
@@ -3,14 +3,14 @@
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.73
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.73';
11
- $ct_agent_version = 'wordpress-573';
12
- $cleantalk_executed=false;
13
- $ct_sfw_updated = false;
14
 
15
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
16
 
@@ -117,7 +117,20 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
117
  }else{
118
  $is_sfw_check=true;
119
  }
120
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  if($is_sfw_check){
122
  $sfw->check_ip();
123
  if($sfw->result){
@@ -359,7 +372,7 @@ if (!function_exists ( 'ct_activation')) {
359
  CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);// SFW update
360
  CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
361
  CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
362
- CleantalkCron::addTask('send_daily_request', 'ct_send_daily_request', 86400); // Daily sends request to servers
363
 
364
  // Additional options
365
  add_option('ct_plugin_do_activation_redirect', true);
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.74
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+
11
+ $cleantalk_plugin_version = '5.74';
12
+ $cleantalk_agent_version = 'wordpress-574';
13
+ $cleantalk_executed = false;
14
 
15
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
16
 
117
  }else{
118
  $is_sfw_check=true;
119
  }
120
+ }
121
+
122
+ // Skip the check
123
+ if(!empty($_GET['access'])){
124
+ $spbc_settings = get_option('spbc_settings');
125
+ $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
126
+ if($_GET['access'] === $ct_options['apikey'] || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
127
+ $is_sfw_check = false;
128
+ setcookie ('spbc_firewall_pass_key', md5($_SERVER['REMOTE_ADDR'].$spbc_key), time()+1200, '/');
129
+ setcookie ('ct_sfw_pass_key', md5($_SERVER['REMOTE_ADDR'].$ct_options['apikey']), time()+1200, '/');
130
+ }
131
+ unset($spbc_settings, $spbc_key);
132
+ }
133
+
134
  if($is_sfw_check){
135
  $sfw->check_ip();
136
  if($sfw->result){
372
  CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);// SFW update
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);
inc/cleantalk-admin.php CHANGED
@@ -234,12 +234,13 @@ function ct_enqueue_scripts($hook) {
234
  $show_check_links = !empty($ct_options['show_check_links']) ? $ct_options['show_check_links'] : 0;
235
 
236
  wp_enqueue_script('ct_comments_checkspam', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-comments-checkspam.js'), array(), $cleantalk_plugin_version);
237
- wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-comments-editscreen.js'), array(), $cleantalk_plugin_version.time());
238
 
239
  wp_localize_script( 'jquery', 'ctCommentsCheck', array(
240
  'ct_ajax_nonce' => $ajax_nonce,
241
  'ct_timeout_confirm' => __('Failed from timeout. Going to check comments again.', 'cleantalk'),
242
  'ct_comments_added' => __('Added', 'cleantalk'),
 
243
  'ct_comments_added_after' => __('comments', 'cleantalk'),
244
  'ct_confirm_deletion_all' => __('Delete all spam comments?', 'cleantalk'),
245
  'ct_confirm_deletion_checked' => __('Delete checked comments?', 'cleantalk'),
@@ -276,6 +277,7 @@ function ct_enqueue_scripts($hook) {
276
  'ct_timeout' => __('Failed from timeout. Going to check users again.', 'cleantalk'),
277
  'ct_timeout_delete' => __('Failed from timeout. Going to run a new attempt to delete spam users.', 'cleantalk'),
278
  'ct_inserted' => __('Inserted', 'cleantalk'),
 
279
  'ct_iusers' => __('users.', 'cleantalk'),
280
  'ct_confirm_deletion_all' => __('Delete all spam users?', 'cleantalk'),
281
  'ct_confirm_deletion_checked' => __('Delete checked users?', 'cleantalk'),
234
  $show_check_links = !empty($ct_options['show_check_links']) ? $ct_options['show_check_links'] : 0;
235
 
236
  wp_enqueue_script('ct_comments_checkspam', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-comments-checkspam.js'), array(), $cleantalk_plugin_version);
237
+ wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-comments-editscreen.js'), array(), $cleantalk_plugin_version);
238
 
239
  wp_localize_script( 'jquery', 'ctCommentsCheck', array(
240
  'ct_ajax_nonce' => $ajax_nonce,
241
  'ct_timeout_confirm' => __('Failed from timeout. Going to check comments again.', 'cleantalk'),
242
  'ct_comments_added' => __('Added', 'cleantalk'),
243
+ 'ct_comments_deleted' => __('Deleted', 'cleantalk'),
244
  'ct_comments_added_after' => __('comments', 'cleantalk'),
245
  'ct_confirm_deletion_all' => __('Delete all spam comments?', 'cleantalk'),
246
  'ct_confirm_deletion_checked' => __('Delete checked comments?', 'cleantalk'),
277
  'ct_timeout' => __('Failed from timeout. Going to check users again.', 'cleantalk'),
278
  'ct_timeout_delete' => __('Failed from timeout. Going to run a new attempt to delete spam users.', 'cleantalk'),
279
  'ct_inserted' => __('Inserted', 'cleantalk'),
280
+ 'ct_deleted' => __('Deleted', 'cleantalk'),
281
  'ct_iusers' => __('users.', 'cleantalk'),
282
  'ct_confirm_deletion_all' => __('Delete all spam users?', 'cleantalk'),
283
  'ct_confirm_deletion_checked' => __('Delete checked users?', 'cleantalk'),
inc/cleantalk-comments.php CHANGED
@@ -213,13 +213,14 @@ function ct_show_checkspam_page(){
213
  </div>
214
  <?php
215
  }
216
- echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class="button" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .'</button><br />' : '';
 
217
  ?>
218
  <br />
219
- <table id="new_test_table">
220
- <tr valign="top">
221
- <td>
222
- <button class="button" id="ct_check_spam_button"><?php _e("Check for spam", 'cleantalk'); ?></button><br /><br />
223
  </td>
224
  <td style="padding-left: 2em;">
225
  <div id="ct_info_message">
@@ -227,6 +228,16 @@ function ct_show_checkspam_page(){
227
  </div>
228
  </td>
229
  </tr>
 
 
 
 
 
 
 
 
 
 
230
  </table>
231
  <?php
232
  if($cnt_spam > 0)
@@ -274,17 +285,19 @@ function ct_ajax_check_comments(){
274
 
275
  if(sizeof($c)>0){
276
 
277
- // Leaving comments only with first comment's date. Unsetting others.
278
- foreach($c as $comment_index => $comment){
279
-
280
- if(!isset($curr_date))
281
- $curr_date = (substr($comment->comment_date, 0, 10) ? substr($comment->comment_date, 0, 10) : '');
 
282
 
283
- if(substr($comment->comment_date, 0, 10) != $curr_date)
284
- unset($c[$comment_index]);
285
 
 
 
286
  }
287
- unset($comment_index, $comment);
288
 
289
  // Checking comments IP/Email. Gathering $data for check.
290
  $data = Array();
@@ -330,7 +343,8 @@ function ct_ajax_check_comments(){
330
  $request['method_name'] = 'spam_check_cms';
331
  $request['auth_key'] = $ct_options['apikey'];
332
  $request['data'] = $data;
333
- $request['date'] = $curr_date;
 
334
 
335
  $url='https://api.cleantalk.org';
336
 
@@ -363,7 +377,6 @@ function ct_ajax_check_comments(){
363
  }else{
364
  for($i=0;$i<sizeof($c);$i++){
365
 
366
-
367
  $mark_spam_ip = false;
368
  $mark_spam_email = false;
369
 
@@ -452,10 +465,27 @@ function ct_ajax_info_comments($direct_call = false){
452
  function ct_ajax_insert_comments(){
453
 
454
  check_ajax_referer( 'ct_secret_nonce', 'security' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  global $wpdb;
456
 
457
- $time = current_time('mysql');
458
- $to_insert = 20;
459
 
460
  $result = $wpdb->get_results("SELECT network FROM `".$wpdb->base_prefix."cleantalk_sfw` LIMIT $to_insert;", ARRAY_A);
461
 
@@ -467,7 +497,10 @@ function ct_ajax_insert_comments(){
467
  unset($value);
468
 
469
  $inserted = 0;
470
- for($i=0; $i<$to_insert; $i++){
 
 
 
471
 
472
  $rnd=mt_rand(1,100);
473
 
@@ -482,13 +515,14 @@ function ct_ajax_insert_comments(){
482
  'comment_type' => '',
483
  'comment_parent' => 0,
484
  'user_id' => 1,
485
- 'comment_author_IP' => $ips[$i],
486
  'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
487
- 'comment_date' => $time,
488
  'comment_approved' => 1,
489
  );
490
 
491
  wp_insert_comment($data);
 
492
  $inserted++;
493
  }
494
  }else{
213
  </div>
214
  <?php
215
  }
216
+ echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class="button" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .' (100)</button> ' : '';
217
+ echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button" id="ct_delete_comments">'. __('Delete comments', 'cleantalk') .' (110)</button><br />' : '';
218
  ?>
219
  <br />
220
+ <table id="ct_check_button_table">
221
+ <tr>
222
+ <td style="width: 130px;">
223
+ <button class="button" id="ct_check_spam_button"><?php _e("Check for spam", 'cleantalk'); ?></button>
224
  </td>
225
  <td style="padding-left: 2em;">
226
  <div id="ct_info_message">
228
  </div>
229
  </td>
230
  </tr>
231
+ <tr>
232
+ <td>
233
+ <div style="margin: 10px 0 0 20px">
234
+ <input id="ct_accurate_check" type="checkbox" value="1" /><?php _e("Accurate check", 'cleantalk'); ?>
235
+ </div>
236
+ </td>
237
+ <td style="padding-left: 2em;">
238
+ <div id="ct_info_message" class="wrap"><?php _e("Allow to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></div>
239
+ </td>
240
+ </tr>
241
  </table>
242
  <?php
243
  if($cnt_spam > 0)
285
 
286
  if(sizeof($c)>0){
287
 
288
+ if(!empty($_POST['accurate_check'])){
289
+ // Leaving comments only with first comment's date. Unsetting others.
290
+ foreach($c as $comment_index => $comment){
291
+
292
+ if(!isset($curr_date))
293
+ $curr_date = (substr($comment->comment_date, 0, 10) ? substr($comment->comment_date, 0, 10) : '');
294
 
295
+ if(substr($comment->comment_date, 0, 10) != $curr_date)
296
+ unset($c[$comment_index]);
297
 
298
+ }
299
+ unset($comment_index, $comment);
300
  }
 
301
 
302
  // Checking comments IP/Email. Gathering $data for check.
303
  $data = Array();
343
  $request['method_name'] = 'spam_check_cms';
344
  $request['auth_key'] = $ct_options['apikey'];
345
  $request['data'] = $data;
346
+ if(!empty($_POST['accurate_check']))
347
+ $request['date'] = $curr_date;
348
 
349
  $url='https://api.cleantalk.org';
350
 
377
  }else{
378
  for($i=0;$i<sizeof($c);$i++){
379
 
 
380
  $mark_spam_ip = false;
381
  $mark_spam_email = false;
382
 
465
  function ct_ajax_insert_comments(){
466
 
467
  check_ajax_referer( 'ct_secret_nonce', 'security' );
468
+
469
+ //* DELETION
470
+ if(!empty($_POST['delete'])){
471
+ $comments = get_comments(array('author_email' => 'stop_email@example.com'));
472
+ $deleted = 0;
473
+ $amount_to_delete = 15;
474
+ foreach($comments as $comment){
475
+ if($deleted >= $amount_to_delete)
476
+ break;
477
+ if(wp_delete_comment($comment->comment_ID, true))
478
+ $deleted++;
479
+ }
480
+ print "$deleted";
481
+ die();
482
+ }
483
+
484
+ //* INSERTION
485
  global $wpdb;
486
 
487
+ $to_insert = 10;
488
+ $time = current_time('timestamp')-(730*86400);
489
 
490
  $result = $wpdb->get_results("SELECT network FROM `".$wpdb->base_prefix."cleantalk_sfw` LIMIT $to_insert;", ARRAY_A);
491
 
497
  unset($value);
498
 
499
  $inserted = 0;
500
+ for($i=0, $j=0; $i<$to_insert; $i++, $j++){
501
+
502
+ if(!isset($ips[$j]))
503
+ $j=0;
504
 
505
  $rnd=mt_rand(1,100);
506
 
515
  'comment_type' => '',
516
  'comment_parent' => 0,
517
  'user_id' => 1,
518
+ 'comment_author_IP' => $ips[$j],
519
  'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
520
+ 'comment_date' => date('Y-m-d H:i:s', $time),
521
  'comment_approved' => 1,
522
  );
523
 
524
  wp_insert_comment($data);
525
+ $time = $time + 86400;
526
  $inserted++;
527
  }
528
  }else{
inc/cleantalk-public.php CHANGED
@@ -2462,7 +2462,13 @@ function ct_contact_form_validate() {
2462
  return null;
2463
 
2464
  // Skip the test if it's WooCommerce and the checkout test unset
2465
- if(strpos($_SERVER['REQUEST_URI'],'wc-ajax=checkout') !==false && $ct_options['wc_checkout_test'] == 0){
 
 
 
 
 
 
2466
  return null;
2467
  }
2468
 
2462
  return null;
2463
 
2464
  // Skip the test if it's WooCommerce and the checkout test unset
2465
+ if(
2466
+ (
2467
+ strpos($_SERVER['REQUEST_URI'],'wc-ajax=checkout') !==false || (isset($_POST['_wp_http_referer']) &&
2468
+ strpos($_POST['_wp_http_referer'], 'wc-ajax=update_order_review') !== false)
2469
+ ) &&
2470
+ $ct_options['wc_checkout_test'] == 0
2471
+ ){
2472
  return null;
2473
  }
2474
 
inc/cleantalk-updater.php CHANGED
@@ -61,6 +61,9 @@ function ct_run_update_actions($current_version, $new_version, $start_version){
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
  }
65
 
66
  return true;
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
 
69
  return true;
inc/cleantalk-users.php CHANGED
@@ -211,13 +211,14 @@ function ct_show_users_page(){
211
  </div>
212
  <?php
213
  }
214
- echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class="button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). '</button><br />' : '';
 
215
  ?>
216
  <br />
217
  <br />
218
- <table>
219
  <tr>
220
- <td>
221
  <button class="button" id="ct_check_users_button"><?php _e("Check for spam", 'cleantalk'); ?></button>
222
  </td>
223
  <td style="padding-left: 2em;">
@@ -226,6 +227,16 @@ function ct_show_users_page(){
226
  </div>
227
  </td>
228
  </tr>
 
 
 
 
 
 
 
 
 
 
229
  </table>
230
  <?php
231
  if($cnt_spam1 > 0)
@@ -281,17 +292,19 @@ function ct_ajax_check_users(){
281
 
282
  if(count($u) > 0){
283
 
284
- // Leaving users only with first comment's date. Unsetting others.
285
- foreach($u as $user_index => $user){
286
-
287
- if(!isset($curr_date))
288
- $curr_date = (substr($user->data->user_registered, 0, 10) ? substr($user->data->user_registered, 0, 10) : '');
 
289
 
290
- if(substr($user->data->user_registered, 0, 10) != $curr_date)
291
- unset($u[$user_index]);
292
 
 
 
293
  }
294
- unset($user_index, $user);
295
 
296
  // Checking comments IP/Email. Gathering $data for check.
297
  $data=Array();
@@ -342,8 +355,11 @@ function ct_ajax_check_users(){
342
  $request['method_name'] = 'spam_check_cms';
343
  $request['auth_key'] = $ct_options['apikey'];
344
  $request['data'] = $data;
345
- $request['date'] = $curr_date;
 
 
346
  $url='https://api.cleantalk.org';
 
347
  if(!function_exists('sendRawRequest'))
348
  require_once('cleantalk.class.php');
349
 
@@ -437,7 +453,7 @@ function ct_ajax_info_users($direct_call = false)
437
  $cnt = $r[0]->cnt;
438
 
439
  // Checked
440
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_checked' or $wpdb->usermeta.meta_key='ct_hash';");
441
  $cnt_checked = $r[0]->cnt;
442
 
443
  //Spam
@@ -474,22 +490,26 @@ function ct_ajax_info_users($direct_call = false)
474
  function ct_ajax_insert_users()
475
  {
476
  check_ajax_referer( 'ct_secret_nonce', 'security' );
477
- global $wpdb;
478
-
479
- $to_insert = 20;
480
 
481
- /* DELETION
482
- $users = get_users(array('search' => '*user_*', 'search_columns' => array('login', 'nicename')));
483
- $inserted = 0;
484
- $amount_to_delete = 0;
485
- foreach($users as $user){
486
- if($inserted >= $amount_to_delete)
487
- break;
488
- if(wp_delete_user($user->ID))
489
- $inserted++;
 
 
 
 
490
  }
491
  //*/
492
 
 
 
 
493
  $result = $wpdb->get_results("SELECT network FROM `".$wpdb->base_prefix."cleantalk_sfw` LIMIT $to_insert;", ARRAY_A);
494
 
495
  if($result){
@@ -523,6 +543,7 @@ function ct_ajax_insert_users()
523
  }else{
524
  $inserted = '0';
525
  }
 
526
 
527
  print "$inserted";
528
  die();
@@ -551,7 +572,7 @@ function ct_ajax_delete_all_users()
551
  'meta_key' => 'ct_marked_as_spam',
552
  'meta_value' => '1',
553
  'fields' => array('ID'),
554
- 'number' => 10
555
  );
556
  $users = get_users($args);
557
 
211
  </div>
212
  <?php
213
  }
214
+ echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class="button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). ' (100)</button> ' : '';
215
+ echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button" id="ct_delete_users">'. __('Delete accounts', 'cleantalk'). ' (110)</button><br />' : '';
216
  ?>
217
  <br />
218
  <br />
219
+ <table id="ct_check_button_table">
220
  <tr>
221
+ <td style="width: 130px;">
222
  <button class="button" id="ct_check_users_button"><?php _e("Check for spam", 'cleantalk'); ?></button>
223
  </td>
224
  <td style="padding-left: 2em;">
227
  </div>
228
  </td>
229
  </tr>
230
+ <tr>
231
+ <td>
232
+ <div style="margin: 10px 0 0 20px">
233
+ <input id="ct_accurate_check" type="checkbox" value="1" /><?php _e("Accurate check", 'cleantalk'); ?>
234
+ </div>
235
+ </td>
236
+ <td style="padding-left: 2em;">
237
+ <div id="ct_info_message" class="wrap"><?php _e("Allow to use registrations dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></div>
238
+ </td>
239
+ </tr>
240
  </table>
241
  <?php
242
  if($cnt_spam1 > 0)
292
 
293
  if(count($u) > 0){
294
 
295
+ if(!empty($_POST['accurate_check'])){
296
+ // Leaving users only with first comment's date. Unsetting others.
297
+ foreach($u as $user_index => $user){
298
+
299
+ if(!isset($curr_date))
300
+ $curr_date = (substr($user->data->user_registered, 0, 10) ? substr($user->data->user_registered, 0, 10) : '');
301
 
302
+ if(substr($user->data->user_registered, 0, 10) != $curr_date)
303
+ unset($u[$user_index]);
304
 
305
+ }
306
+ unset($user_index, $user);
307
  }
 
308
 
309
  // Checking comments IP/Email. Gathering $data for check.
310
  $data=Array();
355
  $request['method_name'] = 'spam_check_cms';
356
  $request['auth_key'] = $ct_options['apikey'];
357
  $request['data'] = $data;
358
+ if(!empty($_POST['accurate_check']))
359
+ $request['date'] = $curr_date;
360
+
361
  $url='https://api.cleantalk.org';
362
+
363
  if(!function_exists('sendRawRequest'))
364
  require_once('cleantalk.class.php');
365
 
453
  $cnt = $r[0]->cnt;
454
 
455
  // Checked
456
+ $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_checked';");
457
  $cnt_checked = $r[0]->cnt;
458
 
459
  //Spam
490
  function ct_ajax_insert_users()
491
  {
492
  check_ajax_referer( 'ct_secret_nonce', 'security' );
 
 
 
493
 
494
+ //* DELETION
495
+ if(!empty($_POST['delete'])){
496
+ $users = get_users(array('search' => '*user_*', 'search_columns' => array('login', 'nicename')));
497
+ $deleted = 0;
498
+ $amount_to_delete = 15;
499
+ foreach($users as $user){
500
+ if($deleted >= $amount_to_delete)
501
+ break;
502
+ if(wp_delete_user($user->ID))
503
+ $deleted++;
504
+ }
505
+ print "$deleted";
506
+ die();
507
  }
508
  //*/
509
 
510
+ //* INSERTION
511
+ global $wpdb;
512
+ $to_insert = 10;
513
  $result = $wpdb->get_results("SELECT network FROM `".$wpdb->base_prefix."cleantalk_sfw` LIMIT $to_insert;", ARRAY_A);
514
 
515
  if($result){
543
  }else{
544
  $inserted = '0';
545
  }
546
+ //*/
547
 
548
  print "$inserted";
549
  die();
572
  'meta_key' => 'ct_marked_as_spam',
573
  'meta_value' => '1',
574
  'fields' => array('ID'),
575
+ 'number' => 50
576
  );
577
  $users = get_users($args);
578
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00, sartemd174, amagsumov
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
- Stable tag: 5.73
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,11 @@ 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.73 August 11 2017 =
510
  * Fix for spam check for already existed users and comments.
511
  * SpamFireWall updated.
@@ -1416,6 +1421,11 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1416
  * First version
1417
 
1418
  == Upgrade Notice ==
 
 
 
 
 
1419
  = 5.73 August 11 2017 =
1420
  * Fix for spam check for already existed users and comments.
1421
  * SpamFireWall 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.74
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.74 August 31 2017 =
510
+ * Users and comments spam check: Two check types (fast and accurate).
511
+ * Fix for WooCommerce checkout test.
512
+ * Minor fixes.
513
+
514
  = 5.73 August 11 2017 =
515
  * Fix for spam check for already existed users and comments.
516
  * SpamFireWall updated.
1421
  * First version
1422
 
1423
  == Upgrade Notice ==
1424
+ = 5.74 August 31 2017 =
1425
+ * Users and comments spam check: Two check types (fast and accurate).
1426
+ * Fix for WooCommerce checkout test.
1427
+ * Minor fixes.
1428
+
1429
  = 5.73 August 11 2017 =
1430
  * Fix for spam check for already existed users and comments.
1431
  * SpamFireWall updated.