Version Description
March 27 2019 = * New: Update logic runs on all pages. * New: Integration for Ajax Contact Forms plugin. * New: Notification for users groups about new comments. * New: SFW die page. Show browser and page creation time. * Fix: Huge bug in Cleantalk.php connected with servers changing. * Fix: Check AJAX requests for logged in users. * Fix: Deleting debug in JS. * Fix: Validating settings before saving.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.117 |
Comparing to | |
See all releases |
Code changes from version 5.116.3 to 5.117
- cleantalk.php +101 -20
- inc/cleantalk-admin.php +0 -18
- inc/cleantalk-common.php +22 -7
- inc/cleantalk-public.php +69 -4
- inc/cleantalk-settings.php +45 -4
- inc/cleantalk-users.php +22 -19
- inc/sfw_die_page.html +6 -2
- js/apbct-public.js +0 -3
- lib/Cleantalk.php +5 -3
- lib/CleantalkAPI.php +10 -6
- lib/CleantalkHelper.php +48 -22
- lib/CleantalkSFW.php +1 -3
- lib/CleantalkSFW_Base.php +73 -23
- lib/CleantalkState.php +7 -2
- readme.txt +21 -1
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 |
*/
|
@@ -83,6 +83,9 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
83 |
|
84 |
}
|
85 |
|
|
|
|
|
|
|
86 |
// Passing JS key to frontend
|
87 |
add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
88 |
add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
@@ -244,7 +247,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
244 |
// Check AJAX requests
|
245 |
// if User is not logged in
|
246 |
// if Unknown action or Known action with mandatory check
|
247 |
-
if(
|
248 |
isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
|
249 |
){
|
250 |
ct_ajax_hook();
|
@@ -362,26 +365,48 @@ function apbct_remote_call__perform()
|
|
362 |
// Flag to let plugin know that Remote Call is running.
|
363 |
$apbct->rc_running = true;
|
364 |
|
|
|
|
|
365 |
// Close renew banner
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
|
|
|
|
372 |
// SFW update
|
373 |
-
|
374 |
-
|
375 |
-
|
|
|
|
|
376 |
// SFW send logs
|
377 |
-
|
378 |
-
|
379 |
-
|
|
|
|
|
380 |
// Update plugin
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
}else
|
386 |
die('FAIL '.json_encode(array('error' => 'WRONG_TOKEN')));
|
387 |
}else
|
@@ -671,7 +696,7 @@ function ct_get_cookie()
|
|
671 |
die();
|
672 |
}
|
673 |
|
674 |
-
function ct_sfw_update(){
|
675 |
|
676 |
global $apbct;
|
677 |
|
@@ -681,7 +706,9 @@ function ct_sfw_update(){
|
|
681 |
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php");
|
682 |
|
683 |
$sfw = new CleantalkSFW();
|
684 |
-
|
|
|
|
|
685 |
unset($sfw);
|
686 |
return $result;
|
687 |
}
|
@@ -773,6 +800,26 @@ function apbct_update(){
|
|
773 |
}
|
774 |
}
|
775 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
function cleantalk_get_brief_data(){
|
777 |
|
778 |
global $apbct;
|
@@ -1190,4 +1237,38 @@ function apbct_is_ajax() {
|
|
1190 |
(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || // by Request type
|
1191 |
!empty($_POST['quform_ajax']); // special. QForms
|
1192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1193 |
}
|
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.117
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
83 |
|
84 |
}
|
85 |
|
86 |
+
// Do update actions if version is changed
|
87 |
+
apbct_update_actions();
|
88 |
+
|
89 |
// Passing JS key to frontend
|
90 |
add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
91 |
add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
247 |
// Check AJAX requests
|
248 |
// if User is not logged in
|
249 |
// if Unknown action or Known action with mandatory check
|
250 |
+
if( (!apbct_is_user_logged_in() || $apbct->settings['protect_logged_in'] == 1) &&
|
251 |
isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
|
252 |
){
|
253 |
ct_ajax_hook();
|
365 |
// Flag to let plugin know that Remote Call is running.
|
366 |
$apbct->rc_running = true;
|
367 |
|
368 |
+
switch ($_GET['spbc_remote_call_action']) {
|
369 |
+
|
370 |
// Close renew banner
|
371 |
+
case 'close_renew_banner':
|
372 |
+
$apbct->data['notice_trial'] = 0;
|
373 |
+
$apbct->data['notice_renew'] = 0;
|
374 |
+
$apbct->saveData();
|
375 |
+
CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
|
376 |
+
die('OK');
|
377 |
+
break;
|
378 |
+
|
379 |
// SFW update
|
380 |
+
case 'sfw_update':
|
381 |
+
$result = ct_sfw_update(true);
|
382 |
+
die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error_string'])));
|
383 |
+
break;
|
384 |
+
|
385 |
// SFW send logs
|
386 |
+
case 'sfw_send_logs':
|
387 |
+
$rc_result = ct_sfw_send_logs();
|
388 |
+
die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error_string'])));
|
389 |
+
break;
|
390 |
+
|
391 |
// Update plugin
|
392 |
+
case 'update_plugin':
|
393 |
+
add_action('wp', 'apbct_update', 1);
|
394 |
+
break;
|
395 |
+
|
396 |
+
// Update settins
|
397 |
+
case 'update_settings':
|
398 |
+
$result = apbct_rc__update_settings($_GET);
|
399 |
+
die(empty($result['error'])
|
400 |
+
? 'OK'
|
401 |
+
: 'FAIL '.json_encode(array('error' => $result['error_string'])));
|
402 |
+
break;
|
403 |
+
|
404 |
+
// No action found
|
405 |
+
default:
|
406 |
+
die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION_2')));
|
407 |
+
break;
|
408 |
+
}
|
409 |
+
|
410 |
}else
|
411 |
die('FAIL '.json_encode(array('error' => 'WRONG_TOKEN')));
|
412 |
}else
|
696 |
die();
|
697 |
}
|
698 |
|
699 |
+
function ct_sfw_update($immediate = false){
|
700 |
|
701 |
global $apbct;
|
702 |
|
706 |
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php");
|
707 |
|
708 |
$sfw = new CleantalkSFW();
|
709 |
+
|
710 |
+
$file_url = isset($_GET['file_url']) ? $_GET['file_url'] : null;
|
711 |
+
$result = $sfw->sfw_update($apbct->api_key, $file_url, $immediate);
|
712 |
unset($sfw);
|
713 |
return $result;
|
714 |
}
|
800 |
}
|
801 |
}
|
802 |
|
803 |
+
function apbct_rc__update_settings($source) {
|
804 |
+
|
805 |
+
global $apbct;
|
806 |
+
|
807 |
+
foreach($apbct->def_settings as $setting => $def_value){
|
808 |
+
if(array_key_exists($setting, $source)){
|
809 |
+
$var = $source[$setting];
|
810 |
+
$type = gettype($def_value);
|
811 |
+
settype($var, $type);
|
812 |
+
if($type == 'string')
|
813 |
+
$var = preg_replace(array('/=/', '/`/'), '', $var);
|
814 |
+
$apbct->settings[$setting] = $var;
|
815 |
+
}
|
816 |
+
}
|
817 |
+
|
818 |
+
$apbct->save('settings');
|
819 |
+
|
820 |
+
return true;
|
821 |
+
}
|
822 |
+
|
823 |
function cleantalk_get_brief_data(){
|
824 |
|
825 |
global $apbct;
|
1237 |
(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || // by Request type
|
1238 |
!empty($_POST['quform_ajax']); // special. QForms
|
1239 |
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
/**
|
1243 |
+
* Runs update actions for new version.
|
1244 |
+
*
|
1245 |
+
* @global type $apbct
|
1246 |
+
*/
|
1247 |
+
function apbct_update_actions(){
|
1248 |
+
|
1249 |
+
global $apbct;
|
1250 |
+
|
1251 |
+
// Update logic
|
1252 |
+
if($apbct->plugin_version != APBCT_VERSION){
|
1253 |
+
|
1254 |
+
// Main blog
|
1255 |
+
if(is_main_site()){
|
1256 |
+
|
1257 |
+
require_once(CLEANTALK_PLUGIN_DIR.'inc/cleantalk-updater.php');
|
1258 |
+
|
1259 |
+
$result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
|
1260 |
+
//If update is successfull
|
1261 |
+
if($result === true){
|
1262 |
+
$apbct->data['plugin_version'] = APBCT_VERSION;
|
1263 |
+
$apbct->saveData();
|
1264 |
+
}
|
1265 |
+
ct_send_feedback('0:' . CLEANTALK_AGENT ); // Send feedback to let cloud know about updated version.
|
1266 |
+
|
1267 |
+
// Side blogs
|
1268 |
+
}else{
|
1269 |
+
$apbct->data['plugin_version'] = APBCT_VERSION;
|
1270 |
+
$apbct->saveData();
|
1271 |
+
}
|
1272 |
+
}
|
1273 |
+
|
1274 |
}
|
inc/cleantalk-admin.php
CHANGED
@@ -133,24 +133,6 @@ function apbct_admin__init(){
|
|
133 |
|
134 |
global $apbct;
|
135 |
|
136 |
-
// Update logic
|
137 |
-
if($apbct->plugin_version != APBCT_VERSION){
|
138 |
-
if(is_main_site()){
|
139 |
-
require_once('cleantalk-updater.php');
|
140 |
-
$result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
|
141 |
-
ct_send_feedback('0:' . CLEANTALK_AGENT ); // Send feedback to let cloud know about updated version.
|
142 |
-
//If update is successfull
|
143 |
-
if($result === true){
|
144 |
-
$apbct->data['plugin_version'] = APBCT_VERSION;
|
145 |
-
$apbct->saveData();
|
146 |
-
}
|
147 |
-
// Update version for side blogs
|
148 |
-
}else{
|
149 |
-
$apbct->data['plugin_version'] = APBCT_VERSION;
|
150 |
-
$apbct->saveData();
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
// Getting dashboard widget statistics
|
155 |
if(!empty($_POST['ct_brief_refresh'])){
|
156 |
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
|
133 |
|
134 |
global $apbct;
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
// Getting dashboard widget statistics
|
137 |
if(!empty($_POST['ct_brief_refresh'])){
|
138 |
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
|
inc/cleantalk-common.php
CHANGED
@@ -108,7 +108,7 @@ function apbct_base_call($params = array(), $reg_flag = false){
|
|
108 |
$ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
|
109 |
$ct->ssl_on = $apbct->settings['ssl_on'];
|
110 |
$ct->ssl_path = APBCT_CASERT_PATH;
|
111 |
-
$ct->server_url = $
|
112 |
$ct->server_ttl = $config['ct_server_ttl'];
|
113 |
// Options store url without shceme because of DB error with ''://'
|
114 |
$ct->work_url = preg_match('/http/', $config['ct_work_url']) ? $config['ct_work_url'] : 'http://'.$config['ct_work_url'];
|
@@ -538,18 +538,33 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
|
|
538 |
if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
|
539 |
$contact = false;
|
540 |
} unset($value);
|
541 |
-
|
542 |
if(count($arr)){
|
|
|
543 |
foreach($arr as $key => $value){
|
544 |
-
|
545 |
-
if(gettype($value)=='string'){
|
|
|
546 |
$tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
|
547 |
$decoded_json_value = json_decode($tmp, true);
|
548 |
-
|
|
|
|
|
549 |
$value = $decoded_json_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
}
|
551 |
-
|
552 |
-
if(!is_array($value) && !is_object($value) && @get_class($value)!='WP_User'){
|
553 |
|
554 |
if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
|
555 |
$contact = false;
|
108 |
$ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
|
109 |
$ct->ssl_on = $apbct->settings['ssl_on'];
|
110 |
$ct->ssl_path = APBCT_CASERT_PATH;
|
111 |
+
$ct->server_url = $config['ct_work_url'];
|
112 |
$ct->server_ttl = $config['ct_server_ttl'];
|
113 |
// Options store url without shceme because of DB error with ''://'
|
114 |
$ct->work_url = preg_match('/http/', $config['ct_work_url']) ? $config['ct_work_url'] : 'http://'.$config['ct_work_url'];
|
538 |
if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
|
539 |
$contact = false;
|
540 |
} unset($value);
|
541 |
+
|
542 |
if(count($arr)){
|
543 |
+
|
544 |
foreach($arr as $key => $value){
|
545 |
+
|
546 |
+
if(gettype($value) == 'string'){
|
547 |
+
|
548 |
$tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
|
549 |
$decoded_json_value = json_decode($tmp, true);
|
550 |
+
|
551 |
+
// Decoding JSON
|
552 |
+
if($decoded_json_value !== null){
|
553 |
$value = $decoded_json_value;
|
554 |
+
|
555 |
+
// Ajax Contact Forms. Get data from such strings:
|
556 |
+
// acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
|
557 |
+
// acfw30_textarea %% msg
|
558 |
+
}elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
|
559 |
+
$value = explode('~', $value);
|
560 |
+
foreach ($value as &$val){
|
561 |
+
$tmp = explode(' %% ', $val);
|
562 |
+
$val = array($tmp[0] => $tmp[1]);
|
563 |
+
}
|
564 |
+
}
|
565 |
}
|
566 |
+
|
567 |
+
if(!is_array($value) && !is_object($value) && @get_class($value) != 'WP_User'){
|
568 |
|
569 |
if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
|
570 |
$contact = false;
|
inc/cleantalk-public.php
CHANGED
@@ -743,9 +743,11 @@ function ct_frm_entries_footer_scripts($fields, $form) {
|
|
743 |
}
|
744 |
}";
|
745 |
|
|
|
746 |
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
747 |
$js_code = strip_tags($js_code); // Removing <script> tag
|
748 |
echo $js_code;
|
|
|
749 |
}
|
750 |
|
751 |
/**
|
@@ -931,10 +933,30 @@ function ct_preprocess_comment($comment) {
|
|
931 |
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
932 |
global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
|
933 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
// Skip processing admin.
|
935 |
if (in_array("administrator", $current_user->roles))
|
936 |
return $comment;
|
937 |
-
|
938 |
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
|
939 |
|
940 |
if($apbct->settings['check_comments_number']){
|
@@ -1096,7 +1118,7 @@ function ct_preprocess_comment($comment) {
|
|
1096 |
}
|
1097 |
|
1098 |
if($apbct->settings['remove_comments_links'] == 1){
|
1099 |
-
$comment = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment);
|
1100 |
}
|
1101 |
|
1102 |
// Change mail notification if license is out of date
|
@@ -1108,10 +1130,49 @@ function ct_preprocess_comment($comment) {
|
|
1108 |
add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
|
1109 |
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
|
1110 |
}
|
1111 |
-
|
1112 |
return $comment;
|
1113 |
}
|
1114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1115 |
/**
|
1116 |
* Changes email notification for spam comment for native Wordpress comment system
|
1117 |
*
|
@@ -2514,7 +2575,11 @@ function ct_contact_form_validate() {
|
|
2514 |
(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'?wc-api=WC_Gateway_Transferuj') !== false) || //WC Gateway
|
2515 |
(isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
|
2516 |
(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'lost-password') !== false) || //Skip lost-password form check
|
2517 |
-
(isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') // Skip mobile requests (push settings)
|
|
|
|
|
|
|
|
|
2518 |
) {
|
2519 |
return null;
|
2520 |
}
|
743 |
}
|
744 |
}";
|
745 |
|
746 |
+
/* Excessive cookie set
|
747 |
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
748 |
$js_code = strip_tags($js_code); // Removing <script> tag
|
749 |
echo $js_code;
|
750 |
+
//*/
|
751 |
}
|
752 |
|
753 |
/**
|
933 |
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
934 |
global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
|
935 |
|
936 |
+
// Send email notification for chosen groups of users
|
937 |
+
if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
|
938 |
+
|
939 |
+
add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
|
940 |
+
|
941 |
+
$users = get_users(array(
|
942 |
+
'role__in' => $apbct->settings['comment_notify__roles'],
|
943 |
+
'fileds' => array('user_email')
|
944 |
+
));
|
945 |
+
|
946 |
+
if($users){
|
947 |
+
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
|
948 |
+
add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
|
949 |
+
foreach($users as $user){
|
950 |
+
$emails[] = $user->user_email;
|
951 |
+
}
|
952 |
+
$apbct->comment_notification_recipients = json_encode($emails);
|
953 |
+
}
|
954 |
+
}
|
955 |
+
|
956 |
// Skip processing admin.
|
957 |
if (in_array("administrator", $current_user->roles))
|
958 |
return $comment;
|
959 |
+
|
960 |
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
|
961 |
|
962 |
if($apbct->settings['check_comments_number']){
|
1118 |
}
|
1119 |
|
1120 |
if($apbct->settings['remove_comments_links'] == 1){
|
1121 |
+
$comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
|
1122 |
}
|
1123 |
|
1124 |
// Change mail notification if license is out of date
|
1130 |
add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
|
1131 |
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
|
1132 |
}
|
1133 |
+
|
1134 |
return $comment;
|
1135 |
}
|
1136 |
|
1137 |
+
/**
|
1138 |
+
* Changes whether notify admin/athor or not.
|
1139 |
+
*
|
1140 |
+
* @param bool $maybe_notify notify flag
|
1141 |
+
* @param int $comment_ID Comment id
|
1142 |
+
* @return bool flag
|
1143 |
+
*/
|
1144 |
+
function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
|
1145 |
+
return true;
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
/**
|
1149 |
+
* Add notification setting link
|
1150 |
+
*
|
1151 |
+
* @param type $notify_message
|
1152 |
+
* @param type $comment_id
|
1153 |
+
* @return type
|
1154 |
+
*/
|
1155 |
+
function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
|
1156 |
+
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
1157 |
+
return $notify_message
|
1158 |
+
.PHP_EOL
|
1159 |
+
.'---'.PHP_EOL
|
1160 |
+
.'Manage notifications settings: http://'.$website.'/wp-admin/options-general.php?page=cleantalk';
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
/**
|
1164 |
+
* Change email notification recipients
|
1165 |
+
*
|
1166 |
+
* @global SpbcState $apbct
|
1167 |
+
* @param type $emails
|
1168 |
+
* @param type $comment_id
|
1169 |
+
* @return type
|
1170 |
+
*/
|
1171 |
+
function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
|
1172 |
+
global $apbct;
|
1173 |
+
return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
|
1174 |
+
}
|
1175 |
+
|
1176 |
/**
|
1177 |
* Changes email notification for spam comment for native Wordpress comment system
|
1178 |
*
|
2575 |
(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'?wc-api=WC_Gateway_Transferuj') !== false) || //WC Gateway
|
2576 |
(isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
|
2577 |
(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'lost-password') !== false) || //Skip lost-password form check
|
2578 |
+
(isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
|
2579 |
+
(strpos($_SERVER['REQUEST_URI'],'membership-login')!==false ) || // Skip login form
|
2580 |
+
(isset($_GET['cookie-state-change'])) || //skip GDPR plugin
|
2581 |
+
(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'MailChimp' && strpos($_SERVER['REQUEST_URI'], 'mc4wp-sync-api/webhook-listener') !== false) || // Mailchimp webhook skip
|
2582 |
+
(strpos($_SERVER['REQUEST_URI'],'researcher-log-in')!==false ) // Skip login form
|
2583 |
) {
|
2584 |
return null;
|
2585 |
}
|
inc/cleantalk-settings.php
CHANGED
@@ -301,6 +301,16 @@ function apbct_settings__add_page() {
|
|
301 |
'parent' => 'store_urls',
|
302 |
'class' => 'apbct_settings-field_wrapper--sub',
|
303 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
),
|
305 |
),
|
306 |
);
|
@@ -773,6 +783,32 @@ function apbct_settings__field__connection_reports() {
|
|
773 |
echo '</div>';
|
774 |
}
|
775 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
function apbct_settings__field__draw($params = array()){
|
777 |
|
778 |
global $apbct;
|
@@ -857,10 +893,15 @@ function apbct_settings__field__draw($params = array()){
|
|
857 |
function apbct_settings__validate($settings) {
|
858 |
|
859 |
global $apbct;
|
860 |
-
|
861 |
-
//
|
862 |
-
$
|
863 |
-
|
|
|
|
|
|
|
|
|
|
|
864 |
// validating API key
|
865 |
$settings['apikey'] = isset($settings['apikey']) ? trim($settings['apikey']) : '';
|
866 |
$settings['apikey'] = $apbct->white_label ? $apbct->settings['apikey'] : $settings['apikey'];
|
301 |
'parent' => 'store_urls',
|
302 |
'class' => 'apbct_settings-field_wrapper--sub',
|
303 |
),
|
304 |
+
'comment_notify' => array(
|
305 |
+
'type' => 'checkbox',
|
306 |
+
'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
|
307 |
+
'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
|
308 |
+
'childrens' => array('comment_notify__roles'),
|
309 |
+
),
|
310 |
+
'comment_notify__roles' => array(
|
311 |
+
'callback' => 'apbct_settings__field__comment_notify',
|
312 |
+
),
|
313 |
+
|
314 |
),
|
315 |
),
|
316 |
);
|
783 |
echo '</div>';
|
784 |
}
|
785 |
|
786 |
+
function apbct_settings__field__comment_notify() {
|
787 |
+
|
788 |
+
global $apbct, $wp_roles;
|
789 |
+
|
790 |
+
$wp_roles = new WP_Roles();
|
791 |
+
$roles = $wp_roles->get_names();
|
792 |
+
|
793 |
+
echo '<div class="apbct_settings-field_wrapper apbct_settings-field_wrapper--sub">';
|
794 |
+
|
795 |
+
echo '<select multiple="multiple" id="apbct_setting_comment_notify__roles" name="cleantalk_settings[comment_notify__roles][]"'
|
796 |
+
.(!$apbct->settings['comment_notify'] ? ' disabled="disabled"' : '')
|
797 |
+
.' size="'.(count($roles)-1).'"'
|
798 |
+
. '>';
|
799 |
+
|
800 |
+
foreach ($roles as $role){
|
801 |
+
if($role == 'Subscriber') continue;
|
802 |
+
echo '<option'
|
803 |
+
.(in_array($role, $apbct->settings['comment_notify__roles']) ? ' selected="selected"' : '')
|
804 |
+
. '>'.$role.'</option>';
|
805 |
+
}
|
806 |
+
|
807 |
+
echo '</select>';
|
808 |
+
|
809 |
+
echo '</div>';
|
810 |
+
}
|
811 |
+
|
812 |
function apbct_settings__field__draw($params = array()){
|
813 |
|
814 |
global $apbct;
|
893 |
function apbct_settings__validate($settings) {
|
894 |
|
895 |
global $apbct;
|
896 |
+
|
897 |
+
// Set missing settings.
|
898 |
+
foreach($apbct->def_settings as $setting => $value){
|
899 |
+
if(!isset($settings[$setting])){
|
900 |
+
$settings[$setting] = null;
|
901 |
+
settype($settings[$setting], gettype($value));
|
902 |
+
}
|
903 |
+
} unset($setting, $value);
|
904 |
+
|
905 |
// validating API key
|
906 |
$settings['apikey'] = isset($settings['apikey']) ? trim($settings['apikey']) : '';
|
907 |
$settings['apikey'] = $apbct->white_label ? $apbct->settings['apikey'] : $settings['apikey'];
|
inc/cleantalk-users.php
CHANGED
@@ -612,32 +612,35 @@ function ct_ajax_delete_checked_users()
|
|
612 |
die();
|
613 |
}
|
614 |
|
615 |
-
function ct_ajax_delete_all_users()
|
616 |
{
|
617 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
618 |
|
619 |
global $wpdb;
|
620 |
|
621 |
-
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", ARRAY_A);
|
622 |
-
$count_all = $r ? $r[0]->cnt : 0;
|
623 |
-
|
624 |
-
$args = array(
|
625 |
-
'meta_key' => 'ct_marked_as_spam',
|
626 |
-
'meta_value' => '1',
|
627 |
-
'fields' => array('ID'),
|
628 |
-
'number' => 50
|
629 |
-
);
|
630 |
-
$users = get_users($args);
|
631 |
|
632 |
-
|
633 |
-
foreach($users as $user){
|
634 |
-
wp_delete_user($user->ID);
|
635 |
-
usleep(5000);
|
636 |
-
}
|
637 |
-
}
|
638 |
|
639 |
-
|
640 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
641 |
}
|
642 |
|
643 |
function ct_ajax_clear_users()
|
612 |
die();
|
613 |
}
|
614 |
|
615 |
+
function ct_ajax_delete_all_users($count_all = 0)
|
616 |
{
|
617 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
618 |
|
619 |
global $wpdb;
|
620 |
|
621 |
+
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", ARRAY_A);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
|
623 |
+
if(!empty($r)){
|
|
|
|
|
|
|
|
|
|
|
624 |
|
625 |
+
$count_all = $r ? $r[0]->cnt : 0;
|
626 |
+
|
627 |
+
$args = array(
|
628 |
+
'meta_key' => 'ct_marked_as_spam',
|
629 |
+
'meta_value' => '1',
|
630 |
+
'fields' => array('ID'),
|
631 |
+
'number' => 50
|
632 |
+
);
|
633 |
+
$users = get_users($args);
|
634 |
+
|
635 |
+
if ($users){
|
636 |
+
foreach($users as $user){
|
637 |
+
wp_delete_user($user->ID);
|
638 |
+
usleep(5000);
|
639 |
+
}
|
640 |
+
}
|
641 |
+
}
|
642 |
+
|
643 |
+
die($count_all);
|
644 |
}
|
645 |
|
646 |
function ct_ajax_clear_users()
|
inc/sfw_die_page.html
CHANGED
@@ -23,6 +23,7 @@
|
|
23 |
</style>
|
24 |
<script>
|
25 |
var reload_timeout = 1000;
|
|
|
26 |
function set_spamFireWallCookie(cookie_name, cookie_value) {
|
27 |
document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/;{COOKIE_DOMAIN}';
|
28 |
return null;
|
@@ -46,7 +47,8 @@ function get_current_url() {
|
|
46 |
<h3>{SFW_DIE_CLICK_TO_PASS}</h3>
|
47 |
<a href='{REQUEST_URI}'><script>get_current_url();</script></a>
|
48 |
{GENERATED}
|
49 |
-
|
|
|
50 |
<p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
|
51 |
<br />
|
52 |
</div>
|
@@ -57,12 +59,14 @@ function get_current_url() {
|
|
57 |
<script type='text/javascript'>
|
58 |
document.getElementById('js_info').style.display = 'none';
|
59 |
document.getElementById('js_passed').style.display = 'block';
|
|
|
|
|
|
|
60 |
setTimeout(function(){
|
61 |
set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_pass_key','{SFW_COOKIE}');
|
62 |
set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_passed','1');
|
63 |
}, 50);
|
64 |
setTimeout(function(){
|
65 |
-
var ct_date = new Date;
|
66 |
window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
|
67 |
}, reload_timeout);
|
68 |
</script>
|
23 |
</style>
|
24 |
<script>
|
25 |
var reload_timeout = 1000;
|
26 |
+
var ct_date = new Date;
|
27 |
function set_spamFireWallCookie(cookie_name, cookie_value) {
|
28 |
document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/;{COOKIE_DOMAIN}';
|
29 |
return null;
|
47 |
<h3>{SFW_DIE_CLICK_TO_PASS}</h3>
|
48 |
<a href='{REQUEST_URI}'><script>get_current_url();</script></a>
|
49 |
{GENERATED}
|
50 |
+
<p>Browser time <span id='curr_date'></span></p>
|
51 |
+
<br />
|
52 |
<p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
|
53 |
<br />
|
54 |
</div>
|
59 |
<script type='text/javascript'>
|
60 |
document.getElementById('js_info').style.display = 'none';
|
61 |
document.getElementById('js_passed').style.display = 'block';
|
62 |
+
|
63 |
+
document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
|
64 |
+
|
65 |
setTimeout(function(){
|
66 |
set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_pass_key','{SFW_COOKIE}');
|
67 |
set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_passed','1');
|
68 |
}, 50);
|
69 |
setTimeout(function(){
|
|
|
70 |
window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
|
71 |
}, reload_timeout);
|
72 |
</script>
|
js/apbct-public.js
CHANGED
@@ -165,9 +165,6 @@ jQuery(document).ajaxComplete(function(event, xhr, settings) {
|
|
165 |
});
|
166 |
|
167 |
function apbct_js_keys__set_input_value(result, data, params, obj){
|
168 |
-
console.log(result);
|
169 |
-
console.log(data);
|
170 |
-
console.log(params);
|
171 |
if (document.getElementById(params.input_name) !== null) {
|
172 |
var ct_input_value = document.getElementById(params.input_name).value;
|
173 |
document.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);
|
165 |
});
|
166 |
|
167 |
function apbct_js_keys__set_input_value(result, data, params, obj){
|
|
|
|
|
|
|
168 |
if (document.getElementById(params.input_name) !== null) {
|
169 |
var ct_input_value = document.getElementById(params.input_name).value;
|
170 |
document.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);
|
lib/Cleantalk.php
CHANGED
@@ -191,8 +191,8 @@ class Cleantalk {
|
|
191 |
switch ($method) {
|
192 |
case 'check_message':
|
193 |
// Convert strings to UTF8
|
194 |
-
$request->message = CleantalkHelper::arrayToUTF8( $request->message, $this->data_codepage);
|
195 |
-
$request->example = CleantalkHelper::arrayToUTF8( $request->example, $this->data_codepage);
|
196 |
$request->sender_email = CleantalkHelper::stringToUTF8($request->sender_email, $this->data_codepage);
|
197 |
$request->sender_nickname = CleantalkHelper::stringToUTF8($request->sender_nickname, $this->data_codepage);
|
198 |
|
@@ -473,7 +473,9 @@ class Cleantalk {
|
|
473 |
{
|
474 |
if (!isset($host))
|
475 |
return null;
|
476 |
-
|
|
|
|
|
477 |
// Get DNS records about URL
|
478 |
if (function_exists('dns_get_record')) {
|
479 |
$records = dns_get_record($host, DNS_A);
|
191 |
switch ($method) {
|
192 |
case 'check_message':
|
193 |
// Convert strings to UTF8
|
194 |
+
$request->message = CleantalkHelper::arrayToUTF8( (array)$request->message, $this->data_codepage);
|
195 |
+
$request->example = CleantalkHelper::arrayToUTF8( (array)$request->example, $this->data_codepage);
|
196 |
$request->sender_email = CleantalkHelper::stringToUTF8($request->sender_email, $this->data_codepage);
|
197 |
$request->sender_nickname = CleantalkHelper::stringToUTF8($request->sender_nickname, $this->data_codepage);
|
198 |
|
473 |
{
|
474 |
if (!isset($host))
|
475 |
return null;
|
476 |
+
|
477 |
+
$servers = array();
|
478 |
+
|
479 |
// Get DNS records about URL
|
480 |
if (function_exists('dns_get_record')) {
|
481 |
$records = dns_get_record($host, DNS_A);
|
lib/CleantalkAPI.php
CHANGED
@@ -72,16 +72,20 @@ class CleantalkAPI
|
|
72 |
return $result;
|
73 |
}
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
81 |
|
82 |
$request = array(
|
83 |
'method_name' => '2s_blacklists_db',
|
84 |
'auth_key' => $api_key,
|
|
|
85 |
);
|
86 |
|
87 |
$result = self::send_request($request);
|
72 |
return $result;
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Wrapper for 2s_blacklists_db API method
|
77 |
+
*
|
78 |
+
* @param type $api_key
|
79 |
+
* @param type $out Data output type (JSON or file URL)
|
80 |
+
* @param type $do_check
|
81 |
+
* @returns mixed STRING || array('error' => true, 'error_string' => STRING)
|
82 |
+
*/
|
83 |
+
static public function method__get_2s_blacklists_db($api_key, $out = null, $do_check = true){
|
84 |
|
85 |
$request = array(
|
86 |
'method_name' => '2s_blacklists_db',
|
87 |
'auth_key' => $api_key,
|
88 |
+
'out' => $out,
|
89 |
);
|
90 |
|
91 |
$result = self::send_request($request);
|
lib/CleantalkHelper.php
CHANGED
@@ -169,22 +169,25 @@ class CleantalkHelper
|
|
169 |
|
170 |
$ch = curl_init();
|
171 |
|
172 |
-
//
|
173 |
-
$opts =
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
|
|
|
|
|
|
184 |
);
|
185 |
|
186 |
// Use presets
|
187 |
-
$presets = is_array($presets) ? $presets :
|
188 |
foreach($presets as $preset){
|
189 |
|
190 |
switch($preset){
|
@@ -221,23 +224,32 @@ class CleantalkHelper
|
|
221 |
} unset($preset);
|
222 |
|
223 |
curl_setopt_array($ch, $opts);
|
224 |
-
$result =
|
225 |
-
|
226 |
-
if
|
|
|
|
|
227 |
|
228 |
if($result){
|
229 |
-
|
230 |
-
if(in_array('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
curl_close($ch);
|
232 |
-
|
233 |
}else
|
234 |
-
$
|
235 |
}else
|
236 |
-
$
|
237 |
|
238 |
/** Fix for get_code preset */
|
239 |
if($presets && ($presets == 'get_code' || (is_array($presets) && in_array('get_code', $presets) ) )
|
240 |
-
&&
|
241 |
){
|
242 |
$headers = get_headers($url);
|
243 |
$out = (int)preg_replace('/.*(\d{3}).*/', '$1', $headers[0]);
|
@@ -303,6 +315,20 @@ class CleantalkHelper
|
|
303 |
return $array;
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
/**
|
307 |
* Function convert string to UTF8 and removes non UTF8 characters
|
308 |
* param string
|
169 |
|
170 |
$ch = curl_init();
|
171 |
|
172 |
+
// Merging OBLIGATORY options with GIVEN options
|
173 |
+
$opts = self::array_merge__save_numeric_keys(
|
174 |
+
array(
|
175 |
+
CURLOPT_URL => $url,
|
176 |
+
CURLOPT_RETURNTRANSFER => true,
|
177 |
+
CURLOPT_CONNECTTIMEOUT_MS => 3000,
|
178 |
+
CURLOPT_FORBID_REUSE => true,
|
179 |
+
CURLOPT_USERAGENT => 'APBCT('.(defined('CLEANTALK_AGENT') ? CLEANTALK_AGENT : 'UNKNOWN_AGENT').')',
|
180 |
+
CURLOPT_POST => true,
|
181 |
+
CURLOPT_POSTFIELDS => str_replace("&", "&", http_build_query($data)),
|
182 |
+
CURLOPT_SSL_VERIFYPEER => false,
|
183 |
+
CURLOPT_SSL_VERIFYHOST => 0,
|
184 |
+
CURLOPT_HTTPHEADER => array('Expect:'), // Fix for large data and old servers http://php.net/manual/ru/function.curl-setopt.php#82418
|
185 |
+
),
|
186 |
+
$opts
|
187 |
);
|
188 |
|
189 |
// Use presets
|
190 |
+
$presets = is_array($presets) ? $presets : explode(' ', $presets);
|
191 |
foreach($presets as $preset){
|
192 |
|
193 |
switch($preset){
|
224 |
} unset($preset);
|
225 |
|
226 |
curl_setopt_array($ch, $opts);
|
227 |
+
$result = curl_exec($ch);
|
228 |
+
|
229 |
+
// RETURN if async request
|
230 |
+
if(in_array('dont_wait_for_answer', $presets))
|
231 |
+
return true;
|
232 |
|
233 |
if($result){
|
234 |
+
|
235 |
+
if(!in_array('dont_split_to_array', $presets))
|
236 |
+
$result = explode(PHP_EOL, $result);
|
237 |
+
|
238 |
+
// Get code crossPHP method
|
239 |
+
if(in_array('get_code', $presets)){
|
240 |
+
$curl_info = curl_getinfo($ch);
|
241 |
+
$result = $curl_info['http_code'];
|
242 |
+
}
|
243 |
curl_close($ch);
|
244 |
+
$out = $result;
|
245 |
}else
|
246 |
+
$out = array('error' => true, 'error_string' => curl_error($ch));
|
247 |
}else
|
248 |
+
$out = array('error' => true, 'error_string' => 'CURL_NOT_INSTALLED');
|
249 |
|
250 |
/** Fix for get_code preset */
|
251 |
if($presets && ($presets == 'get_code' || (is_array($presets) && in_array('get_code', $presets) ) )
|
252 |
+
&& isset($out['error_string']) && $out['error_string'] == 'CURL_NOT_INSTALLED'
|
253 |
){
|
254 |
$headers = get_headers($url);
|
255 |
$out = (int)preg_replace('/.*(\d{3}).*/', '$1', $headers[0]);
|
315 |
return $array;
|
316 |
}
|
317 |
|
318 |
+
/**
|
319 |
+
* Merging arrays without reseting numeric keys
|
320 |
+
*
|
321 |
+
* @param array $arr1 One-dimentional array
|
322 |
+
* @param array $arr2 One-dimentional array
|
323 |
+
* @return array Merged array
|
324 |
+
*/
|
325 |
+
public static function array_merge__save_numeric_keys($arr1, $arr2){
|
326 |
+
foreach ($arr2 as $key => $val){
|
327 |
+
$arr1[$key] = $val;
|
328 |
+
}
|
329 |
+
return $arr1;
|
330 |
+
}
|
331 |
+
|
332 |
/**
|
333 |
* Function convert string to UTF8 and removes non UTF8 characters
|
334 |
* param string
|
lib/CleantalkSFW.php
CHANGED
@@ -60,10 +60,8 @@ class CleantalkSFW extends CleantalkSFW_Base
|
|
60 |
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
61 |
header('Pragma: no-cache');
|
62 |
header("HTTP/1.0 403 Forbidden");
|
63 |
-
$sfw_die_page = str_replace('{GENERATED}', "", $sfw_die_page);
|
64 |
-
}else{
|
65 |
-
$sfw_die_page = str_replace('{GENERATED}', "<h2 class='second'>The page was generated at ".date("D, d M Y H:i:s")."</h2>",$sfw_die_page);
|
66 |
}
|
|
|
67 |
|
68 |
wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
|
69 |
|
60 |
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
61 |
header('Pragma: no-cache');
|
62 |
header("HTTP/1.0 403 Forbidden");
|
|
|
|
|
|
|
63 |
}
|
64 |
+
$sfw_die_page = str_replace('{GENERATED}', "<p>The page was generated at ".date("D, d M Y H:i:s")."</p>",$sfw_die_page);
|
65 |
|
66 |
wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
|
67 |
|
lib/CleantalkSFW_Base.php
CHANGED
@@ -162,35 +162,85 @@ class CleantalkSFW_Base
|
|
162 |
*
|
163 |
* return mixed true || array('error' => true, 'error_string' => STRING)
|
164 |
*/
|
165 |
-
public function sfw_update($ct_key){
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
if(empty($result['error'])){
|
170 |
|
171 |
-
$
|
172 |
|
173 |
-
|
174 |
-
// foreach($result as &$value){
|
175 |
-
// $value[0] = preg_replace('/[^\d]*/', '', $value[0]);
|
176 |
-
// $value[1] = preg_replace('/[^\d]*/', '', $value[0]);
|
177 |
-
// $value[0] = empty($value[0]) ? 0 : $value[0];
|
178 |
-
// $value[1] = empty($value[1]) ? 0 : $value[1];
|
179 |
-
// } unset($value);
|
180 |
-
|
181 |
-
$query = "INSERT INTO ".$this->data_table." VALUES ";
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
|
196 |
/*
|
162 |
*
|
163 |
* return mixed true || array('error' => true, 'error_string' => STRING)
|
164 |
*/
|
165 |
+
public function sfw_update($ct_key, $file_url = null, $immediate = false){
|
166 |
|
167 |
+
// Getting remote file name
|
168 |
+
if(!$file_url){
|
|
|
169 |
|
170 |
+
$result = CleantalkAPI::method__get_2s_blacklists_db($ct_key, 'file');
|
171 |
|
172 |
+
if(empty($result['error'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
+
if( !empty($result['file_url']) ){
|
175 |
+
|
176 |
+
$file_url = $result['file_url'];
|
177 |
+
|
178 |
+
$pattenrs = array();
|
179 |
+
$pattenrs[] = 'get';
|
180 |
+
if(!$immediate) $pattenrs[] = 'dont_wait_for_answer';
|
181 |
+
|
182 |
+
return CleantalkHelper::http__request(
|
183 |
+
get_option('siteurl'),
|
184 |
+
array(
|
185 |
+
'spbc_remote_call_token' => md5($ct_key),
|
186 |
+
'spbc_remote_call_action' => 'sfw_update',
|
187 |
+
'plugin_name' => 'apbct',
|
188 |
+
'file_url' => $result['file_url'],
|
189 |
+
),
|
190 |
+
$pattenrs
|
191 |
+
);
|
192 |
+
|
193 |
+
}else
|
194 |
+
return array('error' => true, 'error_string' => 'BAD_RESPONSE');
|
195 |
+
}else
|
196 |
+
return $result;
|
197 |
+
}else{
|
198 |
|
199 |
+
sleep(3);
|
200 |
|
201 |
+
if(CleantalkHelper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
|
202 |
+
|
203 |
+
$this->db->query("DELETE FROM ".$this->data_table.";", true);
|
204 |
+
|
205 |
+
$gf = gzopen($file_url, 'rb');
|
206 |
+
|
207 |
+
if($gf){
|
208 |
+
|
209 |
+
for($count_result = 0; !gzeof($gf); ){
|
210 |
+
|
211 |
+
$query = "INSERT INTO ".$this->data_table." VALUES ";
|
212 |
+
|
213 |
+
for($i=0; APBCT_WRITE_LIMIT !== $i && !gzeof($gf); $i++, $count_result++){
|
214 |
+
|
215 |
+
$entry = trim(gzgets($gf, 1024));
|
216 |
+
|
217 |
+
if(empty($entry)) continue;
|
218 |
+
|
219 |
+
$entry = explode(',', $entry);
|
220 |
+
|
221 |
+
// Cast result to int
|
222 |
+
$ip = preg_replace('/[^\d]*/', '', $entry[0]);
|
223 |
+
$mask = preg_replace('/[^\d]*/', '', $entry[1]);
|
224 |
+
|
225 |
+
if(!$ip || !$mask) continue;
|
226 |
+
|
227 |
+
$query.="(". $ip .",". $mask ."),";
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
$query = substr($query, 0, -1).';';
|
232 |
+
$this->db->query($query, true);
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
gzclose($gf);
|
237 |
+
return $count_result;
|
238 |
+
|
239 |
+
}else
|
240 |
+
return array('error' => true, 'error_string' => 'ERROR_OPEN_GZ_FILE');
|
241 |
+
}else
|
242 |
+
return array('error' => true, 'error_string' => 'NO_REMOTE_FILE_FOUND');
|
243 |
+
}
|
244 |
}
|
245 |
|
246 |
/*
|
lib/CleantalkState.php
CHANGED
@@ -73,8 +73,10 @@ class CleantalkState
|
|
73 |
'gdpr_text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
|
74 |
|
75 |
// Msic
|
76 |
-
'store_urls'
|
77 |
-
'store_urls__sessions'
|
|
|
|
|
78 |
);
|
79 |
|
80 |
public $def_data = array(
|
@@ -169,6 +171,9 @@ class CleantalkState
|
|
169 |
'update_plugin' => array(
|
170 |
'last_call' => 0,
|
171 |
),
|
|
|
|
|
|
|
172 |
);
|
173 |
|
174 |
public function __construct($option_prefix, $options = array('settings'), $wpms = false)
|
73 |
'gdpr_text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
|
74 |
|
75 |
// Msic
|
76 |
+
'store_urls' => 1,
|
77 |
+
'store_urls__sessions' => 1,
|
78 |
+
'comment_notify' => 1,
|
79 |
+
'comment_notify__roles' => array('administrator'),
|
80 |
);
|
81 |
|
82 |
public $def_data = array(
|
171 |
'update_plugin' => array(
|
172 |
'last_call' => 0,
|
173 |
),
|
174 |
+
'update_settings' => array(
|
175 |
+
'last_call' => 0,
|
176 |
+
),
|
177 |
);
|
178 |
|
179 |
public function __construct($option_prefix, $options = array('settings'), $wpms = false)
|
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.1
|
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.
|
@@ -558,6 +558,16 @@ If your website has forms that send data to external sources, you can enable opt
|
|
558 |
10. Website's options.
|
559 |
|
560 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
= 5.116.3 March 14 2019 =
|
562 |
* Fix: "Headers already sent" error.
|
563 |
* Fix: Images paths.
|
@@ -1823,6 +1833,16 @@ If your website has forms that send data to external sources, you can enable opt
|
|
1823 |
* First version
|
1824 |
|
1825 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1826 |
= 5.116.3 March 14 2019 =
|
1827 |
* Fix: "Headers already sent" error.
|
1828 |
* Fix: Images paths.
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.1
|
6 |
+
Stable tag: 5.117
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
558 |
10. Website's options.
|
559 |
|
560 |
== Changelog ==
|
561 |
+
= 5.117 March 27 2019 =
|
562 |
+
* New: Update logic runs on all pages.
|
563 |
+
* New: Integration for Ajax Contact Forms plugin.
|
564 |
+
* New: Notification for users groups about new comments.
|
565 |
+
* New: SFW die page. Show browser and page creation time.
|
566 |
+
* Fix: Huge bug in Cleantalk.php connected with servers changing.
|
567 |
+
* Fix: Check AJAX requests for logged in users.
|
568 |
+
* Fix: Deleting debug in JS.
|
569 |
+
* Fix: Validating settings before saving.
|
570 |
+
|
571 |
= 5.116.3 March 14 2019 =
|
572 |
* Fix: "Headers already sent" error.
|
573 |
* Fix: Images paths.
|
1833 |
* First version
|
1834 |
|
1835 |
== Upgrade Notice ==
|
1836 |
+
= 5.117 March 27 2019 =
|
1837 |
+
* New: Update logic runs on all pages.
|
1838 |
+
* New: Integration for Ajax Contact Forms plugin.
|
1839 |
+
* New: Notification for users groups about new comments.
|
1840 |
+
* New: SFW die page. Show browser and page creation time.
|
1841 |
+
* Fix: Huge bug in Cleantalk.php connected with servers changing.
|
1842 |
+
* Fix: Check AJAX requests for logged in users.
|
1843 |
+
* Fix: Deleting debug in JS.
|
1844 |
+
* Fix: Validating settings before saving.
|
1845 |
+
|
1846 |
= 5.116.3 March 14 2019 =
|
1847 |
* Fix: "Headers already sent" error.
|
1848 |
* Fix: Images paths.
|