Version Description
2015-06-01 = * Added option for checking all post data for spam * Some JavaScript protection improvements * Added option for old JavaScript check (without AJAX)
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.12 |
Comparing to | |
See all releases |
Code changes from version 5.10 to 5.12
- cleantalk-admin.php +43 -1
- cleantalk-common.php +67 -1
- cleantalk-public.php +110 -7
- cleantalk.class.php +11 -0
- cleantalk.php +19 -5
- cleantalk_nocache.js +56 -12
- readme.txt +18 -5
cleantalk-admin.php
CHANGED
@@ -198,7 +198,9 @@ function ct_admin_init() {
|
|
198 |
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
199 |
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
200 |
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
201 |
add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
202 |
}
|
203 |
|
204 |
/**
|
@@ -319,6 +321,7 @@ function ct_section_settings_state() {
|
|
319 |
{
|
320 |
print ' <img src="' . plugin_dir_url(__FILE__) . 'inc/images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
321 |
}
|
|
|
322 |
print "</div>";
|
323 |
if($test_failed)
|
324 |
{
|
@@ -449,7 +452,46 @@ function ct_input_show_adminbar() {
|
|
449 |
echo "<input type='radio' id='cleantalk_show_adminbar1' name='cleantalk_settings[show_adminbar]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar1'> " . __('Yes') . "</label>";
|
450 |
echo ' ';
|
451 |
echo "<input type='radio' id='cleantalk_show_adminbar0' name='cleantalk_settings[show_adminbar]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar0'> " . __('No') . "</label>";
|
452 |
-
admin_addDescriptionsFields(sprintf(__('Show
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
}
|
454 |
|
455 |
/**
|
198 |
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
199 |
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
200 |
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
201 |
+
add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
202 |
add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
|
203 |
+
add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
|
204 |
}
|
205 |
|
206 |
/**
|
321 |
{
|
322 |
print ' <img src="' . plugin_dir_url(__FILE__) . 'inc/images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
323 |
}
|
324 |
+
|
325 |
print "</div>";
|
326 |
if($test_failed)
|
327 |
{
|
452 |
echo "<input type='radio' id='cleantalk_show_adminbar1' name='cleantalk_settings[show_adminbar]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar1'> " . __('Yes') . "</label>";
|
453 |
echo ' ';
|
454 |
echo "<input type='radio' id='cleantalk_show_adminbar0' name='cleantalk_settings[show_adminbar]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar0'> " . __('No') . "</label>";
|
455 |
+
admin_addDescriptionsFields(sprintf(__('Show/hide CleanTalk icon in top level menu in WordPress backend.', 'cleantalk'), $ct_options['show_adminbar']));
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
|
460 |
+
*
|
461 |
+
* @return null
|
462 |
+
*/
|
463 |
+
function ct_input_general_postdata_test() {
|
464 |
+
global $ct_options, $ct_data;
|
465 |
+
|
466 |
+
if(isset($ct_options['general_postdata_test']))
|
467 |
+
{
|
468 |
+
$value = @intval($ct_options['general_postdata_test']);
|
469 |
+
}
|
470 |
+
else
|
471 |
+
{
|
472 |
+
$value=0;
|
473 |
+
}
|
474 |
+
echo "<input type='radio' id='cleantalk_general_postdata_test1' name='cleantalk_settings[general_postdata_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test1'> " . __('Yes') . "</label>";
|
475 |
+
echo ' ';
|
476 |
+
echo "<input type='radio' id='cleantalk_general_postdata_test0' name='cleantalk_settings[general_postdata_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test0'> " . __('No') . "</label>";
|
477 |
+
@admin_addDescriptionsFields(sprintf(__('Check all POST submissions from website visitors. Enable this option if you have spam misses on website or you don`t have records about missed spam in <a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk dashboard</a>.', 'cleantalk'), $ct_options['general_postdata_test']));
|
478 |
+
}
|
479 |
+
|
480 |
+
function ct_input_use_ajax() {
|
481 |
+
global $ct_options, $ct_data;
|
482 |
+
|
483 |
+
if(isset($ct_options['use_ajax']))
|
484 |
+
{
|
485 |
+
$value = @intval($ct_options['use_ajax']);
|
486 |
+
}
|
487 |
+
else
|
488 |
+
{
|
489 |
+
$value=1;
|
490 |
+
}
|
491 |
+
echo "<input type='radio' id='cleantalk_use_ajax1' name='cleantalk_settings[use_ajax]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_use_ajax1'> " . __('Yes') . "</label>";
|
492 |
+
echo ' ';
|
493 |
+
echo "<input type='radio' id='cleantalk_use_ajax0' name='cleantalk_settings[use_ajax]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_use_ajax0'> " . __('No') . "</label>";
|
494 |
+
@admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
|
495 |
}
|
496 |
|
497 |
/**
|
cleantalk-common.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$ct_agent_version = 'wordpress-
|
4 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
5 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
6 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
@@ -544,6 +544,10 @@ function delete_spam_comments() {
|
|
544 |
return null;
|
545 |
}
|
546 |
|
|
|
|
|
|
|
|
|
547 |
function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$arr)
|
548 |
{
|
549 |
$skip_params = array(
|
@@ -582,4 +586,66 @@ function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$ar
|
|
582 |
}
|
583 |
}
|
584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
$ct_agent_version = 'wordpress-512';
|
4 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
5 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
6 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
544 |
return null;
|
545 |
}
|
546 |
|
547 |
+
/*
|
548 |
+
* Get data from submit recursively
|
549 |
+
*/
|
550 |
+
|
551 |
function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$arr)
|
552 |
{
|
553 |
$skip_params = array(
|
586 |
}
|
587 |
}
|
588 |
|
589 |
+
function ct_get_fields_any_postdata(&$message,$arr)
|
590 |
+
{
|
591 |
+
$skip_params = array(
|
592 |
+
'ipn_track_id', // PayPal IPN #
|
593 |
+
'txn_type', // PayPal transaction type
|
594 |
+
'payment_status', // PayPal payment status
|
595 |
+
);
|
596 |
+
foreach($arr as $key=>$value)
|
597 |
+
{
|
598 |
+
if(!is_array($value))
|
599 |
+
{
|
600 |
+
if (in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) {
|
601 |
+
//$contact = false;
|
602 |
+
}
|
603 |
+
else
|
604 |
+
{
|
605 |
+
$message.="$value\n";
|
606 |
+
}
|
607 |
+
}
|
608 |
+
else
|
609 |
+
{
|
610 |
+
ct_get_fields_any_postdata($message, $value);
|
611 |
+
}
|
612 |
+
}
|
613 |
+
}
|
614 |
+
|
615 |
+
/*
|
616 |
+
* Check if Array has keys with restricted names
|
617 |
+
*/
|
618 |
+
|
619 |
+
$ct_check_post_result=false;
|
620 |
+
|
621 |
+
function ct_check_array_keys_loop($key)
|
622 |
+
{
|
623 |
+
global $ct_check_post_result;
|
624 |
+
$strict=Array('pass','login','pwd');
|
625 |
+
for($i=0;$i<sizeof($strict);$i++)
|
626 |
+
{
|
627 |
+
if(stripos($key,$strict[$i])!==false)
|
628 |
+
{
|
629 |
+
$ct_check_post_result=true;
|
630 |
+
}
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
function ct_check_array_keys($arr)
|
635 |
+
{
|
636 |
+
global $ct_check_post_result;
|
637 |
+
foreach($arr as $key=>$value)
|
638 |
+
{
|
639 |
+
if(!is_array($value))
|
640 |
+
{
|
641 |
+
ct_check_array_keys_loop($key);
|
642 |
+
}
|
643 |
+
else
|
644 |
+
{
|
645 |
+
ct_check_array_keys($value);
|
646 |
+
}
|
647 |
+
}
|
648 |
+
return $ct_check_post_result;
|
649 |
+
}
|
650 |
+
|
651 |
?>
|
cleantalk-public.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @return mixed[] Array of options
|
6 |
*/
|
7 |
function ct_init() {
|
8 |
-
global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_direct_post, $ct_options, $ct_data;
|
9 |
|
10 |
$ct_options = ct_get_options();
|
11 |
|
@@ -19,6 +19,15 @@ function ct_init() {
|
|
19 |
$_SESSION[$ct_formtime_label] = time();
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
//add_action('wp_footer','ct_ajaxurl');
|
23 |
|
24 |
// Fast Secure contact form
|
@@ -128,6 +137,11 @@ function ct_init() {
|
|
128 |
if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])) {
|
129 |
ct_contact_form_validate();
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
}
|
133 |
|
@@ -177,7 +191,16 @@ function ct_footer_add_cookie() {
|
|
177 |
* @param bool $random_key switch on generation random key for every page load
|
178 |
*/
|
179 |
function ct_add_hidden_fields($random_key = false, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
180 |
-
global $ct_checkjs_def, $ct_plugin_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
$ct_checkjs_key = ct_get_checkjs_value($random_key);
|
183 |
$field_id_hash = md5(rand(0, 1000));
|
@@ -193,7 +216,10 @@ ctSetCookie("%s", "%s", "%s");
|
|
193 |
';
|
194 |
$html = sprintf($html, $field_name, $ct_checkjs_key, $ct_checkjs_def);
|
195 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
196 |
-
$
|
|
|
|
|
|
|
197 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
198 |
} else {
|
199 |
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
@@ -207,8 +233,11 @@ setTimeout(function(){var ct_input_name = \'%s\';var ct_input_value = document.g
|
|
207 |
';
|
208 |
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $ct_input_challenge);
|
209 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
210 |
-
$
|
211 |
-
|
|
|
|
|
|
|
212 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
213 |
};
|
214 |
|
@@ -820,6 +849,8 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
820 |
$submit_time = submit_time_test();
|
821 |
|
822 |
$sender_info = get_sender_info();
|
|
|
|
|
823 |
|
824 |
$checkjs = js_test($ct_checkjs_register_form, $_POST, true);
|
825 |
$sender_info['post_checkjs_passed'] = $checkjs;
|
@@ -827,7 +858,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
827 |
//
|
828 |
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
829 |
//
|
830 |
-
if ($checkjs
|
831 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
832 |
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
833 |
}
|
@@ -1407,7 +1438,6 @@ function ct_contact_form_validate () {
|
|
1407 |
{
|
1408 |
return null;
|
1409 |
}
|
1410 |
-
$cleantalk_executed=true;
|
1411 |
/*if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
|
1412 |
{
|
1413 |
return null;
|
@@ -1452,6 +1482,79 @@ function ct_contact_form_validate () {
|
|
1452 |
'checkjs' => $checkjs
|
1453 |
));
|
1454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1455 |
$ct = $ct_base_call_result['ct'];
|
1456 |
$ct_result = $ct_base_call_result['ct_result'];
|
1457 |
|
5 |
* @return mixed[] Array of options
|
6 |
*/
|
7 |
function ct_init() {
|
8 |
+
global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_direct_post, $ct_options, $ct_data, $ct_check_post_result;
|
9 |
|
10 |
$ct_options = ct_get_options();
|
11 |
|
19 |
$_SESSION[$ct_formtime_label] = time();
|
20 |
}
|
21 |
|
22 |
+
if(isset($ct_options['general_postdata_test']))
|
23 |
+
{
|
24 |
+
$ct_general_postdata_test = @intval($ct_options['general_postdata_test']);
|
25 |
+
}
|
26 |
+
else
|
27 |
+
{
|
28 |
+
$ct_general_postdata_test=0;
|
29 |
+
}
|
30 |
+
|
31 |
//add_action('wp_footer','ct_ajaxurl');
|
32 |
|
33 |
// Fast Secure contact form
|
137 |
if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])) {
|
138 |
ct_contact_form_validate();
|
139 |
}
|
140 |
+
if($_SERVER['REQUEST_METHOD'] == 'POST' && $ct_general_postdata_test==1 && !is_admin())
|
141 |
+
{
|
142 |
+
$ct_check_post_result=false;
|
143 |
+
ct_contact_form_validate_postdata();
|
144 |
+
}
|
145 |
}
|
146 |
}
|
147 |
|
191 |
* @param bool $random_key switch on generation random key for every page load
|
192 |
*/
|
193 |
function ct_add_hidden_fields($random_key = false, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
194 |
+
global $ct_checkjs_def, $ct_plugin_name, $ct_options;
|
195 |
+
$ct_options=ct_get_options();
|
196 |
+
if(isset($ct_options['use_ajax']))
|
197 |
+
{
|
198 |
+
$use_ajax = @intval($ct_options['use_ajax']);
|
199 |
+
}
|
200 |
+
else
|
201 |
+
{
|
202 |
+
$use_ajax=1;
|
203 |
+
}
|
204 |
|
205 |
$ct_checkjs_key = ct_get_checkjs_value($random_key);
|
206 |
$field_id_hash = md5(rand(0, 1000));
|
216 |
';
|
217 |
$html = sprintf($html, $field_name, $ct_checkjs_key, $ct_checkjs_def);
|
218 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
219 |
+
if($use_ajax==1)
|
220 |
+
{
|
221 |
+
$html='';
|
222 |
+
}
|
223 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
224 |
} else {
|
225 |
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
233 |
';
|
234 |
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $ct_input_challenge);
|
235 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
236 |
+
if($use_ajax==1)
|
237 |
+
{
|
238 |
+
$html='<input type="hidden" id="%s" name="%s" value="%s" />';
|
239 |
+
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def);
|
240 |
+
}
|
241 |
/*!!! IT'S A TEMPORARILY CODE FOR DEBUGGING CF7 !!!*/
|
242 |
};
|
243 |
|
849 |
$submit_time = submit_time_test();
|
850 |
|
851 |
$sender_info = get_sender_info();
|
852 |
+
|
853 |
+
$checkjs=0;
|
854 |
|
855 |
$checkjs = js_test($ct_checkjs_register_form, $_POST, true);
|
856 |
$sender_info['post_checkjs_passed'] = $checkjs;
|
858 |
//
|
859 |
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
860 |
//
|
861 |
+
if ($checkjs == 0) {
|
862 |
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
863 |
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
864 |
}
|
1438 |
{
|
1439 |
return null;
|
1440 |
}
|
|
|
1441 |
/*if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
|
1442 |
{
|
1443 |
return null;
|
1482 |
'checkjs' => $checkjs
|
1483 |
));
|
1484 |
|
1485 |
+
$cleantalk_executed=true;
|
1486 |
+
|
1487 |
+
$ct = $ct_base_call_result['ct'];
|
1488 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
1489 |
+
|
1490 |
+
if ($ct_result->allow == 0) {
|
1491 |
+
|
1492 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
1493 |
+
global $ct_comment;
|
1494 |
+
$ct_comment = $ct_result->comment;
|
1495 |
+
ct_die(null, null);
|
1496 |
+
} else {
|
1497 |
+
echo $ct_result->comment;
|
1498 |
+
}
|
1499 |
+
exit;
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
return null;
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
/**
|
1506 |
+
* General test for any post data
|
1507 |
+
*/
|
1508 |
+
function ct_contact_form_validate_postdata () {
|
1509 |
+
global $pagenow,$cleantalk_executed;
|
1510 |
+
if($cleantalk_executed)
|
1511 |
+
{
|
1512 |
+
return null;
|
1513 |
+
}
|
1514 |
+
if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
|
1515 |
+
{
|
1516 |
+
return null;
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
|
1520 |
+
if ($_SERVER['REQUEST_METHOD'] != 'POST' ||
|
1521 |
+
(isset($_POST['log']) && isset($_POST['pwd']) && isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
1522 |
+
(isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword')||
|
1523 |
+
ct_check_array_keys($_POST) ||
|
1524 |
+
(isset($pagenow) && $pagenow == 'wp-cron.php')
|
1525 |
+
) {
|
1526 |
+
return null;
|
1527 |
+
}
|
1528 |
+
|
1529 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
1530 |
+
|
1531 |
+
$post_info['comment_type'] = 'feedback_general_postdata';
|
1532 |
+
$post_info = json_encode($post_info);
|
1533 |
+
if ($post_info === false) {
|
1534 |
+
$post_info = '';
|
1535 |
+
}
|
1536 |
+
|
1537 |
+
$message = '';
|
1538 |
+
|
1539 |
+
ct_get_fields_any_postdata($message, $_POST);
|
1540 |
+
|
1541 |
+
if(strlen(trim($message))<10)
|
1542 |
+
{
|
1543 |
+
return null;
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
$ct_base_call_result = ct_base_call(array(
|
1547 |
+
'message' => $message,
|
1548 |
+
'example' => null,
|
1549 |
+
'sender_email' => '',
|
1550 |
+
'sender_nickname' => '',
|
1551 |
+
'post_info' => $post_info,
|
1552 |
+
'sender_info' => get_sender_info(),
|
1553 |
+
'checkjs' => $checkjs
|
1554 |
+
));
|
1555 |
+
|
1556 |
+
$cleantalk_executed=true;
|
1557 |
+
|
1558 |
$ct = $ct_base_call_result['ct'];
|
1559 |
$ct_result = $ct_base_call_result['ct_result'];
|
1560 |
|
cleantalk.class.php
CHANGED
@@ -191,6 +191,12 @@ class CleantalkRequest {
|
|
191 |
*/
|
192 |
public $all_headers = null;
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
/**
|
195 |
* Last error number
|
196 |
* @var integer
|
@@ -689,6 +695,11 @@ class Cleantalk {
|
|
689 |
private function httpRequest($msg) {
|
690 |
$result = false;
|
691 |
$msg->all_headers=json_encode(apache_request_headers());
|
|
|
|
|
|
|
|
|
|
|
692 |
if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
|
693 |
|| $this->stay_on_server == true) {
|
694 |
|
191 |
*/
|
192 |
public $all_headers = null;
|
193 |
|
194 |
+
/**
|
195 |
+
* IP address of connection
|
196 |
+
* @var string
|
197 |
+
*/
|
198 |
+
//public $remote_addr = null;
|
199 |
+
|
200 |
/**
|
201 |
* Last error number
|
202 |
* @var integer
|
695 |
private function httpRequest($msg) {
|
696 |
$result = false;
|
697 |
$msg->all_headers=json_encode(apache_request_headers());
|
698 |
+
//$msg->remote_addr=$_SERVER['REMOTE_ADDR'];
|
699 |
+
//$msg->sender_info['remote_addr']=$_SERVER['REMOTE_ADDR'];
|
700 |
+
$si=json_decode($msg->sender_info,true);
|
701 |
+
$si['remote_addr']=$_SERVER['REMOTE_ADDR'];
|
702 |
+
$msg->sender_info=json_encode($si);
|
703 |
if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
|
704 |
|| $this->stay_on_server == true) {
|
705 |
|
cleantalk.php
CHANGED
@@ -3,11 +3,11 @@
|
|
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: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
$cleantalk_executed=false;
|
12 |
|
13 |
if(!defined('CLEANTALK_PLUGIN_DIR')){
|
@@ -26,9 +26,23 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
26 |
// After plugin loaded - to load locale as described in manual
|
27 |
add_action( 'plugins_loaded', 'ct_plugin_loaded' );
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
33 |
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
34 |
|
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: 5.12
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.12';
|
11 |
$cleantalk_executed=false;
|
12 |
|
13 |
if(!defined('CLEANTALK_PLUGIN_DIR')){
|
26 |
// After plugin loaded - to load locale as described in manual
|
27 |
add_action( 'plugins_loaded', 'ct_plugin_loaded' );
|
28 |
|
29 |
+
$ct_options=ct_get_options();
|
30 |
+
if(isset($ct_options['use_ajax']))
|
31 |
+
{
|
32 |
+
$use_ajax = @intval($ct_options['use_ajax']);
|
33 |
+
}
|
34 |
+
else
|
35 |
+
{
|
36 |
+
$use_ajax=1;
|
37 |
+
}
|
38 |
+
|
39 |
+
if($use_ajax==1)
|
40 |
+
{
|
41 |
+
add_action('wp_loaded', 'ct_add_nocache_script', 1);
|
42 |
+
add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
|
43 |
+
add_action('wp_head', 'ct_add_nocache_script_header', 1);
|
44 |
+
}
|
45 |
+
|
46 |
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
47 |
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
48 |
|
cleantalk_nocache.js
CHANGED
@@ -38,11 +38,15 @@ function createXMLHTTPObject() {
|
|
38 |
return xmlhttp;
|
39 |
}
|
40 |
|
41 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
{
|
43 |
-
ct_cookie=req.responseText.trim();
|
44 |
-
//alert('Key value: ' + ct_cookie);
|
45 |
-
|
46 |
var domain=location.hostname;
|
47 |
tmp=domain.split('.');
|
48 |
if(tmp[0].toLowerCase()=='www')
|
@@ -55,17 +59,22 @@ function ct_callback(req)
|
|
55 |
}
|
56 |
domain=tmp.join('.');
|
57 |
|
58 |
-
document.cookie = "
|
59 |
-
document.cookie = "
|
60 |
-
document.cookie = "
|
61 |
-
|
62 |
-
|
63 |
|
64 |
var date = new Date;
|
65 |
date.setDate(date.getDate() + 1);
|
66 |
-
setTimeout(function() { document.cookie = "
|
|
|
67 |
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
for(i=0;i<document.forms.length;i++)
|
70 |
{
|
71 |
f=document.forms[i];
|
@@ -79,9 +88,44 @@ function ct_callback(req)
|
|
79 |
}
|
80 |
}
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
|
|
83 |
if(ct_nocache_executed==undefined)
|
84 |
{
|
85 |
var ct_nocache_executed=true;
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
38 |
return xmlhttp;
|
39 |
}
|
40 |
|
41 |
+
function ct_getCookie(name) {
|
42 |
+
var matches = document.cookie.match(new RegExp(
|
43 |
+
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
|
44 |
+
));
|
45 |
+
return matches ? decodeURIComponent(matches[1]) : undefined;
|
46 |
+
}
|
47 |
+
|
48 |
+
function ct_setCookie(name, value)
|
49 |
{
|
|
|
|
|
|
|
50 |
var domain=location.hostname;
|
51 |
tmp=domain.split('.');
|
52 |
if(tmp[0].toLowerCase()=='www')
|
59 |
}
|
60 |
domain=tmp.join('.');
|
61 |
|
62 |
+
document.cookie = name+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /";
|
63 |
+
document.cookie = name+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT";
|
64 |
+
document.cookie = name+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; domain = " + domain;
|
|
|
|
|
65 |
|
66 |
var date = new Date;
|
67 |
date.setDate(date.getDate() + 1);
|
68 |
+
setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain}, 200)
|
69 |
+
}
|
70 |
|
71 |
+
function ct_callback(req)
|
72 |
+
{
|
73 |
+
ct_cookie=req.responseText.trim();
|
74 |
+
//alert('Key value: ' + ct_cookie);
|
75 |
+
|
76 |
+
ct_setCookie('ct_checkjs', ct_cookie);
|
77 |
+
|
78 |
for(i=0;i<document.forms.length;i++)
|
79 |
{
|
80 |
f=document.forms[i];
|
88 |
}
|
89 |
}
|
90 |
}
|
91 |
+
|
92 |
+
//alert('Set cookie: \n' + document.cookie);
|
93 |
+
}
|
94 |
+
|
95 |
+
if (!Date.now) {
|
96 |
+
Date.now = function() { return new Date().getTime(); }
|
97 |
}
|
98 |
+
|
99 |
if(ct_nocache_executed==undefined)
|
100 |
{
|
101 |
var ct_nocache_executed=true;
|
102 |
+
var new_timestamp=Math.floor(Date.now() / 1000);
|
103 |
+
|
104 |
+
var old_timestamp=ct_getCookie('ct_timestamp');
|
105 |
+
|
106 |
+
var checkjs_cookie=ct_getCookie('ct_checkjs');
|
107 |
+
|
108 |
+
if(checkjs_cookie!=undefined)
|
109 |
+
{
|
110 |
+
for(i=0;i<document.forms.length;i++)
|
111 |
+
{
|
112 |
+
f=document.forms[i];
|
113 |
+
for(j=0;j<f.elements.length;j++)
|
114 |
+
{
|
115 |
+
e=f.elements[j];
|
116 |
+
if(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)
|
117 |
+
{
|
118 |
+
e.value=checkjs_cookie;
|
119 |
+
//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
if(old_timestamp==undefined||new_timestamp-old_timestamp>82800) //82800 is 23 hours
|
126 |
+
{
|
127 |
+
ct_setCookie('ct_timestamp', new_timestamp);
|
128 |
+
//alert('set!');
|
129 |
+
sendRequest(ct_ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');
|
130 |
+
}
|
131 |
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
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, form, Formidable spam, jetpack spam, 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, widget, widget antispam,
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.2.2
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -21,7 +21,7 @@ No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam b
|
|
21 |
1. Stops spam bookings.
|
22 |
1. Stops spam subscriptions.
|
23 |
1. Stops spam in widgets.
|
24 |
-
1. Check existing comments for spam
|
25 |
|
26 |
= Spam protection =
|
27 |
* WordPress, JetPack comments.
|
@@ -31,6 +31,9 @@ No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam b
|
|
31 |
* WordPress Landing Pages.
|
32 |
* Any WordPress form (option 'Custom contact forms').
|
33 |
|
|
|
|
|
|
|
34 |
= Check existing comments for spam =
|
35 |
With the help of anti-spam CleanTalk you can check existing comments, to find and quickly delete spam comments. For use this function, go to WP Console->Comments->Find spam comments.
|
36 |
|
@@ -46,7 +49,7 @@ We have developed antispam for WordPress that would provide **maximum protection
|
|
46 |
|
47 |
The anti-spam method offered by CleanTalk allows to switch from the methods that trouble the communication (CAPTCHA, question-answer etc.) to a more convenient one.
|
48 |
|
49 |
-
CleanTalk is premium anti-spam for WordPress, please look at the <a href="http://cleantalk.org/price">pricing</a>. The plugin works with cloud anti spam service CleanTalk. <b>CleanTalk has free trial for 14 days.</b> We try to provide anti-spam service at the highest level and we can not afford to offer a free version of our service, as this will immediately affect the quality of providing anti-spam protection. Paying for a year of anti-spam service, you save a lot more and get:
|
50 |
|
51 |
* Up to 100% protection against spam bots.
|
52 |
* Time and resources saving.
|
@@ -111,7 +114,7 @@ Please use email **stop_email@example.com** for comments, contacts or signups to
|
|
111 |
Plugin Anti-spam by CleanTalk stops up to 100% of spam comments, spam signups (registrations), spam contact emails, spam subscriptions, spam bookings or spam orders.
|
112 |
|
113 |
= What about pingback, trackback spam? =
|
114 |
-
Plugin by default pass pingbacks without any checks. All trackbacks will be blocked if the sender
|
115 |
|
116 |
= Can I use CleanTalk with Akismet? =
|
117 |
Sure, you can use CleanTalk with Akismet. In this case probably you will have bigger false/positive rate (when legitimate comments/signups denies), but you will have stronger antispam protection at website.
|
@@ -181,6 +184,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
181 |
1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
|
182 |
|
183 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
184 |
= 5.10 2015-05-25 =
|
185 |
* Fixed Javascript error on some forms
|
186 |
|
@@ -574,6 +582,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
574 |
* First version
|
575 |
|
576 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
577 |
= 5.10 2015-05-25 =
|
578 |
* Fixed Javascript error on some forms
|
579 |
|
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, form, Formidable spam, jetpack spam, 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, widget, widget spam, registration, plugin, antispam plugin, spam plugin, anti-spam plugin, ninja, cache spam
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.2.2
|
6 |
+
Stable tag: 5.12
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
21 |
1. Stops spam bookings.
|
22 |
1. Stops spam subscriptions.
|
23 |
1. Stops spam in widgets.
|
24 |
+
1. Check existing comments for spam.
|
25 |
|
26 |
= Spam protection =
|
27 |
* WordPress, JetPack comments.
|
31 |
* WordPress Landing Pages.
|
32 |
* Any WordPress form (option 'Custom contact forms').
|
33 |
|
34 |
+
= Compatible with WordPress cache plugins =
|
35 |
+
* W3 Total Cache, Quick Cache, WP Fastest Cache, Hyper Cache, WP Super cache
|
36 |
+
|
37 |
= Check existing comments for spam =
|
38 |
With the help of anti-spam CleanTalk you can check existing comments, to find and quickly delete spam comments. For use this function, go to WP Console->Comments->Find spam comments.
|
39 |
|
49 |
|
50 |
The anti-spam method offered by CleanTalk allows to switch from the methods that trouble the communication (CAPTCHA, question-answer etc.) to a more convenient one.
|
51 |
|
52 |
+
CleanTalk is premium anti-spam service for WordPress, please look at the <a href="http://cleantalk.org/price">pricing</a>. The plugin works with cloud anti spam service CleanTalk. <b>CleanTalk has free trial for 14 days.</b> We try to provide anti-spam service at the highest level and we can not afford to offer a free version of our service, as this will immediately affect the quality of providing anti-spam protection. Paying for a year of anti-spam service, you save a lot more and get:
|
53 |
|
54 |
* Up to 100% protection against spam bots.
|
55 |
* Time and resources saving.
|
114 |
Plugin Anti-spam by CleanTalk stops up to 100% of spam comments, spam signups (registrations), spam contact emails, spam subscriptions, spam bookings or spam orders.
|
115 |
|
116 |
= What about pingback, trackback spam? =
|
117 |
+
Plugin by default pass pingbacks without any checks. All trackbacks will be blocked if the sender had spam activity.
|
118 |
|
119 |
= Can I use CleanTalk with Akismet? =
|
120 |
Sure, you can use CleanTalk with Akismet. In this case probably you will have bigger false/positive rate (when legitimate comments/signups denies), but you will have stronger antispam protection at website.
|
184 |
1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
|
185 |
|
186 |
== Changelog ==
|
187 |
+
= 5.12 2015-06-01 =
|
188 |
+
* Added option for checking all post data for spam
|
189 |
+
* Some JavaScript protection improvements
|
190 |
+
* Added option for old JavaScript check (without AJAX)
|
191 |
+
|
192 |
= 5.10 2015-05-25 =
|
193 |
* Fixed Javascript error on some forms
|
194 |
|
582 |
* First version
|
583 |
|
584 |
== Upgrade Notice ==
|
585 |
+
= 5.12 2015-06-01 =
|
586 |
+
* Added option for checking all post data for spam
|
587 |
+
* Some JavaScript protection improvements
|
588 |
+
* Added option for old JavaScript check (without AJAX)
|
589 |
+
|
590 |
= 5.10 2015-05-25 =
|
591 |
* Fixed Javascript error on some forms
|
592 |
|