Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.73

Version Description

August 11 2017 = * Fix for spam check for already existed users and comments. * SpamFireWall updated. * Layout fix for BT Comments. * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.72 to 5.73

assets/css/cleantalk-public.css CHANGED
@@ -30,6 +30,7 @@
30
  height: 12px;
31
  margin-right: 0px;
32
  vertical-align: text-top;
 
33
  }
34
 
35
  .ct_this_is{
30
  height: 12px;
31
  margin-right: 0px;
32
  vertical-align: text-top;
33
+ box-shadow: transparent 0 0 0 !important;
34
  }
35
 
36
  .ct_this_is{
assets/js/cleantalk-comments-editscreen.js CHANGED
@@ -8,8 +8,8 @@ function ct_is_ip(str){
8
  jQuery(document).ready(function(){
9
 
10
  /* Shows "Find spam users" Buttons */
11
- jQuery('#post-query-submit').after('<a href="edit-comments.php?page=ct_check_spam" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctCommentsScreen.spambutton_text+'</a>' +
12
- ' <a href="edit-comments.php?page=ct_check_spam&ct_worked=1" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctCommentsScreen.spambutton_text_show+'</a>&nbsp;');
13
 
14
  /* Shows link to blacklists near every email and IP address */
15
  if(parseInt(ctCommentsScreen.ct_show_check_links))
8
  jQuery(document).ready(function(){
9
 
10
  /* Shows "Find spam users" Buttons */
11
+ jQuery('#post-query-submit').after('<a href="edit-comments.php?page=ct_check_spam" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctAdminCommon.logo_small_colored+'&nbsp;'+ctCommentsScreen.spambutton_text+'</a>' +
12
+ ' <a href="edit-comments.php?page=ct_check_spam&ct_worked=1" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctAdminCommon.logo_small_colored+'&nbsp;'+ctCommentsScreen.spambutton_text_show+'</a>&nbsp;');
13
 
14
  /* Shows link to blacklists near every email and IP address */
15
  if(parseInt(ctCommentsScreen.ct_show_check_links))
assets/js/cleantalk-public.js CHANGED
@@ -1,8 +1,8 @@
1
  jQuery(document).ready(function(){
2
 
3
  // Set background-color similar to parents
4
- var ct_current_wrapper = jQuery('.ct_comment_info').parent(),
5
- ct_current_background_color;
6
  for(var i=0; i < 30; i++){
7
  if(ct_current_wrapper.css('background-color') == 'rgba(0, 0, 0, 0)' || i == 29)
8
  ct_current_wrapper = ct_current_wrapper.parent();
@@ -12,6 +12,11 @@ jQuery(document).ready(function(){
12
  }
13
  }
14
 
 
 
 
 
 
15
  jQuery('.ct_this_is').on('click', function(){
16
 
17
  var ct_current_button = jQuery(this),
1
  jQuery(document).ready(function(){
2
 
3
  // Set background-color similar to parents
4
+ var ct_current_wrapper = jQuery('.ct_comment_info').parent();
5
+
6
  for(var i=0; i < 30; i++){
7
  if(ct_current_wrapper.css('background-color') == 'rgba(0, 0, 0, 0)' || i == 29)
8
  ct_current_wrapper = ct_current_wrapper.parent();
12
  }
13
  }
14
 
15
+ // Set same float style with article
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
 
22
  var ct_current_button = jQuery(this),
assets/js/cleantalk-users-editscreen.js CHANGED
@@ -8,8 +8,8 @@ function ct_is_ip(str){
8
  jQuery(document).ready(function(){
9
 
10
  /* Shows "Find spam users" Buttons */
11
- jQuery('#changeit').after(' <a href="users.php?page=ct_check_users" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctUsersScreen.spambutton_users_text+'</a>' +
12
- ' <a href="users.php?page=ct_check_users&ct_worked=1" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctUsersScreen.spambutton_users_text_show+'</a>');
13
 
14
  /* Shows link to blacklists near every email and IP address */
15
  if(parseInt(ctUsersScreen.ct_show_check_links))
8
  jQuery(document).ready(function(){
9
 
10
  /* Shows "Find spam users" Buttons */
11
+ jQuery('#changeit').after(' <a href="users.php?page=ct_check_users" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctAdminCommon.logo_small_colored+'&nbsp;'+ctUsersScreen.spambutton_users_text+'</a>' +
12
+ ' <a href="users.php?page=ct_check_users&ct_worked=1" class="button" style="margin:1px 0 0 0; display: inline-block;">'+ctAdminCommon.logo_small_colored+'&nbsp;'+ctUsersScreen.spambutton_users_text_show+'</a>');
13
 
14
  /* Shows link to blacklists near every email and IP address */
15
  if(parseInt(ctUsersScreen.ct_show_check_links))
cleantalk.php CHANGED
@@ -3,12 +3,12 @@
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.72
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.72';
11
- $ct_agent_version = 'wordpress-572';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
@@ -180,7 +180,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
180
  add_action('admin_init', 'ct_plugin_redirect');
181
 
182
  // After plugin loaded - to load locale as described in manual
183
- add_action('plugin_loaded', 'ct_plugin_loaded' );
184
 
185
  if( !empty($ct_options['use_ajax']) &&
186
  stripos($_SERVER['REQUEST_URI'],'.xml')===false &&
@@ -359,6 +359,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
 
363
  // Additional options
364
  add_option('ct_plugin_do_activation_redirect', true);
@@ -516,6 +517,24 @@ function ct_wp_logout(){
516
  setcookie('ct_trial_banner_closed', '', time()-3600);
517
  }
518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
  /*
520
  function myplugin_update_field( $new_value, $old_value ) {
521
  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.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
 
180
  add_action('admin_init', 'ct_plugin_redirect');
181
 
182
  // After plugin loaded - to load locale as described in manual
183
+ add_action('plugins_loaded', 'ct_plugin_loaded' );
184
 
185
  if( !empty($ct_options['use_ajax']) &&
186
  stripos($_SERVER['REQUEST_URI'],'.xml')===false &&
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);
517
  setcookie('ct_trial_banner_closed', '', time()-3600);
518
  }
519
 
520
+ function ct_send_daily_request(){
521
+
522
+ $message = "Hello!\nThis is the test request to check connectivity to CleanTalk Anti-Spam servers.\nThank you!";
523
+
524
+ $ct_base_call_result = ct_base_call(
525
+ array(
526
+ 'message' => $message,
527
+ 'example' => '',
528
+ 'sender_email' => 'test@cleantalk.org',
529
+ 'sender_nickname' => 'CleanTalk',
530
+ 'checkjs' => 1,
531
+ 'post_info' => ''
532
+ )
533
+ );
534
+
535
+ return true;
536
+
537
+ }
538
  /*
539
  function myplugin_update_field( $new_value, $old_value ) {
540
  error_log('cleantalk_data dump: '. strlen(serialize($new_value)));
inc/cleantalk-admin.php CHANGED
@@ -203,6 +203,10 @@ function ct_enqueue_scripts($hook) {
203
  wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-admin.js'), array(), $cleantalk_plugin_version);
204
  wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-admin.css'), array(), $cleantalk_plugin_version, 'all');
205
 
 
 
 
 
206
  // Scripts & Styles to main dashboard page
207
  if($hook == 'index.php' && current_user_can('activate_plugins')){
208
  wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-dashboard-widget.js'), array(), $cleantalk_plugin_version);
@@ -389,10 +393,11 @@ function ct_admin_init(){
389
  update_option( 'cleantalk_data' , $ct_data);
390
  }else{
391
  $current_version = (isset($ct_data['plugin_version']) ? $ct_data['plugin_version'] : '1.0.0');
 
392
  if($current_version != $cleantalk_plugin_version){
393
  if(is_main_site()){
394
  require_once('cleantalk-updater.php');
395
- $result = ct_run_update_actions($current_version, $cleantalk_plugin_version);
396
  //If update is successfull
397
  if($result === true){
398
  ct_send_feedback(
203
  wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-admin.js'), array(), $cleantalk_plugin_version);
204
  wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-admin.css'), array(), $cleantalk_plugin_version, 'all');
205
 
206
+ wp_localize_script( 'jquery', 'ctAdminCommon', array(
207
+ 'logo_small_colored' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_color.png" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />'
208
+ ));
209
+
210
  // Scripts & Styles to main dashboard page
211
  if($hook == 'index.php' && current_user_can('activate_plugins')){
212
  wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-dashboard-widget.js'), array(), $cleantalk_plugin_version);
393
  update_option( 'cleantalk_data' , $ct_data);
394
  }else{
395
  $current_version = (isset($ct_data['plugin_version']) ? $ct_data['plugin_version'] : '1.0.0');
396
+ $start_version = (!empty($ct_data['start_version']) ? $ct_data['start_version'] : $current_version);
397
  if($current_version != $cleantalk_plugin_version){
398
  if(is_main_site()){
399
  require_once('cleantalk-updater.php');
400
+ $result = ct_run_update_actions($current_version, $cleantalk_plugin_version, $start_version);
401
  //If update is successfull
402
  if($result === true){
403
  ct_send_feedback(
inc/cleantalk-comments.php CHANGED
@@ -44,7 +44,7 @@ function ct_show_checkspam_page(){
44
  <!-- Deleting message -->
45
  <div id="ct_deleting_message" style="display:none;">
46
  <?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left">
47
- <?php echo $cnt_spam;?>
48
  </span>
49
  </div>
50
 
@@ -247,28 +247,22 @@ function ct_ajax_check_comments(){
247
 
248
  $args_unchecked = array(
249
  'meta_query' => array(
250
- //'relation' => 'AND',
251
  Array(
252
  'key' => 'ct_checked',
253
- 'value' => '1',
254
  'compare' => 'NOT EXISTS'
255
  ),
256
  array(
257
  'key' => 'ct_bad',
258
- 'value' => '1',
259
  'compare' => 'NOT EXISTS'
260
  )
261
- /*array(
262
- 'key' => 'ct_hash',
263
- 'value' => '1',
264
- 'compare' => 'NOT EXISTS'
265
- )*/
266
  ),
267
- 'number'=>100,
268
- 'status' => 'all'
 
269
  );
270
- $c=get_comments($args_unchecked);
271
- $c=array_values($c);
272
 
273
  $check_result = array(
274
  'end' => 0,
@@ -280,6 +274,7 @@ function ct_ajax_check_comments(){
280
 
281
  if(sizeof($c)>0){
282
 
 
283
  foreach($c as $comment_index => $comment){
284
 
285
  if(!isset($curr_date))
@@ -291,7 +286,8 @@ function ct_ajax_check_comments(){
291
  }
292
  unset($comment_index, $comment);
293
 
294
- $data=Array();
 
295
  for($i=0;$i<sizeof($c);$i++){
296
 
297
  $curr_ip = $c[$i]->comment_author_IP;
@@ -305,17 +301,21 @@ function ct_ajax_check_comments(){
305
  $check_result['bad']++;
306
  update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
307
  unset($c[$i]);
308
- $c = array_values($c);
309
  }else{
310
  if(!empty($curr_ip))
311
  $data[] = $curr_ip;
312
  if(!empty($curr_email))
313
  $data[] = $curr_email;
 
314
  $c[$i]->comment_author_IP = empty($curr_ip) ? 'none' : $curr_ip;
315
  $c[$i]->comment_author_email = empty($curr_email) ? 'none' : $curr_email;
316
  }
317
  }
318
 
 
 
 
319
  // Drop if data empty and there's no comments to check
320
  if(count($data) == 0){
321
  if($_POST['unchecked'] === 0)
@@ -394,70 +394,37 @@ function ct_ajax_check_comments(){
394
  die;
395
  }
396
 
397
- function ct_ajax_info_comments($direct_call = true){
398
 
399
  if (!$direct_call)
400
  check_ajax_referer( 'ct_secret_nonce', 'security' );
401
 
402
  // Total comments
403
- $cnt=get_comments(Array('count'=>true));
404
 
405
  // Spam comments
406
- $args_spam = array(
407
- 'meta_query' => array(
408
- Array(
409
- 'key' => 'ct_marked_as_spam',
410
- 'value' => '1',
411
- 'compare' => 'NUMERIC'
412
- )
413
- ),
414
- 'count'=>true
415
  );
416
- $cnt_spam=get_comments($args_spam);
417
-
418
-
419
- // Already checked by Cleantalk
420
- // $args_checked1=array(
421
- // 'meta_query' => array(
422
- // Array(
423
- // 'key' => 'ct_hash',
424
- // 'value'=>'1',
425
- // 'compare' => 'EXISTS'
426
- // )
427
- // ),
428
- // 'count'=>true
429
- // );
430
- // $cnt_checked1=get_comments($args_checked1);
431
 
432
  // Checked comments
433
- $args_checked2=array(
434
- 'meta_query' => array(
435
- Array(
436
- 'key' => 'ct_checked',
437
- //'value'=>'1',
438
- 'compare' => 'EXISTS'
439
- )
440
- ),
441
- 'count'=>true
442
  );
443
- $cnt_checked2 =get_comments($args_checked2);
444
-
445
- // Total checked
446
- // $cnt_checked =$cnt_checked1 + $cnt_checked2;
447
- $cnt_checked = $cnt_checked2;
448
-
449
  // Bad comments (without IP and Email)
450
- $args_bad=array(
451
- 'meta_query' => array(
452
- Array(
453
- 'key' => 'ct_bad',
454
- 'value'=>'1',
455
- 'compare' => 'NUMERIC'
456
- )
457
- ),
458
- 'count'=>true
459
  );
460
- $cnt_bad =get_comments($args_bad);
461
 
462
  $return = array(
463
  'message' => '',
@@ -478,8 +445,7 @@ function ct_ajax_info_comments($direct_call = true){
478
  echo json_encode($return);
479
  die();
480
  }
481
-
482
- return null;
483
  }
484
 
485
 
44
  <!-- Deleting message -->
45
  <div id="ct_deleting_message" style="display:none;">
46
  <?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left">
47
+ <?php echo $cnt_spam; ?>
48
  </span>
49
  </div>
50
 
247
 
248
  $args_unchecked = array(
249
  'meta_query' => array(
250
+ 'relation' => 'AND',
251
  Array(
252
  'key' => 'ct_checked',
 
253
  'compare' => 'NOT EXISTS'
254
  ),
255
  array(
256
  'key' => 'ct_bad',
 
257
  'compare' => 'NOT EXISTS'
258
  )
 
 
 
 
 
259
  ),
260
+ 'orderby' => 'comment_date',
261
+ 'order' => 'ASC',
262
+ 'number' => 100
263
  );
264
+ $c = get_comments($args_unchecked);
265
+ $c = array_values($c);
266
 
267
  $check_result = array(
268
  'end' => 0,
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))
286
  }
287
  unset($comment_index, $comment);
288
 
289
+ // Checking comments IP/Email. Gathering $data for check.
290
+ $data = Array();
291
  for($i=0;$i<sizeof($c);$i++){
292
 
293
  $curr_ip = $c[$i]->comment_author_IP;
301
  $check_result['bad']++;
302
  update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
303
  unset($c[$i]);
304
+
305
  }else{
306
  if(!empty($curr_ip))
307
  $data[] = $curr_ip;
308
  if(!empty($curr_email))
309
  $data[] = $curr_email;
310
+ // Patch for empty IP/Email
311
  $c[$i]->comment_author_IP = empty($curr_ip) ? 'none' : $curr_ip;
312
  $c[$i]->comment_author_email = empty($curr_email) ? 'none' : $curr_email;
313
  }
314
  }
315
 
316
+ // Recombining after checking and unsettting
317
+ $c = array_values($c);
318
+
319
  // Drop if data empty and there's no comments to check
320
  if(count($data) == 0){
321
  if($_POST['unchecked'] === 0)
394
  die;
395
  }
396
 
397
+ function ct_ajax_info_comments($direct_call = false){
398
 
399
  if (!$direct_call)
400
  check_ajax_referer( 'ct_secret_nonce', 'security' );
401
 
402
  // Total comments
403
+ $cnt = get_comments(Array('count'=>true));
404
 
405
  // Spam comments
406
+ $cnt_spam = get_comments(
407
+ array(
408
+ 'meta_key' => 'ct_marked_as_spam',
409
+ 'count' => true
410
+ )
 
 
 
 
411
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
 
413
  // Checked comments
414
+ $cnt_checked =get_comments(
415
+ array(
416
+ 'meta_key' => 'ct_checked',
417
+ 'count' => true
418
+ )
 
 
 
 
419
  );
420
+
 
 
 
 
 
421
  // Bad comments (without IP and Email)
422
+ $cnt_bad =get_comments(
423
+ array(
424
+ 'meta_key' => 'ct_bad',
425
+ 'count' => true
426
+ )
 
 
 
 
427
  );
 
428
 
429
  $return = array(
430
  'message' => '',
445
  echo json_encode($return);
446
  die();
447
  }
448
+
 
449
  }
450
 
451
 
inc/cleantalk-common.php CHANGED
@@ -522,7 +522,11 @@ function ct_get_data($force=false) {
522
  * @return mixed[] Array of default options
523
  */
524
  function ct_def_data() {
 
 
 
525
  return array(
 
526
  'user_token' => '', // User token
527
  'js_keys' => array(), // Keys to do JavaScript antispam test
528
  'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
522
  * @return mixed[] Array of default options
523
  */
524
  function ct_def_data() {
525
+
526
+ global $cleantalk_plugin_version;
527
+
528
  return array(
529
+ 'start_version' => $cleantalk_plugin_version,
530
  'user_token' => '', // User token
531
  'js_keys' => array(), // Keys to do JavaScript antispam test
532
  'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
inc/cleantalk-public.php CHANGED
@@ -2924,7 +2924,7 @@ function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
2924
  if($email)
2925
  echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
2926
  ."$email"
2927
- ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none'/>"
2928
  ."</a>";
2929
  else
2930
  echo __('No email', 'cleantalk');
@@ -2934,7 +2934,7 @@ function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
2934
  if($ip)
2935
  echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
2936
  ."$ip"
2937
- ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none'/>"
2938
  ."</a>";
2939
  else
2940
  echo __('No IP', 'cleantalk');
2924
  if($email)
2925
  echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
2926
  ."$email"
2927
+ ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
2928
  ."</a>";
2929
  else
2930
  echo __('No email', 'cleantalk');
2934
  if($ip)
2935
  echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
2936
  ."$ip"
2937
+ ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
2938
  ."</a>";
2939
  else
2940
  echo __('No IP', 'cleantalk');
inc/cleantalk-updater.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function ct_run_update_actions($current_version, $new_version){
4
 
5
  global $ct_data, $wpdb;
6
 
1
  <?php
2
 
3
+ function ct_run_update_actions($current_version, $new_version, $start_version){
4
 
5
  global $ct_data, $wpdb;
6
 
inc/cleantalk-users.php CHANGED
@@ -258,12 +258,10 @@ function ct_ajax_check_users(){
258
  'meta_query' => array(
259
  array(
260
  'key' => 'ct_checked',
261
- 'value' => '1',
262
  'compare' => 'NOT EXISTS'
263
  ),
264
  array(
265
  'key' => 'ct_bad',
266
- 'value' => '1',
267
  'compare' => 'NOT EXISTS'
268
  ),
269
  ),
@@ -283,6 +281,7 @@ function ct_ajax_check_users(){
283
 
284
  if(count($u) > 0){
285
 
 
286
  foreach($u as $user_index => $user){
287
 
288
  if(!isset($curr_date))
@@ -293,7 +292,8 @@ function ct_ajax_check_users(){
293
 
294
  }
295
  unset($user_index, $user);
296
-
 
297
  $data=Array();
298
  for($i=0; $i < count($u); $i++){
299
 
@@ -312,17 +312,20 @@ function ct_ajax_check_users(){
312
  $check_result['bad']++;
313
  update_user_meta($u[$i]->ID,'ct_bad','1',true);
314
  unset($u[$i]);
315
- $u = array_values($u);
316
  }else{
317
  if(!empty($curr_ip))
318
  $data[] = $curr_ip;
319
  if(!empty($curr_email))
320
  $data[] = $curr_email;
 
321
  $u[$i]->data->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
322
  $u[$i]->data->user_email = empty($curr_email) ? 'none' : $curr_email;
323
  }
324
  }
325
 
 
 
 
326
  // Drop if data empty and there's no users to check
327
  if(count($data) == 0){
328
 
258
  'meta_query' => array(
259
  array(
260
  'key' => 'ct_checked',
 
261
  'compare' => 'NOT EXISTS'
262
  ),
263
  array(
264
  'key' => 'ct_bad',
 
265
  'compare' => 'NOT EXISTS'
266
  ),
267
  ),
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))
292
 
293
  }
294
  unset($user_index, $user);
295
+
296
+ // Checking comments IP/Email. Gathering $data for check.
297
  $data=Array();
298
  for($i=0; $i < count($u); $i++){
299
 
312
  $check_result['bad']++;
313
  update_user_meta($u[$i]->ID,'ct_bad','1',true);
314
  unset($u[$i]);
 
315
  }else{
316
  if(!empty($curr_ip))
317
  $data[] = $curr_ip;
318
  if(!empty($curr_email))
319
  $data[] = $curr_email;
320
+ // Patch for empty IP/Email
321
  $u[$i]->data->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
322
  $u[$i]->data->user_email = empty($curr_email) ? 'none' : $curr_email;
323
  }
324
  }
325
 
326
+ // Recombining after checking and unsettting
327
+ $u = array_values($u);
328
+
329
  // Drop if data empty and there's no users to check
330
  if(count($data) == 0){
331
 
lib/CleantalkSFW.php CHANGED
@@ -1,9 +1,13 @@
1
  <?php
2
 
3
  /*
4
- * CleanTalk SpamFireWall base class
5
- * Version 1.3
6
- * Compatible only with Wordpress.
 
 
 
 
7
  */
8
 
9
  class CleantalkSFW
@@ -50,37 +54,22 @@ class CleantalkSFW
50
 
51
 
52
  /*
53
- * Getting IP function
54
- * Version 1.1
55
- * Compatible with any CMS
56
  */
57
  public function cleantalk_get_real_ip(){
58
 
59
  $result=Array();
60
- if(function_exists('apache_request_headers')){
61
- $headers = apache_request_headers();
62
- $headers['X-Forwarded-For'] = isset($headers['X-Forwarded-For']) ? $headers['X-Forwarded-For'] : null;
63
- $headers['HTTP_X_FORWARDED_FOR'] = isset($headers['HTTP_X_FORWARDED_FOR']) ? $headers['HTTP_X_FORWARDED_FOR'] : null;
64
- $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
65
- $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
66
- }else{
67
- $headers = $_SERVER;
68
- $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
69
- $headers['X-Forwarded-For'] = isset($headers['X-Forwarded-For']) ? $headers['X-Forwarded-For'] : null;
70
- $headers['HTTP_X_FORWARDED_FOR'] = isset($headers['HTTP_X_FORWARDED_FOR']) ? $headers['HTTP_X_FORWARDED_FOR'] : null;
71
- $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
72
- }
73
 
74
- if( $headers['X-Forwarded-For'] ){
75
- $the_ip = explode(",", trim($headers['X-Forwarded-For']));
76
- $the_ip = trim($the_ip[0]);
77
- $result[] = $the_ip;
78
- $this->ip_str_array[]=$the_ip;
79
- $this->ip_array[]=sprintf("%u", ip2long($the_ip));
80
- }
81
 
82
- if( $headers['HTTP_X_FORWARDED_FOR'] ){
83
- $the_ip = explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
84
  $the_ip = trim($the_ip[0]);
85
  $result[] = $the_ip;
86
  $this->ip_str_array[]=$the_ip;
@@ -102,9 +91,7 @@ class CleantalkSFW
102
  }
103
 
104
  /*
105
- * Getting IP function
106
- * Version 1.1
107
- * Compatible with any CMS
108
  */
109
  public function check_ip(){
110
 
@@ -129,9 +116,7 @@ class CleantalkSFW
129
  }
130
 
131
  /*
132
- * Add entries to SFW log
133
- * Version 1.1
134
- * Compatible with any CMS
135
  */
136
  public function sfw_update_logs($ip, $result){
137
 
@@ -158,14 +143,13 @@ class CleantalkSFW
158
  }
159
 
160
  /*
161
- * Updates SFW local base
162
- * Version 1.1
163
- * Compatible only with phpBB 3.1
164
  */
165
  public function sfw_update($ct_key){
166
 
167
  $result = self::get_2sBlacklistsDb($ct_key);
168
- $result = self::checkRequestResult($result);
169
 
170
  if(empty($result['error'])){
171
 
@@ -195,9 +179,9 @@ class CleantalkSFW
195
  }
196
 
197
  /*
198
- * Sends and wipe SFW log
199
- * Version 1.1
200
- * Compatible only with phpBB 3.1
201
  */
202
  public function send_logs($ct_key){
203
 
@@ -217,7 +201,7 @@ class CleantalkSFW
217
 
218
  //Sending the request
219
  $result = self::sfwLogs($ct_key, $data);
220
- $result = self::checkRequestResult($result);
221
  //Checking answer and deleting all lines from the table
222
  if(empty($result['error'])){
223
  if($result['rows'] == count($data)){
@@ -234,9 +218,9 @@ class CleantalkSFW
234
  }
235
 
236
  /*
237
- * Shows DIE page
238
- * Version 1.1
239
- * Compatible with any CMS
240
  */
241
  public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = ''){
242
 
@@ -278,8 +262,12 @@ class CleantalkSFW
278
 
279
  }
280
 
281
-
282
- static public function sfwLogs($api_key, $data){
 
 
 
 
283
  $url='https://api.cleantalk.org';
284
  $request = array(
285
  'auth_key' => $api_key,
@@ -289,16 +277,26 @@ class CleantalkSFW
289
  'timestamp' => time()
290
  );
291
  $result = self::sendRawRequest($url, $request);
 
 
292
  return $result;
293
  }
294
 
295
- static public function get_2sBlacklistsDb($api_key){
 
 
 
 
 
296
  $url='https://api.cleantalk.org';
297
  $request = array(
298
  'auth_key' => $api_key,
299
  'method_name' => '2s_blacklists_db'
300
  );
 
301
  $result = self::sendRawRequest($url, $request);
 
 
302
  return $result;
303
  }
304
 
@@ -363,9 +361,10 @@ class CleantalkSFW
363
  *
364
  * @param string request_method
365
  * @param string result
366
- * @return mixed (array || false)
367
  */
368
- static public function checkRequestResult($result, $method_name = false){
 
369
 
370
  // Errors handling
371
  // Bad connection
@@ -406,9 +405,31 @@ class CleantalkSFW
406
 
407
  /* Other methods */
408
  if(isset($result['data']) && is_array($result['data'])){
409
- $result = $result['data'];
410
  }
411
-
412
- return $result;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  }
414
  }
1
  <?php
2
 
3
  /*
4
+ * CleanTalk SpamFireWall base class
5
+ * Compatible only with Wordpress.
6
+ * Version 1.5-wp
7
+ * author Cleantalk team (welcome@cleantalk.org)
8
+ * copyright (C) 2014 CleanTalk team (http://cleantalk.org)
9
+ * license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
10
+ * see https://github.com/CleanTalk/php-antispam
11
  */
12
 
13
  class CleantalkSFW
54
 
55
 
56
  /*
57
+ * Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, sfw_test_ip)
58
+ *
59
+ * reutrns array
60
  */
61
  public function cleantalk_get_real_ip(){
62
 
63
  $result=Array();
64
+ $headers = function_exists('apache_request_headers')
65
+ ? apache_request_headers()
66
+ : self::apache_request_headers();
 
 
 
 
 
 
 
 
 
 
67
 
68
+ $headers['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
69
+ $sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
 
 
 
 
 
70
 
71
+ if( isset($headers['X-Forwarded-For']) ){
72
+ $the_ip = explode(",", trim($headers['X-Forwarded-For']));
73
  $the_ip = trim($the_ip[0]);
74
  $result[] = $the_ip;
75
  $this->ip_str_array[]=$the_ip;
91
  }
92
 
93
  /*
94
+ * Checks IP via Database
 
 
95
  */
96
  public function check_ip(){
97
 
116
  }
117
 
118
  /*
119
+ * Add entry to SFW log
 
 
120
  */
121
  public function sfw_update_logs($ip, $result){
122
 
143
  }
144
 
145
  /*
146
+ * Updates SFW local base
147
+ *
148
+ * return mixed true || array('error' => true, 'error_string' => STRING)
149
  */
150
  public function sfw_update($ct_key){
151
 
152
  $result = self::get_2sBlacklistsDb($ct_key);
 
153
 
154
  if(empty($result['error'])){
155
 
179
  }
180
 
181
  /*
182
+ * Sends and wipe SFW log
183
+ *
184
+ * returns mixed true || array('error' => true, 'error_string' => STRING)
185
  */
186
  public function send_logs($ct_key){
187
 
201
 
202
  //Sending the request
203
  $result = self::sfwLogs($ct_key, $data);
204
+
205
  //Checking answer and deleting all lines from the table
206
  if(empty($result['error'])){
207
  if($result['rows'] == count($data)){
218
  }
219
 
220
  /*
221
+ * Shows DIE page
222
+ *
223
+ * Stops script executing
224
  */
225
  public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = ''){
226
 
262
 
263
  }
264
 
265
+ /*
266
+ * Wrapper for sfw_logs API method
267
+ *
268
+ * returns mixed STRING || array('error' => true, 'error_string' => STRING)
269
+ */
270
+ static public function sfwLogs($api_key, $data, $do_check = true){
271
  $url='https://api.cleantalk.org';
272
  $request = array(
273
  'auth_key' => $api_key,
277
  'timestamp' => time()
278
  );
279
  $result = self::sendRawRequest($url, $request);
280
+ $result = $do_check ? self::checkRequestResult($result, 'sfw_logs') : $result;
281
+
282
  return $result;
283
  }
284
 
285
+ /*
286
+ * Wrapper for 2s_blacklists_db API method
287
+ *
288
+ * returns mixed STRING || array('error' => true, 'error_string' => STRING)
289
+ */
290
+ static public function get_2sBlacklistsDb($api_key, $do_check = true){
291
  $url='https://api.cleantalk.org';
292
  $request = array(
293
  'auth_key' => $api_key,
294
  'method_name' => '2s_blacklists_db'
295
  );
296
+
297
  $result = self::sendRawRequest($url, $request);
298
+ $result = $do_check ? self::checkRequestResult($result, '2s_blacklists_db') : $result;
299
+
300
  return $result;
301
  }
302
 
361
  *
362
  * @param string request_method
363
  * @param string result
364
+ * @return mixed (array || array('error' => true, 'error_string' => STRING))
365
  */
366
+ static public function checkRequestResult($result, $method_name = null)
367
+ {
368
 
369
  // Errors handling
370
  // Bad connection
405
 
406
  /* Other methods */
407
  if(isset($result['data']) && is_array($result['data'])){
408
+ return $result['data'];
409
  }
410
+ }
411
+
412
+ /*
413
+ * If Apache web server is missing then making
414
+ * Patch for apache_request_headers()
415
+ */
416
+ static function apache_request_headers(){
417
+
418
+ $headers = array();
419
+ foreach($_SERVER as $key => $val){
420
+ if(preg_match('/\AHTTP_/', $key)){
421
+ $server_key = preg_replace('/\AHTTP_/', '', $key);
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);
429
+ }
430
+ $headers[$server_key] = $val;
431
+ }
432
+ }
433
+ return $headers;
434
  }
435
  }
readme.txt CHANGED
@@ -3,17 +3,17 @@ 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.72
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.
10
 
11
  == Description ==
12
 
13
- No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal Anti-Spam plugin.
14
-
15
  **Supports: Contact Form 7, Ninja Forms, Gravity Forms, MailChimp, Formidable forms, WooCommerce, JetPack comments and contact form, BuddyPress, bbPress, Fast Secure Contact form, S2Member, MailPoet, any WordPress registrations & contact forms and themes. Just setup and forget the spam!**
16
 
 
 
17
  = Anti-Spam features =
18
  1. Stops spam comments.
19
  1. Stops spam registrations.
@@ -25,6 +25,7 @@ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bo
25
  1. Stops spam in widgets.
26
  1. Stops spam in WooCommerce.
27
  1. Checks and removes the existing spam comments and spam users.
 
28
 
29
  = Public reviews =
30
  >With CleanTalk installed you can rest assured that you will no longer have to fuss with annoying spam. You can now focus your time on developing and improving your web site, your blog content, and you business without being distracted by these useless comments.
@@ -496,14 +497,21 @@ https://cleantalk.org/faq#feedback_spam
496
  We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade response time in backend or frontend. The plugin proccess only POST requests to WordPress core, it tackes less than 1 second to return results.
497
 
498
  == Screenshots ==
499
- 1. AntiSpam settings.
500
  1. AntiSpam plugin rejected a spam bot at the CAPTCHA less registration form. The plugin provides explanation to visitor and websites about each rejected comment/registration or contact message.
501
  1. Use AntiSpam analytics tool for each website in service Dashboard to have information about spam/legitimate stats.
502
  1. Use AntiSpam log to control anti-spam plugin.
503
  1. CleanTalk works faster than most of other anti-spam plugins.
504
  1. The Dashboard with a map of most spam active countries per your account.
 
505
 
506
  == Changelog ==
 
 
 
 
 
 
507
  = 5.72 July 27 2017 =
508
  * Improved spam check for existed users and comments.
509
  * Minor fixes.
@@ -1408,6 +1416,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1408
  * First version
1409
 
1410
  == Upgrade Notice ==
 
 
 
 
 
 
1411
  = 5.72 July 27 2017 =
1412
  * Improved spam check for existed users and comments.
1413
  * Minor fixes.
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.
10
 
11
  == Description ==
12
 
 
 
13
  **Supports: Contact Form 7, Ninja Forms, Gravity Forms, MailChimp, Formidable forms, WooCommerce, JetPack comments and contact form, BuddyPress, bbPress, Fast Secure Contact form, S2Member, MailPoet, any WordPress registrations & contact forms and themes. Just setup and forget the spam!**
14
 
15
+ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal Anti-Spam plugin.
16
+
17
  = Anti-Spam features =
18
  1. Stops spam comments.
19
  1. Stops spam registrations.
25
  1. Stops spam in widgets.
26
  1. Stops spam in WooCommerce.
27
  1. Checks and removes the existing spam comments and spam users.
28
+ 1. Compatible with mobile users and devices.
29
 
30
  = Public reviews =
31
  >With CleanTalk installed you can rest assured that you will no longer have to fuss with annoying spam. You can now focus your time on developing and improving your web site, your blog content, and you business without being distracted by these useless comments.
497
  We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade response time in backend or frontend. The plugin proccess only POST requests to WordPress core, it tackes less than 1 second to return results.
498
 
499
  == Screenshots ==
500
+ 1. AntiSpam settings are easy to use.
501
  1. AntiSpam plugin rejected a spam bot at the CAPTCHA less registration form. The plugin provides explanation to visitor and websites about each rejected comment/registration or contact message.
502
  1. Use AntiSpam analytics tool for each website in service Dashboard to have information about spam/legitimate stats.
503
  1. Use AntiSpam log to control anti-spam plugin.
504
  1. CleanTalk works faster than most of other anti-spam plugins.
505
  1. The Dashboard with a map of most spam active countries per your account.
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.
512
+ * Layout fix for BT Comments.
513
+ * Minor fixes.
514
+
515
  = 5.72 July 27 2017 =
516
  * Improved spam check for existed users and comments.
517
  * Minor fixes.
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.
1422
+ * Layout fix for BT Comments.
1423
+ * Minor fixes.
1424
+
1425
  = 5.72 July 27 2017 =
1426
  * Improved spam check for existed users and comments.
1427
  * Minor fixes.
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
screenshot-6.png DELETED
Binary file