Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.99

Version Description

July 10 2018 = * Fix: WooCommerce false positives. * Fix: SpamFireWall IP detection. * Minor fixes.

Download this release

Release Info

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

Code changes from version 5.98 to 5.99

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.98
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  $cleantalk_executed = false;
12
 
13
- define('APBCT_VERSION', '5.98');
14
- define('APBCT_AGENT', 'wordpress-598');
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')
@@ -172,7 +172,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
172
 
173
  $is_sfw_check = true;
174
  $sfw = new CleantalkSFW();
175
- $sfw->ip_array = CleantalkSFW::ip_get();
176
 
177
  foreach($sfw->ip_array as $ct_cur_ip){
178
  if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$ct_options['apikey'])){
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.99
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  $cleantalk_executed = false;
12
 
13
+ define('APBCT_VERSION', '5.99');
14
+ define('APBCT_AGENT', 'wordpress-599');
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')
172
 
173
  $is_sfw_check = true;
174
  $sfw = new CleantalkSFW();
175
+ $sfw->ip_array = (array)CleantalkSFW::ip_get(array('real'), true);
176
 
177
  foreach($sfw->ip_array as $ct_cur_ip){
178
  if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$ct_options['apikey'])){
inc/cleantalk-admin.php CHANGED
@@ -352,6 +352,14 @@ function ct_account_status_check(){
352
  $ct_data['auto_update_app'] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
353
  }
354
 
 
 
 
 
 
 
 
 
355
  if (isset($result['license_trial'])){
356
  $ct_data['license_trial'] = $result['license_trial'];
357
  }
@@ -637,7 +645,7 @@ function ct_input_daily_counter() {
637
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_daily_counter1' name='cleantalk_settings[daily_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_daily_counter1'> ".__('Yes')."</label>";
638
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
639
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_daily_counter0' name='cleantalk_settings[daily_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_daily_counter0'> ".__('No')."</label>";
640
- ct_add_descriptions_to_fields(sprintf(__('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'), $ct_options['all_time_counter']));
641
  }
642
 
643
  function ct_input_sfw_counter() {
@@ -664,7 +672,7 @@ function ct_send_connection_reports() {
664
  $value = $value=(isset($ct_options['send_connection_reports']) ? @intval($ct_options['send_connection_reports']) : 0);
665
  echo "<div id='cleantalk_anchor3' style='display:none'></div>";
666
  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>";
667
- 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']));
668
  echo "<script>
669
  jQuery(document).ready(function(){
670
  jQuery('#cleantalk_anchor3').parent().parent().children().first().hide();
@@ -683,8 +691,8 @@ function ct_async_js() {
683
 
684
  $value = $value=(isset($ct_options['async_js']) ? @intval($ct_options['async_js']) : 0);
685
  echo "<div id='cleantalk_anchor4' style='display:none'></div>";
686
- echo "<input type='checkbox' id='connection_reports1' name='cleantalk_settings[async_js]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='connection_reports1'> " . __('Async script loading', 'cleantalk') . "</label>";
687
- ct_add_descriptions_to_fields(sprintf(__('Use async loading for CleanTalk\'s scripts. Warning: This could reduce filtration quality.', 'cleantalk'), $ct_options['spam_firewall']));
688
  echo "<script>
689
  jQuery(document).ready(function(){
690
  jQuery('#cleantalk_anchor4').parent().parent().children().first().hide();
@@ -774,9 +782,22 @@ function ct_add_admin_menu( $wp_admin_bar ) {
774
  $sfw_counter_str='<span style="color: white;" title="'.__('All / Blocked events. Access attempts regitred by SpamFireWall counted since the last plugin activation.', 'cleantalk').'"><span style="color: white;"> | SpamFireWall: ' .$sfw_counter['all']. '</span> / <span style="color: red;">' .$sfw_counter['blocked']. '</span></span>';
775
  }
776
 
 
 
 
 
 
777
  $args = array(
778
  'id' => 'ct_parent_node',
779
- 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.$sfw_counter_str.'</div></div>' //You could change widget string here by simply deleting variables
 
 
 
 
 
 
 
 
780
  );
781
  $wp_admin_bar->add_node( $args );
782
 
@@ -1782,8 +1803,14 @@ function cleantalk_admin_notice_message(){
1782
  $show_notice = false;
1783
  }
1784
 
 
 
 
 
1785
  //"Trial period ends" notice from apbct_admin_init().api_method__notice_paid_till()
1786
  if ($show_notice && $show_ct_notice_trial == 1) {
 
 
1787
  echo '<div class="error">
1788
  <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
1789
  "<a href='{$settings_link}'>$ct_plugin_name</a>",
@@ -1791,6 +1818,16 @@ function cleantalk_admin_notice_message(){
1791
  '</h3>
1792
  </div>';
1793
  $show_notice = false;
 
 
 
 
 
 
 
 
 
 
1794
  }
1795
 
1796
  //Renew notice from apbct_admin_init().api_method__notice_paid_till()
352
  $ct_data['auto_update_app'] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
353
  }
354
 
355
+ if (isset($result['service_id']))
356
+ $ct_data['service_id'] = (int)$result['service_id'];
357
+
358
+ if (isset($result['moderate']) && $result['moderate'] == 1)
359
+ $ct_data['moderate'] = 1;
360
+ else
361
+ $ct_data['moderate'] = 0;
362
+
363
  if (isset($result['license_trial'])){
364
  $ct_data['license_trial'] = $result['license_trial'];
365
  }
645
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_daily_counter1' name='cleantalk_settings[daily_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_daily_counter1'> ".__('Yes')."</label>";
646
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
647
  echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_daily_counter0' name='cleantalk_settings[daily_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_daily_counter0'> ".__('No')."</label>";
648
+ ct_add_descriptions_to_fields(__('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'));
649
  }
650
 
651
  function ct_input_sfw_counter() {
672
  $value = $value=(isset($ct_options['send_connection_reports']) ? @intval($ct_options['send_connection_reports']) : 0);
673
  echo "<div id='cleantalk_anchor3' style='display:none'></div>";
674
  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>";
675
+ ct_add_descriptions_to_fields(__("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'));
676
  echo "<script>
677
  jQuery(document).ready(function(){
678
  jQuery('#cleantalk_anchor3').parent().parent().children().first().hide();
691
 
692
  $value = $value=(isset($ct_options['async_js']) ? @intval($ct_options['async_js']) : 0);
693
  echo "<div id='cleantalk_anchor4' style='display:none'></div>";
694
+ echo "<input type='checkbox' id='async_js' name='cleantalk_settings[async_js]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='async_js'> " . __('Async script loading', 'cleantalk') . "</label>";
695
+ ct_add_descriptions_to_fields(__('Use async loading for CleanTalk\'s scripts. Warning: This could reduce filtration quality.', 'cleantalk'));
696
  echo "<script>
697
  jQuery(document).ready(function(){
698
  jQuery('#cleantalk_anchor4').parent().parent().children().first().hide();
782
  $sfw_counter_str='<span style="color: white;" title="'.__('All / Blocked events. Access attempts regitred by SpamFireWall counted since the last plugin activation.', 'cleantalk').'"><span style="color: white;"> | SpamFireWall: ' .$sfw_counter['all']. '</span> / <span style="color: red;">' .$sfw_counter['blocked']. '</span></span>';
783
  }
784
 
785
+ $show_some = $ct_data['show_ct_notice_trial'] == 1 && isset($ct_data['moderate'],$ct_data['service_id']) && $ct_data['moderate']== 0 && $ct_data['service_id']%2 == 0
786
+ ? true
787
+ : false;
788
+ $user_token = (isset($ct_data['user_token']) && $ct_data['user_token'] != '' ? "&user_token={$ct_data['user_token']}" : "");
789
+
790
  $args = array(
791
  'id' => 'ct_parent_node',
792
+ 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" />'
793
+ .'<div style="margin: auto 7px;" class="ab-item alignright">'
794
+ .'<div class="ab-label" id="ct_stats">'
795
+ .($show_some
796
+ ? "<span><a style='color: red;' href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\">Renew Anti-Spam</a></span>"
797
+ : '<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.$sfw_counter_str
798
+ )
799
+ .'</div>'
800
+ .'</div>' //You could change widget string here by simply deleting variables
801
  );
802
  $wp_admin_bar->add_node( $args );
803
 
1803
  $show_notice = false;
1804
  }
1805
 
1806
+ $test = isset($ct_data['service_id'], $ct_data['moderate']) && $ct_data['service_id']%2 == 0 && $ct_data['moderate'] == 0
1807
+ ? true
1808
+ : false;
1809
+
1810
  //"Trial period ends" notice from apbct_admin_init().api_method__notice_paid_till()
1811
  if ($show_notice && $show_ct_notice_trial == 1) {
1812
+ if($test){
1813
+ if(isset($_GET['page']) && in_array($_GET['page'], array('cleantalk','ct_check_users','ct_check_spam'))){
1814
  echo '<div class="error">
1815
  <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
1816
  "<a href='{$settings_link}'>$ct_plugin_name</a>",
1818
  '</h3>
1819
  </div>';
1820
  $show_notice = false;
1821
+ }
1822
+ }else{
1823
+ echo '<div class="error">
1824
+ <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
1825
+ "<a href='{$settings_link}'>$ct_plugin_name</a>",
1826
+ "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") .
1827
+ '</h3>
1828
+ </div>';
1829
+ $show_notice = false;
1830
+ }
1831
  }
1832
 
1833
  //Renew notice from apbct_admin_init().api_method__notice_paid_till()
inc/cleantalk-common.php CHANGED
@@ -487,6 +487,8 @@ function ct_def_data() {
487
  'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
488
  'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
489
  'ip_license' => 0,
 
 
490
  'sfw_counter' => array(
491
  'all' => 0,
492
  'blocked' => 0
487
  'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
488
  'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
489
  'ip_license' => 0,
490
+ 'service_id' => 0,
491
+ 'moderate' => 0,
492
  'sfw_counter' => array(
493
  'all' => 0,
494
  'blocked' => 0
inc/cleantalk-public.php CHANGED
@@ -2029,8 +2029,9 @@ function ct_contact_form_validate() {
2029
  // Skip the test if it's WooCommerce and the checkout test unset
2030
  if(strpos($_SERVER['REQUEST_URI'], 'wc-ajax=checkout') !== false ||
2031
  strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false ||
2032
- (isset($_POST['_wp_http_referer']) && strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false))
2033
- {
 
2034
  $post_info['comment_type'] = 'order';
2035
  if($ct_options['wc_checkout_test'] == 0){
2036
  return null;
2029
  // Skip the test if it's WooCommerce and the checkout test unset
2030
  if(strpos($_SERVER['REQUEST_URI'], 'wc-ajax=checkout') !== false ||
2031
  strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false ||
2032
+ (isset($_POST['_wp_http_referer']) && strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false) ||
2033
+ !empty($_POST['woocommerce_checkout_place_order'])
2034
+ ){
2035
  $post_info['comment_type'] = 'order';
2036
  if($ct_options['wc_checkout_test'] == 0){
2037
  return null;
lib/CleantalkHelper.php CHANGED
@@ -17,6 +17,8 @@ class CleantalkHelper
17
  '162.158.0.0/15',
18
  '172.64.0.0/13',
19
  '173.245.48.0/20',
 
 
20
  '188.114.96.0/20',
21
  '190.93.240.0/20',
22
  '197.234.240.0/22',
17
  '162.158.0.0/15',
18
  '172.64.0.0/13',
19
  '173.245.48.0/20',
20
+ '185.93.231.18/20', // User fix
21
+ '185.220.101.46/20', // User fix
22
  '188.114.96.0/20',
23
  '190.93.240.0/20',
24
  '197.234.240.0/22',
lib/CleantalkSFW.php CHANGED
@@ -59,7 +59,7 @@ class CleantalkSFW extends CleantalkHelper
59
  */
60
  static public function ip_get($ips_input = array('real', 'remote_addr', 'x_forwarded_for', 'x_real_ip', 'cloud_flare'), $v4_only = true){
61
 
62
- $result = parent::ip_get($ips_input, $v4_only);
63
 
64
  $result = !empty($result) ? $result : array();
65
 
59
  */
60
  static public function ip_get($ips_input = array('real', 'remote_addr', 'x_forwarded_for', 'x_real_ip', 'cloud_flare'), $v4_only = true){
61
 
62
+ $result = (array)parent::ip_get($ips_input, $v4_only);
63
 
64
  $result = !empty($result) ? $result : array();
65
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
- Stable tag: 5.98
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -516,6 +516,11 @@ Yes, it is. Please read this article,
516
  10. Website's options.
517
 
518
  == Changelog ==
 
 
 
 
 
519
  = 5.98 June 27 2018 =
520
  * Fix: WooCommerce: Theme exclusion.
521
  * Fix: Public GDPR JS code.
@@ -1606,6 +1611,11 @@ Yes, it is. Please read this article,
1606
  * First version
1607
 
1608
  == Upgrade Notice ==
 
 
 
 
 
1609
  = 5.98 June 27 2018 =
1610
  * Fix: WooCommerce: Exclusion.
1611
  * Fix: Public GDPR JS code.
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 4.9
6
+ Stable tag: 5.99
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
516
  10. Website's options.
517
 
518
  == Changelog ==
519
+ = 5.99 July 10 2018 =
520
+ * Fix: WooCommerce false positives.
521
+ * Fix: SpamFireWall IP detection.
522
+ * Minor fixes.
523
+
524
  = 5.98 June 27 2018 =
525
  * Fix: WooCommerce: Theme exclusion.
526
  * Fix: Public GDPR JS code.
1611
  * First version
1612
 
1613
  == Upgrade Notice ==
1614
+ = 5.99 July 10 2018 =
1615
+ * Fix: WooCommerce false positives.
1616
+ * Fix: SpamFireWall IP detection.
1617
+ * Minor fixes.
1618
+
1619
  = 5.98 June 27 2018 =
1620
  * Fix: WooCommerce: Exclusion.
1621
  * Fix: Public GDPR JS code.