Version Description
2014-05-12 = * Added: Anti-spam protection for S2Member framework. * Improved: JavaScript anti-spam test. * Improved: Plugin load time for backend and frontend. * Fixed: PHP warning mb_convert_encoding()
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 2.44 |
Comparing to | |
See all releases |
Code changes from version 2.45 to 2.44
- cleantalk-utils.js +0 -13
- cleantalk-utils.php +0 -27
- cleantalk.class.php +2 -6
- cleantalk.php +28 -88
- readme.txt +1 -1
cleantalk-utils.js
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
|
2 |
-
/**
|
3 |
-
* Generates random password
|
4 |
-
*/
|
5 |
-
function ct_random_password(length, list) {
|
6 |
-
retVal = "";
|
7 |
-
for (var i = 0, n = list.length; i < length; ++i) {
|
8 |
-
retVal += list.charAt(Math.floor(Math.random() * n));
|
9 |
-
}
|
10 |
-
return retVal;
|
11 |
-
}
|
12 |
-
|
13 |
-
function md5cycle(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=ff(n,r,i,s,t[0],7,-680876936);s=ff(s,n,r,i,t[1],12,-389564586);i=ff(i,s,n,r,t[2],17,606105819);r=ff(r,i,s,n,t[3],22,-1044525330);n=ff(n,r,i,s,t[4],7,-176418897);s=ff(s,n,r,i,t[5],12,1200080426);i=ff(i,s,n,r,t[6],17,-1473231341);r=ff(r,i,s,n,t[7],22,-45705983);n=ff(n,r,i,s,t[8],7,1770035416);s=ff(s,n,r,i,t[9],12,-1958414417);i=ff(i,s,n,r,t[10],17,-42063);r=ff(r,i,s,n,t[11],22,-1990404162);n=ff(n,r,i,s,t[12],7,1804603682);s=ff(s,n,r,i,t[13],12,-40341101);i=ff(i,s,n,r,t[14],17,-1502002290);r=ff(r,i,s,n,t[15],22,1236535329);n=gg(n,r,i,s,t[1],5,-165796510);s=gg(s,n,r,i,t[6],9,-1069501632);i=gg(i,s,n,r,t[11],14,643717713);r=gg(r,i,s,n,t[0],20,-373897302);n=gg(n,r,i,s,t[5],5,-701558691);s=gg(s,n,r,i,t[10],9,38016083);i=gg(i,s,n,r,t[15],14,-660478335);r=gg(r,i,s,n,t[4],20,-405537848);n=gg(n,r,i,s,t[9],5,568446438);s=gg(s,n,r,i,t[14],9,-1019803690);i=gg(i,s,n,r,t[3],14,-187363961);r=gg(r,i,s,n,t[8],20,1163531501);n=gg(n,r,i,s,t[13],5,-1444681467);s=gg(s,n,r,i,t[2],9,-51403784);i=gg(i,s,n,r,t[7],14,1735328473);r=gg(r,i,s,n,t[12],20,-1926607734);n=hh(n,r,i,s,t[5],4,-378558);s=hh(s,n,r,i,t[8],11,-2022574463);i=hh(i,s,n,r,t[11],16,1839030562);r=hh(r,i,s,n,t[14],23,-35309556);n=hh(n,r,i,s,t[1],4,-1530992060);s=hh(s,n,r,i,t[4],11,1272893353);i=hh(i,s,n,r,t[7],16,-155497632);r=hh(r,i,s,n,t[10],23,-1094730640);n=hh(n,r,i,s,t[13],4,681279174);s=hh(s,n,r,i,t[0],11,-358537222);i=hh(i,s,n,r,t[3],16,-722521979);r=hh(r,i,s,n,t[6],23,76029189);n=hh(n,r,i,s,t[9],4,-640364487);s=hh(s,n,r,i,t[12],11,-421815835);i=hh(i,s,n,r,t[15],16,530742520);r=hh(r,i,s,n,t[2],23,-995338651);n=ii(n,r,i,s,t[0],6,-198630844);s=ii(s,n,r,i,t[7],10,1126891415);i=ii(i,s,n,r,t[14],15,-1416354905);r=ii(r,i,s,n,t[5],21,-57434055);n=ii(n,r,i,s,t[12],6,1700485571);s=ii(s,n,r,i,t[3],10,-1894986606);i=ii(i,s,n,r,t[10],15,-1051523);r=ii(r,i,s,n,t[1],21,-2054922799);n=ii(n,r,i,s,t[8],6,1873313359);s=ii(s,n,r,i,t[15],10,-30611744);i=ii(i,s,n,r,t[6],15,-1560198380);r=ii(r,i,s,n,t[13],21,1309151649);n=ii(n,r,i,s,t[4],6,-145523070);s=ii(s,n,r,i,t[11],10,-1120210379);i=ii(i,s,n,r,t[2],15,718787259);r=ii(r,i,s,n,t[9],21,-343485551);e[0]=add32(n,e[0]);e[1]=add32(r,e[1]);e[2]=add32(i,e[2]);e[3]=add32(s,e[3])}function cmn(e,t,n,r,i,s){t=add32(add32(t,e),add32(r,s));return add32(t<<i|t>>>32-i,n)}function ff(e,t,n,r,i,s,o){return cmn(t&n|~t&r,e,t,i,s,o)}function gg(e,t,n,r,i,s,o){return cmn(t&r|n&~r,e,t,i,s,o)}function hh(e,t,n,r,i,s,o){return cmn(t^n^r,e,t,i,s,o)}function ii(e,t,n,r,i,s,o){return cmn(n^(t|~r),e,t,i,s,o)}function md51(e){txt="";var t=e.length,n=[1732584193,-271733879,-1732584194,271733878],r;for(r=64;r<=e.length;r+=64){md5cycle(n,md5blk(e.substring(r-64,r)))}e=e.substring(r-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<e.length;r++)i[r>>2]|=e.charCodeAt(r)<<(r%4<<3);i[r>>2]|=128<<(r%4<<3);if(r>55){md5cycle(n,i);for(r=0;r<16;r++)i[r]=0}i[14]=t*8;md5cycle(n,i);return n}function md5blk(e){var t=[],n;for(n=0;n<64;n+=4){t[n>>2]=e.charCodeAt(n)+(e.charCodeAt(n+1)<<8)+(e.charCodeAt(n+2)<<16)+(e.charCodeAt(n+3)<<24)}return t}function rhex(e){var t="",n=0;for(;n<4;n++)t+=hex_chr[e>>n*8+4&15]+hex_chr[e>>n*8&15];return t}function hex(e){for(var t=0;t<e.length;t++)e[t]=rhex(e[t]);return e.join("")}function md5(e){return hex(md51(e))}function add32(e,t){return e+t&4294967295}var hex_chr="0123456789abcdef".split("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleantalk-utils.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Generates random password
|
5 |
-
* @param int $length
|
6 |
-
* @param string $list
|
7 |
-
* @return string
|
8 |
-
*/
|
9 |
-
function ct_random_password($length = 4, $list = '') {
|
10 |
-
return substr(str_shuffle($list), 0, $length);
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Check COOKIES
|
15 |
-
* @return null
|
16 |
-
*/
|
17 |
-
function ct_check_cookies() {
|
18 |
-
global $ct_session_name, $ct_plugin_name;
|
19 |
-
|
20 |
-
if (!isset($_COOKIE[$ct_session_name])) {
|
21 |
-
wp_die('<p>Sorry, this is error. Please enable Cookies in your browser and try again! ' . $ct_plugin_name . '</p>', null, array('back_link' => true));
|
22 |
-
}
|
23 |
-
|
24 |
-
return null;
|
25 |
-
}
|
26 |
-
|
27 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleantalk.class.php
CHANGED
@@ -898,12 +898,8 @@ class Cleantalk {
|
|
898 |
return mb_convert_encoding($str, 'UTF-8', $data_codepage);
|
899 |
|
900 |
$encoding = mb_detect_encoding($str);
|
901 |
-
if ($encoding
|
902 |
-
|
903 |
-
} else {
|
904 |
-
// Final cut of non UTF-8 characters
|
905 |
-
$str = preg_replace('/[^(\x20-\x7F)]*/','', $str);
|
906 |
-
}
|
907 |
}
|
908 |
|
909 |
return $str;
|
898 |
return mb_convert_encoding($str, 'UTF-8', $data_codepage);
|
899 |
|
900 |
$encoding = mb_detect_encoding($str);
|
901 |
+
if ($encoding)
|
902 |
+
return @mb_convert_encoding($str, 'UTF-8', $encoding);
|
|
|
|
|
|
|
|
|
903 |
}
|
904 |
|
905 |
return $str;
|
cleantalk.php
CHANGED
@@ -11,8 +11,6 @@
|
|
11 |
define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
12 |
|
13 |
$ct_agent_version = 'wordpress-244';
|
14 |
-
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
15 |
-
$ct_session_name = 'cleantalksession';
|
16 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
17 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
18 |
$ct_session_request_id_label = 'request_id';
|
@@ -64,15 +62,6 @@ $ct_post_data_label = 's2member_pro_paypal_registration';
|
|
64 |
// Form time load label
|
65 |
$ct_formtime_label = 'formtime';
|
66 |
|
67 |
-
// Characters list for random password generation
|
68 |
-
$ct_password_list = '0123456789';
|
69 |
-
|
70 |
-
// Random password length
|
71 |
-
$ct_password_length = 3;
|
72 |
-
|
73 |
-
// Name of the array with random passwords
|
74 |
-
$ct_post_id_label = 'ct_post_id';
|
75 |
-
|
76 |
// Init action.
|
77 |
add_action('init', 'ct_init', 1);
|
78 |
|
@@ -128,9 +117,6 @@ if (is_admin()) {
|
|
128 |
add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
|
129 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
130 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
131 |
-
} else {
|
132 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-utils.php');
|
133 |
-
wp_enqueue_script('ct_utills', plugins_url('/cleantalk-utils.js', __FILE__));
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -313,10 +299,8 @@ function ct_send_feedback($feedback_request = null) {
|
|
313 |
* @return null;
|
314 |
*/
|
315 |
function ct_init_session() {
|
316 |
-
global $ct_session_name;
|
317 |
-
|
318 |
if(session_id() === '') {
|
319 |
-
session_name(
|
320 |
@session_start();
|
321 |
}
|
322 |
|
@@ -433,13 +417,14 @@ function ct_footer_add_cookie() {
|
|
433 |
* @param int $post_id Post ID, not used
|
434 |
*/
|
435 |
function ct_add_hidden_fields($post_id = null, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
436 |
-
global $ct_checkjs_def, $ct_formtime_label
|
|
|
|
|
437 |
|
438 |
$_SESSION[$ct_formtime_label] = time();
|
439 |
|
440 |
if ($cookie_check) {
|
441 |
-
|
442 |
-
$html = '
|
443 |
<script type="text/javascript">
|
444 |
// <![CDATA[
|
445 |
function ctSetCookie(c_name, value) {
|
@@ -451,48 +436,30 @@ ctSetCookie("%s", "%s");
|
|
451 |
';
|
452 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
453 |
} else {
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
$password = ct_random_password($ct_password_length, $ct_password_list) . $post_id;
|
458 |
-
|
459 |
-
$ct_checkjs_key = ct_get_checkjs_value($password);
|
460 |
-
|
461 |
-
$html = '
|
462 |
<input type="hidden" id="%s" name="%s" value="%s" />
|
463 |
-
<input type="hidden" name="ct_post_id" value="%s" />
|
464 |
<script type="text/javascript">
|
465 |
// <![CDATA[
|
466 |
var ct_input_name = \'%s\';
|
467 |
var ct_input_value = document.getElementById(ct_input_name).value;
|
468 |
-
var
|
469 |
-
var ct_password_list = \'%s\';
|
470 |
-
var ct_post_id = \'%s\';
|
471 |
|
472 |
-
|
473 |
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
ct_password_encrypted = md5(ct_password_mixed);
|
482 |
-
}
|
483 |
-
document.getElementById(ct_input_name).value = ct_password_mixed;
|
484 |
|
485 |
-
return null;
|
486 |
-
};
|
487 |
// ]]>
|
488 |
</script>
|
489 |
';
|
490 |
-
$html = sprintf($html, $field_id, $field_name, $
|
491 |
-
|
492 |
-
$_SESSION[$ct_post_id_label][$post_id] = $password;
|
493 |
};
|
494 |
-
|
495 |
-
$html .= '<noscript><p><b>Please enable JavaScript and Cookies 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>';
|
496 |
|
497 |
if ($return_string === true) {
|
498 |
return $html;
|
@@ -560,8 +527,6 @@ function ct_frm_validate_entry ($errors, $values) {
|
|
560 |
if ($options['contact_forms_test'] == 0) {
|
561 |
return false;
|
562 |
}
|
563 |
-
|
564 |
-
ct_check_cookies();
|
565 |
|
566 |
$checkjs = js_test($ct_checkjs_frm, $_POST);
|
567 |
|
@@ -608,7 +573,7 @@ function ct_preprocess_comment($comment) {
|
|
608 |
// this action is called by wp-comments-post.php
|
609 |
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
610 |
global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label, $ct_jp_comments;
|
611 |
-
|
612 |
$options = ct_get_options();
|
613 |
if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
|
614 |
return $comment;
|
@@ -647,7 +612,6 @@ function ct_preprocess_comment($comment) {
|
|
647 |
|
648 |
$post = get_post($comment_post_id);
|
649 |
|
650 |
-
ct_check_cookies();
|
651 |
$checkjs = js_test('ct_checkjs', $_POST);
|
652 |
|
653 |
$example = null;
|
@@ -767,8 +731,6 @@ function ct_die_extended($comment_body) {
|
|
767 |
*
|
768 |
*/
|
769 |
function js_test($field_name = 'ct_checkjs', $data = null) {
|
770 |
-
global $ct_post_id_label;
|
771 |
-
|
772 |
$checkjs = null;
|
773 |
$js_post_value = null;
|
774 |
|
@@ -776,23 +738,12 @@ function js_test($field_name = 'ct_checkjs', $data = null) {
|
|
776 |
return $checkjs;
|
777 |
|
778 |
if (isset($data[$field_name])) {
|
779 |
-
$checkjs = 0;
|
780 |
-
|
781 |
$js_post_value = $data[$field_name];
|
782 |
-
|
783 |
-
if
|
784 |
-
|
785 |
-
if (isset($_SESSION[$ct_post_id_label][$data[$ct_post_id_label]])) {
|
786 |
-
$ct_challenge = $_SESSION[$ct_post_id_label][$data[$ct_post_id_label]];
|
787 |
-
}
|
788 |
-
if($ct_challenge == $js_post_value) {
|
789 |
-
$checkjs = 1;
|
790 |
-
}
|
791 |
} else {
|
792 |
-
$
|
793 |
-
if(preg_match("/$ct_challenge/", $js_post_value)) {
|
794 |
-
$checkjs = 1;
|
795 |
-
}
|
796 |
}
|
797 |
}
|
798 |
|
@@ -947,11 +898,10 @@ function ct_plugin_active($plugin_name){
|
|
947 |
* Get ct_get_checkjs_value
|
948 |
* @return string
|
949 |
*/
|
950 |
-
function ct_get_checkjs_value(
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
}
|
955 |
|
956 |
return md5($salt);
|
957 |
}
|
@@ -1164,8 +1114,6 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
|
|
1164 |
*/
|
1165 |
function ct_contact_form_is_spam($form) {
|
1166 |
global $ct_checkjs_jpcf;
|
1167 |
-
|
1168 |
-
ct_check_cookies();
|
1169 |
|
1170 |
$options = ct_get_options();
|
1171 |
|
@@ -1178,7 +1126,6 @@ function ct_contact_form_is_spam($form) {
|
|
1178 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1179 |
$js_field_name = $k;
|
1180 |
}
|
1181 |
-
|
1182 |
$checkjs = js_test($js_field_name, $_COOKIE);
|
1183 |
|
1184 |
$sender_info = array(
|
@@ -1256,8 +1203,6 @@ function ct_wpcf7_spam($spam) {
|
|
1256 |
return $spam;
|
1257 |
}
|
1258 |
|
1259 |
-
ct_check_cookies();
|
1260 |
-
|
1261 |
$checkjs = js_test($ct_checkjs_cf7, $_POST);
|
1262 |
|
1263 |
$post_info['comment_type'] = 'feedback';
|
@@ -1332,7 +1277,6 @@ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
|
1332 |
if ($options['contact_forms_test'] == 0)
|
1333 |
return $form_errors;
|
1334 |
|
1335 |
-
ct_check_cookies();
|
1336 |
$checkjs = js_test('ct_checkjs', $_POST);
|
1337 |
|
1338 |
$post_info['comment_type'] = 'feedback';
|
@@ -1383,13 +1327,13 @@ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
|
1383 |
* @param string $hook URL of hooked page
|
1384 |
*/
|
1385 |
function ct_comment_text($comment_text) {
|
1386 |
-
global $comment, $ct_approved_request_id_label
|
1387 |
|
1388 |
if (isset($_COOKIE[$ct_approved_request_id_label])) {
|
1389 |
$ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
1390 |
|
1391 |
if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
|
1392 |
-
$comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __(
|
1393 |
}
|
1394 |
}
|
1395 |
|
@@ -1407,8 +1351,6 @@ function ct_check_wplp(){
|
|
1407 |
$options = ct_get_options();
|
1408 |
if ($options['contact_forms_test'] == 0)
|
1409 |
return;
|
1410 |
-
|
1411 |
-
ct_check_cookies();
|
1412 |
|
1413 |
$checkjs = js_test('ct_checkjs', $_COOKIE);
|
1414 |
|
@@ -1476,8 +1418,6 @@ function ct_s2member_registration_test() {
|
|
1476 |
}
|
1477 |
|
1478 |
$submit_time = submit_time_test();
|
1479 |
-
|
1480 |
-
ct_check_cookies();
|
1481 |
|
1482 |
$checkjs = js_test('ct_checkjs', $_COOKIE);
|
1483 |
|
11 |
define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
12 |
|
13 |
$ct_agent_version = 'wordpress-244';
|
|
|
|
|
14 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
15 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
16 |
$ct_session_request_id_label = 'request_id';
|
62 |
// Form time load label
|
63 |
$ct_formtime_label = 'formtime';
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
// Init action.
|
66 |
add_action('init', 'ct_init', 1);
|
67 |
|
117 |
add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
|
118 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
119 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
/**
|
299 |
* @return null;
|
300 |
*/
|
301 |
function ct_init_session() {
|
|
|
|
|
302 |
if(session_id() === '') {
|
303 |
+
session_name('cleantalksession');
|
304 |
@session_start();
|
305 |
}
|
306 |
|
417 |
* @param int $post_id Post ID, not used
|
418 |
*/
|
419 |
function ct_add_hidden_fields($post_id = null, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
420 |
+
global $ct_checkjs_def, $ct_formtime_label;
|
421 |
+
|
422 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
423 |
|
424 |
$_SESSION[$ct_formtime_label] = time();
|
425 |
|
426 |
if ($cookie_check) {
|
427 |
+
$html = '
|
|
|
428 |
<script type="text/javascript">
|
429 |
// <![CDATA[
|
430 |
function ctSetCookie(c_name, value) {
|
436 |
';
|
437 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
438 |
} else {
|
439 |
+
$field_id = $field_name . '_' . md5(rand(0, 1000));
|
440 |
+
$html = '
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
<input type="hidden" id="%s" name="%s" value="%s" />
|
|
|
442 |
<script type="text/javascript">
|
443 |
// <![CDATA[
|
444 |
var ct_input_name = \'%s\';
|
445 |
var ct_input_value = document.getElementById(ct_input_name).value;
|
446 |
+
var ct_input_challenge = \'%s\';
|
|
|
|
|
447 |
|
448 |
+
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, ct_input_challenge);
|
449 |
|
450 |
+
if (document.getElementById(ct_input_name).value == ct_input_value) {
|
451 |
+
document.getElementById(ct_input_name).value = ct_set_challenge(ct_input_challenge);
|
452 |
+
}
|
453 |
+
|
454 |
+
function ct_set_challenge(val) {
|
455 |
+
return val;
|
456 |
+
};
|
|
|
|
|
|
|
457 |
|
|
|
|
|
458 |
// ]]>
|
459 |
</script>
|
460 |
';
|
461 |
+
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $ct_checkjs_key);
|
|
|
|
|
462 |
};
|
|
|
|
|
463 |
|
464 |
if ($return_string === true) {
|
465 |
return $html;
|
527 |
if ($options['contact_forms_test'] == 0) {
|
528 |
return false;
|
529 |
}
|
|
|
|
|
530 |
|
531 |
$checkjs = js_test($ct_checkjs_frm, $_POST);
|
532 |
|
573 |
// this action is called by wp-comments-post.php
|
574 |
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
575 |
global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label, $ct_jp_comments;
|
576 |
+
|
577 |
$options = ct_get_options();
|
578 |
if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
|
579 |
return $comment;
|
612 |
|
613 |
$post = get_post($comment_post_id);
|
614 |
|
|
|
615 |
$checkjs = js_test('ct_checkjs', $_POST);
|
616 |
|
617 |
$example = null;
|
731 |
*
|
732 |
*/
|
733 |
function js_test($field_name = 'ct_checkjs', $data = null) {
|
|
|
|
|
734 |
$checkjs = null;
|
735 |
$js_post_value = null;
|
736 |
|
738 |
return $checkjs;
|
739 |
|
740 |
if (isset($data[$field_name])) {
|
|
|
|
|
741 |
$js_post_value = $data[$field_name];
|
742 |
+
$ct_challenge = ct_get_checkjs_value();
|
743 |
+
if(preg_match("/$ct_challenge/", $js_post_value)) {
|
744 |
+
$checkjs = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
} else {
|
746 |
+
$checkjs = 0;
|
|
|
|
|
|
|
747 |
}
|
748 |
}
|
749 |
|
898 |
* Get ct_get_checkjs_value
|
899 |
* @return string
|
900 |
*/
|
901 |
+
function ct_get_checkjs_value() {
|
902 |
+
$options = ct_get_options();
|
903 |
+
|
904 |
+
$salt = $options['apikey'] . '+' . get_option('admin_email');
|
|
|
905 |
|
906 |
return md5($salt);
|
907 |
}
|
1114 |
*/
|
1115 |
function ct_contact_form_is_spam($form) {
|
1116 |
global $ct_checkjs_jpcf;
|
|
|
|
|
1117 |
|
1118 |
$options = ct_get_options();
|
1119 |
|
1126 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1127 |
$js_field_name = $k;
|
1128 |
}
|
|
|
1129 |
$checkjs = js_test($js_field_name, $_COOKIE);
|
1130 |
|
1131 |
$sender_info = array(
|
1203 |
return $spam;
|
1204 |
}
|
1205 |
|
|
|
|
|
1206 |
$checkjs = js_test($ct_checkjs_cf7, $_POST);
|
1207 |
|
1208 |
$post_info['comment_type'] = 'feedback';
|
1277 |
if ($options['contact_forms_test'] == 0)
|
1278 |
return $form_errors;
|
1279 |
|
|
|
1280 |
$checkjs = js_test('ct_checkjs', $_POST);
|
1281 |
|
1282 |
$post_info['comment_type'] = 'feedback';
|
1327 |
* @param string $hook URL of hooked page
|
1328 |
*/
|
1329 |
function ct_comment_text($comment_text) {
|
1330 |
+
global $comment, $ct_approved_request_id_label;
|
1331 |
|
1332 |
if (isset($_COOKIE[$ct_approved_request_id_label])) {
|
1333 |
$ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
1334 |
|
1335 |
if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
|
1336 |
+
$comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment is approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
|
1337 |
}
|
1338 |
}
|
1339 |
|
1351 |
$options = ct_get_options();
|
1352 |
if ($options['contact_forms_test'] == 0)
|
1353 |
return;
|
|
|
|
|
1354 |
|
1355 |
$checkjs = js_test('ct_checkjs', $_COOKIE);
|
1356 |
|
1418 |
}
|
1419 |
|
1420 |
$submit_time = submit_time_test();
|
|
|
|
|
1421 |
|
1422 |
$checkjs = js_test('ct_checkjs', $_COOKIE);
|
1423 |
|
readme.txt
CHANGED
@@ -16,7 +16,7 @@ No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam b
|
|
16 |
1. Stops spam bots comments.
|
17 |
1. Stops spam bots signups.
|
18 |
1. Stops spam bots contacts emails.
|
19 |
-
1. Stops spam
|
20 |
|
21 |
= Anti-spam protection =
|
22 |
* WordPress, JetPack comments.
|
16 |
1. Stops spam bots comments.
|
17 |
1. Stops spam bots signups.
|
18 |
1. Stops spam bots contacts emails.
|
19 |
+
1. Stops spam trackbacks.
|
20 |
|
21 |
= Anti-spam protection =
|
22 |
* WordPress, JetPack comments.
|