Version Description
2014-07-11 = * Fixed signup anti spam protection logic for BuddyPress registrations. * Fixed anti spam protection for JetPack contact form. * Changed account status check logic.
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 2.54 |
Comparing to | |
See all releases |
Code changes from version 2.53 to 2.54
- cleantalk-admin.php +41 -16
- cleantalk.class.php +6 -11
- cleantalk.php +19 -7
- readme.txt +11 -1
cleantalk-admin.php
CHANGED
@@ -22,24 +22,20 @@ 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, $
|
26 |
|
27 |
$ct_options = ct_get_options();
|
28 |
|
29 |
$show_ct_notice_trial = false;
|
30 |
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
31 |
-
if ($_COOKIE[$ct_notice_trial_label] == 1)
|
32 |
$show_ct_notice_trial = true;
|
33 |
-
} else {
|
34 |
-
// Run function only on special pages
|
35 |
-
$working_pages = array("plugins.php", "options-general.php");
|
36 |
-
$do_request = false;
|
37 |
-
if (in_array($pagenow, $working_pages)) {
|
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'])
|
43 |
$url = 'https://cleantalk.org/app_notice';
|
44 |
$server_timeout = 2;
|
45 |
$data['auth_key'] = $ct_options['apikey'];
|
@@ -61,19 +57,32 @@ function ct_admin_init() {
|
|
61 |
|
62 |
$result = curl_exec($ch);
|
63 |
curl_close($ch);
|
64 |
-
|
|
|
65 |
if ($result) {
|
66 |
$result = json_decode($result, true);
|
67 |
-
if (isset($result['show_notice'])
|
68 |
-
if (isset($result['trial']) && $result['trial'] == 1) {
|
69 |
$show_ct_notice_trial = true;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
}
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
if ($result) {
|
76 |
-
setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$
|
77 |
}
|
78 |
}
|
79 |
|
@@ -250,13 +259,18 @@ function admin_notice_message(){
|
|
250 |
return false;
|
251 |
|
252 |
$options = ct_get_options();
|
|
|
|
|
|
|
|
|
|
|
253 |
$show_notice = true;
|
254 |
if ($show_notice && ct_valid_key($options['apikey']) === false) {
|
255 |
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>';
|
256 |
}
|
257 |
|
258 |
if ($show_notice && $show_ct_notice_trial) {
|
259 |
-
echo '<div class="updated"><h3>' . __("<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a> trial period
|
260 |
$show_notice = false;
|
261 |
}
|
262 |
|
@@ -425,9 +439,11 @@ if (!function_exists ( 'ct_plugin_action_links')) {
|
|
425 |
* @return array
|
426 |
*/
|
427 |
function ct_update_option($option_name) {
|
428 |
-
global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $
|
|
|
429 |
if($option_name !== 'cleantalk_settings')
|
430 |
return;
|
|
|
431 |
$ct_base_call_result = ct_base_call(array(
|
432 |
'message' => 'CleanTalk setup comment',
|
433 |
'example' => null,
|
@@ -443,8 +459,17 @@ function ct_update_option($option_name) {
|
|
443 |
setcookie($ct_notice_online_label, 0, null, '/');
|
444 |
}else{
|
445 |
setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
|
446 |
-
setcookie($ct_notice_trial_label, (int) 0, strtotime("+$
|
447 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
}
|
449 |
|
450 |
?>
|
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_showtime, $pagenow, $ct_plugin_name, $ct_options, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label;
|
26 |
|
27 |
$ct_options = ct_get_options();
|
28 |
|
29 |
$show_ct_notice_trial = false;
|
30 |
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
31 |
+
if ($_COOKIE[$ct_notice_trial_label] == 1) {
|
32 |
$show_ct_notice_trial = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
+
}
|
35 |
|
36 |
+
if (time() > $ct_options['next_account_status_check']) {
|
37 |
$result = false;
|
38 |
+
if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
|
39 |
$url = 'https://cleantalk.org/app_notice';
|
40 |
$server_timeout = 2;
|
41 |
$data['auth_key'] = $ct_options['apikey'];
|
57 |
|
58 |
$result = curl_exec($ch);
|
59 |
curl_close($ch);
|
60 |
+
|
61 |
+
$notice_check_timeout = $trial_notice_check_timeout;
|
62 |
if ($result) {
|
63 |
$result = json_decode($result, true);
|
64 |
+
if (isset($result['show_notice'])) {
|
65 |
+
if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
|
66 |
$show_ct_notice_trial = true;
|
67 |
}
|
68 |
+
|
69 |
+
if ($result['show_notice'] == 0) {
|
70 |
+
$notice_check_timeout = $account_notice_check_timeout;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
if (isset($result['user_token'])) {
|
75 |
+
$ct_options['user_token'] = $result['user_token'];
|
76 |
}
|
77 |
}
|
78 |
+
|
79 |
+
// Save next status request time
|
80 |
+
$ct_options['next_account_status_check'] = strtotime("+ $notice_check_timeout hours", $ct_options['next_account_status_check']);
|
81 |
+
update_option('cleantalk_settings', $ct_options);
|
82 |
}
|
83 |
|
84 |
if ($result) {
|
85 |
+
setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
|
86 |
}
|
87 |
}
|
88 |
|
259 |
return false;
|
260 |
|
261 |
$options = ct_get_options();
|
262 |
+
$user_token = '';
|
263 |
+
if (isset($options['user_token']) && $options['user_token'] != '') {
|
264 |
+
$user_token = '&user_token=' . $options['user_token'];
|
265 |
+
}
|
266 |
+
|
267 |
$show_notice = true;
|
268 |
if ($show_notice && ct_valid_key($options['apikey']) === false) {
|
269 |
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>';
|
270 |
}
|
271 |
|
272 |
if ($show_notice && $show_ct_notice_trial) {
|
273 |
+
echo '<div class="updated"><h3>' . __("<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a> trial period ends, please upgrade to <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>!", 'cleantalk') . '</h3></div>';
|
274 |
$show_notice = false;
|
275 |
}
|
276 |
|
439 |
* @return array
|
440 |
*/
|
441 |
function ct_update_option($option_name) {
|
442 |
+
global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime;
|
443 |
+
|
444 |
if($option_name !== 'cleantalk_settings')
|
445 |
return;
|
446 |
+
|
447 |
$ct_base_call_result = ct_base_call(array(
|
448 |
'message' => 'CleanTalk setup comment',
|
449 |
'example' => null,
|
459 |
setcookie($ct_notice_online_label, 0, null, '/');
|
460 |
}else{
|
461 |
setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
|
462 |
+
setcookie($ct_notice_trial_label, (int) 0, strtotime("+$trial_notice_showtime minutes"), '/');
|
463 |
}
|
464 |
+
|
465 |
+
//
|
466 |
+
// Force account status check
|
467 |
+
//
|
468 |
+
$ct_options = ct_get_options();
|
469 |
+
$ct_options['next_account_status_check'] = 0;
|
470 |
+
update_option('cleantalk_settings', $ct_options);
|
471 |
+
|
472 |
+
return null;
|
473 |
}
|
474 |
|
475 |
?>
|
cleantalk.class.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Cleantalk base class
|
4 |
*
|
5 |
-
* @version 1.
|
6 |
* @package Cleantalk
|
7 |
* @subpackage Base
|
8 |
* @author Сleantalk team (welcome@cleantalk.ru)
|
@@ -873,19 +873,14 @@ class Cleantalk {
|
|
873 |
}
|
874 |
|
875 |
/*
|
876 |
-
Get user IP
|
877 |
*/
|
878 |
-
public function ct_session_ip( $data_ip )
|
879 |
-
|
880 |
-
|
881 |
-
{
|
882 |
-
$forwarded_for = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? htmlentities($_SERVER['HTTP_X_FORWARDED_FOR']) : '';
|
883 |
}
|
884 |
|
885 |
-
|
886 |
-
$session_ip = ($data_ip == '127.0.0.1' && !empty($forwarded_for)) ? $forwarded_for : $data_ip;
|
887 |
-
|
888 |
-
return $session_ip;
|
889 |
}
|
890 |
|
891 |
/**
|
2 |
/**
|
3 |
* Cleantalk base class
|
4 |
*
|
5 |
+
* @version 1.26
|
6 |
* @package Cleantalk
|
7 |
* @subpackage Base
|
8 |
* @author Сleantalk team (welcome@cleantalk.ru)
|
873 |
}
|
874 |
|
875 |
/*
|
876 |
+
Get user IP behind proxy server
|
877 |
*/
|
878 |
+
public function ct_session_ip( $data_ip ) {
|
879 |
+
if ($data_ip == '127.0.0.1' && isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
880 |
+
$data_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
|
|
|
881 |
}
|
882 |
|
883 |
+
return $data_ip;
|
|
|
|
|
|
|
884 |
}
|
885 |
|
886 |
/**
|
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.
|
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-
|
14 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
15 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
16 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
@@ -51,8 +51,14 @@ $ct_notice_online_label = 'ct_notice_online';
|
|
51 |
// Flag to show online notice - 'Y' or 'N'
|
52 |
$show_ct_notice_online = '';
|
53 |
|
54 |
-
// Timeout before new check for trial notice in
|
55 |
-
$trial_notice_check_timeout =
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
// COOKIE label for WP Landing Page proccessing result
|
58 |
$ct_wplp_result_label = 'ct_wplp_result';
|
@@ -214,7 +220,9 @@ function ct_def_options() {
|
|
214 |
'contact_forms_test' => '1',
|
215 |
'remove_old_spam' => '0',
|
216 |
'spam_store_days' => '31', // Days before delete comments from folder Spam
|
217 |
-
'ssl_on' => 0 // Secure connection to servers
|
|
|
|
|
218 |
);
|
219 |
}
|
220 |
|
@@ -1031,8 +1039,11 @@ function ct_register_post($sanitized_user_login = null, $user_email = null, $err
|
|
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 |
// The function already executed
|
1035 |
-
|
|
|
|
|
1036 |
return $errors;
|
1037 |
}
|
1038 |
|
@@ -1193,7 +1204,8 @@ function ct_contact_form_is_spam($form) {
|
|
1193 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1194 |
$js_field_name = $k;
|
1195 |
}
|
1196 |
-
|
|
|
1197 |
|
1198 |
$sender_info = array(
|
1199 |
'sender_url' => @$form['comment_author_url']
|
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.54
|
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-254';
|
14 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
15 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
16 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
51 |
// Flag to show online notice - 'Y' or 'N'
|
52 |
$show_ct_notice_online = '';
|
53 |
|
54 |
+
// Timeout before new check for trial notice in hours
|
55 |
+
$trial_notice_check_timeout = 1;
|
56 |
+
|
57 |
+
// Timeout before new check account notice in hours
|
58 |
+
$account_notice_check_timeout = 24;
|
59 |
+
|
60 |
+
// Trial notice show time in minutes
|
61 |
+
$trial_notice_showtime = 10;
|
62 |
|
63 |
// COOKIE label for WP Landing Page proccessing result
|
64 |
$ct_wplp_result_label = 'ct_wplp_result';
|
220 |
'contact_forms_test' => '1',
|
221 |
'remove_old_spam' => '0',
|
222 |
'spam_store_days' => '31', // Days before delete comments from folder Spam
|
223 |
+
'ssl_on' => 0, // Secure connection to servers
|
224 |
+
'next_account_status_check' => 0, // Time label when the plugin should check account status
|
225 |
+
'user_token' => '' // User token
|
226 |
);
|
227 |
}
|
228 |
|
1039 |
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1040 |
global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done;
|
1041 |
|
1042 |
+
//
|
1043 |
// The function already executed
|
1044 |
+
// It happens when used ct_register_post();
|
1045 |
+
//
|
1046 |
+
if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
|
1047 |
return $errors;
|
1048 |
}
|
1049 |
|
1204 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1205 |
$js_field_name = $k;
|
1206 |
}
|
1207 |
+
|
1208 |
+
$checkjs = js_test($js_field_name, $_POST);
|
1209 |
|
1210 |
$sender_info = array(
|
1211 |
'sender_url' => @$form['comment_author_url']
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov
|
|
3 |
Tags: antispam, anti-spam, anti spam, 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
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.9.1
|
6 |
-
Stable tag: 2.
|
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.53 2014-06-27 =
|
147 |
* Fixed anit-spam protection bug for signups.
|
148 |
* Changed anti-spam functions (comments and signups) priority.
|
@@ -345,6 +350,11 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
|
|
345 |
* First version
|
346 |
|
347 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
348 |
= 2.53 2014-06-27 =
|
349 |
* Fixed anit-spam protection bug for signups.
|
350 |
* Changed anti-spam functions (comments and signups) priority.
|
3 |
Tags: antispam, anti-spam, anti spam, 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
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.9.1
|
6 |
+
Stable tag: 2.54
|
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.54 2014-07-11 =
|
147 |
+
* Fixed signup anti spam protection logic for BuddyPress registrations.
|
148 |
+
* Fixed anti spam protection for JetPack contact form.
|
149 |
+
* Changed account status check logic.
|
150 |
+
|
151 |
= 2.53 2014-06-27 =
|
152 |
* Fixed anit-spam protection bug for signups.
|
153 |
* Changed anti-spam functions (comments and signups) priority.
|
350 |
* First version
|
351 |
|
352 |
== Upgrade Notice ==
|
353 |
+
= 2.54 2014-07-11 =
|
354 |
+
* Fixed signup anti spam protection logic for BuddyPress registrations.
|
355 |
+
* Fixed anti spam protection for JetPack contact form.
|
356 |
+
* Changed account status check logic.
|
357 |
+
|
358 |
= 2.53 2014-06-27 =
|
359 |
* Fixed anit-spam protection bug for signups.
|
360 |
* Changed anti-spam functions (comments and signups) priority.
|