Spam protection, AntiSpam, FireWall by CleanTalk - Version 4.24.1

Version Description

Download this release

Release Info

Developer Vlad Cleantalk
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 4.24.1
Comparing to
See all releases

Code changes from version 5.24 to 4.24.1

cleantalk-admin.php CHANGED
@@ -287,6 +287,7 @@ else
287
  add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
288
  add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
289
  add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
 
290
  }
291
 
292
  /**
@@ -630,6 +631,26 @@ function ct_input_check_external() {
630
  @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['check_external']));
631
  }
632
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
633
 
634
  /**
635
  * Admin callback function - Plugin parameters validator
@@ -916,8 +937,8 @@ if (!function_exists ( 'ct_plugin_action_links')) {
916
  function ct_update_option($option_name) {
917
  global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
918
 
919
- $ct_options = ct_get_options();
920
- $ct_data = ct_get_data();
921
 
922
  if($option_name !== 'cleantalk_settings') {
923
  return;
287
  add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
288
  add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
289
  add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
290
+ //add_settings_field('cleantalk_show_link', __('Show link to CleanTalk on comment forms', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_anti_spam');
291
  }
292
 
293
  /**
631
  @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['check_external']));
632
  }
633
 
634
+ function ct_input_show_link() {
635
+ global $ct_options, $ct_data;
636
+
637
+ $ct_options = ct_get_options();
638
+ $ct_data = ct_get_data();
639
+
640
+ if(isset($ct_options['show_link']))
641
+ {
642
+ $value = @intval($ct_options['show_link']);
643
+ }
644
+ else
645
+ {
646
+ $value=0;
647
+ }
648
+ echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
649
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
650
+ echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";
651
+ @admin_addDescriptionsFields(sprintf(__("Place a small link under comments form, it lets know what's anti-spam tool protects your site", 'cleantalk'), $ct_options['show_link']));
652
+ }
653
+
654
 
655
  /**
656
  * Admin callback function - Plugin parameters validator
937
  function ct_update_option($option_name) {
938
  global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
939
 
940
+ $ct_options = ct_get_options(true);
941
+ $ct_data = ct_get_data(true);
942
 
943
  if($option_name !== 'cleantalk_settings') {
944
  return;
cleantalk-common.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $ct_agent_version = 'wordpress-524';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -355,9 +355,9 @@ function ct_get_checkjs_value($random_key = false) {
355
  * Inner function - Current Cleantalk options
356
  * @return mixed[] Array of options
357
  */
