Version Description
July 13 2016 = * Optimized options getting code. * Added the option 'Protect Logged in users' to do anti-spam tests for submissions by logged in users.
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.44.1 |
Comparing to | |
See all releases |
Code changes from version 5.43.2 to 5.44.1
- cleantalk.php +3 -3
- inc/cleantalk-admin.php +35 -15
- inc/cleantalk-ajax.php +2 -2
- inc/cleantalk-common.php +59 -8
- inc/cleantalk-public.php +41 -14
- readme.txt +5 -3
cleantalk.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
Plugin Name: Spam Protection 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. Formerly Anti-Spam by CleanTalk.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
-
$ct_agent_version = 'wordpress-
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
3 |
Plugin Name: Spam Protection 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. Formerly Anti-Spam by CleanTalk.
|
6 |
+
Version: 5.44.1
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.44.1';
|
11 |
+
$ct_agent_version = 'wordpress-5441';
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
inc/cleantalk-admin.php
CHANGED
@@ -4,6 +4,8 @@ $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
|
|
4 |
$ct_options=ct_get_options();
|
5 |
$ct_data=ct_get_data();
|
6 |
|
|
|
|
|
7 |
add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
|
8 |
function cleantalk_custom_glance_items( )
|
9 |
{
|
@@ -83,10 +85,10 @@ function ct_admin_add_page() {
|
|
83 |
function ct_admin_init()
|
84 |
{
|
85 |
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, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout, $renew_notice_check_timeout, $ct_agent_version;
|
86 |
-
|
87 |
-
|
88 |
$ct_data = ct_get_data();
|
89 |
-
|
90 |
$current_version=@trim($ct_data['current_version']);
|
91 |
if($current_version!=$cleantalk_plugin_version)
|
92 |
{
|
@@ -105,11 +107,6 @@ function ct_admin_init()
|
|
105 |
);
|
106 |
}
|
107 |
|
108 |
-
if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1)
|
109 |
-
{
|
110 |
-
cleantalk_update_sfw();
|
111 |
-
}
|
112 |
-
|
113 |
/*$show_ct_notice_trial = false;
|
114 |
if (isset($_COOKIE[$ct_notice_trial_label]))
|
115 |
{
|
@@ -139,7 +136,6 @@ function ct_admin_init()
|
|
139 |
|
140 |
if (isset($_POST['get_apikey_auto']))
|
141 |
{
|
142 |
-
$email = get_option('admin_email');
|
143 |
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
144 |
$platform = 'wordpress';
|
145 |
|
@@ -148,7 +144,7 @@ function ct_admin_init()
|
|
148 |
require_once('cleantalk.class.php');
|
149 |
}
|
150 |
|
151 |
-
$result = getAutoKey(
|
152 |
|
153 |
if ($result)
|
154 |
{
|
@@ -317,6 +313,7 @@ function ct_admin_init()
|
|
317 |
add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
318 |
add_settings_field('cleantalk_set_cookies', __("Set cookies", 'cleantalk'), 'ct_input_set_cookies', 'cleantalk', 'cleantalk_settings_anti_spam');
|
319 |
add_settings_field('cleantalk_ssl_on', __("Use SSL", 'cleantalk'), 'ct_input_ssl_on', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
320 |
|
321 |
add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
|
322 |
add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
|
@@ -601,11 +598,11 @@ function ct_input_apikey() {
|
|
601 |
if (function_exists('curl_init') && function_exists('json_decode')) {
|
602 |
echo '<br /><br /><input name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
|
603 |
echo " " . __("or") . " ";
|
604 |
-
echo "<a target='__blank' style='' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(
|
605 |
echo "<br />";
|
606 |
echo "<br />";
|
607 |
|
608 |
-
admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'),
|
609 |
admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
|
610 |
}
|
611 |
} else {
|
@@ -662,7 +659,7 @@ function ct_input_contact_forms_test() {
|
|
662 |
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>";
|
663 |
echo ' ';
|
664 |
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>";
|
665 |
-
admin_addDescriptionsFields(__('Contact Form 7,
|
666 |
}
|
667 |
|
668 |
/**
|
@@ -917,6 +914,29 @@ function ct_input_ssl_on() {
|
|
917 |
@admin_addDescriptionsFields(sprintf(__('Turn this option on to use encrypted (SSL) connection with CleanTalk servers.', 'cleantalk')));
|
918 |
}
|
919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
920 |
function ct_input_show_link() {
|
921 |
global $ct_options, $ct_data;
|
922 |
|
@@ -1109,7 +1129,7 @@ function cleantalk_admin_notice_message(){
|
|
1109 |
|
1110 |
if ($show_notice && $show_ct_notice_autokey && $value==1 && (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin())) {
|
1111 |
echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
|
1112 |
-
echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(
|
1113 |
}
|
1114 |
|
1115 |
if ($ct_data['moderate_ip'] == 0 && $show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1 &&
|
@@ -1335,7 +1355,6 @@ if (!function_exists ( 'ct_plugin_action_links')) {
|
|
1335 |
*/
|
1336 |
function ct_update_option($option_name) {
|
1337 |
global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
|
1338 |
-
|
1339 |
$ct_options = ct_get_options(true);
|
1340 |
$ct_data = ct_get_data(true);
|
1341 |
|
@@ -1406,6 +1425,7 @@ function ct_update_option($option_name) {
|
|
1406 |
} else {
|
1407 |
setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
|
1408 |
}
|
|
|
1409 |
}
|
1410 |
|
1411 |
/**
|
4 |
$ct_options=ct_get_options();
|
5 |
$ct_data=ct_get_data();
|
6 |
|
7 |
+
//error_log(print_r($ct_options, true));
|
8 |
+
|
9 |
add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
|
10 |
function cleantalk_custom_glance_items( )
|
11 |
{
|
85 |
function ct_admin_init()
|
86 |
{
|
87 |
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, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout, $renew_notice_check_timeout, $ct_agent_version;
|
88 |
+
|
89 |
+
$ct_options = ct_get_options();
|
90 |
$ct_data = ct_get_data();
|
91 |
+
|
92 |
$current_version=@trim($ct_data['current_version']);
|
93 |
if($current_version!=$cleantalk_plugin_version)
|
94 |
{
|
107 |
);
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
110 |
/*$show_ct_notice_trial = false;
|
111 |
if (isset($_COOKIE[$ct_notice_trial_label]))
|
112 |
{
|
136 |
|
137 |
if (isset($_POST['get_apikey_auto']))
|
138 |
{
|
|
|
139 |
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
140 |
$platform = 'wordpress';
|
141 |
|
144 |
require_once('cleantalk.class.php');
|
145 |
}
|
146 |
|
147 |
+
$result = getAutoKey(ct_get_admin_email(), $website, $platform);
|
148 |
|
149 |
if ($result)
|
150 |
{
|
313 |
add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
314 |
add_settings_field('cleantalk_set_cookies', __("Set cookies", 'cleantalk'), 'ct_input_set_cookies', 'cleantalk', 'cleantalk_settings_anti_spam');
|
315 |
add_settings_field('cleantalk_ssl_on', __("Use SSL", 'cleantalk'), 'ct_input_ssl_on', 'cleantalk', 'cleantalk_settings_anti_spam');
|
316 |
+
add_settings_field('cleantalk_protect_logged_in', __("Protect logged in Users", 'cleantalk'), 'ct_input_protect_logged_in', 'cleantalk', 'cleantalk_settings_anti_spam');
|
317 |
|
318 |
add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
|
319 |
add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
|
598 |
if (function_exists('curl_init') && function_exists('json_decode')) {
|
599 |
echo '<br /><br /><input name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
|
600 |
echo " " . __("or") . " ";
|
601 |
+
echo "<a target='__blank' style='' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(ct_get_admin_email())."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
|
602 |
echo "<br />";
|
603 |
echo "<br />";
|
604 |
|
605 |
+
admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'), ct_get_admin_email()));
|
606 |
admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
|
607 |
}
|
608 |
} else {
|
659 |
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>";
|
660 |
echo ' ';
|
661 |
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>";
|
662 |
+
admin_addDescriptionsFields(__('Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
|
663 |
}
|
664 |
|
665 |
/**
|
914 |
@admin_addDescriptionsFields(sprintf(__('Turn this option on to use encrypted (SSL) connection with CleanTalk servers.', 'cleantalk')));
|
915 |
}
|
916 |
|
917 |
+
function ct_input_protect_logged_in() {
|
918 |
+
global $ct_options, $ct_data;
|
919 |
+
|
920 |
+
$ct_options = ct_get_options();
|
921 |
+
$ct_data = ct_get_data();
|
922 |
+
|
923 |
+
if(isset($ct_options['protect_logged_in']))
|
924 |
+
{
|
925 |
+
$value = @intval($ct_options['protect_logged_in']);
|
926 |
+
$value = $value == 1 ? $value : 0;
|
927 |
+
}
|
928 |
+
else
|
929 |
+
{
|
930 |
+
$value=0;
|
931 |
+
}
|
932 |
+
echo "<input type='radio' id='cleantalk_protect_logged_in1' name='cleantalk_settings[protect_logged_in]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_protect_logged_in1'> " . __('Yes') . "</label>";
|
933 |
+
echo ' ';
|
934 |
+
echo "<input type='radio' id='cleantalk_protect_logged_in0' name='cleantalk_settings[protect_logged_in]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_protect_logged_in0'> " . __('No') . "</label>";
|
935 |
+
@admin_addDescriptionsFields(sprintf(__('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk')));
|
936 |
+
|
937 |
+
return null;
|
938 |
+
}
|
939 |
+
|
940 |
function ct_input_show_link() {
|
941 |
global $ct_options, $ct_data;
|
942 |
|
1129 |
|
1130 |
if ($show_notice && $show_ct_notice_autokey && $value==1 && (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin())) {
|
1131 |
echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
|
1132 |
+
echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(ct_get_admin_email())."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a></h3></div>';
|
1133 |
}
|
1134 |
|
1135 |
if ($ct_data['moderate_ip'] == 0 && $show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1 &&
|
1355 |
*/
|
1356 |
function ct_update_option($option_name) {
|
1357 |
global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
|
|
|
1358 |
$ct_options = ct_get_options(true);
|
1359 |
$ct_data = ct_get_data(true);
|
1360 |
|
1425 |
} else {
|
1426 |
setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
|
1427 |
}
|
1428 |
+
return null;
|
1429 |
}
|
1430 |
|
1431 |
/**
|
inc/cleantalk-ajax.php
CHANGED
@@ -147,7 +147,7 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
|
|
147 |
}
|
148 |
|
149 |
require_once('cleantalk.class.php');
|
150 |
-
$config =
|
151 |
$ct = new Cleantalk();
|
152 |
$ct->work_url = $config['ct_work_url'];
|
153 |
$ct->server_url = $ct_options['server'];
|
@@ -232,7 +232,7 @@ function ct_user_register_ajaxlogin($user_id)
|
|
232 |
}
|
233 |
|
234 |
require_once('cleantalk.class.php');
|
235 |
-
$config =
|
236 |
$ct = new Cleantalk();
|
237 |
$ct->work_url = $config['ct_work_url'];
|
238 |
$ct->server_url = $ct_options['server'];
|
147 |
}
|
148 |
|
149 |
require_once('cleantalk.class.php');
|
150 |
+
$config = ct_get_server();
|
151 |
$ct = new Cleantalk();
|
152 |
$ct->work_url = $config['ct_work_url'];
|
153 |
$ct->server_url = $ct_options['server'];
|
232 |
}
|
233 |
|
234 |
require_once('cleantalk.class.php');
|
235 |
+
$config = ct_get_server();
|
236 |
$ct = new Cleantalk();
|
237 |
$ct->work_url = $config['ct_work_url'];
|
238 |
$ct->server_url = $ct_options['server'];
|
inc/cleantalk-common.php
CHANGED
@@ -97,8 +97,11 @@ $ct_notice_autokey_value = '';
|
|
97 |
|
98 |
$ct_feedback_requests_pool = array();
|
99 |
|
100 |
-
|
101 |
-
$
|
|
|
|
|
|
|
102 |
|
103 |
|
104 |
/**
|
@@ -114,6 +117,7 @@ function ct_plugin_loaded() {
|
|
114 |
* @return null;
|
115 |
*/
|
116 |
function ct_init_session() {
|
|
|
117 |
$session_id = session_id();
|
118 |
if(empty($session_id) && !headers_sent()) {
|
119 |
$result = @session_start();
|
@@ -157,7 +161,7 @@ function ct_base_call($params = array()) {
|
|
157 |
if ($sender_info === false)
|
158 |
$sender_info = '';
|
159 |
|
160 |
-
$config =
|
161 |
|
162 |
$ct = new Cleantalk();
|
163 |
$ct->work_url = $config['ct_work_url'];
|
@@ -357,12 +361,49 @@ function ct_get_checkjs_value($random_key = false) {
|
|
357 |
update_option('cleantalk_data', $ct_data);
|
358 |
}
|
359 |
} else {
|
360 |
-
$key = md5($ct_options['apikey'] . '+' .
|
361 |
}
|
362 |
|
363 |
return $key;
|
364 |
}
|
365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
/**
|
367 |
* Inner function - Current Cleantalk options
|
368 |
* @return mixed[] Array of options
|
@@ -390,7 +431,15 @@ function ct_get_options($force=false) {
|
|
390 |
{
|
391 |
$options['apikey']=CLEANTALK_ACCESS_KEY;
|
392 |
}
|
393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
}
|
396 |
|
@@ -414,7 +463,9 @@ function ct_def_options() {
|
|
414 |
'notice_api_errors' => 0, // Send API error notices to WP admin
|
415 |
'user_token'=>'', //user token for auto login into spam statistics
|
416 |
'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
|
417 |
-
'collect_details' => 0 // Collect details about browser of the visitor.
|
|
|
|
|
418 |
);
|
419 |
}
|
420 |
|
@@ -484,7 +535,7 @@ function ct_feedback($hash, $message = null, $allow) {
|
|
484 |
|
485 |
require_once('cleantalk.class.php');
|
486 |
|
487 |
-
$config =
|
488 |
|
489 |
$ct = new Cleantalk();
|
490 |
$ct->work_url = $config['ct_work_url'];
|
@@ -539,7 +590,7 @@ function ct_send_feedback($feedback_request = null) {
|
|
539 |
}
|
540 |
|
541 |
require_once('cleantalk.class.php');
|
542 |
-
$config =
|
543 |
|
544 |
$ct = new Cleantalk();
|
545 |
$ct->work_url = $config['ct_work_url'];
|
97 |
|
98 |
$ct_feedback_requests_pool = array();
|
99 |
|
100 |
+
// Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
|
101 |
+
$ct_options = NULL;
|
102 |
+
$ct_data = NULL;
|
103 |
+
$ct_server = NULL;
|
104 |
+
$admin_email = NULL;
|
105 |
|
106 |
|
107 |
/**
|
117 |
* @return null;
|
118 |
*/
|
119 |
function ct_init_session() {
|
120 |
+
|
121 |
$session_id = session_id();
|
122 |
if(empty($session_id) && !headers_sent()) {
|
123 |
$result = @session_start();
|
161 |
if ($sender_info === false)
|
162 |
$sender_info = '';
|
163 |
|
164 |
+
$config = ct_get_server();
|
165 |
|
166 |
$ct = new Cleantalk();
|
167 |
$ct->work_url = $config['ct_work_url'];
|
361 |
update_option('cleantalk_data', $ct_data);
|
362 |
}
|
363 |
} else {
|
364 |
+
$key = md5($ct_options['apikey'] . '+' . ct_get_admin_email());
|
365 |
}
|
366 |
|
367 |
return $key;
|
368 |
}
|
369 |
|
370 |
+
/**
|
371 |
+
* Inner function - Current site admin e-mail
|
372 |
+
* @return string Admin e-mail
|
373 |
+
*/
|
374 |
+
function ct_get_admin_email() {
|
375 |
+
global $admin_email;
|
376 |
+
if(!isset($admin_email))
|
377 |
+
{
|
378 |
+
$admin_email = get_option('admin_email');
|
379 |
+
}
|
380 |
+
return $admin_email;
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Inner function - Current Cleantalk working server info
|
385 |
+
* @return mixed[] Array of server data
|
386 |
+
*/
|
387 |
+
function ct_get_server($force=false) {
|
388 |
+
global $ct_server;
|
389 |
+
if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url']))
|
390 |
+
{
|
391 |
+
return $ct_server;
|
392 |
+
}
|
393 |
+
else
|
394 |
+
{
|
395 |
+
$ct_server = get_option('cleantalk_server');
|
396 |
+
if (!is_array($ct_server)){
|
397 |
+
$ct_server = array(
|
398 |
+
'ct_work_url' => NULL,
|
399 |
+
'ct_server_ttl' => NULL,
|
400 |
+
'ct_server_changed' => NULL
|
401 |
+
);
|
402 |
+
}
|
403 |
+
return $ct_server;
|
404 |
+
}
|
405 |
+
}
|
406 |
+
|
407 |
/**
|
408 |
* Inner function - Current Cleantalk options
|
409 |
* @return mixed[] Array of options
|
431 |
{
|
432 |
$options['apikey']=CLEANTALK_ACCESS_KEY;
|
433 |
}
|
434 |
+
$options = array_merge(ct_def_options(), (array) $options);
|
435 |
+
|
436 |
+
if ($options['apikey'] === 'enter key') {
|
437 |
+
if ($options['protect_logged_in'] == -1) {
|
438 |
+
$options['protect_logged_in'] = 1;
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
return $options;
|
443 |
}
|
444 |
}
|
445 |
|
463 |
'notice_api_errors' => 0, // Send API error notices to WP admin
|
464 |
'user_token'=>'', //user token for auto login into spam statistics
|
465 |
'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
|
466 |
+
'collect_details' => 0, // Collect details about browser of the visitor.
|
467 |
+
'show_adminbar' => 1, // Show the admin bar.
|
468 |
+
'protect_logged_in' => -1 // Do anit-spam tests to for logged in users.
|
469 |
);
|
470 |
}
|
471 |
|
535 |
|
536 |
require_once('cleantalk.class.php');
|
537 |
|
538 |
+
$config = ct_get_server();
|
539 |
|
540 |
$ct = new Cleantalk();
|
541 |
$ct->work_url = $config['ct_work_url'];
|
590 |
}
|
591 |
|
592 |
require_once('cleantalk.class.php');
|
593 |
+
$config = ct_get_server();
|
594 |
|
595 |
$ct = new Cleantalk();
|
596 |
$ct->work_url = $config['ct_work_url'];
|
inc/cleantalk-public.php
CHANGED
@@ -93,7 +93,7 @@ function ct_init() {
|
|
93 |
}
|
94 |
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
95 |
{
|
96 |
-
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',
|
97 |
}
|
98 |
else
|
99 |
{
|
@@ -121,8 +121,8 @@ function ct_init() {
|
|
121 |
|
122 |
// Formidable
|
123 |
if(class_exists('FrmSettings')){
|
124 |
-
|
125 |
-
|
126 |
}
|
127 |
|
128 |
// BuddyPress
|
@@ -177,6 +177,12 @@ function ct_init() {
|
|
177 |
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
178 |
add_action('wp_footer', 'ct_footer_add_cookie', 1);
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
if (ct_is_user_enable()) {
|
181 |
ct_cookies_test();
|
182 |
|
@@ -184,7 +190,7 @@ function ct_init() {
|
|
184 |
$ct_check_post_result=false;
|
185 |
ct_contact_form_validate();
|
186 |
}
|
187 |
-
if($_SERVER['REQUEST_METHOD'] == 'POST' && $ct_general_postdata_test==1 && !is_admin()&&!@isset($_POST['ct_checkjs_cf7']))
|
188 |
{
|
189 |
$ct_check_post_result=false;
|
190 |
ct_contact_form_validate_postdata();
|
@@ -365,12 +371,17 @@ function ct_frm_entries_footer_scripts($fields, $form) {
|
|
365 |
*/
|
366 |
function ct_frm_validate_entry ($errors, $values) {
|
367 |
global $wpdb, $current_user, $ct_agent_version, $ct_checkjs_frm, $ct_options, $ct_data;
|
368 |
-
|
369 |
$ct_options = ct_get_options();
|
370 |
$ct_data = ct_get_data();
|
371 |
|
372 |
-
if ($ct_options['contact_forms_test'] == 0
|
373 |
-
return
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
|
376 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
@@ -422,10 +433,15 @@ function ct_bbp_new_pre_content ($comment) {
|
|
422 |
$ct_options = ct_get_options();
|
423 |
$ct_data = ct_get_data();
|
424 |
|
425 |
-
if (
|
426 |
return $comment;
|
427 |
}
|
428 |
|
|
|
|
|
|
|
|
|
|
|
429 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
430 |
if ($checkjs === null) {
|
431 |
$checkjs = js_test('ct_checkjs', $_POST, true);
|
@@ -984,7 +1000,7 @@ function ct_test_registration($nickname, $email, $ip){
|
|
984 |
}
|
985 |
|
986 |
require_once('cleantalk.class.php');
|
987 |
-
$config =
|
988 |
$ct = new Cleantalk();
|
989 |
$ct->work_url = $config['ct_work_url'];
|
990 |
$ct->server_url = $ct_options['server'];
|
@@ -1088,7 +1104,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1088 |
}
|
1089 |
|
1090 |
require_once('cleantalk.class.php');
|
1091 |
-
$config =
|
1092 |
$ct = new Cleantalk();
|
1093 |
$ct->work_url = $config['ct_work_url'];
|
1094 |
$ct->server_url = $ct_options['server'];
|
@@ -1360,7 +1376,12 @@ function ct_wpcf7_spam($param) {
|
|
1360 |
if ($ct_options['contact_forms_test'] == 0) {
|
1361 |
return $param;
|
1362 |
}
|
1363 |
-
|
|
|
|
|
|
|
|
|
|
|
1364 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
1365 |
if($checkjs != 1){
|
1366 |
$checkjs = js_test($ct_checkjs_cf7, $_POST, true);
|
@@ -1725,7 +1746,7 @@ function ct_s2member_registration_test() {
|
|
1725 |
if (isset($_POST[$ct_post_data_authnet_label]['username']))
|
1726 |
$sender_nickname = $_POST[$ct_post_data_authnet_label]['username'];
|
1727 |
|
1728 |
-
$config =
|
1729 |
|
1730 |
$ct = new Cleantalk();
|
1731 |
$ct->work_url = $config['ct_work_url'];
|
@@ -1815,14 +1836,20 @@ function ct_contact_form_validate () {
|
|
1815 |
@intval($ct_options['general_contact_forms_test'])==0 ||
|
1816 |
isset($_POST['bbp_topic_content']) ||
|
1817 |
isset($_POST['bbp_reply_content']) ||
|
1818 |
-
isset($_COOKIE[LOGGED_IN_COOKIE]) ||
|
1819 |
isset($_POST['fscf_submitted']) ||
|
1820 |
strpos($_SERVER['REQUEST_URI'],'/wc-api/')!==false ||
|
1821 |
isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
|
1822 |
isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) // Formidable forms
|
|
|
|
|
1823 |
) {
|
1824 |
return null;
|
1825 |
}
|
|
|
|
|
|
|
|
|
|
|
1826 |
|
1827 |
//@header("CtConditions: Passed");
|
1828 |
cleantalk_debug("CtConditions", "Passed");
|
@@ -2115,7 +2142,7 @@ function ct_send_error_notice ($comment = '') {
|
|
2115 |
$message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
|
2116 |
$message .= sprintf(__('"%s" plugin error on your site %s:', 'cleantalk'), $ct_plugin_name, $blogname) . "\r\n\r\n";
|
2117 |
$message .= $comment . "\r\n\r\n";
|
2118 |
-
@wp_mail(
|
2119 |
}
|
2120 |
|
2121 |
return null;
|
93 |
}
|
94 |
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
95 |
{
|
96 |
+
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
|
97 |
}
|
98 |
else
|
99 |
{
|
121 |
|
122 |
// Formidable
|
123 |
if(class_exists('FrmSettings')){
|
124 |
+
add_action('frm_validate_entry', 'ct_frm_validate_entry', 1, 2);
|
125 |
+
add_action('frm_entries_footer_scripts', 'ct_frm_entries_footer_scripts', 20, 2);
|
126 |
}
|
127 |
|
128 |
// BuddyPress
|
177 |
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
178 |
add_action('wp_footer', 'ct_footer_add_cookie', 1);
|
179 |
}
|
180 |
+
|
181 |
+
if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
|
182 |
+
$ct_check_post_result=false;
|
183 |
+
ct_contact_form_validate();
|
184 |
+
}
|
185 |
+
|
186 |
if (ct_is_user_enable()) {
|
187 |
ct_cookies_test();
|
188 |
|
190 |
$ct_check_post_result=false;
|
191 |
ct_contact_form_validate();
|
192 |
}
|
193 |
+
if($_SERVER['REQUEST_METHOD'] == 'POST' && $ct_general_postdata_test==1 && !is_admin()&&!@isset($_POST['ct_checkjs_cf7']))
|
194 |
{
|
195 |
$ct_check_post_result=false;
|
196 |
ct_contact_form_validate_postdata();
|
371 |
*/
|
372 |
function ct_frm_validate_entry ($errors, $values) {
|
373 |
global $wpdb, $current_user, $ct_agent_version, $ct_checkjs_frm, $ct_options, $ct_data;
|
374 |
+
|
375 |
$ct_options = ct_get_options();
|
376 |
$ct_data = ct_get_data();
|
377 |
|
378 |
+
if ($ct_options['contact_forms_test'] == 0) {
|
379 |
+
return $errors;
|
380 |
+
}
|
381 |
+
|
382 |
+
// Skip processing for logged in users.
|
383 |
+
if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
|
384 |
+
return $errors;
|
385 |
}
|
386 |
|
387 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
433 |
$ct_options = ct_get_options();
|
434 |
$ct_data = ct_get_data();
|
435 |
|
436 |
+
if ($ct_options['comments_test'] == 0 ) {
|
437 |
return $comment;
|
438 |
}
|
439 |
|
440 |
+
// Skip processing for logged in users.
|
441 |
+
if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
|
442 |
+
return $comment;
|
443 |
+
}
|
444 |
+
|
445 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
446 |
if ($checkjs === null) {
|
447 |
$checkjs = js_test('ct_checkjs', $_POST, true);
|
1000 |
}
|
1001 |
|
1002 |
require_once('cleantalk.class.php');
|
1003 |
+
$config = ct_get_server();
|
1004 |
$ct = new Cleantalk();
|
1005 |
$ct->work_url = $config['ct_work_url'];
|
1006 |
$ct->server_url = $ct_options['server'];
|
1104 |
}
|
1105 |
|
1106 |
require_once('cleantalk.class.php');
|
1107 |
+
$config = ct_get_server();
|
1108 |
$ct = new Cleantalk();
|
1109 |
$ct->work_url = $config['ct_work_url'];
|
1110 |
$ct->server_url = $ct_options['server'];
|
1376 |
if ($ct_options['contact_forms_test'] == 0) {
|
1377 |
return $param;
|
1378 |
}
|
1379 |
+
|
1380 |
+
// Skip processing for logged in users.
|
1381 |
+
if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
|
1382 |
+
return $param;
|
1383 |
+
}
|
1384 |
+
|
1385 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
1386 |
if($checkjs != 1){
|
1387 |
$checkjs = js_test($ct_checkjs_cf7, $_POST, true);
|
1746 |
if (isset($_POST[$ct_post_data_authnet_label]['username']))
|
1747 |
$sender_nickname = $_POST[$ct_post_data_authnet_label]['username'];
|
1748 |
|
1749 |
+
$config = ct_get_server();
|
1750 |
|
1751 |
$ct = new Cleantalk();
|
1752 |
$ct->work_url = $config['ct_work_url'];
|
1836 |
@intval($ct_options['general_contact_forms_test'])==0 ||
|
1837 |
isset($_POST['bbp_topic_content']) ||
|
1838 |
isset($_POST['bbp_reply_content']) ||
|
|
|
1839 |
isset($_POST['fscf_submitted']) ||
|
1840 |
strpos($_SERVER['REQUEST_URI'],'/wc-api/')!==false ||
|
1841 |
isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
|
1842 |
isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) // Formidable forms
|
1843 |
+
|| isset($_POST['comment_post_ID']) // The comment form
|
1844 |
+
|| isset($_GET['for'])
|
1845 |
) {
|
1846 |
return null;
|
1847 |
}
|
1848 |
+
|
1849 |
+
// Do not execute anti-spam test for logged in users.
|
1850 |
+
if (isset($_COOKIE[LOGGED_IN_COOKIE]) || $ct_options['protect_logged_in'] != 1) {
|
1851 |
+
return null;
|
1852 |
+
}
|
1853 |
|
1854 |
//@header("CtConditions: Passed");
|
1855 |
cleantalk_debug("CtConditions", "Passed");
|
2142 |
$message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
|
2143 |
$message .= sprintf(__('"%s" plugin error on your site %s:', 'cleantalk'), $ct_plugin_name, $blogname) . "\r\n\r\n";
|
2144 |
$message .= $comment . "\r\n\r\n";
|
2145 |
+
@wp_mail(ct_get_admin_email(), sprintf(__('[%s] %s error!', 'cleantalk'), $ct_plugin_name, $blogname), $message);
|
2146 |
}
|
2147 |
|
2148 |
return null;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00
|
|
3 |
Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, 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, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.5.3
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -469,8 +469,9 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
469 |
1. CleanTalk works faster than most of other anti-spam plugins.
|
470 |
|
471 |
== Changelog ==
|
472 |
-
= 5.44 July
|
473 |
* Optimized options getting code.
|
|
|
474 |
|
475 |
= 5.43.2 June 30 2016 =
|
476 |
* Optimized anti-spam code for AJAX based contact forms.
|
@@ -1086,8 +1087,9 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
1086 |
* First version
|
1087 |
|
1088 |
== Upgrade Notice ==
|
1089 |
-
= 5.44 July
|
1090 |
* Optimized options getting code.
|
|
|
1091 |
|
1092 |
= 5.43.2 June 30 2016 =
|
1093 |
* Optimized anti-spam code for AJAX based contact forms.
|
3 |
Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, 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, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.5.3
|
6 |
+
Stable tag: 5.44.1
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
469 |
1. CleanTalk works faster than most of other anti-spam plugins.
|
470 |
|
471 |
== Changelog ==
|
472 |
+
= 5.44.1 July 13 2016 =
|
473 |
* Optimized options getting code.
|
474 |
+
* Added the option 'Protect Logged in users' to do anti-spam tests for submissions by logged in users.
|
475 |
|
476 |
= 5.43.2 June 30 2016 =
|
477 |
* Optimized anti-spam code for AJAX based contact forms.
|
1087 |
* First version
|
1088 |
|
1089 |
== Upgrade Notice ==
|
1090 |
+
= 5.44.1 July 13 2016 =
|
1091 |
* Optimized options getting code.
|
1092 |
+
* Added the option 'Protect Logged in users' to do anti-spam tests for submissions by logged in users.
|
1093 |
|
1094 |
= 5.43.2 June 30 2016 =
|
1095 |
* Optimized anti-spam code for AJAX based contact forms.
|