Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.93

Version Description

April 9 2018 = * Fix: SpamFirewall IP detection. * Fix: Contact Form 7. False positives. * Mod: Autoupdate function improved. * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.92.2 to 5.93

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.92.2
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  $cleantalk_executed = false;
12
 
13
- define('APBCT_VERSION', '5.92.2');
14
- define('APBCT_AGENT', 'wordpress-5922');
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')
@@ -535,10 +535,13 @@ function ct_sfw_send_logs()
535
  function apbct_update(){
536
 
537
  //Upgrade params
538
- $plugin = 'cleantalk-spam-protect/cleantalk.php';
539
- $title = __('Update Plugin');
540
- $nonce = 'upgrade-plugin_' . $plugin;
541
- $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
 
 
 
542
 
543
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
544
  include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
@@ -560,11 +563,29 @@ function apbct_update(){
560
  if($result === false)
561
  die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE')));
562
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  $plugin_data = get_plugin_data(__FILE__);
564
  $apbct_agent = 'wordpress-'.str_replace('.', '', $plugin_data['Version']);
565
  ct_send_feedback('0:' . $apbct_agent);
566
 
567
- die('OK');
568
 
569
  }else{
570
  die('FAIL '. json_encode(array('error' => $upgrader->apbct_result)));
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.93
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  $cleantalk_executed = false;
12
 
13
+ define('APBCT_VERSION', '5.93');
14
+ define('APBCT_AGENT', 'wordpress-593');
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')
535
  function apbct_update(){
536
 
537
  //Upgrade params
538
+ $plugin = 'cleantalk-spam-protect/cleantalk.php';
539
+ $plugin_slug = 'cleantalk-spam-protect';
540
+ $title = __('Update Plugin');
541
+ $nonce = 'upgrade-plugin_' . $plugin;
542
+ $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
543
+
544
+ $prev_version = APBCT_VERSION;
545
 
546
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
547
  include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
563
  if($result === false)
564
  die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE')));
565
 
566
+ $urlHeaders = get_headers(get_option('siteurl'));
567
+
568
+ if(strpos($urlHeaders[0], '200') === false){
569
+
570
+ // Rollback
571
+ $rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
572
+ $rollback->rollback($plugin);
573
+
574
+ $response = array(
575
+ 'error' => 'BAD_HTTP_CODE',
576
+ 'http_code' => $urlHeaders[0],
577
+ 'output' => substr(file_get_contents(get_option('siteurl')), 0, 4000),
578
+ 'rollback_result' => $rollback->apbct_result,
579
+ );
580
+
581
+ die('FAIL '.json_encode($response));
582
+ }
583
+
584
  $plugin_data = get_plugin_data(__FILE__);
585
  $apbct_agent = 'wordpress-'.str_replace('.', '', $plugin_data['Version']);
586
  ct_send_feedback('0:' . $apbct_agent);
587
 
588
+ die('OK '.json_encode(array('agent' => APBCT_AGENT)));
589
 
590
  }else{
591
  die('FAIL '. json_encode(array('error' => $upgrader->apbct_result)));
inc/cleantalk-admin.php CHANGED
@@ -347,6 +347,10 @@ function ct_account_status_check(){
347
  $ct_data['auto_update_app'] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
348
  }
349
 
 
 
 
 
350
  if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1){
351
  $ct_data['moderate_ip'] = 1;
352
  $ct_data['ip_license'] = $result['ip_license'];
@@ -646,7 +650,7 @@ function ct_send_connection_reports() {
646
  $ct_data = ct_get_data();
647
 
648
  $value = $value=(isset($ct_options['send_connection_reports']) ? @intval($ct_options['send_connection_reports']) : 0);
649
- echo "<div id='cleantalk_anchor3' style='display:none'></div><input type=hidden name='cleantalk_settings[send_connection_reports]' value='0' />";
650
  echo "<input type='checkbox' id='connection_reports1' name='cleantalk_settings[send_connection_reports]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='connection_reports1'> " . __('Send connection reports', 'cleantalk') . "</label>";
651
  ct_add_descriptions_to_fields(sprintf(__("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'), $ct_options['spam_firewall']));
652
  echo "<script>
@@ -658,6 +662,32 @@ function ct_send_connection_reports() {
658
  </script>";
659
 
660
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  function ct_add_admin_menu( $wp_admin_bar ) {
662
  // add a parent item
663
  global $ct_options, $ct_data;
@@ -1324,7 +1354,7 @@ function ct_input_collect_details() {
1324
  $value=0;
1325
  }
1326
 
1327
- echo "<div id='cleantalk_anchor2' style='display:none'></div><input type=hidden name='cleantalk_settings[collect_details]' value='0' />";
1328
  echo "<input type='checkbox' id='collect_details1' name='cleantalk_settings[collect_details]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='collect_details1'> " . __('Collect details about browsers', 'cleantalk') . "</label>";
1329
  ct_add_descriptions_to_fields(sprintf(__("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'), $ct_options['spam_firewall']));
1330
  echo "<script>
@@ -1415,7 +1445,7 @@ function ct_input_set_cookies() {
1415
  echo "<input type='radio' id='cleantalk_set_cookies1' name='cleantalk_settings[set_cookies]' value='1' " . (!empty($ct_options['set_cookies']) ? 'checked' : '') . " /><label for='cleantalk_set_cookies1'> " . __('Yes') . "</label>";
1416
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1417
  echo "<input type='radio' id='cleantalk_set_cookies0' name='cleantalk_settings[set_cookies]' value='0' " . (empty($ct_options['set_cookies']) ? 'checked' : '') . " /><label for='cleantalk_set_cookies0'> " . __('No') . "</label>";
1418
- ct_add_descriptions_to_fields(sprintf(__('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected by CleanTalk if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could get false positives spam detection.</b>', 'cleantalk')));
1419
  }
1420
 
1421
  function ct_input_ssl_on() {
@@ -1596,29 +1626,19 @@ function apbct_settings_page() {
1596
  .'<br>';
1597
  echo __('Plugin Homepage at', 'cleantalk').' <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />';
1598
  echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
1599
- echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk');
1600
- echo '<br />';
1601
- echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b>';
1602
 
1603
- echo "</div>";
1604
- ?>
1605
- <form action="options.php" method="post">
1606
- <?php settings_fields('cleantalk_settings'); ?>
1607
- <?php do_settings_sections('cleantalk'); ?>
1608
- <br>
1609
- <input name="Submit" type="submit" class='cleantalk_manual_link' value="<?php esc_attr_e('Save Changes'); ?>" />
1610
- <?php
1611
  }
1612
- ?>
1613
-
1614
- </form>
1615
- </div>
1616
- <?php
1617
-
1618
- $ct_data = get_option('cleantalk_data');
1619
-
1620
- $user_token = (!empty($ct_data['user_token']) ? $ct_data['user_token'] : false);
1621
-
1622
  // Translate banner for non EN locale
1623
  if(substr(get_locale(), 0, 2) != 'en'){
1624
  require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
@@ -1901,6 +1921,8 @@ function apbct_register_plugin_links($links, $file) {
1901
 
1902
  $links[] = '<a class="ct_meta_links ct_faq_links" href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1903
  $links[] = '<a class="ct_meta_links ct_support_links"href="https://wordpress.org/support/plugin/cleantalk-spam-protect" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
 
 
1904
 
1905
  return $links;
1906
  }
347
  $ct_data['auto_update_app'] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
348
  }
349
 
350
+ if (isset($result['license_trial'])){
351
+ $ct_data['license_trial'] = $result['license_trial'];
352
+ }
353
+
354
  if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1){
355
  $ct_data['moderate_ip'] = 1;
356
  $ct_data['ip_license'] = $result['ip_license'];
650
  $ct_data = ct_get_data();
651
 
652
  $value = $value=(isset($ct_options['send_connection_reports']) ? @intval($ct_options['send_connection_reports']) : 0);
653
+ echo "<div id='cleantalk_anchor3' style='display:none'></div>";
654
  echo "<input type='checkbox' id='connection_reports1' name='cleantalk_settings[send_connection_reports]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='connection_reports1'> " . __('Send connection reports', 'cleantalk') . "</label>";
655
  ct_add_descriptions_to_fields(sprintf(__("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'), $ct_options['spam_firewall']));
656
  echo "<script>
662
  </script>";
663
 
664
  }
665
+
666
+ function ct_input_get_premium($print = true){
667
+
668
+ global $ct_data;
669
+
670
+ $ct_data = ct_get_data();
671
+
672
+ $out = '';
673
+
674
+ if(!empty($ct_data['license_trial']) && !empty($ct_data['user_token'])){
675
+ $out = '<b style="display: inline-block; margin-top: 10px;">'
676
+ .($print ? __('Make it right!', 'cleantalk').' ' : '')
677
+ .sprintf(
678
+ __('%sGet premium%s', 'cleantalk'),
679
+ '<a href="https://cleantalk.org/my/bill/recharge?user_token='.$ct_data['user_token'].'" target="_blank">',
680
+ '</a>'
681
+ )
682
+ .'</b>';
683
+ }
684
+
685
+ if($print)
686
+ echo $out;
687
+ else
688
+ return $out;
689
+ }
690
+
691
  function ct_add_admin_menu( $wp_admin_bar ) {
692
  // add a parent item
693
  global $ct_options, $ct_data;
1354
  $value=0;
1355
  }
1356
 
1357
+ echo "<div id='cleantalk_anchor2' style='display:none'></div>";
1358
  echo "<input type='checkbox' id='collect_details1' name='cleantalk_settings[collect_details]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='collect_details1'> " . __('Collect details about browsers', 'cleantalk') . "</label>";
1359
  ct_add_descriptions_to_fields(sprintf(__("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'), $ct_options['spam_firewall']));
1360
  echo "<script>
1445
  echo "<input type='radio' id='cleantalk_set_cookies1' name='cleantalk_settings[set_cookies]' value='1' " . (!empty($ct_options['set_cookies']) ? 'checked' : '') . " /><label for='cleantalk_set_cookies1'> " . __('Yes') . "</label>";
1446
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1447
  echo "<input type='radio' id='cleantalk_set_cookies0' name='cleantalk_settings[set_cookies]' value='0' " . (empty($ct_options['set_cookies']) ? 'checked' : '') . " /><label for='cleantalk_set_cookies0'> " . __('No') . "</label>";
1448
+ ct_add_descriptions_to_fields(sprintf(__('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected by CleanTalk if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could cause false positives spam detection.</b>', 'cleantalk')));
1449
  }
1450
 
1451
  function ct_input_ssl_on() {
1626
  .'<br>';
1627
  echo __('Plugin Homepage at', 'cleantalk').' <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />';
1628
  echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
1629
+ echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br />';
1630
+ echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
1631
+ ct_input_get_premium();
1632
 
1633
+ echo '</div>';
1634
+ echo '<form action="options.php" method="post">';
1635
+ settings_fields('cleantalk_settings');
1636
+ do_settings_sections('cleantalk');
1637
+ echo '<br>';
1638
+ echo '<input name="Submit" type="submit" class="cleantalk_manual_link" value="'.__('Save Changes').'" />';
 
 
1639
  }
1640
+ echo "</form>";
1641
+ echo "</div>";
 
 
 
 
 
 
 
 
1642
  // Translate banner for non EN locale
1643
  if(substr(get_locale(), 0, 2) != 'en'){
1644
  require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
1921
 
1922
  $links[] = '<a class="ct_meta_links ct_faq_links" href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1923
  $links[] = '<a class="ct_meta_links ct_support_links"href="https://wordpress.org/support/plugin/cleantalk-spam-protect" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
1924
+ if(!empty(ct_input_get_premium(false)))
1925
+ $links[] = ct_input_get_premium(false);
1926
 
1927
  return $links;
1928
  }
inc/cleantalk-comments.php CHANGED
@@ -69,6 +69,8 @@ function ct_show_checkspam_page(){
69
  <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
70
  <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
71
  </div>
 
 
72
  </div>
73
 
74
  <!-- Cooling notice -->
@@ -240,11 +242,12 @@ function ct_show_checkspam_page(){
240
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .' (100)</button> ' : '';
241
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_delete_comments">'. __('Delete comments', 'cleantalk') .' (110)</button>' : '';
242
 
243
- if($cnt_spam > 0)
244
  echo "<div id='ct_search_info'>"
245
  ."<br />"
246
  .__('There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.', 'cleantalk')
247
  ."</div>";
 
248
  ?>
249
  <div>
250
  <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
@@ -270,12 +273,12 @@ function ct_ajax_check_comments(){
270
  if(isset($_COOKIE['ct_comments_safe_check'])){
271
  $c = $wpdb->get_results("
272
  SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
273
- FROM wp_comments as comm
274
  WHERE
275
  (comm.comment_approved = '1' OR comm.comment_approved = '0')
276
  AND NOT EXISTS(
277
- SELECT comment_id meta_key
278
- FROM wp_commentmeta as meta
279
  WHERE comm.comment_ID = meta.comment_id AND (meta_key = 'ct_checked' OR meta_key = 'ct_bad')
280
  )
281
  ORDER BY comment_date_gmt
@@ -439,11 +442,11 @@ function ct_ajax_info_comments($direct_call = false){
439
  if(isset($_COOKIE['ct_comments_safe_check'])){
440
  $res = $wpdb->get_results("
441
  SELECT COUNT(DISTINCT comment_ID) AS cnt
442
- FROM `wp_comments` AS comm
443
  WHERE comm.comment_approved IN ('1','0')".
444
  (!empty($meta)
445
  ? " AND EXISTS (SELECT comment_id, meta_key
446
- FROM wp_commentmeta meta
447
  WHERE comm.comment_ID = meta.comment_id AND meta_key = '$meta')"
448
  : '').
449
  (isset($from_date, $till_date)
@@ -614,7 +617,7 @@ function ct_ajax_clear_comments(){
614
  check_ajax_referer( 'ct_secret_nonce', 'security' );
615
  global $wpdb;
616
  $wpdb->query("DELETE
617
- FROM $wpdb->commentmeta
618
  WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
619
  die();
620
  }
69
  <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
70
  <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
71
  </div>
72
+ <br>
73
+ <?php ct_input_get_premium(); ?>
74
  </div>
75
 
76
  <!-- Cooling notice -->
242
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .' (100)</button> ' : '';
243
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_delete_comments">'. __('Delete comments', 'cleantalk') .' (110)</button>' : '';
244
 
245
+ if($cnt_spam > 0){
246
  echo "<div id='ct_search_info'>"
247
  ."<br />"
248
  .__('There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.', 'cleantalk')
249
  ."</div>";
250
+ }
251
  ?>
252
  <div>
253
  <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
273
  if(isset($_COOKIE['ct_comments_safe_check'])){
274
  $c = $wpdb->get_results("
275
  SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
276
+ FROM {$wpdb->comments} as comm
277
  WHERE
278
  (comm.comment_approved = '1' OR comm.comment_approved = '0')
279
  AND NOT EXISTS(
280
+ SELECT comment_id, meta_key
281
+ FROM {$wpdb->commentmeta} as meta
282
  WHERE comm.comment_ID = meta.comment_id AND (meta_key = 'ct_checked' OR meta_key = 'ct_bad')
283
  )
284
  ORDER BY comment_date_gmt
442
  if(isset($_COOKIE['ct_comments_safe_check'])){
443
  $res = $wpdb->get_results("
444
  SELECT COUNT(DISTINCT comment_ID) AS cnt
445
+ FROM {$wpdb->comments} AS comm
446
  WHERE comm.comment_approved IN ('1','0')".
447
  (!empty($meta)
448
  ? " AND EXISTS (SELECT comment_id, meta_key
449
+ FROM {$wpdb->commentmeta} meta
450
  WHERE comm.comment_ID = meta.comment_id AND meta_key = '$meta')"
451
  : '').
452
  (isset($from_date, $till_date)
617
  check_ajax_referer( 'ct_secret_nonce', 'security' );
618
  global $wpdb;
619
  $wpdb->query("DELETE
620
+ FROM {$wpdb->commentmeta}
621
  WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
622
  die();
623
  }
inc/cleantalk-common.php CHANGED
@@ -690,6 +690,9 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
690
  'user_login-',
691
  // Contact Form 7
692
  '_wpcf7',
 
 
 
693
  );
694
 
695
  // Reset $message if we have a sign-up data
690
  'user_login-',
691
  // Contact Form 7
692
  '_wpcf7',
693
+ 'ebd_settings',
694
+ 'ebd_downloads_',
695
+ 'ecole_origine',
696
  );
697
 
698
  // Reset $message if we have a sign-up data
inc/cleantalk-public.php CHANGED
@@ -2351,6 +2351,11 @@ function ct_enqueue_scripts_public($hook){
2351
  'set_cookies_flag' => empty($ct_options['set_cookies']) ? false : true,
2352
  'blog_home' => get_home_url().'/',
2353
  ));
 
 
 
 
 
2354
  }
2355
  }
2356
  }
2351
  'set_cookies_flag' => empty($ct_options['set_cookies']) ? false : true,
2352
  'blog_home' => get_home_url().'/',
2353
  ));
2354
+
2355
+ wp_localize_script('ct_public', 'apbctDebug', array(
2356
+ 'reload' => false,
2357
+ 'reload_time' => 10000,
2358
+ ));
2359
  }
2360
  }
2361
  }
inc/cleantalk-users.php CHANGED
@@ -69,6 +69,8 @@ function ct_show_users_page(){
69
  <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
70
  <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
71
  </div>
 
 
72
  </div>
73
 
74
  <!-- Cooling notice -->
@@ -238,11 +240,12 @@ function ct_show_users_page(){
238
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class=" ct_to_hide button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). ' (100)</button> ' : '';
239
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="ct_to_hide button" id="ct_delete_users">'. __('Delete accounts', 'cleantalk'). ' (110)</button><br />' : '';
240
 
241
- if($cnt_spam1 > 0)
242
  echo "<div id='ct_search_info'>"
243
  ."<br />"
244
  .__("There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.", 'cleantalk')
245
  ."</div>";
 
246
  ?>
247
  <div>
248
  <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
@@ -613,7 +616,7 @@ function ct_ajax_clear_users()
613
  {
614
  check_ajax_referer( 'ct_secret_nonce', 'security' );
615
  global $wpdb;
616
- $wpdb->query("delete from $wpdb->usermeta where meta_key='ct_checked' or meta_key='ct_marked_as_spam' or meta_key='ct_bad';");
617
  die();
618
  }
619
 
69
  <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
70
  <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
71
  </div>
72
+ <br>
73
+ <?php ct_input_get_premium(); ?>
74
  </div>
75
 
76
  <!-- Cooling notice -->
240
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class=" ct_to_hide button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). ' (100)</button> ' : '';
241
  echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="ct_to_hide button" id="ct_delete_users">'. __('Delete accounts', 'cleantalk'). ' (110)</button><br />' : '';
242
 
243
+ if($cnt_spam1 > 0){
244
  echo "<div id='ct_search_info'>"
245
  ."<br />"
246
  .__("There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.", 'cleantalk')
247
  ."</div>";
248
+ }
249
  ?>
250
  <div>
251
  <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
616
  {
617
  check_ajax_referer( 'ct_secret_nonce', 'security' );
618
  global $wpdb;
619
+ $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
620
  die();
621
  }
622
 
js/apbct-public.js CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  var ct_date = new Date(),
2
  ctTimeMs = new Date().getTime(),
3
  ctMouseEventTimerFlag = true, //Reading interval flag
1
+ if(+apbctDebug.reload){
2
+ setTimeout(function(){
3
+ location.reload();
4
+ }, +apbctDebug.reload_time);
5
+ }
6
+
7
  var ct_date = new Date(),
8
  ctTimeMs = new Date().getTime(),
9
  ctMouseEventTimerFlag = true, //Reading interval flag
lib/CleantalkSFW.php CHANGED
@@ -64,7 +64,8 @@ class CleantalkSFW extends CleantalkHelper
64
  $result = !empty($result) ? $result : array();
65
 
66
  if(isset($_GET['sfw_test_ip'])){
67
- $result['sfw_test'] = $_GET['sfw_test_ip'];
 
68
  }
69
 
70
  return $result;
64
  $result = !empty($result) ? $result : array();
65
 
66
  if(isset($_GET['sfw_test_ip'])){
67
+ if(self::ip_validate($_GET['sfw_test_ip']) !== false)
68
+ $result['sfw_test'] = $_GET['sfw_test_ip'];
69
  }
70
 
71
  return $result;
lib/CleantalkUpgrader.php CHANGED
@@ -1,24 +1,21 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
3
  class CleantalkUpgrader extends Plugin_Upgrader
4
  {
5
- /**
6
- * Plugin upgrade result.
7
- *
8
- * @since 2.8.0
9
- * @var array|WP_Error $result
10
- *
11
- * @see WP_Upgrader::$result
12
- */
13
  public $result;
14
 
15
  public $apbct_result = 'OK';
16
 
17
- /**
18
- * Initialize the upgrade strings.
19
- *
20
- * @since 2.8.0
21
- */
22
  public function upgrade_strings() {
23
  $this->strings['up_to_date'] = 'UP_TO_DATE';
24
  $this->strings['no_package'] = 'PACKAGE_NOT_AVAILABLE';
@@ -29,10 +26,10 @@ class CleantalkUpgrader extends Plugin_Upgrader
29
  }
30
 
31
  public function run( $options ) {
32
-
33
  $defaults = array(
34
- 'package' => '', // Please always pass this.
35
- 'destination' => '', // And this
36
  'clear_destination' => false,
37
  'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
38
  'clear_working' => true,
@@ -117,4 +114,41 @@ class CleantalkUpgrader extends Plugin_Upgrader
117
 
118
  return $result;
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  }
1
  <?php
2
 
3
+ /**
4
+ * Antispam by CleanTalk plugin
5
+ *
6
+ * Class that extends the WP Core Plugin_Upgrader.
7
+ *
8
+ * @copyright : http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since : 1.0.0
10
+ */
11
+
12
  class CleantalkUpgrader extends Plugin_Upgrader
13
  {
14
+
 
 
 
 
 
 
 
15
  public $result;
16
 
17
  public $apbct_result = 'OK';
18
 
 
 
 
 
 
19
  public function upgrade_strings() {
20
  $this->strings['up_to_date'] = 'UP_TO_DATE';
21
  $this->strings['no_package'] = 'PACKAGE_NOT_AVAILABLE';
26
  }
27
 
28
  public function run( $options ) {
29
+
30
  $defaults = array(
31
+ 'package' => '',
32
+ 'destination' => '',
33
  'clear_destination' => false,
34
  'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
35
  'clear_working' => true,
114
 
115
  return $result;
116
  }
117
+
118
+ public function rollback( $plugin, $args = array() ) {
119
+
120
+ $defaults = array(
121
+ 'clear_update_cache' => true,
122
+ );
123
+ $parsed_args = wp_parse_args( $args, $defaults );
124
+
125
+ $this->init();
126
+ $this->upgrade_strings();
127
+
128
+ // add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 );
129
+ add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 );
130
+
131
+ $result = $this->run( array(
132
+ 'package' => 'https://downloads.wordpress.org/plugin/' . $this->skin->options['plugin_slug'] . '.' . $this->skin->options['prev_version'] . '.zip',
133
+ 'destination' => WP_PLUGIN_DIR,
134
+ 'clear_destination' => true,
135
+ 'clear_working' => true,
136
+ 'hook_extra' => array(
137
+ 'plugin' => $plugin,
138
+ 'type' => 'plugin',
139
+ 'action' => 'update',
140
+ ),
141
+ ));
142
+
143
+ // remove_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ) );
144
+ remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ) );
145
+
146
+ if(!$this->result || is_wp_error($this->result)){
147
+ return $this->result;
148
+ }
149
+
150
+ wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); // Refresh of plugin update information.
151
+
152
+ return $result;
153
+ }
154
  }
lib/CleantalkUpgraderSkin.php CHANGED
@@ -35,6 +35,10 @@ class CleantalkUpgraderSkin extends WP_Upgrader_Skin
35
  * @param string|WP_Error $errors
36
  */
37
  public function error($errors) {
38
- $this->upgrader->apbct_result = $this->upgrader->strings[$errors];
 
 
 
 
39
  }
40
  }
35
  * @param string|WP_Error $errors
36
  */
37
  public function error($errors) {
38
+ if(is_wp_error($errors)){
39
+ $this->upgrader->apbct_result = $errors->get_error_code();
40
+ }else{
41
+ $this->upgrader->apbct_result = $this->upgrader->strings[$errors];
42
+ }
43
  }
44
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, sartemd174
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 4.9.4
6
- Stable tag: 5.92.2
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.
@@ -519,6 +519,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
519
  10. Website's options.
520
 
521
  == Changelog ==
 
 
 
 
 
 
522
  = 5.92.2 March 23 2018 =
523
  * Fix: Error if cURL extension is disabled.
524
 
@@ -1564,6 +1570,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1564
  * First version
1565
 
1566
  == Upgrade Notice ==
 
 
 
 
 
 
1567
  = 5.92.2 March 23 2018 =
1568
  * Fix: Error if cURL extension is disabled.
1569
 
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 4.9.4
6
+ Stable tag: 5.93
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.
519
  10. Website's options.
520
 
521
  == Changelog ==
522
+ = 5.93 April 9 2018 =
523
+ * Fix: SpamFirewall IP detection.
524
+ * Fix: Contact Form 7. False positives.
525
+ * Mod: Autoupdate function improved.
526
+ * Minor fixes.
527
+
528
  = 5.92.2 March 23 2018 =
529
  * Fix: Error if cURL extension is disabled.
530
 
1570
  * First version
1571
 
1572
  == Upgrade Notice ==
1573
+ = 5.93 April 9 2018 =
1574
+ * Fix: SpamFirewall IP detection.
1575
+ * Fix: Contact Form 7. False positives.
1576
+ * Mod: Autoupdate function improved.
1577
+ * Minor fixes.
1578
+
1579
  = 5.92.2 March 23 2018 =
1580
  * Fix: Error if cURL extension is disabled.
1581