Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.51

Version Description

2014-06-23 = * Added spam protection for registrations via plugin New User Approve by Josh Harrison. If the CleanTalk matched signup as spam this signup will be denied to placing in pending queue. * Added option "Use secure (SSL) connection to CleanTalk cloud". If the option enabled plugin will communicate with CleanTalk severs via 128bit encrypted data channel. So, if you have SSL protected webforms on website you can use this option to be sure that visitors personal data safely transmits to CleanTalk servers. * Fixed minor bug with loading backend functions.

Download this release

Release Info

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

Code changes from version 2.49 to 2.51

Files changed (5) hide show
  1. cleantalk-admin.php +29 -24
  2. cleantalk.class.php +41 -14
  3. cleantalk.php +49 -11
  4. i18n/cleantalk-ru_RU.mo +0 -0
  5. readme.txt +11 -1
cleantalk-admin.php CHANGED
@@ -22,7 +22,9 @@ function ct_admin_add_page() {
22
  * Admin action 'admin_init' - Add the admin settings and such
23
  */
24
  function ct_admin_init() {
25
- global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout, $pagenow, $ct_plugin_name;
 
 
26
 
27
  $show_ct_notice_trial = false;
28
  if (isset($_COOKIE[$ct_notice_trial_label])) {
@@ -36,12 +38,11 @@ function ct_admin_init() {
36
  $do_request = true;
37
  }
38
 
39
- $options = ct_get_options();
40
  $result = false;
41
- if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($options['apikey']) && $do_request) {
42
  $url = 'https://cleantalk.org/app_notice';
43
  $server_timeout = 2;
44
- $data['auth_key'] = $options['apikey'];
45
  $data['param'] = 'notice_paid_till';
46
 
47
  $ch = curl_init();
@@ -92,6 +93,7 @@ function ct_admin_init() {
92
  add_settings_section('cleantalk_settings_anti_spam', __('Anti-spam settings', 'cleantalk'), 'ct_section_settings_anti_spam', 'cleantalk');
93
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
94
  add_settings_field('cleantalk_autoPubRevelantMess', __('Publish relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
 
95
  add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
96
  add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
97
  add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
@@ -118,35 +120,35 @@ function ct_section_settings_anti_spam() {
118
  * @return null
119
  */
120
  function ct_input_autoPubRevelantMess () {
121
- $options = ct_get_options();
122
- $value = $options['autoPubRevelantMess'];
 
123
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
124
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
125
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess0' name='cleantalk_settings[autoPubRevelantMess]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess0'> " . __('No') . "</label>";
126
  admin_addDescriptionsFields(__('Relevant (not spam) comments from new authors will be automatic published at the blog', 'cleantalk'));
127
  }
128
  /**
129
- * @author Artem Leontiev
130
- * Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
131
  *
132
  * @return null
133
  */
134
- function ct_input_remove_old_spam() {
135
- $options = ct_get_options();
136
- $value = $options['remove_old_spam'];
137
- echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
 
138
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
139
- echo "<input type='radio' id='cleantalk_remove_old_spam0' name='cleantalk_settings[remove_old_spam]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam0'> " . __('No') . "</label>";
140
- admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $options['spam_store_days']));
141
  }
142
 
143
  /**
144
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
145
  */
146
  function ct_input_apikey() {
147
- $options = ct_get_options();
148
- $value = $options['apikey'];
149
-
150
  $def_value = '';
151
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
152
  if (ct_valid_key($value) === false) {
@@ -158,8 +160,9 @@ function ct_input_apikey() {
158
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
159
  */
160
  function ct_input_comments_test() {
161
- $options = ct_get_options();
162
- $value = $options['comments_test'];
 
163
  echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
164
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
165
  echo "<input type='radio' id='cleantalk_comments_test0' name='cleantalk_settings[comments_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_comments_test0'> " . __('No') . "</label>";
@@ -170,8 +173,9 @@ function ct_input_comments_test() {
170
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
171
  */
172
  function ct_input_registrations_test() {
173
- $options = ct_get_options();
174
- $value = $options['registrations_test'];
 
175
  echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
176
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
177
  echo "<input type='radio' id='cleantalk_registrations_test0' name='cleantalk_settings[registrations_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_registrations_test0'> " . __('No') . "</label>";
@@ -182,8 +186,9 @@ function ct_input_registrations_test() {
182
  * Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
183
  */
184
  function ct_input_contact_forms_test() {
185
- $options = ct_get_options();
186
- $value = $options['contact_forms_test'];
 
187
  echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
188
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
189
  echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
@@ -260,7 +265,7 @@ function admin_notice_message(){
260
  if($show_ct_notice_online === 'Y'){
261
  echo __("Please don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
262
  }else{
263
- echo __("Wrong </b><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b><b> access key! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
264
  }
265
  echo '</b></h3></div>';
266
  }
22
  * Admin action 'admin_init' - Add the admin settings and such
23
  */
24
  function ct_admin_init() {
25
+ global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout, $pagenow, $ct_plugin_name, $ct_options;
26
+
27
+ $ct_options = ct_get_options();
28
 
29
  $show_ct_notice_trial = false;
30
  if (isset($_COOKIE[$ct_notice_trial_label])) {
38
  $do_request = true;
39
  }
40
 
 
41
  $result = false;
42
+ if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey']) && $do_request) {
43
  $url = 'https://cleantalk.org/app_notice';
44
  $server_timeout = 2;
45
+ $data['auth_key'] = $ct_options['apikey'];
46
  $data['param'] = 'notice_paid_till';
47
 
48
  $ch = curl_init();
93
  add_settings_section('cleantalk_settings_anti_spam', __('Anti-spam settings', 'cleantalk'), 'ct_section_settings_anti_spam', 'cleantalk');
94
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
95
  add_settings_field('cleantalk_autoPubRevelantMess', __('Publish relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
96
+ add_settings_field('cleantalk_ssl_on', __('Use secure (SSL) connection to CleanTalk cloud', 'cleantalk'), 'ct_radio_ssl_on', 'cleantalk', 'cleantalk_settings_main');
97
  add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
98
  add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
99
  add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
120
  * @return null
121
  */
122
  function ct_input_autoPubRevelantMess () {
123
+ global $ct_options;
124
+
125
+ $value = $ct_options['autoPubRevelantMess'];
126
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
127
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
128
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess0' name='cleantalk_settings[autoPubRevelantMess]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess0'> " . __('No') . "</label>";
129
  admin_addDescriptionsFields(__('Relevant (not spam) comments from new authors will be automatic published at the blog', 'cleantalk'));
130
  }
131
  /**
132
+ * Admin callback function - Display secure connection options
 
133
  *
134
  * @return null
135
  */
136
+ function ct_radio_ssl_on() {
137
+ global $ct_options;
138
+
139
+ $value = $ct_options['ssl_on'];
140
+ echo "<input type='radio' id='cleantalk_ssl_on1' name='cleantalk_settings[ssl_on]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_ssl_on1'> " . __('Yes') . "</label>";
141
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
142
+ echo "<input type='radio' id='cleantalk_ssl_on0' name='cleantalk_settings[ssl_on]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_ssl_on0'> " . __('No') . "</label>";
 
143
  }
144
 
145
  /**
146
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
147
  */
148
  function ct_input_apikey() {
149
+ global $ct_options;
150
+
151
+ $value = $ct_options['apikey'];
152
  $def_value = '';
153
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
154
  if (ct_valid_key($value) === false) {
160
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
161
  */
162
  function ct_input_comments_test() {
163
+ global $ct_options;
164
+
165
+ $value = $ct_options['comments_test'];
166
  echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
167
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
168
  echo "<input type='radio' id='cleantalk_comments_test0' name='cleantalk_settings[comments_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_comments_test0'> " . __('No') . "</label>";
173
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
174
  */
175
  function ct_input_registrations_test() {
176
+ global $ct_options;
177
+
178
+ $value = $ct_options['registrations_test'];
179
  echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
180
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
181
  echo "<input type='radio' id='cleantalk_registrations_test0' name='cleantalk_settings[registrations_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_registrations_test0'> " . __('No') . "</label>";
186
  * Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
187
  */
188
  function ct_input_contact_forms_test() {
189
+ global $ct_options;
190
+
191
+ $value = $ct_options['contact_forms_test'];
192
  echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
193
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
194
  echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
265
  if($show_ct_notice_online === 'Y'){
266
  echo __("Please don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
267
  }else{
268
+ echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
269
  }
270
  echo '</b></h3></div>';
271
  }
cleantalk.class.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Cleantalk base class
4
  *
5
- * @version 1.23
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Сleantalk team (welcome@cleantalk.ru)
@@ -393,6 +393,12 @@ class Cleantalk {
393
  */
394
  public $api_version = '/api2.0';
395
 
 
 
 
 
 
 
396
  /**
397
  * Function checks whether it is possible to publish the message
398
  * @param CleantalkRequest $request
@@ -597,14 +603,21 @@ class Cleantalk {
597
  private function sendRequest($data = null, $url, $server_timeout = 3) {
598
  // Convert to array
599
  $data = json_decode(json_encode($data), true);
600
-
601
  // Convert to JSON
602
  $data = json_encode($data);
603
-
604
- if (isset($this->api_version))
605
  $url = $url . $this->api_version;
606
-
 
 
 
 
 
 
607
  $result = false;
 
608
  if(function_exists('curl_init')) {
609
  $ch = curl_init();
610
  curl_setopt($ch, CURLOPT_URL, $url);
@@ -615,10 +628,22 @@ class Cleantalk {
615
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
616
  // resolve 'Expect: 100-continue' issue
617
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
 
 
 
 
 
 
 
618
 
619
  $result = curl_exec($ch);
 
 
 
 
620
  curl_close($ch);
621
  }
 
622
  if (!$result) {
623
  $allow_url_fopen = ini_get('allow_url_fopen');
624
  if (function_exists('file_get_contents') && isset($allow_url_fopen) && $allow_url_fopen == '1') {
@@ -635,22 +660,28 @@ class Cleantalk {
635
  $result = @file_get_contents($url, false, $context);
636
  }
637
  }
 
638
  if (!$result) {
639
  $response = null;
640
  $response['errno'] = 1;
641
- $response['errstr'] = 'No CURL support compiled in. Disabled allow_url_fopen in php.ini.';
 
 
 
 
 
642
  $response = json_decode(json_encode($response));
643
 
644
  return $response;
645
  }
646
-
647
 
 
648
  $errstr = null;
649
  $response = json_decode($result);
650
  if ($result !== false && is_object($response)) {
651
  $response->errno = 0;
652
  $response->errstr = $errstr;
653
  } else {
654
- $errstr = 'Failed connect to ' . $url . '.' . ' ' . $result;
655
 
656
  $response = null;
657
  $response['errno'] = 1;
@@ -898,12 +929,8 @@ class Cleantalk {
898
  return mb_convert_encoding($str, 'UTF-8', $data_codepage);
899
 
900
  $encoding = mb_detect_encoding($str);
901
- if ($encoding && $encoding != 'UTF-8') {
902
- $str = mb_convert_encoding($str, 'UTF-8', $encoding);
903
- } else {
904
- // Final cut of non UTF-8 characters
905
- $str = preg_replace('/[^(\x20-\x7F)]*/','', $str);
906
- }
907
  }
908
 
909
  return $str;
2
  /**
3
  * Cleantalk base class
4
  *
5
+ * @version 1.24
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Сleantalk team (welcome@cleantalk.ru)
393
  */
394
  public $api_version = '/api2.0';
395
 
396
+ /**
397
+ * Use https connection to servers
398
+ * @var bool
399
+ */
400
+ public $ssl_on = false;
401
+
402
  /**
403
  * Function checks whether it is possible to publish the message
404
  * @param CleantalkRequest $request
603
  private function sendRequest($data = null, $url, $server_timeout = 3) {
604
  // Convert to array
605
  $data = json_decode(json_encode($data), true);
606
+
607
  // Convert to JSON
608
  $data = json_encode($data);
609
+
610
+ if (isset($this->api_version)) {
611
  $url = $url . $this->api_version;
612
+ }
613
+
614
+ // Switching to secure connection
615
+ if ($this->ssl_on && !preg_match("/^https:/", $url)) {
616
+ $url = preg_replace("/^(http)/i", "$1s", $url);
617
+ }
618
+
619
  $result = false;
620
+ $curl_error = null;
621
  if(function_exists('curl_init')) {
622
  $ch = curl_init();
623
  curl_setopt($ch, CURLOPT_URL, $url);
628
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
629
  // resolve 'Expect: 100-continue' issue
630
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
631
+
632
+ // Disabling CA cert verivication
633
+ // Disabling common name verification
634
+ if ($this->ssl_on) {
635
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
636
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
637
+ }
638
 
639
  $result = curl_exec($ch);
640
+ if (!$result) {
641
+ $curl_error = curl_error($ch);
642
+ }
643
+
644
  curl_close($ch);
645
  }
646
+
647
  if (!$result) {
648
  $allow_url_fopen = ini_get('allow_url_fopen');
649
  if (function_exists('file_get_contents') && isset($allow_url_fopen) && $allow_url_fopen == '1') {
660
  $result = @file_get_contents($url, false, $context);
661
  }
662
  }
663
+
664
  if (!$result) {
665
  $response = null;
666
  $response['errno'] = 1;
667
+ if ($curl_error) {
668
+ $response['errstr'] = sprintf("CURL error: '%s'", $curl_error);
669
+ } else {
670
+ $response['errstr'] = 'No CURL support compiled in';
671
+ }
672
+ $response['errstr'] .= ' or disabled allow_url_fopen in php.ini.';
673
  $response = json_decode(json_encode($response));
674
 
675
  return $response;
676
  }
 
677
 
678
+
679
  $errstr = null;
680
  $response = json_decode($result);
681
  if ($result !== false && is_object($response)) {
682
  $response->errno = 0;
683
  $response->errstr = $errstr;
684
  } else {
685
+ $errstr = 'Unknown response from ' . $url . '.' . ' ' . $result;
686
 
687
  $response = null;
688
  $response['errno'] = 1;
929
  return mb_convert_encoding($str, 'UTF-8', $data_codepage);
930
 
931
  $encoding = mb_detect_encoding($str);
932
+ if ($encoding)
933
+ return mb_convert_encoding($str, 'UTF-8', $encoding);
 
 
 
 
934
  }
935
 
936
  return $str;
cleantalk.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
- Version: 2.49
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
12
 
13
- $ct_agent_version = 'wordpress-249';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -27,6 +27,9 @@ $ct_jpcf_fields = array('name', 'email');
27
  // Comment already proccessed
28
  $ct_comment_done = false;
29
 
 
 
 
30
  // Default value for JS test
31
  $ct_checkjs_def = 0;
32
 
@@ -66,6 +69,9 @@ $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
66
  // Form time load label
67
  $ct_formtime_label = 'formtime';
68
 
 
 
 
69
  // Init action.
70
  add_action('init', 'ct_init', 1);
71
 
@@ -107,8 +113,8 @@ add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
107
 
108
  // Login form - for notifications only
109
  add_filter('login_message', 'ct_login_message');
110
-
111
- if (is_admin()) {
112
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
113
 
114
  add_action('admin_init', 'ct_admin_init', 1);
@@ -165,6 +171,15 @@ function ct_init() {
165
  if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && (isset($_POST[$ct_post_data_label]['email']) || isset($_POST[$ct_post_data_authnet_label]['email']))){
166
  ct_s2member_registration_test();
167
  }
 
 
 
 
 
 
 
 
 
168
  }
169
 
170
  /**
@@ -190,16 +205,17 @@ function ct_get_options() {
190
  * @return mixed[] Array of default options
191
  */
192
  function ct_def_options() {
193
- $lang = get_bloginfo('language');
194
  return array(
195
  'server' => 'http://moderate.cleantalk.org',
 
196
  'apikey' => __('enter key', 'cleantalk'),
197
  'autoPubRevelantMess' => '1',
198
  'registrations_test' => '1',
199
  'comments_test' => '1',
200
  'contact_forms_test' => '1',
201
  'remove_old_spam' => '0',
202
- 'spam_store_days' => '31' // Days before delete comments from folder Spam
 
203
  );
204
  }
205
 
@@ -354,6 +370,7 @@ function ct_base_call($params = array()) {
354
  $ct->server_url = $options['server'];
355
  $ct->server_ttl = $config['ct_server_ttl'];
356
  $ct->server_changed = $config['ct_server_changed'];
 
357
 
358
  $ct_request = new CleantalkRequest();
359
 
@@ -989,7 +1006,7 @@ function ct_registration_errors_wpmu($errors) {
989
  return $errors;
990
  }
991
  $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
992
-
993
  // Show CleanTalk errors in user_name field
994
  if (isset($errors['errors']->errors['ct_error'])) {
995
  $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
@@ -998,13 +1015,31 @@ function ct_registration_errors_wpmu($errors) {
998
 
999
  return $errors;
1000
  }
 
 
 
 
 
 
 
 
 
1001
  /**
1002
  * Test users registration
1003
  * @return array with errors
1004
  */
1005
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1006
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp;
1007
-
 
 
 
 
 
 
 
 
 
1008
  //
1009
  // BuddyPress actions
1010
  //
@@ -1048,9 +1083,9 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1048
  $ct->server_url = $options['server'];
1049
  $ct->server_ttl = $config['ct_server_ttl'];
1050
  $ct->server_changed = $config['ct_server_changed'];
1051
-
 
1052
  $ct_request = new CleantalkRequest();
1053
-
1054
  $ct_request->auth_key = $options['apikey'];
1055
  $ct_request->sender_email = $sender_email;
1056
  $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
@@ -1070,6 +1105,8 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1070
  )
1071
  );
1072
  }
 
 
1073
 
1074
  if ($ct_result->errno != 0) {
1075
  return $errors;
@@ -1488,6 +1525,7 @@ function ct_s2member_registration_test() {
1488
  $ct->server_url = $options['server'];
1489
  $ct->server_ttl = $config['ct_server_ttl'];
1490
  $ct->server_changed = $config['ct_server_changed'];
 
1491
 
1492
  $ct_request = new CleantalkRequest();
1493
 
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
+ Version: 2.51
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
12
 
13
+ $ct_agent_version = 'wordpress-251';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
27
  // Comment already proccessed
28
  $ct_comment_done = false;
29
 
30
+ // Comment already proccessed
31
+ $ct_signup_done = false;
32
+
33
  // Default value for JS test
34
  $ct_checkjs_def = 0;
35
 
69
  // Form time load label
70
  $ct_formtime_label = 'formtime';
71
 
72
+ // Plugin's options
73
+ $ct_options = null;
74
+
75
  // Init action.
76
  add_action('init', 'ct_init', 1);
77
 
113
 
114
  // Login form - for notifications only
115
  add_filter('login_message', 'ct_login_message');
116
+
117
+ if (is_admin() && !(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
118
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
119
 
120
  add_action('admin_init', 'ct_admin_init', 1);
171
  if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && (isset($_POST[$ct_post_data_label]['email']) || isset($_POST[$ct_post_data_authnet_label]['email']))){
172
  ct_s2member_registration_test();
173
  }
174
+
175
+ //
176
+ // New user approve hack
177
+ // https://wordpress.org/plugins/new-user-approve/
178
+ //
179
+ if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
180
+ add_action('register_post', 'ct_register_post', 1, 3);
181
+ }
182
+
183
  }
184
 
185
  /**
205
  * @return mixed[] Array of default options
206
  */
207
  function ct_def_options() {
 
208
  return array(
209
  'server' => 'http://moderate.cleantalk.org',
210
+ // 'server' => 'http://localhost',
211
  'apikey' => __('enter key', 'cleantalk'),
212
  'autoPubRevelantMess' => '1',
213
  'registrations_test' => '1',
214
  'comments_test' => '1',
215
  'contact_forms_test' => '1',
216
  'remove_old_spam' => '0',
217
+ 'spam_store_days' => '31', // Days before delete comments from folder Spam
218
+ 'ssl_on' => 0 // Secure connection to servers
219
  );
220
  }
221
 
370
  $ct->server_url = $options['server'];
371
  $ct->server_ttl = $config['ct_server_ttl'];
372
  $ct->server_changed = $config['ct_server_changed'];
373
+ $ct->ssl_on = $config['ssl_on'];
374
 
375
  $ct_request = new CleantalkRequest();
376
 
1006
  return $errors;
1007
  }
1008
  $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
1009
+
1010
  // Show CleanTalk errors in user_name field
1011
  if (isset($errors['errors']->errors['ct_error'])) {
1012
  $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
1015
 
1016
  return $errors;
1017
  }
1018
+
1019
+ /**
1020
+ * Shell for action register_post
1021
+ * @return array with errors
1022
+ */
1023
+ function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1024
+ return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1025
+ }
1026
+
1027
  /**
1028
  * Test users registration
1029
  * @return array with errors
1030
  */
1031
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1032
+ global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done;
1033
+
1034
+ // If there is an error already, let it do it's thing
1035
+ if ($errors->get_error_code()) {
1036
+ return $errors;
1037
+ }
1038
+
1039
+ // The function already executed
1040
+ if ($ct_signup_done) {
1041
+ return $errors;
1042
+ }
1043
  //
1044
  // BuddyPress actions
1045
  //
1083
  $ct->server_url = $options['server'];
1084
  $ct->server_ttl = $config['ct_server_ttl'];
1085
  $ct->server_changed = $config['ct_server_changed'];
1086
+ $ct->ssl_on = $options['ssl_on'];
1087
+
1088
  $ct_request = new CleantalkRequest();
 
1089
  $ct_request->auth_key = $options['apikey'];
1090
  $ct_request->sender_email = $sender_email;
1091
  $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
1105
  )
1106
  );
1107
  }
1108
+
1109
+ $ct_signup_done = true;
1110
 
1111
  if ($ct_result->errno != 0) {
1112
  return $errors;
1525
  $ct->server_url = $options['server'];
1526
  $ct->server_ttl = $config['ct_server_ttl'];
1527
  $ct->server_changed = $config['ct_server_changed'];
1528
+ $ct->ssl_on = $config['ssl_on'];
1529
 
1530
  $ct_request = new CleantalkRequest();
1531
 
i18n/cleantalk-ru_RU.mo CHANGED
Binary file
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov
3
  Tags: anti spam, anti-spam, antispam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cache
4
  Requires at least: 3.0
5
  Tested up to: 3.9.1
6
- Stable tag: 2.49
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -143,6 +143,11 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
143
  1. Anti spam stopped spam bot at the registration form.
144
 
145
  == Changelog ==
 
 
 
 
 
146
  = 2.49 2014-06-10 =
147
  * Added spam protection for S2Member Auth.net forms.
148
  * Added spam protection for multisite signup form.
@@ -333,6 +338,11 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
333
  * First version
334
 
335
  == Upgrade Notice ==
 
 
 
 
 
336
  = 2.49 2014-06-10 =
337
  * Added spam protection for S2Member Auth.net forms.
338
  * Added spam protection for multisite signup form.
3
  Tags: anti spam, anti-spam, antispam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cache
4
  Requires at least: 3.0
5
  Tested up to: 3.9.1
6
+ Stable tag: 2.51
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
143
  1. Anti spam stopped spam bot at the registration form.
144
 
145
  == Changelog ==
146
+ = 2.51 2014-06-23 =
147
+ * Added spam protection for registrations via plugin New User Approve by Josh Harrison. If the CleanTalk matched signup as spam this signup will be denied to placing in pending queue.
148
+ * Added option "Use secure (SSL) connection to CleanTalk cloud". If the option enabled plugin will communicate with CleanTalk severs via 128bit encrypted data channel. So, if you have SSL protected webforms on website you can use this option to be sure that visitors personal data safely transmits to CleanTalk servers.
149
+ * Fixed minor bug with loading backend functions.
150
+
151
  = 2.49 2014-06-10 =
152
  * Added spam protection for S2Member Auth.net forms.
153
  * Added spam protection for multisite signup form.
338
  * First version
339
 
340
  == Upgrade Notice ==
341
+ = 2.51 2014-06-23 =
342
+ * Added spam protection for registrations via plugin New User Approve by Josh Harrison. If the CleanTalk matched signup as spam this signup will be denied to placing in pending queue.
343
+ * Added option "Use secure (SSL) connection to CleanTalk cloud". If the option enabled plugin will communicate with CleanTalk severs via 128bit encrypted data channel. So, if you have SSL protected webforms on website you can use this option to be sure that visitors personal data safely transmits to CleanTalk servers.
344
+ * Fixed minor bug with loading backend functions.
345
+
346
  = 2.49 2014-06-10 =
347
  * Added spam protection for S2Member Auth.net forms.
348
  * Added spam protection for multisite signup form.