Spam protection, AntiSpam, FireWall by CleanTalk - Version 4.22

Version Description

2015-03-17 = * Added button for automatic spam protection key getting.

Download this release

Release Info

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

Code changes from version 4.21 to 4.22

cleantalk-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
4
 
5
  // Timeout to get app server
6
- $ct_server_timeout = 2;
7
 
8
  /**
9
  * Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
@@ -25,7 +25,7 @@ function ct_admin_add_page() {
25
  * Admin action 'admin_init' - Add the admin settings and such
26
  */
27
  function ct_admin_init() {
28
- global $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $ct_account_status_check;
29
 
30
  $ct_options = ct_get_options();
31
 
@@ -41,18 +41,66 @@ function ct_admin_init() {
41
  $show_ct_notice_renew = true;
42
  }
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  if (time() > $ct_options['next_account_status_check']) {
46
  $result = false;
47
  if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
48
  $url = 'https://api.cleantalk.org';
49
- $server_timeout = 2;
50
- $data['auth_key'] = $ct_options['apikey'];
51
  $data['method_name'] = 'notice_paid_till';
 
52
 
53
  $ch = curl_init();
54
  curl_setopt($ch, CURLOPT_URL, $url);
55
- curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
56
  curl_setopt($ch, CURLOPT_POST, true);
57
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
58
 
@@ -69,7 +117,9 @@ function ct_admin_init() {
69
 
70
  if ($result) {
71
  $result = json_decode($result, true);
72
- $result = $result['data']; // !!!!
 
 
73
 
74
  if (isset($result['show_notice'])) {
75
  if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
@@ -154,8 +204,13 @@ function ct_input_apikey() {
154
  $def_value = '';
155
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
156
  if (ct_valid_key($value) === false) {
157
- echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key', 'cleantalk')."</a>";
158
- } else{
 
 
 
 
 
159
  if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
160
  echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;<img src="' . plugin_dir_url(__FILE__) . 'inc/images/yes.png" alt="" height="" />';
161
  }
@@ -279,7 +334,7 @@ input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 no
279
  * @return bool
280
  */
281
  function admin_notice_message(){
282
- global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $ct_plugin_name, $ct_options;
283
 
284
  $user_token = '';
285
  if (isset($ct_options['user_token']) && $ct_options['user_token'] != '') {
@@ -287,13 +342,19 @@ function admin_notice_message(){
287
  }
288
 
289
  $show_notice = true;
 
 
 
 
 
 
290
  if ($show_notice && ct_valid_key($ct_options['apikey']) === false) {
291
- echo '<div class="updated"><h3>' . sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a>") . '</h3></div>';
292
  $show_notice = false;
293
  }
294
 
295
  if ($show_notice && $show_ct_notice_trial) {
296
- echo '<div class="updated"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
297
  $show_notice = false;
298
  }
299
 
@@ -304,15 +365,17 @@ function admin_notice_message(){
304
  }
305
 
306
  if ($show_notice && $show_ct_notice_online != '') {
307
- echo '<div class="updated"><h3><b>';
308
  if($show_ct_notice_online === 'Y'){
 
309
  echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
 
310
  }
311
 
312
  if($show_ct_notice_online === 'N'){
 
313
  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');
 
314
  }
315
- echo '</b></h3></div>';
316
  }
317
 
318
  //ct_send_feedback(); -- removed to ct_do_this_hourly()
@@ -493,14 +556,12 @@ function ct_update_option($option_name) {
493
  }
494
 
495
  $url = 'https://cleantalk.org/app_notice';
496
- $server_timeout = $ct_server_timeout;
497
-
498
  $data['auth_key'] = $api_key;
499
  $data['param'] = 'notice_validate_key';
500
 
501
  $ch = curl_init();
502
  curl_setopt($ch, CURLOPT_URL, $url);
503
- curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
504
  curl_setopt($ch, CURLOPT_POST, true);
505
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
506
 
3
  $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
4
 
5
  // Timeout to get app server
6
+ $ct_server_timeout = 10;
7
 
8
  /**
9
  * Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
25
  * Admin action 'admin_init' - Add the admin settings and such
26
  */
27
  function ct_admin_init() {
28
+ global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $ct_account_status_check;
29
 
30
  $ct_options = ct_get_options();
31
 
41
  $show_ct_notice_renew = true;
42
  }
43
  }
44
+ $show_ct_notice_autokey = false;
45
+ if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label])) {
46
+ if (!empty($_COOKIE[$ct_notice_autokey_label])) {
47
+ $show_ct_notice_autokey = true;
48
+ $ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
49
+ setcookie($ct_notice_autokey_label, '', 1, '/');
50
+ }
51
+ }
52
+
53
+ if (isset($_POST['get_apikey_auto']) && function_exists('curl_init') && function_exists('json_decode')){
54
+ $url = 'https://api.cleantalk.org';
55
+ $data = array();
56
+ $data['method_name'] = 'get_api_key';
57
+ $data['email'] = get_option('admin_email');
58
+ $data['website'] = parse_url(get_option('siteurl'),PHP_URL_HOST);
59
+ $data['platform'] = 'wordpress';
60
+
61
+ $ch = curl_init();
62
+ curl_setopt($ch, CURLOPT_URL, $url);
63
+ curl_setopt($ch, CURLOPT_TIMEOUT, $ct_server_timeout);
64
+ curl_setopt($ch, CURLOPT_POST, true);
65
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
66
+
67
+ // receive server response ...
68
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
69
+ // resolve 'Expect: 100-continue' issue
70
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
71
+
72
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
73
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
74
+
75
+ $result = curl_exec($ch);
76
+ curl_close($ch);
77
+
78
+ if ($result) {
79
+ $result = json_decode($result, true);
80
+ if (isset($result['data']) && is_array($result['data'])) {
81
+ $result = $result['data'];
82
+ }
83
+ if (isset($result['auth_key']) && !empty($result['auth_key'])) {
84
+ $_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
85
+ } else {
86
+ setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
87
+ }
88
+ } else {
89
+ setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
90
+ }
91
+ }
92
 
93
  if (time() > $ct_options['next_account_status_check']) {
94
  $result = false;
95
  if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
96
  $url = 'https://api.cleantalk.org';
97
+ $data = array();
 
98
  $data['method_name'] = 'notice_paid_till';
99
+ $data['auth_key'] = $ct_options['apikey'];
100
 
101
  $ch = curl_init();
102
  curl_setopt($ch, CURLOPT_URL, $url);
103
+ curl_setopt($ch, CURLOPT_TIMEOUT, $ct_server_timeout);
104
  curl_setopt($ch, CURLOPT_POST, true);
105
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
106
 
117
 
118
  if ($result) {
119
  $result = json_decode($result, true);
120
+ if (isset($result['data']) && is_array($result['data'])) {
121
+ $result = $result['data'];
122
+ }
123
 
124
  if (isset($result['show_notice'])) {
125
  if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
204
  $def_value = '';
205
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
206
  if (ct_valid_key($value) === false) {
207
+ echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
208
+ if (function_exists('curl_init') && function_exists('json_decode')) {
209
+ echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
210
+ admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'), get_option('admin_email')));
211
+ admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
212
+ }
213
+ } else {
214
  if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
215
  echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;<img src="' . plugin_dir_url(__FILE__) . 'inc/images/yes.png" alt="" height="" />';
216
  }
334
  * @return bool
335
  */
336
  function admin_notice_message(){
337
+ global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options;
338
 
339
  $user_token = '';
340
  if (isset($ct_options['user_token']) && $ct_options['user_token'] != '') {
342
  }
343
 
344
  $show_notice = true;
345
+
346
+ if ($show_notice && $show_ct_notice_autokey) {
347
+ echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
348
+ echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk').'</a></h3></div>';
349
+ }
350
+
351
  if ($show_notice && ct_valid_key($ct_options['apikey']) === false) {
352
+ echo '<div class="error"><h3>' . sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a>") . '</h3></div>';
353
  $show_notice = false;
354
  }
355
 
356
  if ($show_notice && $show_ct_notice_trial) {
357
+ echo '<div class="error"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
358
  $show_notice = false;
359
  }
360
 
365
  }
366
 
367
  if ($show_notice && $show_ct_notice_online != '') {
 
368
  if($show_ct_notice_online === 'Y'){
369
+ echo '<div class="updated"><h3><b>';
370
  echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
371
+ echo '</b></h3></div>';
372
  }
373
 
374
  if($show_ct_notice_online === 'N'){
375
+ echo '<div class="error"><h3><b>';
376
  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');
377
+ echo '</b></h3></div>';
378
  }
 
379
  }
380
 
381
  //ct_send_feedback(); -- removed to ct_do_this_hourly()
556
  }
557
 
558
  $url = 'https://cleantalk.org/app_notice';
 
 
559
  $data['auth_key'] = $api_key;
560
  $data['param'] = 'notice_validate_key';
561
 
562
  $ch = curl_init();
563
  curl_setopt($ch, CURLOPT_URL, $url);
564
+ curl_setopt($ch, CURLOPT_TIMEOUT, $ct_server_timeout);
565
  curl_setopt($ch, CURLOPT_POST, true);
566
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
567
 
cleantalk-common.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $ct_agent_version = 'wordpress-421';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -90,6 +90,15 @@ $ct_admin_notoice_period = 10800;
90
  // It uses for BuddyPress registrations to avoid double checks
91
  $ct_negative_comment = null;
92
 
 
 
 
 
 
 
 
 
 
93
  /**
94
  * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
95
  */
1
  <?php
2
 
3
+ $ct_agent_version = 'wordpress-422';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
90
  // It uses for BuddyPress registrations to avoid double checks
91
  $ct_negative_comment = null;
92
 
93
+ // Flag to show apikey automatic getting error
94
+ $show_ct_notice_autokey = false;
95
+
96
+ // Apikey automatic getting label
97
+ $ct_notice_autokey_label = 'ct_autokey';
98
+
99
+ // Apikey automatic getting error text
100
+ $ct_notice_autokey_value = '';
101
+
102
  /**
103
  * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
104
  */
cleantalk-public.php CHANGED
@@ -546,7 +546,6 @@ function ct_preprocess_comment($comment) {
546
 
547
  if ($ct_result->allow == 1 && get_option('comment_moderation') !== '1') {
548
  add_filter('pre_comment_approved', 'ct_set_approved', 99, 2);
549
- setcookie($ct_approved_request_id_label, $ct_result->id, 0, '/');
550
  }
551
  if ($ct_result->allow == 0) {
552
  if (isset($ct_result->stop_words)) {
546
 
547
  if ($ct_result->allow == 1 && get_option('comment_moderation') !== '1') {
548
  add_filter('pre_comment_approved', 'ct_set_approved', 99, 2);
 
549
  }
550
  if ($ct_result->allow == 0) {
551
  if (isset($ct_result->stop_words)) {
cleantalk.php CHANGED
@@ -3,7 +3,7 @@
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: 4.21
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
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: 4.22
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
i18n/cleantalk-ru_RU.mo CHANGED
Binary file
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Anti-spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
- Contributors: znaeff, shagimuratov
3
  Tags: akismet, anti-spam, antispam, bbpress spam, buddypress spam, captcha antispam, cf7 spam, comments spam, contact form spam, fast secure contact form spam, form, Formidable spam, jetpack spam, landing pages, math, registration spam, s2member spam, signup spam, spam, spammers, spammy, WooCommerce spam, wordpress spam, booking spam, order spam, subscriptions spam, comments, gravity spam, gravity forms spam
4
  Requires at least: 3.0
5
  Tested up to: 4.1.1
6
- Stable tag: 4.21
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -175,6 +175,9 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
175
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
176
 
177
  == Changelog ==
 
 
 
178
  = 4.21 2015-03-11 =
179
  * Added license renew notification.
180
 
@@ -516,6 +519,9 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
516
  * First version
517
 
518
  == Upgrade Notice ==
 
 
 
519
  = 4.21 2015-03-11 =
520
  Added license renew notification.
521
 
1
  === Anti-spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
+ Contributors: znaeff, shagimuratov, vlad-cleantalk
3
  Tags: akismet, anti-spam, antispam, bbpress spam, buddypress spam, captcha antispam, cf7 spam, comments spam, contact form spam, fast secure contact form spam, form, Formidable spam, jetpack spam, landing pages, math, registration spam, s2member spam, signup spam, spam, spammers, spammy, WooCommerce spam, wordpress spam, booking spam, order spam, subscriptions spam, comments, gravity spam, gravity forms spam
4
  Requires at least: 3.0
5
  Tested up to: 4.1.1
6
+ Stable tag: 4.22
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
175
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
176
 
177
  == Changelog ==
178
+ = 4.22 2015-03-17 =
179
+ * Added button for automatic spam protection key getting.
180
+
181
  = 4.21 2015-03-11 =
182
  * Added license renew notification.
183
 
519
  * First version
520
 
521
  == Upgrade Notice ==
522
+ = 4.22 2015-03-17 =
523
+ Added button for automatic spam protection key getting.
524
+
525
  = 4.21 2015-03-11 =
526
  Added license renew notification.
527