Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.46

Version Description

Download this release

Release Info

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

Code changes from version 2.48 to 2.46

Files changed (3) hide show
  1. cleantalk-admin.php +13 -34
  2. cleantalk.php +7 -54
  3. readme.txt +1 -1
cleantalk-admin.php CHANGED
@@ -22,25 +22,17 @@ 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;
26
 
27
  $show_ct_notice_trial = false;
28
  if (isset($_COOKIE[$ct_notice_trial_label])) {
29
  if ($_COOKIE[$ct_notice_trial_label] == 1)
30
  $show_ct_notice_trial = true;
31
  } else {
32
- // Run function only on special pages
33
- $working_pages = array("plugins.php", "options-general.php");
34
- $do_request = false;
35
- if (in_array($pagenow, $working_pages)) {
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
 
@@ -70,10 +62,8 @@ function ct_admin_init() {
70
  }
71
  }
72
  }
73
-
74
- if ($result) {
75
- setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"), '/');
76
- }
77
  }
78
 
79
  $show_ct_notice_online = '';
@@ -239,22 +229,17 @@ input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 no
239
  * @return bool
240
  */
241
  function admin_notice_message(){
242
- global $show_ct_notice_trial, $show_ct_notice_online, $ct_plugin_name;
243
 
244
  if (ct_active() === false)
245
  return false;
246
-
247
  $options = ct_get_options();
248
  $show_notice = true;
249
  if ($show_notice && ct_valid_key($options['apikey']) === false) {
250
  echo '<div class="updated"><h3>' . __("Please enter the Access Key in <a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a> settings to enable protection from spam!", 'cleantalk') . '</h3></div>';
251
  }
252
 
253
- if ($show_notice && $show_ct_notice_trial) {
254
- echo '<div class="updated"><h3>' . __("<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a> trial period will end soon, please upgrade to <a href=\"http://cleantalk.org/my\" target=\"_blank\"><b>premium version</b></a>!", 'cleantalk') . '</h3></div>';
255
- $show_notice = false;
256
- }
257
-
258
  if ($show_notice && !empty($show_ct_notice_online)) {
259
  echo '<div class="updated"><h3><b>';
260
  if($show_ct_notice_online === 'Y'){
@@ -265,6 +250,11 @@ function admin_notice_message(){
265
  echo '</b></h3></div>';
266
  }
267
 
 
 
 
 
 
268
  ct_send_feedback();
269
 
270
  delete_spam_comments();
@@ -420,7 +410,7 @@ if (!function_exists ( 'ct_plugin_action_links')) {
420
  * @return array
421
  */
422
  function ct_update_option($option_name) {
423
- global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_check_timeout;
424
  if($option_name !== 'cleantalk_settings')
425
  return;
426
  $ct_base_call_result = ct_base_call(array(
@@ -438,18 +428,7 @@ function ct_update_option($option_name) {
438
  setcookie($ct_notice_online_label, 0, null, '/');
439
  }else{
440
  setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
441
- setcookie($ct_notice_trial_label, (int) 0, strtotime("+$trial_notice_check_timeout minutes"), '/');
442
  }
443
  }
444
 
445
-
446
- /**
447
- * Tests account status
448
- * @return array
449
- */
450
- function ct_check_trial_notice() {
451
-
452
- return null;
453
- }
454
-
455
  ?>
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;
26
 
27
  $show_ct_notice_trial = false;
28
  if (isset($_COOKIE[$ct_notice_trial_label])) {
29
  if ($_COOKIE[$ct_notice_trial_label] == 1)
30
  $show_ct_notice_trial = true;
31
  } else {
 
 
 
 
 
 
 
32
  $options = ct_get_options();
33
+ if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($options['apikey'])) {
 
34
  $url = 'https://cleantalk.org/app_notice';
35
+ $server_timeout = 1;
36
  $data['auth_key'] = $options['apikey'];
37
  $data['param'] = 'notice_paid_till';
38
 
62
  }
63
  }
64
  }
65
+
66
+ setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"), '/');
 
 
67
  }
68
 
69
  $show_ct_notice_online = '';
229
  * @return bool
230
  */
231
  function admin_notice_message(){
232
+ global $show_ct_notice_trial, $show_ct_notice_online;
233
 
234
  if (ct_active() === false)
235
  return false;
236
+
237
  $options = ct_get_options();
238
  $show_notice = true;
239
  if ($show_notice && ct_valid_key($options['apikey']) === false) {
240
  echo '<div class="updated"><h3>' . __("Please enter the Access Key in <a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a> settings to enable protection from spam!", 'cleantalk') . '</h3></div>';
241
  }
242
 
 
 
 
 
 
243
  if ($show_notice && !empty($show_ct_notice_online)) {
244
  echo '<div class="updated"><h3><b>';
245
  if($show_ct_notice_online === 'Y'){
250
  echo '</b></h3></div>';
251
  }
252
 
253
+ if ($show_notice && $show_ct_notice_trial) {
254
+ echo '<div class="updated"><h3>' . __("CleanTalk anti-spam trial period will end soon, please upgrade to <a href=\"http://cleantalk.org/my\" target=\"_blank\"><b>premium version</b></a>!", 'cleantalk') . '</h3></div>';
255
+ $show_notice = false;
256
+ }
257
+
258
  ct_send_feedback();
259
 
260
  delete_spam_comments();
410
  * @return array
411
  */
412
  function ct_update_option($option_name) {
413
+ global $show_ct_notice_online, $ct_notice_online_label;
414
  if($option_name !== 'cleantalk_settings')
415
  return;
416
  $ct_base_call_result = ct_base_call(array(
428
  setcookie($ct_notice_online_label, 0, null, '/');
429
  }else{
430
  setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
 
431
  }
432
  }
433
 
 
 
 
 
 
 
 
 
 
 
434
  ?>
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.47
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-247';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -57,12 +57,9 @@ $ct_wplp_result_label = 'ct_wplp_result';
57
  // Flag indicates active JetPack comments
58
  $ct_jp_comments = false;
59
 
60
- // S2member PayPal post data label
61
  $ct_post_data_label = 's2member_pro_paypal_registration';
62
 
63
- // S2member Auth.Net post data label
64
- $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
65
-
66
  // Form time load label
67
  $ct_formtime_label = 'formtime';
68
 
@@ -85,10 +82,6 @@ add_action('register_form','ct_register_form');
85
  add_filter('registration_errors', 'ct_registration_errors', 10, 3);
86
  add_action('user_register', 'ct_user_register');
87
 
88
- // Multisite registrations
89
- add_action('signup_extra_fields','ct_register_form');
90
- add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
91
-
92
  // BuddyPress
93
  add_action('bp_before_registration_submit_buttons','ct_register_form');
94
  add_filter('bp_signup_validate', 'ct_registration_errors');
@@ -132,7 +125,7 @@ if (is_admin()) {
132
  * @return mixed[] Array of options
133
  */
134
  function ct_init() {
135
- global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label;
136
 
137
  ct_init_session();
138
 
@@ -162,7 +155,7 @@ function ct_init() {
162
  }
163
 
164
  // intercept S2member POST
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
  }
@@ -192,7 +185,7 @@ function ct_get_options() {
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',
@@ -264,8 +257,6 @@ function ct_feedback($hash, $message = null, $allow) {
264
  */
265
  function ct_send_feedback($feedback_request = null) {
266
 
267
- return false;
268
-
269
  if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
270
  $feedback_request = $_SESSION['feedback_request'];
271
  unset($_SESSION['feedback_request']);
@@ -968,38 +959,6 @@ function ct_login_message($message) {
968
  return $message;
969
  }
970
 
971
- /**
972
- * Test users registration for multisite enviroment
973
- * @return array with errors
974
- */
975
- function ct_registration_errors_wpmu($errors) {
976
- //
977
- // Multisite actions
978
- //
979
- $sanitized_user_login = null;
980
- if (isset($errors['user_name'])) {
981
- $sanitized_user_login = $errors['user_name'];
982
- $wpmu = true;
983
- }
984
- $user_email = null;
985
- if (isset($errors['user_email'])) {
986
- $user_email = $errors['user_email'];
987
- $wpmu = true;
988
- }
989
-
990
- if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
991
- return $errors;
992
- }
993
- $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
994
-
995
- // Show CleanTalk errors in user_name field
996
- if (isset($errors['errors']->errors['ct_error'])) {
997
- $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
998
- unset($errors['errors']->errors['ct_error']);
999
- }
1000
-
1001
- return $errors;
1002
- }
1003
  /**
1004
  * Test users registration
1005
  * @return array with errors
@@ -1446,7 +1405,7 @@ function ct_check_wplp(){
1446
  * @return array with errors
1447
  */
1448
  function ct_s2member_registration_test() {
1449
- global $ct_agent_version, $ct_post_data_label, $ct_post_data_authnet_label;
1450
 
1451
  $options = ct_get_options();
1452
  if ($options['registrations_test'] == 0) {
@@ -1472,16 +1431,10 @@ function ct_s2member_registration_test() {
1472
  $sender_email = null;
1473
  if (isset($_POST[$ct_post_data_label]['email']))
1474
  $sender_email = $_POST[$ct_post_data_label]['email'];
1475
-
1476
- if (isset($_POST[$ct_post_data_authnet_label]['email']))
1477
- $sender_email = $_POST[$ct_post_data_authnet_label]['email'];
1478
 
1479
  $sender_nickname = null;
1480
  if (isset($_POST[$ct_post_data_label]['username']))
1481
  $sender_nickname = $_POST[$ct_post_data_label]['username'];
1482
-
1483
- if (isset($_POST[$ct_post_data_authnet_label]['username']))
1484
- $sender_nickname = $_POST[$ct_post_data_authnet_label]['username'];
1485
 
1486
  $config = get_option('cleantalk_server');
1487
 
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.46
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-246';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
57
  // Flag indicates active JetPack comments
58
  $ct_jp_comments = false;
59
 
60
+ // S2member post data label
61
  $ct_post_data_label = 's2member_pro_paypal_registration';
62
 
 
 
 
63
  // Form time load label
64
  $ct_formtime_label = 'formtime';
65
 
82
  add_filter('registration_errors', 'ct_registration_errors', 10, 3);
83
  add_action('user_register', 'ct_user_register');
84
 
 
 
 
 
85
  // BuddyPress
86
  add_action('bp_before_registration_submit_buttons','ct_register_form');
87
  add_filter('bp_signup_validate', 'ct_registration_errors');
125
  * @return mixed[] Array of options
126
  */
127
  function ct_init() {
128
+ global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label;
129
 
130
  ct_init_session();
131
 
155
  }
156
 
157
  // intercept S2member POST
158
+ if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && isset($_POST[$ct_post_data_label]['email'])){
159
  ct_s2member_registration_test();
160
  }
161
  }
185
  function ct_def_options() {
186
  $lang = get_bloginfo('language');
187
  return array(
188
+ 'server' => 'http://moderate.cleantalk.ru',
189
  'apikey' => __('enter key', 'cleantalk'),
190
  'autoPubRevelantMess' => '1',
191
  'registrations_test' => '1',
257
  */
258
  function ct_send_feedback($feedback_request = null) {
259
 
 
 
260
  if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
261
  $feedback_request = $_SESSION['feedback_request'];
262
  unset($_SESSION['feedback_request']);
959
  return $message;
960
  }
961
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
962
  /**
963
  * Test users registration
964
  * @return array with errors
1405
  * @return array with errors
1406
  */
1407
  function ct_s2member_registration_test() {
1408
+ global $ct_agent_version, $ct_post_data_label;
1409
 
1410
  $options = ct_get_options();
1411
  if ($options['registrations_test'] == 0) {
1431
  $sender_email = null;
1432
  if (isset($_POST[$ct_post_data_label]['email']))
1433
  $sender_email = $_POST[$ct_post_data_label]['email'];
 
 
 
1434
 
1435
  $sender_nickname = null;
1436
  if (isset($_POST[$ct_post_data_label]['username']))
1437
  $sender_nickname = $_POST[$ct_post_data_label]['username'];
 
 
 
1438
 
1439
  $config = get_option('cleantalk_server');
1440
 
readme.txt CHANGED
@@ -1,4 +1,4 @@
1
- === Anti-spam by CleanTalk ===
2
  Contributors: znaeff, shagimuratov
3
  Tags: antispam, anti-spam, anti spam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, quiz, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cache, question
4
  Requires at least: 3.0
1
+ === SPAM defender ===
2
  Contributors: znaeff, shagimuratov
3
  Tags: antispam, anti-spam, anti spam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, quiz, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cache, question
4
  Requires at least: 3.0