358
- function ct_get_options() {
359
  global $ct_options;
360
- if(isset($ct_options) && isset($ct_options['apikey']))
361
  {
362
  return $ct_options;
363
  }
@@ -400,9 +400,9 @@ function ct_def_options() {
400
  * Inner function - Current Cleantalk data
401
  * @return mixed[] Array of options
402
  */
403
- function ct_get_data() {
404
  global $ct_data;
405
- if(isset($ct_data) && isset($ct_data['js_keys']))
406
  {
407
  return $ct_data;
408
  }
1
  <?php
2
 
3
+ $ct_agent_version = 'wordpress-5241';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
355
  * Inner function - Current Cleantalk options
356
  * @return mixed[] Array of options
357
  */
358
+ function ct_get_options($force=false) {
359
  global $ct_options;
360
+ if(!$force && isset($ct_options) && isset($ct_options['apikey']) && strlen($ct_options['apikey'])>3)
361
  {
362
  return $ct_options;
363
  }
400
  * Inner function - Current Cleantalk data
401
  * @return mixed[] Array of options
402
  */
403
+ function ct_get_data($force=false) {
404
  global $ct_data;
405
+ if(!$force && isset($ct_data) && isset($ct_data['js_keys']))
406
  {
407
  return $ct_data;
408
  }
cleantalk-public.php CHANGED
@@ -468,7 +468,7 @@ function ct_preprocess_comment($comment) {
468
  $ct_options = ct_get_options();
469
  $ct_data = ct_get_data();
470
 
471
- if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done) {
472
  return $comment;
473
  }
474
 
468
  $ct_options = ct_get_options();
469
  $ct_data = ct_get_data();
470
 
471
+ if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false)) {
472
  return $comment;
473
  }
474
 
cleantalk.class.php CHANGED
@@ -594,7 +594,7 @@ class Cleantalk {
594
  */
595
  private function sendRequest($data = null, $url, $server_timeout = 3) {
596
  // Convert to array
597
- $data = json_decode(json_encode($data), true);
598
 
599
  // Convert to JSON
600
  $data = json_encode($data);
@@ -697,7 +697,7 @@ class Cleantalk {
697
  $msg->all_headers=json_encode(apache_request_headers());
698
  //$msg->remote_addr=$_SERVER['REMOTE_ADDR'];
699
  //$msg->sender_info['remote_addr']=$_SERVER['REMOTE_ADDR'];
700
- $si=json_decode($msg->sender_info,true);
701
  $si['remote_addr']=$_SERVER['REMOTE_ADDR'];
702
  $msg->sender_info=json_encode($si);
703
  if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
@@ -889,7 +889,7 @@ class Cleantalk {
889
  if (!$data_ip || !preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $data_ip)) {
890
  return $data_ip;
891
  }
892
- if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
893
 
894
  $forwarded_ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
895
 
@@ -923,7 +923,8 @@ class Cleantalk {
923
  }
924
  }
925
 
926
- return $data_ip;
 
927
  }
928
 
929
  /**
@@ -1117,3 +1118,28 @@ if( !function_exists('apache_request_headers') )
1117
  return( $arh );
1118
  }
1119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  */
595
  private function sendRequest($data = null, $url, $server_timeout = 3) {
596
  // Convert to array
597
+ $data = (array)json_decode(json_encode($data), true);
598
 
599
  // Convert to JSON
600
  $data = json_encode($data);
697
  $msg->all_headers=json_encode(apache_request_headers());
698
  //$msg->remote_addr=$_SERVER['REMOTE_ADDR'];
699
  //$msg->sender_info['remote_addr']=$_SERVER['REMOTE_ADDR'];
700
+ $si=(array)json_decode($msg->sender_info,true);
701
  $si['remote_addr']=$_SERVER['REMOTE_ADDR'];
702
  $msg->sender_info=json_encode($si);
703
  if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
889
  if (!$data_ip || !preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $data_ip)) {
890
  return $data_ip;
891
  }
892
+ /*if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
893
 
894
  $forwarded_ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
895
 
923
  }
924
  }
925
 
926
+ return $data_ip;*/
927
+ return cleantalk_get_real_ip();
928
  }
929
 
930
  /**
1118
  return( $arh );
1119
  }
1120
  }
1121
+
1122
+ function cleantalk_get_real_ip()
1123
+ {
1124
+ if ( function_exists( 'apache_request_headers' ) )
1125
+ {
1126
+ $headers = apache_request_headers();
1127
+ }
1128
+ else
1129
+ {
1130
+ $headers = $_SERVER;
1131
+ }
1132
+ if ( array_key_exists( 'X-Forwarded-For', $headers ) && filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) )
1133
+ {
1134
+ $the_ip = $headers['X-Forwarded-For'];
1135
+ }
1136
+ elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) && filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ))
1137
+ {
1138
+ $the_ip = $headers['HTTP_X_FORWARDED_FOR'];
1139
+ }
1140
+ else
1141
+ {
1142
+ $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
1143
+ }
1144
+ return $the_ip;
1145
+ }
cleantalk.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.24
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.24';
11
  $cleantalk_executed=false;
12
 
13
  if(defined('CLEANTALK_AJAX_USE_BUFFER'))
@@ -103,11 +103,24 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
103
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  if (is_admin())
108
  {
109
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
110
-
111
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
112
  add_action('admin_init', 'ct_admin_init', 1);
113
  add_action('admin_menu', 'ct_admin_add_page');
@@ -248,7 +261,7 @@ function ct_add_nocache_script()
248
 
249
  function ct_add_nocache_script_footer()
250
  {
251
- global $test_external_forms;
252
  print "<script async type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
253
  if($test_external_forms)
254
  {
@@ -298,4 +311,9 @@ if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
298
  $_POST['redirect_to']=$tmp;
299
  }
300
 
 
 
 
 
 
301
  ?>
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.24.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.24.1';
11
  $cleantalk_executed=false;
12
 
13
  if(defined('CLEANTALK_AJAX_USE_BUFFER'))
103
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
104
  }
105
 
106
+
107
+ if(isset($ct_options['show_link']))
108
+ {
109
+ $value = @intval($ct_options['show_link']);
110
+ }
111
+ else
112
+ {
113
+ $value=0;
114
+ }
115
+ if($value==1)
116
+ {
117
+ //add_action('comment_form_after', 'ct_show_comment_link');
118
+ }
119
+
120
 
121
  if (is_admin())
122
  {
123
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
 
124
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
125
  add_action('admin_init', 'ct_admin_init', 1);
126
  add_action('admin_menu', 'ct_admin_add_page');
261
 
262
  function ct_add_nocache_script_footer()
263
  {
264
+ global $test_external_forms, $cleantalk_plugin_version;
265
  print "<script async type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
266
  if($test_external_forms)
267
  {
311
  $_POST['redirect_to']=$tmp;
312
  }
313
 
314
+ function ct_show_comment_link()
315
+ {
316
+ print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>WordPress spam</a> blocked by CleanTalk</div>";
317
+ }
318
+
319
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, vlad-cleantalk
3
  Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
- Stable tag: 5.24
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -311,6 +311,10 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
311
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
312
 
313
  == Changelog ==
 
 
 
 
314
  = 5.24 2015-09-14 =
315
  * Backend interface fixes
316
  * Improvement for AJAX JavaScript spam checking
@@ -759,6 +763,10 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
759
  * First version
760
 
761
  == Upgrade Notice ==
 
 
 
 
762
  = 5.24 2015-09-14 =
763
  * Backend interface fixes
764
  * Improvement for AJAX JavaScript spam checking
3
  Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
+ Stable tag: 5.24.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
311
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
312
 
313
  == Changelog ==
314
+ = 5.24.1 2015-09-16 =
315
+ * Fixed some errors in frontend
316
+ * Fixed access key saving
317
+
318
  = 5.24 2015-09-14 =
319
  * Backend interface fixes
320
  * Improvement for AJAX JavaScript spam checking
763
  * First version
764
 
765
  == Upgrade Notice ==
766
+ = 5.24.1 2015-09-16 =
767
+ * Fixed some errors in frontend
768
+ * Fixed access key saving
769
+
770
  = 5.24 2015-09-14 =
771
  * Backend interface fixes
772
  * Improvement for AJAX JavaScript spam checking