Version Description
August 26 2019 = * Fix: PHP Notices. * Fix: Auto update. * Fix: Displaying protection status for IP license. * Fix: prevent capturing buffer for XMLRPC requests (check_external functionality). * Fix: API key validating. * New: Complete deactivation setting.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.125 |
Comparing to | |
See all releases |
Code changes from version 5.124.1 to 5.125
- cleantalk.php +119 -25
- inc/cleantalk-pluggable.php +1 -1
- inc/cleantalk-public.php +1 -1
- inc/cleantalk-settings.php +44 -62
- lib/CleantalkBase/CleantalkAPI.php +13 -13
- lib/CleantalkBase/CleantalkSFW.php +23 -1
- lib/CleantalkSFW.php +9 -10
- lib/CleantalkSFW_Base.php +17 -0
- lib/CleantalkState.php +1 -0
- readme.txt +18 -2
cleantalk.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Anti-Spam 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.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
Text Domain: cleantalk
|
@@ -51,7 +51,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
51 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
|
52 |
|
53 |
// Base classes
|
54 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkAPI.php'); //
|
55 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkDB.php'); // Database driver
|
56 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkHelper.php'); // Helper
|
57 |
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkBase/CleantalkSFW.php"); // SpamFireWall
|
@@ -432,7 +432,7 @@ function apbct_remote_call__perform()
|
|
432 |
|
433 |
// Update plugin
|
434 |
case 'update_plugin':
|
435 |
-
add_action('wp', '
|
436 |
break;
|
437 |
|
438 |
// Install plugin
|
@@ -711,28 +711,71 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
|
|
711 |
*/
|
712 |
function apbct_deactivation( $network ) {
|
713 |
|
714 |
-
global $wpdb;
|
715 |
-
|
716 |
-
|
|
|
|
|
717 |
$initial_blog = get_current_blog_id();
|
718 |
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
719 |
foreach ($blogs as $blog) {
|
720 |
switch_to_blog($blog);
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
|
|
726 |
}
|
727 |
switch_to_blog($initial_blog);
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
delete_option('cleantalk_cron');
|
734 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
}
|
737 |
|
738 |
/**
|
@@ -841,6 +884,59 @@ function ct_sfw_send_logs()
|
|
841 |
return array('error' => 'SFW_DISABLED');
|
842 |
}
|
843 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
/**
|
845 |
* Install plugin from wordpress catalog
|
846 |
*
|
@@ -883,7 +979,7 @@ function apbct_rc__install_plugin($wp = null, $plugin = null){
|
|
883 |
}else
|
884 |
die('FAIL '. json_encode(array('error' => $installer->apbct_result)));
|
885 |
}else
|
886 |
-
die('FAIL '. json_encode(array('error' => 'FAIL_TO_GET_LATEST_VERSION '
|
887 |
}else
|
888 |
die('FAIL '. json_encode(array('error' => 'PLUGIN_SLUG_INCORRECT')));
|
889 |
}else
|
@@ -907,7 +1003,7 @@ function apbct_rc__activate_plugin($plugin){
|
|
907 |
if($result && !is_wp_error($result)){
|
908 |
return array('success' => true);
|
909 |
}else
|
910 |
-
return array('error' => 'FAIL_TO_ACTIVATE'
|
911 |
}else
|
912 |
return array('error' => 'PLUGIN_NAME_IS_INCORRECT');
|
913 |
}else
|
@@ -996,7 +1092,7 @@ function apbct_rc__uninstall_plugin($plugin = null){
|
|
996 |
if($result && !is_wp_error($result)){
|
997 |
die('OK');
|
998 |
}else
|
999 |
-
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_EXISTS'
|
1000 |
}else
|
1001 |
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
|
1002 |
}else
|
@@ -1040,8 +1136,6 @@ function apbct_rc__update(){
|
|
1040 |
|
1041 |
if(is_wp_error($result))
|
1042 |
die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
|
1043 |
-
if($result === false)
|
1044 |
-
die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE')));
|
1045 |
|
1046 |
$httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
|
1047 |
|
@@ -1445,7 +1539,7 @@ function ct_account_status_check($api_key = null, $process_errors = true){
|
|
1445 |
preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1)
|
1446 |
);
|
1447 |
|
1448 |
-
if(empty($result['error']) ||
|
1449 |
|
1450 |
// Notices
|
1451 |
$apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
|
@@ -1483,7 +1577,7 @@ function ct_account_status_check($api_key = null, $process_errors = true){
|
|
1483 |
$apbct->error_add('account_check', $result);
|
1484 |
}
|
1485 |
|
1486 |
-
if(
|
1487 |
$apbct->data['key_is_ok'] = true;
|
1488 |
$result = true;
|
1489 |
}else{
|
3 |
Plugin Name: Anti-Spam 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.
|
6 |
+
Version: 5.125
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
Text Domain: cleantalk
|
51 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
|
52 |
|
53 |
// Base classes
|
54 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkAPI.php'); // API
|
55 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkDB.php'); // Database driver
|
56 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkHelper.php'); // Helper
|
57 |
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkBase/CleantalkSFW.php"); // SpamFireWall
|
432 |
|
433 |
// Update plugin
|
434 |
case 'update_plugin':
|
435 |
+
add_action('wp', 'apbct_rc__update', 1);
|
436 |
break;
|
437 |
|
438 |
// Install plugin
|
711 |
*/
|
712 |
function apbct_deactivation( $network ) {
|
713 |
|
714 |
+
global $apbct, $wpdb;
|
715 |
+
|
716 |
+
// Deactivation for network
|
717 |
+
if(is_multisite() && $network){
|
718 |
+
|
719 |
$initial_blog = get_current_blog_id();
|
720 |
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
721 |
foreach ($blogs as $blog) {
|
722 |
switch_to_blog($blog);
|
723 |
+
apbct_deactivation__delete_blog_tables();
|
724 |
+
delete_option('cleantalk_cron'); // Deleting cron entries
|
725 |
+
|
726 |
+
if($apbct->settings['complete_deactivation'])
|
727 |
+
apbct_deactivation__delete_all_options();
|
728 |
+
|
729 |
}
|
730 |
switch_to_blog($initial_blog);
|
731 |
+
|
732 |
+
// Deactivation for blog
|
733 |
+
}elseif(is_multisite()){
|
734 |
+
|
735 |
+
apbct_deactivation__delete_common_tables();
|
736 |
+
delete_option('cleantalk_cron'); // Deleting cron entries
|
737 |
+
|
738 |
+
if($apbct->settings['complete_deactivation'])
|
739 |
+
apbct_deactivation__delete_all_options();
|
740 |
+
|
741 |
+
// Deactivation on standalone blog
|
742 |
+
}elseif(!is_multisite()){
|
743 |
+
|
744 |
+
apbct_deactivation__delete_common_tables();
|
745 |
+
delete_option('cleantalk_cron'); // Deleting cron entries
|
746 |
+
|
747 |
+
if($apbct->settings['complete_deactivation'])
|
748 |
+
apbct_deactivation__delete_all_options();
|
749 |
|
750 |
+
}
|
751 |
+
}
|
752 |
+
|
753 |
+
/**
|
754 |
+
* Delete all cleantalk_* entries from _options table
|
755 |
+
*/
|
756 |
+
function apbct_deactivation__delete_all_options(){
|
757 |
+
delete_option('cleantalk_settings');
|
758 |
+
delete_option('cleantalk_data');
|
759 |
+
delete_option('cleantalk_cron');
|
760 |
+
delete_option('cleantalk_errors');
|
761 |
+
delete_option('cleantalk_remote_calls');
|
762 |
+
delete_option('cleantalk_server');
|
763 |
+
delete_option('cleantalk_stats');
|
764 |
+
delete_option('cleantalk_timelabel_reg');
|
765 |
+
}
|
766 |
+
|
767 |
+
function apbct_deactivation__delete_common_tables() {
|
768 |
+
global $wpdb;
|
769 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
770 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
771 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sessions`;'); // Deleting session table
|
772 |
+
}
|
773 |
+
|
774 |
+
function apbct_deactivation__delete_blog_tables() {
|
775 |
+
global $wpdb;
|
776 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
777 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
778 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
779 |
}
|
780 |
|
781 |
/**
|
884 |
return array('error' => 'SFW_DISABLED');
|
885 |
}
|
886 |
|
887 |
+
/**
|
888 |
+
* Wrapper for Cleantalk's remote calls
|
889 |
+
*
|
890 |
+
* @param string $action What you want to do?
|
891 |
+
* @param array $additional_params Additional GET parameters for RC
|
892 |
+
* @param string $presets Presets for CleantalkHelper::http__request(). 'async' maybe?
|
893 |
+
* @param string $plugin_name Plugin name 'antispam' by default
|
894 |
+
* @param string $call_token RC securirty token
|
895 |
+
* @param string $url Current site URL by default
|
896 |
+
*
|
897 |
+
* @return array|bool
|
898 |
+
*/
|
899 |
+
function apbct_rc__send($action, $additional_params = array(), $presets = 'get', $plugin_name = 'antispam', $call_token = '', $url = ''){
|
900 |
+
|
901 |
+
global $apbct;
|
902 |
+
|
903 |
+
$default_params = array(
|
904 |
+
'plugin_name' => $plugin_name,
|
905 |
+
'spbc_remote_call_token' => $call_token ? $call_token : md5($apbct->api_key),
|
906 |
+
'spbc_remote_call_action' => $action,
|
907 |
+
);
|
908 |
+
|
909 |
+
$params = array_merge($additional_params, $default_params);
|
910 |
+
|
911 |
+
return apbct_rc__parse_result(
|
912 |
+
CleantalkHelper::http__request(
|
913 |
+
$url ? $url : get_option('siteurl'),
|
914 |
+
$params,
|
915 |
+
$presets
|
916 |
+
)
|
917 |
+
);
|
918 |
+
}
|
919 |
+
|
920 |
+
/**
|
921 |
+
* Parse different types of remote call results
|
922 |
+
*
|
923 |
+
* @param array|string $rc_result
|
924 |
+
* string - 'FAIL {"some":"result}'
|
925 |
+
* string - 'OK {"some":"result}'
|
926 |
+
*
|
927 |
+
* @return array|string
|
928 |
+
*/
|
929 |
+
function apbct_rc__parse_result($rc_result){
|
930 |
+
if(is_string($rc_result)){
|
931 |
+
$rc_result = preg_replace('/^(OK\s?|FAIL\s?)(.*)/', '$2', $rc_result, 1);
|
932 |
+
$rc_result = json_decode($rc_result, true);
|
933 |
+
$rc_result = $rc_result
|
934 |
+
? $rc_result
|
935 |
+
: array('error' => 'FAIL_TO_PARSE_RC_RESULT');
|
936 |
+
}
|
937 |
+
return $rc_result;
|
938 |
+
}
|
939 |
+
|
940 |
/**
|
941 |
* Install plugin from wordpress catalog
|
942 |
*
|
979 |
}else
|
980 |
die('FAIL '. json_encode(array('error' => $installer->apbct_result)));
|
981 |
}else
|
982 |
+
die('FAIL '. json_encode(array('error' => 'FAIL_TO_GET_LATEST_VERSION', 'details' => $result->get_error_message(),)));
|
983 |
}else
|
984 |
die('FAIL '. json_encode(array('error' => 'PLUGIN_SLUG_INCORRECT')));
|
985 |
}else
|
1003 |
if($result && !is_wp_error($result)){
|
1004 |
return array('success' => true);
|
1005 |
}else
|
1006 |
+
return array('error' => 'FAIL_TO_ACTIVATE', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''));
|
1007 |
}else
|
1008 |
return array('error' => 'PLUGIN_NAME_IS_INCORRECT');
|
1009 |
}else
|
1092 |
if($result && !is_wp_error($result)){
|
1093 |
die('OK');
|
1094 |
}else
|
1095 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_EXISTS', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''))));
|
1096 |
}else
|
1097 |
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
|
1098 |
}else
|
1136 |
|
1137 |
if(is_wp_error($result))
|
1138 |
die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
|
|
|
|
|
1139 |
|
1140 |
$httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
|
1141 |
|
1539 |
preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1)
|
1540 |
);
|
1541 |
|
1542 |
+
if(empty($result['error']) || $result['valid']){
|
1543 |
|
1544 |
// Notices
|
1545 |
$apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
|
1577 |
$apbct->error_add('account_check', $result);
|
1578 |
}
|
1579 |
|
1580 |
+
if($result['valid']){
|
1581 |
$apbct->data['key_is_ok'] = true;
|
1582 |
$result = true;
|
1583 |
}else{
|
inc/cleantalk-pluggable.php
CHANGED
@@ -18,7 +18,7 @@ function apbct_wp_get_current_user(){
|
|
18 |
? $current_user->ID
|
19 |
: null;
|
20 |
}else{
|
21 |
-
$user_id = empty($user_id) && !empty($_COOKIE[LOGGED_IN_COOKIE])
|
22 |
? apbct_wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in')
|
23 |
: null;
|
24 |
}
|
18 |
? $current_user->ID
|
19 |
: null;
|
20 |
}else{
|
21 |
+
$user_id = empty($user_id) && defined('LOGGED_IN_COOKIE') && !empty($_COOKIE[LOGGED_IN_COOKIE])
|
22 |
? apbct_wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in')
|
23 |
: null;
|
24 |
}
|
inc/cleantalk-public.php
CHANGED
@@ -36,7 +36,7 @@ function apbct_init() {
|
|
36 |
if($apbct->settings['check_external']){
|
37 |
|
38 |
// Fixing form and directs it this site
|
39 |
-
if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON)){
|
40 |
add_action('wp', 'apbct_buffer__start');
|
41 |
add_action('shutdown', 'apbct_buffer__end', 0);
|
42 |
add_action('shutdown', 'apbct_buffer__output', 2);
|
36 |
if($apbct->settings['check_external']){
|
37 |
|
38 |
// Fixing form and directs it this site
|
39 |
+
if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
|
40 |
add_action('wp', 'apbct_buffer__start');
|
41 |
add_action('shutdown', 'apbct_buffer__end', 0);
|
42 |
add_action('shutdown', 'apbct_buffer__output', 2);
|
inc/cleantalk-settings.php
CHANGED
@@ -341,6 +341,11 @@ function apbct_settings__add_page() {
|
|
341 |
'comment_notify__roles' => array(
|
342 |
'callback' => 'apbct_settings__field__comment_notify',
|
343 |
),
|
|
|
|
|
|
|
|
|
|
|
344 |
|
345 |
),
|
346 |
),
|
@@ -591,7 +596,7 @@ function apbct_settings__field__debug(){
|
|
591 |
|
592 |
function apbct_settings__field__state(){
|
593 |
|
594 |
-
global $apbct
|
595 |
|
596 |
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
597 |
|
@@ -627,28 +632,23 @@ function apbct_settings__field__state(){
|
|
627 |
print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
|
628 |
|
629 |
print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
// WooCommerce
|
649 |
-
if(class_exists('WooCommerce'))
|
650 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 || $apbct->moderate_ip ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
|
651 |
-
|
652 |
if($apbct->moderate_ip)
|
653 |
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
|
654 |
|
@@ -1071,53 +1071,35 @@ function apbct_settings__validate($settings) {
|
|
1071 |
// Key is good by default
|
1072 |
$apbct->data['key_is_ok'] = true;
|
1073 |
|
1074 |
-
//
|
1075 |
-
|
|
|
|
|
|
|
1076 |
|
1077 |
-
//
|
1078 |
-
$
|
1079 |
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
// Deleting errors about invalid key
|
1086 |
-
$apbct->error_delete('key_invalid key_get', 'save');
|
1087 |
-
|
1088 |
-
// SFW actions
|
1089 |
-
if($apbct->settings['spam_firewall'] == 1){
|
1090 |
-
ct_sfw_update($settings['apikey']);
|
1091 |
-
ct_sfw_send_logs($settings['apikey']);
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
// Updating brief data for dashboard widget
|
1095 |
-
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1096 |
-
|
1097 |
-
// Key is not valid
|
1098 |
-
}else{
|
1099 |
-
$apbct->data['key_is_ok'] = false;
|
1100 |
-
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
1101 |
-
}
|
1102 |
-
|
1103 |
-
// Deleting legacy
|
1104 |
-
if(isset($apbct->data['testing_failed']))
|
1105 |
-
unset($apbct->data['testing_failed']);
|
1106 |
-
|
1107 |
-
// Server error when notice_paid_till
|
1108 |
-
}else{
|
1109 |
-
$apbct->data['key_is_ok'] = false;
|
1110 |
}
|
1111 |
|
1112 |
-
//
|
|
|
|
|
|
|
1113 |
}else{
|
1114 |
$apbct->data['key_is_ok'] = false;
|
1115 |
-
|
1116 |
-
$apbct->error_delete('key_invalid account_check', 'save');
|
1117 |
-
}else
|
1118 |
-
$apbct->error_add('key_invalid', __('Key is not correct', 'cleantalk'));
|
1119 |
}
|
1120 |
|
|
|
|
|
|
|
|
|
|
|
1121 |
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1122 |
|
1123 |
// Notices
|
341 |
'comment_notify__roles' => array(
|
342 |
'callback' => 'apbct_settings__field__comment_notify',
|
343 |
),
|
344 |
+
'complete_deactivation' => array(
|
345 |
+
'type' => 'checkbox',
|
346 |
+
'title' => __('Complete deactivation', 'cleantalk'),
|
347 |
+
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
348 |
+
),
|
349 |
|
350 |
),
|
351 |
),
|
596 |
|
597 |
function apbct_settings__field__state(){
|
598 |
|
599 |
+
global $apbct;
|
600 |
|
601 |
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
602 |
|
632 |
print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
|
633 |
|
634 |
print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
|
635 |
+
|
636 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['registrations_test'] == 1 ? $img : $img_no).'"/>'.__('Registration forms', 'cleantalk');
|
637 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
|
638 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
|
639 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
|
640 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
|
641 |
+
.'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
|
642 |
+
|
643 |
+
// Autoupdate status
|
644 |
+
if($apbct->notice_auto_update){
|
645 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
|
646 |
+
.' <sup><a href="http://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
|
647 |
+
}
|
648 |
+
|
649 |
+
// WooCommerce
|
650 |
+
if(class_exists('WooCommerce'))
|
651 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
|
|
|
|
|
|
|
|
|
|
|
652 |
if($apbct->moderate_ip)
|
653 |
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
|
654 |
|
1071 |
// Key is good by default
|
1072 |
$apbct->data['key_is_ok'] = true;
|
1073 |
|
1074 |
+
// Check account status and validate key. Even if it's not correct because of IP license.
|
1075 |
+
$result = ct_account_status_check($settings['apikey']);
|
1076 |
+
|
1077 |
+
// Is key valid?
|
1078 |
+
if($result){
|
1079 |
|
1080 |
+
// Deleting errors about invalid key
|
1081 |
+
$apbct->error_delete('key_invalid key_get', 'save');
|
1082 |
|
1083 |
+
// SFW actions
|
1084 |
+
if($apbct->settings['spam_firewall'] == 1){
|
1085 |
+
ct_sfw_update($settings['apikey']);
|
1086 |
+
ct_sfw_send_logs($settings['apikey']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1087 |
}
|
1088 |
|
1089 |
+
// Updating brief data for dashboard widget
|
1090 |
+
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1091 |
+
|
1092 |
+
// Key is not valid
|
1093 |
}else{
|
1094 |
$apbct->data['key_is_ok'] = false;
|
1095 |
+
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
|
|
|
|
|
|
1096 |
}
|
1097 |
|
1098 |
+
// Deleting legacy
|
1099 |
+
if(isset($apbct->data['testing_failed']))
|
1100 |
+
unset($apbct->data['testing_failed']);
|
1101 |
+
|
1102 |
+
|
1103 |
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1104 |
|
1105 |
// Notices
|
lib/CleantalkBase/CleantalkAPI.php
CHANGED
@@ -732,20 +732,20 @@ if(!class_exists('CleantalkBase\CleantalkAPI'))
|
|
732 |
|
733 |
// notice_paid_till
|
734 |
case 'notice_paid_till':
|
735 |
-
if(
|
736 |
-
(isset($result['error_no']) && $result['error_no'] == 12) ||
|
737 |
-
(empty($result['error']) && empty($result['data']['service_id'])) ||
|
738 |
-
(empty($result['error']) && isset($result['data']['service_id']) && !is_int($result['data']['service_id']))
|
739 |
-
){
|
740 |
-
$out = array(
|
741 |
-
'valid' => 0,
|
742 |
-
);
|
743 |
-
}else{
|
744 |
-
$out = $result['data'];
|
745 |
-
$out['valid'] = 1;
|
746 |
-
}
|
747 |
|
748 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
749 |
|
750 |
break;
|
751 |
|
732 |
|
733 |
// notice_paid_till
|
734 |
case 'notice_paid_till':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
|
736 |
+
$result = isset($result['data']) ? $result['data'] : $result;
|
737 |
+
|
738 |
+
if((isset($result['error_no']) && $result['error_no'] == 12) ||
|
739 |
+
(
|
740 |
+
!(isset($result['service_id']) && is_int($result['service_id'])) &&
|
741 |
+
empty($result['moderate_ip'])
|
742 |
+
)
|
743 |
+
)
|
744 |
+
$result['valid'] = 0;
|
745 |
+
else
|
746 |
+
$result['valid'] = 1;
|
747 |
+
|
748 |
+
return $result;
|
749 |
|
750 |
break;
|
751 |
|
lib/CleantalkBase/CleantalkSFW.php
CHANGED
@@ -28,9 +28,31 @@ class CleantalkSFW
|
|
28 |
public $pass = true;
|
29 |
|
30 |
public $test = false;
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
public $all_ips = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
public $passed_ips = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public $blocked_ips = array();
|
35 |
|
36 |
// Database
|
28 |
public $pass = true;
|
29 |
|
30 |
public $test = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array of arrays array(origin => array(
|
34 |
+
'ip' => '192.168.0.1',
|
35 |
+
'network' => '192.168.0.0',
|
36 |
+
'mask' => '24',
|
37 |
+
'status' => -1 (blocked) | 1 (passed)
|
38 |
+
)
|
39 |
+
*/
|
40 |
public $all_ips = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var array of arrays array(origin => array(
|
44 |
+
'ip' => '192.168.0.1',
|
45 |
+
)
|
46 |
+
*/
|
47 |
public $passed_ips = array();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var array of arrays array(origin => array(
|
51 |
+
'ip' => '192.168.0.1',
|
52 |
+
'network' => '192.168.0.0',
|
53 |
+
'mask' => '24',
|
54 |
+
)
|
55 |
+
*/
|
56 |
public $blocked_ips = array();
|
57 |
|
58 |
// Database
|
lib/CleantalkSFW.php
CHANGED
@@ -4,18 +4,16 @@
|
|
4 |
* CleanTalk SpamFireWall Wordpress class
|
5 |
* Compatible only with Wordpress.
|
6 |
*
|
7 |
-
* @depends
|
8 |
*
|
9 |
-
* @version
|
10 |
-
* @author
|
11 |
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
12 |
-
* @license
|
13 |
-
* @see
|
14 |
-
*/
|
15 |
-
|
16 |
class CleantalkSFW extends CleantalkBase\CleantalkSFW
|
17 |
{
|
18 |
-
|
19 |
/**
|
20 |
* CleantalkSFW_Base constructor.
|
21 |
* Creates Database driver instance.
|
@@ -48,8 +46,9 @@ class CleantalkSFW extends CleantalkBase\CleantalkSFW
|
|
48 |
|
49 |
// Statistics
|
50 |
if(!empty($this->blocked_ips)){
|
|
|
51 |
$apbct->stats['last_sfw_block']['time'] = time();
|
52 |
-
$apbct->stats['last_sfw_block']['ip'] =
|
53 |
$apbct->save('stats');
|
54 |
}
|
55 |
|
@@ -91,7 +90,7 @@ class CleantalkSFW extends CleantalkBase\CleantalkSFW
|
|
91 |
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', '', $sfw_die_page);
|
92 |
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', '', $sfw_die_page);
|
93 |
}
|
94 |
-
|
95 |
$sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ips ? $this->blocked_ips[key($this->blocked_ips)]['ip'] : '', $sfw_die_page);
|
96 |
|
97 |
// Service info
|
4 |
* CleanTalk SpamFireWall Wordpress class
|
5 |
* Compatible only with Wordpress.
|
6 |
*
|
7 |
+
* @depends CleantalkBase\CleantalkSFW
|
8 |
*
|
9 |
+
* @version 3.3
|
10 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
11 |
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
12 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
13 |
+
* @see https://github.com/CleanTalk/wordpress-antispam
|
14 |
+
*/
|
|
|
15 |
class CleantalkSFW extends CleantalkBase\CleantalkSFW
|
16 |
{
|
|
|
17 |
/**
|
18 |
* CleantalkSFW_Base constructor.
|
19 |
* Creates Database driver instance.
|
46 |
|
47 |
// Statistics
|
48 |
if(!empty($this->blocked_ips)){
|
49 |
+
reset($this->blocked_ips);
|
50 |
$apbct->stats['last_sfw_block']['time'] = time();
|
51 |
+
$apbct->stats['last_sfw_block']['ip'] = $this->blocked_ips[key($this->blocked_ips)]['ip'];
|
52 |
$apbct->save('stats');
|
53 |
}
|
54 |
|
90 |
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', '', $sfw_die_page);
|
91 |
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', '', $sfw_die_page);
|
92 |
}
|
93 |
+
|
94 |
$sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ips ? $this->blocked_ips[key($this->blocked_ips)]['ip'] : '', $sfw_die_page);
|
95 |
|
96 |
// Service info
|
lib/CleantalkSFW_Base.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Patch to use CleantalkBase/CleantalkSFW as CleantalkSFW_Base
|
5 |
+
*
|
6 |
+
* @since 5.124.2
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Base classes
|
11 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkAPI.php'); // API
|
12 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkDB.php'); // Database driver
|
13 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkBase/CleantalkHelper.php'); // Helper
|
14 |
+
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkBase/CleantalkSFW.php"); // SpamFireWall
|
15 |
+
|
16 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB.php'); // Database class for Wordpress
|
17 |
+
|
lib/CleantalkState.php
CHANGED
@@ -95,6 +95,7 @@ class CleantalkState
|
|
95 |
'store_urls__sessions' => 1,
|
96 |
'comment_notify' => 1,
|
97 |
'comment_notify__roles' => array('administrator'),
|
|
|
98 |
);
|
99 |
|
100 |
public $def_data = array(
|
95 |
'store_urls__sessions' => 1,
|
96 |
'comment_notify' => 1,
|
97 |
'comment_notify__roles' => array('administrator'),
|
98 |
+
'complete_deactivation' => 0,
|
99 |
);
|
100 |
|
101 |
public $def_data = array(
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
|
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
@@ -56,7 +56,7 @@ Native spam protection for WordPress, JetPack comments and any other comment plu
|
|
56 |
Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
|
57 |
|
58 |
= Protection from contact form spam =
|
59 |
-
The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin, WPForms Lite, Custom Contact, Forms, Amo Forms, Caldera Forms, Visual Form Builder, Contact Form Clean and Simple, Divi by Elegant Themes, The7 theme and any other themes or custom contact forms, amoForms, Custom Contact Form, Ultimate Form Builder, Contact Bank - Contact Forms Builder, Forms easily built with Smart Forms, Quick Contact Form, Usernoise contact form, cformsII - contact form, Contact Form by Web-Settler, HubSpot Marketing Free.
|
60 |
|
61 |
= WooCommerce spam filter =
|
62 |
Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
|
@@ -575,6 +575,14 @@ If your website has forms that send data to external sources, you can enable opt
|
|
575 |
10. Website's options.
|
576 |
|
577 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
= 5.124.1 August 8 2019 =
|
579 |
* Fix: Error on PHP 5.3.
|
580 |
|
@@ -1969,6 +1977,14 @@ If your website has forms that send data to external sources, you can enable opt
|
|
1969 |
* First version
|
1970 |
|
1971 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1972 |
= 5.124.1 August 8 2019 =
|
1973 |
* Fix: Error on PHP 5.3.
|
1974 |
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 5.125
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
56 |
Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
|
57 |
|
58 |
= Protection from contact form spam =
|
59 |
+
The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin, WPForms Lite, Custom Contact, Forms, Amo Forms, Caldera Forms, Visual Form Builder, Contact Form Clean and Simple, Divi by Elegant Themes, The7 theme and any other themes or custom contact forms, amoForms, Custom Contact Form, Ultimate Form Builder, Contact Bank - Contact Forms Builder, Forms easily built with Smart Forms, Quick Contact Form, Usernoise contact form, cformsII - contact form, Contact Form by Web-Settler, HubSpot Marketing Free, QuForm.
|
60 |
|
61 |
= WooCommerce spam filter =
|
62 |
Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
|
575 |
10. Website's options.
|
576 |
|
577 |
== Changelog ==
|
578 |
+
= 5.125 August 26 2019 =
|
579 |
+
* Fix: PHP Notices.
|
580 |
+
* Fix: Auto update.
|
581 |
+
* Fix: Displaying protection status for IP license.
|
582 |
+
* Fix: prevent capturing buffer for XMLRPC requests (check_external functionality).
|
583 |
+
* Fix: API key validating.
|
584 |
+
* New: Complete deactivation setting.
|
585 |
+
|
586 |
= 5.124.1 August 8 2019 =
|
587 |
* Fix: Error on PHP 5.3.
|
588 |
|
1977 |
* First version
|
1978 |
|
1979 |
== Upgrade Notice ==
|
1980 |
+
= 5.125 August 26 2019 =
|
1981 |
+
* Fix: PHP Notices.
|
1982 |
+
* Fix: Auto update.
|
1983 |
+
* Fix: Displaying protection status for IP license.
|
1984 |
+
* Fix: prevent capturing buffer for XMLRPC requests (check_external functionality).
|
1985 |
+
* Fix: API key validating.
|
1986 |
+
* New: Complete deactivation setting.
|
1987 |
+
|
1988 |
= 5.124.1 August 8 2019 =
|
1989 |
* Fix: Error on PHP 5.3.
|
1990 |
|