Version Description
2014-09-19 = * Fixed json_encode() + malformed characters. * Fixed JavaScript issue with wpautop().
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 3.8 |
Comparing to | |
See all releases |
Code changes from version 3.6 to 3.8
- cleantalk.class.php +11 -2
- cleantalk.php +40 -29
- readme.txt +8 -1
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.org)
|
@@ -597,7 +597,16 @@ class Cleantalk {
|
|
597 |
}
|
598 |
|
599 |
$request->method_name = $method;
|
600 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
return $request;
|
602 |
}
|
603 |
|
2 |
/**
|
3 |
* Cleantalk base class
|
4 |
*
|
5 |
+
* @version 1.31
|
6 |
* @package Cleantalk
|
7 |
* @subpackage Base
|
8 |
* @author Сleantalk team (welcome@cleantalk.org)
|
597 |
}
|
598 |
|
599 |
$request->method_name = $method;
|
600 |
+
|
601 |
+
//
|
602 |
+
// Removing non UTF8 characters from request, because non UTF8 or malformed characters break json_encode().
|
603 |
+
//
|
604 |
+
foreach ($request as $param => $value) {
|
605 |
+
if (!preg_match('//u', $value)) {
|
606 |
+
$request->{$param} = 'Nulled. Not UTF8 encoded or malformed.';
|
607 |
+
}
|
608 |
+
}
|
609 |
+
|
610 |
return $request;
|
611 |
}
|
612 |
|
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: 3.
|
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';
|
@@ -84,6 +84,9 @@ $ct_account_status_check = 0;
|
|
84 |
// Post without page load
|
85 |
$ct_direct_post = 0;
|
86 |
|
|
|
|
|
|
|
87 |
// Init action.
|
88 |
add_action('init', 'ct_init', 1);
|
89 |
|
@@ -288,7 +291,8 @@ function ct_def_options() {
|
|
288 |
'ssl_on' => 0, // Secure connection to servers
|
289 |
'next_account_status_check' => 0, // Time label when the plugin should check account status
|
290 |
'user_token' => '', // User token
|
291 |
-
'relevance_test' => 0 // Test comment for relevance
|
|
|
292 |
);
|
293 |
}
|
294 |
|
@@ -545,12 +549,10 @@ function ct_add_hidden_fields($post_id = null, $field_name = 'ct_checkjs', $retu
|
|
545 |
if ($cookie_check) {
|
546 |
$html = '
|
547 |
<script type="text/javascript">
|
548 |
-
// <![CDATA[
|
549 |
function ctSetCookie(c_name, value) {
|
550 |
document.cookie = c_name + "=" + escape(value) + "; path=/";
|
551 |
}
|
552 |
ctSetCookie("%s", "%s");
|
553 |
-
// ]]>
|
554 |
</script>
|
555 |
';
|
556 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
@@ -559,22 +561,16 @@ ctSetCookie("%s", "%s");
|
|
559 |
$html = '
|
560 |
<input type="hidden" id="%s" name="%s" value="%s" />
|
561 |
<script type="text/javascript">
|
562 |
-
// <![CDATA[
|
563 |
var ct_input_name = \'%s\';
|
564 |
var ct_input_value = document.getElementById(ct_input_name).value;
|
565 |
-
var ct_input_challenge = \'%s\';
|
566 |
-
|
567 |
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, ct_input_challenge);
|
568 |
-
|
569 |
if (document.getElementById(ct_input_name).value == ct_input_value) {
|
570 |
document.getElementById(ct_input_name).value = ct_set_challenge(ct_input_challenge);
|
571 |
}
|
572 |
-
|
573 |
function ct_set_challenge(val) {
|
574 |
return val;
|
575 |
-
};
|
576 |
-
|
577 |
-
// ]]>
|
578 |
</script>
|
579 |
';
|
580 |
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $ct_checkjs_key);
|
@@ -582,6 +578,10 @@ function ct_set_challenge(val) {
|
|
582 |
|
583 |
$html .= '<noscript><p><b>Please enable JavaScript to pass anti-spam protection!</b><br />Here are the instructions how to enable JavaScript in your web browser <a href="http://www.enable-javascript.com" rel="nofollow" target="_blank">http://www.enable-javascript.com</a>.<br />' . $ct_plugin_name . '.</p></noscript>';
|
584 |
|
|
|
|
|
|
|
|
|
585 |
if ($return_string === true) {
|
586 |
return $html;
|
587 |
} else {
|
@@ -1244,30 +1244,21 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1244 |
|
1245 |
$ct_signup_done = true;
|
1246 |
|
1247 |
-
if ($ct_result->errno != 0) {
|
|
|
1248 |
return $errors;
|
1249 |
}
|
1250 |
|
1251 |
-
// Restart submit form counter for failed requests
|
1252 |
-
if ($ct_result->allow == 0) {
|
1253 |
-
$_SESSION[$ct_formtime_label] = time();
|
1254 |
-
}
|
1255 |
-
|
1256 |
if ($ct_result->inactive != 0) {
|
1257 |
-
|
1258 |
-
if(time() - 900 > $timelabel_reg){
|
1259 |
-
update_option('cleantalk_timelabel_reg', time());
|
1260 |
-
|
1261 |
-
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
1262 |
-
$message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
|
1263 |
-
$message .= sprintf(__('"Anti-spam by CleanTalk" plugin error on your site %s:', 'cleantalk'), $blogname) . "\r\n\r\n";
|
1264 |
-
$message .= $ct_result->comment . "\r\n\r\n";
|
1265 |
-
@wp_mail(get_option('admin_email'), sprintf(__('[%s] Anti-spam by CleanTalk error!', 'cleantalk'), $blogname), $message);
|
1266 |
-
}
|
1267 |
return $errors;
|
1268 |
}
|
1269 |
|
1270 |
if ($ct_result->allow == 0) {
|
|
|
|
|
|
|
|
|
1271 |
if ($buddypress === true) {
|
1272 |
$bp->signup->errors['signup_username'] = $ct_result->comment;
|
1273 |
} else {
|
@@ -1836,5 +1827,25 @@ function delete_spam_comments() {
|
|
1836 |
return null;
|
1837 |
}
|
1838 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1839 |
|
1840 |
?>
|
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: 3.8
|
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-38';
|
14 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
15 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
16 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
84 |
// Post without page load
|
85 |
$ct_direct_post = 0;
|
86 |
|
87 |
+
// WP admin email notice interval in seconds
|
88 |
+
$ct_admin_notoice_period = 10800;
|
89 |
+
|
90 |
// Init action.
|
91 |
add_action('init', 'ct_init', 1);
|
92 |
|
291 |
'ssl_on' => 0, // Secure connection to servers
|
292 |
'next_account_status_check' => 0, // Time label when the plugin should check account status
|
293 |
'user_token' => '', // User token
|
294 |
+
'relevance_test' => 0, // Test comment for relevance
|
295 |
+
'notice_api_errors' => 0 // Send API error notices to WP admin
|
296 |
);
|
297 |
}
|
298 |
|
549 |
if ($cookie_check) {
|
550 |
$html = '
|
551 |
<script type="text/javascript">
|
|
|
552 |
function ctSetCookie(c_name, value) {
|
553 |
document.cookie = c_name + "=" + escape(value) + "; path=/";
|
554 |
}
|
555 |
ctSetCookie("%s", "%s");
|
|
|
556 |
</script>
|
557 |
';
|
558 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
561 |
$html = '
|
562 |
<input type="hidden" id="%s" name="%s" value="%s" />
|
563 |
<script type="text/javascript">
|
|
|
564 |
var ct_input_name = \'%s\';
|
565 |
var ct_input_value = document.getElementById(ct_input_name).value;
|
566 |
+
var ct_input_challenge = \'%s\';
|
|
|
567 |
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, ct_input_challenge);
|
|
|
568 |
if (document.getElementById(ct_input_name).value == ct_input_value) {
|
569 |
document.getElementById(ct_input_name).value = ct_set_challenge(ct_input_challenge);
|
570 |
}
|
|
|
571 |
function ct_set_challenge(val) {
|
572 |
return val;
|
573 |
+
};
|
|
|
|
|
574 |
</script>
|
575 |
';
|
576 |
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $ct_checkjs_key);
|
578 |
|
579 |
$html .= '<noscript><p><b>Please enable JavaScript to pass anti-spam protection!</b><br />Here are the instructions how to enable JavaScript in your web browser <a href="http://www.enable-javascript.com" rel="nofollow" target="_blank">http://www.enable-javascript.com</a>.<br />' . $ct_plugin_name . '.</p></noscript>';
|
580 |
|
581 |
+
// Simplify JS code
|
582 |
+
// and fixing issue with wpautop()
|
583 |
+
$html = str_replace(array("\n","\r"),'', $html);
|
584 |
+
|
585 |
if ($return_string === true) {
|
586 |
return $html;
|
587 |
} else {
|
1244 |
|
1245 |
$ct_signup_done = true;
|
1246 |
|
1247 |
+
if ($ct_result->errno != 0 && $options['notice_api_errors']) {
|
1248 |
+
ct_send_error_notice($ct_result->comment);
|
1249 |
return $errors;
|
1250 |
}
|
1251 |
|
|
|
|
|
|
|
|
|
|
|
1252 |
if ($ct_result->inactive != 0) {
|
1253 |
+
ct_send_error_notice($ct_result->comment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1254 |
return $errors;
|
1255 |
}
|
1256 |
|
1257 |
if ($ct_result->allow == 0) {
|
1258 |
+
|
1259 |
+
// Restart submit form counter for failed requests
|
1260 |
+
$_SESSION[$ct_formtime_label] = time();
|
1261 |
+
|
1262 |
if ($buddypress === true) {
|
1263 |
$bp->signup->errors['signup_username'] = $ct_result->comment;
|
1264 |
} else {
|
1827 |
return null;
|
1828 |
}
|
1829 |
|
1830 |
+
/**
|
1831 |
+
* Sends error notice to admin
|
1832 |
+
* @return null
|
1833 |
+
*/
|
1834 |
+
function ct_send_error_notice ($comment = '') {
|
1835 |
+
global $ct_plugin_name, $ct_admin_notoice_period;
|
1836 |
+
|
1837 |
+
$timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
|
1838 |
+
if(time() - $ct_admin_notoice_period > $timelabel_reg){
|
1839 |
+
update_option('cleantalk_timelabel_reg', time());
|
1840 |
+
|
1841 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
1842 |
+
$message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
|
1843 |
+
$message .= sprintf(__('"%s" plugin error on your site %s:', 'cleantalk'), $ct_plugin_name, $blogname) . "\r\n\r\n";
|
1844 |
+
$message .= $comment . "\r\n\r\n";
|
1845 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] %s error!', 'cleantalk'), $ct_plugin_name, $blogname), $message);
|
1846 |
+
}
|
1847 |
+
|
1848 |
+
return null;
|
1849 |
+
}
|
1850 |
|
1851 |
?>
|
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, cf7, form
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.0
|
6 |
-
Stable tag: 3.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -151,6 +151,10 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
|
|
151 |
1. Anti spam stopped spam bot at the CAPTCHA less registration form.
|
152 |
|
153 |
== Changelog ==
|
|
|
|
|
|
|
|
|
154 |
= 3.6 2014-09-15 =
|
155 |
* Fixed preg_match() issue for Formidable forms and Custom contact forms.
|
156 |
* Improved anti spam protection for Custom contact forms.
|
@@ -393,6 +397,9 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
|
|
393 |
* First version
|
394 |
|
395 |
== Upgrade Notice ==
|
|
|
|
|
|
|
396 |
= 3.6 2014-09-15 =
|
397 |
Minor fixes in anti spam protection for Formidable and custom contact forms.
|
398 |
|
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, cf7, form
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.0
|
6 |
+
Stable tag: 3.8
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
151 |
1. Anti spam stopped spam bot at the CAPTCHA less registration form.
|
152 |
|
153 |
== Changelog ==
|
154 |
+
= 3.8 2014-09-19 =
|
155 |
+
* Fixed json_encode() + malformed characters.
|
156 |
+
* Fixed JavaScript issue with wpautop().
|
157 |
+
|
158 |
= 3.6 2014-09-15 =
|
159 |
* Fixed preg_match() issue for Formidable forms and Custom contact forms.
|
160 |
* Improved anti spam protection for Custom contact forms.
|
397 |
* First version
|
398 |
|
399 |
== Upgrade Notice ==
|
400 |
+
= 3.8 2014-09-19 =
|
401 |
+
Bug fix release. Minor fixes in API class and JavaScript anti spam test.
|
402 |
+
|
403 |
= 3.6 2014-09-15 =
|
404 |
Minor fixes in anti spam protection for Formidable and custom contact forms.
|
405 |
|