Version Description
October 3 2016 = * SpamFireWall feature: Class upgraded. * New feature: Delete links from approved comments. * Settings: Grouped. * Settings: Altered description fixed spelling mistakes. * Settings: Added indicator for SpamFireWall. * Admin bar: Added SpamFireWall counter * Clean and Simple Contact Form: Direct integration. * WooCommerce: Don't check password recovery form. * WooCommerce Wishlists: Issue with check for Google bots. * JetPack: contact form fix. * Fixed and created the defaults for all CleanTalk options. * Fixed spelling mistakes.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.49 |
Comparing to | |
See all releases |
Code changes from version 5.48 to 5.49
- cleantalk.php +66 -50
- inc/cleantalk-admin.php +106 -66
- inc/cleantalk-ajax.php +30 -29
- inc/cleantalk-common.php +28 -21
- inc/cleantalk-public.php +35 -24
- inc/cleantalk-sfw.class.php +133 -55
- readme.txt +27 -1
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, no Captcha, 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 |
|
@@ -81,45 +81,29 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
81 |
}
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
$is_sfw_check=true;
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key']==md5($
|
92 |
-
|
93 |
-
$
|
94 |
-
if(isset($_COOKIE['ct_sfw_passed']))
|
95 |
-
{
|
96 |
-
if(isset($ct_data['sfw_log']))
|
97 |
-
{
|
98 |
-
$sfw_log=$ct_data['sfw_log'];
|
99 |
-
}
|
100 |
-
else
|
101 |
-
{
|
102 |
-
$sfw_log=array();
|
103 |
-
$sfw_log[$ip[$i]]=Array();
|
104 |
-
}
|
105 |
-
$sfw_log[$ip[$i]]['allow']++;
|
106 |
-
$ct_data['sfw_log'] = $sfw_log;
|
107 |
update_option('cleantalk_data', $ct_data);
|
|
|
108 |
@setcookie ('ct_sfw_passed', '0', 1, "/");
|
109 |
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
if($is_sfw_check)
|
115 |
-
{
|
116 |
-
//include_once("cleantalk-sfw.php");
|
117 |
-
include_once("inc/cleantalk-sfw.class.php");
|
118 |
-
$sfw = new CleanTalkSFW();
|
119 |
-
$sfw->cleantalk_get_real_ip();
|
120 |
$sfw->check_ip();
|
121 |
-
if($sfw->result)
|
122 |
-
|
123 |
$sfw->sfw_die();
|
124 |
}
|
125 |
}
|
@@ -299,10 +283,27 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
299 |
*/
|
300 |
if (!function_exists ( 'ct_activation')) {
|
301 |
function ct_activation() {
|
|
|
|
|
|
|
302 |
wp_schedule_event(time(), 'hourly', 'ct_hourly_event_hook' );
|
303 |
//wp_schedule_event(time(), 'hourly', 'ct_send_sfw_log' );
|
304 |
wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw' );
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
cleantalk_update_sfw();
|
307 |
add_option('ct_plugin_do_activation_redirect', true);
|
308 |
}
|
@@ -312,6 +313,12 @@ if (!function_exists ( 'ct_activation')) {
|
|
312 |
*/
|
313 |
if (!function_exists ( 'ct_deactivation')) {
|
314 |
function ct_deactivation() {
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
wp_clear_scheduled_hook( 'ct_hourly_event_hook' );
|
316 |
@wp_clear_scheduled_hook( 'ct_send_sfw_log' );
|
317 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
|
@@ -515,11 +522,11 @@ function cleantalk_update_sfw()
|
|
515 |
}
|
516 |
global $ct_options, $ct_data;
|
517 |
if(isset($ct_options['spam_firewall']))
|
518 |
-
|
519 |
$value = @intval($ct_options['spam_firewall']);
|
520 |
}
|
521 |
-
|
522 |
-
|
523 |
$value=0;
|
524 |
}
|
525 |
|
@@ -533,15 +540,9 @@ function cleantalk_update_sfw()
|
|
533 |
$result=json_decode($result, true);
|
534 |
if(isset($result['data']))
|
535 |
{
|
536 |
-
$wpdb->query("
|
537 |
-
$wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
|
538 |
-
`network` int(11) unsigned NOT NULL,
|
539 |
-
`mask` int(11) unsigned NOT NULL,
|
540 |
-
INDEX ( `network` , `mask` )
|
541 |
-
) ENGINE = MYISAM ;");
|
542 |
$result=$result['data'];
|
543 |
$query="INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw` VALUES ";
|
544 |
-
//$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw`;");
|
545 |
for($i=0;$i<sizeof($result);$i++)
|
546 |
{
|
547 |
if($i==sizeof($result)-1)
|
@@ -591,9 +592,24 @@ function cleantalk_get_ip()
|
|
591 |
|
592 |
function ct_send_sfw_log()
|
593 |
{
|
594 |
-
|
595 |
-
|
596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
}
|
598 |
|
599 |
/*
|
3 |
Plugin Name: Spam Protection by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, 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.49
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.49';
|
11 |
+
$ct_agent_version = 'wordpress-549';
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
81 |
}
|
82 |
}
|
83 |
|
84 |
+
if($value==1 && !is_admin() || $value==1 && defined( 'DOING_AJAX' ) && DOING_AJAX)
|
85 |
+
{
|
86 |
+
include_once("inc/cleantalk-sfw.class.php");
|
87 |
+
|
88 |
$is_sfw_check=true;
|
89 |
+
$sfw = new CleanTalkSFW();
|
90 |
+
$ip = $sfw->cleantalk_get_real_ip();
|
91 |
+
|
92 |
+
foreach($ip as $ct_cur_ip){
|
93 |
+
if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$ct_options['apikey'])){
|
94 |
+
$is_sfw_check=false;
|
95 |
+
if(isset($_COOKIE['ct_sfw_passed'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
update_option('cleantalk_data', $ct_data);
|
97 |
+
CleanTalkSFW::sfw_update_logs($ct_cur_ip, 'passed');
|
98 |
@setcookie ('ct_sfw_passed', '0', 1, "/");
|
99 |
}
|
100 |
+
}else
|
101 |
+
$is_sfw_check=true;
|
102 |
+
} unset($ct_cur_ip);
|
103 |
+
if($is_sfw_check){
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
$sfw->check_ip();
|
105 |
+
if($sfw->result){
|
106 |
+
CleanTalkSFW::sfw_update_logs($sfw->blocked_ip, 'blocked');
|
107 |
$sfw->sfw_die();
|
108 |
}
|
109 |
}
|
283 |
*/
|
284 |
if (!function_exists ( 'ct_activation')) {
|
285 |
function ct_activation() {
|
286 |
+
|
287 |
+
global $wpdb;
|
288 |
+
|
289 |
wp_schedule_event(time(), 'hourly', 'ct_hourly_event_hook' );
|
290 |
//wp_schedule_event(time(), 'hourly', 'ct_send_sfw_log' );
|
291 |
wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw' );
|
292 |
|
293 |
+
$wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
|
294 |
+
`network` int(11) unsigned NOT NULL,
|
295 |
+
`mask` int(11) unsigned NOT NULL,
|
296 |
+
INDEX ( `network` , `mask` )
|
297 |
+
) ENGINE = MYISAM ;");
|
298 |
+
|
299 |
+
$wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs` (
|
300 |
+
`ip` VARCHAR(15) NOT NULL ,
|
301 |
+
`all` INT NOT NULL ,
|
302 |
+
`blocked` INT NOT NULL ,
|
303 |
+
`timestamp` INT NOT NULL ,
|
304 |
+
PRIMARY KEY (`ip`))
|
305 |
+
ENGINE = MYISAM;");
|
306 |
+
|
307 |
cleantalk_update_sfw();
|
308 |
add_option('ct_plugin_do_activation_redirect', true);
|
309 |
}
|
313 |
*/
|
314 |
if (!function_exists ( 'ct_deactivation')) {
|
315 |
function ct_deactivation() {
|
316 |
+
|
317 |
+
global $wpdb;
|
318 |
+
|
319 |
+
$wpdb->query("DROP TABLE IF EXISTS `".$wpdb->base_prefix."cleantalk_sfw`;");
|
320 |
+
$wpdb->query("DROP TABLE IF EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs`;");
|
321 |
+
|
322 |
wp_clear_scheduled_hook( 'ct_hourly_event_hook' );
|
323 |
@wp_clear_scheduled_hook( 'ct_send_sfw_log' );
|
324 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
|
522 |
}
|
523 |
global $ct_options, $ct_data;
|
524 |
if(isset($ct_options['spam_firewall']))
|
525 |
+
{
|
526 |
$value = @intval($ct_options['spam_firewall']);
|
527 |
}
|
528 |
+
else
|
529 |
+
{
|
530 |
$value=0;
|
531 |
}
|
532 |
|
540 |
$result=json_decode($result, true);
|
541 |
if(isset($result['data']))
|
542 |
{
|
543 |
+
$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw`;");
|
|
|
|
|
|
|
|
|
|
|
544 |
$result=$result['data'];
|
545 |
$query="INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw` VALUES ";
|
|
|
546 |
for($i=0;$i<sizeof($result);$i++)
|
547 |
{
|
548 |
if($i==sizeof($result)-1)
|
592 |
|
593 |
function ct_send_sfw_log()
|
594 |
{
|
595 |
+
global $ct_options, $ct_data;
|
596 |
+
|
597 |
+
$ct_options=ct_get_options();
|
598 |
+
$ct_data=ct_get_data();
|
599 |
+
|
600 |
+
include_once("inc/cleantalk-sfw.class.php");
|
601 |
+
$result = CleanTalkSFW::send_logs($ct_options['apikey']);
|
602 |
+
|
603 |
+
if($result !== false){
|
604 |
+
|
605 |
+
$ct_data['sfw_counter']['all'] += $result['all'];
|
606 |
+
$ct_data['sfw_counter']['blocked'] += $result['blocked'];
|
607 |
+
$ct_data['last_sfw_send']=time();
|
608 |
+
update_option('cleantalk_data', $ct_data);
|
609 |
+
|
610 |
+
return true;
|
611 |
+
}else
|
612 |
+
return false;
|
613 |
}
|
614 |
|
615 |
/*
|
inc/cleantalk-admin.php
CHANGED
@@ -300,26 +300,37 @@ function ct_admin_init()
|
|
300 |
{
|
301 |
add_settings_field('cleantalk_apikey', '', 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
302 |
}
|
303 |
-
|
304 |
-
|
305 |
add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
306 |
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
307 |
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
308 |
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
309 |
add_settings_field('cleantalk_wc_checkout_test', __('WooCommerce checkout form', 'cleantalk'), 'ct_input_wc_chekout_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
|
|
|
|
|
|
310 |
add_settings_field('cleantalk_bp_private_messages', __('buddyPress private messages', 'cleantalk'), 'ct_input_bp_private_messages', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
|
|
312 |
|
|
|
|
|
313 |
add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
|
314 |
add_settings_field('cleantalk_all_time_counter', " ".__('Show All-time counter', 'cleantalk'), 'ct_input_all_time_counter', 'cleantalk', 'cleantalk_settings_anti_spam');
|
315 |
add_settings_field('cleantalk_daily_conter', " ".__('Show 24 hours counter', 'cleantalk'), 'ct_input_daily_counter', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
316 |
|
317 |
-
add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
|
318 |
-
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
|
319 |
-
add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
320 |
-
add_settings_field('cleantalk_set_cookies', __("Set cookies", 'cleantalk'), 'ct_input_set_cookies', 'cleantalk', 'cleantalk_settings_anti_spam');
|
321 |
-
add_settings_field('cleantalk_ssl_on', __("Use SSL", 'cleantalk'), 'ct_input_ssl_on', 'cleantalk', 'cleantalk_settings_anti_spam');
|
322 |
-
add_settings_field('cleantalk_protect_logged_in', __("Protect logged in Users", 'cleantalk'), 'ct_input_protect_logged_in', 'cleantalk', 'cleantalk_settings_anti_spam');
|
323 |
|
324 |
add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
|
325 |
add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
|
@@ -415,12 +426,27 @@ function ct_input_daily_counter() {
|
|
415 |
$value=(isset($ct_options['daily_counter']) ? @intval($ct_options['daily_counter']) : 0);
|
416 |
$value2=(isset($ct_options['show_adminbar']) ? @intval($ct_options['show_adminbar']) : 0);
|
417 |
|
418 |
-
echo "<input type='radio' class='ct-depends-of-show-adminbar' id='
|
419 |
echo ' ';
|
420 |
-
echo "<input type='radio' class='ct-depends-of-show-adminbar' id='
|
421 |
@admin_addDescriptionsFields(sprintf(__('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'), $ct_options['all_time_counter']));
|
422 |
}
|
423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
function ct_add_admin_menu( $wp_admin_bar ) {
|
425 |
// add a parent item
|
426 |
global $ct_options, $ct_data;
|
@@ -461,30 +487,41 @@ function ct_add_admin_menu( $wp_admin_bar ) {
|
|
461 |
update_option('cleantalk_data', $ct_data);
|
462 |
}
|
463 |
|
|
|
|
|
|
|
|
|
|
|
464 |
//Compile user's counter string
|
465 |
$user_counter=Array('accepted'=>$ct_data['user_counter']['accepted'], 'blocked'=>$ct_data['user_counter']['blocked'], 'all'=>$ct_data['user_counter']['accepted'] + $ct_data['user_counter']['blocked'], 'since'=>$ct_data['user_counter']['since']);
|
466 |
//Previous version $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': ' .$user_counter['all']*/. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
|
467 |
$user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': </span><span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
|
468 |
|
469 |
$all_time_counter_str='';
|
470 |
-
$daily_counter_str='';
|
471 |
-
|
472 |
//Don't compile if all time counter disabled
|
473 |
if(isset($ct_options['all_time_counter']) && $ct_options['all_time_counter']=='1'){
|
474 |
$all_time_counter=Array('accepted'=>$ct_data['all_time_counter']['accepted'], 'blocked'=>$ct_data['all_time_counter']['blocked'], 'all'=>$ct_data['all_time_counter']['accepted'] + $ct_data['all_time_counter']['blocked']);
|
475 |
$all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | All: ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
|
476 |
}
|
477 |
|
|
|
478 |
//Don't compile if daily counter disabled
|
479 |
if(isset($ct_options['daily_counter']) && $ct_options['daily_counter']=='1'){
|
480 |
$daily_counter=Array('accepted'=>array_sum($ct_data['array_accepted']), 'blocked'=>array_sum($ct_data['array_blocked']), 'all'=>array_sum($ct_data['array_accepted']) + array_sum($ct_data['array_blocked']));
|
481 |
//Previous version $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
|
482 |
$daily_counter_str='<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: </span><span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
|
483 |
}
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
$args = array(
|
486 |
'id' => 'ct_parent_node',
|
487 |
-
'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.'</div></div>' //You could change widget string here by simply deleting variables
|
488 |
);
|
489 |
$wp_admin_bar->add_node( $args );
|
490 |
|
@@ -557,84 +594,53 @@ function ct_section_settings_state() {
|
|
557 |
$ct_data['moderate_ip'] = 0;
|
558 |
}
|
559 |
|
560 |
-
$
|
561 |
-
|
|
|
|
|
562 |
$color="black";
|
563 |
$test_failed=false;
|
564 |
-
|
565 |
if(trim($ct_options['apikey'])=='')
|
566 |
{
|
567 |
-
$img="yes_gray.png";
|
568 |
-
$img_no="no_gray.png";
|
569 |
$color="gray";
|
570 |
}
|
571 |
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
572 |
{
|
573 |
-
$img
|
574 |
-
$img_no
|
575 |
$color="black";
|
576 |
$test_failed=true;
|
577 |
}
|
578 |
if($ct_data['moderate_ip'] == 1)
|
579 |
{
|
580 |
-
$img="yes.png";
|
581 |
-
$img_no="no.png";
|
582 |
$color="black";
|
583 |
$test_failed=false;
|
584 |
}
|
585 |
print "<div style='color:$color'>";
|
586 |
-
if($ct_options['registrations_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
|
587 |
-
{
|
588 |
-
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
589 |
-
}
|
590 |
-
else
|
591 |
-
{
|
592 |
-
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
593 |
-
}
|
594 |
|
595 |
-
if(
|
596 |
-
|
597 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
598 |
-
}
|
599 |
else
|
600 |
-
|
601 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
602 |
-
}
|
603 |
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
611 |
-
}
|
612 |
|
613 |
-
if($ct_options['general_contact_forms_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
|
614 |
-
{
|
615 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
616 |
-
}
|
617 |
-
else
|
618 |
-
{
|
619 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
620 |
-
}
|
621 |
-
if($ct_options['wc_checkout_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
|
622 |
-
{
|
623 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
|
624 |
-
}
|
625 |
-
else
|
626 |
-
{
|
627 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
|
628 |
-
}
|
629 |
if($ct_data['moderate_ip'] == 1)
|
630 |
-
{
|
631 |
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
|
632 |
-
}
|
633 |
|
634 |
print "</div>";
|
635 |
if($test_failed && $ct_data['moderate_ip'] != 1)
|
636 |
{
|
637 |
-
//print "Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>";
|
638 |
print __("Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>", 'cleantalk');
|
639 |
}
|
640 |
return true;
|
@@ -742,6 +748,39 @@ function ct_input_comments_test() {
|
|
742 |
admin_addDescriptionsFields(__('WordPress, JetPack, WooCommerce.', 'cleantalk'));
|
743 |
}
|
744 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
/**
|
746 |
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
747 |
*/
|
@@ -908,7 +947,7 @@ function ct_input_use_ajax() {
|
|
908 |
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>";
|
909 |
echo ' ';
|
910 |
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>";
|
911 |
-
@admin_addDescriptionsFields(sprintf(__('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'), $ct_options['use_ajax']));
|
912 |
}
|
913 |
|
914 |
function ct_input_check_comments_number() {
|
@@ -1547,6 +1586,7 @@ function ct_update_option($option_name) {
|
|
1547 |
if (isset($_POST['cleantalk_settings']['spam_firewall'])) {
|
1548 |
if ($_POST['cleantalk_settings']['spam_firewall'] == 1) {
|
1549 |
cleantalk_update_sfw();
|
|
|
1550 |
} else {
|
1551 |
// Reseting SFW logs to do not keep huge ammount of data.
|
1552 |
$ct_data['sfw_log']= array();
|
300 |
{
|
301 |
add_settings_field('cleantalk_apikey', '', 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
302 |
}
|
303 |
+
//Forms for protection
|
304 |
+
add_settings_field('cleantalk_title_fiels_for_protect', "", 'ct_input_what_fields_should_be_protected', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
|
305 |
add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
306 |
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
307 |
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
308 |
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
309 |
add_settings_field('cleantalk_wc_checkout_test', __('WooCommerce checkout form', 'cleantalk'), 'ct_input_wc_chekout_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
310 |
+
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
|
311 |
+
|
312 |
+
//Comments and messages
|
313 |
+
add_settings_field('cleantalk_title_comments_and_messages', "", 'ct_input_comments_and_messages', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
|
314 |
add_settings_field('cleantalk_bp_private_messages', __('buddyPress private messages', 'cleantalk'), 'ct_input_bp_private_messages', 'cleantalk', 'cleantalk_settings_anti_spam');
|
315 |
+
add_settings_field('cleantalk_check_comments_number', __("Don't check trusted user's comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
316 |
+
add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
|
317 |
+
add_settings_field('cleantalk_remove_links_from_comments', __('Remove links from approved comments', 'cleantalk'), 'ct_input_remove_links_from_approved_comments', 'cleantalk', 'cleantalk_settings_anti_spam');
|
318 |
+
|
319 |
+
//Data processing
|
320 |
+
add_settings_field('cleantalk_title_data_processing', "", 'ct_input_data_processing', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
|
321 |
+
add_settings_field('cleantalk_protect_logged_in', __("Protect logged in Users", 'cleantalk'), 'ct_input_protect_logged_in', 'cleantalk', 'cleantalk_settings_anti_spam');
|
322 |
+
add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
|
323 |
add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
324 |
+
add_settings_field('cleantalk_set_cookies', __("Set cookies", 'cleantalk'), 'ct_input_set_cookies', 'cleantalk', 'cleantalk_settings_anti_spam');
|
325 |
+
add_settings_field('cleantalk_ssl_on', __("Use SSL", 'cleantalk'), 'ct_input_ssl_on', 'cleantalk', 'cleantalk_settings_anti_spam');
|
326 |
|
327 |
+
//Administrator Panel
|
328 |
+
add_settings_field('cleantalk_title_administrator_panel', "", 'ct_input_administrator_panel', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
|
329 |
add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
|
330 |
add_settings_field('cleantalk_all_time_counter', " ".__('Show All-time counter', 'cleantalk'), 'ct_input_all_time_counter', 'cleantalk', 'cleantalk_settings_anti_spam');
|
331 |
add_settings_field('cleantalk_daily_conter', " ".__('Show 24 hours counter', 'cleantalk'), 'ct_input_daily_counter', 'cleantalk', 'cleantalk_settings_anti_spam');
|
332 |
+
add_settings_field('cleantalk_sfw_counter', " ".__('SpamFireWall counter', 'cleantalk'), 'ct_input_sfw_counter', 'cleantalk', 'cleantalk_settings_anti_spam');
|
333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
|
336 |
add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
|
426 |
$value=(isset($ct_options['daily_counter']) ? @intval($ct_options['daily_counter']) : 0);
|
427 |
$value2=(isset($ct_options['show_adminbar']) ? @intval($ct_options['show_adminbar']) : 0);
|
428 |
|
429 |
+
echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_daily_counter1' name='cleantalk_settings[daily_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_daily_counter1'> ".__('Yes')."</label>";
|
430 |
echo ' ';
|
431 |
+
echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_daily_counter0' name='cleantalk_settings[daily_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_daily_counter0'> ".__('No')."</label>";
|
432 |
@admin_addDescriptionsFields(sprintf(__('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'), $ct_options['all_time_counter']));
|
433 |
}
|
434 |
|
435 |
+
function ct_input_sfw_counter() {
|
436 |
+
global $ct_options, $ct_data;
|
437 |
+
|
438 |
+
$ct_options = ct_get_options();
|
439 |
+
$ct_data = ct_get_data();
|
440 |
+
|
441 |
+
$value=(isset($ct_options['sfw_counter']) ? @intval($ct_options['sfw_counter']) : 0);
|
442 |
+
$value2=(isset($ct_options['show_adminbar']) ? @intval($ct_options['show_adminbar']) : 0);
|
443 |
+
|
444 |
+
echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_sfw_counter1' name='cleantalk_settings[sfw_counter]' value='1' ".($value=='1'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_sfw_counter1'> ".__('Yes')."</label>";
|
445 |
+
echo ' ';
|
446 |
+
echo "<input type='radio' class='ct-depends-of-show-adminbar' id='cleantalk_sfw_counter0' name='cleantalk_settings[sfw_counter]' value='0' ".($value=='0'?'checked':'').($value2=='0'?' disabled':'')." /><label for='cleantalk_sfw_counter0'> ".__('No')."</label>";
|
447 |
+
@admin_addDescriptionsFields(sprintf(__('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'), $ct_options['sfw_counter']));
|
448 |
+
}
|
449 |
+
|
450 |
function ct_add_admin_menu( $wp_admin_bar ) {
|
451 |
// add a parent item
|
452 |
global $ct_options, $ct_data;
|
487 |
update_option('cleantalk_data', $ct_data);
|
488 |
}
|
489 |
|
490 |
+
if(!isset($ct_data['sfw_counter'])){
|
491 |
+
$ct_data['sfw_counter']['all'] = 0;
|
492 |
+
$ct_data['sfw_counter']['blocked'] = 0;
|
493 |
+
}
|
494 |
+
|
495 |
//Compile user's counter string
|
496 |
$user_counter=Array('accepted'=>$ct_data['user_counter']['accepted'], 'blocked'=>$ct_data['user_counter']['blocked'], 'all'=>$ct_data['user_counter']['accepted'] + $ct_data['user_counter']['blocked'], 'since'=>$ct_data['user_counter']['since']);
|
497 |
//Previous version $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': ' .$user_counter['all']*/. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
|
498 |
$user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': </span><span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
|
499 |
|
500 |
$all_time_counter_str='';
|
|
|
|
|
501 |
//Don't compile if all time counter disabled
|
502 |
if(isset($ct_options['all_time_counter']) && $ct_options['all_time_counter']=='1'){
|
503 |
$all_time_counter=Array('accepted'=>$ct_data['all_time_counter']['accepted'], 'blocked'=>$ct_data['all_time_counter']['blocked'], 'all'=>$ct_data['all_time_counter']['accepted'] + $ct_data['all_time_counter']['blocked']);
|
504 |
$all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | All: ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
|
505 |
}
|
506 |
|
507 |
+
$daily_counter_str='';
|
508 |
//Don't compile if daily counter disabled
|
509 |
if(isset($ct_options['daily_counter']) && $ct_options['daily_counter']=='1'){
|
510 |
$daily_counter=Array('accepted'=>array_sum($ct_data['array_accepted']), 'blocked'=>array_sum($ct_data['array_blocked']), 'all'=>array_sum($ct_data['array_accepted']) + array_sum($ct_data['array_blocked']));
|
511 |
//Previous version $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
|
512 |
$daily_counter_str='<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: </span><span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
|
513 |
}
|
514 |
+
|
515 |
+
$sfw_counter_str='';
|
516 |
+
//Don't compile if SFW counter disabled
|
517 |
+
if(isset($ct_options['sfw_counter']) && $ct_options['sfw_counter']=='1'){
|
518 |
+
$sfw_counter=Array('all'=>$ct_data['sfw_counter']['all'], 'blocked'=>$ct_data['sfw_counter']['blocked']);
|
519 |
+
$sfw_counter_str='<span style="color: white;" title="'.__('All / Blocked events. Access attempts is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | SpamFireWall: ' .$sfw_counter['all']. '</span> / <span style="color: red;">' .$sfw_counter['blocked']. '</span></span>';
|
520 |
+
}
|
521 |
+
|
522 |
$args = array(
|
523 |
'id' => 'ct_parent_node',
|
524 |
+
'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.$sfw_counter_str.'</div></div>' //You could change widget string here by simply deleting variables
|
525 |
);
|
526 |
$wp_admin_bar->add_node( $args );
|
527 |
|
594 |
$ct_data['moderate_ip'] = 0;
|
595 |
}
|
596 |
|
597 |
+
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
598 |
+
|
599 |
+
$img = $path_to_img."yes.png";
|
600 |
+
$img_no = $path_to_img."no.png";
|
601 |
$color="black";
|
602 |
$test_failed=false;
|
603 |
+
|
604 |
if(trim($ct_options['apikey'])=='')
|
605 |
{
|
606 |
+
$img = $path_to_img."yes_gray.png";
|
607 |
+
$img_no = $path_to_img."no_gray.png";
|
608 |
$color="gray";
|
609 |
}
|
610 |
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
611 |
{
|
612 |
+
$img=$path_to_img."no.png";
|
613 |
+
$img_no=$path_to_img."no.png";
|
614 |
$color="black";
|
615 |
$test_failed=true;
|
616 |
}
|
617 |
if($ct_data['moderate_ip'] == 1)
|
618 |
{
|
619 |
+
$img = $path_to_img."yes.png";
|
620 |
+
$img_no = $path_to_img."no.png";
|
621 |
$color="black";
|
622 |
$test_failed=false;
|
623 |
}
|
624 |
print "<div style='color:$color'>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
|
626 |
+
if(isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
|
627 |
+
$ct_moderate = true;
|
|
|
|
|
628 |
else
|
629 |
+
$ct_moderate = false;
|
|
|
|
|
630 |
|
631 |
+
print '<img src="'. (($ct_options['registrations_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
632 |
+
print ' <img src="'.(($ct_options['comments_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Comments forms', 'cleantalk');
|
633 |
+
print ' <img src="'.(($ct_options['contact_forms_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
634 |
+
print ' <img src="'.(($ct_options['general_contact_forms_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
635 |
+
print ' <img src="'.(($ct_options['spam_firewall']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('SpamFireWall', 'cleantalk');
|
636 |
+
print ' <img src="'.(($ct_options['wc_checkout_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
|
|
|
|
|
637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
if($ct_data['moderate_ip'] == 1)
|
|
|
639 |
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
|
|
|
640 |
|
641 |
print "</div>";
|
642 |
if($test_failed && $ct_data['moderate_ip'] != 1)
|
643 |
{
|
|
|
644 |
print __("Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>", 'cleantalk');
|
645 |
}
|
646 |
return true;
|
748 |
admin_addDescriptionsFields(__('WordPress, JetPack, WooCommerce.', 'cleantalk'));
|
749 |
}
|
750 |
|
751 |
+
//Titles for advanced settings.
|
752 |
+
function ct_input_what_fields_should_be_protected(){
|
753 |
+
echo "<h3>".__('Forms to protect', 'cleantalk')."</h3>";
|
754 |
+
}
|
755 |
+
|
756 |
+
function ct_input_comments_and_messages(){
|
757 |
+
echo "<h3>".__('Comments and messages', 'cleantalk')."</h3>";
|
758 |
+
}
|
759 |
+
|
760 |
+
function ct_input_data_processing(){
|
761 |
+
echo "<h3>".__('Data processing', 'cleantalk')."</h3>";
|
762 |
+
}
|
763 |
+
|
764 |
+
function ct_input_administrator_panel(){
|
765 |
+
echo "<h3>".__('Admin bar', 'cleantalk')."</h3>";
|
766 |
+
}
|
767 |
+
|
768 |
+
/**
|
769 |
+
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
770 |
+
*/
|
771 |
+
function ct_input_remove_links_from_approved_comments() {
|
772 |
+
global $ct_options, $ct_data;
|
773 |
+
|
774 |
+
$ct_options = ct_get_options();
|
775 |
+
$ct_data = ct_get_data();
|
776 |
+
|
777 |
+
$value = $ct_options['remove_comments_links'];
|
778 |
+
echo "<input type='radio' id='cleantalk_remove_links_from_comments1' name='cleantalk_settings[remove_comments_links]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_links_from_comments1'> " . __('Yes') . "</label>";
|
779 |
+
echo ' ';
|
780 |
+
echo "<input type='radio' id='cleantalk_remove_links_from_comments0' name='cleantalk_settings[remove_comments_links]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_remove_links_from_comments0'> " . __('No') . "</label>";
|
781 |
+
admin_addDescriptionsFields(__('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'));
|
782 |
+
}
|
783 |
+
|
784 |
/**
|
785 |
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
786 |
*/
|
947 |
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>";
|
948 |
echo ' ';
|
949 |
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>";
|
950 |
+
@admin_addDescriptionsFields(sprintf(__('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk')."<strong> ".__('Attention! Incompatible with AMP plugins!', 'cleantalk')."</strong>", $ct_options['use_ajax']));
|
951 |
}
|
952 |
|
953 |
function ct_input_check_comments_number() {
|
1586 |
if (isset($_POST['cleantalk_settings']['spam_firewall'])) {
|
1587 |
if ($_POST['cleantalk_settings']['spam_firewall'] == 1) {
|
1588 |
cleantalk_update_sfw();
|
1589 |
+
ct_send_sfw_log();
|
1590 |
} else {
|
1591 |
// Reseting SFW logs to do not keep huge ammount of data.
|
1592 |
$ct_data['sfw_log']= array();
|
inc/cleantalk-ajax.php
CHANGED
@@ -63,9 +63,13 @@ $cleantalk_hooked_actions[]='zn_do_login';
|
|
63 |
/*hooks for zn_do_login */
|
64 |
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
|
65 |
//add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
|
70 |
/*hooks for visual form builder */
|
71 |
//add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
|
@@ -271,7 +275,7 @@ function ct_user_register_ajaxlogin($user_id)
|
|
271 |
return $user_id;
|
272 |
}
|
273 |
|
274 |
-
function ct_ajax_hook()
|
275 |
{
|
276 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
277 |
global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data, $current_user;
|
@@ -322,24 +326,29 @@ function ct_ajax_hook()
|
|
322 |
$nickname='';
|
323 |
}
|
324 |
|
325 |
-
|
326 |
-
{
|
327 |
-
|
328 |
-
|
|
|
329 |
}
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
335 |
}
|
336 |
|
337 |
//UserPro fix
|
338 |
if($_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
|
339 |
$ct_post_temp = $_POST;
|
340 |
$ct_post_temp['shortcode'] = '';
|
341 |
-
|
342 |
-
|
|
|
|
|
|
|
343 |
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
344 |
|
345 |
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
@@ -353,16 +362,6 @@ function ct_ajax_hook()
|
|
353 |
}
|
354 |
|
355 |
$message = json_encode($message);
|
356 |
-
|
357 |
-
if(isset($_POST['cscf']['confirm-email']))
|
358 |
-
{
|
359 |
-
$_POST['cscf']['confirm-email']=$tmp;
|
360 |
-
}
|
361 |
-
|
362 |
-
if(($_POST['action']=='request_appointment'||$_POST['action']=='send_message')&&isset($_POST['target']))
|
363 |
-
{
|
364 |
-
$_POST['target']=$tmp;
|
365 |
-
}
|
366 |
|
367 |
if($sender_email!=null)
|
368 |
{
|
@@ -439,11 +438,13 @@ function ct_ajax_hook()
|
|
439 |
print json_encode($result);
|
440 |
die();
|
441 |
}
|
442 |
-
else if($_POST['action']=='cscf-submitform')
|
443 |
{
|
444 |
-
$
|
445 |
-
|
446 |
-
|
|
|
|
|
447 |
}
|
448 |
else if($_POST['action']=='woocommerce_checkout')
|
449 |
{
|
63 |
/*hooks for zn_do_login */
|
64 |
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
|
65 |
//add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
|
66 |
+
if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
|
67 |
+
add_filter('preprocess_comment', 'ct_ajax_hook', 1);
|
68 |
+
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
|
69 |
+
//add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
|
70 |
+
$cleantalk_hooked_actions[]='cscf-submitform';
|
71 |
+
}
|
72 |
+
|
73 |
|
74 |
/*hooks for visual form builder */
|
75 |
//add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
|
275 |
return $user_id;
|
276 |
}
|
277 |
|
278 |
+
function ct_ajax_hook($message_obj = false)
|
279 |
{
|
280 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
281 |
global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data, $current_user;
|
326 |
$nickname='';
|
327 |
}
|
328 |
|
329 |
+
//CSCF fix
|
330 |
+
if($_POST['action']== 'cscf-submitform' && !isset($_POST['cscf'])){
|
331 |
+
$ct_post_temp[] = $message_obj['comment_author'];
|
332 |
+
$ct_post_temp[] = $message_obj['comment_author_email'];
|
333 |
+
$ct_post_temp[] = $message_obj['comment_content'];
|
334 |
}
|
335 |
+
|
336 |
+
|
337 |
+
//??? fix
|
338 |
+
if(($_POST['action']=='request_appointment'||$_POST['action']=='send_message')&&isset($_POST['target'])){
|
339 |
+
$ct_post_temp=$_POST;
|
340 |
+
$ct_post_temp['target']=1;
|
341 |
}
|
342 |
|
343 |
//UserPro fix
|
344 |
if($_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
|
345 |
$ct_post_temp = $_POST;
|
346 |
$ct_post_temp['shortcode'] = '';
|
347 |
+
}
|
348 |
+
|
349 |
+
if(isset($ct_post_temp))
|
350 |
+
$ct_temp_msg_data = ct_get_fields_any($ct_post_temp);
|
351 |
+
else
|
352 |
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
353 |
|
354 |
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
362 |
}
|
363 |
|
364 |
$message = json_encode($message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
|
366 |
if($sender_email!=null)
|
367 |
{
|
438 |
print json_encode($result);
|
439 |
die();
|
440 |
}
|
441 |
+
else if($_POST['action']== 'cscf-submitform' && !isset($_POST['cscf']))
|
442 |
{
|
443 |
+
$message_obj['akismet_result'] = 'true';
|
444 |
+
return $message_obj;
|
445 |
+
//$result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
|
446 |
+
//print json_encode($result);
|
447 |
+
//die();
|
448 |
}
|
449 |
else if($_POST['action']=='woocommerce_checkout')
|
450 |
{
|
inc/cleantalk-common.php
CHANGED
@@ -465,22 +465,34 @@ function ct_def_options() {
|
|
465 |
'server' => 'http://moderate.cleantalk.org',
|
466 |
'apikey' => __('', 'cleantalk'),
|
467 |
'autoPubRevelantMess' => '0',
|
468 |
-
|
|
|
469 |
'comments_test' => '1',
|
470 |
'contact_forms_test' => '1',
|
471 |
'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
|
472 |
'wc_checkout_test' => '0', //WooCommerce checkout default test => OFF
|
|
|
|
|
473 |
'bp_private_messages' => '1', //buddyPress private messages test => ON
|
|
|
474 |
'remove_old_spam' => '0',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
'spam_store_days' => '15', // Days before delete comments from folder Spam
|
476 |
-
'ssl_on' => 0, // Secure connection to servers
|
477 |
'relevance_test' => 0, // Test comment for relevance
|
478 |
'notice_api_errors' => 0, // Send API error notices to WP admin
|
479 |
'user_token'=>'', //user token for auto login into spam statistics
|
480 |
-
'
|
481 |
-
'collect_details' => 0, // Collect details about browser of the visitor.
|
482 |
-
'show_adminbar' => 1, // Show the admin bar.
|
483 |
-
'protect_logged_in' => -1 // Do anit-spam tests to for logged in users.
|
484 |
);
|
485 |
}
|
486 |
|
@@ -887,6 +899,7 @@ function ct_get_fields_any_postdata($arr, $message=array()){
|
|
887 |
'txn_type', // PayPal transaction type
|
888 |
'payment_status', // PayPal payment status
|
889 |
);
|
|
|
890 |
foreach($arr as $key => $value){
|
891 |
if(!is_array($value)){
|
892 |
if($value == '')
|
@@ -941,25 +954,19 @@ function ct_check_array_keys($arr)
|
|
941 |
return $ct_check_post_result;
|
942 |
}
|
943 |
|
944 |
-
function check_url_exclusions()
|
945 |
-
|
946 |
global $cleantalk_url_exclusions;
|
947 |
-
|
948 |
-
if(isset($cleantalk_url_exclusions) && sizeof($cleantalk_url_exclusions)>0)
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
if(stripos($_SERVER['REQUEST_URI'], $value)!==false)
|
953 |
-
{
|
954 |
-
$result=true;
|
955 |
}
|
956 |
}
|
957 |
}
|
958 |
-
|
959 |
-
|
960 |
-
$result=false;
|
961 |
-
}
|
962 |
-
return $result;
|
963 |
}
|
964 |
|
965 |
function ct_filter_array(&$array)
|
465 |
'server' => 'http://moderate.cleantalk.org',
|
466 |
'apikey' => __('', 'cleantalk'),
|
467 |
'autoPubRevelantMess' => '0',
|
468 |
+
//Forms for protection
|
469 |
+
'registrations_test' => '1',
|
470 |
'comments_test' => '1',
|
471 |
'contact_forms_test' => '1',
|
472 |
'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
|
473 |
'wc_checkout_test' => '0', //WooCommerce checkout default test => OFF
|
474 |
+
'check_external' => '0',
|
475 |
+
//Comments and messages
|
476 |
'bp_private_messages' => '1', //buddyPress private messages test => ON
|
477 |
+
'check_comments_number' => '1',
|
478 |
'remove_old_spam' => '0',
|
479 |
+
'remove_comments_links' => '0', //Removes links from approved comments
|
480 |
+
//Data processing
|
481 |
+
'protect_logged_in' => '-1', // Do anit-spam tests to for logged in users.
|
482 |
+
'use_ajax' => '1',
|
483 |
+
'general_postdata_test' => '0', //CAPD
|
484 |
+
'set_cookies'=> '1', // Disable cookies generatation to be compatible with Varnish.
|
485 |
+
'ssl_on' => '0', // Secure connection to servers
|
486 |
+
//Administrator Panel
|
487 |
+
'show_adminbar' => '1', // Show the admin bar.
|
488 |
+
'all_time_counter' => '0',
|
489 |
+
'daily_counter' => '0',
|
490 |
+
//Others
|
491 |
'spam_store_days' => '15', // Days before delete comments from folder Spam
|
|
|
492 |
'relevance_test' => 0, // Test comment for relevance
|
493 |
'notice_api_errors' => 0, // Send API error notices to WP admin
|
494 |
'user_token'=>'', //user token for auto login into spam statistics
|
495 |
+
'collect_details' => 0 // Collect details about browser of the visitor.
|
|
|
|
|
|
|
496 |
);
|
497 |
}
|
498 |
|
899 |
'txn_type', // PayPal transaction type
|
900 |
'payment_status', // PayPal payment status
|
901 |
);
|
902 |
+
|
903 |
foreach($arr as $key => $value){
|
904 |
if(!is_array($value)){
|
905 |
if($value == '')
|
954 |
return $ct_check_post_result;
|
955 |
}
|
956 |
|
957 |
+
function check_url_exclusions($exclusions = NULL){
|
958 |
+
|
959 |
global $cleantalk_url_exclusions;
|
960 |
+
|
961 |
+
if((isset($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions) && sizeof($cleantalk_url_exclusions)>0) || ($exclusions !== NULL && is_array($exclusions) && sizeof($exclusions)>0)){
|
962 |
+
foreach($cleantalk_url_exclusions as $key => $value){
|
963 |
+
if(stripos($_SERVER['REQUEST_URI'], $value) !== false){
|
964 |
+
return true;
|
|
|
|
|
|
|
965 |
}
|
966 |
}
|
967 |
}
|
968 |
+
|
969 |
+
return false;
|
|
|
|
|
|
|
970 |
}
|
971 |
|
972 |
function ct_filter_array(&$array)
|
inc/cleantalk-public.php
CHANGED
@@ -88,26 +88,28 @@ function ct_init() {
|
|
88 |
|
89 |
// JetPack Contact form
|
90 |
$jetpack_active_modules = false;
|
91 |
-
if(defined('JETPACK__VERSION')
|
92 |
{
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
111 |
}
|
112 |
|
113 |
// Contact Form7
|
@@ -214,8 +216,12 @@ function ct_woocommerce_wishlist_check($args){
|
|
214 |
if(isset($ct_options['protect_logged_in']) && $ct_options['protect_logged_in'] == 0)
|
215 |
return $args;
|
216 |
|
217 |
-
//
|
|
|
|
|
|
|
218 |
|
|
|
219 |
$message = '';
|
220 |
$subject = '';
|
221 |
$email = $args['wishlist_owner_email'];
|
@@ -239,7 +245,6 @@ function ct_woocommerce_wishlist_check($args){
|
|
239 |
);
|
240 |
|
241 |
//Making a call
|
242 |
-
|
243 |
$ct_base_call_result = ct_base_call(array(
|
244 |
'message' => $subject." ".$message,
|
245 |
'example' => null,
|
@@ -853,7 +858,11 @@ function ct_preprocess_comment($comment) {
|
|
853 |
add_action('comment_post', 'ct_set_meta', 10, 2);
|
854 |
}
|
855 |
}
|
856 |
-
|
|
|
|
|
|
|
|
|
857 |
return $comment;
|
858 |
}
|
859 |
|
@@ -2014,7 +2023,7 @@ function ct_contact_form_validate () {
|
|
2014 |
|
2015 |
$ct_options = ct_get_options();
|
2016 |
$ct_data = ct_get_data();
|
2017 |
-
|
2018 |
if($cleantalk_executed)
|
2019 |
{
|
2020 |
return null;
|
@@ -2056,10 +2065,12 @@ function ct_contact_form_validate () {
|
|
2056 |
(isset($_POST['log']) && isset($_POST['pwd'])) || //WooCommerce Sensei login form fix
|
2057 |
(isset($_POST['_wpcf7']) && isset($_POST['_wpcf7_version']) && isset($_POST['_wpcf7_locale'])) || //CF7 fix)
|
2058 |
(isset($_POST['hash']) && isset($_POST['device_unique_id']) && isset($_POST['device_name'])) ||//Mobile Assistant Connector fix
|
2059 |
-
isset($_POST['gform_submit'])
|
|
|
2060 |
) {
|
2061 |
return null;
|
2062 |
}
|
|
|
2063 |
// Do not execute anti-spam test for logged in users.
|
2064 |
if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $ct_options['protect_logged_in'] != 1) {
|
2065 |
return null;
|
88 |
|
89 |
// JetPack Contact form
|
90 |
$jetpack_active_modules = false;
|
91 |
+
if(defined('JETPACK__VERSION'))
|
92 |
{
|
93 |
+
if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
|
94 |
+
if(JETPACK__VERSION=='3.4-beta')
|
95 |
+
{
|
96 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
97 |
+
}
|
98 |
+
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
99 |
+
{
|
100 |
+
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
|
101 |
+
}
|
102 |
+
else
|
103 |
+
{
|
104 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
105 |
+
}
|
106 |
+
$jetpack_active_modules = get_option('jetpack_active_modules');
|
107 |
+
if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
|
108 |
+
{
|
109 |
+
$ct_jp_comments = true;
|
110 |
+
}
|
111 |
+
}else
|
112 |
+
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
113 |
}
|
114 |
|
115 |
// Contact Form7
|
216 |
if(isset($ct_options['protect_logged_in']) && $ct_options['protect_logged_in'] == 0)
|
217 |
return $args;
|
218 |
|
219 |
+
//If the IP is a Google bot
|
220 |
+
$hostname = gethostbyaddr( filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) );
|
221 |
+
if(!strpos($hostname, 'googlebot.com'))
|
222 |
+
return $args;
|
223 |
|
224 |
+
//Getting request params
|
225 |
$message = '';
|
226 |
$subject = '';
|
227 |
$email = $args['wishlist_owner_email'];
|
245 |
);
|
246 |
|
247 |
//Making a call
|
|
|
248 |
$ct_base_call_result = ct_base_call(array(
|
249 |
'message' => $subject." ".$message,
|
250 |
'example' => null,
|
858 |
add_action('comment_post', 'ct_set_meta', 10, 2);
|
859 |
}
|
860 |
}
|
861 |
+
|
862 |
+
if(isset($ct_options['remove_comments_links']) && $ct_options['remove_comments_links'] == '1'){
|
863 |
+
$comment = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment);
|
864 |
+
}
|
865 |
+
|
866 |
return $comment;
|
867 |
}
|
868 |
|
2023 |
|
2024 |
$ct_options = ct_get_options();
|
2025 |
$ct_data = ct_get_data();
|
2026 |
+
|
2027 |
if($cleantalk_executed)
|
2028 |
{
|
2029 |
return null;
|
2065 |
(isset($_POST['log']) && isset($_POST['pwd'])) || //WooCommerce Sensei login form fix
|
2066 |
(isset($_POST['_wpcf7']) && isset($_POST['_wpcf7_version']) && isset($_POST['_wpcf7_locale'])) || //CF7 fix)
|
2067 |
(isset($_POST['hash']) && isset($_POST['device_unique_id']) && isset($_POST['device_name'])) ||//Mobile Assistant Connector fix
|
2068 |
+
isset($_POST['gform_submit']) || //Gravity form
|
2069 |
+
(isset($_POST['wc_reset_password']) && isset($_POST['_wpnonce']) && isset($_POST['_wp_http_referer'])) //WooCommerce recovery password form
|
2070 |
) {
|
2071 |
return null;
|
2072 |
}
|
2073 |
+
|
2074 |
// Do not execute anti-spam test for logged in users.
|
2075 |
if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $ct_options['protect_logged_in'] != 1) {
|
2076 |
return null;
|
inc/cleantalk-sfw.class.php
CHANGED
@@ -6,93 +6,64 @@ class CleanTalkSFW
|
|
6 |
public $ip_array = Array();
|
7 |
public $ip_str_array = Array();
|
8 |
public $blocked_ip = '';
|
|
|
9 |
public $result = false;
|
10 |
|
11 |
public function cleantalk_get_real_ip()
|
12 |
{
|
|
|
13 |
if ( function_exists( 'apache_request_headers' ) )
|
14 |
-
{
|
15 |
$headers = apache_request_headers();
|
16 |
-
}
|
17 |
else
|
18 |
-
{
|
19 |
$headers = $_SERVER;
|
20 |
-
|
21 |
-
if ( array_key_exists( 'X-Forwarded-For', $headers ) )
|
22 |
-
|
23 |
-
$the_ip=explode(",", trim($headers['X-Forwarded-For']));
|
24 |
$the_ip = trim($the_ip[0]);
|
|
|
25 |
$this->ip_str_array[]=$the_ip;
|
26 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
27 |
}
|
28 |
-
|
29 |
-
{
|
30 |
-
$the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
|
31 |
$the_ip = trim($the_ip[0]);
|
|
|
32 |
$this->ip_str_array[]=$the_ip;
|
33 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
34 |
}
|
|
|
35 |
$the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
|
|
|
36 |
$this->ip_str_array[]=$the_ip;
|
37 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
38 |
|
39 |
-
if(isset($_GET['sfw_test_ip']))
|
40 |
-
|
41 |
-
$
|
42 |
$this->ip_str_array[]=$the_ip;
|
43 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
44 |
}
|
45 |
-
|
46 |
-
|
47 |
-
//print sprintf("%u", ip2long($the_ip));
|
48 |
}
|
49 |
|
50 |
public function check_ip()
|
51 |
-
{
|
52 |
global $wpdb,$ct_options, $ct_data;
|
53 |
-
$passed_ip='';
|
54 |
-
for($i=0;$i<sizeof($this->ip_array);$i++)
|
55 |
-
{
|
56 |
-
//print "select network from `".$wpdb->base_prefix."cleantalk_sfw` where ".$this->ip." & mask = network;";
|
57 |
-
//$r = $wpdb->get_results("select network from `".$wpdb->base_prefix."cleantalk_sfw` where network = ".$this->ip." & mask;", ARRAY_A);
|
58 |
-
$r = $wpdb->get_results("select network from `".$wpdb->base_prefix."cleantalk_sfw` where network = ".$this->ip_array[$i]." & mask;", ARRAY_A);
|
59 |
-
|
60 |
-
if(isset($ct_data['sfw_log']))
|
61 |
-
{
|
62 |
-
$sfw_log=$ct_data['sfw_log'];
|
63 |
-
}
|
64 |
-
else
|
65 |
-
{
|
66 |
-
$sfw_log=array();
|
67 |
-
}
|
68 |
|
69 |
-
|
70 |
-
|
|
|
71 |
$this->result=true;
|
72 |
$this->blocked_ip=$this->ip_str_array[$i];
|
73 |
-
|
74 |
-
|
75 |
-
$sfw_log[$this->ip_str_array[$i]]['all']++;
|
76 |
-
}
|
77 |
-
else
|
78 |
-
{
|
79 |
-
$sfw_log[$this->ip_str_array[$i]] = Array('datetime'=>time(), 'all' => 1, 'allow' => 0);
|
80 |
-
}
|
81 |
}
|
82 |
-
else
|
83 |
-
{
|
84 |
-
//$sfw_log[$this->ip_str]['allow']++;
|
85 |
-
//@setcookie ('ct_sfw_pass_key', md5($this->ip_str.$ct_options['apikey']), 0, "/");
|
86 |
-
$passed_ip = $this->ip_str_array[$i];
|
87 |
-
}
|
88 |
-
//if($this->result)break;
|
89 |
}
|
90 |
-
if($passed_ip!='')
|
91 |
-
|
92 |
-
@setcookie ('ct_sfw_pass_key', md5($passed_ip.$ct_options['apikey']), 0, "/");
|
93 |
}
|
94 |
-
$ct_data['sfw_log'] = $sfw_log;
|
95 |
-
update_option('cleantalk_data', $ct_data);
|
96 |
}
|
97 |
|
98 |
public function sfw_die()
|
@@ -108,7 +79,113 @@ class CleanTalkSFW
|
|
108 |
wp_die( $sfw_die_page, "Blacklisted", Array('response'=>403) );
|
109 |
}
|
110 |
|
111 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
{
|
113 |
global $ct_options, $ct_data;
|
114 |
$ct_options = ct_get_options();
|
@@ -154,4 +231,5 @@ class CleanTalkSFW
|
|
154 |
|
155 |
}
|
156 |
}
|
|
|
157 |
}
|
6 |
public $ip_array = Array();
|
7 |
public $ip_str_array = Array();
|
8 |
public $blocked_ip = '';
|
9 |
+
public $passed_ip = '';
|
10 |
public $result = false;
|
11 |
|
12 |
public function cleantalk_get_real_ip()
|
13 |
{
|
14 |
+
$result=Array();
|
15 |
if ( function_exists( 'apache_request_headers' ) )
|
|
|
16 |
$headers = apache_request_headers();
|
|
|
17 |
else
|
|
|
18 |
$headers = $_SERVER;
|
19 |
+
|
20 |
+
if ( array_key_exists( 'X-Forwarded-For', $headers ) ){
|
21 |
+
$the_ip = explode(",", trim($headers['X-Forwarded-For']));
|
|
|
22 |
$the_ip = trim($the_ip[0]);
|
23 |
+
$result[] = $the_ip;
|
24 |
$this->ip_str_array[]=$the_ip;
|
25 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
26 |
}
|
27 |
+
|
28 |
+
if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers )){
|
29 |
+
$the_ip = explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
|
30 |
$the_ip = trim($the_ip[0]);
|
31 |
+
$result[] = $the_ip;
|
32 |
$this->ip_str_array[]=$the_ip;
|
33 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
34 |
}
|
35 |
+
|
36 |
$the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
|
37 |
+
$result[] = $the_ip;
|
38 |
$this->ip_str_array[]=$the_ip;
|
39 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
40 |
|
41 |
+
if(isset($_GET['sfw_test_ip'])){
|
42 |
+
$the_ip = $_GET['sfw_test_ip'];
|
43 |
+
$result[] = $the_ip;
|
44 |
$this->ip_str_array[]=$the_ip;
|
45 |
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
|
46 |
}
|
47 |
+
|
48 |
+
return $result;
|
|
|
49 |
}
|
50 |
|
51 |
public function check_ip()
|
52 |
+
{
|
53 |
global $wpdb,$ct_options, $ct_data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
for($i=0;$i<sizeof($this->ip_array);$i++){
|
56 |
+
$r = $wpdb->get_results("select count(network) as cnt from `".$wpdb->base_prefix."cleantalk_sfw` where network = ".$this->ip_array[$i]." & mask;", ARRAY_A);
|
57 |
+
if($r[0]['cnt']){
|
58 |
$this->result=true;
|
59 |
$this->blocked_ip=$this->ip_str_array[$i];
|
60 |
+
}else{
|
61 |
+
$this->passed_ip = $this->ip_str_array[$i];
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
+
if($this->passed_ip!=''){
|
65 |
+
@setcookie ('ct_sfw_pass_key', md5($this->passed_ip.$ct_options['apikey']), 0, "/");
|
|
|
66 |
}
|
|
|
|
|
67 |
}
|
68 |
|
69 |
public function sfw_die()
|
79 |
wp_die( $sfw_die_page, "Blacklisted", Array('response'=>403) );
|
80 |
}
|
81 |
|
82 |
+
static public function sfw_update($ct_key){
|
83 |
+
|
84 |
+
global $wpdb;
|
85 |
+
|
86 |
+
if(!function_exists('sendRawRequest'))
|
87 |
+
require_once(plugin_dir_path(__FILE__) . 'cleantalk.class.php');
|
88 |
+
|
89 |
+
$data = Array('auth_key' => $ct_key, 'method_name' => '2s_blacklists_db');
|
90 |
+
$result=sendRawRequest('https://api.cleantalk.org/2.1',$data,false);
|
91 |
+
|
92 |
+
$result=json_decode($result, true);
|
93 |
+
|
94 |
+
if(isset($result['data'])){
|
95 |
+
|
96 |
+
$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw`;");
|
97 |
+
|
98 |
+
$result=$result['data'];
|
99 |
+
$query="INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw` VALUES ";
|
100 |
+
for($i=0;$i<sizeof($result);$i++){
|
101 |
+
if($i==sizeof($result)-1){
|
102 |
+
$query.="(".$result[$i][0].",".$result[$i][1].");";
|
103 |
+
}else{
|
104 |
+
$query.="(".$result[$i][0].",".$result[$i][1]."), ";
|
105 |
+
}
|
106 |
+
}
|
107 |
+
$wpdb->query($query);
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
//Add entries to SFW log
|
112 |
+
static public function sfw_update_logs($ip, $result){
|
113 |
+
|
114 |
+
if($ip === NULL || $result === NULL){
|
115 |
+
error_log('SFW log update failed');
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
|
119 |
+
global $wpdb;
|
120 |
+
|
121 |
+
$blocked = ($result == 'blocked' ? ' + 1' : '');
|
122 |
+
$time = time();
|
123 |
+
|
124 |
+
$query = "INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw_logs`
|
125 |
+
SET
|
126 |
+
`ip` = '$ip',
|
127 |
+
`all` = 1,
|
128 |
+
`blocked` = 1,
|
129 |
+
`timestamp` = '".$time."'
|
130 |
+
ON DUPLICATE KEY
|
131 |
+
UPDATE
|
132 |
+
`all` = `all` + 1,
|
133 |
+
`blocked` = `blocked`".$blocked.",
|
134 |
+
`timestamp` = '".$time."'";
|
135 |
+
|
136 |
+
$result = $wpdb->query($query);
|
137 |
+
}
|
138 |
+
|
139 |
+
//*Send and wipe SFW log
|
140 |
+
public static function send_logs($ct_key){
|
141 |
+
|
142 |
+
global $wpdb;
|
143 |
+
|
144 |
+
//Getting logs
|
145 |
+
$result = $wpdb->get_results("SELECT * FROM `".$wpdb->base_prefix."cleantalk_sfw_logs`", ARRAY_A);
|
146 |
+
|
147 |
+
if(count($result)){
|
148 |
+
//Compile logs
|
149 |
+
$data = array();
|
150 |
+
|
151 |
+
$for_return['all'] = 0;
|
152 |
+
$for_return['blocked'] = 0;
|
153 |
+
|
154 |
+
foreach($result as $key => $value){
|
155 |
+
//Compile log
|
156 |
+
$data[] = array(trim($value['ip']), $value['all'], $value['blocked'], $value['timestamp']);
|
157 |
+
//Compile to return;
|
158 |
+
$for_return['all'] = $for_return['all'] + $value['all'];
|
159 |
+
$for_return['blocked'] = $for_return['blocked'] + $value['blocked'];
|
160 |
+
} unset($key, $value, $result);
|
161 |
+
|
162 |
+
//Final compile
|
163 |
+
$qdata = array (
|
164 |
+
'data' => json_encode($data),
|
165 |
+
'rows' => count($data),
|
166 |
+
'timestamp' => time()
|
167 |
+
);
|
168 |
+
|
169 |
+
if(!function_exists('sendRawRequest'))
|
170 |
+
require_once(plugin_dir_path(__FILE__) . 'cleantalk.class.php');
|
171 |
+
|
172 |
+
//Sendings request
|
173 |
+
$result=sendRawRequest('https://api.cleantalk.org/?method_name=sfw_logs&auth_key='.$ct_key, $qdata, false);
|
174 |
+
|
175 |
+
$result = json_decode($result);
|
176 |
+
//Checking answer and truncate table
|
177 |
+
if(isset($result->data) && isset($result->data->rows))
|
178 |
+
if($result->data->rows == count($data)){
|
179 |
+
$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw_logs`");
|
180 |
+
return $for_return;
|
181 |
+
}
|
182 |
+
|
183 |
+
}else
|
184 |
+
return false;
|
185 |
+
}
|
186 |
+
|
187 |
+
/* OLD Send and wipe SFW log
|
188 |
+
public function send_logs_old()
|
189 |
{
|
190 |
global $ct_options, $ct_data;
|
191 |
$ct_options = ct_get_options();
|
231 |
|
232 |
}
|
233 |
}
|
234 |
+
//*/
|
235 |
}
|
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, 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, widget, review, firewall, 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,honeypot,spamshield
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.6.1
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -481,6 +481,19 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
481 |
1. The Dashboard with a map of most spam active countries per your account.
|
482 |
|
483 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
= 5.48 September 15 2016 =
|
485 |
* buddyPress: Added private messages filtering. Doesn't check user if he has 3 or more messages in the "sentbox" and "inbox" folders.
|
486 |
* buddyPress: Added option in settings for private messages check.
|
@@ -1144,6 +1157,19 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
1144 |
|
1145 |
== Upgrade Notice ==
|
1146 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1147 |
= 5.48 September 15 2016 =
|
1148 |
* buddyPress: Added private messages filtering. Doesn't check user if he has 3 or more messages in the "sentbox" and "inbox" folders.
|
1149 |
* buddyPress: Added option in settings for private messages check.
|
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, 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, widget, review, firewall, 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,honeypot,spamshield
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.6.1
|
6 |
+
Stable tag: 5.49
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
481 |
1. The Dashboard with a map of most spam active countries per your account.
|
482 |
|
483 |
== Changelog ==
|
484 |
+
= 5.49 October 3 2016 =
|
485 |
+
* SpamFireWall feature: Class upgraded.
|
486 |
+
* New feature: Delete links from approved comments.
|
487 |
+
* Settings: Grouped.
|
488 |
+
* Settings: Altered description fixed spelling mistakes.
|
489 |
+
* Settings: Added indicator for SpamFireWall.
|
490 |
+
* Admin bar: Added SpamFireWall counter
|
491 |
+
* Clean and Simple Contact Form: Direct integration.
|
492 |
+
* WooCommerce: Don't check password recovery form.
|
493 |
+
* WooCommerce Wishlists: Issue with check for Google bots.
|
494 |
+
* JetPack: contact form fix.
|
495 |
+
* Fixed and created the defaults for all CleanTalk options.
|
496 |
+
* Fixed spelling mistakes.
|
497 |
= 5.48 September 15 2016 =
|
498 |
* buddyPress: Added private messages filtering. Doesn't check user if he has 3 or more messages in the "sentbox" and "inbox" folders.
|
499 |
* buddyPress: Added option in settings for private messages check.
|
1157 |
|
1158 |
== Upgrade Notice ==
|
1159 |
== Changelog ==
|
1160 |
+
= 5.49 October 3 2016 =
|
1161 |
+
* SpamFireWall feature: Class upgraded.
|
1162 |
+
* New feature: Delete links from approved comments.
|
1163 |
+
* Settings: Grouped.
|
1164 |
+
* Settings: Altered description fixed spelling mistakes.
|
1165 |
+
* Settings: Added indicator for SpamFireWall.
|
1166 |
+
* Admin bar: Added SpamFireWall counter
|
1167 |
+
* Clean and Simple Contact Form: Direct integration.
|
1168 |
+
* WooCommerce: Don't check password recovery form.
|
1169 |
+
* WooCommerce Wishlists: Issue with check for Google bots.
|
1170 |
+
* JetPack: contact form fix.
|
1171 |
+
* Fixed and created the defaults for all CleanTalk options.
|
1172 |
+
* Fixed spelling mistakes.
|
1173 |
= 5.48 September 15 2016 =
|
1174 |
* buddyPress: Added private messages filtering. Doesn't check user if he has 3 or more messages in the "sentbox" and "inbox" folders.
|
1175 |
* buddyPress: Added option in settings for private messages check.
|