Version Description
October 30 2019 = * Upd: Localize updated. * Fix: Direct $_SERVER access replaced. * Integration: The 7 theme contact form. * Fix: Minor improvements and bug fixes. * Mod: Putting site in maintenance mode during plugin update.
Download this release
Release Info
Developer | glomberg |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.129 |
Comparing to | |
See all releases |
Code changes from version 5.128.1 to 5.129
- cleantalk.php +60 -19
- i18n/cleantalk-ru_RU.mo +0 -0
- i18n/cleantalk-ru_RU.po +610 -355
- i18n/cleantalk.pot +538 -320
- inc/cleantalk-ajax.php +725 -723
- inc/cleantalk-comments.php +725 -725
- inc/cleantalk-common.php +991 -978
- inc/cleantalk-pluggable.php +230 -228
- inc/cleantalk-public.php +3501 -3438
- inc/cleantalk-settings.php +1455 -1455
- inc/cleantalk-users.php +781 -781
- lib/Cleantalk/Antispam/Helper.php +692 -692
- lib/CleantalkSFW.php +141 -141
- readme.txt +10 -3
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
|
@@ -170,7 +170,7 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
|
170 |
}
|
171 |
|
172 |
// Ninja Forms. Making GET action to POST action
|
173 |
-
if(
|
174 |
$_POST['action']='ninja_forms_ajax_submit';
|
175 |
|
176 |
add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
@@ -185,6 +185,10 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
|
185 |
add_action( 'wp_ajax_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
186 |
add_action( 'wp_ajax_nopriv_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
187 |
|
|
|
|
|
|
|
|
|
188 |
// Public actions
|
189 |
if(!is_admin() && !apbct_is_ajax()){
|
190 |
|
@@ -200,8 +204,8 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
|
200 |
// SpamFireWall check
|
201 |
if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
|
202 |
$apbct->settings['spam_firewall'] == 1 &&
|
203 |
-
|
204 |
-
{
|
205 |
apbct_sfw__check();
|
206 |
}
|
207 |
|
@@ -231,8 +235,8 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
|
231 |
add_action('plugins_loaded', 'apbct_plugin_loaded' );
|
232 |
|
233 |
if( !empty($apbct->settings['use_ajax']) &&
|
234 |
-
stripos(
|
235 |
-
stripos(
|
236 |
{
|
237 |
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
238 |
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
@@ -329,7 +333,7 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
|
329 |
if($pagenow=='users.php')
|
330 |
add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
|
331 |
|
332 |
-
if($pagenow=='plugins.php' || (
|
333 |
|
334 |
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
335 |
add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
@@ -504,7 +508,7 @@ function apbct_sfw__check()
|
|
504 |
if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
|
505 |
$core_page_to_skip_check = array('/feed');
|
506 |
foreach (array_merge($cleantalk_url_exclusions, $core_page_to_skip_check) as $v) {
|
507 |
-
if (stripos(
|
508 |
return;
|
509 |
}
|
510 |
}
|
@@ -541,8 +545,8 @@ function apbct_sfw__check()
|
|
541 |
$spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
|
542 |
if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
|
543 |
$is_sfw_check = false;
|
544 |
-
setcookie ('spbc_firewall_pass_key', md5(
|
545 |
-
setcookie ('ct_sfw_pass_key', md5(
|
546 |
}
|
547 |
unset($spbc_settings, $spbc_key);
|
548 |
}
|
@@ -1141,28 +1145,37 @@ function apbct_rc__update(){
|
|
1141 |
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
|
1142 |
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
|
1143 |
|
|
|
|
|
1144 |
$upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
|
1145 |
$upgrader->upgrade($plugin);
|
1146 |
|
|
|
|
|
|
|
|
|
1147 |
// Changing response UP_TO_DATE to OK
|
1148 |
if($upgrader->apbct_result === 'UP_TO_DATE')
|
1149 |
$upgrader->apbct_result = 'OK';
|
1150 |
|
1151 |
if($upgrader->apbct_result === 'OK'){
|
1152 |
|
1153 |
-
$result
|
1154 |
-
|
1155 |
-
if(is_wp_error($result))
|
1156 |
die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
|
|
|
1157 |
|
1158 |
$httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
|
1159 |
|
1160 |
if( strpos($httpResponseCode, '200') === false ){
|
1161 |
|
|
|
|
|
1162 |
// Rollback
|
1163 |
$rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
|
1164 |
$rollback->rollback($plugin);
|
1165 |
|
|
|
|
|
1166 |
$response = array(
|
1167 |
'error' => 'BAD_HTTP_CODE',
|
1168 |
'http_code' => $httpResponseCode,
|
@@ -1249,7 +1262,7 @@ function apbct_rc__insert_auth_key($key, $plugin){
|
|
1249 |
|
1250 |
return 'OK';
|
1251 |
}else
|
1252 |
-
return array('error' =>
|
1253 |
}else
|
1254 |
return array('error' => $result);
|
1255 |
}else
|
@@ -1260,6 +1273,34 @@ function apbct_rc__insert_auth_key($key, $plugin){
|
|
1260 |
return array('error' => 'PLUGIN_SLUG_INCORRECT');
|
1261 |
}
|
1262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1263 |
function cleantalk_get_brief_data(){
|
1264 |
|
1265 |
global $apbct;
|
@@ -1436,12 +1477,12 @@ function apbct_cookie(){
|
|
1436 |
}
|
1437 |
|
1438 |
// Pervious referer
|
1439 |
-
if(
|
1440 |
$apbct->settings['set_cookies__sessions']
|
1441 |
-
? apbct_alt_session__save('apbct_prev_referer',
|
1442 |
-
: setcookie('apbct_prev_referer',
|
1443 |
$cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
|
1444 |
-
$cookie_test_value['check_value'] .=
|
1445 |
}
|
1446 |
|
1447 |
// Landing time
|
@@ -1615,7 +1656,7 @@ function ct_mail_send_connection_report() {
|
|
1615 |
if (($apbct->settings['send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || !empty($_GET['ct_send_connection_report']))
|
1616 |
{
|
1617 |
$to = "welcome@cleantalk.org" ;
|
1618 |
-
$subject = "Connection report for "
|
1619 |
$message = '
|
1620 |
<html>
|
1621 |
<head>
|
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.129
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
Text Domain: cleantalk
|
170 |
}
|
171 |
|
172 |
// Ninja Forms. Making GET action to POST action
|
173 |
+
if(stripos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'admin-ajax.php') !== false && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit')
|
174 |
$_POST['action']='ninja_forms_ajax_submit';
|
175 |
|
176 |
add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
185 |
add_action( 'wp_ajax_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
186 |
add_action( 'wp_ajax_nopriv_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
187 |
|
188 |
+
// The 7 theme contact form integration
|
189 |
+
add_action( 'wp_ajax_nopriv_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
|
190 |
+
add_action( 'wp_ajax_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
|
191 |
+
|
192 |
// Public actions
|
193 |
if(!is_admin() && !apbct_is_ajax()){
|
194 |
|
204 |
// SpamFireWall check
|
205 |
if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
|
206 |
$apbct->settings['spam_firewall'] == 1 &&
|
207 |
+
filter_input(INPUT_SERVER, 'REQUEST_METHOD') == 'GET'
|
208 |
+
){
|
209 |
apbct_sfw__check();
|
210 |
}
|
211 |
|
235 |
add_action('plugins_loaded', 'apbct_plugin_loaded' );
|
236 |
|
237 |
if( !empty($apbct->settings['use_ajax']) &&
|
238 |
+
stripos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'.xml')===false &&
|
239 |
+
stripos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'.xsl')===false)
|
240 |
{
|
241 |
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
242 |
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
333 |
if($pagenow=='users.php')
|
334 |
add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
|
335 |
|
336 |
+
if($pagenow=='plugins.php' || (strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'plugins.php') !== false)){
|
337 |
|
338 |
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
339 |
add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
508 |
if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
|
509 |
$core_page_to_skip_check = array('/feed');
|
510 |
foreach (array_merge($cleantalk_url_exclusions, $core_page_to_skip_check) as $v) {
|
511 |
+
if (stripos(filter_input(INPUT_SERVER, 'REQUEST_URI'), $v) !== false) {
|
512 |
return;
|
513 |
}
|
514 |
}
|
545 |
$spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
|
546 |
if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
|
547 |
$is_sfw_check = false;
|
548 |
+
setcookie ('spbc_firewall_pass_key', md5(filter_input(INPUT_SERVER, 'REMOTE_ADDR') . $spbc_key), time()+1200, '/');
|
549 |
+
setcookie ('ct_sfw_pass_key', md5(filter_input(INPUT_SERVER, 'REMOTE_ADDR') . $apbct->api_key), time()+1200, '/');
|
550 |
}
|
551 |
unset($spbc_settings, $spbc_key);
|
552 |
}
|
1145 |
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
|
1146 |
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
|
1147 |
|
1148 |
+
apbct_maintance_mode__enable( 30 );
|
1149 |
+
|
1150 |
$upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
|
1151 |
$upgrader->upgrade($plugin);
|
1152 |
|
1153 |
+
apbct_maintance_mode__disable();
|
1154 |
+
|
1155 |
+
$result = activate_plugins( $plugin );
|
1156 |
+
|
1157 |
// Changing response UP_TO_DATE to OK
|
1158 |
if($upgrader->apbct_result === 'UP_TO_DATE')
|
1159 |
$upgrader->apbct_result = 'OK';
|
1160 |
|
1161 |
if($upgrader->apbct_result === 'OK'){
|
1162 |
|
1163 |
+
if(is_wp_error($result)){
|
|
|
|
|
1164 |
die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
|
1165 |
+
}
|
1166 |
|
1167 |
$httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
|
1168 |
|
1169 |
if( strpos($httpResponseCode, '200') === false ){
|
1170 |
|
1171 |
+
apbct_maintance_mode__enable( 30 );
|
1172 |
+
|
1173 |
// Rollback
|
1174 |
$rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
|
1175 |
$rollback->rollback($plugin);
|
1176 |
|
1177 |
+
apbct_maintance_mode__disable();
|
1178 |
+
|
1179 |
$response = array(
|
1180 |
'error' => 'BAD_HTTP_CODE',
|
1181 |
'http_code' => $httpResponseCode,
|
1262 |
|
1263 |
return 'OK';
|
1264 |
}else
|
1265 |
+
return array('error' => 'KEY_IS_NOT_VALID');
|
1266 |
}else
|
1267 |
return array('error' => $result);
|
1268 |
}else
|
1273 |
return array('error' => 'PLUGIN_SLUG_INCORRECT');
|
1274 |
}
|
1275 |
|
1276 |
+
/**
|
1277 |
+
* Putting Wordpress to maintenance mode.
|
1278 |
+
* For given duration in seconds
|
1279 |
+
*
|
1280 |
+
* @param $duration
|
1281 |
+
*
|
1282 |
+
* @return bool
|
1283 |
+
*/
|
1284 |
+
function apbct_maintance_mode__enable( $duration ) {
|
1285 |
+
apbct_maintance_mode__disable();
|
1286 |
+
$content = "<?php\n\n"
|
1287 |
+
. '$upgrading = ' . (time() - ( 60 * 10 ) + $duration) . ';';
|
1288 |
+
|
1289 |
+
return (bool)file_put_contents( ABSPATH . '.maintenance', $content );
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
/**
|
1293 |
+
* Disabling maintenance mode by deleting .maintenance file.
|
1294 |
+
*
|
1295 |
+
* @return void
|
1296 |
+
*/
|
1297 |
+
function apbct_maintance_mode__disable() {
|
1298 |
+
$maintenance_file = ABSPATH . '.maintenance';
|
1299 |
+
if ( file_exists( $maintenance_file ) ) {
|
1300 |
+
unlink( $maintenance_file );
|
1301 |
+
}
|
1302 |
+
}
|
1303 |
+
|
1304 |
function cleantalk_get_brief_data(){
|
1305 |
|
1306 |
global $apbct;
|
1477 |
}
|
1478 |
|
1479 |
// Pervious referer
|
1480 |
+
if(filter_input(INPUT_SERVER, 'HTTP_REFERER')){
|
1481 |
$apbct->settings['set_cookies__sessions']
|
1482 |
+
? apbct_alt_session__save('apbct_prev_referer', filter_input(INPUT_SERVER, 'HTTP_REFERER'))
|
1483 |
+
: setcookie('apbct_prev_referer', filter_input(INPUT_SERVER, 'HTTP_REFERER'), 0, '/', $domain, false, true);
|
1484 |
$cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
|
1485 |
+
$cookie_test_value['check_value'] .= filter_input(INPUT_SERVER, 'HTTP_REFERER');
|
1486 |
}
|
1487 |
|
1488 |
// Landing time
|
1656 |
if (($apbct->settings['send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || !empty($_GET['ct_send_connection_report']))
|
1657 |
{
|
1658 |
$to = "welcome@cleantalk.org" ;
|
1659 |
+
$subject = "Connection report for ".filter_input(INPUT_SERVER, 'HTTP_HOST');
|
1660 |
$message = '
|
1661 |
<html>
|
1662 |
<head>
|
i18n/cleantalk-ru_RU.mo
CHANGED
Binary file
|
i18n/cleantalk-ru_RU.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
4 |
-
"POT-Creation-Date: 2019-
|
5 |
-
"PO-Revision-Date: 2019-
|
6 |
"Last-Translator: admin <ievlev@cleantalk.org>\n"
|
7 |
"Language-Team: Русский\n"
|
8 |
"Language: ru_RU\n"
|
@@ -21,52 +21,162 @@ msgstr ""
|
|
21 |
"X-Poedit-SearchPath-0: .\n"
|
22 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
23 |
"Report-Msgid-Bugs-To: \n"
|
24 |
-
"X-Loco-Version: 2.3.0; wp-5.2.
|
25 |
|
26 |
-
#: inc/cleantalk-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
#, php-format
|
28 |
msgid "%sRefresh%s"
|
29 |
msgstr "%sОбновить%s"
|
30 |
|
31 |
-
#: inc/cleantalk-admin.php:
|
32 |
#, php-format
|
33 |
msgid "%sConfigure%s"
|
34 |
msgstr "%sКонфигурация%s"
|
35 |
|
36 |
-
#: inc/cleantalk-admin.php:
|
37 |
msgid "7 days anti-spam stats"
|
38 |
msgstr "Статистика атак за 7 дней"
|
39 |
|
40 |
-
#: inc/cleantalk-admin.php:
|
41 |
msgid "Top 5 spam IPs blocked"
|
42 |
msgstr "Топ 5 cамых заблокированных IP"
|
43 |
|
44 |
-
#: inc/cleantalk-admin.php:
|
45 |
msgid "Get Access key to activate Anti-Spam protection!"
|
46 |
msgstr "Получите ключ доступа для активации спам защиты!"
|
47 |
|
48 |
-
#: inc/cleantalk-admin.php:
|
49 |
#, php-format
|
50 |
msgid "Something went wrong! Error: \"%s\"."
|
51 |
msgstr "Что-то пошло не так: Ошибка: \"%s\"."
|
52 |
|
53 |
-
#: inc/cleantalk-admin.php:
|
54 |
msgid "Please, visit your dashboard."
|
55 |
msgstr "Пожалуйста, посетите панель управления."
|
56 |
|
57 |
-
#: inc/cleantalk-admin.php:
|
58 |
msgid "IP"
|
59 |
msgstr "IP"
|
60 |
|
61 |
-
#: inc/cleantalk-admin.php:
|
62 |
msgid "Country"
|
63 |
msgstr "Страна"
|
64 |
|
65 |
-
#: inc/cleantalk-admin.php:
|
66 |
msgid "Block Count"
|
67 |
msgstr "Заблкирован раз"
|
68 |
|
69 |
-
#: inc/cleantalk-admin.php:
|
70 |
#, php-format
|
71 |
msgid ""
|
72 |
"This is the count from the %s's cloud and could be different to admin bar "
|
@@ -76,7 +186,7 @@ msgstr ""
|
|
76 |
"админ-баре."
|
77 |
|
78 |
#. %s: Number of spam messages
|
79 |
-
#: inc/cleantalk-admin.php:
|
80 |
#, php-format
|
81 |
msgid ""
|
82 |
"%s%s%s has blocked %s spam for all time. The statistics are automatically "
|
@@ -85,57 +195,57 @@ msgstr ""
|
|
85 |
"%s%s%s заблокировал %s спама за все время. Статистика автоматически "
|
86 |
"обновляется каждый 24 часа."
|
87 |
|
88 |
-
#: inc/cleantalk-admin.php:
|
89 |
#, php-format
|
90 |
msgid "Do you like CleanTalk? %sPost your feedback here%s."
|
91 |
msgstr "Вам понравился CleanTalk?%s Напишите свой отзыв здесь%s."
|
92 |
|
93 |
-
#: inc/cleantalk-admin.php:
|
94 |
msgid "Translate"
|
95 |
msgstr "Перевести"
|
96 |
|
97 |
-
#: inc/cleantalk-admin.php:
|
98 |
msgid "Start here"
|
99 |
msgstr "Начать здесь"
|
100 |
|
101 |
-
#: inc/cleantalk-admin.php:
|
102 |
msgid "FAQ"
|
103 |
msgstr "FAQ"
|
104 |
|
105 |
-
#: inc/cleantalk-admin.php:
|
106 |
-
#: inc/cleantalk-settings.php:
|
107 |
msgid "Support"
|
108 |
msgstr "Поддержка"
|
109 |
|
110 |
-
#: inc/cleantalk-admin.php:
|
111 |
msgid "Hosting AntiSpam"
|
112 |
msgstr "Hosting AntiSpam"
|
113 |
|
114 |
-
#: inc/cleantalk-admin.php:
|
115 |
msgid "Failed from timeout. Going to check comments again."
|
116 |
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
117 |
|
118 |
-
#: inc/cleantalk-admin.php:
|
119 |
msgid "Added"
|
120 |
msgstr "Добавлены"
|
121 |
|
122 |
-
#: inc/cleantalk-admin.php:
|
123 |
msgid "Deleted"
|
124 |
msgstr "Удалено"
|
125 |
|
126 |
-
#: inc/cleantalk-admin.php:
|
127 |
msgid "comments"
|
128 |
msgstr "комментарии"
|
129 |
|
130 |
-
#: inc/cleantalk-admin.php:
|
131 |
msgid "Delete all spam comments?"
|
132 |
msgstr "Удалить ВСЕ найденные спам-комментарии?"
|
133 |
|
134 |
-
#: inc/cleantalk-admin.php:
|
135 |
msgid "Delete checked comments?"
|
136 |
msgstr "Удалить отмеченые спам-комментарии?"
|
137 |
|
138 |
-
#: inc/cleantalk-admin.php:
|
139 |
#, php-format
|
140 |
msgid ""
|
141 |
"Total comments %s. Checked %s. Found %s spam comments. %s bad comments "
|
@@ -144,55 +254,51 @@ msgstr ""
|
|
144 |
"Всего комментариев %s. Проверено %s. Найдено %s спам комментариев. %s плохих "
|
145 |
"комментариев (без IP и Email'а)."
|
146 |
|
147 |
-
#: inc/cleantalk-admin.php:
|
148 |
-
#: inc/cleantalk-users.php:
|
149 |
msgid "Please do backup of WordPress database before delete any accounts!"
|
150 |
msgstr ""
|
151 |
"Пожалуйста, сделайте резервную копию базы данных Wordpress перед удалением "
|
152 |
"аккаунтов."
|
153 |
|
154 |
-
#: inc/cleantalk-admin.php:
|
155 |
-
msgid "Find spam-comments"
|
156 |
-
msgstr "Найти спам-комментарии"
|
157 |
-
|
158 |
-
#: inc/cleantalk-admin.php:316
|
159 |
msgid "The sender has been whitelisted."
|
160 |
msgstr "Отправитель был добавлен в белый список."
|
161 |
|
162 |
-
#: inc/cleantalk-admin.php:
|
163 |
msgid "The sender has been blacklisted."
|
164 |
msgstr "Отправитель был добавлен в черный список."
|
165 |
|
166 |
-
#: inc/cleantalk-admin.php:
|
167 |
#, php-format
|
168 |
msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
|
169 |
msgstr "Обратная связь отправлена в панель управления %sCleanTalk%s."
|
170 |
|
171 |
-
#: inc/cleantalk-admin.php:
|
172 |
msgid "Failed from timeout. Going to check users again."
|
173 |
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
174 |
|
175 |
-
#: inc/cleantalk-admin.php:
|
176 |
msgid "Failed from timeout. Going to run a new attempt to delete spam users."
|
177 |
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
178 |
|
179 |
-
#: inc/cleantalk-admin.php:
|
180 |
msgid "Inserted"
|
181 |
msgstr "Добавлено"
|
182 |
|
183 |
-
#: inc/cleantalk-admin.php:
|
184 |
msgid "users."
|
185 |
msgstr "пользователей."
|
186 |
|
187 |
-
#: inc/cleantalk-admin.php:
|
188 |
msgid "Delete all spam users?"
|
189 |
msgstr "Удалить ВСЕХ найденых спам-пользователей?"
|
190 |
|
191 |
-
#: inc/cleantalk-admin.php:
|
192 |
msgid "Delete checked users?"
|
193 |
msgstr "Удалить отмеченых спам-пользователей?"
|
194 |
|
195 |
-
#: inc/cleantalk-admin.php:
|
196 |
#, php-format
|
197 |
msgid ""
|
198 |
"Total users %s, checked %s, found %s spam users and %s bad users (without IP "
|
@@ -201,79 +307,79 @@ msgstr ""
|
|
201 |
"Всего пользователей %s, проверено %s, найдено %s спам пользователей и %s "
|
202 |
"плохих пользователей (без IP и Email'а)"
|
203 |
|
204 |
-
#: inc/cleantalk-admin.php:
|
205 |
msgid "Find spam-users"
|
206 |
msgstr "Найти спам-пользователей"
|
207 |
|
208 |
-
#: inc/cleantalk-admin.php:
|
209 |
#, php-format
|
210 |
msgid "Unable to get Access key automatically: %s"
|
211 |
msgstr "Невозможно получить ключ автоматически: %s"
|
212 |
|
213 |
-
#: inc/cleantalk-admin.php:
|
214 |
msgid "Get the Access key"
|
215 |
msgstr "Получить ключ вручную"
|
216 |
|
217 |
-
#: inc/cleantalk-admin.php:
|
218 |
#, php-format
|
219 |
msgid "Please enter Access Key in %s settings to enable anti spam protection!"
|
220 |
msgstr ""
|
221 |
"Пожалуйста, укажите Ключ доступа в настройках %s для активации защиты от "
|
222 |
"спама!"
|
223 |
|
224 |
-
#: inc/cleantalk-admin.php:
|
225 |
#, php-format
|
226 |
msgid "%s trial period ends, please upgrade to %s!"
|
227 |
msgstr ""
|
228 |
"%s заканчивается ознакомительный срок пользования антиспам плагином "
|
229 |
"CleanTalk, пожалуйста продлите подключение %s."
|
230 |
|
231 |
-
#: inc/cleantalk-admin.php:
|
232 |
msgid "RENEW ANTI-SPAM"
|
233 |
msgstr "ПРОДЛИТЬ АНТИСПАМ"
|
234 |
|
235 |
-
#: inc/cleantalk-admin.php:
|
236 |
msgid "next year"
|
237 |
msgstr "следующий год"
|
238 |
|
239 |
-
#: inc/cleantalk-admin.php:
|
240 |
#, php-format
|
241 |
msgid "Please renew your anti-spam license for %s."
|
242 |
msgstr "Пожалуйста, продлите свою антиспам-лицензию на %s."
|
243 |
|
244 |
-
#: inc/cleantalk-admin.php:
|
245 |
msgid "Make it right!"
|
246 |
msgstr "Сделай все правильно!"
|
247 |
|
248 |
-
#: inc/cleantalk-admin.php:
|
249 |
#, php-format
|
250 |
msgid "%sGet premium%s"
|
251 |
msgstr "%sПолучить премиум%s"
|
252 |
|
253 |
-
#: inc/cleantalk-admin.php:
|
254 |
msgid "Since"
|
255 |
msgstr "От"
|
256 |
|
257 |
-
#: inc/cleantalk-admin.php:
|
258 |
msgid ""
|
259 |
"All / Allowed / Blocked submissions. The number of submissions is being "
|
260 |
"counted since CleanTalk plugin installation."
|
261 |
msgstr "Все / Разрешенные / Запрещенные запросы с момента установки CleanTalk."
|
262 |
|
263 |
-
#: inc/cleantalk-admin.php:
|
264 |
msgid "All"
|
265 |
msgstr "Все"
|
266 |
|
267 |
-
#: inc/cleantalk-admin.php:
|
268 |
msgid ""
|
269 |
"Allowed / Blocked submissions. The number of submissions for past 24 hours. "
|
270 |
msgstr "Разрешенные / Запрещенные запросы за последние 24 часа."
|
271 |
|
272 |
-
#: inc/cleantalk-admin.php:
|
273 |
msgid "Day"
|
274 |
msgstr "За день"
|
275 |
|
276 |
-
#: inc/cleantalk-admin.php:
|
277 |
msgid ""
|
278 |
"All / Blocked events. Access attempts regitred by SpamFireWall counted since "
|
279 |
"the last plugin activation."
|
@@ -281,149 +387,65 @@ msgstr ""
|
|
281 |
"Все / Запрещенные попытки просмотра сайта. Отображет попытки с момента "
|
282 |
"последней активации плагина."
|
283 |
|
284 |
-
#: inc/cleantalk-admin.php:
|
285 |
msgid ""
|
286 |
"Allowed / Blocked submissions. The number of submissions is being counted "
|
287 |
"since "
|
288 |
msgstr "Разрешенные / Запрещенные попытки."
|
289 |
|
290 |
-
#: inc/cleantalk-admin.php:
|
291 |
msgid "dashboard"
|
292 |
msgstr "панель управления"
|
293 |
|
294 |
-
#: inc/cleantalk-admin.php:
|
295 |
msgid "Settings"
|
296 |
msgstr "Настройки"
|
297 |
|
298 |
-
#: inc/cleantalk-admin.php:
|
299 |
msgid "Bulk spam comments removal tool."
|
300 |
msgstr "Инструмент массового удаления пользователей."
|
301 |
|
302 |
-
#: inc/cleantalk-admin.php:
|
303 |
msgid "Check comments for spam"
|
304 |
msgstr "Проверка комментариев"
|
305 |
|
306 |
-
#: inc/cleantalk-admin.php:
|
307 |
msgid "Check users for spam"
|
308 |
msgstr "Проверить пользователей на спам"
|
309 |
|
310 |
-
#: inc/cleantalk-admin.php:
|
311 |
msgid "Reset first counter"
|
312 |
msgstr "Сбросить первый счетчик"
|
313 |
|
314 |
-
#: inc/cleantalk-admin.php:
|
315 |
msgid "Reset all counters"
|
316 |
msgstr "Сбросить все счетчики"
|
317 |
|
318 |
-
#: inc/cleantalk-comments.php:
|
319 |
-
msgid "Check for spam"
|
320 |
-
msgstr "Проверить на спам"
|
321 |
-
|
322 |
-
#: inc/cleantalk-comments.php:14
|
323 |
-
msgid "Find spam comments"
|
324 |
-
msgstr "Найти спам в комментариях"
|
325 |
-
|
326 |
-
#: inc/cleantalk-comments.php:24 inc/cleantalk-users.php:25
|
327 |
-
msgid "Plugin Settings"
|
328 |
-
msgstr "Настройки плагина"
|
329 |
-
|
330 |
-
#: inc/cleantalk-comments.php:33 inc/cleantalk-users.php:34
|
331 |
-
#, php-format
|
332 |
-
msgid ""
|
333 |
-
"Antispam hosting tariff does not allow you to use this feature. To do so, "
|
334 |
-
"you need to enter an Access Key in the %splugin settings%s."
|
335 |
-
msgstr ""
|
336 |
-
"Тариф на антиспам хостинг не позволяет использовать эту функцию. Для этого "
|
337 |
-
"вам необходимо ввести ключ доступа в %sнастройках плагина%s."
|
338 |
-
|
339 |
-
#: inc/cleantalk-comments.php:58 inc/cleantalk-users.php:60
|
340 |
-
msgid ""
|
341 |
-
"Ajax error. Process will be automatically restarted in 3 seconds. Status: "
|
342 |
-
msgstr ""
|
343 |
-
"Ajax ошибка. Процесс проверки будет автоматически возобновлен через 3 "
|
344 |
-
"секунды. Статус:"
|
345 |
-
|
346 |
-
#: inc/cleantalk-comments.php:65
|
347 |
-
msgid ""
|
348 |
-
"Please wait for a while. CleanTalk is deleting spam comments. Comments left: "
|
349 |
-
msgstr "Пожалуйста, подождите. CleanTalk удаляет спам-комментарии. Осталось:"
|
350 |
-
|
351 |
-
#: inc/cleantalk-comments.php:75 inc/cleantalk-users.php:77
|
352 |
-
msgid "Start check"
|
353 |
-
msgstr "Начать проверку"
|
354 |
-
|
355 |
-
#: inc/cleantalk-comments.php:76 inc/cleantalk-users.php:78
|
356 |
-
msgid "Continue check"
|
357 |
-
msgstr "Продолжить проверку"
|
358 |
-
|
359 |
-
#: inc/cleantalk-comments.php:77 inc/cleantalk-users.php:79
|
360 |
-
msgid ""
|
361 |
-
"The plugin will check all comments against blacklists database and show you "
|
362 |
-
"senders that have spam activity on other websites."
|
363 |
-
msgstr ""
|
364 |
-
"Пожалуйста, подождите. CleanTalk проверяет комментарии по черным спискам на "
|
365 |
-
"cleantalk.org. Вы сможете удалить комментарии со спамом после окончания "
|
366 |
-
"работы."
|
367 |
-
|
368 |
-
#: inc/cleantalk-comments.php:80 inc/cleantalk-users.php:82
|
369 |
-
msgid "Accurate check"
|
370 |
-
msgstr "Точная проверка"
|
371 |
-
|
372 |
-
#: inc/cleantalk-comments.php:82 inc/cleantalk-users.php:84
|
373 |
-
msgid ""
|
374 |
-
"Allows to use comment's dates to perform more accurate check. Could "
|
375 |
-
"seriously slow down the check."
|
376 |
-
msgstr ""
|
377 |
-
"Позволяет использовать даты комментариев для выполения более тщательной "
|
378 |
-
"проверки. Может серьезно замедлить проверку."
|
379 |
-
|
380 |
-
#: inc/cleantalk-comments.php:85 inc/cleantalk-users.php:87
|
381 |
-
msgid "Specify date range"
|
382 |
-
msgstr "Указать диапазон дат"
|
383 |
-
|
384 |
-
#: inc/cleantalk-comments.php:103
|
385 |
-
msgid ""
|
386 |
-
"Please wait! CleanTalk is checking all approved and pending comments via "
|
387 |
-
"blacklist database at cleantalk.org. You will have option to delete found "
|
388 |
-
"spam comments after plugin finish."
|
389 |
-
msgstr ""
|
390 |
-
"Пожалуйста, подождите! CleanTalk проверяет комментарии по черным спискам на "
|
391 |
-
"cleantalk.org. Вы сможете удалить комментарии со спамом после окончания "
|
392 |
-
"работы."
|
393 |
-
|
394 |
-
#: inc/cleantalk-comments.php:153
|
395 |
-
msgid "Comment"
|
396 |
-
msgstr "Комментарий"
|
397 |
-
|
398 |
-
#: inc/cleantalk-comments.php:154
|
399 |
-
msgid "In Response To"
|
400 |
-
msgstr "В ответ на"
|
401 |
-
|
402 |
-
#: inc/cleantalk-comments.php:216 inc/cleantalk-users.php:217
|
403 |
msgid "Approve"
|
404 |
msgstr "Одобрить"
|
405 |
|
406 |
-
#: inc/cleantalk-comments.php:
|
407 |
msgid "Delete"
|
408 |
msgstr "Удалить"
|
409 |
|
410 |
-
#: inc/cleantalk-comments.php:
|
411 |
msgid "Delete all comments from the list"
|
412 |
msgstr "Удалить все сообщения в списке"
|
413 |
|
414 |
-
#: inc/cleantalk-comments.php:
|
415 |
msgid "Delete selected"
|
416 |
msgstr "Удалить отмеченные"
|
417 |
|
418 |
-
#: inc/cleantalk-comments.php:
|
419 |
msgid "Insert comments"
|
420 |
msgstr "Добавить комментарии"
|
421 |
|
422 |
-
#: inc/cleantalk-comments.php:
|
423 |
msgid "Delete comments"
|
424 |
msgstr "Удалить тестовые спам-комментарии?"
|
425 |
|
426 |
-
#: inc/cleantalk-comments.php:
|
427 |
msgid ""
|
428 |
"There is some differencies between blacklists database and our API "
|
429 |
"mechanisms. Blacklists shows all history of spam activity, but our API (that "
|
@@ -440,68 +462,82 @@ msgstr ""
|
|
440 |
"ничего странного, если некоторые письма/IP не будут обнаружены при этой "
|
441 |
"проверке."
|
442 |
|
443 |
-
#: inc/cleantalk-comments.php:
|
444 |
msgid "Stop deletion"
|
445 |
msgstr "Остановить удаление"
|
446 |
|
447 |
-
#: inc/cleantalk-comments.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
msgid "Please do backup of WordPress database before delete any comments!"
|
449 |
msgstr ""
|
450 |
"Пожалуйста, сделайте резервную копию базы данных Wordpress перед удалением "
|
451 |
"комментариев."
|
452 |
|
453 |
-
#: inc/cleantalk-public.php:
|
454 |
-
#: inc/cleantalk-public.php:
|
|
|
455 |
msgid "Spam protection by CleanTalk"
|
456 |
msgstr "Спам защита CleanTalk"
|
457 |
|
458 |
-
#: inc/cleantalk-public.php:
|
459 |
-
#: inc/cleantalk-public.php:
|
460 |
msgid "Spam protection"
|
461 |
msgstr "Защита от спама"
|
462 |
|
463 |
-
#: inc/cleantalk-public.php:
|
464 |
-
|
465 |
-
|
466 |
-
msgstr "CleanTalk AntiSpam: Это сообщение - спам."
|
467 |
|
468 |
-
#: inc/cleantalk-public.php:
|
469 |
msgid "You could check it in CleanTalk's anti-spam database:"
|
470 |
msgstr "Вы можете проверить это по антиспам-базе CleanTalk:"
|
471 |
|
472 |
-
#: inc/cleantalk-public.php:
|
473 |
#, php-format
|
474 |
msgid "Registration approved by %s."
|
475 |
msgstr "Регистрация одобрена %s."
|
476 |
|
477 |
-
#: inc/cleantalk-public.php:
|
478 |
msgid "CleanTalk AntiSpam: This registration is spam."
|
479 |
msgstr "CleanTalk AntiSpam: Эта регистрация - спам."
|
480 |
|
481 |
-
#: inc/cleantalk-public.php:
|
482 |
-
#: inc/cleantalk-public.php:
|
483 |
msgid "CleanTalk's anti-spam database:"
|
484 |
msgstr "Антиспам-база CleanTalk:"
|
485 |
|
486 |
-
#: inc/cleantalk-public.php:
|
|
|
|
|
|
|
|
|
|
|
487 |
msgid "Comment approved. Anti-spam by CleanTalk."
|
488 |
msgstr "Комментарий одобрен. Антиспам от CleanTalk."
|
489 |
|
490 |
-
#: inc/cleantalk-public.php:
|
491 |
msgid "Attention, please!"
|
492 |
msgstr "Внимание!"
|
493 |
|
494 |
-
#: inc/cleantalk-public.php:
|
495 |
#, php-format
|
496 |
msgid "\"%s\" plugin error on your site \"%s\":"
|
497 |
msgstr "\"%s\" ошибка плагина на сайте \"%s\":"
|
498 |
|
499 |
-
#: inc/cleantalk-public.php:
|
500 |
#, php-format
|
501 |
msgid "[%s] \"%s\" error!"
|
502 |
msgstr "[%s] \"%s\" ошибка!"
|
503 |
|
504 |
-
#: inc/cleantalk-public.php:
|
505 |
msgid ""
|
506 |
"By using this form you agree with the storage and processing of your data by "
|
507 |
"using the Privacy Policy on this website."
|
@@ -509,51 +545,51 @@ msgstr ""
|
|
509 |
"Используя эту форму, вы соглашаетесь с хранением и обработкой ваших данных, "
|
510 |
"в соответствии с Политикой конфиденциальности на этом сайте."
|
511 |
|
512 |
-
#: inc/cleantalk-public.php:
|
513 |
msgid "Error occured while sending feedback."
|
514 |
msgstr "Случилась ошибка при отправке обратной связи."
|
515 |
|
516 |
-
#: inc/cleantalk-public.php:
|
517 |
msgid "Feedback wasn't sent. There is no associated request."
|
518 |
msgstr "Обратная связь не была отправлена. Нет связанного запроса."
|
519 |
|
520 |
-
#: inc/cleantalk-public.php:
|
521 |
msgid "Sender info"
|
522 |
msgstr "Информация об отправителе"
|
523 |
|
524 |
-
#: inc/cleantalk-public.php:
|
525 |
msgid "by"
|
526 |
msgstr " от"
|
527 |
|
528 |
-
#: inc/cleantalk-public.php:
|
529 |
msgid "No email"
|
530 |
msgstr "Email отсутствует"
|
531 |
|
532 |
-
#: inc/cleantalk-public.php:
|
533 |
msgid "No IP"
|
534 |
msgstr "IP отсутствует"
|
535 |
|
536 |
-
#: inc/cleantalk-public.php:
|
537 |
msgid "Mark as spam"
|
538 |
msgstr "Отметить как спам"
|
539 |
|
540 |
-
#: inc/cleantalk-public.php:
|
541 |
msgid "Unspam"
|
542 |
msgstr "Вернуть из спама"
|
543 |
|
544 |
-
#: inc/cleantalk-public.php:
|
545 |
msgid "Marked as spam."
|
546 |
msgstr "Отмечено как спам."
|
547 |
|
548 |
-
#: inc/cleantalk-public.php:
|
549 |
msgid "Marked as not spam."
|
550 |
msgstr "Отмечено как не спам."
|
551 |
|
552 |
-
#: inc/cleantalk-settings.php:
|
553 |
msgid "SpamFireWall"
|
554 |
msgstr "SpamFireWall"
|
555 |
|
556 |
-
#: inc/cleantalk-settings.php:
|
557 |
msgid ""
|
558 |
"This option allows to filter spam bots before they access website. Also "
|
559 |
"reduces CPU usage on hosting server and accelerates pages load time."
|
@@ -562,35 +598,35 @@ msgstr ""
|
|
562 |
"Также уменьшает загрузку процессора на хостинге и ускоряет время загрузки "
|
563 |
"страниц."
|
564 |
|
565 |
-
#: inc/cleantalk-settings.php:
|
566 |
msgid "Forms to protect"
|
567 |
msgstr "Защищаемые формы"
|
568 |
|
569 |
-
#: inc/cleantalk-settings.php:
|
570 |
msgid "Advanced settings"
|
571 |
msgstr "Продвинутые настройки"
|
572 |
|
573 |
-
#: inc/cleantalk-settings.php:
|
574 |
msgid "Registration Forms"
|
575 |
msgstr "Формы регистрации"
|
576 |
|
577 |
-
#: inc/cleantalk-settings.php:
|
578 |
msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
579 |
msgstr "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
580 |
|
581 |
-
#: inc/cleantalk-settings.php:
|
582 |
msgid "Comments form"
|
583 |
msgstr "Комментарии в блоге"
|
584 |
|
585 |
-
#: inc/cleantalk-settings.php:
|
586 |
msgid "WordPress, JetPack, WooCommerce."
|
587 |
msgstr "WordPress, JetPack, WooCommerce."
|
588 |
|
589 |
-
#: inc/cleantalk-settings.php:
|
590 |
msgid "Contact forms"
|
591 |
msgstr "Контактные формы"
|
592 |
|
593 |
-
#: inc/cleantalk-settings.php:
|
594 |
msgid ""
|
595 |
"Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
|
596 |
"WordPress Landing Pages, Gravity Forms."
|
@@ -598,27 +634,27 @@ msgstr ""
|
|
598 |
"Contact Form 7, Formidable Forms, Jetpack, Fast Secure Contact Form, "
|
599 |
"WordPress Landing Pages, Gravity Forms."
|
600 |
|
601 |
-
#: inc/cleantalk-settings.php:
|
602 |
msgid "Custom contact forms"
|
603 |
msgstr "Произвольные контактные формы"
|
604 |
|
605 |
-
#: inc/cleantalk-settings.php:
|
606 |
msgid "Anti spam test for any WordPress themes or contacts forms."
|
607 |
msgstr "Защита от спама любой контактной формы или темы."
|
608 |
|
609 |
-
#: inc/cleantalk-settings.php:
|
610 |
msgid "WooCommerce checkout form"
|
611 |
msgstr "Форма заказа WooCommerce"
|
612 |
|
613 |
-
#: inc/cleantalk-settings.php:
|
614 |
msgid "Anti spam test for WooCommerce checkout form."
|
615 |
msgstr "Спам тест для формы заказа WooCommerce"
|
616 |
|
617 |
-
#: inc/cleantalk-settings.php:
|
618 |
msgid "Spam test for registration during checkout"
|
619 |
msgstr "Регистрация на странице заказа"
|
620 |
|
621 |
-
#: inc/cleantalk-settings.php:
|
622 |
msgid ""
|
623 |
"Enable anti spam test for registration process which during woocommerce's "
|
624 |
"checkout."
|
@@ -626,24 +662,24 @@ msgstr ""
|
|
626 |
"Включить защиту от спама в регистрациях, которые проходят во время "
|
627 |
"оформления заказа."
|
628 |
|
629 |
-
#: inc/cleantalk-settings.php:
|
630 |
msgid "Test default Wordpress search form for spam"
|
631 |
msgstr "Стандартная форма поиска Wordpress"
|
632 |
|
633 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
634 |
#, php-format
|
635 |
-
msgid ""
|
636 |
-
"
|
637 |
-
"Search form%s on our blog."
|
638 |
-
msgstr ""
|
639 |
-
"Защита от спама для формы поиска. Узнайте больше о %sзащите от спама для "
|
640 |
-
"формы поиска%s в нашем блоге."
|
641 |
|
642 |
-
#: inc/cleantalk-settings.php:
|
643 |
msgid "Protect external forms"
|
644 |
msgstr "Защита внешних форм"
|
645 |
|
646 |
-
#: inc/cleantalk-settings.php:
|
647 |
msgid ""
|
648 |
"Turn this option on to protect forms on your WordPress that send data to "
|
649 |
"third-part servers (like MailChimp)."
|
@@ -651,60 +687,72 @@ msgstr ""
|
|
651 |
"Включите эту опцию, что бы защитить формы, которые отсылают данные на "
|
652 |
"сторонние ресурсы, например MailChimp."
|
653 |
|
654 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
655 |
msgid "Protect internal forms"
|
656 |
msgstr "Защита внутренних форм"
|
657 |
|
658 |
-
#: inc/cleantalk-settings.php:
|
659 |
msgid ""
|
660 |
"This option will enable protection for custom (hand-made) AJAX forms with "
|
661 |
"PHP scripts handlers on your WordPress."
|
662 |
msgstr "Эта опция обеспечит защиту созданных вручную форм, использующих AJAX."
|
663 |
|
664 |
-
#: inc/cleantalk-settings.php:
|
665 |
msgid "Comments and Messages"
|
666 |
msgstr "Комментарии и сообщения"
|
667 |
|
668 |
-
#: inc/cleantalk-settings.php:
|
669 |
msgid "BuddyPress Private Messages"
|
670 |
msgstr "Личные сообщения buddyPress"
|
671 |
|
672 |
-
#: inc/cleantalk-settings.php:
|
673 |
msgid "Check buddyPress private messages."
|
674 |
msgstr "Проверять личные сообщения buddyPress "
|
675 |
|
676 |
-
#: inc/cleantalk-settings.php:
|
677 |
msgid "Don't check trusted user's comments"
|
678 |
msgstr "Не проверять доверенных пользователей"
|
679 |
|
680 |
-
#: inc/cleantalk-settings.php:
|
681 |
#, php-format
|
682 |
-
msgid "Don't check comments for users with above % comments."
|
683 |
-
msgstr ""
|
684 |
-
"Не проверять пользователей, у которых больше %s одобренных комментариев."
|
685 |
|
686 |
-
#: inc/cleantalk-settings.php:
|
687 |
msgid "Automatically delete spam comments"
|
688 |
msgstr "Автоматически удалять спам-комментарии"
|
689 |
|
690 |
-
#: inc/cleantalk-settings.php:
|
691 |
#, php-format
|
692 |
msgid "Delete spam comments older than %d days."
|
693 |
msgstr "Удалять комментарии старше %d дней."
|
694 |
|
695 |
-
#: inc/cleantalk-settings.php:
|
696 |
msgid "Remove links from approved comments"
|
697 |
msgstr "Удалять ссылки из одобреных комментариев"
|
698 |
|
699 |
-
#: inc/cleantalk-settings.php:
|
700 |
msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
|
701 |
msgstr "Удалять ссылки из одобренных сообщений"
|
702 |
|
703 |
-
#: inc/cleantalk-settings.php:
|
704 |
msgid "Show links to check Emails, IPs for spam."
|
705 |
msgstr "Отобразить ссылки для проверки Email'ов и IP адресов."
|
706 |
|
707 |
-
#: inc/cleantalk-settings.php:
|
708 |
msgid ""
|
709 |
"Shows little icon near IP addresses and Emails allowing you to check it via "
|
710 |
"CleanTalk's database. Also allowing you to manage comments from the public "
|
@@ -714,39 +762,49 @@ msgstr ""
|
|
714 |
"через базу данных. Так же позволяет управлять комментариями с публичной "
|
715 |
"страницы записи."
|
716 |
|
717 |
-
#: inc/cleantalk-settings.php:
|
718 |
msgid "Data Processing"
|
719 |
msgstr "Обработка данных"
|
720 |
|
721 |
-
#: inc/cleantalk-settings.php:
|
722 |
msgid "Protect logged in Users"
|
723 |
msgstr "Проверять залогиненых пользователей"
|
724 |
|
725 |
-
#: inc/cleantalk-settings.php:
|
726 |
msgid ""
|
727 |
"Turn this option on to check for spam any submissions (comments, contact "
|
728 |
"forms and etc.) from registered Users."
|
729 |
msgstr "Включите, чтобы проверять зарегистрированных пользователей."
|
730 |
|
731 |
-
#: inc/cleantalk-settings.php:
|
732 |
msgid "Use AJAX for JavaScript check"
|
733 |
msgstr "Использовать AJAX для проверки JavaScript"
|
734 |
|
735 |
-
#: inc/cleantalk-settings.php:
|
736 |
msgid ""
|
737 |
"Options helps protect WordPress against spam with any caching plugins. Turn "
|
738 |
"this option on to avoid issues with caching plugins."
|
739 |
msgstr "Данная настройка помогает избежать конфликтов с кеширующими плагинами."
|
740 |
|
741 |
-
#: inc/cleantalk-settings.php:
|
742 |
-
msgid "
|
743 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
744 |
|
745 |
-
#: inc/cleantalk-settings.php:
|
746 |
msgid "Check all post data"
|
747 |
msgstr "Проверять все POST-данные"
|
748 |
|
749 |
-
#: inc/cleantalk-settings.php:
|
750 |
msgid ""
|
751 |
"Check all POST submissions from website visitors. Enable this option if you "
|
752 |
"have spam misses on website."
|
@@ -754,25 +812,25 @@ msgstr ""
|
|
754 |
"Проверять все POST-данные, отправляемые посетителями. Активируйте, если у "
|
755 |
"вас есть спам на сайте."
|
756 |
|
757 |
-
#: inc/cleantalk-settings.php:
|
758 |
msgid " Or you don`t have records about missed spam here:"
|
759 |
msgstr " Или у вас нет записей о спаме здесь:"
|
760 |
|
761 |
-
#: inc/cleantalk-settings.php:
|
762 |
msgid "CleanTalk dashboard"
|
763 |
msgstr "панель управления CleanTalk"
|
764 |
|
765 |
-
#: inc/cleantalk-settings.php:
|
766 |
msgid "СAUTION! Option can catch POST requests in WordPress backend"
|
767 |
msgstr ""
|
768 |
"ВНИМАНИЕ! Опция может перехватывать все POST запросы в панели управления "
|
769 |
"Wordpress. Отключите, если возникают проблемы/ошибки."
|
770 |
|
771 |
-
#: inc/cleantalk-settings.php:
|
772 |
msgid "Set cookies"
|
773 |
msgstr "Устанавливать куки"
|
774 |
|
775 |
-
#: inc/cleantalk-settings.php:
|
776 |
msgid ""
|
777 |
"Turn this option off to deny plugin generates any cookies on website front-"
|
778 |
"end. This option is helpful if you use Varnish. But most of contact forms "
|
@@ -786,47 +844,86 @@ msgstr ""
|
|
786 |
"настоятельно рекомендуем не отключать опцию, иначе это может привести к "
|
787 |
"ложному обнаружению спама.</b>"
|
788 |
|
789 |
-
#: inc/cleantalk-settings.php:
|
790 |
-
msgid "Use alternative mechanism for cookies
|
791 |
-
msgstr "Использовать альтернативный механизм
|
792 |
|
793 |
-
#: inc/cleantalk-settings.php:
|
794 |
msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
|
795 |
msgstr ""
|
796 |
"Не использовать файлы cookies или PHP-сессии. Собирать данные обо всех типах "
|
797 |
"ботов."
|
798 |
|
799 |
-
#: inc/cleantalk-settings.php:
|
800 |
msgid "Use SSL"
|
801 |
msgstr "Использовать SSL"
|
802 |
|
803 |
-
#: inc/cleantalk-settings.php:
|
804 |
msgid "Turn this option on to use encrypted (SSL) connection with servers."
|
805 |
msgstr ""
|
806 |
"Включите эту опцию для использования защищенного (SSL) соединения между "
|
807 |
"серверами."
|
808 |
|
809 |
-
#: inc/cleantalk-settings.php:
|
810 |
msgid "Use Wordpress HTTP API"
|
811 |
msgstr "Использовать стандартное Wordpress HTTP API"
|
812 |
|
813 |
-
#: inc/cleantalk-settings.php:
|
814 |
msgid ""
|
815 |
-
"Alternative way to connect the
|
816 |
-
"
|
817 |
msgstr ""
|
818 |
-
"Альтернативный способ подключения к CleanTalk Cloud.
|
819 |
-
"
|
820 |
|
821 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
822 |
msgid "Admin bar"
|
823 |
msgstr "Админ-бар"
|
824 |
|
825 |
-
#: inc/cleantalk-settings.php:
|
826 |
msgid "Show statistics in admin bar"
|
827 |
msgstr "Показывать статистику в админбаре"
|
828 |
|
829 |
-
#: inc/cleantalk-settings.php:
|
830 |
msgid ""
|
831 |
"Show/hide icon in top level menu in WordPress backend. The number of "
|
832 |
"submissions is being counted for past 24 hours."
|
@@ -834,11 +931,11 @@ msgstr ""
|
|
834 |
"Показать/скрыть иконку CleanTalk в админ-баре WordPress. Статистика "
|
835 |
"подсчитывается за последние 24 часа."
|
836 |
|
837 |
-
#: inc/cleantalk-settings.php:
|
838 |
msgid "Show All-time counter"
|
839 |
msgstr "Счетчик за все время"
|
840 |
|
841 |
-
#: inc/cleantalk-settings.php:
|
842 |
msgid ""
|
843 |
"Display all-time requests counter in the admin bar. Counter displays number "
|
844 |
"of requests since plugin installation."
|
@@ -846,11 +943,11 @@ msgstr ""
|
|
846 |
"Отображать счетчик запросов за все время в админ-баре. Счетчик показывает "
|
847 |
"записи с момента установки."
|
848 |
|
849 |
-
#: inc/cleantalk-settings.php:
|
850 |
msgid "Show 24 hours counter"
|
851 |
msgstr "24-х часовой счетчик"
|
852 |
|
853 |
-
#: inc/cleantalk-settings.php:
|
854 |
msgid ""
|
855 |
"Display daily requests counter in the admin bar. Counter displays number of "
|
856 |
"requests of the past 24 hours."
|
@@ -858,11 +955,11 @@ msgstr ""
|
|
858 |
"Отображать 24-х часовой счетчик запросов в админ-баре. Отображает запросы за "
|
859 |
"последние 24 часа."
|
860 |
|
861 |
-
#: inc/cleantalk-settings.php:
|
862 |
msgid "SpamFireWall counter"
|
863 |
msgstr "Счетчик SpamFireWall"
|
864 |
|
865 |
-
#: inc/cleantalk-settings.php:
|
866 |
msgid ""
|
867 |
"Display SpamFireWall requests in the admin bar. Counter displays number of "
|
868 |
"requests since plugin installation."
|
@@ -870,11 +967,11 @@ msgstr ""
|
|
870 |
"Отображать счетчик SpamFireWall запросов в админ-баре. Отображает количество "
|
871 |
"запросов с момента установки плагина."
|
872 |
|
873 |
-
#: inc/cleantalk-settings.php:
|
874 |
msgid "Collect details about browsers"
|
875 |
msgstr "Собирать данные браузера"
|
876 |
|
877 |
-
#: inc/cleantalk-settings.php:
|
878 |
msgid ""
|
879 |
"Checking this box you allow plugin store information about screen size and "
|
880 |
"browser plugins of website visitors. The option in a beta state."
|
@@ -882,11 +979,11 @@ msgstr ""
|
|
882 |
"Включая эту опцию, Вы разрешаете плагину хранить информацию о размере экрана "
|
883 |
"и плагинах браузера посетителей. Бета опция."
|
884 |
|
885 |
-
#: inc/cleantalk-settings.php:
|
886 |
msgid "Send connection reports"
|
887 |
msgstr "Отправлять отчеты о соединении"
|
888 |
|
889 |
-
#: inc/cleantalk-settings.php:
|
890 |
msgid ""
|
891 |
"Checking this box you allow plugin to send the information about your "
|
892 |
"connection. The option in a beta state."
|
@@ -894,22 +991,22 @@ msgstr ""
|
|
894 |
"Ставя эту галочку вы разрешаете плагину отрпавлять информацию о интернет-"
|
895 |
"соединении. Опция находится на бета-тестировании."
|
896 |
|
897 |
-
#: inc/cleantalk-settings.php:
|
898 |
msgid "Async JavaScript loading"
|
899 |
msgstr "Асинхронная загрузка JavaScript"
|
900 |
|
901 |
-
#: inc/cleantalk-settings.php:
|
902 |
msgid ""
|
903 |
"Use async loading for scripts. Warning: This could reduce filtration quality."
|
904 |
msgstr ""
|
905 |
"Использовать асинхронную загрузку JS-скриптов. ВНИМАНИЕ! это может понизить "
|
906 |
"качество спам-фильтра."
|
907 |
|
908 |
-
#: inc/cleantalk-settings.php:
|
909 |
msgid "Allow to add GDPR notice via shortcode"
|
910 |
msgstr "Разрешить добавление GDPR-уведомления с помощью шордкода"
|
911 |
|
912 |
-
#: inc/cleantalk-settings.php:
|
913 |
msgid ""
|
914 |
" Adds small checkbox under your website form. To add it you should use the "
|
915 |
"shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
@@ -917,19 +1014,19 @@ msgstr ""
|
|
917 |
"Добавить не большой чекбокс в форму. Для добавления уведомления вставьте на "
|
918 |
"странице с формой этот шорткод: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
919 |
|
920 |
-
#: inc/cleantalk-settings.php:
|
921 |
msgid "GDPR text notice"
|
922 |
msgstr "Текст GDPR-уведомления"
|
923 |
|
924 |
-
#: inc/cleantalk-settings.php:
|
925 |
msgid "This text will be added as a description to the GDPR checkbox."
|
926 |
msgstr "Этот текст будет добавлен к чекбоксу как описание."
|
927 |
|
928 |
-
#: inc/cleantalk-settings.php:
|
929 |
msgid "Store visited URLs"
|
930 |
msgstr "Хранить посещенные URL-ы"
|
931 |
|
932 |
-
#: inc/cleantalk-settings.php:
|
933 |
msgid ""
|
934 |
"Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
|
935 |
"form on the site. You can see stored visited URLS for each visitor in your "
|
@@ -940,11 +1037,11 @@ msgstr ""
|
|
940 |
"URL-адреса для каждого посетителя на своей панели инструментов. Включите эту "
|
941 |
"опцию, чтобы улучшить защиту от спама."
|
942 |
|
943 |
-
#: inc/cleantalk-settings.php:
|
944 |
msgid "Use cookies less sessions"
|
945 |
msgstr "Использовать сеансы без cookies"
|
946 |
|
947 |
-
#: inc/cleantalk-settings.php:
|
948 |
msgid ""
|
949 |
"Notify users with selected roles about new approved comments. Hold CTRL to "
|
950 |
"select multiple roles."
|
@@ -952,104 +1049,189 @@ msgstr ""
|
|
952 |
"Уведомлять пользователей с выбранными ролями о новых одобренных комментариях."
|
953 |
" Удерживайте CTRL для выбора нескольких ролей."
|
954 |
|
955 |
-
#: inc/cleantalk-settings.php:
|
956 |
#, php-format
|
957 |
msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
|
958 |
msgstr "Если включено, переопределяет аналогичные %sнастройки Wordpress%s."
|
959 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
960 |
#: inc/cleantalk-settings.php:398
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
961 |
msgid "CleanTalk's tech support:"
|
962 |
msgstr "Техническия поддержка CleanTalk: "
|
963 |
|
964 |
-
#: inc/cleantalk-settings.php:
|
965 |
msgid "Plugin Homepage at"
|
966 |
msgstr "Домашняя страница плагина на"
|
967 |
|
968 |
-
#: inc/cleantalk-settings.php:
|
969 |
msgid "GDPR compliance"
|
970 |
msgstr "Соответствие GDPR"
|
971 |
|
972 |
-
#: inc/cleantalk-settings.php:
|
973 |
msgid "Use s@cleantalk.org to test plugin in any WordPress form."
|
974 |
msgstr ""
|
975 |
"Используйте s@cleantalk.org чтобы проверить плагин в любой форме в WordPress."
|
976 |
|
977 |
-
#: inc/cleantalk-settings.php:
|
978 |
msgid "CleanTalk is registered Trademark. All rights reserved."
|
979 |
msgstr "CleanTalk - это зарегистрированая торговая марка. Все права защищены."
|
980 |
|
981 |
-
#: inc/cleantalk-settings.php:
|
982 |
-
#, php-format
|
983 |
-
msgid "Your CleanTalk access key is: <b>%s</b>."
|
984 |
-
msgstr "Ваш ключ доступа CleanTalk: <b>%s</b>."
|
985 |
-
|
986 |
-
#: inc/cleantalk-settings.php:427
|
987 |
-
msgid ""
|
988 |
-
"To set up global CleanTalk access key for all websites, define constant in "
|
989 |
-
"your wp-config.php file before defining database constants: <br/><pre>"
|
990 |
-
"define(\"CLEANTALK_ACCESS_KEY\", \"place your key here\");</pre>"
|
991 |
-
msgstr ""
|
992 |
-
"Для глобальной установки вашего ключа доступа CleanTalk для всех сайтов сети,"
|
993 |
-
" объявите константу в файле wp-config.php перед объявлением констант базы "
|
994 |
-
"данных: <br/><pre>define(\"CLEANTALK_ACCESS_KEY\", \"place your key here\");"
|
995 |
-
"</pre>"
|
996 |
-
|
997 |
-
#: inc/cleantalk-settings.php:439
|
998 |
#, php-format
|
999 |
msgid "%s has blocked <b>%s</b> spam."
|
1000 |
msgstr "%s заблокировал <b>%s</b> спама."
|
1001 |
|
1002 |
-
#: inc/cleantalk-settings.php:
|
1003 |
msgid "Click here to get anti-spam statistics"
|
1004 |
msgstr "Щелкните, чтобы получить статистику"
|
1005 |
|
1006 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1007 |
#, php-format
|
1008 |
msgid "You can get support any time here: %s."
|
1009 |
msgstr "Вы всегда можете получить техническую поддержку здесь: %s."
|
1010 |
|
1011 |
-
#: inc/cleantalk-settings.php:
|
1012 |
msgid "Protection is active"
|
1013 |
msgstr "Защита включена"
|
1014 |
|
1015 |
-
#: inc/cleantalk-settings.php:
|
1016 |
msgid "Registration forms"
|
1017 |
msgstr "Регистрации пользователей"
|
1018 |
|
1019 |
-
#: inc/cleantalk-settings.php:
|
1020 |
msgid "Comments forms"
|
1021 |
msgstr "Формы комментариев"
|
1022 |
|
1023 |
-
#: inc/cleantalk-settings.php:
|
1024 |
msgid "Validate email for existence"
|
1025 |
msgstr "Проверка e-mail на существование"
|
1026 |
|
1027 |
-
#: inc/cleantalk-settings.php:
|
1028 |
msgid "Auto update"
|
1029 |
msgstr "Автообновлние"
|
1030 |
|
1031 |
-
#: inc/cleantalk-settings.php:
|
1032 |
-
msgid "<h3>Key is provided by Super Admin
|
1033 |
-
msgstr "<h3>Ключ предоставлен
|
1034 |
|
1035 |
-
#: inc/cleantalk-settings.php:
|
1036 |
msgid "Access key"
|
1037 |
msgstr "Ключ доступа"
|
1038 |
|
1039 |
-
#: inc/cleantalk-settings.php:
|
1040 |
msgid "Enter the key"
|
1041 |
msgstr "Введите ключ"
|
1042 |
|
1043 |
-
#: inc/cleantalk-settings.php:
|
1044 |
#, php-format
|
1045 |
msgid "Account at cleantalk.org is %s."
|
1046 |
msgstr "Аккаунт на cleantalk.org %s."
|
1047 |
|
1048 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
1049 |
msgid "Get Access Key Automatically"
|
1050 |
msgstr "Получить ключ доступа автоматически"
|
1051 |
|
1052 |
-
#: inc/cleantalk-settings.php:
|
1053 |
#, php-format
|
1054 |
msgid ""
|
1055 |
"Admin e-mail (%s) will be used for registration, if you want to use other "
|
@@ -1059,73 +1241,121 @@ msgstr ""
|
|
1059 |
"использовать другой e-mail, пожлуйста, %sполучите ключ доступа "
|
1060 |
"самостоятельно%s."
|
1061 |
|
1062 |
-
#: inc/cleantalk-settings.php:
|
1063 |
-
|
1064 |
-
|
|
|
1065 |
|
1066 |
-
#: inc/cleantalk-settings.php:
|
1067 |
msgid "Statistics & Reports"
|
1068 |
msgstr "Статистика и отчеты"
|
1069 |
|
1070 |
-
#: inc/cleantalk-settings.php:
|
1071 |
#, php-format
|
1072 |
msgid "Last spam check request to %s server was at %s."
|
1073 |
msgstr "Последний запрос проверки спама на сервере %s был произведен %s."
|
1074 |
|
1075 |
-
#: inc/cleantalk-settings.php:
|
1076 |
-
#: inc/cleantalk-settings.php:
|
1077 |
-
#: inc/cleantalk-settings.php:
|
1078 |
-
#: inc/cleantalk-settings.php:
|
1079 |
-
#: inc/cleantalk-settings.php:
|
1080 |
msgid "unknown"
|
1081 |
msgstr "неизвестно"
|
1082 |
|
1083 |
-
#: inc/cleantalk-settings.php:
|
1084 |
#, php-format
|
1085 |
msgid "Average request time for past 7 days: %s seconds."
|
1086 |
msgstr "Среднее время запроса за последние 7 дней: %s секунд."
|
1087 |
|
1088 |
-
#: inc/cleantalk-settings.php:
|
1089 |
#, php-format
|
1090 |
msgid "Last time SpamFireWall was triggered for %s IP at %s"
|
1091 |
msgstr "В последний раз SpamFireWall сработал на %s IP %s"
|
1092 |
|
1093 |
-
#: inc/cleantalk-settings.php:
|
1094 |
#, php-format
|
1095 |
msgid "SpamFireWall was updated %s. Now contains %s entries."
|
1096 |
msgstr "SpamFireWall был обновлен %s. Содержится %s записей."
|
1097 |
|
1098 |
-
#: inc/cleantalk-settings.php:
|
1099 |
#, php-format
|
1100 |
msgid "SpamFireWall sent %s events at %s."
|
1101 |
msgstr "SpamFireWall отправил %s событий %s."
|
1102 |
|
1103 |
-
#: inc/cleantalk-settings.php:
|
1104 |
msgid "There are no failed connections to server."
|
1105 |
msgstr "Проблем с подключением к серверу нет."
|
1106 |
|
1107 |
-
#: inc/cleantalk-settings.php:
|
1108 |
msgid "Send report"
|
1109 |
msgstr "Отправить отчет"
|
1110 |
|
1111 |
-
#: inc/cleantalk-settings.php:
|
1112 |
msgid ""
|
1113 |
"Please, enable \"Send connection reports\" setting to be able to send reports"
|
1114 |
msgstr ""
|
1115 |
"Пожалуйста, активируйте опцию \"Отправлять отчеты о соединении\" для "
|
1116 |
"возможности отправлять отчеты."
|
1117 |
|
1118 |
-
#: inc/cleantalk-settings.php:
|
1119 |
-
msgid "Get access key automatically"
|
1120 |
-
msgstr "Получить ключ автоматически"
|
1121 |
-
|
1122 |
-
#: inc/cleantalk-settings.php:1091
|
1123 |
msgid "Testing is failed. Please check the Access key."
|
1124 |
msgstr "Ошибка тестирования. Пожалуйста, проверьте ключ доступа."
|
1125 |
|
1126 |
-
#: inc/cleantalk-settings.php:
|
1127 |
-
msgid "
|
1128 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
|
1130 |
#: inc/cleantalk-users.php:15
|
1131 |
msgid "Find spam users"
|
@@ -1135,7 +1365,23 @@ msgstr "Найти спам-пользователей"
|
|
1135 |
msgid "Please wait for a while. CleanTalk is deleting spam users. Users left: "
|
1136 |
msgstr "Пожалуйста, подождите. CleanTalk удаляет спам-пользователей. Осталось:"
|
1137 |
|
1138 |
-
#: inc/cleantalk-users.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1139 |
msgid ""
|
1140 |
"Please wait for a while. CleanTalk is checking all users via blacklist "
|
1141 |
"database at cleantalk.org. You will have option to delete found spam users "
|
@@ -1145,22 +1391,31 @@ msgstr ""
|
|
1145 |
"спискам на cleantalk.org. У вас появится возможность удалить обнаруженных "
|
1146 |
"спам-пользователей как только плагин закончит."
|
1147 |
|
1148 |
-
#: inc/cleantalk-users.php:
|
1149 |
msgid "Delete all users from list"
|
1150 |
msgstr "Удалить всех пользователей в списке"
|
1151 |
|
1152 |
-
#: inc/cleantalk-users.php:
|
1153 |
msgid "Download results in CSV"
|
1154 |
msgstr "Загрузить результаты (CSV)"
|
1155 |
|
1156 |
-
#: inc/cleantalk-users.php:
|
1157 |
msgid "Insert accounts"
|
1158 |
msgstr "Добавить аккаунты"
|
1159 |
|
1160 |
-
#: inc/cleantalk-users.php:
|
1161 |
msgid "Delete accounts"
|
1162 |
msgstr "Удалить тестовые спам-аккаунты"
|
1163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1164 |
#: inc/cleantalk-widget.php:22
|
1165 |
msgid "CleanTalk Widget"
|
1166 |
msgstr "Виджет CleanTalk"
|
@@ -1213,11 +1468,11 @@ msgstr "Темный"
|
|
1213 |
msgid "Referal link ID:"
|
1214 |
msgstr "ID партнера:"
|
1215 |
|
1216 |
-
#: lib/CleantalkSFW.php:
|
1217 |
msgid "SpamFireWall is activated for your IP "
|
1218 |
msgstr "Спам Фаервол заблокировал ваш IP"
|
1219 |
|
1220 |
-
#: lib/CleantalkSFW.php:
|
1221 |
msgid ""
|
1222 |
"To continue working with web site, please make sure that you have enabled "
|
1223 |
"JavaScript."
|
@@ -1225,11 +1480,11 @@ msgstr ""
|
|
1225 |
"Что бы продолжить работу с сайтом, пожалуйста, убедитесь что у вас включен "
|
1226 |
"JavaScript."
|
1227 |
|
1228 |
-
#: lib/CleantalkSFW.php:
|
1229 |
msgid "Please click below to pass protection,"
|
1230 |
msgstr "Пожалуйста, нажмите, чтобы пройти защиту,"
|
1231 |
|
1232 |
-
#: lib/CleantalkSFW.php:
|
1233 |
#, php-format
|
1234 |
msgid ""
|
1235 |
"Or you will be automatically redirected to the requested page after %d "
|
@@ -1238,11 +1493,11 @@ msgstr ""
|
|
1238 |
"Или вы будете автоматически переадресованы на запрашиваемую страницу через "
|
1239 |
"%d секунд."
|
1240 |
|
1241 |
-
#: lib/CleantalkSFW.php:
|
1242 |
msgid "Antispam by CleanTalk"
|
1243 |
msgstr "Антиспам от CleanTalk"
|
1244 |
|
1245 |
-
#: lib/CleantalkSFW.php:
|
1246 |
msgid "This is the testing page for SpamFireWall"
|
1247 |
msgstr "Это тестовая страница SpamFireWall"
|
1248 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
4 |
+
"POT-Creation-Date: 2019-10-27 16:02+0000\n"
|
5 |
+
"PO-Revision-Date: 2019-10-27 16:39+0000\n"
|
6 |
"Last-Translator: admin <ievlev@cleantalk.org>\n"
|
7 |
"Language-Team: Русский\n"
|
8 |
"Language: ru_RU\n"
|
21 |
"X-Poedit-SearchPath-0: .\n"
|
22 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
23 |
"Report-Msgid-Bugs-To: \n"
|
24 |
+
"X-Loco-Version: 2.3.0; wp-5.2.4"
|
25 |
|
26 |
+
#: inc/classCleantalkComments.php:32 inc/cleantalk-comments.php:16
|
27 |
+
#: inc/cleantalk-users.php:15
|
28 |
+
msgid "Check for spam"
|
29 |
+
msgstr "Проверить на спам"
|
30 |
+
|
31 |
+
#: inc/classCleantalkComments.php:33 inc/cleantalk-admin.php:350
|
32 |
+
#: inc/cleantalk-comments.php:16
|
33 |
+
msgid "Find spam comments"
|
34 |
+
msgstr "Найти спам в комментариях"
|
35 |
+
|
36 |
+
#: inc/classCleantalkComments.php:66 inc/cleantalk-comments.php:26
|
37 |
+
#: inc/cleantalk-users.php:25
|
38 |
+
msgid "Plugin Settings"
|
39 |
+
msgstr "Настройки плагина"
|
40 |
+
|
41 |
+
#: inc/classCleantalkComments.php:76 inc/cleantalk-comments.php:35
|
42 |
+
#: inc/cleantalk-users.php:34
|
43 |
+
#, php-format
|
44 |
+
msgid ""
|
45 |
+
"Antispam hosting tariff does not allow you to use this feature. To do so, "
|
46 |
+
"you need to enter an Access Key in the %splugin settings%s."
|
47 |
+
msgstr ""
|
48 |
+
"Тариф на антиспам хостинг не позволяет использовать эту функцию. Для этого "
|
49 |
+
"вам необходимо ввести ключ доступа в %sнастройках плагина%s."
|
50 |
+
|
51 |
+
#: inc/classCleantalkComments.php:101 inc/cleantalk-comments.php:60
|
52 |
+
#: inc/cleantalk-users.php:60
|
53 |
+
msgid ""
|
54 |
+
"Ajax error. Process will be automatically restarted in 3 seconds. Status: "
|
55 |
+
msgstr ""
|
56 |
+
"Ajax ошибка. Процесс проверки будет автоматически возобновлен через 3 "
|
57 |
+
"секунды. Статус:"
|
58 |
+
|
59 |
+
#: inc/classCleantalkComments.php:108 inc/cleantalk-comments.php:67
|
60 |
+
msgid ""
|
61 |
+
"Please wait for a while. CleanTalk is deleting spam comments. Comments left: "
|
62 |
+
msgstr "Пожалуйста, подождите. CleanTalk удаляет спам-комментарии. Осталось:"
|
63 |
+
|
64 |
+
#: inc/classCleantalkComments.php:118 inc/cleantalk-comments.php:77
|
65 |
+
#: inc/cleantalk-users.php:77
|
66 |
+
msgid "Start check"
|
67 |
+
msgstr "Начать проверку"
|
68 |
+
|
69 |
+
#: inc/classCleantalkComments.php:119 inc/cleantalk-comments.php:78
|
70 |
+
#: inc/cleantalk-users.php:78
|
71 |
+
msgid "Continue check"
|
72 |
+
msgstr "Продолжить проверку"
|
73 |
+
|
74 |
+
#: inc/classCleantalkComments.php:120 inc/cleantalk-comments.php:79
|
75 |
+
msgid ""
|
76 |
+
"The plugin will check all comments against blacklists database and show you "
|
77 |
+
"senders that have spam activity on other websites."
|
78 |
+
msgstr ""
|
79 |
+
"Пожалуйста, подождите. CleanTalk проверяет комментарии по черным спискам на "
|
80 |
+
"cleantalk.org. Вы сможете удалить комментарии со спамом после окончания "
|
81 |
+
"работы."
|
82 |
+
|
83 |
+
#: inc/classCleantalkComments.php:123 inc/cleantalk-comments.php:82
|
84 |
+
#: inc/cleantalk-users.php:82
|
85 |
+
msgid "Accurate check"
|
86 |
+
msgstr "Точная проверка"
|
87 |
+
|
88 |
+
#: inc/classCleantalkComments.php:125 inc/cleantalk-comments.php:84
|
89 |
+
msgid ""
|
90 |
+
"Allows to use comment's dates to perform more accurate check. Could "
|
91 |
+
"seriously slow down the check."
|
92 |
+
msgstr ""
|
93 |
+
"Позволяет использовать даты комментариев для выполения более тщательной "
|
94 |
+
"проверки. Может серьезно замедлить проверку."
|
95 |
+
|
96 |
+
#: inc/classCleantalkComments.php:128 inc/cleantalk-comments.php:87
|
97 |
+
#: inc/cleantalk-users.php:87
|
98 |
+
msgid "Specify date range"
|
99 |
+
msgstr "Указать диапазон дат"
|
100 |
+
|
101 |
+
#: inc/classCleantalkComments.php:149 inc/cleantalk-comments.php:108
|
102 |
+
msgid ""
|
103 |
+
"Please wait! CleanTalk is checking all approved and pending comments via "
|
104 |
+
"blacklist database at cleantalk.org. You will have option to delete found "
|
105 |
+
"spam comments after plugin finish."
|
106 |
+
msgstr ""
|
107 |
+
"Пожалуйста, подождите! CleanTalk проверяет комментарии по черным спискам на "
|
108 |
+
"cleantalk.org. Вы сможете удалить комментарии со спамом после окончания "
|
109 |
+
"работы."
|
110 |
+
|
111 |
+
#: inc/classCleantalkCommentsListTable.php:24
|
112 |
+
msgid "Author"
|
113 |
+
msgstr "Автор"
|
114 |
+
|
115 |
+
#: inc/classCleantalkCommentsListTable.php:25 inc/cleantalk-comments.php:158
|
116 |
+
msgid "Comment"
|
117 |
+
msgstr "Комментарий"
|
118 |
+
|
119 |
+
#: inc/classCleantalkCommentsListTable.php:26 inc/cleantalk-comments.php:159
|
120 |
+
msgid "In Response To"
|
121 |
+
msgstr "В ответ на"
|
122 |
+
|
123 |
+
#: inc/classCleantalkCommentsListTable.php:33
|
124 |
+
msgid "No spam comments."
|
125 |
+
msgstr "Нет спам комментариев."
|
126 |
+
|
127 |
+
#: inc/cleantalk-admin.php:27
|
128 |
+
#, php-format
|
129 |
+
msgid "Find spam %s"
|
130 |
+
msgstr "Найти спам %s"
|
131 |
+
|
132 |
+
#: inc/cleantalk-admin.php:31
|
133 |
+
msgid "CleanTalk Anti-Spam Log"
|
134 |
+
msgstr "CleanTalk Anti-Spam лог"
|
135 |
+
|
136 |
+
#: inc/cleantalk-admin.php:50
|
137 |
#, php-format
|
138 |
msgid "%sRefresh%s"
|
139 |
msgstr "%sОбновить%s"
|
140 |
|
141 |
+
#: inc/cleantalk-admin.php:51
|
142 |
#, php-format
|
143 |
msgid "%sConfigure%s"
|
144 |
msgstr "%sКонфигурация%s"
|
145 |
|
146 |
+
#: inc/cleantalk-admin.php:68
|
147 |
msgid "7 days anti-spam stats"
|
148 |
msgstr "Статистика атак за 7 дней"
|
149 |
|
150 |
+
#: inc/cleantalk-admin.php:72
|
151 |
msgid "Top 5 spam IPs blocked"
|
152 |
msgstr "Топ 5 cамых заблокированных IP"
|
153 |
|
154 |
+
#: inc/cleantalk-admin.php:78
|
155 |
msgid "Get Access key to activate Anti-Spam protection!"
|
156 |
msgstr "Получите ключ доступа для активации спам защиты!"
|
157 |
|
158 |
+
#: inc/cleantalk-admin.php:86
|
159 |
#, php-format
|
160 |
msgid "Something went wrong! Error: \"%s\"."
|
161 |
msgstr "Что-то пошло не так: Ошибка: \"%s\"."
|
162 |
|
163 |
+
#: inc/cleantalk-admin.php:90
|
164 |
msgid "Please, visit your dashboard."
|
165 |
msgstr "Пожалуйста, посетите панель управления."
|
166 |
|
167 |
+
#: inc/cleantalk-admin.php:104
|
168 |
msgid "IP"
|
169 |
msgstr "IP"
|
170 |
|
171 |
+
#: inc/cleantalk-admin.php:105
|
172 |
msgid "Country"
|
173 |
msgstr "Страна"
|
174 |
|
175 |
+
#: inc/cleantalk-admin.php:106
|
176 |
msgid "Block Count"
|
177 |
msgstr "Заблкирован раз"
|
178 |
|
179 |
+
#: inc/cleantalk-admin.php:134
|
180 |
#, php-format
|
181 |
msgid ""
|
182 |
"This is the count from the %s's cloud and could be different to admin bar "
|
186 |
"админ-баре."
|
187 |
|
188 |
#. %s: Number of spam messages
|
189 |
+
#: inc/cleantalk-admin.php:137
|
190 |
#, php-format
|
191 |
msgid ""
|
192 |
"%s%s%s has blocked %s spam for all time. The statistics are automatically "
|
195 |
"%s%s%s заблокировал %s спама за все время. Статистика автоматически "
|
196 |
"обновляется каждый 24 часа."
|
197 |
|
198 |
+
#: inc/cleantalk-admin.php:148 inc/cleantalk-settings.php:544
|
199 |
#, php-format
|
200 |
msgid "Do you like CleanTalk? %sPost your feedback here%s."
|
201 |
msgstr "Вам понравился CleanTalk?%s Напишите свой отзыв здесь%s."
|
202 |
|
203 |
+
#: inc/cleantalk-admin.php:234
|
204 |
msgid "Translate"
|
205 |
msgstr "Перевести"
|
206 |
|
207 |
+
#: inc/cleantalk-admin.php:237
|
208 |
msgid "Start here"
|
209 |
msgstr "Начать здесь"
|
210 |
|
211 |
+
#: inc/cleantalk-admin.php:238
|
212 |
msgid "FAQ"
|
213 |
msgstr "FAQ"
|
214 |
|
215 |
+
#: inc/cleantalk-admin.php:239 inc/cleantalk-admin.php:644
|
216 |
+
#: inc/cleantalk-settings.php:575
|
217 |
msgid "Support"
|
218 |
msgstr "Поддержка"
|
219 |
|
220 |
+
#: inc/cleantalk-admin.php:306 inc/cleantalk-settings.php:523
|
221 |
msgid "Hosting AntiSpam"
|
222 |
msgstr "Hosting AntiSpam"
|
223 |
|
224 |
+
#: inc/cleantalk-admin.php:333
|
225 |
msgid "Failed from timeout. Going to check comments again."
|
226 |
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
227 |
|
228 |
+
#: inc/cleantalk-admin.php:334
|
229 |
msgid "Added"
|
230 |
msgstr "Добавлены"
|
231 |
|
232 |
+
#: inc/cleantalk-admin.php:335 inc/cleantalk-admin.php:386
|
233 |
msgid "Deleted"
|
234 |
msgstr "Удалено"
|
235 |
|
236 |
+
#: inc/cleantalk-admin.php:336
|
237 |
msgid "comments"
|
238 |
msgstr "комментарии"
|
239 |
|
240 |
+
#: inc/cleantalk-admin.php:337
|
241 |
msgid "Delete all spam comments?"
|
242 |
msgstr "Удалить ВСЕ найденные спам-комментарии?"
|
243 |
|
244 |
+
#: inc/cleantalk-admin.php:338
|
245 |
msgid "Delete checked comments?"
|
246 |
msgstr "Удалить отмеченые спам-комментарии?"
|
247 |
|
248 |
+
#: inc/cleantalk-admin.php:339
|
249 |
#, php-format
|
250 |
msgid ""
|
251 |
"Total comments %s. Checked %s. Found %s spam comments. %s bad comments "
|
254 |
"Всего комментариев %s. Проверено %s. Найдено %s спам комментариев. %s плохих "
|
255 |
"комментариев (без IP и Email'а)."
|
256 |
|
257 |
+
#: inc/cleantalk-admin.php:340 inc/cleantalk-admin.php:393
|
258 |
+
#: inc/cleantalk-users.php:531
|
259 |
msgid "Please do backup of WordPress database before delete any accounts!"
|
260 |
msgstr ""
|
261 |
"Пожалуйста, сделайте резервную копию базы данных Wordpress перед удалением "
|
262 |
"аккаунтов."
|
263 |
|
264 |
+
#: inc/cleantalk-admin.php:351
|
|
|
|
|
|
|
|
|
265 |
msgid "The sender has been whitelisted."
|
266 |
msgstr "Отправитель был добавлен в белый список."
|
267 |
|
268 |
+
#: inc/cleantalk-admin.php:352
|
269 |
msgid "The sender has been blacklisted."
|
270 |
msgstr "Отправитель был добавлен в черный список."
|
271 |
|
272 |
+
#: inc/cleantalk-admin.php:353 inc/cleantalk-public.php:3321
|
273 |
#, php-format
|
274 |
msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
|
275 |
msgstr "Обратная связь отправлена в панель управления %sCleanTalk%s."
|
276 |
|
277 |
+
#: inc/cleantalk-admin.php:383
|
278 |
msgid "Failed from timeout. Going to check users again."
|
279 |
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
280 |
|
281 |
+
#: inc/cleantalk-admin.php:384
|
282 |
msgid "Failed from timeout. Going to run a new attempt to delete spam users."
|
283 |
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
284 |
|
285 |
+
#: inc/cleantalk-admin.php:385
|
286 |
msgid "Inserted"
|
287 |
msgstr "Добавлено"
|
288 |
|
289 |
+
#: inc/cleantalk-admin.php:387
|
290 |
msgid "users."
|
291 |
msgstr "пользователей."
|
292 |
|
293 |
+
#: inc/cleantalk-admin.php:388
|
294 |
msgid "Delete all spam users?"
|
295 |
msgstr "Удалить ВСЕХ найденых спам-пользователей?"
|
296 |
|
297 |
+
#: inc/cleantalk-admin.php:389
|
298 |
msgid "Delete checked users?"
|
299 |
msgstr "Удалить отмеченых спам-пользователей?"
|
300 |
|
301 |
+
#: inc/cleantalk-admin.php:392
|
302 |
#, php-format
|
303 |
msgid ""
|
304 |
"Total users %s, checked %s, found %s spam users and %s bad users (without IP "
|
307 |
"Всего пользователей %s, проверено %s, найдено %s спам пользователей и %s "
|
308 |
"плохих пользователей (без IP и Email'а)"
|
309 |
|
310 |
+
#: inc/cleantalk-admin.php:401
|
311 |
msgid "Find spam-users"
|
312 |
msgstr "Найти спам-пользователей"
|
313 |
|
314 |
+
#: inc/cleantalk-admin.php:449
|
315 |
#, php-format
|
316 |
msgid "Unable to get Access key automatically: %s"
|
317 |
msgstr "Невозможно получить ключ автоматически: %s"
|
318 |
|
319 |
+
#: inc/cleantalk-admin.php:450
|
320 |
msgid "Get the Access key"
|
321 |
msgstr "Получить ключ вручную"
|
322 |
|
323 |
+
#: inc/cleantalk-admin.php:459
|
324 |
#, php-format
|
325 |
msgid "Please enter Access Key in %s settings to enable anti spam protection!"
|
326 |
msgstr ""
|
327 |
"Пожалуйста, укажите Ключ доступа в настройках %s для активации защиты от "
|
328 |
"спама!"
|
329 |
|
330 |
+
#: inc/cleantalk-admin.php:469
|
331 |
#, php-format
|
332 |
msgid "%s trial period ends, please upgrade to %s!"
|
333 |
msgstr ""
|
334 |
"%s заканчивается ознакомительный срок пользования антиспам плагином "
|
335 |
"CleanTalk, пожалуйста продлите подключение %s."
|
336 |
|
337 |
+
#: inc/cleantalk-admin.php:481
|
338 |
msgid "RENEW ANTI-SPAM"
|
339 |
msgstr "ПРОДЛИТЬ АНТИСПАМ"
|
340 |
|
341 |
+
#: inc/cleantalk-admin.php:482
|
342 |
msgid "next year"
|
343 |
msgstr "следующий год"
|
344 |
|
345 |
+
#: inc/cleantalk-admin.php:486
|
346 |
#, php-format
|
347 |
msgid "Please renew your anti-spam license for %s."
|
348 |
msgstr "Пожалуйста, продлите свою антиспам-лицензию на %s."
|
349 |
|
350 |
+
#: inc/cleantalk-admin.php:511
|
351 |
msgid "Make it right!"
|
352 |
msgstr "Сделай все правильно!"
|
353 |
|
354 |
+
#: inc/cleantalk-admin.php:513
|
355 |
#, php-format
|
356 |
msgid "%sGet premium%s"
|
357 |
msgstr "%sПолучить премиум%s"
|
358 |
|
359 |
+
#: inc/cleantalk-admin.php:552
|
360 |
msgid "Since"
|
361 |
msgstr "От"
|
362 |
|
363 |
+
#: inc/cleantalk-admin.php:558
|
364 |
msgid ""
|
365 |
"All / Allowed / Blocked submissions. The number of submissions is being "
|
366 |
"counted since CleanTalk plugin installation."
|
367 |
msgstr "Все / Разрешенные / Запрещенные запросы с момента установки CleanTalk."
|
368 |
|
369 |
+
#: inc/cleantalk-admin.php:558
|
370 |
msgid "All"
|
371 |
msgstr "Все"
|
372 |
|
373 |
+
#: inc/cleantalk-admin.php:566
|
374 |
msgid ""
|
375 |
"Allowed / Blocked submissions. The number of submissions for past 24 hours. "
|
376 |
msgstr "Разрешенные / Запрещенные запросы за последние 24 часа."
|
377 |
|
378 |
+
#: inc/cleantalk-admin.php:566
|
379 |
msgid "Day"
|
380 |
msgstr "За день"
|
381 |
|
382 |
+
#: inc/cleantalk-admin.php:572
|
383 |
msgid ""
|
384 |
"All / Blocked events. Access attempts regitred by SpamFireWall counted since "
|
385 |
"the last plugin activation."
|
387 |
"Все / Запрещенные попытки просмотра сайта. Отображет попытки с момента "
|
388 |
"последней активации плагина."
|
389 |
|
390 |
+
#: inc/cleantalk-admin.php:582
|
391 |
msgid ""
|
392 |
"Allowed / Blocked submissions. The number of submissions is being counted "
|
393 |
"since "
|
394 |
msgstr "Разрешенные / Запрещенные попытки."
|
395 |
|
396 |
+
#: inc/cleantalk-admin.php:593
|
397 |
msgid "dashboard"
|
398 |
msgstr "панель управления"
|
399 |
|
400 |
+
#: inc/cleantalk-admin.php:600
|
401 |
msgid "Settings"
|
402 |
msgstr "Настройки"
|
403 |
|
404 |
+
#: inc/cleantalk-admin.php:608
|
405 |
msgid "Bulk spam comments removal tool."
|
406 |
msgstr "Инструмент массового удаления пользователей."
|
407 |
|
408 |
+
#: inc/cleantalk-admin.php:608 inc/cleantalk-settings.php:882
|
409 |
msgid "Check comments for spam"
|
410 |
msgstr "Проверка комментариев"
|
411 |
|
412 |
+
#: inc/cleantalk-admin.php:618 inc/cleantalk-settings.php:885
|
413 |
msgid "Check users for spam"
|
414 |
msgstr "Проверить пользователей на спам"
|
415 |
|
416 |
+
#: inc/cleantalk-admin.php:627
|
417 |
msgid "Reset first counter"
|
418 |
msgstr "Сбросить первый счетчик"
|
419 |
|
420 |
+
#: inc/cleantalk-admin.php:635
|
421 |
msgid "Reset all counters"
|
422 |
msgstr "Сбросить все счетчики"
|
423 |
|
424 |
+
#: inc/cleantalk-comments.php:221 inc/cleantalk-users.php:220
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
msgid "Approve"
|
426 |
msgstr "Одобрить"
|
427 |
|
428 |
+
#: inc/cleantalk-comments.php:223 inc/cleantalk-users.php:222
|
429 |
msgid "Delete"
|
430 |
msgstr "Удалить"
|
431 |
|
432 |
+
#: inc/cleantalk-comments.php:265
|
433 |
msgid "Delete all comments from the list"
|
434 |
msgstr "Удалить все сообщения в списке"
|
435 |
|
436 |
+
#: inc/cleantalk-comments.php:266 inc/cleantalk-users.php:268
|
437 |
msgid "Delete selected"
|
438 |
msgstr "Удалить отмеченные"
|
439 |
|
440 |
+
#: inc/cleantalk-comments.php:270
|
441 |
msgid "Insert comments"
|
442 |
msgstr "Добавить комментарии"
|
443 |
|
444 |
+
#: inc/cleantalk-comments.php:271
|
445 |
msgid "Delete comments"
|
446 |
msgstr "Удалить тестовые спам-комментарии?"
|
447 |
|
448 |
+
#: inc/cleantalk-comments.php:276 inc/cleantalk-users.php:279
|
449 |
msgid ""
|
450 |
"There is some differencies between blacklists database and our API "
|
451 |
"mechanisms. Blacklists shows all history of spam activity, but our API (that "
|
462 |
"ничего странного, если некоторые письма/IP не будут обнаружены при этой "
|
463 |
"проверке."
|
464 |
|
465 |
+
#: inc/cleantalk-comments.php:281 inc/cleantalk-users.php:284
|
466 |
msgid "Stop deletion"
|
467 |
msgstr "Остановить удаление"
|
468 |
|
469 |
+
#: inc/cleantalk-comments.php:495
|
470 |
+
#, php-format
|
471 |
+
msgid ""
|
472 |
+
"Total comments %s. Checked %s. Last check %s. Found %s spam comments. %s bad "
|
473 |
+
"comments (without IP or email)."
|
474 |
+
msgstr ""
|
475 |
+
"Всего комментариев %s. Проверено %s. Последняя проверка %s. Найдено %s спам-"
|
476 |
+
"комментариев. %s плохие комментарии (без IP или электронной почты)."
|
477 |
+
|
478 |
+
#: inc/cleantalk-comments.php:499
|
479 |
msgid "Please do backup of WordPress database before delete any comments!"
|
480 |
msgstr ""
|
481 |
"Пожалуйста, сделайте резервную копию базы данных Wordpress перед удалением "
|
482 |
"комментариев."
|
483 |
|
484 |
+
#: inc/cleantalk-public.php:500 inc/cleantalk-public.php:641
|
485 |
+
#: inc/cleantalk-public.php:743 inc/cleantalk-public.php:2363
|
486 |
+
#: inc/cleantalk-public.php:3052
|
487 |
msgid "Spam protection by CleanTalk"
|
488 |
msgstr "Спам защита CleanTalk"
|
489 |
|
490 |
+
#: inc/cleantalk-public.php:1233 inc/cleantalk-public.php:1361
|
491 |
+
#: inc/cleantalk-public.php:1379
|
492 |
msgid "Spam protection"
|
493 |
msgstr "Защита от спама"
|
494 |
|
495 |
+
#: inc/cleantalk-public.php:1332
|
496 |
+
msgid "CleanTalk AntiSpam: This message is possible spam."
|
497 |
+
msgstr "CleanTalk AntiSpam: Это сообщение, возможно, является спамом."
|
|
|
498 |
|
499 |
+
#: inc/cleantalk-public.php:1333
|
500 |
msgid "You could check it in CleanTalk's anti-spam database:"
|
501 |
msgstr "Вы можете проверить это по антиспам-базе CleanTalk:"
|
502 |
|
503 |
+
#: inc/cleantalk-public.php:1569
|
504 |
#, php-format
|
505 |
msgid "Registration approved by %s."
|
506 |
msgstr "Регистрация одобрена %s."
|
507 |
|
508 |
+
#: inc/cleantalk-public.php:1849
|
509 |
msgid "CleanTalk AntiSpam: This registration is spam."
|
510 |
msgstr "CleanTalk AntiSpam: Эта регистрация - спам."
|
511 |
|
512 |
+
#: inc/cleantalk-public.php:1850 inc/cleantalk-public.php:2219
|
513 |
+
#: inc/cleantalk-public.php:2387 inc/cleantalk-public.php:2542
|
514 |
msgid "CleanTalk's anti-spam database:"
|
515 |
msgstr "Антиспам-база CleanTalk:"
|
516 |
|
517 |
+
#: inc/cleantalk-public.php:2218 inc/cleantalk-public.php:2386
|
518 |
+
#: inc/cleantalk-public.php:2541
|
519 |
+
msgid "CleanTalk AntiSpam: This message is spam."
|
520 |
+
msgstr "CleanTalk AntiSpam: Это сообщение - спам."
|
521 |
+
|
522 |
+
#: inc/cleantalk-public.php:2666
|
523 |
msgid "Comment approved. Anti-spam by CleanTalk."
|
524 |
msgstr "Комментарий одобрен. Антиспам от CleanTalk."
|
525 |
|
526 |
+
#: inc/cleantalk-public.php:3219
|
527 |
msgid "Attention, please!"
|
528 |
msgstr "Внимание!"
|
529 |
|
530 |
+
#: inc/cleantalk-public.php:3220
|
531 |
#, php-format
|
532 |
msgid "\"%s\" plugin error on your site \"%s\":"
|
533 |
msgstr "\"%s\" ошибка плагина на сайте \"%s\":"
|
534 |
|
535 |
+
#: inc/cleantalk-public.php:3222
|
536 |
#, php-format
|
537 |
msgid "[%s] \"%s\" error!"
|
538 |
msgstr "[%s] \"%s\" ошибка!"
|
539 |
|
540 |
+
#: inc/cleantalk-public.php:3271
|
541 |
msgid ""
|
542 |
"By using this form you agree with the storage and processing of your data by "
|
543 |
"using the Privacy Policy on this website."
|
545 |
"Используя эту форму, вы соглашаетесь с хранением и обработкой ваших данных, "
|
546 |
"в соответствии с Политикой конфиденциальности на этом сайте."
|
547 |
|
548 |
+
#: inc/cleantalk-public.php:3319
|
549 |
msgid "Error occured while sending feedback."
|
550 |
msgstr "Случилась ошибка при отправке обратной связи."
|
551 |
|
552 |
+
#: inc/cleantalk-public.php:3320
|
553 |
msgid "Feedback wasn't sent. There is no associated request."
|
554 |
msgstr "Обратная связь не была отправлена. Нет связанного запроса."
|
555 |
|
556 |
+
#: inc/cleantalk-public.php:3364
|
557 |
msgid "Sender info"
|
558 |
msgstr "Информация об отправителе"
|
559 |
|
560 |
+
#: inc/cleantalk-public.php:3367
|
561 |
msgid "by"
|
562 |
msgstr " от"
|
563 |
|
564 |
+
#: inc/cleantalk-public.php:3378
|
565 |
msgid "No email"
|
566 |
msgstr "Email отсутствует"
|
567 |
|
568 |
+
#: inc/cleantalk-public.php:3388
|
569 |
msgid "No IP"
|
570 |
msgstr "IP отсутствует"
|
571 |
|
572 |
+
#: inc/cleantalk-public.php:3391
|
573 |
msgid "Mark as spam"
|
574 |
msgstr "Отметить как спам"
|
575 |
|
576 |
+
#: inc/cleantalk-public.php:3392
|
577 |
msgid "Unspam"
|
578 |
msgstr "Вернуть из спама"
|
579 |
|
580 |
+
#: inc/cleantalk-public.php:3394
|
581 |
msgid "Marked as spam."
|
582 |
msgstr "Отмечено как спам."
|
583 |
|
584 |
+
#: inc/cleantalk-public.php:3395
|
585 |
msgid "Marked as not spam."
|
586 |
msgstr "Отмечено как не спам."
|
587 |
|
588 |
+
#: inc/cleantalk-settings.php:96
|
589 |
msgid "SpamFireWall"
|
590 |
msgstr "SpamFireWall"
|
591 |
|
592 |
+
#: inc/cleantalk-settings.php:97
|
593 |
msgid ""
|
594 |
"This option allows to filter spam bots before they access website. Also "
|
595 |
"reduces CPU usage on hosting server and accelerates pages load time."
|
598 |
"Также уменьшает загрузку процессора на хостинге и ускоряет время загрузки "
|
599 |
"страниц."
|
600 |
|
601 |
+
#: inc/cleantalk-settings.php:104
|
602 |
msgid "Forms to protect"
|
603 |
msgstr "Защищаемые формы"
|
604 |
|
605 |
+
#: inc/cleantalk-settings.php:110
|
606 |
msgid "Advanced settings"
|
607 |
msgstr "Продвинутые настройки"
|
608 |
|
609 |
+
#: inc/cleantalk-settings.php:117
|
610 |
msgid "Registration Forms"
|
611 |
msgstr "Формы регистрации"
|
612 |
|
613 |
+
#: inc/cleantalk-settings.php:118
|
614 |
msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
615 |
msgstr "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
616 |
|
617 |
+
#: inc/cleantalk-settings.php:121
|
618 |
msgid "Comments form"
|
619 |
msgstr "Комментарии в блоге"
|
620 |
|
621 |
+
#: inc/cleantalk-settings.php:122
|
622 |
msgid "WordPress, JetPack, WooCommerce."
|
623 |
msgstr "WordPress, JetPack, WooCommerce."
|
624 |
|
625 |
+
#: inc/cleantalk-settings.php:125 inc/cleantalk-settings.php:761
|
626 |
msgid "Contact forms"
|
627 |
msgstr "Контактные формы"
|
628 |
|
629 |
+
#: inc/cleantalk-settings.php:126
|
630 |
msgid ""
|
631 |
"Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
|
632 |
"WordPress Landing Pages, Gravity Forms."
|
634 |
"Contact Form 7, Formidable Forms, Jetpack, Fast Secure Contact Form, "
|
635 |
"WordPress Landing Pages, Gravity Forms."
|
636 |
|
637 |
+
#: inc/cleantalk-settings.php:129 inc/cleantalk-settings.php:762
|
638 |
msgid "Custom contact forms"
|
639 |
msgstr "Произвольные контактные формы"
|
640 |
|
641 |
+
#: inc/cleantalk-settings.php:130
|
642 |
msgid "Anti spam test for any WordPress themes or contacts forms."
|
643 |
msgstr "Защита от спама любой контактной формы или темы."
|
644 |
|
645 |
+
#: inc/cleantalk-settings.php:133 inc/cleantalk-settings.php:775
|
646 |
msgid "WooCommerce checkout form"
|
647 |
msgstr "Форма заказа WooCommerce"
|
648 |
|
649 |
+
#: inc/cleantalk-settings.php:134
|
650 |
msgid "Anti spam test for WooCommerce checkout form."
|
651 |
msgstr "Спам тест для формы заказа WooCommerce"
|
652 |
|
653 |
+
#: inc/cleantalk-settings.php:138
|
654 |
msgid "Spam test for registration during checkout"
|
655 |
msgstr "Регистрация на странице заказа"
|
656 |
|
657 |
+
#: inc/cleantalk-settings.php:139
|
658 |
msgid ""
|
659 |
"Enable anti spam test for registration process which during woocommerce's "
|
660 |
"checkout."
|
662 |
"Включить защиту от спама в регистрациях, которые проходят во время "
|
663 |
"оформления заказа."
|
664 |
|
665 |
+
#: inc/cleantalk-settings.php:145
|
666 |
msgid "Test default Wordpress search form for spam"
|
667 |
msgstr "Стандартная форма поиска Wordpress"
|
668 |
|
669 |
+
#: inc/cleantalk-settings.php:146
|
670 |
+
msgid "Spam protection for Search form."
|
671 |
+
msgstr "Защита от спама для Форм поиска."
|
672 |
+
|
673 |
+
#: inc/cleantalk-settings.php:148
|
674 |
#, php-format
|
675 |
+
msgid "Read more about %sspam protection for Search form%s on our blog."
|
676 |
+
msgstr "Прочтите о %sспам-защите для Форм поиска%s на нашем блоге."
|
|
|
|
|
|
|
|
|
677 |
|
678 |
+
#: inc/cleantalk-settings.php:156
|
679 |
msgid "Protect external forms"
|
680 |
msgstr "Защита внешних форм"
|
681 |
|
682 |
+
#: inc/cleantalk-settings.php:157
|
683 |
msgid ""
|
684 |
"Turn this option on to protect forms on your WordPress that send data to "
|
685 |
"third-part servers (like MailChimp)."
|
687 |
"Включите эту опцию, что бы защитить формы, которые отсылают данные на "
|
688 |
"сторонние ресурсы, например MailChimp."
|
689 |
|
690 |
+
#: inc/cleantalk-settings.php:161
|
691 |
+
msgid "Capture buffer"
|
692 |
+
msgstr "Захват буфера"
|
693 |
+
|
694 |
+
#: inc/cleantalk-settings.php:162
|
695 |
+
msgid ""
|
696 |
+
"This setting gives you more sophisticated and strengthened protection for "
|
697 |
+
"external forms. But it could break plugins which use a buffer like Ninja "
|
698 |
+
"Forms."
|
699 |
+
msgstr ""
|
700 |
+
"Этот параметр дает вам более сложную и усиленную защиту для внешних форм. Но "
|
701 |
+
"это может сломать плагины, которые используют буфер, такой как Ninja Forms."
|
702 |
+
|
703 |
+
#: inc/cleantalk-settings.php:167
|
704 |
msgid "Protect internal forms"
|
705 |
msgstr "Защита внутренних форм"
|
706 |
|
707 |
+
#: inc/cleantalk-settings.php:168
|
708 |
msgid ""
|
709 |
"This option will enable protection for custom (hand-made) AJAX forms with "
|
710 |
"PHP scripts handlers on your WordPress."
|
711 |
msgstr "Эта опция обеспечит защиту созданных вручную форм, использующих AJAX."
|
712 |
|
713 |
+
#: inc/cleantalk-settings.php:175
|
714 |
msgid "Comments and Messages"
|
715 |
msgstr "Комментарии и сообщения"
|
716 |
|
717 |
+
#: inc/cleantalk-settings.php:178
|
718 |
msgid "BuddyPress Private Messages"
|
719 |
msgstr "Личные сообщения buddyPress"
|
720 |
|
721 |
+
#: inc/cleantalk-settings.php:179
|
722 |
msgid "Check buddyPress private messages."
|
723 |
msgstr "Проверять личные сообщения buddyPress "
|
724 |
|
725 |
+
#: inc/cleantalk-settings.php:182
|
726 |
msgid "Don't check trusted user's comments"
|
727 |
msgstr "Не проверять доверенных пользователей"
|
728 |
|
729 |
+
#: inc/cleantalk-settings.php:183
|
730 |
#, php-format
|
731 |
+
msgid "Don't check comments for users with above %d comments."
|
732 |
+
msgstr "Не проверять комментарии пользователей с более %d комментариями."
|
|
|
733 |
|
734 |
+
#: inc/cleantalk-settings.php:186
|
735 |
msgid "Automatically delete spam comments"
|
736 |
msgstr "Автоматически удалять спам-комментарии"
|
737 |
|
738 |
+
#: inc/cleantalk-settings.php:187
|
739 |
#, php-format
|
740 |
msgid "Delete spam comments older than %d days."
|
741 |
msgstr "Удалять комментарии старше %d дней."
|
742 |
|
743 |
+
#: inc/cleantalk-settings.php:190
|
744 |
msgid "Remove links from approved comments"
|
745 |
msgstr "Удалять ссылки из одобреных комментариев"
|
746 |
|
747 |
+
#: inc/cleantalk-settings.php:191
|
748 |
msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
|
749 |
msgstr "Удалять ссылки из одобренных сообщений"
|
750 |
|
751 |
+
#: inc/cleantalk-settings.php:194
|
752 |
msgid "Show links to check Emails, IPs for spam."
|
753 |
msgstr "Отобразить ссылки для проверки Email'ов и IP адресов."
|
754 |
|
755 |
+
#: inc/cleantalk-settings.php:195
|
756 |
msgid ""
|
757 |
"Shows little icon near IP addresses and Emails allowing you to check it via "
|
758 |
"CleanTalk's database. Also allowing you to manage comments from the public "
|
762 |
"через базу данных. Так же позволяет управлять комментариями с публичной "
|
763 |
"страницы записи."
|
764 |
|
765 |
+
#: inc/cleantalk-settings.php:203
|
766 |
msgid "Data Processing"
|
767 |
msgstr "Обработка данных"
|
768 |
|
769 |
+
#: inc/cleantalk-settings.php:206
|
770 |
msgid "Protect logged in Users"
|
771 |
msgstr "Проверять залогиненых пользователей"
|
772 |
|
773 |
+
#: inc/cleantalk-settings.php:207
|
774 |
msgid ""
|
775 |
"Turn this option on to check for spam any submissions (comments, contact "
|
776 |
"forms and etc.) from registered Users."
|
777 |
msgstr "Включите, чтобы проверять зарегистрированных пользователей."
|
778 |
|
779 |
+
#: inc/cleantalk-settings.php:210
|
780 |
msgid "Use AJAX for JavaScript check"
|
781 |
msgstr "Использовать AJAX для проверки JavaScript"
|
782 |
|
783 |
+
#: inc/cleantalk-settings.php:211
|
784 |
msgid ""
|
785 |
"Options helps protect WordPress against spam with any caching plugins. Turn "
|
786 |
"this option on to avoid issues with caching plugins."
|
787 |
msgstr "Данная настройка помогает избежать конфликтов с кеширующими плагинами."
|
788 |
|
789 |
+
#: inc/cleantalk-settings.php:214
|
790 |
+
msgid "Use static keys for JS check."
|
791 |
+
msgstr "Использовать постоянный (статичный) ключ для проверки JS."
|
792 |
+
|
793 |
+
#: inc/cleantalk-settings.php:215
|
794 |
+
msgid ""
|
795 |
+
"Could help if you have cache for AJAX requests and you are dealing with "
|
796 |
+
"false positives. Slightly decreases protection quality. Auto - Static key "
|
797 |
+
"will be used if caching plugin is spotted."
|
798 |
+
msgstr ""
|
799 |
+
"Может помочь, если у вас кешируются запросы AJAX и вы имеете дело с ложными "
|
800 |
+
"срабатываниями. Немного снижает качество защиты. Статический ключ будет "
|
801 |
+
"использоваться автоматически, если обнаружен плагин кэширования."
|
802 |
|
803 |
+
#: inc/cleantalk-settings.php:223
|
804 |
msgid "Check all post data"
|
805 |
msgstr "Проверять все POST-данные"
|
806 |
|
807 |
+
#: inc/cleantalk-settings.php:224
|
808 |
msgid ""
|
809 |
"Check all POST submissions from website visitors. Enable this option if you "
|
810 |
"have spam misses on website."
|
812 |
"Проверять все POST-данные, отправляемые посетителями. Активируйте, если у "
|
813 |
"вас есть спам на сайте."
|
814 |
|
815 |
+
#: inc/cleantalk-settings.php:226
|
816 |
msgid " Or you don`t have records about missed spam here:"
|
817 |
msgstr " Или у вас нет записей о спаме здесь:"
|
818 |
|
819 |
+
#: inc/cleantalk-settings.php:226
|
820 |
msgid "CleanTalk dashboard"
|
821 |
msgstr "панель управления CleanTalk"
|
822 |
|
823 |
+
#: inc/cleantalk-settings.php:229
|
824 |
msgid "СAUTION! Option can catch POST requests in WordPress backend"
|
825 |
msgstr ""
|
826 |
"ВНИМАНИЕ! Опция может перехватывать все POST запросы в панели управления "
|
827 |
"Wordpress. Отключите, если возникают проблемы/ошибки."
|
828 |
|
829 |
+
#: inc/cleantalk-settings.php:232
|
830 |
msgid "Set cookies"
|
831 |
msgstr "Устанавливать куки"
|
832 |
|
833 |
+
#: inc/cleantalk-settings.php:233
|
834 |
msgid ""
|
835 |
"Turn this option off to deny plugin generates any cookies on website front-"
|
836 |
"end. This option is helpful if you use Varnish. But most of contact forms "
|
844 |
"настоятельно рекомендуем не отключать опцию, иначе это может привести к "
|
845 |
"ложному обнаружению спама.</b>"
|
846 |
|
847 |
+
#: inc/cleantalk-settings.php:237
|
848 |
+
msgid "Use alternative mechanism for cookies"
|
849 |
+
msgstr "Использовать альтернативный механизм хранения файлов cookie"
|
850 |
|
851 |
+
#: inc/cleantalk-settings.php:238 inc/cleantalk-settings.php:360
|
852 |
msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
|
853 |
msgstr ""
|
854 |
"Не использовать файлы cookies или PHP-сессии. Собирать данные обо всех типах "
|
855 |
"ботов."
|
856 |
|
857 |
+
#: inc/cleantalk-settings.php:243
|
858 |
msgid "Use SSL"
|
859 |
msgstr "Использовать SSL"
|
860 |
|
861 |
+
#: inc/cleantalk-settings.php:244
|
862 |
msgid "Turn this option on to use encrypted (SSL) connection with servers."
|
863 |
msgstr ""
|
864 |
"Включите эту опцию для использования защищенного (SSL) соединения между "
|
865 |
"серверами."
|
866 |
|
867 |
+
#: inc/cleantalk-settings.php:247
|
868 |
msgid "Use Wordpress HTTP API"
|
869 |
msgstr "Использовать стандартное Wordpress HTTP API"
|
870 |
|
871 |
+
#: inc/cleantalk-settings.php:248
|
872 |
msgid ""
|
873 |
+
"Alternative way to connect the Cloud. Use this if you have connection "
|
874 |
+
"problems."
|
875 |
msgstr ""
|
876 |
+
"Альтернативный способ подключения к CleanTalk Cloud. Используйте, если вы "
|
877 |
+
"имеете проблемы с подключением."
|
878 |
|
879 |
+
#: inc/cleantalk-settings.php:255
|
880 |
+
msgid "Exclusions"
|
881 |
+
msgstr "Исключения"
|
882 |
+
|
883 |
+
#: inc/cleantalk-settings.php:259
|
884 |
+
msgid "URL exclusions"
|
885 |
+
msgstr "Исключения по URL"
|
886 |
+
|
887 |
+
#: inc/cleantalk-settings.php:260
|
888 |
+
msgid "You could type here URL you want to exclude. Use comma as separator."
|
889 |
+
msgstr ""
|
890 |
+
"Вы можете ввести здесь URL, который вы хотите исключить. Используйте запятую "
|
891 |
+
"в качестве разделителя."
|
892 |
+
|
893 |
+
#: inc/cleantalk-settings.php:264
|
894 |
+
msgid "Use Regular Expression in URL Exclusions"
|
895 |
+
msgstr "Использовать регулярное выражение в исключении по URL"
|
896 |
+
|
897 |
+
#: inc/cleantalk-settings.php:268
|
898 |
+
msgid "Field name exclusions"
|
899 |
+
msgstr "Исключение по имени поля"
|
900 |
+
|
901 |
+
#: inc/cleantalk-settings.php:269
|
902 |
+
msgid ""
|
903 |
+
"You could type here fields names you want to exclude. Use comma as separator."
|
904 |
+
msgstr ""
|
905 |
+
"Вы можете ввести здесь имена полей, которые вы хотите исключить. Используйте "
|
906 |
+
"запятую в качестве разделителя."
|
907 |
+
|
908 |
+
#: inc/cleantalk-settings.php:273
|
909 |
+
msgid "Use Regular Expression in Field Exclusions"
|
910 |
+
msgstr "Использовать регулярное выражение в исключении по полю формы."
|
911 |
+
|
912 |
+
#: inc/cleantalk-settings.php:280
|
913 |
+
msgid "Roles which bypass spam test. Hold CTRL to select multiple roles."
|
914 |
+
msgstr ""
|
915 |
+
"Роли, которые обходят проверку на спам. Удерживайте CTRL, чтобы выбрать "
|
916 |
+
"несколько ролей."
|
917 |
+
|
918 |
+
#: inc/cleantalk-settings.php:287
|
919 |
msgid "Admin bar"
|
920 |
msgstr "Админ-бар"
|
921 |
|
922 |
+
#: inc/cleantalk-settings.php:294
|
923 |
msgid "Show statistics in admin bar"
|
924 |
msgstr "Показывать статистику в админбаре"
|
925 |
|
926 |
+
#: inc/cleantalk-settings.php:295
|
927 |
msgid ""
|
928 |
"Show/hide icon in top level menu in WordPress backend. The number of "
|
929 |
"submissions is being counted for past 24 hours."
|
931 |
"Показать/скрыть иконку CleanTalk в админ-баре WordPress. Статистика "
|
932 |
"подсчитывается за последние 24 часа."
|
933 |
|
934 |
+
#: inc/cleantalk-settings.php:299
|
935 |
msgid "Show All-time counter"
|
936 |
msgstr "Счетчик за все время"
|
937 |
|
938 |
+
#: inc/cleantalk-settings.php:300
|
939 |
msgid ""
|
940 |
"Display all-time requests counter in the admin bar. Counter displays number "
|
941 |
"of requests since plugin installation."
|
943 |
"Отображать счетчик запросов за все время в админ-баре. Счетчик показывает "
|
944 |
"записи с момента установки."
|
945 |
|
946 |
+
#: inc/cleantalk-settings.php:305
|
947 |
msgid "Show 24 hours counter"
|
948 |
msgstr "24-х часовой счетчик"
|
949 |
|
950 |
+
#: inc/cleantalk-settings.php:306
|
951 |
msgid ""
|
952 |
"Display daily requests counter in the admin bar. Counter displays number of "
|
953 |
"requests of the past 24 hours."
|
955 |
"Отображать 24-х часовой счетчик запросов в админ-баре. Отображает запросы за "
|
956 |
"последние 24 часа."
|
957 |
|
958 |
+
#: inc/cleantalk-settings.php:311
|
959 |
msgid "SpamFireWall counter"
|
960 |
msgstr "Счетчик SpamFireWall"
|
961 |
|
962 |
+
#: inc/cleantalk-settings.php:312
|
963 |
msgid ""
|
964 |
"Display SpamFireWall requests in the admin bar. Counter displays number of "
|
965 |
"requests since plugin installation."
|
967 |
"Отображать счетчик SpamFireWall запросов в админ-баре. Отображает количество "
|
968 |
"запросов с момента установки плагина."
|
969 |
|
970 |
+
#: inc/cleantalk-settings.php:325
|
971 |
msgid "Collect details about browsers"
|
972 |
msgstr "Собирать данные браузера"
|
973 |
|
974 |
+
#: inc/cleantalk-settings.php:326
|
975 |
msgid ""
|
976 |
"Checking this box you allow plugin store information about screen size and "
|
977 |
"browser plugins of website visitors. The option in a beta state."
|
979 |
"Включая эту опцию, Вы разрешаете плагину хранить информацию о размере экрана "
|
980 |
"и плагинах браузера посетителей. Бета опция."
|
981 |
|
982 |
+
#: inc/cleantalk-settings.php:330
|
983 |
msgid "Send connection reports"
|
984 |
msgstr "Отправлять отчеты о соединении"
|
985 |
|
986 |
+
#: inc/cleantalk-settings.php:331
|
987 |
msgid ""
|
988 |
"Checking this box you allow plugin to send the information about your "
|
989 |
"connection. The option in a beta state."
|
991 |
"Ставя эту галочку вы разрешаете плагину отрпавлять информацию о интернет-"
|
992 |
"соединении. Опция находится на бета-тестировании."
|
993 |
|
994 |
+
#: inc/cleantalk-settings.php:335
|
995 |
msgid "Async JavaScript loading"
|
996 |
msgstr "Асинхронная загрузка JavaScript"
|
997 |
|
998 |
+
#: inc/cleantalk-settings.php:336
|
999 |
msgid ""
|
1000 |
"Use async loading for scripts. Warning: This could reduce filtration quality."
|
1001 |
msgstr ""
|
1002 |
"Использовать асинхронную загрузку JS-скриптов. ВНИМАНИЕ! это может понизить "
|
1003 |
"качество спам-фильтра."
|
1004 |
|
1005 |
+
#: inc/cleantalk-settings.php:340
|
1006 |
msgid "Allow to add GDPR notice via shortcode"
|
1007 |
msgstr "Разрешить добавление GDPR-уведомления с помощью шордкода"
|
1008 |
|
1009 |
+
#: inc/cleantalk-settings.php:341
|
1010 |
msgid ""
|
1011 |
" Adds small checkbox under your website form. To add it you should use the "
|
1012 |
"shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
1014 |
"Добавить не большой чекбокс в форму. Для добавления уведомления вставьте на "
|
1015 |
"странице с формой этот шорткод: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
1016 |
|
1017 |
+
#: inc/cleantalk-settings.php:346
|
1018 |
msgid "GDPR text notice"
|
1019 |
msgstr "Текст GDPR-уведомления"
|
1020 |
|
1021 |
+
#: inc/cleantalk-settings.php:347
|
1022 |
msgid "This text will be added as a description to the GDPR checkbox."
|
1023 |
msgstr "Этот текст будет добавлен к чекбоксу как описание."
|
1024 |
|
1025 |
+
#: inc/cleantalk-settings.php:353
|
1026 |
msgid "Store visited URLs"
|
1027 |
msgstr "Хранить посещенные URL-ы"
|
1028 |
|
1029 |
+
#: inc/cleantalk-settings.php:354
|
1030 |
msgid ""
|
1031 |
"Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
|
1032 |
"form on the site. You can see stored visited URLS for each visitor in your "
|
1037 |
"URL-адреса для каждого посетителя на своей панели инструментов. Включите эту "
|
1038 |
"опцию, чтобы улучшить защиту от спама."
|
1039 |
|
1040 |
+
#: inc/cleantalk-settings.php:359
|
1041 |
msgid "Use cookies less sessions"
|
1042 |
msgstr "Использовать сеансы без cookies"
|
1043 |
|
1044 |
+
#: inc/cleantalk-settings.php:366
|
1045 |
msgid ""
|
1046 |
"Notify users with selected roles about new approved comments. Hold CTRL to "
|
1047 |
"select multiple roles."
|
1049 |
"Уведомлять пользователей с выбранными ролями о новых одобренных комментариях."
|
1050 |
" Удерживайте CTRL для выбора нескольких ролей."
|
1051 |
|
1052 |
+
#: inc/cleantalk-settings.php:367
|
1053 |
#, php-format
|
1054 |
msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
|
1055 |
msgstr "Если включено, переопределяет аналогичные %sнастройки Wordpress%s."
|
1056 |
|
1057 |
+
#: inc/cleantalk-settings.php:380
|
1058 |
+
msgid "Complete deactivation"
|
1059 |
+
msgstr "Полная деактивация"
|
1060 |
+
|
1061 |
+
#: inc/cleantalk-settings.php:381
|
1062 |
+
msgid "Leave no trace in the system after deactivation."
|
1063 |
+
msgstr "Не оставлять следов в системе после деактивации."
|
1064 |
+
|
1065 |
#: inc/cleantalk-settings.php:398
|
1066 |
+
msgid "Enable White Label Mode"
|
1067 |
+
msgstr "Активировать White Label Mode."
|
1068 |
+
|
1069 |
+
#: inc/cleantalk-settings.php:399
|
1070 |
+
#, php-format
|
1071 |
+
msgid "Learn more information %shere%s."
|
1072 |
+
msgstr "Узнать болье информации %sздесь%s"
|
1073 |
+
|
1074 |
+
#: inc/cleantalk-settings.php:404
|
1075 |
+
msgid "Hoster API Key"
|
1076 |
+
msgstr "Хостинг API ключ"
|
1077 |
+
|
1078 |
+
#: inc/cleantalk-settings.php:405
|
1079 |
+
#, php-format
|
1080 |
+
msgid "You can get it in %sCleantalk's Control Panel%s"
|
1081 |
+
msgstr "Вы можете получить это в вашей %sпанели управления CleanTalk%s"
|
1082 |
+
|
1083 |
+
#: inc/cleantalk-settings.php:413
|
1084 |
+
msgid "Plugin name"
|
1085 |
+
msgstr "Наименование плагина"
|
1086 |
+
|
1087 |
+
#: inc/cleantalk-settings.php:414
|
1088 |
+
#, php-format
|
1089 |
+
msgid "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s"
|
1090 |
+
msgstr ""
|
1091 |
+
"Укажите название плагина. Оставьте пустым для названия по умолчанию "
|
1092 |
+
"%sAntispam by Cleantalk%s"
|
1093 |
+
|
1094 |
+
#: inc/cleantalk-settings.php:423
|
1095 |
+
msgid "Allow users to use other key"
|
1096 |
+
msgstr "Позволяет пользователям использовать другой ключ."
|
1097 |
+
|
1098 |
+
#: inc/cleantalk-settings.php:424
|
1099 |
+
msgid ""
|
1100 |
+
"Allow users to use different Access key in their plugin settings on child "
|
1101 |
+
"blogs. They could use different CleanTalk account."
|
1102 |
+
msgstr ""
|
1103 |
+
"Позволяет пользователям использовать разные Ключи доступа в настройках "
|
1104 |
+
"плагина на их дочерних блогах. Они могут использовать разные аккаунты "
|
1105 |
+
"CleanTalk."
|
1106 |
+
|
1107 |
+
#: inc/cleantalk-settings.php:427
|
1108 |
+
msgid ""
|
1109 |
+
"Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key "
|
1110 |
+
"from this constant. Look into wp-config.php"
|
1111 |
+
msgstr ""
|
1112 |
+
"Константа <b>CLEANTALK_ACCESS_KEY</b> установлена. Все дочерние сайты будут "
|
1113 |
+
"использовать ключ доступа из этой контсанты. Смотри в wp-config.php"
|
1114 |
+
|
1115 |
+
#: inc/cleantalk-settings.php:533
|
1116 |
msgid "CleanTalk's tech support:"
|
1117 |
msgstr "Техническия поддержка CleanTalk: "
|
1118 |
|
1119 |
+
#: inc/cleantalk-settings.php:539
|
1120 |
msgid "Plugin Homepage at"
|
1121 |
msgstr "Домашняя страница плагина на"
|
1122 |
|
1123 |
+
#: inc/cleantalk-settings.php:540
|
1124 |
msgid "GDPR compliance"
|
1125 |
msgstr "Соответствие GDPR"
|
1126 |
|
1127 |
+
#: inc/cleantalk-settings.php:541
|
1128 |
msgid "Use s@cleantalk.org to test plugin in any WordPress form."
|
1129 |
msgstr ""
|
1130 |
"Используйте s@cleantalk.org чтобы проверить плагин в любой форме в WordPress."
|
1131 |
|
1132 |
+
#: inc/cleantalk-settings.php:542
|
1133 |
msgid "CleanTalk is registered Trademark. All rights reserved."
|
1134 |
msgstr "CleanTalk - это зарегистрированая торговая марка. Все права защищены."
|
1135 |
|
1136 |
+
#: inc/cleantalk-settings.php:559
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1137 |
#, php-format
|
1138 |
msgid "%s has blocked <b>%s</b> spam."
|
1139 |
msgstr "%s заблокировал <b>%s</b> спама."
|
1140 |
|
1141 |
+
#: inc/cleantalk-settings.php:571
|
1142 |
msgid "Click here to get anti-spam statistics"
|
1143 |
msgstr "Щелкните, чтобы получить статистику"
|
1144 |
|
1145 |
+
#: inc/cleantalk-settings.php:614
|
1146 |
+
#, php-format
|
1147 |
+
msgid "Please, enter the %splugin settings%s in main site dashboard."
|
1148 |
+
msgstr ""
|
1149 |
+
"Пожалуйста, перейдите в %sнастройки плагина%s в панели управления на главном "
|
1150 |
+
"сайте."
|
1151 |
+
|
1152 |
+
#: inc/cleantalk-settings.php:633
|
1153 |
+
msgid "Error occured while API key validating. Error: "
|
1154 |
+
msgstr "Произошла ошибка при проверке ключа API. Ошибка: "
|
1155 |
+
|
1156 |
+
#: inc/cleantalk-settings.php:634
|
1157 |
+
msgid "Error occured while automatically gettings access key. Error: "
|
1158 |
+
msgstr "Произошла ошибка при автоматическом получении ключа доступа. Ошибка: "
|
1159 |
+
|
1160 |
+
#: inc/cleantalk-settings.php:635
|
1161 |
+
msgid "Error occured while sending sending SpamFireWall logs. Error: "
|
1162 |
+
msgstr "Произошла ошибка при отправке логов Spam FireWall. Ошибка: "
|
1163 |
+
|
1164 |
+
#: inc/cleantalk-settings.php:636
|
1165 |
+
msgid "Error occured while updating SpamFireWall local base. Error: "
|
1166 |
+
msgstr "Произошла ошибка при обновлении локальной базы Spam FireWall. Ошибка: "
|
1167 |
+
|
1168 |
+
#: inc/cleantalk-settings.php:637
|
1169 |
+
msgid "Error occured while checking account status. Error: "
|
1170 |
+
msgstr "Произошла ошибка при проверке статуса аккаунта. Ошибка: "
|
1171 |
+
|
1172 |
+
#: inc/cleantalk-settings.php:638
|
1173 |
+
msgid "Error occured while excuting API call. Error: "
|
1174 |
+
msgstr "Произошла ошибка при выполнении вызова API. Ошибка: "
|
1175 |
+
|
1176 |
+
#: inc/cleantalk-settings.php:646
|
1177 |
+
msgid "Unknown error. Error: "
|
1178 |
+
msgstr "Неизвестная ошибка. Ошибка: "
|
1179 |
+
|
1180 |
+
#: inc/cleantalk-settings.php:677
|
1181 |
+
msgid "Errors:"
|
1182 |
+
msgstr "Ошибки: "
|
1183 |
+
|
1184 |
+
#: inc/cleantalk-settings.php:682
|
1185 |
#, php-format
|
1186 |
msgid "You can get support any time here: %s."
|
1187 |
msgstr "Вы всегда можете получить техническую поддержку здесь: %s."
|
1188 |
|
1189 |
+
#: inc/cleantalk-settings.php:757
|
1190 |
msgid "Protection is active"
|
1191 |
msgstr "Защита включена"
|
1192 |
|
1193 |
+
#: inc/cleantalk-settings.php:759
|
1194 |
msgid "Registration forms"
|
1195 |
msgstr "Регистрации пользователей"
|
1196 |
|
1197 |
+
#: inc/cleantalk-settings.php:760
|
1198 |
msgid "Comments forms"
|
1199 |
msgstr "Формы комментариев"
|
1200 |
|
1201 |
+
#: inc/cleantalk-settings.php:765
|
1202 |
msgid "Validate email for existence"
|
1203 |
msgstr "Проверка e-mail на существование"
|
1204 |
|
1205 |
+
#: inc/cleantalk-settings.php:769
|
1206 |
msgid "Auto update"
|
1207 |
msgstr "Автообновлние"
|
1208 |
|
1209 |
+
#: inc/cleantalk-settings.php:793
|
1210 |
+
msgid "<h3>Key is provided by Super Admin.</h3>"
|
1211 |
+
msgstr "<h3>Ключ доступа предоставлен Супер Администратором.</h3>"
|
1212 |
|
1213 |
+
#: inc/cleantalk-settings.php:797
|
1214 |
msgid "Access key"
|
1215 |
msgstr "Ключ доступа"
|
1216 |
|
1217 |
+
#: inc/cleantalk-settings.php:812
|
1218 |
msgid "Enter the key"
|
1219 |
msgstr "Введите ключ"
|
1220 |
|
1221 |
+
#: inc/cleantalk-settings.php:818
|
1222 |
#, php-format
|
1223 |
msgid "Account at cleantalk.org is %s."
|
1224 |
msgstr "Аккаунт на cleantalk.org %s."
|
1225 |
|
1226 |
+
#: inc/cleantalk-settings.php:827
|
1227 |
+
msgid "Show the access key"
|
1228 |
+
msgstr "Показать ключ доступа"
|
1229 |
+
|
1230 |
+
#: inc/cleantalk-settings.php:838
|
1231 |
msgid "Get Access Key Automatically"
|
1232 |
msgstr "Получить ключ доступа автоматически"
|
1233 |
|
1234 |
+
#: inc/cleantalk-settings.php:846
|
1235 |
#, php-format
|
1236 |
msgid ""
|
1237 |
"Admin e-mail (%s) will be used for registration, if you want to use other "
|
1241 |
"использовать другой e-mail, пожлуйста, %sполучите ключ доступа "
|
1242 |
"самостоятельно%s."
|
1243 |
|
1244 |
+
#: inc/cleantalk-settings.php:862
|
1245 |
+
#, php-format
|
1246 |
+
msgid "I accept %sLicense Agreement%s."
|
1247 |
+
msgstr "Я принимаю %sЛицензионно Соглашение%s."
|
1248 |
|
1249 |
+
#: inc/cleantalk-settings.php:888
|
1250 |
msgid "Statistics & Reports"
|
1251 |
msgstr "Статистика и отчеты"
|
1252 |
|
1253 |
+
#: inc/cleantalk-settings.php:904
|
1254 |
#, php-format
|
1255 |
msgid "Last spam check request to %s server was at %s."
|
1256 |
msgstr "Последний запрос проверки спама на сервере %s был произведен %s."
|
1257 |
|
1258 |
+
#: inc/cleantalk-settings.php:905 inc/cleantalk-settings.php:906
|
1259 |
+
#: inc/cleantalk-settings.php:915 inc/cleantalk-settings.php:922
|
1260 |
+
#: inc/cleantalk-settings.php:923 inc/cleantalk-settings.php:931
|
1261 |
+
#: inc/cleantalk-settings.php:932 inc/cleantalk-settings.php:939
|
1262 |
+
#: inc/cleantalk-settings.php:940
|
1263 |
msgid "unknown"
|
1264 |
msgstr "неизвестно"
|
1265 |
|
1266 |
+
#: inc/cleantalk-settings.php:912
|
1267 |
#, php-format
|
1268 |
msgid "Average request time for past 7 days: %s seconds."
|
1269 |
msgstr "Среднее время запроса за последние 7 дней: %s секунд."
|
1270 |
|
1271 |
+
#: inc/cleantalk-settings.php:921
|
1272 |
#, php-format
|
1273 |
msgid "Last time SpamFireWall was triggered for %s IP at %s"
|
1274 |
msgstr "В последний раз SpamFireWall сработал на %s IP %s"
|
1275 |
|
1276 |
+
#: inc/cleantalk-settings.php:930
|
1277 |
#, php-format
|
1278 |
msgid "SpamFireWall was updated %s. Now contains %s entries."
|
1279 |
msgstr "SpamFireWall был обновлен %s. Содержится %s записей."
|
1280 |
|
1281 |
+
#: inc/cleantalk-settings.php:938
|
1282 |
#, php-format
|
1283 |
msgid "SpamFireWall sent %s events at %s."
|
1284 |
msgstr "SpamFireWall отправил %s событий %s."
|
1285 |
|
1286 |
+
#: inc/cleantalk-settings.php:948
|
1287 |
msgid "There are no failed connections to server."
|
1288 |
msgstr "Проблем с подключением к серверу нет."
|
1289 |
|
1290 |
+
#: inc/cleantalk-settings.php:975
|
1291 |
msgid "Send report"
|
1292 |
msgstr "Отправить отчет"
|
1293 |
|
1294 |
+
#: inc/cleantalk-settings.php:979
|
1295 |
msgid ""
|
1296 |
"Please, enable \"Send connection reports\" setting to be able to send reports"
|
1297 |
msgstr ""
|
1298 |
"Пожалуйста, активируйте опцию \"Отправлять отчеты о соединении\" для "
|
1299 |
"возможности отправлять отчеты."
|
1300 |
|
1301 |
+
#: inc/cleantalk-settings.php:1327
|
|
|
|
|
|
|
|
|
1302 |
msgid "Testing is failed. Please check the Access key."
|
1303 |
msgstr "Ошибка тестирования. Пожалуйста, проверьте ключ доступа."
|
1304 |
|
1305 |
+
#: inc/cleantalk-settings.php:1442
|
1306 |
+
msgid "XSS check"
|
1307 |
+
msgstr "Проверка XSS уязвимости"
|
1308 |
+
|
1309 |
+
#: inc/cleantalk-settings.php:1443
|
1310 |
+
msgid ""
|
1311 |
+
"Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to "
|
1312 |
+
"any user. As a result malicious scripts can not get access to the cookie "
|
1313 |
+
"files, session tokens and any other confidential information browsers use "
|
1314 |
+
"and store. Such scripts can even overwrite content of HTML pages. CleanTalk "
|
1315 |
+
"WAF monitors for patterns of these parameters and block them."
|
1316 |
+
msgstr ""
|
1317 |
+
"Межсайтовый скриптинг (XSS) - предотвращает выполнение / отправку "
|
1318 |
+
"вредоносного кода любому пользователю. В результате вредоносные сценарии не "
|
1319 |
+
"могут получить доступ к файлам cookie, токенам сеансов и любой другой "
|
1320 |
+
"конфиденциальной информации, которую используют и хранят браузеры. Такие "
|
1321 |
+
"сценарии могут даже перезаписывать содержимое HTML-страниц. CleanTalk WAF "
|
1322 |
+
"отслеживает шаблоны этих параметров и блокирует их."
|
1323 |
+
|
1324 |
+
#: inc/cleantalk-settings.php:1446
|
1325 |
+
msgid "SQL-injection check"
|
1326 |
+
msgstr "Проверка на наличие SQL-injection"
|
1327 |
+
|
1328 |
+
#: inc/cleantalk-settings.php:1447
|
1329 |
+
msgid ""
|
1330 |
+
"SQL Injection — one of the most popular ways to hack websites and programs "
|
1331 |
+
"that work with databases. It is based on injection of a custom SQL code into "
|
1332 |
+
"database queries. It could transmit data through GET, POST requests or "
|
1333 |
+
"cookie files in an SQL code. If a website is vulnerable and execute such "
|
1334 |
+
"injections then it would allow attackers to apply changes to the website's "
|
1335 |
+
"MySQL database."
|
1336 |
+
msgstr ""
|
1337 |
+
"SQL-инъекция - один из самых популярных способов взлома сайтов и программ, "
|
1338 |
+
"работающих с базами данных. Он основан на внедрении пользовательского кода "
|
1339 |
+
"SQL в запросы к базе данных. Он может передавать данные через запросы GET, "
|
1340 |
+
"POST или файлы cookie в коде SQL. Если веб-сайт уязвим и выполняет такие "
|
1341 |
+
"инъекции, это позволит злоумышленникам применить изменения к базе данных "
|
1342 |
+
"MySQL веб-сайта."
|
1343 |
+
|
1344 |
+
#: inc/cleantalk-settings.php:1450
|
1345 |
+
msgid "Check uploaded files"
|
1346 |
+
msgstr "Проверка загруженных файлов"
|
1347 |
+
|
1348 |
+
#: inc/cleantalk-settings.php:1451
|
1349 |
+
msgid ""
|
1350 |
+
"The option checks each uploaded file to a website for malicious code. If "
|
1351 |
+
"it's possible for visitors to upload files to a website, for instance a work "
|
1352 |
+
"resume, then attackers could abuse it and upload an infected file to execute "
|
1353 |
+
"it later and get access to your website."
|
1354 |
+
msgstr ""
|
1355 |
+
"Опция проверяет каждый загруженный файл на веб-сайт на наличие вредоносного "
|
1356 |
+
"кода. Если посетители могут загружать на сайт файлы, например, резюме, то "
|
1357 |
+
"злоумышленники могут злоупотреблять им и загружать зараженный файл, чтобы "
|
1358 |
+
"выполнить его позднее и получить доступ к вашему сайту."
|
1359 |
|
1360 |
#: inc/cleantalk-users.php:15
|
1361 |
msgid "Find spam users"
|
1365 |
msgid "Please wait for a while. CleanTalk is deleting spam users. Users left: "
|
1366 |
msgstr "Пожалуйста, подождите. CleanTalk удаляет спам-пользователей. Осталось:"
|
1367 |
|
1368 |
+
#: inc/cleantalk-users.php:79
|
1369 |
+
msgid ""
|
1370 |
+
"The plugin will check all users against blacklists database and show you "
|
1371 |
+
"senders that have spam activity on other websites."
|
1372 |
+
msgstr ""
|
1373 |
+
"Плагин проверит всех пользователей по базе данных чёрных списков и покажет "
|
1374 |
+
"отправителей, которые занимаются спамом на других сайтах."
|
1375 |
+
|
1376 |
+
#: inc/cleantalk-users.php:84
|
1377 |
+
msgid ""
|
1378 |
+
"Allows to use user's dates to perform more accurate check. Could seriously "
|
1379 |
+
"slow down the check."
|
1380 |
+
msgstr ""
|
1381 |
+
"Позволяет использовать даты пользователей для выполения более тщательной "
|
1382 |
+
"проверки. Может серьезно замедлить проверку."
|
1383 |
+
|
1384 |
+
#: inc/cleantalk-users.php:108
|
1385 |
msgid ""
|
1386 |
"Please wait for a while. CleanTalk is checking all users via blacklist "
|
1387 |
"database at cleantalk.org. You will have option to delete found spam users "
|
1391 |
"спискам на cleantalk.org. У вас появится возможность удалить обнаруженных "
|
1392 |
"спам-пользователей как только плагин закончит."
|
1393 |
|
1394 |
+
#: inc/cleantalk-users.php:267
|
1395 |
msgid "Delete all users from list"
|
1396 |
msgstr "Удалить всех пользователей в списке"
|
1397 |
|
1398 |
+
#: inc/cleantalk-users.php:269
|
1399 |
msgid "Download results in CSV"
|
1400 |
msgstr "Загрузить результаты (CSV)"
|
1401 |
|
1402 |
+
#: inc/cleantalk-users.php:273
|
1403 |
msgid "Insert accounts"
|
1404 |
msgstr "Добавить аккаунты"
|
1405 |
|
1406 |
+
#: inc/cleantalk-users.php:274
|
1407 |
msgid "Delete accounts"
|
1408 |
msgstr "Удалить тестовые спам-аккаунты"
|
1409 |
|
1410 |
+
#: inc/cleantalk-users.php:527
|
1411 |
+
#, php-format
|
1412 |
+
msgid ""
|
1413 |
+
"Total users %s, checked %s, last check %s, found %s spam users and %s bad "
|
1414 |
+
"users (without IP or email)"
|
1415 |
+
msgstr ""
|
1416 |
+
"Всего пользователей %s, проверено %s, последняя проверка %s, найдено %s спам-"
|
1417 |
+
"пользователей и %s плохих пользователей (без IP или электронной почты)"
|
1418 |
+
|
1419 |
#: inc/cleantalk-widget.php:22
|
1420 |
msgid "CleanTalk Widget"
|
1421 |
msgstr "Виджет CleanTalk"
|
1468 |
msgid "Referal link ID:"
|
1469 |
msgstr "ID партнера:"
|
1470 |
|
1471 |
+
#: lib/CleantalkSFW.php:71
|
1472 |
msgid "SpamFireWall is activated for your IP "
|
1473 |
msgstr "Спам Фаервол заблокировал ваш IP"
|
1474 |
|
1475 |
+
#: lib/CleantalkSFW.php:72
|
1476 |
msgid ""
|
1477 |
"To continue working with web site, please make sure that you have enabled "
|
1478 |
"JavaScript."
|
1480 |
"Что бы продолжить работу с сайтом, пожалуйста, убедитесь что у вас включен "
|
1481 |
"JavaScript."
|
1482 |
|
1483 |
+
#: lib/CleantalkSFW.php:73
|
1484 |
msgid "Please click below to pass protection,"
|
1485 |
msgstr "Пожалуйста, нажмите, чтобы пройти защиту,"
|
1486 |
|
1487 |
+
#: lib/CleantalkSFW.php:74
|
1488 |
#, php-format
|
1489 |
msgid ""
|
1490 |
"Or you will be automatically redirected to the requested page after %d "
|
1493 |
"Или вы будете автоматически переадресованы на запрашиваемую страницу через "
|
1494 |
"%d секунд."
|
1495 |
|
1496 |
+
#: lib/CleantalkSFW.php:75
|
1497 |
msgid "Antispam by CleanTalk"
|
1498 |
msgstr "Антиспам от CleanTalk"
|
1499 |
|
1500 |
+
#: lib/CleantalkSFW.php:76
|
1501 |
msgid "This is the testing page for SpamFireWall"
|
1502 |
msgstr "Это тестовая страница SpamFireWall"
|
1503 |
|
i18n/cleantalk.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
6 |
-
"POT-Creation-Date: 2019-
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: \n"
|
9 |
"Language-Team: \n"
|
@@ -21,50 +21,148 @@ msgstr ""
|
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
"Language: "
|
23 |
|
24 |
-
#: inc/cleantalk-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
#, php-format
|
26 |
msgid "%sRefresh%s"
|
27 |
msgstr ""
|
28 |
|
29 |
-
#: inc/cleantalk-admin.php:
|
30 |
#, php-format
|
31 |
msgid "%sConfigure%s"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: inc/cleantalk-admin.php:
|
35 |
msgid "7 days anti-spam stats"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: inc/cleantalk-admin.php:
|
39 |
msgid "Top 5 spam IPs blocked"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: inc/cleantalk-admin.php:
|
43 |
msgid "Get Access key to activate Anti-Spam protection!"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: inc/cleantalk-admin.php:
|
47 |
#, php-format
|
48 |
msgid "Something went wrong! Error: \"%s\"."
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: inc/cleantalk-admin.php:
|
52 |
msgid "Please, visit your dashboard."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: inc/cleantalk-admin.php:
|
56 |
msgid "IP"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: inc/cleantalk-admin.php:
|
60 |
msgid "Country"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: inc/cleantalk-admin.php:
|
64 |
msgid "Block Count"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: inc/cleantalk-admin.php:
|
68 |
#, php-format
|
69 |
msgid ""
|
70 |
"This is the count from the %s's cloud and could be different to admin bar "
|
@@ -72,328 +170,252 @@ msgid ""
|
|
72 |
msgstr ""
|
73 |
|
74 |
#. %s: Number of spam messages
|
75 |
-
#: inc/cleantalk-admin.php:
|
76 |
#, php-format
|
77 |
msgid ""
|
78 |
"%s%s%s has blocked %s spam for all time. The statistics are automatically "
|
79 |
"updated every 24 hours."
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: inc/cleantalk-admin.php:
|
83 |
#, php-format
|
84 |
msgid "Do you like CleanTalk? %sPost your feedback here%s."
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: inc/cleantalk-admin.php:
|
88 |
msgid "Translate"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: inc/cleantalk-admin.php:
|
92 |
msgid "Start here"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: inc/cleantalk-admin.php:
|
96 |
msgid "FAQ"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: inc/cleantalk-admin.php:
|
100 |
-
#: inc/cleantalk-settings.php:
|
101 |
msgid "Support"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: inc/cleantalk-admin.php:
|
105 |
msgid "Hosting AntiSpam"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: inc/cleantalk-admin.php:
|
109 |
msgid "Failed from timeout. Going to check comments again."
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: inc/cleantalk-admin.php:
|
113 |
msgid "Added"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: inc/cleantalk-admin.php:
|
117 |
msgid "Deleted"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: inc/cleantalk-admin.php:
|
121 |
msgid "comments"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: inc/cleantalk-admin.php:
|
125 |
msgid "Delete all spam comments?"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: inc/cleantalk-admin.php:
|
129 |
msgid "Delete checked comments?"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: inc/cleantalk-admin.php:
|
133 |
#, php-format
|
134 |
msgid ""
|
135 |
"Total comments %s. Checked %s. Found %s spam comments. %s bad comments "
|
136 |
"(without IP or email)."
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: inc/cleantalk-admin.php:
|
140 |
-
#: inc/cleantalk-users.php:
|
141 |
msgid "Please do backup of WordPress database before delete any accounts!"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: inc/cleantalk-admin.php:
|
145 |
-
msgid "Find spam-comments"
|
146 |
-
msgstr ""
|
147 |
-
|
148 |
-
#: inc/cleantalk-admin.php:316
|
149 |
msgid "The sender has been whitelisted."
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: inc/cleantalk-admin.php:
|
153 |
msgid "The sender has been blacklisted."
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: inc/cleantalk-admin.php:
|
157 |
#, php-format
|
158 |
msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: inc/cleantalk-admin.php:
|
162 |
msgid "Failed from timeout. Going to check users again."
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: inc/cleantalk-admin.php:
|
166 |
msgid "Failed from timeout. Going to run a new attempt to delete spam users."
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: inc/cleantalk-admin.php:
|
170 |
msgid "Inserted"
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: inc/cleantalk-admin.php:
|
174 |
msgid "users."
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: inc/cleantalk-admin.php:
|
178 |
msgid "Delete all spam users?"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: inc/cleantalk-admin.php:
|
182 |
msgid "Delete checked users?"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: inc/cleantalk-admin.php:
|
186 |
#, php-format
|
187 |
msgid ""
|
188 |
"Total users %s, checked %s, found %s spam users and %s bad users (without IP "
|
189 |
"or email)"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: inc/cleantalk-admin.php:
|
193 |
msgid "Find spam-users"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: inc/cleantalk-admin.php:
|
197 |
#, php-format
|
198 |
msgid "Unable to get Access key automatically: %s"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: inc/cleantalk-admin.php:
|
202 |
msgid "Get the Access key"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: inc/cleantalk-admin.php:
|
206 |
#, php-format
|
207 |
msgid "Please enter Access Key in %s settings to enable anti spam protection!"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: inc/cleantalk-admin.php:
|
211 |
#, php-format
|
212 |
msgid "%s trial period ends, please upgrade to %s!"
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: inc/cleantalk-admin.php:
|
216 |
msgid "RENEW ANTI-SPAM"
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: inc/cleantalk-admin.php:
|
220 |
msgid "next year"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: inc/cleantalk-admin.php:
|
224 |
#, php-format
|
225 |
msgid "Please renew your anti-spam license for %s."
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: inc/cleantalk-admin.php:
|
229 |
msgid "Make it right!"
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: inc/cleantalk-admin.php:
|
233 |
#, php-format
|
234 |
msgid "%sGet premium%s"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: inc/cleantalk-admin.php:
|
238 |
msgid "Since"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: inc/cleantalk-admin.php:
|
242 |
msgid ""
|
243 |
"All / Allowed / Blocked submissions. The number of submissions is being "
|
244 |
"counted since CleanTalk plugin installation."
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: inc/cleantalk-admin.php:
|
248 |
msgid "All"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: inc/cleantalk-admin.php:
|
252 |
msgid ""
|
253 |
"Allowed / Blocked submissions. The number of submissions for past 24 hours. "
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: inc/cleantalk-admin.php:
|
257 |
msgid "Day"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: inc/cleantalk-admin.php:
|
261 |
msgid ""
|
262 |
"All / Blocked events. Access attempts regitred by SpamFireWall counted since "
|
263 |
"the last plugin activation."
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: inc/cleantalk-admin.php:
|
267 |
msgid ""
|
268 |
"Allowed / Blocked submissions. The number of submissions is being counted "
|
269 |
"since "
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: inc/cleantalk-admin.php:
|
273 |
msgid "dashboard"
|
274 |
msgstr ""
|
275 |
|
276 |
-
#: inc/cleantalk-admin.php:
|
277 |
msgid "Settings"
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: inc/cleantalk-admin.php:
|
281 |
msgid "Bulk spam comments removal tool."
|
282 |
msgstr ""
|
283 |
|
284 |
-
#: inc/cleantalk-admin.php:
|
285 |
msgid "Check comments for spam"
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: inc/cleantalk-admin.php:
|
289 |
msgid "Check users for spam"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: inc/cleantalk-admin.php:
|
293 |
msgid "Reset first counter"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: inc/cleantalk-admin.php:
|
297 |
msgid "Reset all counters"
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: inc/cleantalk-comments.php:
|
301 |
-
msgid "Check for spam"
|
302 |
-
msgstr ""
|
303 |
-
|
304 |
-
#: inc/cleantalk-comments.php:14
|
305 |
-
msgid "Find spam comments"
|
306 |
-
msgstr ""
|
307 |
-
|
308 |
-
#: inc/cleantalk-comments.php:24 inc/cleantalk-users.php:25
|
309 |
-
msgid "Plugin Settings"
|
310 |
-
msgstr ""
|
311 |
-
|
312 |
-
#: inc/cleantalk-comments.php:33 inc/cleantalk-users.php:34
|
313 |
-
#, php-format
|
314 |
-
msgid ""
|
315 |
-
"Antispam hosting tariff does not allow you to use this feature. To do so, "
|
316 |
-
"you need to enter an Access Key in the %splugin settings%s."
|
317 |
-
msgstr ""
|
318 |
-
|
319 |
-
#: inc/cleantalk-comments.php:58 inc/cleantalk-users.php:60
|
320 |
-
msgid ""
|
321 |
-
"Ajax error. Process will be automatically restarted in 3 seconds. Status: "
|
322 |
-
msgstr ""
|
323 |
-
|
324 |
-
#: inc/cleantalk-comments.php:65
|
325 |
-
msgid ""
|
326 |
-
"Please wait for a while. CleanTalk is deleting spam comments. Comments left: "
|
327 |
-
msgstr ""
|
328 |
-
|
329 |
-
#: inc/cleantalk-comments.php:75 inc/cleantalk-users.php:77
|
330 |
-
msgid "Start check"
|
331 |
-
msgstr ""
|
332 |
-
|
333 |
-
#: inc/cleantalk-comments.php:76 inc/cleantalk-users.php:78
|
334 |
-
msgid "Continue check"
|
335 |
-
msgstr ""
|
336 |
-
|
337 |
-
#: inc/cleantalk-comments.php:77 inc/cleantalk-users.php:79
|
338 |
-
msgid ""
|
339 |
-
"The plugin will check all comments against blacklists database and show you "
|
340 |
-
"senders that have spam activity on other websites."
|
341 |
-
msgstr ""
|
342 |
-
|
343 |
-
#: inc/cleantalk-comments.php:80 inc/cleantalk-users.php:82
|
344 |
-
msgid "Accurate check"
|
345 |
-
msgstr ""
|
346 |
-
|
347 |
-
#: inc/cleantalk-comments.php:82 inc/cleantalk-users.php:84
|
348 |
-
msgid ""
|
349 |
-
"Allows to use comment's dates to perform more accurate check. Could "
|
350 |
-
"seriously slow down the check."
|
351 |
-
msgstr ""
|
352 |
-
|
353 |
-
#: inc/cleantalk-comments.php:85 inc/cleantalk-users.php:87
|
354 |
-
msgid "Specify date range"
|
355 |
-
msgstr ""
|
356 |
-
|
357 |
-
#: inc/cleantalk-comments.php:103
|
358 |
-
msgid ""
|
359 |
-
"Please wait! CleanTalk is checking all approved and pending comments via "
|
360 |
-
"blacklist database at cleantalk.org. You will have option to delete found "
|
361 |
-
"spam comments after plugin finish."
|
362 |
-
msgstr ""
|
363 |
-
|
364 |
-
#: inc/cleantalk-comments.php:153
|
365 |
-
msgid "Comment"
|
366 |
-
msgstr ""
|
367 |
-
|
368 |
-
#: inc/cleantalk-comments.php:154
|
369 |
-
msgid "In Response To"
|
370 |
-
msgstr ""
|
371 |
-
|
372 |
-
#: inc/cleantalk-comments.php:216 inc/cleantalk-users.php:217
|
373 |
msgid "Approve"
|
374 |
msgstr ""
|
375 |
|
376 |
-
#: inc/cleantalk-comments.php:
|
377 |
msgid "Delete"
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: inc/cleantalk-comments.php:
|
381 |
msgid "Delete all comments from the list"
|
382 |
msgstr ""
|
383 |
|
384 |
-
#: inc/cleantalk-comments.php:
|
385 |
msgid "Delete selected"
|
386 |
msgstr ""
|
387 |
|
388 |
-
#: inc/cleantalk-comments.php:
|
389 |
msgid "Insert comments"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: inc/cleantalk-comments.php:
|
393 |
msgid "Delete comments"
|
394 |
msgstr ""
|
395 |
|
396 |
-
#: inc/cleantalk-comments.php:
|
397 |
msgid ""
|
398 |
"There is some differencies between blacklists database and our API "
|
399 |
"mechanisms. Blacklists shows all history of spam activity, but our API (that "
|
@@ -403,316 +425,348 @@ msgid ""
|
|
403 |
"emails/IPs will be not found by this checking."
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: inc/cleantalk-comments.php:
|
407 |
msgid "Stop deletion"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: inc/cleantalk-comments.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
msgid "Please do backup of WordPress database before delete any comments!"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: inc/cleantalk-public.php:
|
415 |
-
#: inc/cleantalk-public.php:
|
|
|
416 |
msgid "Spam protection by CleanTalk"
|
417 |
msgstr ""
|
418 |
|
419 |
-
#: inc/cleantalk-public.php:
|
420 |
-
#: inc/cleantalk-public.php:
|
421 |
msgid "Spam protection"
|
422 |
msgstr ""
|
423 |
|
424 |
-
#: inc/cleantalk-public.php:
|
425 |
-
|
426 |
-
msgid "CleanTalk AntiSpam: This message is spam."
|
427 |
msgstr ""
|
428 |
|
429 |
-
#: inc/cleantalk-public.php:
|
430 |
msgid "You could check it in CleanTalk's anti-spam database:"
|
431 |
msgstr ""
|
432 |
|
433 |
-
#: inc/cleantalk-public.php:
|
434 |
#, php-format
|
435 |
msgid "Registration approved by %s."
|
436 |
msgstr ""
|
437 |
|
438 |
-
#: inc/cleantalk-public.php:
|
439 |
msgid "CleanTalk AntiSpam: This registration is spam."
|
440 |
msgstr ""
|
441 |
|
442 |
-
#: inc/cleantalk-public.php:
|
443 |
-
#: inc/cleantalk-public.php:
|
444 |
msgid "CleanTalk's anti-spam database:"
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: inc/cleantalk-public.php:
|
|
|
|
|
|
|
|
|
|
|
448 |
msgid "Comment approved. Anti-spam by CleanTalk."
|
449 |
msgstr ""
|
450 |
|
451 |
-
#: inc/cleantalk-public.php:
|
452 |
msgid "Attention, please!"
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: inc/cleantalk-public.php:
|
456 |
#, php-format
|
457 |
msgid "\"%s\" plugin error on your site \"%s\":"
|
458 |
msgstr ""
|
459 |
|
460 |
-
#: inc/cleantalk-public.php:
|
461 |
#, php-format
|
462 |
msgid "[%s] \"%s\" error!"
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: inc/cleantalk-public.php:
|
466 |
msgid ""
|
467 |
"By using this form you agree with the storage and processing of your data by "
|
468 |
"using the Privacy Policy on this website."
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: inc/cleantalk-public.php:
|
472 |
msgid "Error occured while sending feedback."
|
473 |
msgstr ""
|
474 |
|
475 |
-
#: inc/cleantalk-public.php:
|
476 |
msgid "Feedback wasn't sent. There is no associated request."
|
477 |
msgstr ""
|
478 |
|
479 |
-
#: inc/cleantalk-public.php:
|
480 |
msgid "Sender info"
|
481 |
msgstr ""
|
482 |
|
483 |
-
#: inc/cleantalk-public.php:
|
484 |
msgid "by"
|
485 |
msgstr ""
|
486 |
|
487 |
-
#: inc/cleantalk-public.php:
|
488 |
msgid "No email"
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: inc/cleantalk-public.php:
|
492 |
msgid "No IP"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: inc/cleantalk-public.php:
|
496 |
msgid "Mark as spam"
|
497 |
msgstr ""
|
498 |
|
499 |
-
#: inc/cleantalk-public.php:
|
500 |
msgid "Unspam"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#: inc/cleantalk-public.php:
|
504 |
msgid "Marked as spam."
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: inc/cleantalk-public.php:
|
508 |
msgid "Marked as not spam."
|
509 |
msgstr ""
|
510 |
|
511 |
-
#: inc/cleantalk-settings.php:
|
512 |
msgid "SpamFireWall"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: inc/cleantalk-settings.php:
|
516 |
msgid ""
|
517 |
"This option allows to filter spam bots before they access website. Also "
|
518 |
"reduces CPU usage on hosting server and accelerates pages load time."
|
519 |
msgstr ""
|
520 |
|
521 |
-
#: inc/cleantalk-settings.php:
|
522 |
msgid "Forms to protect"
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: inc/cleantalk-settings.php:
|
526 |
msgid "Advanced settings"
|
527 |
msgstr ""
|
528 |
|
529 |
-
#: inc/cleantalk-settings.php:
|
530 |
msgid "Registration Forms"
|
531 |
msgstr ""
|
532 |
|
533 |
-
#: inc/cleantalk-settings.php:
|
534 |
msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
535 |
msgstr ""
|
536 |
|
537 |
-
#: inc/cleantalk-settings.php:
|
538 |
msgid "Comments form"
|
539 |
msgstr ""
|
540 |
|
541 |
-
#: inc/cleantalk-settings.php:
|
542 |
msgid "WordPress, JetPack, WooCommerce."
|
543 |
msgstr ""
|
544 |
|
545 |
-
#: inc/cleantalk-settings.php:
|
546 |
msgid "Contact forms"
|
547 |
msgstr ""
|
548 |
|
549 |
-
#: inc/cleantalk-settings.php:
|
550 |
msgid ""
|
551 |
"Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
|
552 |
"WordPress Landing Pages, Gravity Forms."
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: inc/cleantalk-settings.php:
|
556 |
msgid "Custom contact forms"
|
557 |
msgstr ""
|
558 |
|
559 |
-
#: inc/cleantalk-settings.php:
|
560 |
msgid "Anti spam test for any WordPress themes or contacts forms."
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: inc/cleantalk-settings.php:
|
564 |
msgid "WooCommerce checkout form"
|
565 |
msgstr ""
|
566 |
|
567 |
-
#: inc/cleantalk-settings.php:
|
568 |
msgid "Anti spam test for WooCommerce checkout form."
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: inc/cleantalk-settings.php:
|
572 |
msgid "Spam test for registration during checkout"
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: inc/cleantalk-settings.php:
|
576 |
msgid ""
|
577 |
"Enable anti spam test for registration process which during woocommerce's "
|
578 |
"checkout."
|
579 |
msgstr ""
|
580 |
|
581 |
-
#: inc/cleantalk-settings.php:
|
582 |
msgid "Test default Wordpress search form for spam"
|
583 |
msgstr ""
|
584 |
|
585 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
586 |
#, php-format
|
587 |
-
msgid ""
|
588 |
-
"Spam protection for Search form. Read more about %sspam protection for "
|
589 |
-
"Search form%s on our blog."
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: inc/cleantalk-settings.php:
|
593 |
msgid "Protect external forms"
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: inc/cleantalk-settings.php:
|
597 |
msgid ""
|
598 |
"Turn this option on to protect forms on your WordPress that send data to "
|
599 |
"third-part servers (like MailChimp)."
|
600 |
msgstr ""
|
601 |
|
602 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
msgid "Protect internal forms"
|
604 |
msgstr ""
|
605 |
|
606 |
-
#: inc/cleantalk-settings.php:
|
607 |
msgid ""
|
608 |
"This option will enable protection for custom (hand-made) AJAX forms with "
|
609 |
"PHP scripts handlers on your WordPress."
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: inc/cleantalk-settings.php:
|
613 |
msgid "Comments and Messages"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: inc/cleantalk-settings.php:
|
617 |
msgid "BuddyPress Private Messages"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: inc/cleantalk-settings.php:
|
621 |
msgid "Check buddyPress private messages."
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: inc/cleantalk-settings.php:
|
625 |
msgid "Don't check trusted user's comments"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: inc/cleantalk-settings.php:
|
629 |
#, php-format
|
630 |
-
msgid "Don't check comments for users with above % comments."
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: inc/cleantalk-settings.php:
|
634 |
msgid "Automatically delete spam comments"
|
635 |
msgstr ""
|
636 |
|
637 |
-
#: inc/cleantalk-settings.php:
|
638 |
#, php-format
|
639 |
msgid "Delete spam comments older than %d days."
|
640 |
msgstr ""
|
641 |
|
642 |
-
#: inc/cleantalk-settings.php:
|
643 |
msgid "Remove links from approved comments"
|
644 |
msgstr ""
|
645 |
|
646 |
-
#: inc/cleantalk-settings.php:
|
647 |
msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
|
648 |
msgstr ""
|
649 |
|
650 |
-
#: inc/cleantalk-settings.php:
|
651 |
msgid "Show links to check Emails, IPs for spam."
|
652 |
msgstr ""
|
653 |
|
654 |
-
#: inc/cleantalk-settings.php:
|
655 |
msgid ""
|
656 |
"Shows little icon near IP addresses and Emails allowing you to check it via "
|
657 |
"CleanTalk's database. Also allowing you to manage comments from the public "
|
658 |
"post's page."
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: inc/cleantalk-settings.php:
|
662 |
msgid "Data Processing"
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: inc/cleantalk-settings.php:
|
666 |
msgid "Protect logged in Users"
|
667 |
msgstr ""
|
668 |
|
669 |
-
#: inc/cleantalk-settings.php:
|
670 |
msgid ""
|
671 |
"Turn this option on to check for spam any submissions (comments, contact "
|
672 |
"forms and etc.) from registered Users."
|
673 |
msgstr ""
|
674 |
|
675 |
-
#: inc/cleantalk-settings.php:
|
676 |
msgid "Use AJAX for JavaScript check"
|
677 |
msgstr ""
|
678 |
|
679 |
-
#: inc/cleantalk-settings.php:
|
680 |
msgid ""
|
681 |
"Options helps protect WordPress against spam with any caching plugins. Turn "
|
682 |
"this option on to avoid issues with caching plugins."
|
683 |
msgstr ""
|
684 |
|
685 |
-
#: inc/cleantalk-settings.php:
|
686 |
-
msgid "
|
687 |
msgstr ""
|
688 |
|
689 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
msgid "Check all post data"
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: inc/cleantalk-settings.php:
|
694 |
msgid ""
|
695 |
"Check all POST submissions from website visitors. Enable this option if you "
|
696 |
"have spam misses on website."
|
697 |
msgstr ""
|
698 |
|
699 |
-
#: inc/cleantalk-settings.php:
|
700 |
msgid " Or you don`t have records about missed spam here:"
|
701 |
msgstr ""
|
702 |
|
703 |
-
#: inc/cleantalk-settings.php:
|
704 |
msgid "CleanTalk dashboard"
|
705 |
msgstr ""
|
706 |
|
707 |
-
#: inc/cleantalk-settings.php:
|
708 |
msgid "СAUTION! Option can catch POST requests in WordPress backend"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: inc/cleantalk-settings.php:
|
712 |
msgid "Set cookies"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: inc/cleantalk-settings.php:
|
716 |
msgid ""
|
717 |
"Turn this option off to deny plugin generates any cookies on website front-"
|
718 |
"end. This option is helpful if you use Varnish. But most of contact forms "
|
@@ -721,307 +775,452 @@ msgid ""
|
|
721 |
"detection.</b>"
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: inc/cleantalk-settings.php:
|
725 |
-
msgid "Use alternative mechanism for cookies
|
726 |
msgstr ""
|
727 |
|
728 |
-
#: inc/cleantalk-settings.php:
|
729 |
msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
|
730 |
msgstr ""
|
731 |
|
732 |
-
#: inc/cleantalk-settings.php:
|
733 |
msgid "Use SSL"
|
734 |
msgstr ""
|
735 |
|
736 |
-
#: inc/cleantalk-settings.php:
|
737 |
msgid "Turn this option on to use encrypted (SSL) connection with servers."
|
738 |
msgstr ""
|
739 |
|
740 |
-
#: inc/cleantalk-settings.php:
|
741 |
msgid "Use Wordpress HTTP API"
|
742 |
msgstr ""
|
743 |
|
744 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
msgid ""
|
746 |
-
"
|
747 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
msgstr ""
|
749 |
|
750 |
-
#: inc/cleantalk-settings.php:
|
751 |
msgid "Admin bar"
|
752 |
msgstr ""
|
753 |
|
754 |
-
#: inc/cleantalk-settings.php:
|
755 |
msgid "Show statistics in admin bar"
|
756 |
msgstr ""
|
757 |
|
758 |
-
#: inc/cleantalk-settings.php:
|
759 |
msgid ""
|
760 |
"Show/hide icon in top level menu in WordPress backend. The number of "
|
761 |
"submissions is being counted for past 24 hours."
|
762 |
msgstr ""
|
763 |
|
764 |
-
#: inc/cleantalk-settings.php:
|
765 |
msgid "Show All-time counter"
|
766 |
msgstr ""
|
767 |
|
768 |
-
#: inc/cleantalk-settings.php:
|
769 |
msgid ""
|
770 |
"Display all-time requests counter in the admin bar. Counter displays number "
|
771 |
"of requests since plugin installation."
|
772 |
msgstr ""
|
773 |
|
774 |
-
#: inc/cleantalk-settings.php:
|
775 |
msgid "Show 24 hours counter"
|
776 |
msgstr ""
|
777 |
|
778 |
-
#: inc/cleantalk-settings.php:
|
779 |
msgid ""
|
780 |
"Display daily requests counter in the admin bar. Counter displays number of "
|
781 |
"requests of the past 24 hours."
|
782 |
msgstr ""
|
783 |
|
784 |
-
#: inc/cleantalk-settings.php:
|
785 |
msgid "SpamFireWall counter"
|
786 |
msgstr ""
|
787 |
|
788 |
-
#: inc/cleantalk-settings.php:
|
789 |
msgid ""
|
790 |
"Display SpamFireWall requests in the admin bar. Counter displays number of "
|
791 |
"requests since plugin installation."
|
792 |
msgstr ""
|
793 |
|
794 |
-
#: inc/cleantalk-settings.php:
|
795 |
msgid "Collect details about browsers"
|
796 |
msgstr ""
|
797 |
|
798 |
-
#: inc/cleantalk-settings.php:
|
799 |
msgid ""
|
800 |
"Checking this box you allow plugin store information about screen size and "
|
801 |
"browser plugins of website visitors. The option in a beta state."
|
802 |
msgstr ""
|
803 |
|
804 |
-
#: inc/cleantalk-settings.php:
|
805 |
msgid "Send connection reports"
|
806 |
msgstr ""
|
807 |
|
808 |
-
#: inc/cleantalk-settings.php:
|
809 |
msgid ""
|
810 |
"Checking this box you allow plugin to send the information about your "
|
811 |
"connection. The option in a beta state."
|
812 |
msgstr ""
|
813 |
|
814 |
-
#: inc/cleantalk-settings.php:
|
815 |
msgid "Async JavaScript loading"
|
816 |
msgstr ""
|
817 |
|
818 |
-
#: inc/cleantalk-settings.php:
|
819 |
msgid ""
|
820 |
"Use async loading for scripts. Warning: This could reduce filtration quality."
|
821 |
msgstr ""
|
822 |
|
823 |
-
#: inc/cleantalk-settings.php:
|
824 |
msgid "Allow to add GDPR notice via shortcode"
|
825 |
msgstr ""
|
826 |
|
827 |
-
#: inc/cleantalk-settings.php:
|
828 |
msgid ""
|
829 |
" Adds small checkbox under your website form. To add it you should use the "
|
830 |
"shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
831 |
msgstr ""
|
832 |
|
833 |
-
#: inc/cleantalk-settings.php:
|
834 |
msgid "GDPR text notice"
|
835 |
msgstr ""
|
836 |
|
837 |
-
#: inc/cleantalk-settings.php:
|
838 |
msgid "This text will be added as a description to the GDPR checkbox."
|
839 |
msgstr ""
|
840 |
|
841 |
-
#: inc/cleantalk-settings.php:
|
842 |
msgid "Store visited URLs"
|
843 |
msgstr ""
|
844 |
|
845 |
-
#: inc/cleantalk-settings.php:
|
846 |
msgid ""
|
847 |
"Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
|
848 |
"form on the site. You can see stored visited URLS for each visitor in your "
|
849 |
"Dashboard. Turn the option on to improve Anti-Spam protection."
|
850 |
msgstr ""
|
851 |
|
852 |
-
#: inc/cleantalk-settings.php:
|
853 |
msgid "Use cookies less sessions"
|
854 |
msgstr ""
|
855 |
|
856 |
-
#: inc/cleantalk-settings.php:
|
857 |
msgid ""
|
858 |
"Notify users with selected roles about new approved comments. Hold CTRL to "
|
859 |
"select multiple roles."
|
860 |
msgstr ""
|
861 |
|
862 |
-
#: inc/cleantalk-settings.php:
|
863 |
#, php-format
|
864 |
msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
|
865 |
msgstr ""
|
866 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
867 |
#: inc/cleantalk-settings.php:398
|
868 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
869 |
msgstr ""
|
870 |
|
871 |
#: inc/cleantalk-settings.php:404
|
872 |
-
msgid "
|
873 |
msgstr ""
|
874 |
|
875 |
#: inc/cleantalk-settings.php:405
|
876 |
-
|
|
|
877 |
msgstr ""
|
878 |
|
879 |
-
#: inc/cleantalk-settings.php:
|
880 |
-
msgid "
|
881 |
msgstr ""
|
882 |
|
883 |
-
#: inc/cleantalk-settings.php:
|
884 |
-
|
|
|
885 |
msgstr ""
|
886 |
|
887 |
-
#: inc/cleantalk-settings.php:
|
888 |
-
|
889 |
-
|
|
|
|
|
|
|
|
|
|
|
890 |
msgstr ""
|
891 |
|
892 |
#: inc/cleantalk-settings.php:427
|
893 |
msgid ""
|
894 |
-
"
|
895 |
-
"
|
896 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
897 |
msgstr ""
|
898 |
|
899 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
900 |
#, php-format
|
901 |
msgid "%s has blocked <b>%s</b> spam."
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: inc/cleantalk-settings.php:
|
905 |
msgid "Click here to get anti-spam statistics"
|
906 |
msgstr ""
|
907 |
|
908 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
909 |
#, php-format
|
910 |
msgid "You can get support any time here: %s."
|
911 |
msgstr ""
|
912 |
|
913 |
-
#: inc/cleantalk-settings.php:
|
914 |
msgid "Protection is active"
|
915 |
msgstr ""
|
916 |
|
917 |
-
#: inc/cleantalk-settings.php:
|
918 |
msgid "Registration forms"
|
919 |
msgstr ""
|
920 |
|
921 |
-
#: inc/cleantalk-settings.php:
|
922 |
msgid "Comments forms"
|
923 |
msgstr ""
|
924 |
|
925 |
-
#: inc/cleantalk-settings.php:
|
926 |
msgid "Validate email for existence"
|
927 |
msgstr ""
|
928 |
|
929 |
-
#: inc/cleantalk-settings.php:
|
930 |
msgid "Auto update"
|
931 |
msgstr ""
|
932 |
|
933 |
-
#: inc/cleantalk-settings.php:
|
934 |
-
msgid "<h3>Key is provided by Super Admin
|
935 |
msgstr ""
|
936 |
|
937 |
-
#: inc/cleantalk-settings.php:
|
938 |
msgid "Access key"
|
939 |
msgstr ""
|
940 |
|
941 |
-
#: inc/cleantalk-settings.php:
|
942 |
msgid "Enter the key"
|
943 |
msgstr ""
|
944 |
|
945 |
-
#: inc/cleantalk-settings.php:
|
946 |
#, php-format
|
947 |
msgid "Account at cleantalk.org is %s."
|
948 |
msgstr ""
|
949 |
|
950 |
-
#: inc/cleantalk-settings.php:
|
|
|
|
|
|
|
|
|
951 |
msgid "Get Access Key Automatically"
|
952 |
msgstr ""
|
953 |
|
954 |
-
#: inc/cleantalk-settings.php:
|
955 |
#, php-format
|
956 |
msgid ""
|
957 |
"Admin e-mail (%s) will be used for registration, if you want to use other "
|
958 |
"email please %sGet Access Key Manually%s."
|
959 |
msgstr ""
|
960 |
|
961 |
-
#: inc/cleantalk-settings.php:
|
962 |
-
|
|
|
963 |
msgstr ""
|
964 |
|
965 |
-
#: inc/cleantalk-settings.php:
|
966 |
msgid "Statistics & Reports"
|
967 |
msgstr ""
|
968 |
|
969 |
-
#: inc/cleantalk-settings.php:
|
970 |
#, php-format
|
971 |
msgid "Last spam check request to %s server was at %s."
|
972 |
msgstr ""
|
973 |
|
974 |
-
#: inc/cleantalk-settings.php:
|
975 |
-
#: inc/cleantalk-settings.php:
|
976 |
-
#: inc/cleantalk-settings.php:
|
977 |
-
#: inc/cleantalk-settings.php:
|
978 |
-
#: inc/cleantalk-settings.php:
|
979 |
msgid "unknown"
|
980 |
msgstr ""
|
981 |
|
982 |
-
#: inc/cleantalk-settings.php:
|
983 |
#, php-format
|
984 |
msgid "Average request time for past 7 days: %s seconds."
|
985 |
msgstr ""
|
986 |
|
987 |
-
#: inc/cleantalk-settings.php:
|
988 |
#, php-format
|
989 |
msgid "Last time SpamFireWall was triggered for %s IP at %s"
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: inc/cleantalk-settings.php:
|
993 |
#, php-format
|
994 |
msgid "SpamFireWall was updated %s. Now contains %s entries."
|
995 |
msgstr ""
|
996 |
|
997 |
-
#: inc/cleantalk-settings.php:
|
998 |
#, php-format
|
999 |
msgid "SpamFireWall sent %s events at %s."
|
1000 |
msgstr ""
|
1001 |
|
1002 |
-
#: inc/cleantalk-settings.php:
|
1003 |
msgid "There are no failed connections to server."
|
1004 |
msgstr ""
|
1005 |
|
1006 |
-
#: inc/cleantalk-settings.php:
|
1007 |
msgid "Send report"
|
1008 |
msgstr ""
|
1009 |
|
1010 |
-
#: inc/cleantalk-settings.php:
|
1011 |
msgid ""
|
1012 |
"Please, enable \"Send connection reports\" setting to be able to send reports"
|
1013 |
msgstr ""
|
1014 |
|
1015 |
-
#: inc/cleantalk-settings.php:
|
1016 |
-
msgid "
|
1017 |
msgstr ""
|
1018 |
|
1019 |
-
#: inc/cleantalk-settings.php:
|
1020 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
msgstr ""
|
1022 |
|
1023 |
-
#: inc/cleantalk-settings.php:
|
1024 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1025 |
msgstr ""
|
1026 |
|
1027 |
#: inc/cleantalk-users.php:15
|
@@ -1032,29 +1231,48 @@ msgstr ""
|
|
1032 |
msgid "Please wait for a while. CleanTalk is deleting spam users. Users left: "
|
1033 |
msgstr ""
|
1034 |
|
1035 |
-
#: inc/cleantalk-users.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1036 |
msgid ""
|
1037 |
"Please wait for a while. CleanTalk is checking all users via blacklist "
|
1038 |
"database at cleantalk.org. You will have option to delete found spam users "
|
1039 |
"after plugin finish."
|
1040 |
msgstr ""
|
1041 |
|
1042 |
-
#: inc/cleantalk-users.php:
|
1043 |
msgid "Delete all users from list"
|
1044 |
msgstr ""
|
1045 |
|
1046 |
-
#: inc/cleantalk-users.php:
|
1047 |
msgid "Download results in CSV"
|
1048 |
msgstr ""
|
1049 |
|
1050 |
-
#: inc/cleantalk-users.php:
|
1051 |
msgid "Insert accounts"
|
1052 |
msgstr ""
|
1053 |
|
1054 |
-
#: inc/cleantalk-users.php:
|
1055 |
msgid "Delete accounts"
|
1056 |
msgstr ""
|
1057 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1058 |
#: inc/cleantalk-widget.php:22
|
1059 |
msgid "CleanTalk Widget"
|
1060 |
msgstr ""
|
@@ -1107,32 +1325,32 @@ msgstr ""
|
|
1107 |
msgid "Referal link ID:"
|
1108 |
msgstr ""
|
1109 |
|
1110 |
-
#: lib/CleantalkSFW.php:
|
1111 |
msgid "SpamFireWall is activated for your IP "
|
1112 |
msgstr ""
|
1113 |
|
1114 |
-
#: lib/CleantalkSFW.php:
|
1115 |
msgid ""
|
1116 |
"To continue working with web site, please make sure that you have enabled "
|
1117 |
"JavaScript."
|
1118 |
msgstr ""
|
1119 |
|
1120 |
-
#: lib/CleantalkSFW.php:
|
1121 |
msgid "Please click below to pass protection,"
|
1122 |
msgstr ""
|
1123 |
|
1124 |
-
#: lib/CleantalkSFW.php:
|
1125 |
#, php-format
|
1126 |
msgid ""
|
1127 |
"Or you will be automatically redirected to the requested page after %d "
|
1128 |
"seconds."
|
1129 |
msgstr ""
|
1130 |
|
1131 |
-
#: lib/CleantalkSFW.php:
|
1132 |
msgid "Antispam by CleanTalk"
|
1133 |
msgstr ""
|
1134 |
|
1135 |
-
#: lib/CleantalkSFW.php:
|
1136 |
msgid "This is the testing page for SpamFireWall"
|
1137 |
msgstr ""
|
1138 |
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
6 |
+
"POT-Creation-Date: 2019-10-27 16:02+0000\n"
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: \n"
|
9 |
"Language-Team: \n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
"Language: "
|
23 |
|
24 |
+
#: inc/classCleantalkComments.php:32 inc/cleantalk-comments.php:16
|
25 |
+
#: inc/cleantalk-users.php:15
|
26 |
+
msgid "Check for spam"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: inc/classCleantalkComments.php:33 inc/cleantalk-admin.php:350
|
30 |
+
#: inc/cleantalk-comments.php:16
|
31 |
+
msgid "Find spam comments"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: inc/classCleantalkComments.php:66 inc/cleantalk-comments.php:26
|
35 |
+
#: inc/cleantalk-users.php:25
|
36 |
+
msgid "Plugin Settings"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: inc/classCleantalkComments.php:76 inc/cleantalk-comments.php:35
|
40 |
+
#: inc/cleantalk-users.php:34
|
41 |
+
#, php-format
|
42 |
+
msgid ""
|
43 |
+
"Antispam hosting tariff does not allow you to use this feature. To do so, "
|
44 |
+
"you need to enter an Access Key in the %splugin settings%s."
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: inc/classCleantalkComments.php:101 inc/cleantalk-comments.php:60
|
48 |
+
#: inc/cleantalk-users.php:60
|
49 |
+
msgid ""
|
50 |
+
"Ajax error. Process will be automatically restarted in 3 seconds. Status: "
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: inc/classCleantalkComments.php:108 inc/cleantalk-comments.php:67
|
54 |
+
msgid ""
|
55 |
+
"Please wait for a while. CleanTalk is deleting spam comments. Comments left: "
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: inc/classCleantalkComments.php:118 inc/cleantalk-comments.php:77
|
59 |
+
#: inc/cleantalk-users.php:77
|
60 |
+
msgid "Start check"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: inc/classCleantalkComments.php:119 inc/cleantalk-comments.php:78
|
64 |
+
#: inc/cleantalk-users.php:78
|
65 |
+
msgid "Continue check"
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: inc/classCleantalkComments.php:120 inc/cleantalk-comments.php:79
|
69 |
+
msgid ""
|
70 |
+
"The plugin will check all comments against blacklists database and show you "
|
71 |
+
"senders that have spam activity on other websites."
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: inc/classCleantalkComments.php:123 inc/cleantalk-comments.php:82
|
75 |
+
#: inc/cleantalk-users.php:82
|
76 |
+
msgid "Accurate check"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: inc/classCleantalkComments.php:125 inc/cleantalk-comments.php:84
|
80 |
+
msgid ""
|
81 |
+
"Allows to use comment's dates to perform more accurate check. Could "
|
82 |
+
"seriously slow down the check."
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: inc/classCleantalkComments.php:128 inc/cleantalk-comments.php:87
|
86 |
+
#: inc/cleantalk-users.php:87
|
87 |
+
msgid "Specify date range"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#: inc/classCleantalkComments.php:149 inc/cleantalk-comments.php:108
|
91 |
+
msgid ""
|
92 |
+
"Please wait! CleanTalk is checking all approved and pending comments via "
|
93 |
+
"blacklist database at cleantalk.org. You will have option to delete found "
|
94 |
+
"spam comments after plugin finish."
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: inc/classCleantalkCommentsListTable.php:24
|
98 |
+
msgid "Author"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: inc/classCleantalkCommentsListTable.php:25 inc/cleantalk-comments.php:158
|
102 |
+
msgid "Comment"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: inc/classCleantalkCommentsListTable.php:26 inc/cleantalk-comments.php:159
|
106 |
+
msgid "In Response To"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: inc/classCleantalkCommentsListTable.php:33
|
110 |
+
msgid "No spam comments."
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: inc/cleantalk-admin.php:27
|
114 |
+
#, php-format
|
115 |
+
msgid "Find spam %s"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: inc/cleantalk-admin.php:31
|
119 |
+
msgid "CleanTalk Anti-Spam Log"
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: inc/cleantalk-admin.php:50
|
123 |
#, php-format
|
124 |
msgid "%sRefresh%s"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: inc/cleantalk-admin.php:51
|
128 |
#, php-format
|
129 |
msgid "%sConfigure%s"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: inc/cleantalk-admin.php:68
|
133 |
msgid "7 days anti-spam stats"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: inc/cleantalk-admin.php:72
|
137 |
msgid "Top 5 spam IPs blocked"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: inc/cleantalk-admin.php:78
|
141 |
msgid "Get Access key to activate Anti-Spam protection!"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: inc/cleantalk-admin.php:86
|
145 |
#, php-format
|
146 |
msgid "Something went wrong! Error: \"%s\"."
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: inc/cleantalk-admin.php:90
|
150 |
msgid "Please, visit your dashboard."
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: inc/cleantalk-admin.php:104
|
154 |
msgid "IP"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: inc/cleantalk-admin.php:105
|
158 |
msgid "Country"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: inc/cleantalk-admin.php:106
|
162 |
msgid "Block Count"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: inc/cleantalk-admin.php:134
|
166 |
#, php-format
|
167 |
msgid ""
|
168 |
"This is the count from the %s's cloud and could be different to admin bar "
|
170 |
msgstr ""
|
171 |
|
172 |
#. %s: Number of spam messages
|
173 |
+
#: inc/cleantalk-admin.php:137
|
174 |
#, php-format
|
175 |
msgid ""
|
176 |
"%s%s%s has blocked %s spam for all time. The statistics are automatically "
|
177 |
"updated every 24 hours."
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: inc/cleantalk-admin.php:148 inc/cleantalk-settings.php:544
|
181 |
#, php-format
|
182 |
msgid "Do you like CleanTalk? %sPost your feedback here%s."
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: inc/cleantalk-admin.php:234
|
186 |
msgid "Translate"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: inc/cleantalk-admin.php:237
|
190 |
msgid "Start here"
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: inc/cleantalk-admin.php:238
|
194 |
msgid "FAQ"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: inc/cleantalk-admin.php:239 inc/cleantalk-admin.php:644
|
198 |
+
#: inc/cleantalk-settings.php:575
|
199 |
msgid "Support"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: inc/cleantalk-admin.php:306 inc/cleantalk-settings.php:523
|
203 |
msgid "Hosting AntiSpam"
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: inc/cleantalk-admin.php:333
|
207 |
msgid "Failed from timeout. Going to check comments again."
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: inc/cleantalk-admin.php:334
|
211 |
msgid "Added"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: inc/cleantalk-admin.php:335 inc/cleantalk-admin.php:386
|
215 |
msgid "Deleted"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: inc/cleantalk-admin.php:336
|
219 |
msgid "comments"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: inc/cleantalk-admin.php:337
|
223 |
msgid "Delete all spam comments?"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: inc/cleantalk-admin.php:338
|
227 |
msgid "Delete checked comments?"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: inc/cleantalk-admin.php:339
|
231 |
#, php-format
|
232 |
msgid ""
|
233 |
"Total comments %s. Checked %s. Found %s spam comments. %s bad comments "
|
234 |
"(without IP or email)."
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: inc/cleantalk-admin.php:340 inc/cleantalk-admin.php:393
|
238 |
+
#: inc/cleantalk-users.php:531
|
239 |
msgid "Please do backup of WordPress database before delete any accounts!"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: inc/cleantalk-admin.php:351
|
|
|
|
|
|
|
|
|
243 |
msgid "The sender has been whitelisted."
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: inc/cleantalk-admin.php:352
|
247 |
msgid "The sender has been blacklisted."
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: inc/cleantalk-admin.php:353 inc/cleantalk-public.php:3321
|
251 |
#, php-format
|
252 |
msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: inc/cleantalk-admin.php:383
|
256 |
msgid "Failed from timeout. Going to check users again."
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: inc/cleantalk-admin.php:384
|
260 |
msgid "Failed from timeout. Going to run a new attempt to delete spam users."
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: inc/cleantalk-admin.php:385
|
264 |
msgid "Inserted"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: inc/cleantalk-admin.php:387
|
268 |
msgid "users."
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: inc/cleantalk-admin.php:388
|
272 |
msgid "Delete all spam users?"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: inc/cleantalk-admin.php:389
|
276 |
msgid "Delete checked users?"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: inc/cleantalk-admin.php:392
|
280 |
#, php-format
|
281 |
msgid ""
|
282 |
"Total users %s, checked %s, found %s spam users and %s bad users (without IP "
|
283 |
"or email)"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: inc/cleantalk-admin.php:401
|
287 |
msgid "Find spam-users"
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: inc/cleantalk-admin.php:449
|
291 |
#, php-format
|
292 |
msgid "Unable to get Access key automatically: %s"
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: inc/cleantalk-admin.php:450
|
296 |
msgid "Get the Access key"
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: inc/cleantalk-admin.php:459
|
300 |
#, php-format
|
301 |
msgid "Please enter Access Key in %s settings to enable anti spam protection!"
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: inc/cleantalk-admin.php:469
|
305 |
#, php-format
|
306 |
msgid "%s trial period ends, please upgrade to %s!"
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: inc/cleantalk-admin.php:481
|
310 |
msgid "RENEW ANTI-SPAM"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: inc/cleantalk-admin.php:482
|
314 |
msgid "next year"
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: inc/cleantalk-admin.php:486
|
318 |
#, php-format
|
319 |
msgid "Please renew your anti-spam license for %s."
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: inc/cleantalk-admin.php:511
|
323 |
msgid "Make it right!"
|
324 |
msgstr ""
|
325 |
|
326 |
+
#: inc/cleantalk-admin.php:513
|
327 |
#, php-format
|
328 |
msgid "%sGet premium%s"
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: inc/cleantalk-admin.php:552
|
332 |
msgid "Since"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: inc/cleantalk-admin.php:558
|
336 |
msgid ""
|
337 |
"All / Allowed / Blocked submissions. The number of submissions is being "
|
338 |
"counted since CleanTalk plugin installation."
|
339 |
msgstr ""
|
340 |
|
341 |
+
#: inc/cleantalk-admin.php:558
|
342 |
msgid "All"
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: inc/cleantalk-admin.php:566
|
346 |
msgid ""
|
347 |
"Allowed / Blocked submissions. The number of submissions for past 24 hours. "
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: inc/cleantalk-admin.php:566
|
351 |
msgid "Day"
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: inc/cleantalk-admin.php:572
|
355 |
msgid ""
|
356 |
"All / Blocked events. Access attempts regitred by SpamFireWall counted since "
|
357 |
"the last plugin activation."
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: inc/cleantalk-admin.php:582
|
361 |
msgid ""
|
362 |
"Allowed / Blocked submissions. The number of submissions is being counted "
|
363 |
"since "
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: inc/cleantalk-admin.php:593
|
367 |
msgid "dashboard"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: inc/cleantalk-admin.php:600
|
371 |
msgid "Settings"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: inc/cleantalk-admin.php:608
|
375 |
msgid "Bulk spam comments removal tool."
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: inc/cleantalk-admin.php:608 inc/cleantalk-settings.php:882
|
379 |
msgid "Check comments for spam"
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: inc/cleantalk-admin.php:618 inc/cleantalk-settings.php:885
|
383 |
msgid "Check users for spam"
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: inc/cleantalk-admin.php:627
|
387 |
msgid "Reset first counter"
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: inc/cleantalk-admin.php:635
|
391 |
msgid "Reset all counters"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: inc/cleantalk-comments.php:221 inc/cleantalk-users.php:220
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
msgid "Approve"
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: inc/cleantalk-comments.php:223 inc/cleantalk-users.php:222
|
399 |
msgid "Delete"
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: inc/cleantalk-comments.php:265
|
403 |
msgid "Delete all comments from the list"
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: inc/cleantalk-comments.php:266 inc/cleantalk-users.php:268
|
407 |
msgid "Delete selected"
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: inc/cleantalk-comments.php:270
|
411 |
msgid "Insert comments"
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: inc/cleantalk-comments.php:271
|
415 |
msgid "Delete comments"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: inc/cleantalk-comments.php:276 inc/cleantalk-users.php:279
|
419 |
msgid ""
|
420 |
"There is some differencies between blacklists database and our API "
|
421 |
"mechanisms. Blacklists shows all history of spam activity, but our API (that "
|
425 |
"emails/IPs will be not found by this checking."
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: inc/cleantalk-comments.php:281 inc/cleantalk-users.php:284
|
429 |
msgid "Stop deletion"
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: inc/cleantalk-comments.php:495
|
433 |
+
#, php-format
|
434 |
+
msgid ""
|
435 |
+
"Total comments %s. Checked %s. Last check %s. Found %s spam comments. %s bad "
|
436 |
+
"comments (without IP or email)."
|
437 |
+
msgstr ""
|
438 |
+
|
439 |
+
#: inc/cleantalk-comments.php:499
|
440 |
msgid "Please do backup of WordPress database before delete any comments!"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: inc/cleantalk-public.php:500 inc/cleantalk-public.php:641
|
444 |
+
#: inc/cleantalk-public.php:743 inc/cleantalk-public.php:2363
|
445 |
+
#: inc/cleantalk-public.php:3052
|
446 |
msgid "Spam protection by CleanTalk"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: inc/cleantalk-public.php:1233 inc/cleantalk-public.php:1361
|
450 |
+
#: inc/cleantalk-public.php:1379
|
451 |
msgid "Spam protection"
|
452 |
msgstr ""
|
453 |
|
454 |
+
#: inc/cleantalk-public.php:1332
|
455 |
+
msgid "CleanTalk AntiSpam: This message is possible spam."
|
|
|
456 |
msgstr ""
|
457 |
|
458 |
+
#: inc/cleantalk-public.php:1333
|
459 |
msgid "You could check it in CleanTalk's anti-spam database:"
|
460 |
msgstr ""
|
461 |
|
462 |
+
#: inc/cleantalk-public.php:1569
|
463 |
#, php-format
|
464 |
msgid "Registration approved by %s."
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: inc/cleantalk-public.php:1849
|
468 |
msgid "CleanTalk AntiSpam: This registration is spam."
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: inc/cleantalk-public.php:1850 inc/cleantalk-public.php:2219
|
472 |
+
#: inc/cleantalk-public.php:2387 inc/cleantalk-public.php:2542
|
473 |
msgid "CleanTalk's anti-spam database:"
|
474 |
msgstr ""
|
475 |
|
476 |
+
#: inc/cleantalk-public.php:2218 inc/cleantalk-public.php:2386
|
477 |
+
#: inc/cleantalk-public.php:2541
|
478 |
+
msgid "CleanTalk AntiSpam: This message is spam."
|
479 |
+
msgstr ""
|
480 |
+
|
481 |
+
#: inc/cleantalk-public.php:2666
|
482 |
msgid "Comment approved. Anti-spam by CleanTalk."
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: inc/cleantalk-public.php:3219
|
486 |
msgid "Attention, please!"
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: inc/cleantalk-public.php:3220
|
490 |
#, php-format
|
491 |
msgid "\"%s\" plugin error on your site \"%s\":"
|
492 |
msgstr ""
|
493 |
|
494 |
+
#: inc/cleantalk-public.php:3222
|
495 |
#, php-format
|
496 |
msgid "[%s] \"%s\" error!"
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: inc/cleantalk-public.php:3271
|
500 |
msgid ""
|
501 |
"By using this form you agree with the storage and processing of your data by "
|
502 |
"using the Privacy Policy on this website."
|
503 |
msgstr ""
|
504 |
|
505 |
+
#: inc/cleantalk-public.php:3319
|
506 |
msgid "Error occured while sending feedback."
|
507 |
msgstr ""
|
508 |
|
509 |
+
#: inc/cleantalk-public.php:3320
|
510 |
msgid "Feedback wasn't sent. There is no associated request."
|
511 |
msgstr ""
|
512 |
|
513 |
+
#: inc/cleantalk-public.php:3364
|
514 |
msgid "Sender info"
|
515 |
msgstr ""
|
516 |
|
517 |
+
#: inc/cleantalk-public.php:3367
|
518 |
msgid "by"
|
519 |
msgstr ""
|
520 |
|
521 |
+
#: inc/cleantalk-public.php:3378
|
522 |
msgid "No email"
|
523 |
msgstr ""
|
524 |
|
525 |
+
#: inc/cleantalk-public.php:3388
|
526 |
msgid "No IP"
|
527 |
msgstr ""
|
528 |
|
529 |
+
#: inc/cleantalk-public.php:3391
|
530 |
msgid "Mark as spam"
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: inc/cleantalk-public.php:3392
|
534 |
msgid "Unspam"
|
535 |
msgstr ""
|
536 |
|
537 |
+
#: inc/cleantalk-public.php:3394
|
538 |
msgid "Marked as spam."
|
539 |
msgstr ""
|
540 |
|
541 |
+
#: inc/cleantalk-public.php:3395
|
542 |
msgid "Marked as not spam."
|
543 |
msgstr ""
|
544 |
|
545 |
+
#: inc/cleantalk-settings.php:96
|
546 |
msgid "SpamFireWall"
|
547 |
msgstr ""
|
548 |
|
549 |
+
#: inc/cleantalk-settings.php:97
|
550 |
msgid ""
|
551 |
"This option allows to filter spam bots before they access website. Also "
|
552 |
"reduces CPU usage on hosting server and accelerates pages load time."
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: inc/cleantalk-settings.php:104
|
556 |
msgid "Forms to protect"
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: inc/cleantalk-settings.php:110
|
560 |
msgid "Advanced settings"
|
561 |
msgstr ""
|
562 |
|
563 |
+
#: inc/cleantalk-settings.php:117
|
564 |
msgid "Registration Forms"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: inc/cleantalk-settings.php:118
|
568 |
msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: inc/cleantalk-settings.php:121
|
572 |
msgid "Comments form"
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: inc/cleantalk-settings.php:122
|
576 |
msgid "WordPress, JetPack, WooCommerce."
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: inc/cleantalk-settings.php:125 inc/cleantalk-settings.php:761
|
580 |
msgid "Contact forms"
|
581 |
msgstr ""
|
582 |
|
583 |
+
#: inc/cleantalk-settings.php:126
|
584 |
msgid ""
|
585 |
"Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
|
586 |
"WordPress Landing Pages, Gravity Forms."
|
587 |
msgstr ""
|
588 |
|
589 |
+
#: inc/cleantalk-settings.php:129 inc/cleantalk-settings.php:762
|
590 |
msgid "Custom contact forms"
|
591 |
msgstr ""
|
592 |
|
593 |
+
#: inc/cleantalk-settings.php:130
|
594 |
msgid "Anti spam test for any WordPress themes or contacts forms."
|
595 |
msgstr ""
|
596 |
|
597 |
+
#: inc/cleantalk-settings.php:133 inc/cleantalk-settings.php:775
|
598 |
msgid "WooCommerce checkout form"
|
599 |
msgstr ""
|
600 |
|
601 |
+
#: inc/cleantalk-settings.php:134
|
602 |
msgid "Anti spam test for WooCommerce checkout form."
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: inc/cleantalk-settings.php:138
|
606 |
msgid "Spam test for registration during checkout"
|
607 |
msgstr ""
|
608 |
|
609 |
+
#: inc/cleantalk-settings.php:139
|
610 |
msgid ""
|
611 |
"Enable anti spam test for registration process which during woocommerce's "
|
612 |
"checkout."
|
613 |
msgstr ""
|
614 |
|
615 |
+
#: inc/cleantalk-settings.php:145
|
616 |
msgid "Test default Wordpress search form for spam"
|
617 |
msgstr ""
|
618 |
|
619 |
+
#: inc/cleantalk-settings.php:146
|
620 |
+
msgid "Spam protection for Search form."
|
621 |
+
msgstr ""
|
622 |
+
|
623 |
+
#: inc/cleantalk-settings.php:148
|
624 |
#, php-format
|
625 |
+
msgid "Read more about %sspam protection for Search form%s on our blog."
|
|
|
|
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: inc/cleantalk-settings.php:156
|
629 |
msgid "Protect external forms"
|
630 |
msgstr ""
|
631 |
|
632 |
+
#: inc/cleantalk-settings.php:157
|
633 |
msgid ""
|
634 |
"Turn this option on to protect forms on your WordPress that send data to "
|
635 |
"third-part servers (like MailChimp)."
|
636 |
msgstr ""
|
637 |
|
638 |
+
#: inc/cleantalk-settings.php:161
|
639 |
+
msgid "Capture buffer"
|
640 |
+
msgstr ""
|
641 |
+
|
642 |
+
#: inc/cleantalk-settings.php:162
|
643 |
+
msgid ""
|
644 |
+
"This setting gives you more sophisticated and strengthened protection for "
|
645 |
+
"external forms. But it could break plugins which use a buffer like Ninja "
|
646 |
+
"Forms."
|
647 |
+
msgstr ""
|
648 |
+
|
649 |
+
#: inc/cleantalk-settings.php:167
|
650 |
msgid "Protect internal forms"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: inc/cleantalk-settings.php:168
|
654 |
msgid ""
|
655 |
"This option will enable protection for custom (hand-made) AJAX forms with "
|
656 |
"PHP scripts handlers on your WordPress."
|
657 |
msgstr ""
|
658 |
|
659 |
+
#: inc/cleantalk-settings.php:175
|
660 |
msgid "Comments and Messages"
|
661 |
msgstr ""
|
662 |
|
663 |
+
#: inc/cleantalk-settings.php:178
|
664 |
msgid "BuddyPress Private Messages"
|
665 |
msgstr ""
|
666 |
|
667 |
+
#: inc/cleantalk-settings.php:179
|
668 |
msgid "Check buddyPress private messages."
|
669 |
msgstr ""
|
670 |
|
671 |
+
#: inc/cleantalk-settings.php:182
|
672 |
msgid "Don't check trusted user's comments"
|
673 |
msgstr ""
|
674 |
|
675 |
+
#: inc/cleantalk-settings.php:183
|
676 |
#, php-format
|
677 |
+
msgid "Don't check comments for users with above %d comments."
|
678 |
msgstr ""
|
679 |
|
680 |
+
#: inc/cleantalk-settings.php:186
|
681 |
msgid "Automatically delete spam comments"
|
682 |
msgstr ""
|
683 |
|
684 |
+
#: inc/cleantalk-settings.php:187
|
685 |
#, php-format
|
686 |
msgid "Delete spam comments older than %d days."
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: inc/cleantalk-settings.php:190
|
690 |
msgid "Remove links from approved comments"
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: inc/cleantalk-settings.php:191
|
694 |
msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
|
695 |
msgstr ""
|
696 |
|
697 |
+
#: inc/cleantalk-settings.php:194
|
698 |
msgid "Show links to check Emails, IPs for spam."
|
699 |
msgstr ""
|
700 |
|
701 |
+
#: inc/cleantalk-settings.php:195
|
702 |
msgid ""
|
703 |
"Shows little icon near IP addresses and Emails allowing you to check it via "
|
704 |
"CleanTalk's database. Also allowing you to manage comments from the public "
|
705 |
"post's page."
|
706 |
msgstr ""
|
707 |
|
708 |
+
#: inc/cleantalk-settings.php:203
|
709 |
msgid "Data Processing"
|
710 |
msgstr ""
|
711 |
|
712 |
+
#: inc/cleantalk-settings.php:206
|
713 |
msgid "Protect logged in Users"
|
714 |
msgstr ""
|
715 |
|
716 |
+
#: inc/cleantalk-settings.php:207
|
717 |
msgid ""
|
718 |
"Turn this option on to check for spam any submissions (comments, contact "
|
719 |
"forms and etc.) from registered Users."
|
720 |
msgstr ""
|
721 |
|
722 |
+
#: inc/cleantalk-settings.php:210
|
723 |
msgid "Use AJAX for JavaScript check"
|
724 |
msgstr ""
|
725 |
|
726 |
+
#: inc/cleantalk-settings.php:211
|
727 |
msgid ""
|
728 |
"Options helps protect WordPress against spam with any caching plugins. Turn "
|
729 |
"this option on to avoid issues with caching plugins."
|
730 |
msgstr ""
|
731 |
|
732 |
+
#: inc/cleantalk-settings.php:214
|
733 |
+
msgid "Use static keys for JS check."
|
734 |
msgstr ""
|
735 |
|
736 |
+
#: inc/cleantalk-settings.php:215
|
737 |
+
msgid ""
|
738 |
+
"Could help if you have cache for AJAX requests and you are dealing with "
|
739 |
+
"false positives. Slightly decreases protection quality. Auto - Static key "
|
740 |
+
"will be used if caching plugin is spotted."
|
741 |
+
msgstr ""
|
742 |
+
|
743 |
+
#: inc/cleantalk-settings.php:223
|
744 |
msgid "Check all post data"
|
745 |
msgstr ""
|
746 |
|
747 |
+
#: inc/cleantalk-settings.php:224
|
748 |
msgid ""
|
749 |
"Check all POST submissions from website visitors. Enable this option if you "
|
750 |
"have spam misses on website."
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: inc/cleantalk-settings.php:226
|
754 |
msgid " Or you don`t have records about missed spam here:"
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: inc/cleantalk-settings.php:226
|
758 |
msgid "CleanTalk dashboard"
|
759 |
msgstr ""
|
760 |
|
761 |
+
#: inc/cleantalk-settings.php:229
|
762 |
msgid "СAUTION! Option can catch POST requests in WordPress backend"
|
763 |
msgstr ""
|
764 |
|
765 |
+
#: inc/cleantalk-settings.php:232
|
766 |
msgid "Set cookies"
|
767 |
msgstr ""
|
768 |
|
769 |
+
#: inc/cleantalk-settings.php:233
|
770 |
msgid ""
|
771 |
"Turn this option off to deny plugin generates any cookies on website front-"
|
772 |
"end. This option is helpful if you use Varnish. But most of contact forms "
|
775 |
"detection.</b>"
|
776 |
msgstr ""
|
777 |
|
778 |
+
#: inc/cleantalk-settings.php:237
|
779 |
+
msgid "Use alternative mechanism for cookies"
|
780 |
msgstr ""
|
781 |
|
782 |
+
#: inc/cleantalk-settings.php:238 inc/cleantalk-settings.php:360
|
783 |
msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
|
784 |
msgstr ""
|
785 |
|
786 |
+
#: inc/cleantalk-settings.php:243
|
787 |
msgid "Use SSL"
|
788 |
msgstr ""
|
789 |
|
790 |
+
#: inc/cleantalk-settings.php:244
|
791 |
msgid "Turn this option on to use encrypted (SSL) connection with servers."
|
792 |
msgstr ""
|
793 |
|
794 |
+
#: inc/cleantalk-settings.php:247
|
795 |
msgid "Use Wordpress HTTP API"
|
796 |
msgstr ""
|
797 |
|
798 |
+
#: inc/cleantalk-settings.php:248
|
799 |
+
msgid ""
|
800 |
+
"Alternative way to connect the Cloud. Use this if you have connection "
|
801 |
+
"problems."
|
802 |
+
msgstr ""
|
803 |
+
|
804 |
+
#: inc/cleantalk-settings.php:255
|
805 |
+
msgid "Exclusions"
|
806 |
+
msgstr ""
|
807 |
+
|
808 |
+
#: inc/cleantalk-settings.php:259
|
809 |
+
msgid "URL exclusions"
|
810 |
+
msgstr ""
|
811 |
+
|
812 |
+
#: inc/cleantalk-settings.php:260
|
813 |
+
msgid "You could type here URL you want to exclude. Use comma as separator."
|
814 |
+
msgstr ""
|
815 |
+
|
816 |
+
#: inc/cleantalk-settings.php:264
|
817 |
+
msgid "Use Regular Expression in URL Exclusions"
|
818 |
+
msgstr ""
|
819 |
+
|
820 |
+
#: inc/cleantalk-settings.php:268
|
821 |
+
msgid "Field name exclusions"
|
822 |
+
msgstr ""
|
823 |
+
|
824 |
+
#: inc/cleantalk-settings.php:269
|
825 |
msgid ""
|
826 |
+
"You could type here fields names you want to exclude. Use comma as separator."
|
827 |
+
msgstr ""
|
828 |
+
|
829 |
+
#: inc/cleantalk-settings.php:273
|
830 |
+
msgid "Use Regular Expression in Field Exclusions"
|
831 |
+
msgstr ""
|
832 |
+
|
833 |
+
#: inc/cleantalk-settings.php:280
|
834 |
+
msgid "Roles which bypass spam test. Hold CTRL to select multiple roles."
|
835 |
msgstr ""
|
836 |
|
837 |
+
#: inc/cleantalk-settings.php:287
|
838 |
msgid "Admin bar"
|
839 |
msgstr ""
|
840 |
|
841 |
+
#: inc/cleantalk-settings.php:294
|
842 |
msgid "Show statistics in admin bar"
|
843 |
msgstr ""
|
844 |
|
845 |
+
#: inc/cleantalk-settings.php:295
|
846 |
msgid ""
|
847 |
"Show/hide icon in top level menu in WordPress backend. The number of "
|
848 |
"submissions is being counted for past 24 hours."
|
849 |
msgstr ""
|
850 |
|
851 |
+
#: inc/cleantalk-settings.php:299
|
852 |
msgid "Show All-time counter"
|
853 |
msgstr ""
|
854 |
|
855 |
+
#: inc/cleantalk-settings.php:300
|
856 |
msgid ""
|
857 |
"Display all-time requests counter in the admin bar. Counter displays number "
|
858 |
"of requests since plugin installation."
|
859 |
msgstr ""
|
860 |
|
861 |
+
#: inc/cleantalk-settings.php:305
|
862 |
msgid "Show 24 hours counter"
|
863 |
msgstr ""
|
864 |
|
865 |
+
#: inc/cleantalk-settings.php:306
|
866 |
msgid ""
|
867 |
"Display daily requests counter in the admin bar. Counter displays number of "
|
868 |
"requests of the past 24 hours."
|
869 |
msgstr ""
|
870 |
|
871 |
+
#: inc/cleantalk-settings.php:311
|
872 |
msgid "SpamFireWall counter"
|
873 |
msgstr ""
|
874 |
|
875 |
+
#: inc/cleantalk-settings.php:312
|
876 |
msgid ""
|
877 |
"Display SpamFireWall requests in the admin bar. Counter displays number of "
|
878 |
"requests since plugin installation."
|
879 |
msgstr ""
|
880 |
|
881 |
+
#: inc/cleantalk-settings.php:325
|
882 |
msgid "Collect details about browsers"
|
883 |
msgstr ""
|
884 |
|
885 |
+
#: inc/cleantalk-settings.php:326
|
886 |
msgid ""
|
887 |
"Checking this box you allow plugin store information about screen size and "
|
888 |
"browser plugins of website visitors. The option in a beta state."
|
889 |
msgstr ""
|
890 |
|
891 |
+
#: inc/cleantalk-settings.php:330
|
892 |
msgid "Send connection reports"
|
893 |
msgstr ""
|
894 |
|
895 |
+
#: inc/cleantalk-settings.php:331
|
896 |
msgid ""
|
897 |
"Checking this box you allow plugin to send the information about your "
|
898 |
"connection. The option in a beta state."
|
899 |
msgstr ""
|
900 |
|
901 |
+
#: inc/cleantalk-settings.php:335
|
902 |
msgid "Async JavaScript loading"
|
903 |
msgstr ""
|
904 |
|
905 |
+
#: inc/cleantalk-settings.php:336
|
906 |
msgid ""
|
907 |
"Use async loading for scripts. Warning: This could reduce filtration quality."
|
908 |
msgstr ""
|
909 |
|
910 |
+
#: inc/cleantalk-settings.php:340
|
911 |
msgid "Allow to add GDPR notice via shortcode"
|
912 |
msgstr ""
|
913 |
|
914 |
+
#: inc/cleantalk-settings.php:341
|
915 |
msgid ""
|
916 |
" Adds small checkbox under your website form. To add it you should use the "
|
917 |
"shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
918 |
msgstr ""
|
919 |
|
920 |
+
#: inc/cleantalk-settings.php:346
|
921 |
msgid "GDPR text notice"
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: inc/cleantalk-settings.php:347
|
925 |
msgid "This text will be added as a description to the GDPR checkbox."
|
926 |
msgstr ""
|
927 |
|
928 |
+
#: inc/cleantalk-settings.php:353
|
929 |
msgid "Store visited URLs"
|
930 |
msgstr ""
|
931 |
|
932 |
+
#: inc/cleantalk-settings.php:354
|
933 |
msgid ""
|
934 |
"Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
|
935 |
"form on the site. You can see stored visited URLS for each visitor in your "
|
936 |
"Dashboard. Turn the option on to improve Anti-Spam protection."
|
937 |
msgstr ""
|
938 |
|
939 |
+
#: inc/cleantalk-settings.php:359
|
940 |
msgid "Use cookies less sessions"
|
941 |
msgstr ""
|
942 |
|
943 |
+
#: inc/cleantalk-settings.php:366
|
944 |
msgid ""
|
945 |
"Notify users with selected roles about new approved comments. Hold CTRL to "
|
946 |
"select multiple roles."
|
947 |
msgstr ""
|
948 |
|
949 |
+
#: inc/cleantalk-settings.php:367
|
950 |
#, php-format
|
951 |
msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
|
952 |
msgstr ""
|
953 |
|
954 |
+
#: inc/cleantalk-settings.php:380
|
955 |
+
msgid "Complete deactivation"
|
956 |
+
msgstr ""
|
957 |
+
|
958 |
+
#: inc/cleantalk-settings.php:381
|
959 |
+
msgid "Leave no trace in the system after deactivation."
|
960 |
+
msgstr ""
|
961 |
+
|
962 |
#: inc/cleantalk-settings.php:398
|
963 |
+
msgid "Enable White Label Mode"
|
964 |
+
msgstr ""
|
965 |
+
|
966 |
+
#: inc/cleantalk-settings.php:399
|
967 |
+
#, php-format
|
968 |
+
msgid "Learn more information %shere%s."
|
969 |
msgstr ""
|
970 |
|
971 |
#: inc/cleantalk-settings.php:404
|
972 |
+
msgid "Hoster API Key"
|
973 |
msgstr ""
|
974 |
|
975 |
#: inc/cleantalk-settings.php:405
|
976 |
+
#, php-format
|
977 |
+
msgid "You can get it in %sCleantalk's Control Panel%s"
|
978 |
msgstr ""
|
979 |
|
980 |
+
#: inc/cleantalk-settings.php:413
|
981 |
+
msgid "Plugin name"
|
982 |
msgstr ""
|
983 |
|
984 |
+
#: inc/cleantalk-settings.php:414
|
985 |
+
#, php-format
|
986 |
+
msgid "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s"
|
987 |
msgstr ""
|
988 |
|
989 |
+
#: inc/cleantalk-settings.php:423
|
990 |
+
msgid "Allow users to use other key"
|
991 |
+
msgstr ""
|
992 |
+
|
993 |
+
#: inc/cleantalk-settings.php:424
|
994 |
+
msgid ""
|
995 |
+
"Allow users to use different Access key in their plugin settings on child "
|
996 |
+
"blogs. They could use different CleanTalk account."
|
997 |
msgstr ""
|
998 |
|
999 |
#: inc/cleantalk-settings.php:427
|
1000 |
msgid ""
|
1001 |
+
"Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key "
|
1002 |
+
"from this constant. Look into wp-config.php"
|
1003 |
+
msgstr ""
|
1004 |
+
|
1005 |
+
#: inc/cleantalk-settings.php:533
|
1006 |
+
msgid "CleanTalk's tech support:"
|
1007 |
+
msgstr ""
|
1008 |
+
|
1009 |
+
#: inc/cleantalk-settings.php:539
|
1010 |
+
msgid "Plugin Homepage at"
|
1011 |
msgstr ""
|
1012 |
|
1013 |
+
#: inc/cleantalk-settings.php:540
|
1014 |
+
msgid "GDPR compliance"
|
1015 |
+
msgstr ""
|
1016 |
+
|
1017 |
+
#: inc/cleantalk-settings.php:541
|
1018 |
+
msgid "Use s@cleantalk.org to test plugin in any WordPress form."
|
1019 |
+
msgstr ""
|
1020 |
+
|
1021 |
+
#: inc/cleantalk-settings.php:542
|
1022 |
+
msgid "CleanTalk is registered Trademark. All rights reserved."
|
1023 |
+
msgstr ""
|
1024 |
+
|
1025 |
+
#: inc/cleantalk-settings.php:559
|
1026 |
#, php-format
|
1027 |
msgid "%s has blocked <b>%s</b> spam."
|
1028 |
msgstr ""
|
1029 |
|
1030 |
+
#: inc/cleantalk-settings.php:571
|
1031 |
msgid "Click here to get anti-spam statistics"
|
1032 |
msgstr ""
|
1033 |
|
1034 |
+
#: inc/cleantalk-settings.php:614
|
1035 |
+
#, php-format
|
1036 |
+
msgid "Please, enter the %splugin settings%s in main site dashboard."
|
1037 |
+
msgstr ""
|
1038 |
+
|
1039 |
+
#: inc/cleantalk-settings.php:633
|
1040 |
+
msgid "Error occured while API key validating. Error: "
|
1041 |
+
msgstr ""
|
1042 |
+
|
1043 |
+
#: inc/cleantalk-settings.php:634
|
1044 |
+
msgid "Error occured while automatically gettings access key. Error: "
|
1045 |
+
msgstr ""
|
1046 |
+
|
1047 |
+
#: inc/cleantalk-settings.php:635
|
1048 |
+
msgid "Error occured while sending sending SpamFireWall logs. Error: "
|
1049 |
+
msgstr ""
|
1050 |
+
|
1051 |
+
#: inc/cleantalk-settings.php:636
|
1052 |
+
msgid "Error occured while updating SpamFireWall local base. Error: "
|
1053 |
+
msgstr ""
|
1054 |
+
|
1055 |
+
#: inc/cleantalk-settings.php:637
|
1056 |
+
msgid "Error occured while checking account status. Error: "
|
1057 |
+
msgstr ""
|
1058 |
+
|
1059 |
+
#: inc/cleantalk-settings.php:638
|
1060 |
+
msgid "Error occured while excuting API call. Error: "
|
1061 |
+
msgstr ""
|
1062 |
+
|
1063 |
+
#: inc/cleantalk-settings.php:646
|
1064 |
+
msgid "Unknown error. Error: "
|
1065 |
+
msgstr ""
|
1066 |
+
|
1067 |
+
#: inc/cleantalk-settings.php:677
|
1068 |
+
msgid "Errors:"
|
1069 |
+
msgstr ""
|
1070 |
+
|
1071 |
+
#: inc/cleantalk-settings.php:682
|
1072 |
#, php-format
|
1073 |
msgid "You can get support any time here: %s."
|
1074 |
msgstr ""
|
1075 |
|
1076 |
+
#: inc/cleantalk-settings.php:757
|
1077 |
msgid "Protection is active"
|
1078 |
msgstr ""
|
1079 |
|
1080 |
+
#: inc/cleantalk-settings.php:759
|
1081 |
msgid "Registration forms"
|
1082 |
msgstr ""
|
1083 |
|
1084 |
+
#: inc/cleantalk-settings.php:760
|
1085 |
msgid "Comments forms"
|
1086 |
msgstr ""
|
1087 |
|
1088 |
+
#: inc/cleantalk-settings.php:765
|
1089 |
msgid "Validate email for existence"
|
1090 |
msgstr ""
|
1091 |
|
1092 |
+
#: inc/cleantalk-settings.php:769
|
1093 |
msgid "Auto update"
|
1094 |
msgstr ""
|
1095 |
|
1096 |
+
#: inc/cleantalk-settings.php:793
|
1097 |
+
msgid "<h3>Key is provided by Super Admin.</h3>"
|
1098 |
msgstr ""
|
1099 |
|
1100 |
+
#: inc/cleantalk-settings.php:797
|
1101 |
msgid "Access key"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
+
#: inc/cleantalk-settings.php:812
|
1105 |
msgid "Enter the key"
|
1106 |
msgstr ""
|
1107 |
|
1108 |
+
#: inc/cleantalk-settings.php:818
|
1109 |
#, php-format
|
1110 |
msgid "Account at cleantalk.org is %s."
|
1111 |
msgstr ""
|
1112 |
|
1113 |
+
#: inc/cleantalk-settings.php:827
|
1114 |
+
msgid "Show the access key"
|
1115 |
+
msgstr ""
|
1116 |
+
|
1117 |
+
#: inc/cleantalk-settings.php:838
|
1118 |
msgid "Get Access Key Automatically"
|
1119 |
msgstr ""
|
1120 |
|
1121 |
+
#: inc/cleantalk-settings.php:846
|
1122 |
#, php-format
|
1123 |
msgid ""
|
1124 |
"Admin e-mail (%s) will be used for registration, if you want to use other "
|
1125 |
"email please %sGet Access Key Manually%s."
|
1126 |
msgstr ""
|
1127 |
|
1128 |
+
#: inc/cleantalk-settings.php:862
|
1129 |
+
#, php-format
|
1130 |
+
msgid "I accept %sLicense Agreement%s."
|
1131 |
msgstr ""
|
1132 |
|
1133 |
+
#: inc/cleantalk-settings.php:888
|
1134 |
msgid "Statistics & Reports"
|
1135 |
msgstr ""
|
1136 |
|
1137 |
+
#: inc/cleantalk-settings.php:904
|
1138 |
#, php-format
|
1139 |
msgid "Last spam check request to %s server was at %s."
|
1140 |
msgstr ""
|
1141 |
|
1142 |
+
#: inc/cleantalk-settings.php:905 inc/cleantalk-settings.php:906
|
1143 |
+
#: inc/cleantalk-settings.php:915 inc/cleantalk-settings.php:922
|
1144 |
+
#: inc/cleantalk-settings.php:923 inc/cleantalk-settings.php:931
|
1145 |
+
#: inc/cleantalk-settings.php:932 inc/cleantalk-settings.php:939
|
1146 |
+
#: inc/cleantalk-settings.php:940
|
1147 |
msgid "unknown"
|
1148 |
msgstr ""
|
1149 |
|
1150 |
+
#: inc/cleantalk-settings.php:912
|
1151 |
#, php-format
|
1152 |
msgid "Average request time for past 7 days: %s seconds."
|
1153 |
msgstr ""
|
1154 |
|
1155 |
+
#: inc/cleantalk-settings.php:921
|
1156 |
#, php-format
|
1157 |
msgid "Last time SpamFireWall was triggered for %s IP at %s"
|
1158 |
msgstr ""
|
1159 |
|
1160 |
+
#: inc/cleantalk-settings.php:930
|
1161 |
#, php-format
|
1162 |
msgid "SpamFireWall was updated %s. Now contains %s entries."
|
1163 |
msgstr ""
|
1164 |
|
1165 |
+
#: inc/cleantalk-settings.php:938
|
1166 |
#, php-format
|
1167 |
msgid "SpamFireWall sent %s events at %s."
|
1168 |
msgstr ""
|
1169 |
|
1170 |
+
#: inc/cleantalk-settings.php:948
|
1171 |
msgid "There are no failed connections to server."
|
1172 |
msgstr ""
|
1173 |
|
1174 |
+
#: inc/cleantalk-settings.php:975
|
1175 |
msgid "Send report"
|
1176 |
msgstr ""
|
1177 |
|
1178 |
+
#: inc/cleantalk-settings.php:979
|
1179 |
msgid ""
|
1180 |
"Please, enable \"Send connection reports\" setting to be able to send reports"
|
1181 |
msgstr ""
|
1182 |
|
1183 |
+
#: inc/cleantalk-settings.php:1327
|
1184 |
+
msgid "Testing is failed. Please check the Access key."
|
1185 |
msgstr ""
|
1186 |
|
1187 |
+
#: inc/cleantalk-settings.php:1442
|
1188 |
+
msgid "XSS check"
|
1189 |
+
msgstr ""
|
1190 |
+
|
1191 |
+
#: inc/cleantalk-settings.php:1443
|
1192 |
+
msgid ""
|
1193 |
+
"Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to "
|
1194 |
+
"any user. As a result malicious scripts can not get access to the cookie "
|
1195 |
+
"files, session tokens and any other confidential information browsers use "
|
1196 |
+
"and store. Such scripts can even overwrite content of HTML pages. CleanTalk "
|
1197 |
+
"WAF monitors for patterns of these parameters and block them."
|
1198 |
msgstr ""
|
1199 |
|
1200 |
+
#: inc/cleantalk-settings.php:1446
|
1201 |
+
msgid "SQL-injection check"
|
1202 |
+
msgstr ""
|
1203 |
+
|
1204 |
+
#: inc/cleantalk-settings.php:1447
|
1205 |
+
msgid ""
|
1206 |
+
"SQL Injection — one of the most popular ways to hack websites and programs "
|
1207 |
+
"that work with databases. It is based on injection of a custom SQL code into "
|
1208 |
+
"database queries. It could transmit data through GET, POST requests or "
|
1209 |
+
"cookie files in an SQL code. If a website is vulnerable and execute such "
|
1210 |
+
"injections then it would allow attackers to apply changes to the website's "
|
1211 |
+
"MySQL database."
|
1212 |
+
msgstr ""
|
1213 |
+
|
1214 |
+
#: inc/cleantalk-settings.php:1450
|
1215 |
+
msgid "Check uploaded files"
|
1216 |
+
msgstr ""
|
1217 |
+
|
1218 |
+
#: inc/cleantalk-settings.php:1451
|
1219 |
+
msgid ""
|
1220 |
+
"The option checks each uploaded file to a website for malicious code. If "
|
1221 |
+
"it's possible for visitors to upload files to a website, for instance a work "
|
1222 |
+
"resume, then attackers could abuse it and upload an infected file to execute "
|
1223 |
+
"it later and get access to your website."
|
1224 |
msgstr ""
|
1225 |
|
1226 |
#: inc/cleantalk-users.php:15
|
1231 |
msgid "Please wait for a while. CleanTalk is deleting spam users. Users left: "
|
1232 |
msgstr ""
|
1233 |
|
1234 |
+
#: inc/cleantalk-users.php:79
|
1235 |
+
msgid ""
|
1236 |
+
"The plugin will check all users against blacklists database and show you "
|
1237 |
+
"senders that have spam activity on other websites."
|
1238 |
+
msgstr ""
|
1239 |
+
|
1240 |
+
#: inc/cleantalk-users.php:84
|
1241 |
+
msgid ""
|
1242 |
+
"Allows to use user's dates to perform more accurate check. Could seriously "
|
1243 |
+
"slow down the check."
|
1244 |
+
msgstr ""
|
1245 |
+
|
1246 |
+
#: inc/cleantalk-users.php:108
|
1247 |
msgid ""
|
1248 |
"Please wait for a while. CleanTalk is checking all users via blacklist "
|
1249 |
"database at cleantalk.org. You will have option to delete found spam users "
|
1250 |
"after plugin finish."
|
1251 |
msgstr ""
|
1252 |
|
1253 |
+
#: inc/cleantalk-users.php:267
|
1254 |
msgid "Delete all users from list"
|
1255 |
msgstr ""
|
1256 |
|
1257 |
+
#: inc/cleantalk-users.php:269
|
1258 |
msgid "Download results in CSV"
|
1259 |
msgstr ""
|
1260 |
|
1261 |
+
#: inc/cleantalk-users.php:273
|
1262 |
msgid "Insert accounts"
|
1263 |
msgstr ""
|
1264 |
|
1265 |
+
#: inc/cleantalk-users.php:274
|
1266 |
msgid "Delete accounts"
|
1267 |
msgstr ""
|
1268 |
|
1269 |
+
#: inc/cleantalk-users.php:527
|
1270 |
+
#, php-format
|
1271 |
+
msgid ""
|
1272 |
+
"Total users %s, checked %s, last check %s, found %s spam users and %s bad "
|
1273 |
+
"users (without IP or email)"
|
1274 |
+
msgstr ""
|
1275 |
+
|
1276 |
#: inc/cleantalk-widget.php:22
|
1277 |
msgid "CleanTalk Widget"
|
1278 |
msgstr ""
|
1325 |
msgid "Referal link ID:"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
+
#: lib/CleantalkSFW.php:71
|
1329 |
msgid "SpamFireWall is activated for your IP "
|
1330 |
msgstr ""
|
1331 |
|
1332 |
+
#: lib/CleantalkSFW.php:72
|
1333 |
msgid ""
|
1334 |
"To continue working with web site, please make sure that you have enabled "
|
1335 |
"JavaScript."
|
1336 |
msgstr ""
|
1337 |
|
1338 |
+
#: lib/CleantalkSFW.php:73
|
1339 |
msgid "Please click below to pass protection,"
|
1340 |
msgstr ""
|
1341 |
|
1342 |
+
#: lib/CleantalkSFW.php:74
|
1343 |
#, php-format
|
1344 |
msgid ""
|
1345 |
"Or you will be automatically redirected to the requested page after %d "
|
1346 |
"seconds."
|
1347 |
msgstr ""
|
1348 |
|
1349 |
+
#: lib/CleantalkSFW.php:75
|
1350 |
msgid "Antispam by CleanTalk"
|
1351 |
msgstr ""
|
1352 |
|
1353 |
+
#: lib/CleantalkSFW.php:76
|
1354 |
msgid "This is the testing page for SpamFireWall"
|
1355 |
msgstr ""
|
1356 |
|
inc/cleantalk-ajax.php
CHANGED
@@ -1,723 +1,725 @@
|
|
1 |
-
<?php
|
2 |
-
global $cleantalk_hooked_actions;
|
3 |
-
|
4 |
-
/*
|
5 |
-
AJAX functions
|
6 |
-
*/
|
7 |
-
|
8 |
-
//$cleantalk_ajax_actions_to_check - array for POST 'actions' we should check.
|
9 |
-
|
10 |
-
$cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
|
11 |
-
$cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
|
12 |
-
|
13 |
-
//cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
|
14 |
-
|
15 |
-
$cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
|
16 |
-
|
17 |
-
$cleantalk_hooked_actions[] = 'ct_feedback_comment';
|
18 |
-
|
19 |
-
/* MailChimp Premium*/
|
20 |
-
add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
|
21 |
-
|
22 |
-
/*hooks for Usernoise Form*/
|
23 |
-
add_action('un_feedback_form_body', 'ct_add_hidden_fields',1);
|
24 |
-
add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
|
25 |
-
|
26 |
-
/*hooks for AJAX Login & Register email validation*/
|
27 |
-
add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
|
28 |
-
add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
|
29 |
-
$cleantalk_hooked_actions[]='validate_email';
|
30 |
-
|
31 |
-
/*hooks for user registration*/
|
32 |
-
add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
|
33 |
-
|
34 |
-
/*hooks for WPUF pro */
|
35 |
-
//add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
|
36 |
-
//add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
|
37 |
-
add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
|
38 |
-
add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
|
39 |
-
$cleantalk_hooked_actions[]='submit_register';
|
40 |
-
|
41 |
-
/*hooks for MyMail */
|
42 |
-
//add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
|
43 |
-
//add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
|
44 |
-
add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
|
45 |
-
add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
|
46 |
-
$cleantalk_hooked_actions[]='form_submit';
|
47 |
-
|
48 |
-
/*hooks for MailPoet */
|
49 |
-
//add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
|
50 |
-
//add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
|
51 |
-
add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
|
52 |
-
add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
|
53 |
-
$cleantalk_hooked_actions[]='wysija_ajax';
|
54 |
-
|
55 |
-
/*hooks for cs_registration_validation */
|
56 |
-
//add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
57 |
-
//add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
58 |
-
add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
|
59 |
-
add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
|
60 |
-
$cleantalk_hooked_actions[]='cs_registration_validation';
|
61 |
-
|
62 |
-
/*hooks for send_message and request_appointment */
|
63 |
-
//add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
|
64 |
-
//add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
|
65 |
-
//add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
|
66 |
-
//add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
|
67 |
-
add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
|
68 |
-
add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
|
69 |
-
add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
|
70 |
-
add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
|
71 |
-
$cleantalk_hooked_actions[]='send_message';
|
72 |
-
$cleantalk_hooked_actions[]='request_appointment';
|
73 |
-
|
74 |
-
/*hooks for zn_do_login */
|
75 |
-
//add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
|
76 |
-
//add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
|
77 |
-
add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
|
78 |
-
add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
|
79 |
-
$cleantalk_hooked_actions[]='zn_do_login';
|
80 |
-
|
81 |
-
/*hooks for zn_do_login */
|
82 |
-
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
|
83 |
-
//add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
|
84 |
-
if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
|
85 |
-
add_filter('preprocess_comment', 'ct_ajax_hook', 1);
|
86 |
-
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
|
87 |
-
//add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
|
88 |
-
$cleantalk_hooked_actions[]='cscf-submitform';
|
89 |
-
}
|
90 |
-
|
91 |
-
|
92 |
-
/*hooks for visual form builder */
|
93 |
-
//add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
|
94 |
-
//add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
|
95 |
-
add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
|
96 |
-
add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
|
97 |
-
$cleantalk_hooked_actions[]='vfb_submit';
|
98 |
-
|
99 |
-
/*hooks for woocommerce_checkout*/
|
100 |
-
add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
|
101 |
-
add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
|
102 |
-
$cleantalk_hooked_actions[]='woocommerce_checkout';
|
103 |
-
$cleantalk_hooked_actions[]='wcfm_ajax_controller';
|
104 |
-
|
105 |
-
/*hooks for frm_action*/
|
106 |
-
add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
|
107 |
-
add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
|
108 |
-
$cleantalk_hooked_actions[]='frm_entries_create';
|
109 |
-
|
110 |
-
add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
|
111 |
-
add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
|
112 |
-
$cleantalk_hooked_actions[]='td_mod_register';
|
113 |
-
|
114 |
-
/*hooks for tevolution theme*/
|
115 |
-
add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
|
116 |
-
add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
|
117 |
-
add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
|
118 |
-
add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
|
119 |
-
add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
|
120 |
-
add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
|
121 |
-
$cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
|
122 |
-
$cleantalk_hooked_actions[]='tevolution_submit_from_preview';
|
123 |
-
$cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
|
124 |
-
|
125 |
-
/* hooks for contact forms by web settler ajax*/
|
126 |
-
add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
|
127 |
-
$cleantalk_hooked_actions[]='smuzform_form_submit';
|
128 |
-
|
129 |
-
/* hooks for reviewer plugin*/
|
130 |
-
add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
|
131 |
-
$cleantalk_hooked_actions[]='rwp-submit-wrap';
|
132 |
-
|
133 |
-
$cleantalk_hooked_actions[]='post_update';
|
134 |
-
|
135 |
-
/* Ninja Forms hoocked actions */
|
136 |
-
$cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
|
137 |
-
$cleantalk_hooked_actions[]='nf_ajax_submit';
|
138 |
-
$cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
|
139 |
-
|
140 |
-
/* Follow-Up Emails */
|
141 |
-
$cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
|
142 |
-
|
143 |
-
/* Follow-Up Emails */
|
144 |
-
$cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
|
145 |
-
|
146 |
-
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
147 |
-
|
148 |
-
$email = is_null( $email ) ? $email : $_POST['email'];
|
149 |
-
$email = sanitize_email($email);
|
150 |
-
$is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
|
151 |
-
|
152 |
-
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
|
153 |
-
|
154 |
-
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
155 |
-
$sender_info['post_checkjs_passed'] = $checkjs;
|
156 |
-
if ($checkjs === null){
|
157 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
158 |
-
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
159 |
-
}
|
160 |
-
|
161 |
-
//Making a call
|
162 |
-
$base_call_result = apbct_base_call(
|
163 |
-
array(
|
164 |
-
'sender_email' => $email,
|
165 |
-
'sender_nickname' => '',
|
166 |
-
'sender_info' => $sender_info,
|
167 |
-
'js_on' => $checkjs,
|
168 |
-
),
|
169 |
-
true
|
170 |
-
);
|
171 |
-
|
172 |
-
$ct_result = $base_call_result['ct_result'];
|
173 |
-
|
174 |
-
if ($ct_result->allow===0){
|
175 |
-
$is_good=false;
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
if($is_good){
|
180 |
-
$ajaxresult=array(
|
181 |
-
'description' => null,
|
182 |
-
'cssClass' => 'noon',
|
183 |
-
'code' => 'success'
|
184 |
-
);
|
185 |
-
}else{
|
186 |
-
$ajaxresult=array(
|
187 |
-
'description' => 'Invalid Email',
|
188 |
-
'cssClass' => 'error-container',
|
189 |
-
'code' => 'error'
|
190 |
-
);
|
191 |
-
}
|
192 |
-
|
193 |
-
$ajaxresult = json_encode($ajaxresult);
|
194 |
-
print $ajaxresult;
|
195 |
-
wp_die();
|
196 |
-
}
|
197 |
-
|
198 |
-
function ct_user_register_ajaxlogin($user_id)
|
199 |
-
{
|
200 |
-
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
201 |
-
{
|
202 |
-
|
203 |
-
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
204 |
-
$sender_info['post_checkjs_passed'] = $checkjs;
|
205 |
-
if ($checkjs === null){
|
206 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
207 |
-
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
208 |
-
}
|
209 |
-
|
210 |
-
//Making a call
|
211 |
-
$base_call_result = apbct_base_call(
|
212 |
-
array(
|
213 |
-
'sender_email' => sanitize_email($_POST['email']),
|
214 |
-
'sender_nickname' => sanitize_email($_POST['login']),
|
215 |
-
'sender_info' => $sender_info,
|
216 |
-
'js_on' => $checkjs,
|
217 |
-
),
|
218 |
-
true
|
219 |
-
);
|
220 |
-
|
221 |
-
$ct_result = $base_call_result['ct_result'];
|
222 |
-
|
223 |
-
if ($ct_result->allow === 0)
|
224 |
-
{
|
225 |
-
wp_delete_user($user_id);
|
226 |
-
}
|
227 |
-
}
|
228 |
-
return $user_id;
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
|
233 |
-
*
|
234 |
-
* @param array $errors
|
235 |
-
* @return array
|
236 |
-
*/
|
237 |
-
function ct_mc4wp_ajax_hook( array $errors )
|
238 |
-
{
|
239 |
-
$result = ct_ajax_hook();
|
240 |
-
|
241 |
-
// only return modified errors array when function returned a string value (the message key)
|
242 |
-
if( is_string( $result ) ) {
|
243 |
-
$errors[] = $result;
|
244 |
-
}
|
245 |
-
|
246 |
-
return $errors;
|
247 |
-
}
|
248 |
-
|
249 |
-
function ct_ajax_hook($message_obj = false, $additional = false)
|
250 |
-
{
|
251 |
-
global $apbct, $current_user;
|
252 |
-
|
253 |
-
$message_obj = (array)$message_obj;
|
254 |
-
|
255 |
-
// Get current_user and set it globaly
|
256 |
-
apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
|
257 |
-
|
258 |
-
// Go out because of not spam data
|
259 |
-
$skip_post = array(
|
260 |
-
'gmaps_display_info_window', // Geo My WP pop-up windows.
|
261 |
-
'gmw_ps_display_info_window', // Geo My WP pop-up windows.
|
262 |
-
'the_champ_user_auth', // Super Socializer
|
263 |
-
'simbatfa-init-otp', //Two-Factor Auth
|
264 |
-
'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
|
265 |
-
'boss_we_login', //Login form
|
266 |
-
'sidebar_login_process', // Login CF7
|
267 |
-
'cp_update_style_settings', // Convert Pro. Saving settings
|
268 |
-
'updraft_savesettings', // UpdraftPlus
|
269 |
-
'wpdUpdateAutomatically', //Comments update
|
270 |
-
'upload-attachment', // Skip ulpload attachments
|
271 |
-
'iwj_update_profile', //Skip profile page checker
|
272 |
-
'st_partner_create_service', //Skip add hotel via admin
|
273 |
-
'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
|
274 |
-
'mailster_send_test', //Mailster send test admin
|
275 |
-
'acf/validate_save_post', //ACF validate post admin
|
276 |
-
'admin:saveThemeOptions', //Ait-theme admin checking
|
277 |
-
'save_tourmaster_option', //Tourmaster admin save
|
278 |
-
'validate_register_email', // Service id #313320
|
279 |
-
'elementor_pro_forms_send_form', //Elementor Pro
|
280 |
-
'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
|
281 |
-
'ihc_check_reg_field_ajax', //Ajax check required fields
|
282 |
-
'OSTC_lostPassword', //Lost password ajax form
|
283 |
-
'check_retina_image_availability', //There are too many ajax requests from mobile
|
284 |
-
'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
|
285 |
-
'edit-comment', // Edit comments by admin ??? that shouldn't happen
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
$sender_nickname = '';
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
$ct_post_temp['
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
$ct_post_temp[] = $message_obj['
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
$ct_post_temp['
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
$
|
380 |
-
$
|
381 |
-
$
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
'
|
428 |
-
'
|
429 |
-
'
|
430 |
-
'
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
$result
|
519 |
-
$result['
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
'
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
'
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
'
|
575 |
-
'
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
'
|
604 |
-
'
|
605 |
-
'
|
606 |
-
'
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
'
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
'
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
'
|
639 |
-
'
|
640 |
-
'
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
'
|
653 |
-
'
|
654 |
-
'
|
655 |
-
'
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
'
|
707 |
-
'
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
}
|
|
|
|
1 |
+
<?php
|
2 |
+
global $cleantalk_hooked_actions;
|
3 |
+
|
4 |
+
/*
|
5 |
+
AJAX functions
|
6 |
+
*/
|
7 |
+
|
8 |
+
//$cleantalk_ajax_actions_to_check - array for POST 'actions' we should check.
|
9 |
+
|
10 |
+
$cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
|
11 |
+
$cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
|
12 |
+
|
13 |
+
//cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
|
14 |
+
|
15 |
+
$cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
|
16 |
+
|
17 |
+
$cleantalk_hooked_actions[] = 'ct_feedback_comment';
|
18 |
+
|
19 |
+
/* MailChimp Premium*/
|
20 |
+
add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
|
21 |
+
|
22 |
+
/*hooks for Usernoise Form*/
|
23 |
+
add_action('un_feedback_form_body', 'ct_add_hidden_fields',1);
|
24 |
+
add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
|
25 |
+
|
26 |
+
/*hooks for AJAX Login & Register email validation*/
|
27 |
+
add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
|
28 |
+
add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
|
29 |
+
$cleantalk_hooked_actions[]='validate_email';
|
30 |
+
|
31 |
+
/*hooks for user registration*/
|
32 |
+
add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
|
33 |
+
|
34 |
+
/*hooks for WPUF pro */
|
35 |
+
//add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
|
36 |
+
//add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
|
37 |
+
add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
|
38 |
+
add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
|
39 |
+
$cleantalk_hooked_actions[]='submit_register';
|
40 |
+
|
41 |
+
/*hooks for MyMail */
|
42 |
+
//add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
|
43 |
+
//add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
|
44 |
+
add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
|
45 |
+
add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
|
46 |
+
$cleantalk_hooked_actions[]='form_submit';
|
47 |
+
|
48 |
+
/*hooks for MailPoet */
|
49 |
+
//add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
|
50 |
+
//add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
|
51 |
+
add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
|
52 |
+
add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
|
53 |
+
$cleantalk_hooked_actions[]='wysija_ajax';
|
54 |
+
|
55 |
+
/*hooks for cs_registration_validation */
|
56 |
+
//add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
57 |
+
//add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
58 |
+
add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
|
59 |
+
add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
|
60 |
+
$cleantalk_hooked_actions[]='cs_registration_validation';
|
61 |
+
|
62 |
+
/*hooks for send_message and request_appointment */
|
63 |
+
//add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
|
64 |
+
//add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
|
65 |
+
//add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
|
66 |
+
//add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
|
67 |
+
add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
|
68 |
+
add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
|
69 |
+
add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
|
70 |
+
add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
|
71 |
+
$cleantalk_hooked_actions[]='send_message';
|
72 |
+
$cleantalk_hooked_actions[]='request_appointment';
|
73 |
+
|
74 |
+
/*hooks for zn_do_login */
|
75 |
+
//add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
|
76 |
+
//add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
|
77 |
+
add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
|
78 |
+
add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
|
79 |
+
$cleantalk_hooked_actions[]='zn_do_login';
|
80 |
+
|
81 |
+
/*hooks for zn_do_login */
|
82 |
+
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
|
83 |
+
//add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
|
84 |
+
if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
|
85 |
+
add_filter('preprocess_comment', 'ct_ajax_hook', 1);
|
86 |
+
//add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
|
87 |
+
//add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
|
88 |
+
$cleantalk_hooked_actions[]='cscf-submitform';
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
+
/*hooks for visual form builder */
|
93 |
+
//add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
|
94 |
+
//add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
|
95 |
+
add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
|
96 |
+
add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
|
97 |
+
$cleantalk_hooked_actions[]='vfb_submit';
|
98 |
+
|
99 |
+
/*hooks for woocommerce_checkout*/
|
100 |
+
add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
|
101 |
+
add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
|
102 |
+
$cleantalk_hooked_actions[]='woocommerce_checkout';
|
103 |
+
$cleantalk_hooked_actions[]='wcfm_ajax_controller';
|
104 |
+
|
105 |
+
/*hooks for frm_action*/
|
106 |
+
add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
|
107 |
+
add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
|
108 |
+
$cleantalk_hooked_actions[]='frm_entries_create';
|
109 |
+
|
110 |
+
add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
|
111 |
+
add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
|
112 |
+
$cleantalk_hooked_actions[]='td_mod_register';
|
113 |
+
|
114 |
+
/*hooks for tevolution theme*/
|
115 |
+
add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
|
116 |
+
add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
|
117 |
+
add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
|
118 |
+
add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
|
119 |
+
add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
|
120 |
+
add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
|
121 |
+
$cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
|
122 |
+
$cleantalk_hooked_actions[]='tevolution_submit_from_preview';
|
123 |
+
$cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
|
124 |
+
|
125 |
+
/* hooks for contact forms by web settler ajax*/
|
126 |
+
add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
|
127 |
+
$cleantalk_hooked_actions[]='smuzform_form_submit';
|
128 |
+
|
129 |
+
/* hooks for reviewer plugin*/
|
130 |
+
add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
|
131 |
+
$cleantalk_hooked_actions[]='rwp-submit-wrap';
|
132 |
+
|
133 |
+
$cleantalk_hooked_actions[]='post_update';
|
134 |
+
|
135 |
+
/* Ninja Forms hoocked actions */
|
136 |
+
$cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
|
137 |
+
$cleantalk_hooked_actions[]='nf_ajax_submit';
|
138 |
+
$cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
|
139 |
+
|
140 |
+
/* Follow-Up Emails */
|
141 |
+
$cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
|
142 |
+
|
143 |
+
/* Follow-Up Emails */
|
144 |
+
$cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
|
145 |
+
|
146 |
+
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
147 |
+
|
148 |
+
$email = is_null( $email ) ? $email : $_POST['email'];
|
149 |
+
$email = sanitize_email($email);
|
150 |
+
$is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
|
151 |
+
|
152 |
+
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
|
153 |
+
|
154 |
+
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
155 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
156 |
+
if ($checkjs === null){
|
157 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
158 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
159 |
+
}
|
160 |
+
|
161 |
+
//Making a call
|
162 |
+
$base_call_result = apbct_base_call(
|
163 |
+
array(
|
164 |
+
'sender_email' => $email,
|
165 |
+
'sender_nickname' => '',
|
166 |
+
'sender_info' => $sender_info,
|
167 |
+
'js_on' => $checkjs,
|
168 |
+
),
|
169 |
+
true
|
170 |
+
);
|
171 |
+
|
172 |
+
$ct_result = $base_call_result['ct_result'];
|
173 |
+
|
174 |
+
if ($ct_result->allow===0){
|
175 |
+
$is_good=false;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
if($is_good){
|
180 |
+
$ajaxresult=array(
|
181 |
+
'description' => null,
|
182 |
+
'cssClass' => 'noon',
|
183 |
+
'code' => 'success'
|
184 |
+
);
|
185 |
+
}else{
|
186 |
+
$ajaxresult=array(
|
187 |
+
'description' => 'Invalid Email',
|
188 |
+
'cssClass' => 'error-container',
|
189 |
+
'code' => 'error'
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
$ajaxresult = json_encode($ajaxresult);
|
194 |
+
print $ajaxresult;
|
195 |
+
wp_die();
|
196 |
+
}
|
197 |
+
|
198 |
+
function ct_user_register_ajaxlogin($user_id)
|
199 |
+
{
|
200 |
+
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
201 |
+
{
|
202 |
+
|
203 |
+
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
204 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
205 |
+
if ($checkjs === null){
|
206 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
207 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
208 |
+
}
|
209 |
+
|
210 |
+
//Making a call
|
211 |
+
$base_call_result = apbct_base_call(
|
212 |
+
array(
|
213 |
+
'sender_email' => sanitize_email($_POST['email']),
|
214 |
+
'sender_nickname' => sanitize_email($_POST['login']),
|
215 |
+
'sender_info' => $sender_info,
|
216 |
+
'js_on' => $checkjs,
|
217 |
+
),
|
218 |
+
true
|
219 |
+
);
|
220 |
+
|
221 |
+
$ct_result = $base_call_result['ct_result'];
|
222 |
+
|
223 |
+
if ($ct_result->allow === 0)
|
224 |
+
{
|
225 |
+
wp_delete_user($user_id);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
return $user_id;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
|
233 |
+
*
|
234 |
+
* @param array $errors
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
function ct_mc4wp_ajax_hook( array $errors )
|
238 |
+
{
|
239 |
+
$result = ct_ajax_hook();
|
240 |
+
|
241 |
+
// only return modified errors array when function returned a string value (the message key)
|
242 |
+
if( is_string( $result ) ) {
|
243 |
+
$errors[] = $result;
|
244 |
+
}
|
245 |
+
|
246 |
+
return $errors;
|
247 |
+
}
|
248 |
+
|
249 |
+
function ct_ajax_hook($message_obj = false, $additional = false)
|
250 |
+
{
|
251 |
+
global $apbct, $current_user;
|
252 |
+
|
253 |
+
$message_obj = (array)$message_obj;
|
254 |
+
|
255 |
+
// Get current_user and set it globaly
|
256 |
+
apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
|
257 |
+
|
258 |
+
// Go out because of not spam data
|
259 |
+
$skip_post = array(
|
260 |
+
'gmaps_display_info_window', // Geo My WP pop-up windows.
|
261 |
+
'gmw_ps_display_info_window', // Geo My WP pop-up windows.
|
262 |
+
'the_champ_user_auth', // Super Socializer
|
263 |
+
'simbatfa-init-otp', //Two-Factor Auth
|
264 |
+
'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
|
265 |
+
'boss_we_login', //Login form
|
266 |
+
'sidebar_login_process', // Login CF7
|
267 |
+
'cp_update_style_settings', // Convert Pro. Saving settings
|
268 |
+
'updraft_savesettings', // UpdraftPlus
|
269 |
+
'wpdUpdateAutomatically', //Comments update
|
270 |
+
'upload-attachment', // Skip ulpload attachments
|
271 |
+
'iwj_update_profile', //Skip profile page checker
|
272 |
+
'st_partner_create_service', //Skip add hotel via admin
|
273 |
+
'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
|
274 |
+
'mailster_send_test', //Mailster send test admin
|
275 |
+
'acf/validate_save_post', //ACF validate post admin
|
276 |
+
'admin:saveThemeOptions', //Ait-theme admin checking
|
277 |
+
'save_tourmaster_option', //Tourmaster admin save
|
278 |
+
'validate_register_email', // Service id #313320
|
279 |
+
'elementor_pro_forms_send_form', //Elementor Pro
|
280 |
+
'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
|
281 |
+
'ihc_check_reg_field_ajax', //Ajax check required fields
|
282 |
+
'OSTC_lostPassword', //Lost password ajax form
|
283 |
+
'check_retina_image_availability', //There are too many ajax requests from mobile
|
284 |
+
'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
|
285 |
+
'edit-comment', // Edit comments by admin ??? that shouldn't happen
|
286 |
+
'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
|
287 |
+
'wpdmpp_save_settings', // PayPal save settings.
|
288 |
+
);
|
289 |
+
|
290 |
+
// Skip test if
|
291 |
+
if( !$apbct->settings['general_contact_forms_test'] || // Test disabled
|
292 |
+
!apbct_is_user_enable($apbct->user) || // User is admin, editor, author
|
293 |
+
// (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
|
294 |
+
($apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
|
295 |
+
apbct_exclusions_check__url() || // url exclusions
|
296 |
+
(isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
|
297 |
+
(isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
|
298 |
+
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
299 |
+
// QAEngine Theme fix
|
300 |
+
( strval(current_action()) != 'et_pre_insert_answer' &&
|
301 |
+
(
|
302 |
+
(isset($message_obj['author']) && intval($message_obj['author']) == 0) ||
|
303 |
+
(isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)
|
304 |
+
)
|
305 |
+
)
|
306 |
+
)
|
307 |
+
{
|
308 |
+
return false;
|
309 |
+
}
|
310 |
+
|
311 |
+
//General post_info for all ajax calls
|
312 |
+
$post_info = array('comment_type' => 'feedback_ajax');
|
313 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
314 |
+
|
315 |
+
if(isset($_POST['user_login']))
|
316 |
+
$sender_nickname = $_POST['user_login'];
|
317 |
+
else
|
318 |
+
$sender_nickname = '';
|
319 |
+
|
320 |
+
//QAEngine Theme answers
|
321 |
+
if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
|
322 |
+
$curr_user = get_user_by('id', $message_obj['author']);
|
323 |
+
if (!$curr_user)
|
324 |
+
$curr_user = get_user_by('id', $message_obj['post_author']);
|
325 |
+
$ct_post_temp['comment'] = $message_obj['post_content'];
|
326 |
+
$ct_post_temp['email'] = $curr_user->data->user_email;
|
327 |
+
$ct_post_temp['name'] = $curr_user->data->user_login;
|
328 |
+
}
|
329 |
+
|
330 |
+
//CSCF fix
|
331 |
+
if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){
|
332 |
+
$ct_post_temp[] = $message_obj['comment_author'];
|
333 |
+
$ct_post_temp[] = $message_obj['comment_author_email'];
|
334 |
+
$ct_post_temp[] = $message_obj['comment_content'];
|
335 |
+
}
|
336 |
+
|
337 |
+
//??? fix
|
338 |
+
if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){
|
339 |
+
$ct_post_temp=$_POST;
|
340 |
+
$ct_post_temp['target']=1;
|
341 |
+
}
|
342 |
+
|
343 |
+
//UserPro fix
|
344 |
+
if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
|
345 |
+
$ct_post_temp = $_POST;
|
346 |
+
$ct_post_temp['shortcode'] = '';
|
347 |
+
}
|
348 |
+
//Reviewer fix
|
349 |
+
if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
|
350 |
+
{
|
351 |
+
$ct_post_temp['name'] = $_POST['user_name'];
|
352 |
+
$ct_post_temp['email'] = $_POST['user_email'];
|
353 |
+
$ct_post_temp['comment'] = $_POST['comment'];
|
354 |
+
}
|
355 |
+
//Woocommerce checkout
|
356 |
+
if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
|
357 |
+
$post_info['comment_type'] = 'order';
|
358 |
+
}
|
359 |
+
//Easy Forms for Mailchimp
|
360 |
+
if( isset($_POST['action']) && $_POST['action']=='process_form_submission' ){
|
361 |
+
$post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
|
362 |
+
if( isset($_POST['form_data']) ) {
|
363 |
+
$form_data = explode( '&', $_POST['form_data'] );
|
364 |
+
$form_data_arr = array();
|
365 |
+
foreach ( $form_data as $val ) {
|
366 |
+
$form_data_element = explode( '=', $val );
|
367 |
+
$form_data_arr[$form_data_element[0]] = @$form_data_element[1];
|
368 |
+
}
|
369 |
+
if( isset( $form_data_arr['EMAIL'] ) ) {
|
370 |
+
$ct_post_temp['email'] = $form_data_arr['EMAIL'];
|
371 |
+
}
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
$ct_temp_msg_data = isset($ct_post_temp)
|
376 |
+
? ct_get_fields_any($ct_post_temp)
|
377 |
+
: ct_get_fields_any($_POST);
|
378 |
+
|
379 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
380 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
381 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
382 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
383 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
384 |
+
if($subject != '') {
|
385 |
+
$message['subject'] = $subject;
|
386 |
+
}
|
387 |
+
|
388 |
+
// Skip submission if no data found
|
389 |
+
if ($sender_email === ''|| !$contact_form)
|
390 |
+
return false;
|
391 |
+
|
392 |
+
// Mailpoet fix
|
393 |
+
if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns')
|
394 |
+
return false;
|
395 |
+
// Mailpoet3 admin skip fix
|
396 |
+
if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save')
|
397 |
+
return false;
|
398 |
+
|
399 |
+
// WP Foto Vote Fix
|
400 |
+
if (!empty($_FILES)){
|
401 |
+
foreach($message as $key => $value){
|
402 |
+
if(strpos($key, 'oje') !== false)
|
403 |
+
return;
|
404 |
+
} unset($key ,$value);
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* @todo Contact form detect
|
409 |
+
*/
|
410 |
+
// Detect contact form an set it's name to $contact_form to use later
|
411 |
+
$contact_form = null;
|
412 |
+
foreach($_POST as $param => $value){
|
413 |
+
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
414 |
+
$contact_form = 'contact_form_divi_theme';
|
415 |
+
$contact_form_additional = str_replace($param, '', $param);
|
416 |
+
}
|
417 |
+
if(strpos($param, 'avia_generated_form') === 0){
|
418 |
+
$contact_form = 'contact_form_enfold_theme';
|
419 |
+
$contact_form_additional = str_replace('avia_generated_form', '', $param);
|
420 |
+
}
|
421 |
+
if(!empty($contact_form))
|
422 |
+
break;
|
423 |
+
}
|
424 |
+
|
425 |
+
$base_call_result = apbct_base_call(
|
426 |
+
array(
|
427 |
+
'message' => $message,
|
428 |
+
'sender_email' => $sender_email,
|
429 |
+
'sender_nickname' => $sender_nickname,
|
430 |
+
'sender_info' => array('post_checkjs_passed' => $checkjs),
|
431 |
+
'post_info' => $post_info,
|
432 |
+
'js_on' => $checkjs,
|
433 |
+
)
|
434 |
+
);
|
435 |
+
$ct_result = $base_call_result['ct_result'];
|
436 |
+
|
437 |
+
if ($ct_result->allow == 0)
|
438 |
+
{
|
439 |
+
if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){
|
440 |
+
$result=Array('success'=>false,'error'=>$ct_result->comment);
|
441 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
442 |
+
print json_encode($result);
|
443 |
+
die();
|
444 |
+
}
|
445 |
+
else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit')
|
446 |
+
{
|
447 |
+
$result=Array('success'=>false,'html'=>$ct_result->comment);
|
448 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
449 |
+
print json_encode($result);
|
450 |
+
die();
|
451 |
+
}
|
452 |
+
else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail')
|
453 |
+
{
|
454 |
+
$result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
|
455 |
+
//@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
456 |
+
print $_GET['callback'].'('.json_encode($result).');';
|
457 |
+
die();
|
458 |
+
}
|
459 |
+
else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation')
|
460 |
+
{
|
461 |
+
$result=Array("type"=>"error","message"=>$ct_result->comment);
|
462 |
+
print json_encode($result);
|
463 |
+
die();
|
464 |
+
}
|
465 |
+
else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message'))
|
466 |
+
{
|
467 |
+
print $ct_result->comment;
|
468 |
+
die();
|
469 |
+
}
|
470 |
+
else if(isset($_POST['action']) && $_POST['action']=='zn_do_login')
|
471 |
+
{
|
472 |
+
print '<div id="login_error">'.$ct_result->comment.'</div>';
|
473 |
+
die();
|
474 |
+
}
|
475 |
+
else if(isset($_POST['action']) && $_POST['action']=='vfb_submit')
|
476 |
+
{
|
477 |
+
$result=Array('result'=>false,'message'=>$ct_result->comment);
|
478 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
479 |
+
print json_encode($result);
|
480 |
+
die();
|
481 |
+
}
|
482 |
+
else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
|
483 |
+
{
|
484 |
+
print $ct_result->comment;
|
485 |
+
die();
|
486 |
+
}
|
487 |
+
else if(isset($_POST['action']) && $_POST['action']=='frm_entries_create')
|
488 |
+
{
|
489 |
+
$result=Array('112'=>$ct_result->comment);
|
490 |
+
print json_encode($result);
|
491 |
+
die();
|
492 |
+
}
|
493 |
+
else if(isset($_POST['cma-action']) && $_POST['cma-action']=='add')
|
494 |
+
{
|
495 |
+
$result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
|
496 |
+
print json_encode($result);
|
497 |
+
die();
|
498 |
+
}
|
499 |
+
else if(isset($_POST['action']) && $_POST['action']=='td_mod_register')
|
500 |
+
{
|
501 |
+
print json_encode(array('register', 0, $ct_result->comment));
|
502 |
+
die();
|
503 |
+
}
|
504 |
+
else if(isset($_POST['action']) && $_POST['action']=='tmpl_ajax_check_user_email')
|
505 |
+
{
|
506 |
+
print "17,email";
|
507 |
+
die();
|
508 |
+
}
|
509 |
+
else if(isset($_POST['action']) && ($_POST['action']=='tevolution_submit_from_preview' || $_POST['action']=='submit_form_recaptcha_validation'))
|
510 |
+
{
|
511 |
+
print $ct_result->comment;
|
512 |
+
die();
|
513 |
+
}
|
514 |
+
// WooWaitList
|
515 |
+
// http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
|
516 |
+
else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
|
517 |
+
{
|
518 |
+
$result = array();
|
519 |
+
$result['error'] = 1;
|
520 |
+
$result['message'] = $ct_result->comment;
|
521 |
+
$result['code'] = 5; // Unused code number in WooWaitlist
|
522 |
+
print json_encode($result);
|
523 |
+
die();
|
524 |
+
}
|
525 |
+
// UserPro
|
526 |
+
else if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register')
|
527 |
+
{
|
528 |
+
foreach($_POST as $key => $value){
|
529 |
+
$output[$key]=$value;
|
530 |
+
}unset($key, $value);
|
531 |
+
$output['template'] = $ct_result->comment;
|
532 |
+
$output=json_encode($output);
|
533 |
+
print_r($output);
|
534 |
+
die;
|
535 |
+
}
|
536 |
+
// Quick event manager
|
537 |
+
else if(isset($_POST['action']) && $_POST['action']=='qem_validate_form'){
|
538 |
+
$errors[] = 'registration_forbidden';
|
539 |
+
$result = Array(
|
540 |
+
'success' => 'false',
|
541 |
+
'errors' => $errors,
|
542 |
+
'title' => $ct_result->comment
|
543 |
+
);
|
544 |
+
print json_encode($result);
|
545 |
+
die();
|
546 |
+
}
|
547 |
+
// Quick Contact Form
|
548 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'qcf_validate_form')
|
549 |
+
{
|
550 |
+
$result = Array(
|
551 |
+
'blurb' => "<h1>".$ct_result->comment."</h1>",
|
552 |
+
'display' => "Oops, got a few problems here",
|
553 |
+
'errors' => array(
|
554 |
+
0 => array(
|
555 |
+
error => 'error',
|
556 |
+
name => 'name'
|
557 |
+
),
|
558 |
+
),
|
559 |
+
'success' => 'false',
|
560 |
+
);
|
561 |
+
print json_encode($result);
|
562 |
+
die();
|
563 |
+
}
|
564 |
+
// Usernoise Contact Form
|
565 |
+
elseif(isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']))
|
566 |
+
{
|
567 |
+
return array($ct_result->comment);
|
568 |
+
die();
|
569 |
+
}
|
570 |
+
// amoForms
|
571 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'amoforms_submit')
|
572 |
+
{
|
573 |
+
$result = Array(
|
574 |
+
'result' => true,
|
575 |
+
'type' => "html",
|
576 |
+
'value' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
|
577 |
+
'fast' => false
|
578 |
+
);
|
579 |
+
print json_encode($result);
|
580 |
+
die();
|
581 |
+
}
|
582 |
+
// MailChimp for Wordpress Premium
|
583 |
+
elseif(!empty($_POST['_mc4wp_form_id']))
|
584 |
+
{
|
585 |
+
return 'ct_mc4wp_response';
|
586 |
+
}
|
587 |
+
// QAEngine Theme answers
|
588 |
+
elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
|
589 |
+
throw new Exception($ct_result->comment);
|
590 |
+
}
|
591 |
+
//ES Add subscriber
|
592 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'es_add_subscriber')
|
593 |
+
{
|
594 |
+
$result = Array(
|
595 |
+
'error' => 'unexpected-error',
|
596 |
+
);
|
597 |
+
print json_encode($result);
|
598 |
+
die();
|
599 |
+
}
|
600 |
+
//Convertplug. Strpos because action value dynamically changes and depends on mailing service
|
601 |
+
elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
|
602 |
+
$result = Array(
|
603 |
+
'action' => "message",
|
604 |
+
'detailed_msg' => "",
|
605 |
+
'email_status' => false,
|
606 |
+
'message' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
|
607 |
+
'status' => "error",
|
608 |
+
'url' => "none"
|
609 |
+
);
|
610 |
+
print json_encode($result);
|
611 |
+
die();
|
612 |
+
}
|
613 |
+
// Ultimate Form Builder
|
614 |
+
elseif (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
|
615 |
+
$result = Array(
|
616 |
+
'error_keys' => array(),
|
617 |
+
'error_flag' => 1,
|
618 |
+
'response_message' => $ct_result->comment
|
619 |
+
);
|
620 |
+
print json_encode($result);
|
621 |
+
die();
|
622 |
+
}
|
623 |
+
// Smart Forms
|
624 |
+
elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
|
625 |
+
$result = Array(
|
626 |
+
'message' => $ct_result->comment,
|
627 |
+
'refreshCaptcha' => 'n',
|
628 |
+
'success' => 'n'
|
629 |
+
);
|
630 |
+
print json_encode($result);
|
631 |
+
die();
|
632 |
+
}
|
633 |
+
//cFormsII
|
634 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
|
635 |
+
{
|
636 |
+
header('Content-Type: application/json');
|
637 |
+
$result = Array(
|
638 |
+
'no' => "",
|
639 |
+
'result' => "failure",
|
640 |
+
'html' =>$ct_result->comment,
|
641 |
+
'hide' => false,
|
642 |
+
'redirection' => null
|
643 |
+
|
644 |
+
);
|
645 |
+
print json_encode($result);
|
646 |
+
die();
|
647 |
+
}
|
648 |
+
//Contact Form by Web-Settler
|
649 |
+
elseif(isset($_POST['smFieldData']))
|
650 |
+
{
|
651 |
+
$result = Array(
|
652 |
+
'signal' => true,
|
653 |
+
'code' => 0,
|
654 |
+
'thanksMsg' => $ct_result->comment,
|
655 |
+
'errors' => array(),
|
656 |
+
'isMsg' => true,
|
657 |
+
'redirectUrl' => null
|
658 |
+
);
|
659 |
+
print json_encode($result);
|
660 |
+
die();
|
661 |
+
}
|
662 |
+
//Reviewer
|
663 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
|
664 |
+
{
|
665 |
+
$result = Array(
|
666 |
+
'success' => false,
|
667 |
+
'data' => array(0=>$ct_result->comment)
|
668 |
+
);
|
669 |
+
print json_encode($result);
|
670 |
+
die();
|
671 |
+
}
|
672 |
+
// CouponXXL Theme
|
673 |
+
elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
|
674 |
+
$result = array(
|
675 |
+
'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
|
676 |
+
);
|
677 |
+
die(json_encode($result));
|
678 |
+
}
|
679 |
+
//ConvertPro
|
680 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'cp_v2_notify_admin' || $_POST['action'] == 'cpro_notify_via_email')
|
681 |
+
{
|
682 |
+
$result = Array(
|
683 |
+
'success' => false,
|
684 |
+
'data' => array('error'=>$ct_result->comment,'style_slug'=>'convertprot-form'),
|
685 |
+
);
|
686 |
+
print json_encode($result);
|
687 |
+
die();
|
688 |
+
}
|
689 |
+
//Easy Forms for Mailchimp
|
690 |
+
elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
|
691 |
+
wp_send_json_error(
|
692 |
+
array(
|
693 |
+
'error' => 1,
|
694 |
+
'response' => $ct_result->comment
|
695 |
+
)
|
696 |
+
);
|
697 |
+
}
|
698 |
+
//Optin wheel
|
699 |
+
elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
|
700 |
+
wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
|
701 |
+
}
|
702 |
+
// Forminator
|
703 |
+
elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
|
704 |
+
wp_send_json_error(
|
705 |
+
array(
|
706 |
+
'message' => $ct_result->comment,
|
707 |
+
'success' => false,
|
708 |
+
'errors' => array(),
|
709 |
+
'behav' => 'behaviour-thankyou',
|
710 |
+
)
|
711 |
+
);
|
712 |
+
}
|
713 |
+
else
|
714 |
+
{
|
715 |
+
die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
|
716 |
+
}
|
717 |
+
}
|
718 |
+
//Allow == 1
|
719 |
+
else{
|
720 |
+
//QAEngine Theme answers
|
721 |
+
if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
|
722 |
+
return $message_obj;
|
723 |
+
}
|
724 |
+
}
|
725 |
+
}
|
inc/cleantalk-comments.php
CHANGED
@@ -1,726 +1,726 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
add_action('admin_menu', 'ct_add_comments_menu');
|
4 |
-
add_action( 'wp_ajax_ajax_check_comments', 'ct_ajax_check_comments' );
|
5 |
-
add_action( 'wp_ajax_ajax_info_comments', 'ct_ajax_info_comments' );
|
6 |
-
add_action( 'wp_ajax_ajax_insert_comments', 'ct_ajax_insert_comments' );
|
7 |
-
add_action( 'wp_ajax_ajax_delete_checked', 'ct_ajax_delete_checked' );
|
8 |
-
add_action( 'wp_ajax_ajax_delete_all', 'ct_ajax_delete_all' );
|
9 |
-
add_action( 'wp_ajax_ajax_clear_comments', 'ct_ajax_clear_comments' );
|
10 |
-
add_action( 'wp_ajax_ajax_ct_approve_comment', 'ct_comment_check_approve_comment' );
|
11 |
-
|
12 |
-
function ct_add_comments_menu(){
|
13 |
-
if(current_user_can('activate_plugins'))
|
14 |
-
add_comments_page( __("Check for spam", 'cleantalk'), __("Find spam comments", 'cleantalk'), 'read', 'ct_check_spam', 'ct_show_checkspam_page');
|
15 |
-
}
|
16 |
-
|
17 |
-
function ct_show_checkspam_page(){
|
18 |
-
|
19 |
-
global $apbct;
|
20 |
-
|
21 |
-
?>
|
22 |
-
<div class="wrap">
|
23 |
-
<h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
|
24 |
-
<a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
|
25 |
-
<br />
|
26 |
-
<?php
|
27 |
-
|
28 |
-
// If access key is unset in
|
29 |
-
if(!apbct_api_key__is_correct()){
|
30 |
-
if($apbct->moderate_ip == 1){
|
31 |
-
echo '<h3>'
|
32 |
-
.sprintf(
|
33 |
-
__('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
|
34 |
-
'<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
|
35 |
-
'</a>'
|
36 |
-
)
|
37 |
-
.'</h3>';
|
38 |
-
return;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
// Getting total spam comments
|
43 |
-
$args_spam = array(
|
44 |
-
'meta_query' => array(
|
45 |
-
Array(
|
46 |
-
'key' => 'ct_marked_as_spam',
|
47 |
-
'compare' => 'EXISTS'
|
48 |
-
)
|
49 |
-
),
|
50 |
-
'count'=>true
|
51 |
-
);
|
52 |
-
$cnt_spam = get_comments($args_spam);
|
53 |
-
|
54 |
-
?>
|
55 |
-
<!-- AJAX error message -->
|
56 |
-
<div id="ct_error_message" style="display:none">
|
57 |
-
<h3>
|
58 |
-
<?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
|
59 |
-
</h3>
|
60 |
-
<h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
|
61 |
-
</div>
|
62 |
-
|
63 |
-
<!-- Deleting message -->
|
64 |
-
<div id="ct_deleting_message" style="display:none;">
|
65 |
-
<?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left">
|
66 |
-
<?php echo $cnt_spam; ?>
|
67 |
-
</span>
|
68 |
-
</div>
|
69 |
-
|
70 |
-
<!-- Main info -->
|
71 |
-
<h3 id="ct_checking_status"><?php echo ct_ajax_info_comments(true);?></h3>
|
72 |
-
|
73 |
-
<!-- Check options -->
|
74 |
-
<div class="ct_to_hide" id="ct_check_params_wrapper">
|
75 |
-
<button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
|
76 |
-
<?php if(!empty($_COOKIE['ct_paused_comments_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
|
77 |
-
<p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
|
78 |
-
<br />
|
79 |
-
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
80 |
-
<input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
|
81 |
-
</div>
|
82 |
-
<p class="ct_check_params_desc"><?php _e("Allows to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
|
83 |
-
<br />
|
84 |
-
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
85 |
-
<input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
|
86 |
-
</div>
|
87 |
-
<div class="ct_check_params_desc">
|
88 |
-
<input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo ct_last_checked_comment(); ?>" disabled readonly />
|
89 |
-
<input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo date( "M j Y"); ?>" disabled readonly />
|
90 |
-
</div>
|
91 |
-
<div class="ct_check_params_desc">
|
92 |
-
<p>Begin/end dates of creation comments to check. If no date is specified, the plugin uses the last comments check date.</p>
|
93 |
-
</div>
|
94 |
-
<br>
|
95 |
-
<?php apbct_admin__badge__get_premium(); ?>
|
96 |
-
</div>
|
97 |
-
|
98 |
-
<!-- Cooling notice -->
|
99 |
-
<h3 id="ct_cooling_notice"></h3>
|
100 |
-
|
101 |
-
<!-- Preloader and working message -->
|
102 |
-
<div id="ct_preloader">
|
103 |
-
<img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
|
104 |
-
</div>
|
105 |
-
<div id="ct_working_message">
|
106 |
-
<?php _e("Please wait! CleanTalk is checking all approved and pending comments via blacklist database at cleantalk.org. You will have option to delete found spam comments after plugin finish.", 'cleantalk'); ?>
|
107 |
-
</div>
|
108 |
-
|
109 |
-
<!-- Pause button -->
|
110 |
-
<button class="button" id="ct_pause">Pause check</button>
|
111 |
-
|
112 |
-
<?php
|
113 |
-
|
114 |
-
// Pagination
|
115 |
-
$page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
|
116 |
-
$on_page = 20;
|
117 |
-
|
118 |
-
$args_spam = array(
|
119 |
-
'meta_query' => array(
|
120 |
-
Array(
|
121 |
-
'key' => 'ct_marked_as_spam',
|
122 |
-
'value' => '1',
|
123 |
-
'compare' => 'NUMERIC'
|
124 |
-
)
|
125 |
-
),
|
126 |
-
'number'=>$on_page,
|
127 |
-
'offset'=>($page-1)*$on_page
|
128 |
-
);
|
129 |
-
|
130 |
-
$c_spam = get_comments($args_spam);
|
131 |
-
if($cnt_spam>0){
|
132 |
-
|
133 |
-
$pages = ceil(intval($cnt_spam)/$on_page);
|
134 |
-
if($pages && $pages != 1){
|
135 |
-
echo "<div class='ct_to_hide pagination'>"
|
136 |
-
."<b>Pages:</b>"
|
137 |
-
."<ul class='pagination'>";
|
138 |
-
for($i = 1; $i <= $pages; $i++){
|
139 |
-
echo "<li class='pagination'>"
|
140 |
-
."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
|
141 |
-
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
142 |
-
."</a>"
|
143 |
-
."</li>";
|
144 |
-
}
|
145 |
-
echo "</ul>";
|
146 |
-
echo "</div>";
|
147 |
-
}
|
148 |
-
?>
|
149 |
-
<table class="ct_to_hide widefat fixed comments" id="ct_check_comments_table">
|
150 |
-
<thead>
|
151 |
-
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
152 |
-
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
153 |
-
<input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
|
154 |
-
</th>
|
155 |
-
<th scope="col" id="author" class="manage-column column-slug"><?php print _e( 'Author' ); ?></th>
|
156 |
-
<th scope="col" id="comment" class="manage-column column-comment"><?php _e( 'Comment', 'cleantalk'); ?></th>
|
157 |
-
<th scope="col" id="response" class="manage-column column-response sortable desc"><?php _e( 'In Response To', 'cleantalk' );?></th>
|
158 |
-
</thead>
|
159 |
-
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
160 |
-
<?php
|
161 |
-
for($i=0;$i<sizeof($c_spam);$i++){
|
162 |
-
$id = $c_spam[$i]->comment_ID;
|
163 |
-
$post_id = $c_spam[$i]->comment_post_ID;
|
164 |
-
$login = $c_spam[$i]->comment_author;
|
165 |
-
$email = $c_spam[$i]->comment_author_email;
|
166 |
-
$ip = $c_spam[$i]->comment_author_IP;
|
167 |
-
|
168 |
-
echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_comment' data-id='$id'>"
|
169 |
-
."<th scope='row' class='check-column'>"
|
170 |
-
."<label class='screen-reader-text' for='cb-select-$id'>Select comment</label>"
|
171 |
-
."<input id='cb-select-$id' type='checkbox' name='del_comments[]' value='$id'/>"
|
172 |
-
."</th>"
|
173 |
-
."<td class='author column-author' nowrap>"
|
174 |
-
."<strong>"
|
175 |
-
.get_avatar( $c_spam[$i]->user_id , 32)
|
176 |
-
."$login"
|
177 |
-
."</strong>"
|
178 |
-
."<br />"
|
179 |
-
."<br />";
|
180 |
-
|
181 |
-
// Outputs email if exists
|
182 |
-
if($email)
|
183 |
-
echo "<a href='mailto:$email'>$email</a>"
|
184 |
-
.(!$apbct->white_label
|
185 |
-
? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
|
186 |
-
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
187 |
-
."</a>"
|
188 |
-
: '');
|
189 |
-
else
|
190 |
-
echo "No email";
|
191 |
-
echo "<br/>";
|
192 |
-
|
193 |
-
// Outputs IP if exists
|
194 |
-
if($ip)
|
195 |
-
echo "<a href='edit-comments.php?s=$ip&mode=detail'>$ip </a>"
|
196 |
-
.(!$apbct->white_label
|
197 |
-
?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
|
198 |
-
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none'/>"
|
199 |
-
."</a>"
|
200 |
-
: '');
|
201 |
-
else
|
202 |
-
echo "No IP adress";
|
203 |
-
echo "</td>";
|
204 |
-
?>
|
205 |
-
<td class="comment column-comment">
|
206 |
-
<div class="submitted-on">
|
207 |
-
<?php printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), get_comment_link($id),
|
208 |
-
/* translators: comment date format. See http://php.net/date */
|
209 |
-
get_comment_date( __( 'Y/m/d' ),$id ),
|
210 |
-
get_comment_date( get_option( 'time_format' ),$id )
|
211 |
-
);
|
212 |
-
?>
|
213 |
-
|
214 |
-
</div>
|
215 |
-
<p>
|
216 |
-
<?php print $c_spam[$i]->comment_content; ?>
|
217 |
-
</p>
|
218 |
-
<div style="height:16px; display: none;" id='cleantalk_button_set_<?php print $id; ?>'>
|
219 |
-
<a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
|
220 |
-
|
|
221 |
-
<a href="#" class="cleantalk_delete_button" data-id="<?php print $id; ?>" style="color:#a00;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
|
222 |
-
</div>
|
223 |
-
</td>
|
224 |
-
<td class="response column-response">
|
225 |
-
<div>
|
226 |
-
<span>
|
227 |
-
<a href="/wp-admin/post.php?post=<?php print $post_id; ?>&action=edit"><?php print get_the_title($post_id); ?></a>
|
228 |
-
<br/>
|
229 |
-
<a href="/wp-admin/edit-comments.php?p=<?php print $post_id; ?>" class="post-com-count">
|
230 |
-
<span class="comment-count"><?php
|
231 |
-
$p_cnt=wp_count_comments();
|
232 |
-
print $p_cnt->total_comments;
|
233 |
-
?></span>
|
234 |
-
</a>
|
235 |
-
</span>
|
236 |
-
<a href="<?php print get_permalink($post_id); ?>"><?php print _e('View Post');?></a>
|
237 |
-
</div>
|
238 |
-
</td>
|
239 |
-
</tr>
|
240 |
-
<?php
|
241 |
-
}
|
242 |
-
?>
|
243 |
-
</tbody>
|
244 |
-
</table>
|
245 |
-
<?php
|
246 |
-
// Pagination
|
247 |
-
if($pages && $pages != 1){
|
248 |
-
echo "<div class='ct_to_hide pagination'>"
|
249 |
-
."<b>Pages:</b>"
|
250 |
-
."<ul class='pagination'>";
|
251 |
-
for($i = 1; $i <= $pages; $i++){
|
252 |
-
echo "<li class='pagination'>"
|
253 |
-
."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
|
254 |
-
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
255 |
-
."</a>"
|
256 |
-
."</li>";
|
257 |
-
}
|
258 |
-
echo "</ul>";
|
259 |
-
echo "</div>";
|
260 |
-
}
|
261 |
-
?>
|
262 |
-
<div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
|
263 |
-
<button class= "button" id="ct_delete_all"><?php _e('Delete all comments from the list', 'cleantalk'); ?></button>
|
264 |
-
<button class="button" id="ct_delete_checked"><?php _e('Delete selected', 'cleantalk'); ?></button><br /><br />
|
265 |
-
</div>
|
266 |
-
<?php
|
267 |
-
}
|
268 |
-
echo
|
269 |
-
echo
|
270 |
-
|
271 |
-
if($cnt_spam > 0){
|
272 |
-
echo "<div id='ct_search_info'>"
|
273 |
-
."<br />"
|
274 |
-
.__('There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.', 'cleantalk')
|
275 |
-
."</div>";
|
276 |
-
}
|
277 |
-
?>
|
278 |
-
<div>
|
279 |
-
<button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
|
280 |
-
</div>
|
281 |
-
</div>
|
282 |
-
<?php
|
283 |
-
}
|
284 |
-
|
285 |
-
function ct_ajax_check_comments(){
|
286 |
-
|
287 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
288 |
-
|
289 |
-
global $wpdb, $apbct;
|
290 |
-
|
291 |
-
if(isset($_POST['from'], $_POST['till'])){
|
292 |
-
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
293 |
-
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
294 |
-
}
|
295 |
-
|
296 |
-
// Gettings comments 100 unchecked comments
|
297 |
-
if(isset($_COOKIE['ct_comments_safe_check'])){
|
298 |
-
$c = $wpdb->get_results("
|
299 |
-
SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
|
300 |
-
FROM {$wpdb->comments} as comm
|
301 |
-
WHERE
|
302 |
-
(comm.comment_approved = '1' OR comm.comment_approved = '0')
|
303 |
-
AND NOT EXISTS(
|
304 |
-
SELECT comment_id, meta_key
|
305 |
-
FROM {$wpdb->commentmeta} as meta
|
306 |
-
WHERE comm.comment_ID = meta.comment_id AND (meta_key = 'ct_checked' OR meta_key = 'ct_bad')
|
307 |
-
)
|
308 |
-
ORDER BY comment_date_gmt
|
309 |
-
LIMIT 100",
|
310 |
-
ARRAY_A
|
311 |
-
);
|
312 |
-
}else{
|
313 |
-
$params = array(
|
314 |
-
'meta_query' => array(
|
315 |
-
'relation' => 'AND',
|
316 |
-
array(
|
317 |
-
'key' => 'ct_checked',
|
318 |
-
'compare' => 'NOT EXISTS'
|
319 |
-
),
|
320 |
-
array(
|
321 |
-
'key' => 'ct_bad',
|
322 |
-
'compare' => 'NOT EXISTS'
|
323 |
-
)
|
324 |
-
),
|
325 |
-
'orderby' => 'comment_date_gmt',
|
326 |
-
'order' => 'ASC',
|
327 |
-
'number' => 100
|
328 |
-
);
|
329 |
-
if(isset($from_date, $till_date)){
|
330 |
-
$params['date_query'] = array(
|
331 |
-
'column' => 'comment_date_gmt',
|
332 |
-
'after' => $from_date,
|
333 |
-
'before' => $till_date,
|
334 |
-
'inclusive' => true,
|
335 |
-
);
|
336 |
-
}
|
337 |
-
$c = get_comments( $params );
|
338 |
-
}
|
339 |
-
|
340 |
-
$check_result = array(
|
341 |
-
'end' => 0,
|
342 |
-
'checked' => 0,
|
343 |
-
'spam' => 0,
|
344 |
-
'bad' => 0,
|
345 |
-
'error' => 0
|
346 |
-
);
|
347 |
-
|
348 |
-
if(sizeof($c)>0){
|
349 |
-
|
350 |
-
// Coverting $c to objects
|
351 |
-
if(is_array($c[0])){
|
352 |
-
foreach($c as $key => $value){
|
353 |
-
$c[$key] = (object)$value;
|
354 |
-
} unset($key, $value);
|
355 |
-
}
|
356 |
-
|
357 |
-
if(!empty($_POST['accurate_check'])){
|
358 |
-
// Leaving comments only with first comment's date. Unsetting others.
|
359 |
-
|
360 |
-
foreach($c as $comment_index => $comment){
|
361 |
-
|
362 |
-
if(!isset($curr_date))
|
363 |
-
$curr_date = (substr($comment->comment_date_gmt, 0, 10) ? substr($comment->comment_date_gmt, 0, 10) : '');
|
364 |
-
|
365 |
-
if(substr($comment->comment_date_gmt, 0, 10) != $curr_date)
|
366 |
-
unset($c[$comment_index]);
|
367 |
-
|
368 |
-
}
|
369 |
-
unset($comment_index, $comment);
|
370 |
-
}
|
371 |
-
|
372 |
-
// Checking comments IP/Email. Gathering $data for check.
|
373 |
-
$data = Array();
|
374 |
-
for($i=0;$i<sizeof($c);$i++){
|
375 |
-
|
376 |
-
$curr_ip = $c[$i]->comment_author_IP;
|
377 |
-
$curr_email = $c[$i]->comment_author_email;
|
378 |
-
|
379 |
-
// Check for identity
|
380 |
-
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
381 |
-
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
382 |
-
|
383 |
-
if(empty($curr_ip) && empty($curr_email)){
|
384 |
-
$check_result['bad']++;
|
385 |
-
update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
|
386 |
-
unset($c[$i]);
|
387 |
-
}else{
|
388 |
-
if(!empty($curr_ip))
|
389 |
-
$data[] = $curr_ip;
|
390 |
-
if(!empty($curr_email))
|
391 |
-
$data[] = $curr_email;
|
392 |
-
// Patch for empty IP/Email
|
393 |
-
$c[$i]->comment_author_IP = empty($curr_ip) ? 'none' : $curr_ip;
|
394 |
-
$c[$i]->comment_author_email = empty($curr_email) ? 'none' : $curr_email;
|
395 |
-
}
|
396 |
-
}
|
397 |
-
|
398 |
-
// Recombining after checking and unsettting
|
399 |
-
$c = array_values($c);
|
400 |
-
|
401 |
-
// Drop if data empty and there's no comments to check
|
402 |
-
if(count($data) == 0){
|
403 |
-
if($_POST['unchecked'] === 0)
|
404 |
-
$check_result['end'] = 1;
|
405 |
-
print json_encode($check_result);
|
406 |
-
die();
|
407 |
-
}
|
408 |
-
|
409 |
-
$result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
|
410 |
-
|
411 |
-
if(empty($result['error'])){
|
412 |
-
|
413 |
-
for($i=0;$i<sizeof($c);$i++){
|
414 |
-
|
415 |
-
$mark_spam_ip = false;
|
416 |
-
$mark_spam_email = false;
|
417 |
-
|
418 |
-
$check_result['checked']++;
|
419 |
-
update_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
|
420 |
-
$uip=$c[$i]->comment_author_IP;
|
421 |
-
$uim=$c[$i]->comment_author_email;
|
422 |
-
|
423 |
-
if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
|
424 |
-
$mark_spam_ip = true;
|
425 |
-
|
426 |
-
if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
|
427 |
-
$mark_spam_email = true;
|
428 |
-
|
429 |
-
if ($mark_spam_ip || $mark_spam_email){
|
430 |
-
$check_result['spam']++;
|
431 |
-
update_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
|
432 |
-
}
|
433 |
-
}
|
434 |
-
print json_encode($check_result);
|
435 |
-
|
436 |
-
}else{
|
437 |
-
$check_result['error'] = 1;
|
438 |
-
$check_result['error_message'] = $result['error'];
|
439 |
-
echo json_encode($check_result);
|
440 |
-
}
|
441 |
-
}else{
|
442 |
-
$check_result['end'] = 1;
|
443 |
-
print json_encode($check_result);
|
444 |
-
}
|
445 |
-
|
446 |
-
die;
|
447 |
-
}
|
448 |
-
|
449 |
-
function ct_ajax_info_comments($direct_call = false){
|
450 |
-
|
451 |
-
if (!$direct_call)
|
452 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
453 |
-
|
454 |
-
global $wpdb;
|
455 |
-
|
456 |
-
$metas = array('', 'ct_marked_as_spam', 'ct_checked', 'ct_bad');
|
457 |
-
|
458 |
-
$result = array();
|
459 |
-
foreach($metas as $meta){
|
460 |
-
if(isset($_COOKIE['ct_comments_safe_check'])){
|
461 |
-
$res = $wpdb->get_results("
|
462 |
-
SELECT COUNT(DISTINCT comment_ID) AS cnt
|
463 |
-
FROM {$wpdb->comments} AS comm
|
464 |
-
WHERE comm.comment_approved IN ('1','0')".
|
465 |
-
(!empty($meta)
|
466 |
-
? " AND EXISTS (SELECT comment_id, meta_key
|
467 |
-
FROM {$wpdb->commentmeta} meta
|
468 |
-
WHERE comm.comment_ID = meta.comment_id AND meta_key = '$meta')"
|
469 |
-
: ''),
|
470 |
-
ARRAY_A);
|
471 |
-
$result[] = $res[0]['cnt'];
|
472 |
-
}else{
|
473 |
-
$params = array('fields' => 'ids', 'count' => true);
|
474 |
-
if(!empty($meta))
|
475 |
-
$params['meta_key'] = $meta;
|
476 |
-
$result[] = get_comments( $params );
|
477 |
-
}
|
478 |
-
}
|
479 |
-
|
480 |
-
$cnt = $result[0]; // Total comments
|
481 |
-
$cnt_spam = $result[1]; // Spam comments
|
482 |
-
$cnt_checked = $result[2]; // Checked comments
|
483 |
-
$cnt_bad = $result[3]; // Bad comments (without IP and Email)
|
484 |
-
|
485 |
-
$return = array(
|
486 |
-
'message' => '',
|
487 |
-
'total' => $cnt,
|
488 |
-
'spam' => $cnt_spam,
|
489 |
-
'checked' => $cnt_checked,
|
490 |
-
'bad' => $cnt_bad,
|
491 |
-
);
|
492 |
-
|
493 |
-
$return['message'] .= sprintf (__("Total comments %s. Checked %s. Last check %s. Found %s spam comments. %s bad comments (without IP or email).", 'cleantalk'), $cnt, $cnt_checked, ct_get_last_comment_check_date(), $cnt_spam, $cnt_bad);
|
494 |
-
|
495 |
-
$backup_notice = ' ';
|
496 |
-
if ($cnt_spam > 0){
|
497 |
-
$backup_notice = __("Please do backup of WordPress database before delete any comments!", 'cleantalk');
|
498 |
-
}
|
499 |
-
$return['message'] .= "<p>$backup_notice</p>";
|
500 |
-
|
501 |
-
if($direct_call){
|
502 |
-
return $return['message'];
|
503 |
-
}else{
|
504 |
-
echo json_encode($return);
|
505 |
-
die();
|
506 |
-
}
|
507 |
-
|
508 |
-
}
|
509 |
-
|
510 |
-
|
511 |
-
function ct_ajax_insert_comments(){
|
512 |
-
|
513 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
514 |
-
|
515 |
-
//* DELETION
|
516 |
-
if(!empty($_POST['delete'])){
|
517 |
-
$comments = get_comments(array('author_email' => 'stop_email@example.com'));
|
518 |
-
$deleted = 0;
|
519 |
-
$amount_to_delete = 15;
|
520 |
-
foreach($comments as $comment){
|
521 |
-
if($deleted >= $amount_to_delete)
|
522 |
-
break;
|
523 |
-
if(wp_delete_comment($comment->comment_ID, true))
|
524 |
-
$deleted++;
|
525 |
-
}
|
526 |
-
print "$deleted";
|
527 |
-
die();
|
528 |
-
}
|
529 |
-
|
530 |
-
//* INSERTION
|
531 |
-
global $wpdb;
|
532 |
-
|
533 |
-
$to_insert = 100;
|
534 |
-
$time = current_time('timestamp')-(730*86400);
|
535 |
-
|
536 |
-
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
537 |
-
|
538 |
-
if($result){
|
539 |
-
$ip = array();
|
540 |
-
foreach($result as $value){
|
541 |
-
$ips[] = long2ip($value['network']);
|
542 |
-
}
|
543 |
-
unset($value);
|
544 |
-
|
545 |
-
$inserted = 0;
|
546 |
-
for($i=0, $j=0; $i<$to_insert; $i++, $j++){
|
547 |
-
|
548 |
-
if(!isset($ips[$j]))
|
549 |
-
$j=0;
|
550 |
-
|
551 |
-
$rnd=mt_rand(1,100);
|
552 |
-
|
553 |
-
$email="stop_email@example.com";
|
554 |
-
|
555 |
-
$data = array(
|
556 |
-
'comment_post_ID' => 1,
|
557 |
-
'comment_author' => "author_$rnd",
|
558 |
-
'comment_author_email' => $email,
|
559 |
-
'comment_author_url' => 'http://',
|
560 |
-
'comment_content' => "comment content ".mt_rand(1,10000)." ".mt_rand(1,10000)." ".mt_rand(1,10000),
|
561 |
-
'comment_type' => '',
|
562 |
-
'comment_parent' => 0,
|
563 |
-
'user_id' => 1,
|
564 |
-
'comment_author_IP' => $ips[$j],
|
565 |
-
'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
|
566 |
-
'comment_date' => date('Y-m-d H:i:s', $time),
|
567 |
-
'comment_approved' => 1,
|
568 |
-
);
|
569 |
-
|
570 |
-
wp_insert_comment($data);
|
571 |
-
$time = $time + 86400;
|
572 |
-
$inserted++;
|
573 |
-
}
|
574 |
-
}else{
|
575 |
-
$inserted = '0';
|
576 |
-
}
|
577 |
-
|
578 |
-
print $inserted;
|
579 |
-
die();
|
580 |
-
}
|
581 |
-
|
582 |
-
function ct_ajax_delete_checked(){
|
583 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
584 |
-
foreach($_POST['ids'] as $key=>$value){
|
585 |
-
wp_delete_comment($value, false);
|
586 |
-
}
|
587 |
-
die();
|
588 |
-
}
|
589 |
-
|
590 |
-
function ct_ajax_delete_all(){
|
591 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
592 |
-
$args_spam = array(
|
593 |
-
'number'=>100,
|
594 |
-
'meta_query' => array(
|
595 |
-
Array(
|
596 |
-
'key' => 'ct_marked_as_spam',
|
597 |
-
'value' => '1',
|
598 |
-
'compare' => 'NUMERIC'
|
599 |
-
)
|
600 |
-
)
|
601 |
-
);
|
602 |
-
$c_spam=get_comments($args_spam);
|
603 |
-
|
604 |
-
$cnt=sizeof($c_spam);
|
605 |
-
|
606 |
-
$args_spam = array(
|
607 |
-
'count'=>true,
|
608 |
-
'meta_query' => array(
|
609 |
-
Array(
|
610 |
-
'key' => 'ct_marked_as_spam',
|
611 |
-
'value' => '1',
|
612 |
-
'compare' => 'NUMERIC'
|
613 |
-
)
|
614 |
-
)
|
615 |
-
);
|
616 |
-
$cnt_all=get_comments($args_spam);
|
617 |
-
|
618 |
-
for($i=0;$i<sizeof($c_spam);$i++){
|
619 |
-
wp_delete_comment($c_spam[$i]->comment_ID, false);
|
620 |
-
usleep(10000);
|
621 |
-
}
|
622 |
-
print $cnt_all;
|
623 |
-
die();
|
624 |
-
}
|
625 |
-
|
626 |
-
function ct_ajax_clear_comments(){
|
627 |
-
|
628 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
629 |
-
|
630 |
-
if ( isset($_POST['from']) && isset($_POST['till']) ) {
|
631 |
-
if ( preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['from'] ) && preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['till'] ) ) {
|
632 |
-
|
633 |
-
$from = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
|
634 |
-
$till = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
|
635 |
-
|
636 |
-
global $wpdb;
|
637 |
-
$query_result = $wpdb->query("DELETE FROM {$wpdb->commentmeta} WHERE
|
638 |
-
meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad')
|
639 |
-
AND meta_value >= '{$from}'
|
640 |
-
AND meta_value <= '{$till}';");
|
641 |
-
|
642 |
-
die();
|
643 |
-
|
644 |
-
}
|
645 |
-
}
|
646 |
-
|
647 |
-
}
|
648 |
-
|
649 |
-
/**
|
650 |
-
* Admin action 'comment_unapproved_to_approved' - Approve comment, delete from the deleting list
|
651 |
-
*/
|
652 |
-
function ct_comment_check_approve_comment(){
|
653 |
-
|
654 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
655 |
-
|
656 |
-
$id=$_POST['id'];
|
657 |
-
$comment = get_comment($id, 'ARRAY_A');
|
658 |
-
$comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
|
659 |
-
$comment['comment_approved'] = 1;
|
660 |
-
update_comment_meta($id, 'ct_marked_as_spam', 0);
|
661 |
-
wp_update_comment($comment);
|
662 |
-
|
663 |
-
die();
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* Get date last checked comment or date of the first comment
|
668 |
-
*
|
669 |
-
* @return string date "M j Y"
|
670 |
-
*/
|
671 |
-
function ct_last_checked_comment() {
|
672 |
-
|
673 |
-
$params = array(
|
674 |
-
'fields' => 'ids',
|
675 |
-
'meta_key' => 'ct_checked',
|
676 |
-
'orderby' => 'ct_checked',
|
677 |
-
'order' => 'ASC'
|
678 |
-
);
|
679 |
-
$checked_comments = get_comments( $params );
|
680 |
-
|
681 |
-
if ( ! empty($checked_comments) ) {
|
682 |
-
|
683 |
-
return get_comment_date( "M j Y", end( $checked_comments ) );
|
684 |
-
|
685 |
-
} else {
|
686 |
-
|
687 |
-
$params = array(
|
688 |
-
'fields' => 'ids',
|
689 |
-
'orderby' => 'comment_date_gmt',
|
690 |
-
'order' => 'ASC',
|
691 |
-
'number' => 1
|
692 |
-
);
|
693 |
-
$first_comment = get_comments( $params );
|
694 |
-
|
695 |
-
return get_comment_date( "M j Y", current( $first_comment ) );
|
696 |
-
|
697 |
-
}
|
698 |
-
|
699 |
-
}
|
700 |
-
|
701 |
-
/**
|
702 |
-
* Get last comments check date.
|
703 |
-
*
|
704 |
-
* @return string|null Date format"M j Y" or datetime format or null
|
705 |
-
*/
|
706 |
-
function ct_get_last_comment_check_date( $timestamp = false ) {
|
707 |
-
|
708 |
-
$params = array(
|
709 |
-
'fields' => 'ids',
|
710 |
-
'meta_key' => 'ct_checked',
|
711 |
-
'orderby' => 'comment_date_gmt',
|
712 |
-
'order' => 'ASC'
|
713 |
-
);
|
714 |
-
$checked_comments = get_comments( $params );
|
715 |
-
|
716 |
-
$last_check = null;
|
717 |
-
|
718 |
-
if( ! empty( $checked_comments ) ) {
|
719 |
-
|
720 |
-
$last_check = $timestamp ? get_comment_meta( end( $checked_comments ), 'ct_checked', true ) : date( "M j Y", strtotime( get_comment_meta( end( $checked_comments ), 'ct_checked', true ) ) );
|
721 |
-
|
722 |
-
}
|
723 |
-
|
724 |
-
return $last_check;
|
725 |
-
|
726 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action('admin_menu', 'ct_add_comments_menu');
|
4 |
+
add_action( 'wp_ajax_ajax_check_comments', 'ct_ajax_check_comments' );
|
5 |
+
add_action( 'wp_ajax_ajax_info_comments', 'ct_ajax_info_comments' );
|
6 |
+
add_action( 'wp_ajax_ajax_insert_comments', 'ct_ajax_insert_comments' );
|
7 |
+
add_action( 'wp_ajax_ajax_delete_checked', 'ct_ajax_delete_checked' );
|
8 |
+
add_action( 'wp_ajax_ajax_delete_all', 'ct_ajax_delete_all' );
|
9 |
+
add_action( 'wp_ajax_ajax_clear_comments', 'ct_ajax_clear_comments' );
|
10 |
+
add_action( 'wp_ajax_ajax_ct_approve_comment', 'ct_comment_check_approve_comment' );
|
11 |
+
|
12 |
+
function ct_add_comments_menu(){
|
13 |
+
if(current_user_can('activate_plugins'))
|
14 |
+
add_comments_page( __("Check for spam", 'cleantalk'), __("Find spam comments", 'cleantalk'), 'read', 'ct_check_spam', 'ct_show_checkspam_page');
|
15 |
+
}
|
16 |
+
|
17 |
+
function ct_show_checkspam_page(){
|
18 |
+
|
19 |
+
global $apbct;
|
20 |
+
|
21 |
+
?>
|
22 |
+
<div class="wrap">
|
23 |
+
<h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
|
24 |
+
<a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
|
25 |
+
<br />
|
26 |
+
<?php
|
27 |
+
|
28 |
+
// If access key is unset in
|
29 |
+
if(!apbct_api_key__is_correct()){
|
30 |
+
if($apbct->moderate_ip == 1){
|
31 |
+
echo '<h3>'
|
32 |
+
.sprintf(
|
33 |
+
__('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
|
34 |
+
'<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
|
35 |
+
'</a>'
|
36 |
+
)
|
37 |
+
.'</h3>';
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
// Getting total spam comments
|
43 |
+
$args_spam = array(
|
44 |
+
'meta_query' => array(
|
45 |
+
Array(
|
46 |
+
'key' => 'ct_marked_as_spam',
|
47 |
+
'compare' => 'EXISTS'
|
48 |
+
)
|
49 |
+
),
|
50 |
+
'count'=>true
|
51 |
+
);
|
52 |
+
$cnt_spam = get_comments($args_spam);
|
53 |
+
|
54 |
+
?>
|
55 |
+
<!-- AJAX error message -->
|
56 |
+
<div id="ct_error_message" style="display:none">
|
57 |
+
<h3>
|
58 |
+
<?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
|
59 |
+
</h3>
|
60 |
+
<h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
|
61 |
+
</div>
|
62 |
+
|
63 |
+
<!-- Deleting message -->
|
64 |
+
<div id="ct_deleting_message" style="display:none;">
|
65 |
+
<?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left">
|
66 |
+
<?php echo $cnt_spam; ?>
|
67 |
+
</span>
|
68 |
+
</div>
|
69 |
+
|
70 |
+
<!-- Main info -->
|
71 |
+
<h3 id="ct_checking_status"><?php echo ct_ajax_info_comments(true);?></h3>
|
72 |
+
|
73 |
+
<!-- Check options -->
|
74 |
+
<div class="ct_to_hide" id="ct_check_params_wrapper">
|
75 |
+
<button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
|
76 |
+
<?php if(!empty($_COOKIE['ct_paused_comments_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
|
77 |
+
<p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
|
78 |
+
<br />
|
79 |
+
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
80 |
+
<input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
|
81 |
+
</div>
|
82 |
+
<p class="ct_check_params_desc"><?php _e("Allows to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
|
83 |
+
<br />
|
84 |
+
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
85 |
+
<input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
|
86 |
+
</div>
|
87 |
+
<div class="ct_check_params_desc">
|
88 |
+
<input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo ct_last_checked_comment(); ?>" disabled readonly />
|
89 |
+
<input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo date( "M j Y"); ?>" disabled readonly />
|
90 |
+
</div>
|
91 |
+
<div class="ct_check_params_desc">
|
92 |
+
<p>Begin/end dates of creation comments to check. If no date is specified, the plugin uses the last comments check date.</p>
|
93 |
+
</div>
|
94 |
+
<br>
|
95 |
+
<?php apbct_admin__badge__get_premium(); ?>
|
96 |
+
</div>
|
97 |
+
|
98 |
+
<!-- Cooling notice -->
|
99 |
+
<h3 id="ct_cooling_notice"></h3>
|
100 |
+
|
101 |
+
<!-- Preloader and working message -->
|
102 |
+
<div id="ct_preloader">
|
103 |
+
<img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
|
104 |
+
</div>
|
105 |
+
<div id="ct_working_message">
|
106 |
+
<?php _e("Please wait! CleanTalk is checking all approved and pending comments via blacklist database at cleantalk.org. You will have option to delete found spam comments after plugin finish.", 'cleantalk'); ?>
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<!-- Pause button -->
|
110 |
+
<button class="button" id="ct_pause">Pause check</button>
|
111 |
+
|
112 |
+
<?php
|
113 |
+
|
114 |
+
// Pagination
|
115 |
+
$page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
|
116 |
+
$on_page = 20;
|
117 |
+
|
118 |
+
$args_spam = array(
|
119 |
+
'meta_query' => array(
|
120 |
+
Array(
|
121 |
+
'key' => 'ct_marked_as_spam',
|
122 |
+
'value' => '1',
|
123 |
+
'compare' => 'NUMERIC'
|
124 |
+
)
|
125 |
+
),
|
126 |
+
'number'=>$on_page,
|
127 |
+
'offset'=>($page-1)*$on_page
|
128 |
+
);
|
129 |
+
|
130 |
+
$c_spam = get_comments($args_spam);
|
131 |
+
if($cnt_spam>0){
|
132 |
+
|
133 |
+
$pages = ceil(intval($cnt_spam)/$on_page);
|
134 |
+
if($pages && $pages != 1){
|
135 |
+
echo "<div class='ct_to_hide pagination'>"
|
136 |
+
."<b>Pages:</b>"
|
137 |
+
."<ul class='pagination'>";
|
138 |
+
for($i = 1; $i <= $pages; $i++){
|
139 |
+
echo "<li class='pagination'>"
|
140 |
+
."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
|
141 |
+
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
142 |
+
."</a>"
|
143 |
+
."</li>";
|
144 |
+
}
|
145 |
+
echo "</ul>";
|
146 |
+
echo "</div>";
|
147 |
+
}
|
148 |
+
?>
|
149 |
+
<table class="ct_to_hide widefat fixed comments" id="ct_check_comments_table">
|
150 |
+
<thead>
|
151 |
+
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
152 |
+
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
153 |
+
<input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
|
154 |
+
</th>
|
155 |
+
<th scope="col" id="author" class="manage-column column-slug"><?php print _e( 'Author' ); ?></th>
|
156 |
+
<th scope="col" id="comment" class="manage-column column-comment"><?php _e( 'Comment', 'cleantalk'); ?></th>
|
157 |
+
<th scope="col" id="response" class="manage-column column-response sortable desc"><?php _e( 'In Response To', 'cleantalk' );?></th>
|
158 |
+
</thead>
|
159 |
+
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
160 |
+
<?php
|
161 |
+
for($i=0;$i<sizeof($c_spam);$i++){
|
162 |
+
$id = $c_spam[$i]->comment_ID;
|
163 |
+
$post_id = $c_spam[$i]->comment_post_ID;
|
164 |
+
$login = $c_spam[$i]->comment_author;
|
165 |
+
$email = $c_spam[$i]->comment_author_email;
|
166 |
+
$ip = $c_spam[$i]->comment_author_IP;
|
167 |
+
|
168 |
+
echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_comment' data-id='$id'>"
|
169 |
+
."<th scope='row' class='check-column'>"
|
170 |
+
."<label class='screen-reader-text' for='cb-select-$id'>Select comment</label>"
|
171 |
+
."<input id='cb-select-$id' type='checkbox' name='del_comments[]' value='$id'/>"
|
172 |
+
."</th>"
|
173 |
+
."<td class='author column-author' nowrap>"
|
174 |
+
."<strong>"
|
175 |
+
.get_avatar( $c_spam[$i]->user_id , 32)
|
176 |
+
."$login"
|
177 |
+
."</strong>"
|
178 |
+
."<br />"
|
179 |
+
."<br />";
|
180 |
+
|
181 |
+
// Outputs email if exists
|
182 |
+
if($email)
|
183 |
+
echo "<a href='mailto:$email'>$email</a>"
|
184 |
+
.(!$apbct->white_label
|
185 |
+
? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
|
186 |
+
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
187 |
+
."</a>"
|
188 |
+
: '');
|
189 |
+
else
|
190 |
+
echo "No email";
|
191 |
+
echo "<br/>";
|
192 |
+
|
193 |
+
// Outputs IP if exists
|
194 |
+
if($ip)
|
195 |
+
echo "<a href='edit-comments.php?s=$ip&mode=detail'>$ip </a>"
|
196 |
+
.(!$apbct->white_label
|
197 |
+
?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
|
198 |
+
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none'/>"
|
199 |
+
."</a>"
|
200 |
+
: '');
|
201 |
+
else
|
202 |
+
echo "No IP adress";
|
203 |
+
echo "</td>";
|
204 |
+
?>
|
205 |
+
<td class="comment column-comment">
|
206 |
+
<div class="submitted-on">
|
207 |
+
<?php printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), get_comment_link($id),
|
208 |
+
/* translators: comment date format. See http://php.net/date */
|
209 |
+
get_comment_date( __( 'Y/m/d' ),$id ),
|
210 |
+
get_comment_date( get_option( 'time_format' ),$id )
|
211 |
+
);
|
212 |
+
?>
|
213 |
+
|
214 |
+
</div>
|
215 |
+
<p>
|
216 |
+
<?php print $c_spam[$i]->comment_content; ?>
|
217 |
+
</p>
|
218 |
+
<div style="height:16px; display: none;" id='cleantalk_button_set_<?php print $id; ?>'>
|
219 |
+
<a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
|
220 |
+
|
|
221 |
+
<a href="#" class="cleantalk_delete_button" data-id="<?php print $id; ?>" style="color:#a00;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
|
222 |
+
</div>
|
223 |
+
</td>
|
224 |
+
<td class="response column-response">
|
225 |
+
<div>
|
226 |
+
<span>
|
227 |
+
<a href="/wp-admin/post.php?post=<?php print $post_id; ?>&action=edit"><?php print get_the_title($post_id); ?></a>
|
228 |
+
<br/>
|
229 |
+
<a href="/wp-admin/edit-comments.php?p=<?php print $post_id; ?>" class="post-com-count">
|
230 |
+
<span class="comment-count"><?php
|
231 |
+
$p_cnt=wp_count_comments();
|
232 |
+
print $p_cnt->total_comments;
|
233 |
+
?></span>
|
234 |
+
</a>
|
235 |
+
</span>
|
236 |
+
<a href="<?php print get_permalink($post_id); ?>"><?php print _e('View Post');?></a>
|
237 |
+
</div>
|
238 |
+
</td>
|
239 |
+
</tr>
|
240 |
+
<?php
|
241 |
+
}
|
242 |
+
?>
|
243 |
+
</tbody>
|
244 |
+
</table>
|
245 |
+
<?php
|
246 |
+
// Pagination
|
247 |
+
if($pages && $pages != 1){
|
248 |
+
echo "<div class='ct_to_hide pagination'>"
|
249 |
+
."<b>Pages:</b>"
|
250 |
+
."<ul class='pagination'>";
|
251 |
+
for($i = 1; $i <= $pages; $i++){
|
252 |
+
echo "<li class='pagination'>"
|
253 |
+
."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
|
254 |
+
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
255 |
+
."</a>"
|
256 |
+
."</li>";
|
257 |
+
}
|
258 |
+
echo "</ul>";
|
259 |
+
echo "</div>";
|
260 |
+
}
|
261 |
+
?>
|
262 |
+
<div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
|
263 |
+
<button class= "button" id="ct_delete_all"><?php _e('Delete all comments from the list', 'cleantalk'); ?></button>
|
264 |
+
<button class="button" id="ct_delete_checked"><?php _e('Delete selected', 'cleantalk'); ?></button><br /><br />
|
265 |
+
</div>
|
266 |
+
<?php
|
267 |
+
}
|
268 |
+
echo filter_input(INPUT_SERVER, 'REMOTE_ADDR')=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .' (100)</button> ' : '';
|
269 |
+
echo filter_input(INPUT_SERVER, 'REMOTE_ADDR')=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_delete_comments">'. __('Delete comments', 'cleantalk') .' (110)</button>' : '';
|
270 |
+
|
271 |
+
if($cnt_spam > 0){
|
272 |
+
echo "<div id='ct_search_info'>"
|
273 |
+
."<br />"
|
274 |
+
.__('There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.', 'cleantalk')
|
275 |
+
."</div>";
|
276 |
+
}
|
277 |
+
?>
|
278 |
+
<div>
|
279 |
+
<button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
|
280 |
+
</div>
|
281 |
+
</div>
|
282 |
+
<?php
|
283 |
+
}
|
284 |
+
|
285 |
+
function ct_ajax_check_comments(){
|
286 |
+
|
287 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
288 |
+
|
289 |
+
global $wpdb, $apbct;
|
290 |
+
|
291 |
+
if(isset($_POST['from'], $_POST['till'])){
|
292 |
+
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
293 |
+
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
294 |
+
}
|
295 |
+
|
296 |
+
// Gettings comments 100 unchecked comments
|
297 |
+
if(isset($_COOKIE['ct_comments_safe_check'])){
|
298 |
+
$c = $wpdb->get_results("
|
299 |
+
SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
|
300 |
+
FROM {$wpdb->comments} as comm
|
301 |
+
WHERE
|
302 |
+
(comm.comment_approved = '1' OR comm.comment_approved = '0')
|
303 |
+
AND NOT EXISTS(
|
304 |
+
SELECT comment_id, meta_key
|
305 |
+
FROM {$wpdb->commentmeta} as meta
|
306 |
+
WHERE comm.comment_ID = meta.comment_id AND (meta_key = 'ct_checked' OR meta_key = 'ct_bad')
|
307 |
+
)
|
308 |
+
ORDER BY comment_date_gmt
|
309 |
+
LIMIT 100",
|
310 |
+
ARRAY_A
|
311 |
+
);
|
312 |
+
}else{
|
313 |
+
$params = array(
|
314 |
+
'meta_query' => array(
|
315 |
+
'relation' => 'AND',
|
316 |
+
array(
|
317 |
+
'key' => 'ct_checked',
|
318 |
+
'compare' => 'NOT EXISTS'
|
319 |
+
),
|
320 |
+
array(
|
321 |
+
'key' => 'ct_bad',
|
322 |
+
'compare' => 'NOT EXISTS'
|
323 |
+
)
|
324 |
+
),
|
325 |
+
'orderby' => 'comment_date_gmt',
|
326 |
+
'order' => 'ASC',
|
327 |
+
'number' => 100
|
328 |
+
);
|
329 |
+
if(isset($from_date, $till_date)){
|
330 |
+
$params['date_query'] = array(
|
331 |
+
'column' => 'comment_date_gmt',
|
332 |
+
'after' => $from_date,
|
333 |
+
'before' => $till_date,
|
334 |
+
'inclusive' => true,
|
335 |
+
);
|
336 |
+
}
|
337 |
+
$c = get_comments( $params );
|
338 |
+
}
|
339 |
+
|
340 |
+
$check_result = array(
|
341 |
+
'end' => 0,
|
342 |
+
'checked' => 0,
|
343 |
+
'spam' => 0,
|
344 |
+
'bad' => 0,
|
345 |
+
'error' => 0
|
346 |
+
);
|
347 |
+
|
348 |
+
if(sizeof($c)>0){
|
349 |
+
|
350 |
+
// Coverting $c to objects
|
351 |
+
if(is_array($c[0])){
|
352 |
+
foreach($c as $key => $value){
|
353 |
+
$c[$key] = (object)$value;
|
354 |
+
} unset($key, $value);
|
355 |
+
}
|
356 |
+
|
357 |
+
if(!empty($_POST['accurate_check'])){
|
358 |
+
// Leaving comments only with first comment's date. Unsetting others.
|
359 |
+
|
360 |
+
foreach($c as $comment_index => $comment){
|
361 |
+
|
362 |
+
if(!isset($curr_date))
|
363 |
+
$curr_date = (substr($comment->comment_date_gmt, 0, 10) ? substr($comment->comment_date_gmt, 0, 10) : '');
|
364 |
+
|
365 |
+
if(substr($comment->comment_date_gmt, 0, 10) != $curr_date)
|
366 |
+
unset($c[$comment_index]);
|
367 |
+
|
368 |
+
}
|
369 |
+
unset($comment_index, $comment);
|
370 |
+
}
|
371 |
+
|
372 |
+
// Checking comments IP/Email. Gathering $data for check.
|
373 |
+
$data = Array();
|
374 |
+
for($i=0;$i<sizeof($c);$i++){
|
375 |
+
|
376 |
+
$curr_ip = $c[$i]->comment_author_IP;
|
377 |
+
$curr_email = $c[$i]->comment_author_email;
|
378 |
+
|
379 |
+
// Check for identity
|
380 |
+
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
381 |
+
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
382 |
+
|
383 |
+
if(empty($curr_ip) && empty($curr_email)){
|
384 |
+
$check_result['bad']++;
|
385 |
+
update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
|
386 |
+
unset($c[$i]);
|
387 |
+
}else{
|
388 |
+
if(!empty($curr_ip))
|
389 |
+
$data[] = $curr_ip;
|
390 |
+
if(!empty($curr_email))
|
391 |
+
$data[] = $curr_email;
|
392 |
+
// Patch for empty IP/Email
|
393 |
+
$c[$i]->comment_author_IP = empty($curr_ip) ? 'none' : $curr_ip;
|
394 |
+
$c[$i]->comment_author_email = empty($curr_email) ? 'none' : $curr_email;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// Recombining after checking and unsettting
|
399 |
+
$c = array_values($c);
|
400 |
+
|
401 |
+
// Drop if data empty and there's no comments to check
|
402 |
+
if(count($data) == 0){
|
403 |
+
if($_POST['unchecked'] === 0)
|
404 |
+
$check_result['end'] = 1;
|
405 |
+
print json_encode($check_result);
|
406 |
+
die();
|
407 |
+
}
|
408 |
+
|
409 |
+
$result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
|
410 |
+
|
411 |
+
if(empty($result['error'])){
|
412 |
+
|
413 |
+
for($i=0;$i<sizeof($c);$i++){
|
414 |
+
|
415 |
+
$mark_spam_ip = false;
|
416 |
+
$mark_spam_email = false;
|
417 |
+
|
418 |
+
$check_result['checked']++;
|
419 |
+
update_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
|
420 |
+
$uip=$c[$i]->comment_author_IP;
|
421 |
+
$uim=$c[$i]->comment_author_email;
|
422 |
+
|
423 |
+
if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
|
424 |
+
$mark_spam_ip = true;
|
425 |
+
|
426 |
+
if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
|
427 |
+
$mark_spam_email = true;
|
428 |
+
|
429 |
+
if ($mark_spam_ip || $mark_spam_email){
|
430 |
+
$check_result['spam']++;
|
431 |
+
update_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
|
432 |
+
}
|
433 |
+
}
|
434 |
+
print json_encode($check_result);
|
435 |
+
|
436 |
+
}else{
|
437 |
+
$check_result['error'] = 1;
|
438 |
+
$check_result['error_message'] = $result['error'];
|
439 |
+
echo json_encode($check_result);
|
440 |
+
}
|
441 |
+
}else{
|
442 |
+
$check_result['end'] = 1;
|
443 |
+
print json_encode($check_result);
|
444 |
+
}
|
445 |
+
|
446 |
+
die;
|
447 |
+
}
|
448 |
+
|
449 |
+
function ct_ajax_info_comments($direct_call = false){
|
450 |
+
|
451 |
+
if (!$direct_call)
|
452 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
453 |
+
|
454 |
+
global $wpdb;
|
455 |
+
|
456 |
+
$metas = array('', 'ct_marked_as_spam', 'ct_checked', 'ct_bad');
|
457 |
+
|
458 |
+
$result = array();
|
459 |
+
foreach($metas as $meta){
|
460 |
+
if(isset($_COOKIE['ct_comments_safe_check'])){
|
461 |
+
$res = $wpdb->get_results("
|
462 |
+
SELECT COUNT(DISTINCT comment_ID) AS cnt
|
463 |
+
FROM {$wpdb->comments} AS comm
|
464 |
+
WHERE comm.comment_approved IN ('1','0')".
|
465 |
+
(!empty($meta)
|
466 |
+
? " AND EXISTS (SELECT comment_id, meta_key
|
467 |
+
FROM {$wpdb->commentmeta} meta
|
468 |
+
WHERE comm.comment_ID = meta.comment_id AND meta_key = '$meta')"
|
469 |
+
: ''),
|
470 |
+
ARRAY_A);
|
471 |
+
$result[] = $res[0]['cnt'];
|
472 |
+
}else{
|
473 |
+
$params = array('fields' => 'ids', 'count' => true);
|
474 |
+
if(!empty($meta))
|
475 |
+
$params['meta_key'] = $meta;
|
476 |
+
$result[] = get_comments( $params );
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
$cnt = $result[0]; // Total comments
|
481 |
+
$cnt_spam = $result[1]; // Spam comments
|
482 |
+
$cnt_checked = $result[2]; // Checked comments
|
483 |
+
$cnt_bad = $result[3]; // Bad comments (without IP and Email)
|
484 |
+
|
485 |
+
$return = array(
|
486 |
+
'message' => '',
|
487 |
+
'total' => $cnt,
|
488 |
+
'spam' => $cnt_spam,
|
489 |
+
'checked' => $cnt_checked,
|
490 |
+
'bad' => $cnt_bad,
|
491 |
+
);
|
492 |
+
|
493 |
+
$return['message'] .= sprintf (__("Total comments %s. Checked %s. Last check %s. Found %s spam comments. %s bad comments (without IP or email).", 'cleantalk'), $cnt, $cnt_checked, ct_get_last_comment_check_date(), $cnt_spam, $cnt_bad);
|
494 |
+
|
495 |
+
$backup_notice = ' ';
|
496 |
+
if ($cnt_spam > 0){
|
497 |
+
$backup_notice = __("Please do backup of WordPress database before delete any comments!", 'cleantalk');
|
498 |
+
}
|
499 |
+
$return['message'] .= "<p>$backup_notice</p>";
|
500 |
+
|
501 |
+
if($direct_call){
|
502 |
+
return $return['message'];
|
503 |
+
}else{
|
504 |
+
echo json_encode($return);
|
505 |
+
die();
|
506 |
+
}
|
507 |
+
|
508 |
+
}
|
509 |
+
|
510 |
+
|
511 |
+
function ct_ajax_insert_comments(){
|
512 |
+
|
513 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
514 |
+
|
515 |
+
//* DELETION
|
516 |
+
if(!empty($_POST['delete'])){
|
517 |
+
$comments = get_comments(array('author_email' => 'stop_email@example.com'));
|
518 |
+
$deleted = 0;
|
519 |
+
$amount_to_delete = 15;
|
520 |
+
foreach($comments as $comment){
|
521 |
+
if($deleted >= $amount_to_delete)
|
522 |
+
break;
|
523 |
+
if(wp_delete_comment($comment->comment_ID, true))
|
524 |
+
$deleted++;
|
525 |
+
}
|
526 |
+
print "$deleted";
|
527 |
+
die();
|
528 |
+
}
|
529 |
+
|
530 |
+
//* INSERTION
|
531 |
+
global $wpdb;
|
532 |
+
|
533 |
+
$to_insert = 100;
|
534 |
+
$time = current_time('timestamp')-(730*86400);
|
535 |
+
|
536 |
+
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
537 |
+
|
538 |
+
if($result){
|
539 |
+
$ip = array();
|
540 |
+
foreach($result as $value){
|
541 |
+
$ips[] = long2ip($value['network']);
|
542 |
+
}
|
543 |
+
unset($value);
|
544 |
+
|
545 |
+
$inserted = 0;
|
546 |
+
for($i=0, $j=0; $i<$to_insert; $i++, $j++){
|
547 |
+
|
548 |
+
if(!isset($ips[$j]))
|
549 |
+
$j=0;
|
550 |
+
|
551 |
+
$rnd=mt_rand(1,100);
|
552 |
+
|
553 |
+
$email="stop_email@example.com";
|
554 |
+
|
555 |
+
$data = array(
|
556 |
+
'comment_post_ID' => 1,
|
557 |
+
'comment_author' => "author_$rnd",
|
558 |
+
'comment_author_email' => $email,
|
559 |
+
'comment_author_url' => 'http://',
|
560 |
+
'comment_content' => "comment content ".mt_rand(1,10000)." ".mt_rand(1,10000)." ".mt_rand(1,10000),
|
561 |
+
'comment_type' => '',
|
562 |
+
'comment_parent' => 0,
|
563 |
+
'user_id' => 1,
|
564 |
+
'comment_author_IP' => $ips[$j],
|
565 |
+
'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
|
566 |
+
'comment_date' => date('Y-m-d H:i:s', $time),
|
567 |
+
'comment_approved' => 1,
|
568 |
+
);
|
569 |
+
|
570 |
+
wp_insert_comment($data);
|
571 |
+
$time = $time + 86400;
|
572 |
+
$inserted++;
|
573 |
+
}
|
574 |
+
}else{
|
575 |
+
$inserted = '0';
|
576 |
+
}
|
577 |
+
|
578 |
+
print $inserted;
|
579 |
+
die();
|
580 |
+
}
|
581 |
+
|
582 |
+
function ct_ajax_delete_checked(){
|
583 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
584 |
+
foreach($_POST['ids'] as $key=>$value){
|
585 |
+
wp_delete_comment($value, false);
|
586 |
+
}
|
587 |
+
die();
|
588 |
+
}
|
589 |
+
|
590 |
+
function ct_ajax_delete_all(){
|
591 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
592 |
+
$args_spam = array(
|
593 |
+
'number'=>100,
|
594 |
+
'meta_query' => array(
|
595 |
+
Array(
|
596 |
+
'key' => 'ct_marked_as_spam',
|
597 |
+
'value' => '1',
|
598 |
+
'compare' => 'NUMERIC'
|
599 |
+
)
|
600 |
+
)
|
601 |
+
);
|
602 |
+
$c_spam=get_comments($args_spam);
|
603 |
+
|
604 |
+
$cnt=sizeof($c_spam);
|
605 |
+
|
606 |
+
$args_spam = array(
|
607 |
+
'count'=>true,
|
608 |
+
'meta_query' => array(
|
609 |
+
Array(
|
610 |
+
'key' => 'ct_marked_as_spam',
|
611 |
+
'value' => '1',
|
612 |
+
'compare' => 'NUMERIC'
|
613 |
+
)
|
614 |
+
)
|
615 |
+
);
|
616 |
+
$cnt_all=get_comments($args_spam);
|
617 |
+
|
618 |
+
for($i=0;$i<sizeof($c_spam);$i++){
|
619 |
+
wp_delete_comment($c_spam[$i]->comment_ID, false);
|
620 |
+
usleep(10000);
|
621 |
+
}
|
622 |
+
print $cnt_all;
|
623 |
+
die();
|
624 |
+
}
|
625 |
+
|
626 |
+
function ct_ajax_clear_comments(){
|
627 |
+
|
628 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
629 |
+
|
630 |
+
if ( isset($_POST['from']) && isset($_POST['till']) ) {
|
631 |
+
if ( preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['from'] ) && preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['till'] ) ) {
|
632 |
+
|
633 |
+
$from = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
|
634 |
+
$till = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
|
635 |
+
|
636 |
+
global $wpdb;
|
637 |
+
$query_result = $wpdb->query("DELETE FROM {$wpdb->commentmeta} WHERE
|
638 |
+
meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad')
|
639 |
+
AND meta_value >= '{$from}'
|
640 |
+
AND meta_value <= '{$till}';");
|
641 |
+
|
642 |
+
die();
|
643 |
+
|
644 |
+
}
|
645 |
+
}
|
646 |
+
|
647 |
+
}
|
648 |
+
|
649 |
+
/**
|
650 |
+
* Admin action 'comment_unapproved_to_approved' - Approve comment, delete from the deleting list
|
651 |
+
*/
|
652 |
+
function ct_comment_check_approve_comment(){
|
653 |
+
|
654 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
655 |
+
|
656 |
+
$id=$_POST['id'];
|
657 |
+
$comment = get_comment($id, 'ARRAY_A');
|
658 |
+
$comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
|
659 |
+
$comment['comment_approved'] = 1;
|
660 |
+
update_comment_meta($id, 'ct_marked_as_spam', 0);
|
661 |
+
wp_update_comment($comment);
|
662 |
+
|
663 |
+
die();
|
664 |
+
}
|
665 |
+
|
666 |
+
/**
|
667 |
+
* Get date last checked comment or date of the first comment
|
668 |
+
*
|
669 |
+
* @return string date "M j Y"
|
670 |
+
*/
|
671 |
+
function ct_last_checked_comment() {
|
672 |
+
|
673 |
+
$params = array(
|
674 |
+
'fields' => 'ids',
|
675 |
+
'meta_key' => 'ct_checked',
|
676 |
+
'orderby' => 'ct_checked',
|
677 |
+
'order' => 'ASC'
|
678 |
+
);
|
679 |
+
$checked_comments = get_comments( $params );
|
680 |
+
|
681 |
+
if ( ! empty($checked_comments) ) {
|
682 |
+
|
683 |
+
return get_comment_date( "M j Y", end( $checked_comments ) );
|
684 |
+
|
685 |
+
} else {
|
686 |
+
|
687 |
+
$params = array(
|
688 |
+
'fields' => 'ids',
|
689 |
+
'orderby' => 'comment_date_gmt',
|
690 |
+
'order' => 'ASC',
|
691 |
+
'number' => 1
|
692 |
+
);
|
693 |
+
$first_comment = get_comments( $params );
|
694 |
+
|
695 |
+
return get_comment_date( "M j Y", current( $first_comment ) );
|
696 |
+
|
697 |
+
}
|
698 |
+
|
699 |
+
}
|
700 |
+
|
701 |
+
/**
|
702 |
+
* Get last comments check date.
|
703 |
+
*
|
704 |
+
* @return string|null Date format"M j Y" or datetime format or null
|
705 |
+
*/
|
706 |
+
function ct_get_last_comment_check_date( $timestamp = false ) {
|
707 |
+
|
708 |
+
$params = array(
|
709 |
+
'fields' => 'ids',
|
710 |
+
'meta_key' => 'ct_checked',
|
711 |
+
'orderby' => 'comment_date_gmt',
|
712 |
+
'order' => 'ASC'
|
713 |
+
);
|
714 |
+
$checked_comments = get_comments( $params );
|
715 |
+
|
716 |
+
$last_check = null;
|
717 |
+
|
718 |
+
if( ! empty( $checked_comments ) ) {
|
719 |
+
|
720 |
+
$last_check = $timestamp ? get_comment_meta( end( $checked_comments ), 'ct_checked', true ) : date( "M j Y", strtotime( get_comment_meta( end( $checked_comments ), 'ct_checked', true ) ) );
|
721 |
+
|
722 |
+
}
|
723 |
+
|
724 |
+
return $last_check;
|
725 |
+
|
726 |
}
|
inc/cleantalk-common.php
CHANGED
@@ -1,979 +1,992 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function apbct_array( $array ){
|
4 |
-
return new Cleantalk\Arr( $array );
|
5 |
-
}
|
6 |
-
|
7 |
-
$ct_checkjs_frm = 'ct_checkjs_frm';
|
8 |
-
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
9 |
-
|
10 |
-
$apbct_cookie_request_id_label = 'request_id';
|
11 |
-
$apbct_cookie_register_ok_label = 'register_ok';
|
12 |
-
|
13 |
-
$ct_checkjs_cf7 = 'ct_checkjs_cf7';
|
14 |
-
$ct_cf7_comment = '';
|
15 |
-
|
16 |
-
$ct_checkjs_jpcf = 'ct_checkjs_jpcf';
|
17 |
-
$ct_jpcf_patched = false;
|
18 |
-
$ct_jpcf_fields = array('name', 'email');
|
19 |
-
|
20 |
-
// Comment already proccessed
|
21 |
-
$ct_comment_done = false;
|
22 |
-
|
23 |
-
// Comment already proccessed
|
24 |
-
$ct_signup_done = false;
|
25 |
-
|
26 |
-
//Contains registration error
|
27 |
-
$ct_registration_error_comment = false;
|
28 |
-
|
29 |
-
// Default value for JS test
|
30 |
-
$ct_checkjs_def = 0;
|
31 |
-
|
32 |
-
// COOKIE label to store request id for last approved
|
33 |
-
$ct_approved_request_id_label = 'ct_approved_request_id';
|
34 |
-
|
35 |
-
// Last request id approved for publication
|
36 |
-
$ct_approved_request_id = null;
|
37 |
-
|
38 |
-
// Trial notice show time in minutes
|
39 |
-
$trial_notice_showtime = 10;
|
40 |
-
|
41 |
-
// Renew notice show time in minutes
|
42 |
-
$renew_notice_showtime = 10;
|
43 |
-
|
44 |
-
// COOKIE label for WP Landing Page proccessing result
|
45 |
-
$ct_wplp_result_label = 'ct_wplp_result';
|
46 |
-
|
47 |
-
// Flag indicates active JetPack comments
|
48 |
-
$ct_jp_comments = false;
|
49 |
-
|
50 |
-
// WP admin email notice interval in seconds
|
51 |
-
$ct_admin_notoice_period = 21600;
|
52 |
-
|
53 |
-
// Sevice negative comment to visitor.
|
54 |
-
// It uses for BuddyPress registrations to avoid double checks
|
55 |
-
$ct_negative_comment = null;
|
56 |
-
|
57 |
-
// Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
|
58 |
-
$ct_server = NULL;
|
59 |
-
$admin_email = NULL;
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
|
63 |
-
*/
|
64 |
-
function apbct_plugin_loaded() {
|
65 |
-
$dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
|
66 |
-
$loaded=load_plugin_textdomain('cleantalk', false, $dir);
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Inner function - Request's wrapper for anything
|
71 |
-
* @param array Array of parameters:
|
72 |
-
* 'message' - string
|
73 |
-
* 'example' - string
|
74 |
-
* 'checkjs' - int
|
75 |
-
* 'sender_email' - string
|
76 |
-
* 'sender_nickname' - string
|
77 |
-
* 'sender_info' - array
|
78 |
-
* 'post_info' - string
|
79 |
-
* @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
|
80 |
-
*/
|
81 |
-
function apbct_base_call($params = array(), $reg_flag = false){
|
82 |
-
|
83 |
-
global $apbct, $cleantalk_executed;
|
84 |
-
|
85 |
-
$cleantalk_executed = true;
|
86 |
-
|
87 |
-
$sender_info = !empty($params['sender_info'])
|
88 |
-
? CleantalkHelper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
|
89 |
-
: apbct_get_sender_info();
|
90 |
-
|
91 |
-
// Fileds exclusions
|
92 |
-
if( ! empty( $params['message'] ) && is_array( $params['message'] ) ){
|
93 |
-
|
94 |
-
$params['message'] = apbct_array( $params['message'] )
|
95 |
-
->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
|
96 |
-
->delete();
|
97 |
-
}
|
98 |
-
|
99 |
-
$default_params = array(
|
100 |
-
|
101 |
-
// IPs
|
102 |
-
'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : CleantalkHelper::ip__get(array('real'), false)),
|
103 |
-
'x_forwarded_for' => CleantalkHelper::ip__get(array('x_forwarded_for'), false),
|
104 |
-
'x_real_ip' => CleantalkHelper::ip__get(array('x_real_ip'), false),
|
105 |
-
|
106 |
-
// Misc
|
107 |
-
'auth_key' => $apbct->api_key,
|
108 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
|
109 |
-
|
110 |
-
'agent' => APBCT_AGENT,
|
111 |
-
'sender_info' => $sender_info,
|
112 |
-
'submit_time' => apbct_get_submit_time(),
|
113 |
-
);
|
114 |
-
|
115 |
-
// Send $_SERVER if couldn't find IP
|
116 |
-
if(empty($default_params['sender_ip']))
|
117 |
-
$default_params['sender_info']['server_info'] = $_SERVER;
|
118 |
-
|
119 |
-
$ct_request = new CleantalkRequest(
|
120 |
-
CleantalkHelper::array_merge__save_numeric_keys__recursive($default_params, $params)
|
121 |
-
);
|
122 |
-
|
123 |
-
$ct = new Cleantalk();
|
124 |
-
|
125 |
-
$ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
|
126 |
-
$ct->ssl_on = $apbct->settings['ssl_on'];
|
127 |
-
$ct->ssl_path = APBCT_CASERT_PATH;
|
128 |
-
|
129 |
-
// Options store url without shceme because of DB error with ''://'
|
130 |
-
$config = ct_get_server();
|
131 |
-
$ct->server_url = APBCT_MODERATE_URL;
|
132 |
-
$ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
|
133 |
-
$ct->server_ttl = $config['ct_server_ttl'];
|
134 |
-
$ct->server_changed = $config['ct_server_changed'];
|
135 |
-
|
136 |
-
$start = microtime(true);
|
137 |
-
$ct_result = $reg_flag
|
138 |
-
? @$ct->isAllowUser($ct_request)
|
139 |
-
: @$ct->isAllowMessage($ct_request);
|
140 |
-
$exec_time = microtime(true) - $start;
|
141 |
-
|
142 |
-
// Statistics
|
143 |
-
// Average request time
|
144 |
-
apbct_statistics__rotate($exec_time);
|
145 |
-
// Last request
|
146 |
-
$apbct->stats['last_request']['time'] = time();
|
147 |
-
$apbct->stats['last_request']['server'] = $ct->work_url;
|
148 |
-
$apbct->save('stats');
|
149 |
-
|
150 |
-
// Connection reports
|
151 |
-
if ($ct_result->errno === 0 && empty($ct_result->errstr))
|
152 |
-
$apbct->data['connection_reports']['success']++;
|
153 |
-
else
|
154 |
-
{
|
155 |
-
$apbct->data['connection_reports']['negative']++;
|
156 |
-
$apbct->data['connection_reports']['negative_report'][] = array(
|
157 |
-
'date' => date("Y-m-d H:i:s"),
|
158 |
-
'page_url' =>
|
159 |
-
'lib_report' => $ct_result->errstr,
|
160 |
-
'work_url' => $ct->work_url,
|
161 |
-
);
|
162 |
-
|
163 |
-
if(count($apbct->data['connection_reports']['negative_report']) > 20)
|
164 |
-
$apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
|
165 |
-
|
166 |
-
}
|
167 |
-
|
168 |
-
if ($ct->server_change) {
|
169 |
-
update_option(
|
170 |
-
'cleantalk_server',
|
171 |
-
array(
|
172 |
-
'ct_work_url' => $ct->work_url,
|
173 |
-
'ct_server_ttl' => $ct->server_ttl,
|
174 |
-
'ct_server_changed' => time(),
|
175 |
-
)
|
176 |
-
);
|
177 |
-
}
|
178 |
-
|
179 |
-
$ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
|
180 |
-
|
181 |
-
// Restart submit form counter for failed requests
|
182 |
-
if ($ct_result->allow == 0){
|
183 |
-
apbct_cookie(); // Setting page timer and cookies
|
184 |
-
ct_add_event('no');
|
185 |
-
}else{
|
186 |
-
ct_add_event('yes');
|
187 |
-
}
|
188 |
-
|
189 |
-
// Set cookies if it's not.
|
190 |
-
if(empty($apbct->flags__cookies_setuped))
|
191 |
-
apbct_cookie();
|
192 |
-
|
193 |
-
return array('ct' => $ct, 'ct_result' => $ct_result);
|
194 |
-
|
195 |
-
}
|
196 |
-
|
197 |
-
function apbct_exclusions_check($func = null){
|
198 |
-
|
199 |
-
global $apbct, $cleantalk_executed;
|
200 |
-
|
201 |
-
// Common exclusions
|
202 |
-
if(
|
203 |
-
apbct_exclusions_check__ip() ||
|
204 |
-
apbct_exclusions_check__url() ||
|
205 |
-
apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
|
206 |
-
$cleantalk_executed
|
207 |
-
)
|
208 |
-
return true;
|
209 |
-
|
210 |
-
// Personal exclusions
|
211 |
-
switch ($func){
|
212 |
-
case 'ct_contact_form_validate_postdata':
|
213 |
-
if(
|
214 |
-
(defined( 'DOING_AJAX' ) && DOING_AJAX) ||
|
215 |
-
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
216 |
-
)
|
217 |
-
return true;
|
218 |
-
break;
|
219 |
-
case 'ct_contact_form_validate':
|
220 |
-
if(
|
221 |
-
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
222 |
-
)
|
223 |
-
return true;
|
224 |
-
break;
|
225 |
-
default:
|
226 |
-
return false;
|
227 |
-
break;
|
228 |
-
}
|
229 |
-
|
230 |
-
return false;
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Checks if reuqest URI is in exclusion list
|
235 |
-
*
|
236 |
-
* @return bool
|
237 |
-
*/
|
238 |
-
function apbct_exclusions_check__url() {
|
239 |
-
|
240 |
-
global $apbct;
|
241 |
-
|
242 |
-
if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
|
243 |
-
|
244 |
-
$exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
|
245 |
-
|
246 |
-
// Fix for AJAX forms
|
247 |
-
$haystack =
|
248 |
-
?
|
249 |
-
:
|
250 |
-
|
251 |
-
foreach ( $exclusions as $exclusion ) {
|
252 |
-
if (
|
253 |
-
($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
|
254 |
-
stripos( $haystack, $exclusion ) !== false
|
255 |
-
){
|
256 |
-
return true;
|
257 |
-
}
|
258 |
-
}
|
259 |
-
return false;
|
260 |
-
}
|
261 |
-
}
|
262 |
-
/**
|
263 |
-
* @deprecated 5.128 Using IP white-lists instead
|
264 |
-
* @deprecated since 18.09.2019
|
265 |
-
* Checks if sender_ip is in exclusion list
|
266 |
-
*
|
267 |
-
* @return bool
|
268 |
-
*/
|
269 |
-
function apbct_exclusions_check__ip(){
|
270 |
-
|
271 |
-
global $cleantalk_ip_exclusions;
|
272 |
-
|
273 |
-
if(
|
274 |
-
|
275 |
-
if( CleantalkHelper::ip__is_cleantalks(
|
276 |
-
return true;
|
277 |
-
}
|
278 |
-
|
279 |
-
if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
|
280 |
-
foreach ( $cleantalk_ip_exclusions as $exclusion ){
|
281 |
-
if( stripos(
|
282 |
-
return true;
|
283 |
-
}
|
284 |
-
}
|
285 |
-
}
|
286 |
-
}
|
287 |
-
|
288 |
-
return false;
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Inner function - Default data array for senders
|
293 |
-
* @return array
|
294 |
-
*/
|
295 |
-
function apbct_get_sender_info() {
|
296 |
-
|
297 |
-
global $apbct;
|
298 |
-
|
299 |
-
// Validate cookie from the backend
|
300 |
-
$cookie_is_ok = apbct_cookies_test();
|
301 |
-
|
302 |
-
$referer_previous = $apbct->settings['set_cookies__sessions']
|
303 |
-
? apbct_alt_session__get('apbct_prev_referer')
|
304 |
-
: filter_input(INPUT_COOKIE, 'apbct_prev_referer');
|
305 |
-
|
306 |
-
$site_landing_ts = $apbct->settings['set_cookies__sessions']
|
307 |
-
? apbct_alt_session__get('apbct_site_landing_ts')
|
308 |
-
: filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
|
309 |
-
|
310 |
-
$page_hits = $apbct->settings['set_cookies__sessions']
|
311 |
-
? apbct_alt_session__get('apbct_page_hits')
|
312 |
-
: filter_input(INPUT_COOKIE, 'apbct_page_hits');
|
313 |
-
|
314 |
-
if (count($_POST) > 0) {
|
315 |
-
foreach ($_POST as $k => $v) {
|
316 |
-
if (preg_match("/^(ct_check|checkjs).+/", $k)) {
|
317 |
-
$checkjs_data_post = $v;
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
// AMP check
|
323 |
-
$amp_detected =
|
324 |
-
? strpos(
|
325 |
-
? 1
|
326 |
-
: 0
|
327 |
-
: null;
|
328 |
-
|
329 |
-
$site_referer = $apbct->settings['store_urls__sessions']
|
330 |
-
? apbct_alt_session__get('apbct_site_referer')
|
331 |
-
: filter_input(INPUT_COOKIE, 'apbct_site_referer');
|
332 |
-
|
333 |
-
$urls = $apbct->settings['store_urls__sessions']
|
334 |
-
? (array)apbct_alt_session__get('apbct_urls')
|
335 |
-
: (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
|
336 |
-
|
337 |
-
return array(
|
338 |
-
'remote_addr' => CleantalkHelper::ip__get(array('remote_addr'), false),
|
339 |
-
'REFFERRER' =>
|
340 |
-
'USER_AGENT' =>
|
341 |
-
'page_url' => isset($_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']) ? htmlspecialchars($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']) : null,
|
342 |
-
'cms_lang' => substr(get_locale(), 0, 2),
|
343 |
-
'ct_options' => json_encode($apbct->settings),
|
344 |
-
'fields_number' => sizeof($_POST),
|
345 |
-
'direct_post' => $cookie_is_ok === null &&
|
346 |
-
// Raw data to validated JavaScript test in the cloud
|
347 |
-
'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
|
348 |
-
'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
|
349 |
-
// PHP cookies
|
350 |
-
'cookies_enabled' => $cookie_is_ok,
|
351 |
-
'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
|
352 |
-
'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
|
353 |
-
'page_hits' => !empty($page_hits) ? $page_hits : null,
|
354 |
-
// JS cookies
|
355 |
-
'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
|
356 |
-
'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
|
357 |
-
'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
|
358 |
-
'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
|
359 |
-
'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
|
360 |
-
'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
|
361 |
-
'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
|
362 |
-
// Misc
|
363 |
-
'site_referer' => !empty($site_referer) ? $site_referer : null,
|
364 |
-
'source_url' => !empty($urls) ? json_encode($urls) : null,
|
365 |
-
// Debug stuff
|
366 |
-
'amp_detected' => $amp_detected,
|
367 |
-
'hook' => current_action(),
|
368 |
-
'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
|
369 |
-
'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : false,
|
370 |
-
'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
|
371 |
-
'request_type' =>
|
372 |
-
'abpct_hyro_acc_collect' => !empty($_COOKIE['abpct_hyro_acc_collect']) ? json_decode(stripslashes($_COOKIE['abpct_hyro_acc_collect']), true): null,
|
373 |
-
);
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Process visible fields for specific form to match the fields from request
|
378 |
-
*
|
379 |
-
* @param string $visible_fields
|
380 |
-
*
|
381 |
-
* @return string
|
382 |
-
*/
|
383 |
-
function apbct_visibile_fields__process($visible_fields) {
|
384 |
-
if(strpos($visible_fields, 'wpforms') !== false){
|
385 |
-
$visible_fields = preg_replace(
|
386 |
-
array('/\[/', '/\]/'),
|
387 |
-
'',
|
388 |
-
str_replace(
|
389 |
-
'][',
|
390 |
-
'_',
|
391 |
-
str_replace(
|
392 |
-
'wpforms[fields]',
|
393 |
-
'',
|
394 |
-
$visible_fields
|
395 |
-
)
|
396 |
-
)
|
397 |
-
);
|
398 |
-
}
|
399 |
-
|
400 |
-
return $visible_fields;
|
401 |
-
}
|
402 |
-
|
403 |
-
/*
|
404 |
-
* Outputs JS key for AJAX-use only. Stops script.
|
405 |
-
*/
|
406 |
-
function apbct_js_keys__get__ajax($direct_call = false){
|
407 |
-
if(!$direct_call){
|
408 |
-
if(isset($_POST['_ajax_nonce'])){
|
409 |
-
if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
|
410 |
-
wp_doing_ajax()
|
411 |
-
? wp_die( -1, 403 )
|
412 |
-
: die( '-1' );
|
413 |
-
}
|
414 |
-
}else{
|
415 |
-
wp_doing_ajax()
|
416 |
-
? wp_die( -1, 403 )
|
417 |
-
: die( '-1' );
|
418 |
-
}
|
419 |
-
}
|
420 |
-
die(json_encode(array(
|
421 |
-
'js_key' => ct_get_checkjs_value()
|
422 |
-
)));
|
423 |
-
}
|
424 |
-
|
425 |
-
/**
|
426 |
-
* Get ct_get_checkjs_value
|
427 |
-
*
|
428 |
-
* @param bool $random_key
|
429 |
-
*
|
430 |
-
* @return int|string|null
|
431 |
-
*/
|
432 |
-
function ct_get_checkjs_value(){
|
433 |
-
|
434 |
-
global $apbct;
|
435 |
-
|
436 |
-
// Use static JS keys
|
437 |
-
if(
|
438 |
-
|
439 |
-
($apbct->
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
$
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Inner function - Current
|
513 |
-
* @return
|
514 |
-
*/
|
515 |
-
function
|
516 |
-
global $
|
517 |
-
if(
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
*
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
//
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
'
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
'
|
691 |
-
'
|
692 |
-
|
693 |
-
'
|
694 |
-
'
|
695 |
-
'
|
696 |
-
'
|
697 |
-
'
|
698 |
-
//
|
699 |
-
'
|
700 |
-
'
|
701 |
-
|
702 |
-
'
|
703 |
-
|
704 |
-
'
|
705 |
-
|
706 |
-
'
|
707 |
-
'
|
708 |
-
|
709 |
-
'
|
710 |
-
'
|
711 |
-
//
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
'
|
716 |
-
|
717 |
-
'
|
718 |
-
'
|
719 |
-
|
720 |
-
'
|
721 |
-
|
722 |
-
'
|
723 |
-
'
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
$
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
$
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
}
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
}
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
}
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
979 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function apbct_array( $array ){
|
4 |
+
return new Cleantalk\Arr( $array );
|
5 |
+
}
|
6 |
+
|
7 |
+
$ct_checkjs_frm = 'ct_checkjs_frm';
|
8 |
+
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
9 |
+
|
10 |
+
$apbct_cookie_request_id_label = 'request_id';
|
11 |
+
$apbct_cookie_register_ok_label = 'register_ok';
|
12 |
+
|
13 |
+
$ct_checkjs_cf7 = 'ct_checkjs_cf7';
|
14 |
+
$ct_cf7_comment = '';
|
15 |
+
|
16 |
+
$ct_checkjs_jpcf = 'ct_checkjs_jpcf';
|
17 |
+
$ct_jpcf_patched = false;
|
18 |
+
$ct_jpcf_fields = array('name', 'email');
|
19 |
+
|
20 |
+
// Comment already proccessed
|
21 |
+
$ct_comment_done = false;
|
22 |
+
|
23 |
+
// Comment already proccessed
|
24 |
+
$ct_signup_done = false;
|
25 |
+
|
26 |
+
//Contains registration error
|
27 |
+
$ct_registration_error_comment = false;
|
28 |
+
|
29 |
+
// Default value for JS test
|
30 |
+
$ct_checkjs_def = 0;
|
31 |
+
|
32 |
+
// COOKIE label to store request id for last approved
|
33 |
+
$ct_approved_request_id_label = 'ct_approved_request_id';
|
34 |
+
|
35 |
+
// Last request id approved for publication
|
36 |
+
$ct_approved_request_id = null;
|
37 |
+
|
38 |
+
// Trial notice show time in minutes
|
39 |
+
$trial_notice_showtime = 10;
|
40 |
+
|
41 |
+
// Renew notice show time in minutes
|
42 |
+
$renew_notice_showtime = 10;
|
43 |
+
|
44 |
+
// COOKIE label for WP Landing Page proccessing result
|
45 |
+
$ct_wplp_result_label = 'ct_wplp_result';
|
46 |
+
|
47 |
+
// Flag indicates active JetPack comments
|
48 |
+
$ct_jp_comments = false;
|
49 |
+
|
50 |
+
// WP admin email notice interval in seconds
|
51 |
+
$ct_admin_notoice_period = 21600;
|
52 |
+
|
53 |
+
// Sevice negative comment to visitor.
|
54 |
+
// It uses for BuddyPress registrations to avoid double checks
|
55 |
+
$ct_negative_comment = null;
|
56 |
+
|
57 |
+
// Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
|
58 |
+
$ct_server = NULL;
|
59 |
+
$admin_email = NULL;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
|
63 |
+
*/
|
64 |
+
function apbct_plugin_loaded() {
|
65 |
+
$dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
|
66 |
+
$loaded=load_plugin_textdomain('cleantalk', false, $dir);
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Inner function - Request's wrapper for anything
|
71 |
+
* @param array Array of parameters:
|
72 |
+
* 'message' - string
|
73 |
+
* 'example' - string
|
74 |
+
* 'checkjs' - int
|
75 |
+
* 'sender_email' - string
|
76 |
+
* 'sender_nickname' - string
|
77 |
+
* 'sender_info' - array
|
78 |
+
* 'post_info' - string
|
79 |
+
* @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
|
80 |
+
*/
|
81 |
+
function apbct_base_call($params = array(), $reg_flag = false){
|
82 |
+
|
83 |
+
global $apbct, $cleantalk_executed;
|
84 |
+
|
85 |
+
$cleantalk_executed = true;
|
86 |
+
|
87 |
+
$sender_info = !empty($params['sender_info'])
|
88 |
+
? CleantalkHelper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
|
89 |
+
: apbct_get_sender_info();
|
90 |
+
|
91 |
+
// Fileds exclusions
|
92 |
+
if( ! empty( $params['message'] ) && is_array( $params['message'] ) ){
|
93 |
+
|
94 |
+
$params['message'] = apbct_array( $params['message'] )
|
95 |
+
->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
|
96 |
+
->delete();
|
97 |
+
}
|
98 |
+
|
99 |
+
$default_params = array(
|
100 |
+
|
101 |
+
// IPs
|
102 |
+
'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : CleantalkHelper::ip__get(array('real'), false)),
|
103 |
+
'x_forwarded_for' => CleantalkHelper::ip__get(array('x_forwarded_for'), false),
|
104 |
+
'x_real_ip' => CleantalkHelper::ip__get(array('x_real_ip'), false),
|
105 |
+
|
106 |
+
// Misc
|
107 |
+
'auth_key' => $apbct->api_key,
|
108 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
|
109 |
+
|
110 |
+
'agent' => APBCT_AGENT,
|
111 |
+
'sender_info' => $sender_info,
|
112 |
+
'submit_time' => apbct_get_submit_time(),
|
113 |
+
);
|
114 |
+
|
115 |
+
// Send $_SERVER if couldn't find IP
|
116 |
+
if(empty($default_params['sender_ip']))
|
117 |
+
$default_params['sender_info']['server_info'] = $_SERVER;
|
118 |
+
|
119 |
+
$ct_request = new CleantalkRequest(
|
120 |
+
CleantalkHelper::array_merge__save_numeric_keys__recursive($default_params, $params)
|
121 |
+
);
|
122 |
+
|
123 |
+
$ct = new Cleantalk();
|
124 |
+
|
125 |
+
$ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
|
126 |
+
$ct->ssl_on = $apbct->settings['ssl_on'];
|
127 |
+
$ct->ssl_path = APBCT_CASERT_PATH;
|
128 |
+
|
129 |
+
// Options store url without shceme because of DB error with ''://'
|
130 |
+
$config = ct_get_server();
|
131 |
+
$ct->server_url = APBCT_MODERATE_URL;
|
132 |
+
$ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
|
133 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
134 |
+
$ct->server_changed = $config['ct_server_changed'];
|
135 |
+
|
136 |
+
$start = microtime(true);
|
137 |
+
$ct_result = $reg_flag
|
138 |
+
? @$ct->isAllowUser($ct_request)
|
139 |
+
: @$ct->isAllowMessage($ct_request);
|
140 |
+
$exec_time = microtime(true) - $start;
|
141 |
+
|
142 |
+
// Statistics
|
143 |
+
// Average request time
|
144 |
+
apbct_statistics__rotate($exec_time);
|
145 |
+
// Last request
|
146 |
+
$apbct->stats['last_request']['time'] = time();
|
147 |
+
$apbct->stats['last_request']['server'] = $ct->work_url;
|
148 |
+
$apbct->save('stats');
|
149 |
+
|
150 |
+
// Connection reports
|
151 |
+
if ($ct_result->errno === 0 && empty($ct_result->errstr))
|
152 |
+
$apbct->data['connection_reports']['success']++;
|
153 |
+
else
|
154 |
+
{
|
155 |
+
$apbct->data['connection_reports']['negative']++;
|
156 |
+
$apbct->data['connection_reports']['negative_report'][] = array(
|
157 |
+
'date' => date("Y-m-d H:i:s"),
|
158 |
+
'page_url' => filter_input(INPUT_SERVER, 'REQUEST_URI'),
|
159 |
+
'lib_report' => $ct_result->errstr,
|
160 |
+
'work_url' => $ct->work_url,
|
161 |
+
);
|
162 |
+
|
163 |
+
if(count($apbct->data['connection_reports']['negative_report']) > 20)
|
164 |
+
$apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
if ($ct->server_change) {
|
169 |
+
update_option(
|
170 |
+
'cleantalk_server',
|
171 |
+
array(
|
172 |
+
'ct_work_url' => $ct->work_url,
|
173 |
+
'ct_server_ttl' => $ct->server_ttl,
|
174 |
+
'ct_server_changed' => time(),
|
175 |
+
)
|
176 |
+
);
|
177 |
+
}
|
178 |
+
|
179 |
+
$ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
|
180 |
+
|
181 |
+
// Restart submit form counter for failed requests
|
182 |
+
if ($ct_result->allow == 0){
|
183 |
+
apbct_cookie(); // Setting page timer and cookies
|
184 |
+
ct_add_event('no');
|
185 |
+
}else{
|
186 |
+
ct_add_event('yes');
|
187 |
+
}
|
188 |
+
|
189 |
+
// Set cookies if it's not.
|
190 |
+
if(empty($apbct->flags__cookies_setuped))
|
191 |
+
apbct_cookie();
|
192 |
+
|
193 |
+
return array('ct' => $ct, 'ct_result' => $ct_result);
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
function apbct_exclusions_check($func = null){
|
198 |
+
|
199 |
+
global $apbct, $cleantalk_executed;
|
200 |
+
|
201 |
+
// Common exclusions
|
202 |
+
if(
|
203 |
+
apbct_exclusions_check__ip() ||
|
204 |
+
apbct_exclusions_check__url() ||
|
205 |
+
apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
|
206 |
+
$cleantalk_executed
|
207 |
+
)
|
208 |
+
return true;
|
209 |
+
|
210 |
+
// Personal exclusions
|
211 |
+
switch ($func){
|
212 |
+
case 'ct_contact_form_validate_postdata':
|
213 |
+
if(
|
214 |
+
(defined( 'DOING_AJAX' ) && DOING_AJAX) ||
|
215 |
+
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
216 |
+
)
|
217 |
+
return true;
|
218 |
+
break;
|
219 |
+
case 'ct_contact_form_validate':
|
220 |
+
if(
|
221 |
+
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
222 |
+
)
|
223 |
+
return true;
|
224 |
+
break;
|
225 |
+
default:
|
226 |
+
return false;
|
227 |
+
break;
|
228 |
+
}
|
229 |
+
|
230 |
+
return false;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Checks if reuqest URI is in exclusion list
|
235 |
+
*
|
236 |
+
* @return bool
|
237 |
+
*/
|
238 |
+
function apbct_exclusions_check__url() {
|
239 |
+
|
240 |
+
global $apbct;
|
241 |
+
|
242 |
+
if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
|
243 |
+
|
244 |
+
$exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
|
245 |
+
|
246 |
+
// Fix for AJAX forms
|
247 |
+
$haystack = filter_input(INPUT_SERVER, 'REQUEST_URI') == '/wp-admin/admin-ajax.php' && ! filter_input(INPUT_SERVER, 'HTTP_REFERER')
|
248 |
+
? filter_input(INPUT_SERVER, 'HTTP_REFERER')
|
249 |
+
: filter_input(INPUT_SERVER, 'REQUEST_URI');
|
250 |
+
|
251 |
+
foreach ( $exclusions as $exclusion ) {
|
252 |
+
if (
|
253 |
+
($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
|
254 |
+
stripos( $haystack, $exclusion ) !== false
|
255 |
+
){
|
256 |
+
return true;
|
257 |
+
}
|
258 |
+
}
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
/**
|
263 |
+
* @deprecated 5.128 Using IP white-lists instead
|
264 |
+
* @deprecated since 18.09.2019
|
265 |
+
* Checks if sender_ip is in exclusion list
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
function apbct_exclusions_check__ip(){
|
270 |
+
|
271 |
+
global $cleantalk_ip_exclusions;
|
272 |
+
|
273 |
+
if( filter_input(INPUT_SERVER, 'REMOTE_ADDR') ){
|
274 |
+
|
275 |
+
if( CleantalkHelper::ip__is_cleantalks( filter_input(INPUT_SERVER, 'REMOTE_ADDR') ) ){
|
276 |
+
return true;
|
277 |
+
}
|
278 |
+
|
279 |
+
if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
|
280 |
+
foreach ( $cleantalk_ip_exclusions as $exclusion ){
|
281 |
+
if( stripos( filter_input(INPUT_SERVER, 'REMOTE_ADDR'), $exclusion ) !== false ){
|
282 |
+
return true;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
return false;
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Inner function - Default data array for senders
|
293 |
+
* @return array
|
294 |
+
*/
|
295 |
+
function apbct_get_sender_info() {
|
296 |
+
|
297 |
+
global $apbct;
|
298 |
+
|
299 |
+
// Validate cookie from the backend
|
300 |
+
$cookie_is_ok = apbct_cookies_test();
|
301 |
+
|
302 |
+
$referer_previous = $apbct->settings['set_cookies__sessions']
|
303 |
+
? apbct_alt_session__get('apbct_prev_referer')
|
304 |
+
: filter_input(INPUT_COOKIE, 'apbct_prev_referer');
|
305 |
+
|
306 |
+
$site_landing_ts = $apbct->settings['set_cookies__sessions']
|
307 |
+
? apbct_alt_session__get('apbct_site_landing_ts')
|
308 |
+
: filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
|
309 |
+
|
310 |
+
$page_hits = $apbct->settings['set_cookies__sessions']
|
311 |
+
? apbct_alt_session__get('apbct_page_hits')
|
312 |
+
: filter_input(INPUT_COOKIE, 'apbct_page_hits');
|
313 |
+
|
314 |
+
if (count($_POST) > 0) {
|
315 |
+
foreach ($_POST as $k => $v) {
|
316 |
+
if (preg_match("/^(ct_check|checkjs).+/", $k)) {
|
317 |
+
$checkjs_data_post = $v;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
// AMP check
|
323 |
+
$amp_detected = filter_input(INPUT_SERVER, 'HTTP_REFERER')
|
324 |
+
? strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'), '/amp/') !== false || strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'), '?amp=1') !== false || strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'), '&=1') !== false
|
325 |
+
? 1
|
326 |
+
: 0
|
327 |
+
: null;
|
328 |
+
|
329 |
+
$site_referer = $apbct->settings['store_urls__sessions']
|
330 |
+
? apbct_alt_session__get('apbct_site_referer')
|
331 |
+
: filter_input(INPUT_COOKIE, 'apbct_site_referer');
|
332 |
+
|
333 |
+
$urls = $apbct->settings['store_urls__sessions']
|
334 |
+
? (array)apbct_alt_session__get('apbct_urls')
|
335 |
+
: (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
|
336 |
+
|
337 |
+
return array(
|
338 |
+
'remote_addr' => CleantalkHelper::ip__get(array('remote_addr'), false),
|
339 |
+
'REFFERRER' => filter_input(INPUT_SERVER, 'HTTP_REFERER') ? htmlspecialchars(filter_input(INPUT_SERVER, 'HTTP_REFERER')) : null,
|
340 |
+
'USER_AGENT' => filter_input(INPUT_SERVER, 'HTTP_USER_AGENT') ? htmlspecialchars(filter_input(INPUT_SERVER, 'HTTP_USER_AGENT')) : null,
|
341 |
+
'page_url' => isset($_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']) ? htmlspecialchars($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']) : null,
|
342 |
+
'cms_lang' => substr(get_locale(), 0, 2),
|
343 |
+
'ct_options' => json_encode($apbct->settings),
|
344 |
+
'fields_number' => sizeof($_POST),
|
345 |
+
'direct_post' => $cookie_is_ok === null && filter_input(INPUT_SERVER, 'REQUEST_METHOD') == 'POST' ? 1 : 0,
|
346 |
+
// Raw data to validated JavaScript test in the cloud
|
347 |
+
'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
|
348 |
+
'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
|
349 |
+
// PHP cookies
|
350 |
+
'cookies_enabled' => $cookie_is_ok,
|
351 |
+
'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
|
352 |
+
'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
|
353 |
+
'page_hits' => !empty($page_hits) ? $page_hits : null,
|
354 |
+
// JS cookies
|
355 |
+
'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
|
356 |
+
'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
|
357 |
+
'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
|
358 |
+
'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
|
359 |
+
'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
|
360 |
+
'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
|
361 |
+
'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
|
362 |
+
// Misc
|
363 |
+
'site_referer' => !empty($site_referer) ? $site_referer : null,
|
364 |
+
'source_url' => !empty($urls) ? json_encode($urls) : null,
|
365 |
+
// Debug stuff
|
366 |
+
'amp_detected' => $amp_detected,
|
367 |
+
'hook' => current_action(),
|
368 |
+
'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
|
369 |
+
'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : false,
|
370 |
+
'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
|
371 |
+
'request_type' => filter_input(INPUT_SERVER, 'REQUEST_METHOD') ? filter_input(INPUT_SERVER, 'REQUEST_METHOD') : 'UNKNOWN',
|
372 |
+
'abpct_hyro_acc_collect' => !empty($_COOKIE['abpct_hyro_acc_collect']) ? json_decode(stripslashes($_COOKIE['abpct_hyro_acc_collect']), true): null,
|
373 |
+
);
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Process visible fields for specific form to match the fields from request
|
378 |
+
*
|
379 |
+
* @param string $visible_fields
|
380 |
+
*
|
381 |
+
* @return string
|
382 |
+
*/
|
383 |
+
function apbct_visibile_fields__process($visible_fields) {
|
384 |
+
if(strpos($visible_fields, 'wpforms') !== false){
|
385 |
+
$visible_fields = preg_replace(
|
386 |
+
array('/\[/', '/\]/'),
|
387 |
+
'',
|
388 |
+
str_replace(
|
389 |
+
'][',
|
390 |
+
'_',
|
391 |
+
str_replace(
|
392 |
+
'wpforms[fields]',
|
393 |
+
'',
|
394 |
+
$visible_fields
|
395 |
+
)
|
396 |
+
)
|
397 |
+
);
|
398 |
+
}
|
399 |
+
|
400 |
+
return $visible_fields;
|
401 |
+
}
|
402 |
+
|
403 |
+
/*
|
404 |
+
* Outputs JS key for AJAX-use only. Stops script.
|
405 |
+
*/
|
406 |
+
function apbct_js_keys__get__ajax($direct_call = false){
|
407 |
+
if(!$direct_call){
|
408 |
+
if(isset($_POST['_ajax_nonce'])){
|
409 |
+
if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
|
410 |
+
wp_doing_ajax()
|
411 |
+
? wp_die( -1, 403 )
|
412 |
+
: die( '-1' );
|
413 |
+
}
|
414 |
+
}else{
|
415 |
+
wp_doing_ajax()
|
416 |
+
? wp_die( -1, 403 )
|
417 |
+
: die( '-1' );
|
418 |
+
}
|
419 |
+
}
|
420 |
+
die(json_encode(array(
|
421 |
+
'js_key' => ct_get_checkjs_value()
|
422 |
+
)));
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Get ct_get_checkjs_value
|
427 |
+
*
|
428 |
+
* @param bool $random_key
|
429 |
+
*
|
430 |
+
* @return int|string|null
|
431 |
+
*/
|
432 |
+
function ct_get_checkjs_value(){
|
433 |
+
|
434 |
+
global $apbct;
|
435 |
+
|
436 |
+
// Use static JS keys
|
437 |
+
if($apbct->settings['use_static_js_key'] == 1){
|
438 |
+
|
439 |
+
$key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
|
440 |
+
|
441 |
+
// Auto detecting. Detected.
|
442 |
+
}elseif(
|
443 |
+
$apbct->settings['use_static_js_key'] == - 1 &&
|
444 |
+
( apbct_is_cache_plugins_exists() ||
|
445 |
+
( strtolower( filter_input(INPUT_SERVER, 'REQUEST_METHOD') ) == 'post' && $apbct->data['cache_detected'] == 1 )
|
446 |
+
)
|
447 |
+
){
|
448 |
+
$key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
|
449 |
+
if( apbct_is_cache_plugins_exists() )
|
450 |
+
$apbct->data['cache_detected'] = 1;
|
451 |
+
|
452 |
+
// Using dynamic JS keys
|
453 |
+
}else{
|
454 |
+
|
455 |
+
$keys = $apbct->data['js_keys'];
|
456 |
+
$keys_checksum = md5(json_encode($keys));
|
457 |
+
|
458 |
+
$key = null;
|
459 |
+
$latest_key_time = 0;
|
460 |
+
|
461 |
+
foreach ($keys as $k => $t) {
|
462 |
+
|
463 |
+
// Removing key if it's to old
|
464 |
+
if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
|
465 |
+
unset($keys[$k]);
|
466 |
+
continue;
|
467 |
+
}
|
468 |
+
|
469 |
+
if ($t > $latest_key_time) {
|
470 |
+
$latest_key_time = $t;
|
471 |
+
$key = $k;
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
// Set new key if the latest key is too old
|
476 |
+
if (time() - $latest_key_time > $apbct->data['js_key_lifetime']) {
|
477 |
+
$key = rand();
|
478 |
+
$keys[$key] = time();
|
479 |
+
}
|
480 |
+
|
481 |
+
// Save keys if they were changed
|
482 |
+
if (md5(json_encode($keys)) != $keys_checksum) {
|
483 |
+
$apbct->data['js_keys'] = $keys;
|
484 |
+
// $apbct->saveData();
|
485 |
+
}
|
486 |
+
|
487 |
+
$apbct->data['cache_detected'] = 0;
|
488 |
+
}
|
489 |
+
|
490 |
+
$apbct->saveData();
|
491 |
+
|
492 |
+
return $key;
|
493 |
+
}
|
494 |
+
|
495 |
+
function apbct_is_cache_plugins_exists(){
|
496 |
+
return
|
497 |
+
defined('WP_ROCKET_VERSION') || // WPRocket
|
498 |
+
defined('LSCWP_DIR') || // LiteSpeed Cache
|
499 |
+
defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
|
500 |
+
defined('W3TC') || // W3 Total Cache
|
501 |
+
defined('WPO_VERSION') || // WP-Optimize – Clean, Compress, Cache
|
502 |
+
defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
|
503 |
+
defined('WPCACHEHOME') || // WP Super Cache
|
504 |
+
defined('WPHB_VERSION') || // Hummingbird – Speed up, Cache, Optimize Your CSS and JS
|
505 |
+
defined('CE_FILE') || // Cache Enabler – WordPress Cache
|
506 |
+
class_exists('RedisObjectCache') || // Redis Object Cache
|
507 |
+
defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
|
508 |
+
class_exists('WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Inner function - Current site admin e-mail
|
513 |
+
* @return string Admin e-mail
|
514 |
+
*/
|
515 |
+
function ct_get_admin_email() {
|
516 |
+
global $admin_email;
|
517 |
+
if(!isset($admin_email))
|
518 |
+
{
|
519 |
+
$admin_email = get_option('admin_email');
|
520 |
+
}
|
521 |
+
return $admin_email;
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* Inner function - Current Cleantalk working server info
|
526 |
+
* @return mixed[] Array of server data
|
527 |
+
*/
|
528 |
+
function ct_get_server($force=false) {
|
529 |
+
global $ct_server;
|
530 |
+
if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
|
531 |
+
|
532 |
+
return $ct_server;
|
533 |
+
|
534 |
+
}else{
|
535 |
+
|
536 |
+
$ct_server = get_option('cleantalk_server');
|
537 |
+
if (!is_array($ct_server)){
|
538 |
+
$ct_server = array(
|
539 |
+
'ct_work_url' => NULL,
|
540 |
+
'ct_server_ttl' => NULL,
|
541 |
+
'ct_server_changed' => NULL
|
542 |
+
);
|
543 |
+
}
|
544 |
+
return $ct_server;
|
545 |
+
}
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Inner function - Stores ang returns cleantalk hash of current comment
|
550 |
+
* @param string New hash or NULL
|
551 |
+
* @return string New hash or current hash depending on parameter
|
552 |
+
*/
|
553 |
+
function ct_hash($new_hash = '') {
|
554 |
+
/**
|
555 |
+
* Current hash
|
556 |
+
*/
|
557 |
+
static $hash;
|
558 |
+
|
559 |
+
if (!empty($new_hash)) {
|
560 |
+
$hash = $new_hash;
|
561 |
+
}
|
562 |
+
return $hash;
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Inner function - Write manual moderation results to PHP sessions
|
567 |
+
* @param string $hash Cleantalk comment hash
|
568 |
+
* @param string $message comment_content
|
569 |
+
* @param int $allow flag good comment (1) or bad (0)
|
570 |
+
* @return string comment_content w\o cleantalk resume
|
571 |
+
*/
|
572 |
+
function ct_feedback($hash, $allow) {
|
573 |
+
global $apbct;
|
574 |
+
|
575 |
+
$ct_feedback = $hash . ':' . $allow . ';';
|
576 |
+
if($apbct->data['feedback_request'])
|
577 |
+
$apbct->data['feedback_request'] = $ct_feedback;
|
578 |
+
else
|
579 |
+
$apbct->data['feedback_request'] .= $ct_feedback;
|
580 |
+
|
581 |
+
$apbct->saveData();
|
582 |
+
}
|
583 |
+
|
584 |
+
/**
|
585 |
+
* Inner function - Sends the results of moderation
|
586 |
+
* Scheduled in 3600 seconds!
|
587 |
+
* @param string $feedback_request
|
588 |
+
* @return bool
|
589 |
+
*/
|
590 |
+
function ct_send_feedback($feedback_request = null) {
|
591 |
+
|
592 |
+
global $apbct;
|
593 |
+
|
594 |
+
if (empty($feedback_request) && isset($apbct->data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $apbct->data['feedback_request'])){
|
595 |
+
$feedback_request = $apbct->data['feedback_request'];
|
596 |
+
$apbct->data['feedback_request'] = '';
|
597 |
+
$apbct->saveData();
|
598 |
+
}
|
599 |
+
|
600 |
+
if ($feedback_request !== null) {
|
601 |
+
|
602 |
+
$ct_request = new CleantalkRequest(array(
|
603 |
+
// General
|
604 |
+
'auth_key' => $apbct->api_key,
|
605 |
+
// Additional
|
606 |
+
'feedback' => $feedback_request,
|
607 |
+
));
|
608 |
+
|
609 |
+
$ct = new Cleantalk();
|
610 |
+
|
611 |
+
// Server URL handling
|
612 |
+
$config = ct_get_server();
|
613 |
+
$ct->server_url = APBCT_MODERATE_URL;
|
614 |
+
$ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
|
615 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
616 |
+
$ct->server_changed = $config['ct_server_changed'];
|
617 |
+
|
618 |
+
$ct->sendFeedback($ct_request);
|
619 |
+
|
620 |
+
if ($ct->server_change) {
|
621 |
+
update_option(
|
622 |
+
'cleantalk_server',
|
623 |
+
array(
|
624 |
+
'ct_work_url' => $ct->work_url,
|
625 |
+
'ct_server_ttl' => $ct->server_ttl,
|
626 |
+
'ct_server_changed' => time(),
|
627 |
+
)
|
628 |
+
);
|
629 |
+
}
|
630 |
+
|
631 |
+
return true;
|
632 |
+
}
|
633 |
+
|
634 |
+
return false;
|
635 |
+
}
|
636 |
+
|
637 |
+
/**
|
638 |
+
* Delete old spam comments
|
639 |
+
* Scheduled in 3600 seconds!
|
640 |
+
* @return null
|
641 |
+
*/
|
642 |
+
function ct_delete_spam_comments() {
|
643 |
+
|
644 |
+
global $apbct;
|
645 |
+
|
646 |
+
if ($apbct->settings['remove_old_spam'] == 1) {
|
647 |
+
$last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
|
648 |
+
foreach ($last_comments as $c) {
|
649 |
+
$comment_date_gmt = strtotime($c->comment_date_gmt);
|
650 |
+
if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
|
651 |
+
if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
|
652 |
+
// Force deletion old spam comments
|
653 |
+
wp_delete_comment($c->comment_ID, true);
|
654 |
+
}
|
655 |
+
}
|
656 |
+
}
|
657 |
+
}
|
658 |
+
|
659 |
+
return null;
|
660 |
+
}
|
661 |
+
|
662 |
+
/*
|
663 |
+
* Get data from an ARRAY recursively
|
664 |
+
* @return array
|
665 |
+
*/
|
666 |
+
function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
|
667 |
+
|
668 |
+
//Skip request if fields exists
|
669 |
+
$skip_params = array(
|
670 |
+
'ipn_track_id', // PayPal IPN #
|
671 |
+
'txn_type', // PayPal transaction type
|
672 |
+
'payment_status', // PayPal payment status
|
673 |
+
'ccbill_ipn', // CCBill IPN
|
674 |
+
'ct_checkjs', // skip ct_checkjs field
|
675 |
+
'api_mode', // DigiStore-API
|
676 |
+
'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
|
677 |
+
);
|
678 |
+
|
679 |
+
// Fields to replace with ****
|
680 |
+
$obfuscate_params = array(
|
681 |
+
'password',
|
682 |
+
'pass',
|
683 |
+
'pwd',
|
684 |
+
'pswd'
|
685 |
+
);
|
686 |
+
|
687 |
+
// Skip feilds with these strings and known service fields
|
688 |
+
$skip_fields_with_strings = array(
|
689 |
+
// Common
|
690 |
+
'ct_checkjs', //Do not send ct_checkjs
|
691 |
+
'nonce', //nonce for strings such as 'rsvp_nonce_name'
|
692 |
+
'security',
|
693 |
+
// 'action',
|
694 |
+
'http_referer',
|
695 |
+
'referer-page',
|
696 |
+
'timestamp',
|
697 |
+
'captcha',
|
698 |
+
// Formidable Form
|
699 |
+
'form_key',
|
700 |
+
'submit_entry',
|
701 |
+
// Custom Contact Forms
|
702 |
+
'form_id',
|
703 |
+
'ccf_form',
|
704 |
+
'form_page',
|
705 |
+
// Qu Forms
|
706 |
+
'iphorm_uid',
|
707 |
+
'form_url',
|
708 |
+
'post_id',
|
709 |
+
'iphorm_ajax',
|
710 |
+
'iphorm_id',
|
711 |
+
// Fast SecureContact Froms
|
712 |
+
'fs_postonce_1',
|
713 |
+
'fscf_submitted',
|
714 |
+
'mailto_id',
|
715 |
+
'si_contact_action',
|
716 |
+
// Ninja Forms
|
717 |
+
'formData_id',
|
718 |
+
'formData_settings',
|
719 |
+
'formData_fields_\d+_id',
|
720 |
+
'formData_fields_\d+_files.*',
|
721 |
+
// E_signature
|
722 |
+
'recipient_signature',
|
723 |
+
'output_\d+_\w{0,2}',
|
724 |
+
// Contact Form by Web-Settler protection
|
725 |
+
'_formId',
|
726 |
+
'_returnLink',
|
727 |
+
// Social login and more
|
728 |
+
'_save',
|
729 |
+
'_facebook',
|
730 |
+
'_social',
|
731 |
+
'user_login-',
|
732 |
+
// Contact Form 7
|
733 |
+
'_wpcf7',
|
734 |
+
'ebd_settings',
|
735 |
+
'ebd_downloads_',
|
736 |
+
'ecole_origine',
|
737 |
+
);
|
738 |
+
|
739 |
+
// Reset $message if we have a sign-up data
|
740 |
+
$skip_message_post = array(
|
741 |
+
'edd_action', // Easy Digital Downloads
|
742 |
+
);
|
743 |
+
|
744 |
+
if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
|
745 |
+
$contact = false;
|
746 |
+
|
747 |
+
if(count($arr)){
|
748 |
+
|
749 |
+
foreach($arr as $key => $value){
|
750 |
+
|
751 |
+
if(gettype($value) == 'string'){
|
752 |
+
|
753 |
+
$tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
|
754 |
+
$decoded_json_value = json_decode($tmp, true);
|
755 |
+
|
756 |
+
// Decoding JSON
|
757 |
+
if($decoded_json_value !== null){
|
758 |
+
$value = $decoded_json_value;
|
759 |
+
|
760 |
+
// Ajax Contact Forms. Get data from such strings:
|
761 |
+
// acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
|
762 |
+
// acfw30_textarea %% msg
|
763 |
+
}elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
|
764 |
+
$value = explode('~', $value);
|
765 |
+
foreach ($value as &$val){
|
766 |
+
$tmp = explode(' %% ', $val);
|
767 |
+
$val = array($tmp[0] => $tmp[1]);
|
768 |
+
}
|
769 |
+
}
|
770 |
+
}
|
771 |
+
|
772 |
+
if(!is_array($value) && !is_object($value)){
|
773 |
+
|
774 |
+
if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
|
775 |
+
$contact = false;
|
776 |
+
|
777 |
+
if($value === '')
|
778 |
+
continue;
|
779 |
+
|
780 |
+
// Skipping fields names with strings from (array)skip_fields_with_strings
|
781 |
+
foreach($skip_fields_with_strings as $needle){
|
782 |
+
if (preg_match("/".$needle."/", $prev_name.$key) == 1){
|
783 |
+
continue(2);
|
784 |
+
}
|
785 |
+
}unset($needle);
|
786 |
+
|
787 |
+
// Obfuscating params
|
788 |
+
foreach($obfuscate_params as $needle){
|
789 |
+
if (strpos($key, $needle) !== false){
|
790 |
+
$value = ct_obfuscate_param($value);
|
791 |
+
continue(2);
|
792 |
+
}
|
793 |
+
}unset($needle);
|
794 |
+
|
795 |
+
// Removes whitespaces
|
796 |
+
$value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
|
797 |
+
$value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
|
798 |
+
|
799 |
+
// Email
|
800 |
+
if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
|
801 |
+
$email = $value_for_email;
|
802 |
+
|
803 |
+
// Names
|
804 |
+
}elseif (preg_match("/name/i", $key)){
|
805 |
+
|
806 |
+
preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
|
807 |
+
preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
|
808 |
+
preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
|
809 |
+
|
810 |
+
if(count($match_forename) > 1)
|
811 |
+
$nickname['first'] = $value;
|
812 |
+
elseif(count($match_surname) > 1)
|
813 |
+
$nickname['last'] = $value;
|
814 |
+
elseif(count($match_nickname) > 1)
|
815 |
+
$nickname['nick'] = $value;
|
816 |
+
else
|
817 |
+
$message[$prev_name.$key] = $value;
|
818 |
+
|
819 |
+
// Subject
|
820 |
+
}elseif ($subject === null && preg_match("/subject/i", $key)){
|
821 |
+
$subject = $value;
|
822 |
+
|
823 |
+
// Message
|
824 |
+
}else{
|
825 |
+
$message[$prev_name.$key] = $value;
|
826 |
+
}
|
827 |
+
|
828 |
+
}elseif(!is_object($value)){
|
829 |
+
|
830 |
+
$prev_name_original = $prev_name;
|
831 |
+
$prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
|
832 |
+
|
833 |
+
$temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
|
834 |
+
|
835 |
+
$message = $temp['message'];
|
836 |
+
$email = ($temp['email'] ? $temp['email'] : null);
|
837 |
+
$nickname = ($temp['nickname'] ? $temp['nickname'] : null);
|
838 |
+
$subject = ($temp['subject'] ? $temp['subject'] : null);
|
839 |
+
if($contact === true)
|
840 |
+
$contact = ($temp['contact'] === false ? false : true);
|
841 |
+
$prev_name = $prev_name_original;
|
842 |
+
}
|
843 |
+
} unset($key, $value);
|
844 |
+
}
|
845 |
+
|
846 |
+
foreach ($skip_message_post as $v) {
|
847 |
+
if (isset($_POST[$v])) {
|
848 |
+
$message = null;
|
849 |
+
break;
|
850 |
+
}
|
851 |
+
} unset($v);
|
852 |
+
|
853 |
+
//If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
|
854 |
+
if($prev_name === ''){
|
855 |
+
if(!empty($nickname)){
|
856 |
+
$nickname_str = '';
|
857 |
+
foreach($nickname as $value){
|
858 |
+
$nickname_str .= ($value ? $value." " : "");
|
859 |
+
}unset($value);
|
860 |
+
}
|
861 |
+
$nickname = $nickname_str;
|
862 |
+
}
|
863 |
+
|
864 |
+
$return_param = array(
|
865 |
+
'email' => $email,
|
866 |
+
'nickname' => $nickname,
|
867 |
+
'subject' => $subject,
|
868 |
+
'contact' => $contact,
|
869 |
+
'message' => $message
|
870 |
+
);
|
871 |
+
return $return_param;
|
872 |
+
}
|
873 |
+
|
874 |
+
/**
|
875 |
+
* Masks a value with asterisks (*)
|
876 |
+
* @return string
|
877 |
+
*/
|
878 |
+
function ct_obfuscate_param($value = null) {
|
879 |
+
if ($value && (!is_object($value) || !is_array($value))) {
|
880 |
+
$length = strlen($value);
|
881 |
+
$value = str_repeat('*', $length);
|
882 |
+
}
|
883 |
+
|
884 |
+
return $value;
|
885 |
+
}
|
886 |
+
|
887 |
+
//New ct_get_fields_any_postdata
|
888 |
+
function ct_get_fields_any_postdata($arr, $message=array()){
|
889 |
+
$skip_params = array(
|
890 |
+
'ipn_track_id', // PayPal IPN #
|
891 |
+
'txn_type', // PayPal transaction type
|
892 |
+
'payment_status', // PayPal payment status
|
893 |
+
);
|
894 |
+
|
895 |
+
foreach($arr as $key => $value){
|
896 |
+
if(!is_array($value)){
|
897 |
+
if($value == '')
|
898 |
+
continue;
|
899 |
+
if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
|
900 |
+
$message[$key] = $value;
|
901 |
+
}else{
|
902 |
+
$temp = ct_get_fields_any_postdata($value);
|
903 |
+
$message = (count($temp) == 0 ? $message : array_merge($message, $temp));
|
904 |
+
}
|
905 |
+
}
|
906 |
+
return $message;
|
907 |
+
}
|
908 |
+
|
909 |
+
/**
|
910 |
+
* Checks if given string is valid regular expression
|
911 |
+
*
|
912 |
+
* @param string $regexp
|
913 |
+
*
|
914 |
+
* @return bool
|
915 |
+
*/
|
916 |
+
function apbct_is_regexp($regexp){
|
917 |
+
return @preg_match('/' . $regexp . '/', null) !== false;
|
918 |
+
}
|
919 |
+
|
920 |
+
function cleantalk_debug($key,$value)
|
921 |
+
{
|
922 |
+
if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
|
923 |
+
{
|
924 |
+
@header($key.": ".$value);
|
925 |
+
}
|
926 |
+
}
|
927 |
+
|
928 |
+
/**
|
929 |
+
* Function changes CleanTalk result object if an error occured.
|
930 |
+
* @return object
|
931 |
+
*/
|
932 |
+
function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
|
933 |
+
|
934 |
+
global $apbct;
|
935 |
+
|
936 |
+
if (!$ct_result) {
|
937 |
+
return $ct_result;
|
938 |
+
}
|
939 |
+
|
940 |
+
if(@intval($ct_result->errno) != 0)
|
941 |
+
{
|
942 |
+
if($checkjs === null || $checkjs != 1)
|
943 |
+
{
|
944 |
+
$ct_result->allow = 0;
|
945 |
+
$ct_result->spam = 1;
|
946 |
+
$ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
|
947 |
+
$ct_result->comment,
|
948 |
+
$apbct->plugin_name
|
949 |
+
);
|
950 |
+
}
|
951 |
+
else
|
952 |
+
{
|
953 |
+
$ct_result->allow = 1;
|
954 |
+
$ct_result->comment = 'Allow';
|
955 |
+
}
|
956 |
+
}
|
957 |
+
|
958 |
+
return $ct_result;
|
959 |
+
}
|
960 |
+
|
961 |
+
/**
|
962 |
+
* Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
|
963 |
+
* @param api_key
|
964 |
+
* @return bool
|
965 |
+
*/
|
966 |
+
function apbct_api_key__is_correct($api_key = null)
|
967 |
+
{
|
968 |
+
global $apbct;
|
969 |
+
$api_key = $api_key !== null ? $api_key : $apbct->api_key;
|
970 |
+
return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
|
971 |
+
}
|
972 |
+
|
973 |
+
function apbct_add_async_attribute($tag, $handle, $src) {
|
974 |
+
|
975 |
+
global $apbct;
|
976 |
+
|
977 |
+
if(
|
978 |
+
$apbct->settings['async_js'] &&
|
979 |
+
(
|
980 |
+
$handle === 'ct_public'
|
981 |
+
|| $handle === 'ct_public_gdpr'
|
982 |
+
|| $handle === 'ct_debug_js'
|
983 |
+
|| $handle === 'ct_public_admin_js'
|
984 |
+
|| $handle === 'ct_internal'
|
985 |
+
|| $handle === 'ct_external'
|
986 |
+
|| $handle === 'ct_nocache'
|
987 |
+
)
|
988 |
+
)
|
989 |
+
return str_replace( ' src', ' async="async" src', $tag );
|
990 |
+
else
|
991 |
+
return $tag;
|
992 |
}
|
inc/cleantalk-pluggable.php
CHANGED
@@ -1,229 +1,231 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Getting current user by cookie
|
5 |
-
*
|
6 |
-
* @return WP_User|null
|
7 |
-
*/
|
8 |
-
function apbct_wp_get_current_user(){
|
9 |
-
|
10 |
-
global $apbct, $current_user;
|
11 |
-
|
12 |
-
$user = null;
|
13 |
-
|
14 |
-
if(!(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
|
15 |
-
|
16 |
-
if(!empty($apbct->user)){
|
17 |
-
$user_id = is_object($current_user) && isset($current_user->ID) && !($current_user instanceof WP_User)
|
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 |
-
}
|
25 |
-
|
26 |
-
if($user_id){
|
27 |
-
$user = new WP_User($user_id);
|
28 |
-
}
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
return $user ? $user : $current_user;
|
33 |
-
}
|
34 |
-
|
35 |
-
function apbct_wp_set_current_user($user = null){
|
36 |
-
|
37 |
-
global $apbct;
|
38 |
-
|
39 |
-
if( $user instanceof WP_User ){
|
40 |
-
$apbct->user = $user;
|
41 |
-
return true;
|
42 |
-
}
|
43 |
-
|
44 |
-
return false;
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Validates authentication cookie.
|
49 |
-
*
|
50 |
-
* The checks include making sure that the authentication cookie is set and
|
51 |
-
* pulling in the contents (if $cookie is not used).
|
52 |
-
*
|
53 |
-
* Makes sure the cookie is not expired. Verifies the hash in cookie is what is
|
54 |
-
* should be and compares the two.
|
55 |
-
*
|
56 |
-
* @param string $cookie Optional. If used, will validate contents instead of cookie's
|
57 |
-
* @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
|
58 |
-
*
|
59 |
-
* @return false|int False if invalid cookie, User ID if valid.
|
60 |
-
* @global int $login_grace_period
|
61 |
-
*
|
62 |
-
*/
|
63 |
-
function apbct_wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
|
64 |
-
|
65 |
-
$cookie_elements = apbct_wp_parse_auth_cookie($cookie, $scheme);
|
66 |
-
|
67 |
-
$scheme = $cookie_elements['scheme'];
|
68 |
-
$username = $cookie_elements['username'];
|
69 |
-
$hmac = $cookie_elements['hmac'];
|
70 |
-
$token = $cookie_elements['token'];
|
71 |
-
$expiration = $cookie_elements['expiration'];
|
72 |
-
|
73 |
-
// Allow a grace period for POST and Ajax requests
|
74 |
-
$expired = apbct_is_ajax() || 'POST' ==
|
75 |
-
? $expiration + HOUR_IN_SECONDS
|
76 |
-
: $cookie_elements['expiration'];
|
77 |
-
|
78 |
-
// Quick check to see if an honest cookie has expired
|
79 |
-
if($expired >= time()){
|
80 |
-
$user = apbct_wp_get_user_by('login', $username);
|
81 |
-
if($user){
|
82 |
-
$pass_frag = substr($user->user_pass, 8, 4);
|
83 |
-
$key = apbct_wp_hash($username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme);
|
84 |
-
// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
|
85 |
-
$algo = function_exists('hash') ? 'sha256' : 'sha1';
|
86 |
-
$hash = hash_hmac($algo, $username . '|' . $expiration . '|' . $token, $key);
|
87 |
-
if(hash_equals($hash, $hmac)){
|
88 |
-
$sessions = get_user_meta($user->ID, 'session_tokens', true);
|
89 |
-
$sessions = current($sessions);
|
90 |
-
if(is_array($sessions)){
|
91 |
-
if(is_int($sessions['expiration']) && $sessions['expiration'] > time()){
|
92 |
-
return $user->ID;
|
93 |
-
}else
|
94 |
-
return false;
|
95 |
-
}else
|
96 |
-
return false;
|
97 |
-
}else
|
98 |
-
return false;
|
99 |
-
}else
|
100 |
-
return false;
|
101 |
-
}else
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Gets user by filed
|
107 |
-
*
|
108 |
-
* @param $field
|
109 |
-
* @param $value
|
110 |
-
*
|
111 |
-
* @return bool|WP_User
|
112 |
-
*/
|
113 |
-
function apbct_wp_get_user_by($field, $value){
|
114 |
-
|
115 |
-
$userdata = WP_User::get_data_by($field, $value);
|
116 |
-
|
117 |
-
if(!$userdata)
|
118 |
-
return false;
|
119 |
-
|
120 |
-
$user = new WP_User;
|
121 |
-
$user->init($userdata);
|
122 |
-
|
123 |
-
return $user;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Get hash of given string.
|
128 |
-
*
|
129 |
-
* @param string $data Plain text to hash
|
130 |
-
* @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
|
131 |
-
* @return string Hash of $data
|
132 |
-
*/
|
133 |
-
function apbct_wp_hash( $data, $scheme = 'auth' ) {
|
134 |
-
|
135 |
-
$values = array(
|
136 |
-
'key' => '',
|
137 |
-
'salt' => '',
|
138 |
-
);
|
139 |
-
|
140 |
-
foreach(array('key', 'salt') as $type){
|
141 |
-
$const = strtoupper( "{$scheme}_{$type}");
|
142 |
-
if ( defined($const) && constant($const)){
|
143 |
-
$values[$type] = constant($const);
|
144 |
-
}elseif(!$values[$type]){
|
145 |
-
$values[$type] = get_site_option( "{$scheme}_{$type}");
|
146 |
-
if (!$values[$type]){
|
147 |
-
$values[$type] = '';
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
$salt = $values['key'] . $values['salt'];
|
153 |
-
|
154 |
-
return hash_hmac('md5', $data, $salt);
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Parse a cookie into its components
|
159 |
-
*
|
160 |
-
* @param string $cookie
|
161 |
-
* @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
|
162 |
-
*
|
163 |
-
* @return array|false Authentication cookie components
|
164 |
-
*
|
165 |
-
*/
|
166 |
-
function apbct_wp_parse_auth_cookie($cookie = '', $scheme = '')
|
167 |
-
{
|
168 |
-
$cookie_elements = explode('|', $cookie);
|
169 |
-
if(count($cookie_elements) !== 4){
|
170 |
-
return false;
|
171 |
-
}
|
172 |
-
|
173 |
-
list($username, $expiration, $token, $hmac) = $cookie_elements;
|
174 |
-
|
175 |
-
return compact('username', 'expiration', 'token', 'hmac', 'scheme');
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Checks if the plugin is active
|
180 |
-
*
|
181 |
-
* @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
|
182 |
-
*
|
183 |
-
* @return bool
|
184 |
-
*/
|
185 |
-
function apbct_is_plugin_active( $plugin ) {
|
186 |
-
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || apbct_is_plugin_active_for_network( $plugin );
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Checks if the plugin is active for network
|
191 |
-
*
|
192 |
-
* @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
|
193 |
-
*
|
194 |
-
* @return bool
|
195 |
-
*/
|
196 |
-
function apbct_is_plugin_active_for_network( $plugin ){
|
197 |
-
|
198 |
-
if ( ! APBCT_WPMS )
|
199 |
-
return false;
|
200 |
-
|
201 |
-
$plugins = get_site_option( 'active_sitewide_plugins' );
|
202 |
-
|
203 |
-
return isset( $plugins[ $plugin ] )
|
204 |
-
? true
|
205 |
-
: false;
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Checks if the request is AJAX
|
210 |
-
*
|
211 |
-
* @return boolean
|
212 |
-
*/
|
213 |
-
function apbct_is_ajax() {
|
214 |
-
|
215 |
-
return
|
216 |
-
(defined( 'DOING_AJAX' ) && DOING_AJAX) || // by standart WP functions
|
217 |
-
(
|
218 |
-
!empty($_POST['quform_ajax']); // special. QForms
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Checks if the user is logged in
|
224 |
-
*
|
225 |
-
* @return bool
|
226 |
-
*/
|
227 |
-
function apbct_is_user_logged_in(){
|
228 |
-
|
|
|
|
|
229 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Getting current user by cookie
|
5 |
+
*
|
6 |
+
* @return WP_User|null
|
7 |
+
*/
|
8 |
+
function apbct_wp_get_current_user(){
|
9 |
+
|
10 |
+
global $apbct, $current_user;
|
11 |
+
|
12 |
+
$user = null;
|
13 |
+
|
14 |
+
if(!(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
|
15 |
+
|
16 |
+
if(!empty($apbct->user)){
|
17 |
+
$user_id = is_object($current_user) && isset($current_user->ID) && !($current_user instanceof WP_User)
|
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 |
+
}
|
25 |
+
|
26 |
+
if($user_id){
|
27 |
+
$user = new WP_User($user_id);
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
return $user ? $user : $current_user;
|
33 |
+
}
|
34 |
+
|
35 |
+
function apbct_wp_set_current_user($user = null){
|
36 |
+
|
37 |
+
global $apbct;
|
38 |
+
|
39 |
+
if( $user instanceof WP_User ){
|
40 |
+
$apbct->user = $user;
|
41 |
+
return true;
|
42 |
+
}
|
43 |
+
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Validates authentication cookie.
|
49 |
+
*
|
50 |
+
* The checks include making sure that the authentication cookie is set and
|
51 |
+
* pulling in the contents (if $cookie is not used).
|
52 |
+
*
|
53 |
+
* Makes sure the cookie is not expired. Verifies the hash in cookie is what is
|
54 |
+
* should be and compares the two.
|
55 |
+
*
|
56 |
+
* @param string $cookie Optional. If used, will validate contents instead of cookie's
|
57 |
+
* @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
|
58 |
+
*
|
59 |
+
* @return false|int False if invalid cookie, User ID if valid.
|
60 |
+
* @global int $login_grace_period
|
61 |
+
*
|
62 |
+
*/
|
63 |
+
function apbct_wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
|
64 |
+
|
65 |
+
$cookie_elements = apbct_wp_parse_auth_cookie($cookie, $scheme);
|
66 |
+
|
67 |
+
$scheme = $cookie_elements['scheme'];
|
68 |
+
$username = $cookie_elements['username'];
|
69 |
+
$hmac = $cookie_elements['hmac'];
|
70 |
+
$token = $cookie_elements['token'];
|
71 |
+
$expiration = $cookie_elements['expiration'];
|
72 |
+
|
73 |
+
// Allow a grace period for POST and Ajax requests
|
74 |
+
$expired = apbct_is_ajax() || 'POST' == filter_input(INPUT_SERVER, 'REQUEST_METHOD')
|
75 |
+
? $expiration + HOUR_IN_SECONDS
|
76 |
+
: $cookie_elements['expiration'];
|
77 |
+
|
78 |
+
// Quick check to see if an honest cookie has expired
|
79 |
+
if($expired >= time()){
|
80 |
+
$user = apbct_wp_get_user_by('login', $username);
|
81 |
+
if($user){
|
82 |
+
$pass_frag = substr($user->user_pass, 8, 4);
|
83 |
+
$key = apbct_wp_hash($username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme);
|
84 |
+
// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
|
85 |
+
$algo = function_exists('hash') ? 'sha256' : 'sha1';
|
86 |
+
$hash = hash_hmac($algo, $username . '|' . $expiration . '|' . $token, $key);
|
87 |
+
if(hash_equals($hash, $hmac)){
|
88 |
+
$sessions = get_user_meta($user->ID, 'session_tokens', true);
|
89 |
+
$sessions = current($sessions);
|
90 |
+
if(is_array($sessions)){
|
91 |
+
if(is_int($sessions['expiration']) && $sessions['expiration'] > time()){
|
92 |
+
return $user->ID;
|
93 |
+
}else
|
94 |
+
return false;
|
95 |
+
}else
|
96 |
+
return false;
|
97 |
+
}else
|
98 |
+
return false;
|
99 |
+
}else
|
100 |
+
return false;
|
101 |
+
}else
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Gets user by filed
|
107 |
+
*
|
108 |
+
* @param $field
|
109 |
+
* @param $value
|
110 |
+
*
|
111 |
+
* @return bool|WP_User
|
112 |
+
*/
|
113 |
+
function apbct_wp_get_user_by($field, $value){
|
114 |
+
|
115 |
+
$userdata = WP_User::get_data_by($field, $value);
|
116 |
+
|
117 |
+
if(!$userdata)
|
118 |
+
return false;
|
119 |
+
|
120 |
+
$user = new WP_User;
|
121 |
+
$user->init($userdata);
|
122 |
+
|
123 |
+
return $user;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get hash of given string.
|
128 |
+
*
|
129 |
+
* @param string $data Plain text to hash
|
130 |
+
* @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
|
131 |
+
* @return string Hash of $data
|
132 |
+
*/
|
133 |
+
function apbct_wp_hash( $data, $scheme = 'auth' ) {
|
134 |
+
|
135 |
+
$values = array(
|
136 |
+
'key' => '',
|
137 |
+
'salt' => '',
|
138 |
+
);
|
139 |
+
|
140 |
+
foreach(array('key', 'salt') as $type){
|
141 |
+
$const = strtoupper( "{$scheme}_{$type}");
|
142 |
+
if ( defined($const) && constant($const)){
|
143 |
+
$values[$type] = constant($const);
|
144 |
+
}elseif(!$values[$type]){
|
145 |
+
$values[$type] = get_site_option( "{$scheme}_{$type}");
|
146 |
+
if (!$values[$type]){
|
147 |
+
$values[$type] = '';
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
$salt = $values['key'] . $values['salt'];
|
153 |
+
|
154 |
+
return hash_hmac('md5', $data, $salt);
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Parse a cookie into its components
|
159 |
+
*
|
160 |
+
* @param string $cookie
|
161 |
+
* @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
|
162 |
+
*
|
163 |
+
* @return array|false Authentication cookie components
|
164 |
+
*
|
165 |
+
*/
|
166 |
+
function apbct_wp_parse_auth_cookie($cookie = '', $scheme = '')
|
167 |
+
{
|
168 |
+
$cookie_elements = explode('|', $cookie);
|
169 |
+
if(count($cookie_elements) !== 4){
|
170 |
+
return false;
|
171 |
+
}
|
172 |
+
|
173 |
+
list($username, $expiration, $token, $hmac) = $cookie_elements;
|
174 |
+
|
175 |
+
return compact('username', 'expiration', 'token', 'hmac', 'scheme');
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Checks if the plugin is active
|
180 |
+
*
|
181 |
+
* @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
|
182 |
+
*
|
183 |
+
* @return bool
|
184 |
+
*/
|
185 |
+
function apbct_is_plugin_active( $plugin ) {
|
186 |
+
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || apbct_is_plugin_active_for_network( $plugin );
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Checks if the plugin is active for network
|
191 |
+
*
|
192 |
+
* @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
|
193 |
+
*
|
194 |
+
* @return bool
|
195 |
+
*/
|
196 |
+
function apbct_is_plugin_active_for_network( $plugin ){
|
197 |
+
|
198 |
+
if ( ! APBCT_WPMS )
|
199 |
+
return false;
|
200 |
+
|
201 |
+
$plugins = get_site_option( 'active_sitewide_plugins' );
|
202 |
+
|
203 |
+
return isset( $plugins[ $plugin ] )
|
204 |
+
? true
|
205 |
+
: false;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Checks if the request is AJAX
|
210 |
+
*
|
211 |
+
* @return boolean
|
212 |
+
*/
|
213 |
+
function apbct_is_ajax() {
|
214 |
+
|
215 |
+
return
|
216 |
+
(defined( 'DOING_AJAX' ) && DOING_AJAX) || // by standart WP functions
|
217 |
+
(filter_input(INPUT_SERVER, 'HTTP_X_REQUESTED_WITH') && strtolower(filter_input(INPUT_SERVER, 'HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest') || // by Request type
|
218 |
+
!empty($_POST['quform_ajax']); // special. QForms
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Checks if the user is logged in
|
224 |
+
*
|
225 |
+
* @return bool
|
226 |
+
*/
|
227 |
+
function apbct_is_user_logged_in(){
|
228 |
+
$siteurl = get_site_option( 'siteurl' );
|
229 |
+
$cookiehash = $siteurl ? md5( $siteurl ) : '';
|
230 |
+
return count($_COOKIE) && isset($_COOKIE['wordpress_logged_in_'.$cookiehash]);
|
231 |
}
|
inc/cleantalk-public.php
CHANGED
@@ -1,3438 +1,3501 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Init functions
|
5 |
-
* @return mixed[] Array of options
|
6 |
-
*/
|
7 |
-
function apbct_init() {
|
8 |
-
|
9 |
-
global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $apbct, $test_external_forms, $cleantalk_executed, $wpdb;
|
10 |
-
|
11 |
-
//Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
|
12 |
-
if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
|
13 |
-
$apbct->settings['check_internal']
|
14 |
-
){
|
15 |
-
$ct_result = ct_contact_form_validate();
|
16 |
-
if($ct_result == null){
|
17 |
-
echo 'true';
|
18 |
-
die();
|
19 |
-
}else{
|
20 |
-
echo $ct_result;
|
21 |
-
die();
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
//fix for EPM registration form
|
26 |
-
if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
|
27 |
-
{
|
28 |
-
unset($_POST['ct_checkjs_register_form']);
|
29 |
-
}
|
30 |
-
|
31 |
-
if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
|
32 |
-
{
|
33 |
-
add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
|
34 |
-
}
|
35 |
-
|
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);
|
43 |
-
}
|
44 |
-
|
45 |
-
// Check and redirecct
|
46 |
-
if(
|
47 |
-
&& isset($_POST['cleantalk_hidden_method'])
|
48 |
-
&& isset($_POST['cleantalk_hidden_action'])
|
49 |
-
){
|
50 |
-
$action = htmlspecialchars($_POST['cleantalk_hidden_action']);
|
51 |
-
$method = htmlspecialchars($_POST['cleantalk_hidden_method']);
|
52 |
-
unset($_POST['cleantalk_hidden_action']);
|
53 |
-
unset($_POST['cleantalk_hidden_method']);
|
54 |
-
ct_contact_form_validate();
|
55 |
-
if(!apbct_is_ajax()){
|
56 |
-
print "<html><body><form method='$method' action='$action'>";
|
57 |
-
ct_print_form($_POST, '');
|
58 |
-
print "</form></body></html>";
|
59 |
-
print "<script>
|
60 |
-
if(document.forms[0].submit !== 'undefined'){
|
61 |
-
var objects = document.getElementsByName('submit');
|
62 |
-
if(objects.length > 0)
|
63 |
-
document.forms[0].removeChild(objects[0]);
|
64 |
-
}
|
65 |
-
document.forms[0].submit();
|
66 |
-
</script>";
|
67 |
-
die();
|
68 |
-
}
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
|
73 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
74 |
-
ct_ajax_hook();
|
75 |
-
}
|
76 |
-
|
77 |
-
/**hooks for cm answers pro */
|
78 |
-
if(defined('CMA_PLUGIN_FILE')){
|
79 |
-
add_action( 'wp', 'ct_ajax_hook',1 );
|
80 |
-
}
|
81 |
-
|
82 |
-
//hook for Anonymous Post
|
83 |
-
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
84 |
-
add_action('wp', 'ct_contact_form_validate_postdata',1);
|
85 |
-
|
86 |
-
if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
|
87 |
-
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
88 |
-
//add_action('init','ct_contact_form_validate',1);
|
89 |
-
ct_contact_form_validate();
|
90 |
-
if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
|
91 |
-
{
|
92 |
-
unset($_POST['ct_checkjs_register_form']);
|
93 |
-
ct_contact_form_validate();
|
94 |
-
}
|
95 |
-
/*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
96 |
-
{
|
97 |
-
$tmp=$_POST['redirect_to'];
|
98 |
-
unset($_POST['redirect_to']);
|
99 |
-
ct_contact_form_validate();
|
100 |
-
$_POST['redirect_to']=$tmp;
|
101 |
-
}*/
|
102 |
-
}
|
103 |
-
|
104 |
-
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
105 |
-
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
106 |
-
|
107 |
-
//add_action('wp_footer','ct_ajaxurl');
|
108 |
-
|
109 |
-
// Fast Secure contact form
|
110 |
-
if(defined('FSCF_VERSION')){
|
111 |
-
add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
|
112 |
-
add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
|
113 |
-
}
|
114 |
-
|
115 |
-
// WooCommerce registration
|
116 |
-
if(class_exists('WooCommerce')){
|
117 |
-
if( $apbct->settings['wc_register_from_order'] == 1 ){
|
118 |
-
add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
// WooCommerce whishlist
|
123 |
-
if(class_exists('WC_Wishlists_Wishlist'))
|
124 |
-
add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
|
125 |
-
|
126 |
-
|
127 |
-
// JetPack Contact form
|
128 |
-
$jetpack_active_modules = false;
|
129 |
-
if(defined('JETPACK__VERSION'))
|
130 |
-
{
|
131 |
-
if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
|
132 |
-
if(JETPACK__VERSION=='3.4-beta')
|
133 |
-
{
|
134 |
-
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
135 |
-
}
|
136 |
-
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
137 |
-
{
|
138 |
-
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
|
139 |
-
}
|
140 |
-
else
|
141 |
-
{
|
142 |
-
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
143 |
-
}
|
144 |
-
$jetpack_active_modules = get_option('jetpack_active_modules');
|
145 |
-
if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
|
146 |
-
{
|
147 |
-
$ct_jp_comments = true;
|
148 |
-
}
|
149 |
-
}else
|
150 |
-
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
151 |
-
}
|
152 |
-
|
153 |
-
// WP Maintenance Mode (wpmm)
|
154 |
-
add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
|
155 |
-
|
156 |
-
// Contact Form7
|
157 |
-
if(defined('WPCF7_VERSION')){
|
158 |
-
add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
|
159 |
-
add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
|
160 |
-
add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
|
161 |
-
}
|
162 |
-
|
163 |
-
// Formidable
|
164 |
-
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
165 |
-
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
166 |
-
|
167 |
-
// BuddyPress
|
168 |
-
if(class_exists('BuddyPress')){
|
169 |
-
add_action('bp_before_registration_submit_buttons','ct_register_form',1);
|
170 |
-
add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
|
171 |
-
add_filter('bp_signup_validate', 'ct_registration_errors',1);
|
172 |
-
add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
|
173 |
-
}
|
174 |
-
|
175 |
-
if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
|
176 |
-
add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
|
177 |
-
}
|
178 |
-
|
179 |
-
|
180 |
-
// bbPress
|
181 |
-
if(class_exists('bbPress')){
|
182 |
-
add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
|
183 |
-
add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
|
184 |
-
add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
|
185 |
-
add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
|
186 |
-
add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
|
187 |
-
}
|
188 |
-
|
189 |
-
//Custom Contact Forms
|
190 |
-
if(defined('CCF_VERSION'))
|
191 |
-
add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
|
192 |
-
|
193 |
-
add_action('comment_form', 'ct_comment_form');
|
194 |
-
|
195 |
-
// intercept WordPress Landing Pages POST
|
196 |
-
if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
|
197 |
-
if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
|
198 |
-
ct_check_wplp();
|
199 |
-
}else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
|
200 |
-
ct_check_wplp();
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
// S2member. intercept POST
|
205 |
-
if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
|
206 |
-
$post_keys = array_keys($_POST);
|
207 |
-
foreach($post_keys as $post_key){
|
208 |
-
|
209 |
-
// Detect POST keys like /s2member_pro.*registration/
|
210 |
-
if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
|
211 |
-
ct_s2member_registration_test($post_key);
|
212 |
-
break;
|
213 |
-
}
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
// New user approve hack
|
218 |
-
// https://wordpress.org/plugins/new-user-approve/
|
219 |
-
if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
|
220 |
-
add_action('register_post', 'ct_register_post', 1, 3);
|
221 |
-
}
|
222 |
-
|
223 |
-
// Wilcity theme registration validation fix
|
224 |
-
add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
|
225 |
-
|
226 |
-
|
227 |
-
// Gravity forms
|
228 |
-
if (defined('GF_MIN_WP_VERSION')) {
|
229 |
-
add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
|
230 |
-
add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
|
231 |
-
add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
|
232 |
-
}
|
233 |
-
|
234 |
-
//Pirate forms
|
235 |
-
if(defined('PIRATE_FORMS_VERSION')){
|
236 |
-
if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
|
237 |
-
apbct_form__piratesForm__testSpam();
|
238 |
-
}
|
239 |
-
|
240 |
-
// WPForms
|
241 |
-
// Adding fields
|
242 |
-
add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
|
243 |
-
// Gathering data to validate
|
244 |
-
add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
|
245 |
-
// Do spam check
|
246 |
-
add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
|
247 |
-
|
248 |
-
// QForms integration
|
249 |
-
add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
|
250 |
-
|
251 |
-
// Ultimate Members
|
252 |
-
if (class_exists('UM')) {
|
253 |
-
add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
|
254 |
-
add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
|
255 |
-
}
|
256 |
-
|
257 |
-
//
|
258 |
-
// Load JS code to website footer
|
259 |
-
//
|
260 |
-
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
261 |
-
add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
|
262 |
-
add_action('wp_footer', 'apbct_hook__wp_footer', 1);
|
263 |
-
}
|
264 |
-
|
265 |
-
if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
|
266 |
-
ct_contact_form_validate();
|
267 |
-
}
|
268 |
-
|
269 |
-
if (apbct_is_user_enable()) {
|
270 |
-
|
271 |
-
if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
|
272 |
-
add_action( 'init', 'ct_contact_form_validate', 999 );
|
273 |
-
}
|
274 |
-
if(
|
275 |
-
$apbct->settings['general_postdata_test'] == 1 &&
|
276 |
-
!isset($_POST['ct_checkjs_cf7']) &&
|
277 |
-
!is_admin() &&
|
278 |
-
!apbct_is_user_role_in(array('administrator', 'moderator'))
|
279 |
-
){
|
280 |
-
ct_contact_form_validate_postdata();
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
function apbct_buffer__start(){
|
286 |
-
ob_start();
|
287 |
-
}
|
288 |
-
|
289 |
-
function apbct_buffer__end(){
|
290 |
-
|
291 |
-
if(!ob_get_level())
|
292 |
-
return;
|
293 |
-
|
294 |
-
global $apbct;
|
295 |
-
$apbct->buffer = ob_get_contents();
|
296 |
-
ob_end_clean();
|
297 |
-
}
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Outputs changed buffer
|
301 |
-
*
|
302 |
-
* @global $apbct
|
303 |
-
*/
|
304 |
-
function apbct_buffer__output(){
|
305 |
-
|
306 |
-
global $apbct;
|
307 |
-
|
308 |
-
if(empty($apbct->buffer))
|
309 |
-
return;
|
310 |
-
|
311 |
-
$site_url = get_option('siteurl');
|
312 |
-
$site__host = parse_url($site_url, PHP_URL_HOST);
|
313 |
-
|
314 |
-
$dom = new DOMDocument();
|
315 |
-
@$dom->loadHTML($apbct->buffer);
|
316 |
-
|
317 |
-
$forms = $dom->getElementsByTagName('form');
|
318 |
-
|
319 |
-
foreach($forms as $form){
|
320 |
-
|
321 |
-
$action = $form->getAttribute('action');
|
322 |
-
$action = $action ? $action : $site_url;
|
323 |
-
$action__host = parse_url($action, PHP_URL_HOST);
|
324 |
-
|
325 |
-
// Check if the form directed to the third party site
|
326 |
-
if($site__host != $action__host){
|
327 |
-
|
328 |
-
$method = $form->getAttribute('method');
|
329 |
-
$method = $method ? $method : 'get';
|
330 |
-
// Directs form to our site
|
331 |
-
$form->setAttribute('method', 'POST');
|
332 |
-
$form->setAttribute('action', $site_url);
|
333 |
-
|
334 |
-
// Add cleantalk_hidden_action
|
335 |
-
$new_input = $dom->createElement('input');
|
336 |
-
$new_input->setAttribute('type', 'hidden');
|
337 |
-
$new_input->setAttribute('name', 'cleantalk_hidden_action');
|
338 |
-
$new_input->setAttribute('value', $action);
|
339 |
-
$form->appendChild($new_input);
|
340 |
-
|
341 |
-
// Add cleantalk_hidden_method
|
342 |
-
$new_input = $dom->createElement('input');
|
343 |
-
$new_input->setAttribute('type', 'hidden');
|
344 |
-
$new_input->setAttribute('name', 'cleantalk_hidden_method');
|
345 |
-
$new_input->setAttribute('value', $method);
|
346 |
-
$form->appendChild($new_input);
|
347 |
-
|
348 |
-
}
|
349 |
-
} unset($form);
|
350 |
-
|
351 |
-
$html = $dom->getElementsByTagName('html');
|
352 |
-
|
353 |
-
echo gettype($html) == 'object' && !isset( $html[0], $html[0]->childNodes, $html[0]->childNodes[0] )
|
354 |
-
? $html[0]
|
355 |
-
->childNodes[0]
|
356 |
-
->ownerDocument
|
357 |
-
->saveHTML()
|
358 |
-
: $apbct->buffer;
|
359 |
-
}
|
360 |
-
|
361 |
-
// MailChimp Premium for Wordpress
|
362 |
-
function ct_add_mc4wp_error_message($messages){
|
363 |
-
|
364 |
-
$messages['ct_mc4wp_response'] = array(
|
365 |
-
'type' => 'error',
|
366 |
-
'text' => 'Your message looks like spam.'
|
367 |
-
);
|
368 |
-
return $messages;
|
369 |
-
}
|
370 |
-
add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
|
371 |
-
|
372 |
-
/*
|
373 |
-
* Function to set validate fucntion for CCF form
|
374 |
-
* Input - Сonsistently each form field
|
375 |
-
* Returns - String. Validate function
|
376 |
-
*/
|
377 |
-
function ct_ccf($callback, $value, $field_id, $type){
|
378 |
-
/*
|
379 |
-
if($type == 'name')
|
380 |
-
$ct_global_temporary_data['name'] = $value;
|
381 |
-
elseif($type == 'email')
|
382 |
-
$ct_global_temporary_data['email'] = $value;
|
383 |
-
else
|
384 |
-
$ct_global_temporary_data[] = $value;
|
385 |
-
//*/
|
386 |
-
return 'ct_validate_ccf_submission';
|
387 |
-
}
|
388 |
-
/*
|
389 |
-
* Validate function for CCF form. Gatheering data. Multiple calls.
|
390 |
-
* Input - void. Global $ct_global_temporary_data
|
391 |
-
* Returns - String. CleanTalk comment.
|
392 |
-
*/
|
393 |
-
$ct_global_temporary_data = array();
|
394 |
-
function ct_validate_ccf_submission($value, $field_id, $required){
|
395 |
-
global $ct_global_temporary_data, $apbct;
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
//If the check for contact forms enabled
|
400 |
-
if(!$apbct->settings['contact_forms_test'])
|
401 |
-
return true;
|
402 |
-
//If the check for logged in users enabled
|
403 |
-
if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in())
|
404 |
-
return true;
|
405 |
-
|
406 |
-
//Accumulate data
|
407 |
-
$ct_global_temporary_data[] = $value;
|
408 |
-
|
409 |
-
//If it's the last field of the form
|
410 |
-
(!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
|
411 |
-
$form_id = $_POST['form_id'];
|
412 |
-
if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true )))
|
413 |
-
return true;
|
414 |
-
unset($ct_global_temporary_data['count']);
|
415 |
-
|
416 |
-
//Getting request params
|
417 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
418 |
-
|
419 |
-
unset($ct_global_temporary_data);
|
420 |
-
|
421 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
422 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
423 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
424 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
425 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
426 |
-
|
427 |
-
if ($subject != '')
|
428 |
-
$message['subject'] = $subject;
|
429 |
-
|
430 |
-
$post_info['comment_type'] = 'feedback_custom_contact_forms';
|
431 |
-
$post_info['post_url'] =
|
432 |
-
|
433 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
434 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
435 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
436 |
-
|
437 |
-
//Making a call
|
438 |
-
$base_call_result = apbct_base_call(
|
439 |
-
array(
|
440 |
-
'message' => $message,
|
441 |
-
'sender_email' => $sender_email,
|
442 |
-
'sender_nickname' => $sender_nickname,
|
443 |
-
'post_info' => $post_info,
|
444 |
-
'js_on' => $checkjs,
|
445 |
-
'sender_info' => array('sender_url' => null),
|
446 |
-
)
|
447 |
-
);
|
448 |
-
|
449 |
-
$ct_result = $base_call_result['ct_result'];
|
450 |
-
|
451 |
-
return $ct_result->allow == 0 ? $ct_result->comment : true;;
|
452 |
-
}
|
453 |
-
|
454 |
-
function ct_woocommerce_wishlist_check($args){
|
455 |
-
global $apbct;
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
//Protect logged in users
|
460 |
-
if($args['wishlist_status'])
|
461 |
-
if($apbct->settings['protect_logged_in'] == 0)
|
462 |
-
return $args;
|
463 |
-
|
464 |
-
//If the IP is a Google bot
|
465 |
-
$hostname = gethostbyaddr(
|
466 |
-
if(!strpos($hostname, 'googlebot.com'))
|
467 |
-
return $args;
|
468 |
-
|
469 |
-
//Getting request params
|
470 |
-
$message = '';
|
471 |
-
$subject = '';
|
472 |
-
$email = $args['wishlist_owner_email'];
|
473 |
-
if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
|
474 |
-
$nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
|
475 |
-
else
|
476 |
-
$nickname = '';
|
477 |
-
|
478 |
-
$post_info['comment_type'] = 'feedback';
|
479 |
-
$post_info['post_url'] =
|
480 |
-
|
481 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
482 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
483 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
484 |
-
|
485 |
-
//Making a call
|
486 |
-
$base_call_result = apbct_base_call(
|
487 |
-
array(
|
488 |
-
'message' => $subject." ".$message,
|
489 |
-
'sender_email' => $email,
|
490 |
-
'sender_nickname' => $nickname,
|
491 |
-
'post_info' => $post_info,
|
492 |
-
'js_on' => $checkjs,
|
493 |
-
'sender_info' => array('sender_url' => null),
|
494 |
-
)
|
495 |
-
);
|
496 |
-
|
497 |
-
$ct_result = $base_call_result['ct_result'];
|
498 |
-
|
499 |
-
if ($ct_result->allow == 0)
|
500 |
-
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
501 |
-
else
|
502 |
-
return $args;
|
503 |
-
}
|
504 |
-
|
505 |
-
function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
|
506 |
-
global $apbct;
|
507 |
-
preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
|
508 |
-
$apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Test BuddyPress activity for spam (post update only)
|
513 |
-
*
|
514 |
-
* @global SpbcState $apbct
|
515 |
-
* @param bool $is_spam
|
516 |
-
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
517 |
-
* @return boolean Spam flag
|
518 |
-
*/
|
519 |
-
function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
|
520 |
-
|
521 |
-
global $apbct;
|
522 |
-
|
523 |
-
if($activity_obj === null || !isset($_POST['action']) || $_POST['action'] && $_POST['action'] !== 'post_update')
|
524 |
-
return;
|
525 |
-
|
526 |
-
$curr_user = get_user_by('id', $activity_obj->user_id);
|
527 |
-
|
528 |
-
//Making a call
|
529 |
-
$base_call_result = apbct_base_call(
|
530 |
-
array(
|
531 |
-
'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
|
532 |
-
'sender_email' => $curr_user->data->user_email,
|
533 |
-
'sender_nickname' => $curr_user->data->user_login,
|
534 |
-
'post_info' => array(
|
535 |
-
'post_url' => '
|
536 |
-
'comment_type' =>
|
537 |
-
),
|
538 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
539 |
-
'sender_info' => array('sender_url' => null),
|
540 |
-
)
|
541 |
-
);
|
542 |
-
|
543 |
-
$ct_result = $base_call_result['ct_result'];
|
544 |
-
|
545 |
-
if ($ct_result->allow == 0){
|
546 |
-
add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
|
547 |
-
$apbct->spam_notification = $ct_result->comment;
|
548 |
-
return true;
|
549 |
-
}else
|
550 |
-
return $is_spam;
|
551 |
-
}
|
552 |
-
|
553 |
-
/**
|
554 |
-
* Outputs message to AJAX frontend handler
|
555 |
-
*
|
556 |
-
* @global SpbcState $apbct
|
557 |
-
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
558 |
-
*/
|
559 |
-
function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
|
560 |
-
|
561 |
-
global $apbct;
|
562 |
-
|
563 |
-
// Legacy template
|
564 |
-
if($apbct->buddy_press_tmpl === 'bp-legacy'){
|
565 |
-
die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
|
566 |
-
// Nouveau tamplate and others
|
567 |
-
}else{
|
568 |
-
@header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
|
569 |
-
die(json_encode(array(
|
570 |
-
'success' => false,
|
571 |
-
'data' => array('message' => $apbct->spam_notification),
|
572 |
-
)));
|
573 |
-
}
|
574 |
-
}
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Public function - Tests new private messages (dialogs)
|
578 |
-
*
|
579 |
-
* @global SpbcState $apbct
|
580 |
-
* @param type $bp_message_obj
|
581 |
-
* @return array with errors if spam has found
|
582 |
-
*/
|
583 |
-
function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
|
584 |
-
|
585 |
-
global $apbct;
|
586 |
-
|
587 |
-
//Check for enabled option
|
588 |
-
if($apbct->settings['bp_private_messages'] == 0)
|
589 |
-
return;
|
590 |
-
|
591 |
-
//Check for quantity of comments
|
592 |
-
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
|
593 |
-
? CLEANTALK_CHECK_COMMENTS_NUMBER
|
594 |
-
: 3;
|
595 |
-
|
596 |
-
if($apbct->settings['check_comments_number']){
|
597 |
-
$args = array(
|
598 |
-
'user_id' => $bp_message_obj->sender_id,
|
599 |
-
'box' => 'sentbox',
|
600 |
-
'type' => 'all',
|
601 |
-
'limit' => $comments_check_number,
|
602 |
-
'page' => null,
|
603 |
-
'search_terms' => '',
|
604 |
-
'meta_query' => array()
|
605 |
-
);
|
606 |
-
$sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
607 |
-
$cnt_sentbox_msgs = $sentbox_msgs['total'];
|
608 |
-
$args['box'] = 'inbox';
|
609 |
-
$inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
610 |
-
$cnt_inbox_msgs = $inbox_msgs['total'];
|
611 |
-
|
612 |
-
if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
|
613 |
-
$is_max_comments = true;
|
614 |
-
}
|
615 |
-
|
616 |
-
if(!empty($is_max_comments))
|
617 |
-
return;
|
618 |
-
|
619 |
-
$sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
|
620 |
-
|
621 |
-
//Making a call
|
622 |
-
$base_call_result = apbct_base_call(
|
623 |
-
array(
|
624 |
-
'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
|
625 |
-
'sender_email' => $sender_user_obj->data->user_email,
|
626 |
-
'sender_nickname' => $sender_user_obj->data->user_login,
|
627 |
-
'post_info' => array(
|
628 |
-
'comment_type' => 'buddypress_comment',
|
629 |
-
'post_url' =>
|
630 |
-
),
|
631 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
|
632 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
633 |
-
: apbct_js_test('ct_checkjs', $_POST),
|
634 |
-
'sender_info' => array('sender_url' => null),
|
635 |
-
)
|
636 |
-
);
|
637 |
-
|
638 |
-
$ct_result = $base_call_result['ct_result'];
|
639 |
-
|
640 |
-
if ($ct_result->allow == 0)
|
641 |
-
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
642 |
-
}
|
643 |
-
|
644 |
-
/**
|
645 |
-
* Adds hiden filed to deafualt serach form
|
646 |
-
*
|
647 |
-
* @param $form string
|
648 |
-
* @return string
|
649 |
-
*/
|
650 |
-
function apbct_forms__search__addField( $form ){
|
651 |
-
global $apbct;
|
652 |
-
if($apbct->settings['search_test'] == 1){
|
653 |
-
$js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
|
654 |
-
$form = str_replace('</form>', $js_filed, $form);
|
655 |
-
}
|
656 |
-
return $form;
|
657 |
-
}
|
658 |
-
|
659 |
-
/**
|
660 |
-
* Test default search string for spam
|
661 |
-
*
|
662 |
-
* @param $search string
|
663 |
-
* @return string
|
664 |
-
*/
|
665 |
-
function apbct_forms__search__testSpam( $search ){
|
666 |
-
|
667 |
-
global $apbct, $cleantalk_executed;
|
668 |
-
|
669 |
-
if(
|
670 |
-
empty($search) ||
|
671 |
-
$cleantalk_executed ||
|
672 |
-
$apbct->settings['search_test'] == 0 ||
|
673 |
-
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
674 |
-
){
|
675 |
-
return $search;
|
676 |
-
}
|
677 |
-
|
678 |
-
if(apbct_is_user_logged_in())
|
679 |
-
$user = wp_get_current_user();
|
680 |
-
|
681 |
-
$base_call_result = apbct_base_call(
|
682 |
-
array(
|
683 |
-
'message' => $search,
|
684 |
-
'sender_email' => !empty($user) ? $user->user_email : null,
|
685 |
-
'sender_nickname' => !empty($user) ? $user->user_login : null,
|
686 |
-
'post_info' => array('comment_type' => 'site_search_wordpress'),
|
687 |
-
//'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
|
688 |
-
)
|
689 |
-
);
|
690 |
-
$ct_result = $base_call_result['ct_result'];
|
691 |
-
|
692 |
-
$cleantalk_executed = true;
|
693 |
-
|
694 |
-
if ($ct_result->allow == 0){
|
695 |
-
die($ct_result->comment);
|
696 |
-
}
|
697 |
-
|
698 |
-
return $search;
|
699 |
-
}
|
700 |
-
|
701 |
-
/**
|
702 |
-
* Public function - Tests for Pirate contact froms
|
703 |
-
* return NULL
|
704 |
-
*/
|
705 |
-
function apbct_form__piratesForm__testSpam(){
|
706 |
-
|
707 |
-
global $apbct;
|
708 |
-
|
709 |
-
//Check for enabled option
|
710 |
-
if( !$apbct->settings['contact_forms_test'])
|
711 |
-
return;
|
712 |
-
|
713 |
-
//Getting request params
|
714 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
715 |
-
|
716 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
717 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
718 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
719 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
720 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
721 |
-
|
722 |
-
if($subject != '')
|
723 |
-
$message = array_merge(array('subject' => $subject), $message);
|
724 |
-
|
725 |
-
$post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
|
726 |
-
$post_info['post_url'] =
|
727 |
-
|
728 |
-
//Making a call
|
729 |
-
$base_call_result = apbct_base_call(
|
730 |
-
array(
|
731 |
-
'message' => $message,
|
732 |
-
'sender_email' => $sender_email,
|
733 |
-
'sender_nickname' => $sender_nickname,
|
734 |
-
'post_info' => $post_info,
|
735 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
736 |
-
'sender_info' => array('sender_url' => null),
|
737 |
-
)
|
738 |
-
);
|
739 |
-
|
740 |
-
$ct_result = $base_call_result['ct_result'];
|
741 |
-
|
742 |
-
if ($ct_result->allow == 0)
|
743 |
-
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
744 |
-
}
|
745 |
-
|
746 |
-
/**
|
747 |
-
* Adds hidden filed to comment form
|
748 |
-
*/
|
749 |
-
function ct_comment_form($post_id){
|
750 |
-
|
751 |
-
global $apbct;
|
752 |
-
|
753 |
-
if (apbct_is_user_enable() === false) {
|
754 |
-
return false;
|
755 |
-
}
|
756 |
-
|
757 |
-
if ( !$apbct->settings['comments_test']) {
|
758 |
-
return false;
|
759 |
-
}
|
760 |
-
|
761 |
-
ct_add_hidden_fields('ct_checkjs', false, false);
|
762 |
-
|
763 |
-
return null;
|
764 |
-
}
|
765 |
-
|
766 |
-
/**
|
767 |
-
* Adds cookie script filed to head
|
768 |
-
*/
|
769 |
-
function apbct_hook__wp_head__set_cookie__ct_checkjs() {
|
770 |
-
|
771 |
-
ct_add_hidden_fields('ct_checkjs', false, true, true);
|
772 |
-
|
773 |
-
return null;
|
774 |
-
}
|
775 |
-
|
776 |
-
/**
|
777 |
-
* Adds cookie script filed to footer
|
778 |
-
*/
|
779 |
-
function apbct_hook__wp_footer() {
|
780 |
-
|
781 |
-
//ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
|
782 |
-
|
783 |
-
return null;
|
784 |
-
}
|
785 |
-
|
786 |
-
/**
|
787 |
-
* Adds hidden filed to define avaialbility of client's JavaScript
|
788 |
-
* @param bool $random_key switch on generation random key for every page load
|
789 |
-
*/
|
790 |
-
function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
|
791 |
-
|
792 |
-
global $ct_checkjs_def, $apbct;
|
793 |
-
|
794 |
-
$ct_checkjs_key = ct_get_checkjs_value();
|
795 |
-
$field_id_hash = md5(rand(0, 1000));
|
796 |
-
|
797 |
-
// Using only cookies
|
798 |
-
if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
|
799 |
-
|
800 |
-
$html = "<script type='text/javascript'>
|
801 |
-
function ctSetCookie(c_name, value, def_value){
|
802 |
-
document.cookie = c_name + '=' + escape(value) + '; path=/';
|
803 |
-
}
|
804 |
-
ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
|
805 |
-
</script>";
|
806 |
-
|
807 |
-
// Using AJAX to get key
|
808 |
-
}elseif($apbct->settings['use_ajax'] && $ajax){
|
809 |
-
|
810 |
-
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
811 |
-
if($no_print)
|
812 |
-
return;
|
813 |
-
|
814 |
-
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
815 |
-
$field_id = $field_name . '_' . $field_id_hash;
|
816 |
-
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
817 |
-
<script type='text/javascript'>
|
818 |
-
setTimeout(function(){
|
819 |
-
apbct_sendAJAXRequest(
|
820 |
-
{action: 'apbct_js_keys__get'},
|
821 |
-
{callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
|
822 |
-
);
|
823 |
-
}, 1000);
|
824 |
-
</script>";
|
825 |
-
|
826 |
-
// Set KEY from backend
|
827 |
-
}else{
|
828 |
-
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
829 |
-
if($no_print)
|
830 |
-
return;
|
831 |
-
|
832 |
-
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
833 |
-
$field_id = $field_name . '_' . $field_id_hash;
|
834 |
-
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
835 |
-
<script type='text/javascript'>
|
836 |
-
setTimeout(function(){
|
837 |
-
var ct_input_name = '{$field_id}';
|
838 |
-
if (document.getElementById(ct_input_name) !== null) {
|
839 |
-
var ct_input_value = document.getElementById(ct_input_name).value;
|
840 |
-
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
|
841 |
-
}
|
842 |
-
}, 1000);
|
843 |
-
</script>";
|
844 |
-
}
|
845 |
-
|
846 |
-
// Simplify JS code and Fixing issue with wpautop()
|
847 |
-
$html = str_replace(array("\n","\r","\t"),'', $html);
|
848 |
-
|
849 |
-
if ($return_string === true) {
|
850 |
-
return $html;
|
851 |
-
} else {
|
852 |
-
echo $html;
|
853 |
-
}
|
854 |
-
}
|
855 |
-
|
856 |
-
/**
|
857 |
-
* Public function - Insert JS code for spam tests
|
858 |
-
* return null;
|
859 |
-
*/
|
860 |
-
function apbct_rorm__formidable__footerScripts($fields, $form) {
|
861 |
-
|
862 |
-
global $apbct, $ct_checkjs_frm;
|
863 |
-
|
864 |
-
if ( !$apbct->settings['contact_forms_test'])
|
865 |
-
return false;
|
866 |
-
|
867 |
-
$ct_checkjs_key = ct_get_checkjs_value();
|
868 |
-
$ct_frm_base_name = 'form_';
|
869 |
-
$ct_frm_name = $ct_frm_base_name . $form->form_key;
|
870 |
-
|
871 |
-
echo "var input = document.createElement('input');
|
872 |
-
input.setAttribute('type', 'hidden');
|
873 |
-
input.setAttribute('name', '$ct_checkjs_frm');
|
874 |
-
input.setAttribute('value', '$ct_checkjs_key');
|
875 |
-
for (i = 0; i < document.forms.length; i++) {
|
876 |
-
if (typeof document.forms[i].id == 'string'){
|
877 |
-
if(document.forms[i].id.search('$ct_frm_name') != -1) {
|
878 |
-
document.forms[i].appendChild(input);
|
879 |
-
}
|
880 |
-
}
|
881 |
-
}";
|
882 |
-
|
883 |
-
/* Excessive cookie set
|
884 |
-
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
885 |
-
$js_code = strip_tags($js_code); // Removing <script> tag
|
886 |
-
echo $js_code;
|
887 |
-
//*/
|
888 |
-
}
|
889 |
-
|
890 |
-
/**
|
891 |
-
* Public function - Test Formidable data for spam activity
|
892 |
-
* @param $errors
|
893 |
-
* @param $form
|
894 |
-
*
|
895 |
-
* @return array with errors if spam has found
|
896 |
-
*/
|
897 |
-
function apbct_rorm__formidable__testSpam ( $errors, $form ) {
|
898 |
-
|
899 |
-
global $apbct;
|
900 |
-
|
901 |
-
if ( !$apbct->settings['contact_forms_test']) {
|
902 |
-
return $errors;
|
903 |
-
}
|
904 |
-
|
905 |
-
// Skip processing for logged in users.
|
906 |
-
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
|
907 |
-
return $errors;
|
908 |
-
}
|
909 |
-
|
910 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
|
911 |
-
|
912 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
913 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
914 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
915 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
916 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
917 |
-
|
918 |
-
// Adding 'input_meta[]' to every field /Formidable fix/
|
919 |
-
$message = array_flip($message);
|
920 |
-
foreach($message as &$value){
|
921 |
-
$value = 'item_meta['.$value.']';
|
922 |
-
} unset($value);
|
923 |
-
$message = array_flip($message);
|
924 |
-
|
925 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
926 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
927 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
928 |
-
|
929 |
-
$base_call_result = apbct_base_call(
|
930 |
-
array(
|
931 |
-
'message' => $message,
|
932 |
-
'sender_email' => $sender_email,
|
933 |
-
'sender_nickname' => $sender_nickname,
|
934 |
-
'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
|
935 |
-
'js_on' => $checkjs
|
936 |
-
)
|
937 |
-
);
|
938 |
-
$ct_result = $base_call_result['ct_result'];
|
939 |
-
|
940 |
-
if ($ct_result->allow == 0) {
|
941 |
-
$errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
|
942 |
-
}
|
943 |
-
|
944 |
-
return $errors;
|
945 |
-
}
|
946 |
-
|
947 |
-
/**
|
948 |
-
* Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
|
949 |
-
* @param mixed[] $comment Comment string
|
950 |
-
* @return mixed[] $comment Comment string
|
951 |
-
*/
|
952 |
-
function ct_bbp_get_topic($topic){
|
953 |
-
global $ct_bbp_topic;
|
954 |
-
|
955 |
-
$ct_bbp_topic=$topic;
|
956 |
-
|
957 |
-
return $topic;
|
958 |
-
}
|
959 |
-
|
960 |
-
/**
|
961 |
-
* Public filter 'bbp_*' - Checks topics, replies by cleantalk
|
962 |
-
* @param mixed[] $comment Comment string
|
963 |
-
* @return mixed[] $comment Comment string
|
964 |
-
*/
|
965 |
-
function ct_bbp_new_pre_content ($comment) {
|
966 |
-
|
967 |
-
global $apbct, $current_user;
|
968 |
-
|
969 |
-
if ( !$apbct->settings['comments_test']) {
|
970 |
-
return $comment;
|
971 |
-
}
|
972 |
-
|
973 |
-
// Skip processing for logged in users and admin.
|
974 |
-
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
|
975 |
-
in_array("administrator", $current_user->roles))
|
976 |
-
return $comment;
|
977 |
-
|
978 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
979 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
980 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
981 |
-
|
982 |
-
$post_info['comment_type'] = 'bbpress_comment';
|
983 |
-
$post_info['post_url'] = bbp_get_topic_permalink();
|
984 |
-
|
985 |
-
if( is_user_logged_in() ) {
|
986 |
-
$sender_email = $current_user->user_email;
|
987 |
-
$sender_nickname = $current_user->display_name;
|
988 |
-
} else {
|
989 |
-
$sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
|
990 |
-
$sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
|
991 |
-
}
|
992 |
-
|
993 |
-
$base_call_result = apbct_base_call(
|
994 |
-
array(
|
995 |
-
'message' => $comment,
|
996 |
-
'sender_email' => $sender_email,
|
997 |
-
'sender_nickname' => $sender_nickname,
|
998 |
-
'post_info' => $post_info,
|
999 |
-
'js_on' => $checkjs,
|
1000 |
-
'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
|
1001 |
-
)
|
1002 |
-
);
|
1003 |
-
$ct_result = $base_call_result['ct_result'];
|
1004 |
-
|
1005 |
-
if ($ct_result->allow == 0) {
|
1006 |
-
bbp_add_error('bbp_reply_content', $ct_result->comment);
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
return $comment;
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
function apbct_comment__sanitize_data__before_wp_die($function){
|
1013 |
-
|
1014 |
-
global $apbct;
|
1015 |
-
|
1016 |
-
$comment_data = wp_unslash($_POST);
|
1017 |
-
|
1018 |
-
$user_ID = 0;
|
1019 |
-
|
1020 |
-
$comment_type = '';
|
1021 |
-
|
1022 |
-
$comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
|
1023 |
-
$comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
|
1024 |
-
|
1025 |
-
$comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
|
1026 |
-
$comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
|
1027 |
-
$comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
|
1028 |
-
$comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
|
1029 |
-
|
1030 |
-
if(isset($comment_content, $comment_parent)){
|
1031 |
-
|
1032 |
-
$user = wp_get_current_user();
|
1033 |
-
|
1034 |
-
if($user->exists()){
|
1035 |
-
$comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
|
1036 |
-
$comment_author_email = $user->user_email;
|
1037 |
-
$comment_author_url = $user->user_url;
|
1038 |
-
$user_ID = $user->ID;
|
1039 |
-
}
|
1040 |
-
|
1041 |
-
$apbct->comment_data = compact(
|
1042 |
-
'comment_post_ID',
|
1043 |
-
'comment_author',
|
1044 |
-
'comment_author_email',
|
1045 |
-
'comment_author_url',
|
1046 |
-
'comment_content',
|
1047 |
-
'comment_type',
|
1048 |
-
'comment_parent',
|
1049 |
-
'user_ID'
|
1050 |
-
);
|
1051 |
-
|
1052 |
-
$function = 'apbct_comment__check_via_wp_die';
|
1053 |
-
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
return $function;
|
1057 |
-
}
|
1058 |
-
|
1059 |
-
function apbct_comment__check_via_wp_die($message, $title, $args){
|
1060 |
-
if($title == __('Comment Submission Failure')){
|
1061 |
-
global $apbct;
|
1062 |
-
$apbct->validation_error = $message;
|
1063 |
-
ct_preprocess_comment($apbct->comment_data);
|
1064 |
-
}
|
1065 |
-
_default_wp_die_handler($message, $title, $args);
|
1066 |
-
}
|
1067 |
-
|
1068 |
-
/**
|
1069 |
-
* Public filter 'preprocess_comment' - Checks comment by cleantalk server
|
1070 |
-
* @param mixed[] $comment Comment data array
|
1071 |
-
* @return mixed[] New data array of comment
|
1072 |
-
*/
|
1073 |
-
function ct_preprocess_comment($comment) {
|
1074 |
-
// this action is called just when WP process POST request (adds new comment)
|
1075 |
-
// this action is called by wp-comments-post.php
|
1076 |
-
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
1077 |
-
global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
|
1078 |
-
|
1079 |
-
// Send email notification for chosen groups of users
|
1080 |
-
if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
|
1081 |
-
|
1082 |
-
add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
|
1083 |
-
|
1084 |
-
$users = get_users(array(
|
1085 |
-
'role__in' => $apbct->settings['comment_notify__roles'],
|
1086 |
-
'fileds' => array('user_email')
|
1087 |
-
));
|
1088 |
-
|
1089 |
-
if($users){
|
1090 |
-
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
|
1091 |
-
add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
|
1092 |
-
foreach($users as $user){
|
1093 |
-
$emails[] = $user->user_email;
|
1094 |
-
}
|
1095 |
-
$apbct->comment_notification_recipients = json_encode($emails);
|
1096 |
-
}
|
1097 |
-
}
|
1098 |
-
|
1099 |
-
// Skip processing admin.
|
1100 |
-
if (in_array("administrator", $current_user->roles))
|
1101 |
-
return $comment;
|
1102 |
-
|
1103 |
-
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
|
1104 |
-
|
1105 |
-
if($apbct->settings['check_comments_number']){
|
1106 |
-
$args = array(
|
1107 |
-
'author_email' => $comment['comment_author_email'],
|
1108 |
-
'status' => 'approve',
|
1109 |
-
'count' => false,
|
1110 |
-
'number' => $comments_check_number,
|
1111 |
-
);
|
1112 |
-
$cnt = count(get_comments($args));
|
1113 |
-
$is_max_comments = $cnt >= $comments_check_number ? true : false;
|
1114 |
-
}
|
1115 |
-
|
1116 |
-
if (
|
1117 |
-
($comment['comment_type']!='trackback') &&
|
1118 |
-
(
|
1119 |
-
apbct_is_user_enable() === false ||
|
1120 |
-
$apbct->settings['comments_test'] == 0 ||
|
1121 |
-
$ct_comment_done ||
|
1122 |
-
(
|
1123 |
-
(isset($is_max_comments) && $is_max_comments) ||
|
1124 |
-
strpos(
|
1125 |
-
)
|
1126 |
-
{
|
1127 |
-
return $comment;
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
$local_blacklists = wp_blacklist_check(
|
1131 |
-
$comment['comment_author'],
|
1132 |
-
$comment['comment_author_email'],
|
1133 |
-
$comment['comment_author_url'],
|
1134 |
-
$comment['comment_content'],
|
1135 |
-
|
1136 |
-
|
1137 |
-
);
|
1138 |
-
|
1139 |
-
// Go out if author in local blacklists
|
1140 |
-
if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
|
1141 |
-
return $comment;
|
1142 |
-
}
|
1143 |
-
|
1144 |
-
// Skip pingback anti-spam test
|
1145 |
-
/*if ($comment['comment_type'] == 'pingback') {
|
1146 |
-
return $comment;
|
1147 |
-
}*/
|
1148 |
-
|
1149 |
-
$ct_comment_done = true;
|
1150 |
-
|
1151 |
-
$comment_post_id = $comment['comment_post_ID'];
|
1152 |
-
|
1153 |
-
// JetPack comments logic
|
1154 |
-
$post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
|
1155 |
-
$post_info['post_url'] = ct_post_url(null, $comment_post_id);
|
1156 |
-
|
1157 |
-
// Comment type
|
1158 |
-
$post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
|
1159 |
-
|
1160 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1161 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1162 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
1163 |
-
|
1164 |
-
|
1165 |
-
$example = null;
|
1166 |
-
if ($apbct->data['relevance_test']) {
|
1167 |
-
$post = get_post($comment_post_id);
|
1168 |
-
if ($post !== null){
|
1169 |
-
$example['title'] = $post->post_title;
|
1170 |
-
$example['body'] = $post->post_content;
|
1171 |
-
$example['comments'] = null;
|
1172 |
-
|
1173 |
-
$last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
|
1174 |
-
foreach ($last_comments as $post_comment){
|
1175 |
-
$example['comments'] .= "\n\n" . $post_comment->comment_content;
|
1176 |
-
}
|
1177 |
-
|
1178 |
-
$example = json_encode($example);
|
1179 |
-
}
|
1180 |
-
|
1181 |
-
// Use plain string format if've failed with JSON
|
1182 |
-
if ($example === false || $example === null){
|
1183 |
-
$example = ($post->post_title !== null) ? $post->post_title : '';
|
1184 |
-
$example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
|
1185 |
-
}
|
1186 |
-
}
|
1187 |
-
|
1188 |
-
$base_call_result = apbct_base_call(
|
1189 |
-
array(
|
1190 |
-
'message' => $comment['comment_content'],
|
1191 |
-
'example' => $example,
|
1192 |
-
'sender_email' => $comment['comment_author_email'],
|
1193 |
-
'sender_nickname' => $comment['comment_author'],
|
1194 |
-
'post_info' => $post_info,
|
1195 |
-
'js_on' => $checkjs,
|
1196 |
-
'sender_info' => array(
|
1197 |
-
'sender_url' => @$comment['comment_author_url'],
|
1198 |
-
'form_validation' => !isset($apbct->validation_error)
|
1199 |
-
? null
|
1200 |
-
: json_encode(array(
|
1201 |
-
'validation_notice' => $apbct->validation_error,
|
1202 |
-
'page_url' => filter_input(INPUT_SERVER, 'HTTP_HOST') . filter_input(INPUT_SERVER, 'REQUEST_URI'),
|
1203 |
-
))
|
1204 |
-
),
|
1205 |
-
)
|
1206 |
-
);
|
1207 |
-
$ct_result = $base_call_result['ct_result'];
|
1208 |
-
|
1209 |
-
ct_hash($ct_result->id);
|
1210 |
-
|
1211 |
-
//Don't check trusted users
|
1212 |
-
if (isset($comment['comment_author_email'])){
|
1213 |
-
$approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
|
1214 |
-
$new_user = $approved_comments == 0 ? true : false;
|
1215 |
-
}
|
1216 |
-
|
1217 |
-
// Change comment flow only for new authors
|
1218 |
-
if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
|
1219 |
-
add_action('comment_post', 'ct_set_meta', 10, 2);
|
1220 |
-
|
1221 |
-
if($ct_result->allow){ // Pass if allowed
|
1222 |
-
if(get_option('comment_moderation') === '1') // Wordpress moderation flag
|
1223 |
-
add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
|
1224 |
-
else
|
1225 |
-
add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
|
1226 |
-
}else{
|
1227 |
-
|
1228 |
-
global $ct_comment, $ct_stop_words;
|
1229 |
-
|
1230 |
-
$ct_comment = $ct_result->comment;
|
1231 |
-
$ct_stop_words = $ct_result->stop_words;
|
1232 |
-
|
1233 |
-
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
|
1234 |
-
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1235 |
-
|
1236 |
-
// Terminate. Definitely spam.
|
1237 |
-
if($ct_result->stop_queue == 1)
|
1238 |
-
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1239 |
-
|
1240 |
-
// Terminate by user's setting.
|
1241 |
-
if($ct_result->spam == 3)
|
1242 |
-
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1243 |
-
|
1244 |
-
// Trash comment.
|
1245 |
-
if($ct_result->spam == 2){
|
1246 |
-
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1247 |
-
add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
|
1248 |
-
}
|
1249 |
-
|
1250 |
-
// Spam comment
|
1251 |
-
if($ct_result->spam == 1)
|
1252 |
-
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1253 |
-
|
1254 |
-
// Move to pending folder. Contains stop_words.
|
1255 |
-
if($ct_result->stop_words){
|
1256 |
-
add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
|
1257 |
-
add_action('comment_post', 'ct_mark_red', 998, 2);
|
1258 |
-
}
|
1259 |
-
|
1260 |
-
add_action('comment_post', 'ct_die', 999, 2);
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
if($apbct->settings['remove_comments_links'] == 1){
|
1264 |
-
$comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
// Change mail notification if license is out of date
|
1268 |
-
if($apbct->data['moderate'] == 0){
|
1269 |
-
$apbct->sender_email = $comment['comment_author_email'];
|
1270 |
-
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
1271 |
-
add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
|
1272 |
-
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
|
1273 |
-
}
|
1274 |
-
|
1275 |
-
return $comment;
|
1276 |
-
}
|
1277 |
-
|
1278 |
-
/**
|
1279 |
-
* Changes whether notify admin/athor or not.
|
1280 |
-
*
|
1281 |
-
* @param bool $maybe_notify notify flag
|
1282 |
-
* @param int $comment_ID Comment id
|
1283 |
-
* @return bool flag
|
1284 |
-
*/
|
1285 |
-
function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
|
1286 |
-
return true;
|
1287 |
-
}
|
1288 |
-
|
1289 |
-
/**
|
1290 |
-
* Add notification setting link
|
1291 |
-
*
|
1292 |
-
* @param string $notify_message
|
1293 |
-
* @param integer $comment_id
|
1294 |
-
*
|
1295 |
-
* @return string
|
1296 |
-
*/
|
1297 |
-
function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
|
1298 |
-
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
1299 |
-
return $notify_message
|
1300 |
-
.PHP_EOL
|
1301 |
-
.'---'.PHP_EOL
|
1302 |
-
.'Manage notifications settings: http://'.$website.'/wp-admin/options-general.php?page=cleantalk';
|
1303 |
-
}
|
1304 |
-
|
1305 |
-
/**
|
1306 |
-
* Change email notification recipients
|
1307 |
-
*
|
1308 |
-
* @param array $emails
|
1309 |
-
* @param integer $comment_id
|
1310 |
-
*
|
1311 |
-
* @return array
|
1312 |
-
* @global SpbcState $apbct
|
1313 |
-
*/
|
1314 |
-
function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
|
1315 |
-
global $apbct;
|
1316 |
-
return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
/**
|
1320 |
-
* Changes email notification for spam comment for native Wordpress comment system
|
1321 |
-
*
|
1322 |
-
* @param string $notify_message Body of email notification
|
1323 |
-
* @param int $comment_id Comment id
|
1324 |
-
* @return string Body for email notification
|
1325 |
-
*/
|
1326 |
-
function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
|
1327 |
-
|
1328 |
-
global $apbct;
|
1329 |
-
|
1330 |
-
$notify_message =
|
1331 |
-
PHP_EOL
|
1332 |
-
.__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk')
|
1333 |
-
."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
|
1334 |
-
."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
|
1335 |
-
."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
|
1336 |
-
."\n".PHP_EOL . sprintf(
|
1337 |
-
__('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
|
1338 |
-
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
|
1339 |
-
.($apbct->data['user_token']
|
1340 |
-
? '&iser_token='.$apbct->data['user_token']
|
1341 |
-
: ''
|
1342 |
-
)
|
1343 |
-
)
|
1344 |
-
.PHP_EOL . '---'
|
1345 |
-
.PHP_EOL
|
1346 |
-
.PHP_EOL
|
1347 |
-
.$notify_message;
|
1348 |
-
|
1349 |
-
return $notify_message;
|
1350 |
-
|
1351 |
-
}
|
1352 |
-
|
1353 |
-
/**
|
1354 |
-
* Set die page with Cleantalk comment.
|
1355 |
-
* @global array $ct_comment
|
1356 |
-
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1357 |
-
* @param type $comment_status
|
1358 |
-
*/
|
1359 |
-
function ct_die($comment_id, $comment_status) {
|
1360 |
-
global $ct_comment;
|
1361 |
-
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1362 |
-
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1363 |
-
if(isset($_POST['et_pb_contact_email']))
|
1364 |
-
{
|
1365 |
-
$mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
|
1366 |
-
wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
|
1367 |
-
}
|
1368 |
-
else
|
1369 |
-
{
|
1370 |
-
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1371 |
-
}
|
1372 |
-
}
|
1373 |
-
|
1374 |
-
/**
|
1375 |
-
* Set die page with Cleantalk comment from parameter.
|
1376 |
-
* @param type $comment_body
|
1377 |
-
*/
|
1378 |
-
function ct_die_extended($comment_body) {
|
1379 |
-
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
|
1380 |
-
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1381 |
-
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1382 |
-
}
|
1383 |
-
|
1384 |
-
/**
|
1385 |
-
* Validates JavaScript anti-spam test
|
1386 |
-
*
|
1387 |
-
* @param string $field_name filed to serach in data
|
1388 |
-
* @param null $data Data to search in
|
1389 |
-
* @param bool $random_key
|
1390 |
-
*
|
1391 |
-
* @return int|null
|
1392 |
-
*/
|
1393 |
-
function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
|
1394 |
-
|
1395 |
-
global $apbct;
|
1396 |
-
|
1397 |
-
$out = null;
|
1398 |
-
|
1399 |
-
if($data && isset($data[$field_name])){
|
1400 |
-
|
1401 |
-
$js_key = trim($data[$field_name]);
|
1402 |
-
|
1403 |
-
// Check static key
|
1404 |
-
if(
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
$out =
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
}
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
$
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
$
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
}
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
}
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
}
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
$
|
1607 |
-
|
1608 |
-
$
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
}
|
1615 |
-
|
1616 |
-
$errors['errors']
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
'
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
'
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
*
|
1703 |
-
*
|
1704 |
-
* @
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
if (
|
1716 |
-
return $errors;
|
1717 |
-
}
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
if ($
|
1731 |
-
|
1732 |
-
|
1733 |
-
}
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
if ($
|
1742 |
-
$
|
1743 |
-
$buddypress = true;
|
1744 |
-
}
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
$checkjs_post =
|
1764 |
-
$checkjs_cookie =
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
}
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
}
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
*
|
1842 |
-
*
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
.
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
*
|
1875 |
-
*
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
$
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
$
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
'
|
2019 |
-
'
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
$
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
'
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
*
|
2098 |
-
*
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
}
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
$
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
$
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
$
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
'
|
2155 |
-
'
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
.PHP_EOL .
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
'
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
$
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
$
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
.PHP_EOL
|
2390 |
-
.
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
*
|
2420 |
-
*
|
2421 |
-
* @
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
2433 |
-
|
2434 |
-
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
*
|
2445 |
-
*
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
|
2450 |
-
|
2451 |
-
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
*
|
2471 |
-
*
|
2472 |
-
*
|
2473 |
-
*
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
$
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
'
|
2505 |
-
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
}
|
2525 |
-
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
|
2531 |
-
*
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
$
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
.PHP_EOL
|
2545 |
-
.
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
$
|
2574 |
-
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
}
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
if ($
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
$
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
'
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
}
|
2672 |
-
|
2673 |
-
|
2674 |
-
|
2675 |
-
|
2676 |
-
|
2677 |
-
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
$
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
$
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
$
|
2706 |
-
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
-
|
2727 |
-
|
2728 |
-
|
2729 |
-
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
|
2743 |
-
|
2744 |
-
|
2745 |
-
|
2746 |
-
|
2747 |
-
|
2748 |
-
|
2749 |
-
$
|
2750 |
-
|
2751 |
-
// Adding
|
2752 |
-
|
2753 |
-
|
2754 |
-
|
2755 |
-
|
2756 |
-
|
2757 |
-
|
2758 |
-
|
2759 |
-
|
2760 |
-
|
2761 |
-
|
2762 |
-
|
2763 |
-
|
2764 |
-
|
2765 |
-
|
2766 |
-
|
2767 |
-
|
2768 |
-
|
2769 |
-
|
2770 |
-
|
2771 |
-
|
2772 |
-
|
2773 |
-
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
-
|
2778 |
-
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
$
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
-
$message = array_flip($message);
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
|
2802 |
-
|
2803 |
-
|
2804 |
-
|
2805 |
-
|
2806 |
-
'
|
2807 |
-
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
|
2817 |
-
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
|
2831 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
|
2846 |
-
|
2847 |
-
$
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
(
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
$
|
2893 |
-
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
2907 |
-
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
|
2921 |
-
|
2922 |
-
|
2923 |
-
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
2928 |
-
|
2929 |
-
|
2930 |
-
|
2931 |
-
|
2932 |
-
|
2933 |
-
|
2934 |
-
|
2935 |
-
|
2936 |
-
|
2937 |
-
|
2938 |
-
|
2939 |
-
|
2940 |
-
|
2941 |
-
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
|
2946 |
-
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
-
|
2975 |
-
|
2976 |
-
|
2977 |
-
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
)
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
-
|
3001 |
-
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
|
3027 |
-
|
3028 |
-
|
3029 |
-
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
-
|
3037 |
-
|
3038 |
-
|
3039 |
-
|
3040 |
-
|
3041 |
-
|
3042 |
-
|
3043 |
-
|
3044 |
-
|
3045 |
-
|
3046 |
-
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
-
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
);
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
3073 |
-
|
3074 |
-
|
3075 |
-
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
-
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
3099 |
-
|
3100 |
-
|
3101 |
-
|
3102 |
-
|
3103 |
-
|
3104 |
-
|
3105 |
-
|
3106 |
-
|
3107 |
-
|
3108 |
-
|
3109 |
-
|
3110 |
-
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
|
3126 |
-
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
3130 |
-
|
3131 |
-
|
3132 |
-
|
3133 |
-
|
3134 |
-
|
3135 |
-
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
3140 |
-
|
3141 |
-
|
3142 |
-
|
3143 |
-
|
3144 |
-
|
3145 |
-
|
3146 |
-
|
3147 |
-
|
3148 |
-
|
3149 |
-
|
3150 |
-
|
3151 |
-
|
3152 |
-
|
3153 |
-
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
$
|
3158 |
-
|
3159 |
-
|
3160 |
-
|
3161 |
-
|
3162 |
-
|
3163 |
-
|
3164 |
-
|
3165 |
-
|
3166 |
-
|
3167 |
-
|
3168 |
-
|
3169 |
-
|
3170 |
-
|
3171 |
-
|
3172 |
-
|
3173 |
-
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
-
|
3191 |
-
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
3196 |
-
|
3197 |
-
|
3198 |
-
|
3199 |
-
|
3200 |
-
return
|
3201 |
-
}
|
3202 |
-
|
3203 |
-
|
3204 |
-
|
3205 |
-
|
3206 |
-
|
3207 |
-
|
3208 |
-
|
3209 |
-
|
3210 |
-
|
3211 |
-
|
3212 |
-
|
3213 |
-
|
3214 |
-
|
3215 |
-
|
3216 |
-
|
3217 |
-
|
3218 |
-
|
3219 |
-
|
3220 |
-
|
3221 |
-
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
3228 |
-
|
3229 |
-
|
3230 |
-
|
3231 |
-
|
3232 |
-
|
3233 |
-
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
3239 |
-
|
3240 |
-
|
3241 |
-
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
3286 |
-
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
3293 |
-
|
3294 |
-
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
|
3299 |
-
|
3300 |
-
|
3301 |
-
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
-
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
|
3330 |
-
|
3331 |
-
|
3332 |
-
'
|
3333 |
-
|
3334 |
-
|
3335 |
-
|
3336 |
-
}
|
3337 |
-
|
3338 |
-
|
3339 |
-
|
3340 |
-
|
3341 |
-
|
3342 |
-
|
3343 |
-
|
3344 |
-
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
-
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
|
3358 |
-
|
3359 |
-
|
3360 |
-
|
3361 |
-
|
3362 |
-
|
3363 |
-
|
3364 |
-
|
3365 |
-
|
3366 |
-
|
3367 |
-
|
3368 |
-
|
3369 |
-
|
3370 |
-
|
3371 |
-
|
3372 |
-
if($
|
3373 |
-
|
3374 |
-
|
3375 |
-
|
3376 |
-
.
|
3377 |
-
|
3378 |
-
|
3379 |
-
|
3380 |
-
|
3381 |
-
|
3382 |
-
|
3383 |
-
|
3384 |
-
|
3385 |
-
|
3386 |
-
|
3387 |
-
|
3388 |
-
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
|
3402 |
-
|
3403 |
-
|
3404 |
-
|
3405 |
-
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
|
3412 |
-
$
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
3418 |
-
|
3419 |
-
|
3420 |
-
$
|
3421 |
-
|
3422 |
-
|
3423 |
-
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
3429 |
-
|
3430 |
-
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
|
3437 |
-
|
3438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Init functions
|
5 |
+
* @return mixed[] Array of options
|
6 |
+
*/
|
7 |
+
function apbct_init() {
|
8 |
+
|
9 |
+
global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $apbct, $test_external_forms, $cleantalk_executed, $wpdb;
|
10 |
+
|
11 |
+
//Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
|
12 |
+
if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
|
13 |
+
$apbct->settings['check_internal']
|
14 |
+
){
|
15 |
+
$ct_result = ct_contact_form_validate();
|
16 |
+
if($ct_result == null){
|
17 |
+
echo 'true';
|
18 |
+
die();
|
19 |
+
}else{
|
20 |
+
echo $ct_result;
|
21 |
+
die();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
//fix for EPM registration form
|
26 |
+
if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
|
27 |
+
{
|
28 |
+
unset($_POST['ct_checkjs_register_form']);
|
29 |
+
}
|
30 |
+
|
31 |
+
if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
|
32 |
+
{
|
33 |
+
add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
|
34 |
+
}
|
35 |
+
|
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);
|
43 |
+
}
|
44 |
+
|
45 |
+
// Check and redirecct
|
46 |
+
if(filter_input(INPUT_SERVER, 'REQUEST_METHOD') == 'POST'
|
47 |
+
&& isset($_POST['cleantalk_hidden_method'])
|
48 |
+
&& isset($_POST['cleantalk_hidden_action'])
|
49 |
+
){
|
50 |
+
$action = htmlspecialchars($_POST['cleantalk_hidden_action']);
|
51 |
+
$method = htmlspecialchars($_POST['cleantalk_hidden_method']);
|
52 |
+
unset($_POST['cleantalk_hidden_action']);
|
53 |
+
unset($_POST['cleantalk_hidden_method']);
|
54 |
+
ct_contact_form_validate();
|
55 |
+
if(!apbct_is_ajax()){
|
56 |
+
print "<html><body><form method='$method' action='$action'>";
|
57 |
+
ct_print_form($_POST, '');
|
58 |
+
print "</form></body></html>";
|
59 |
+
print "<script>
|
60 |
+
if(document.forms[0].submit !== 'undefined'){
|
61 |
+
var objects = document.getElementsByName('submit');
|
62 |
+
if(objects.length > 0)
|
63 |
+
document.forms[0].removeChild(objects[0]);
|
64 |
+
}
|
65 |
+
document.forms[0].submit();
|
66 |
+
</script>";
|
67 |
+
die();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
|
73 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
74 |
+
ct_ajax_hook();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**hooks for cm answers pro */
|
78 |
+
if(defined('CMA_PLUGIN_FILE')){
|
79 |
+
add_action( 'wp', 'ct_ajax_hook',1 );
|
80 |
+
}
|
81 |
+
|
82 |
+
//hook for Anonymous Post
|
83 |
+
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
84 |
+
add_action('wp', 'ct_contact_form_validate_postdata',1);
|
85 |
+
|
86 |
+
if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
|
87 |
+
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
88 |
+
//add_action('init','ct_contact_form_validate',1);
|
89 |
+
ct_contact_form_validate();
|
90 |
+
if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
|
91 |
+
{
|
92 |
+
unset($_POST['ct_checkjs_register_form']);
|
93 |
+
ct_contact_form_validate();
|
94 |
+
}
|
95 |
+
/*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
96 |
+
{
|
97 |
+
$tmp=$_POST['redirect_to'];
|
98 |
+
unset($_POST['redirect_to']);
|
99 |
+
ct_contact_form_validate();
|
100 |
+
$_POST['redirect_to']=$tmp;
|
101 |
+
}*/
|
102 |
+
}
|
103 |
+
|
104 |
+
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
105 |
+
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
106 |
+
|
107 |
+
//add_action('wp_footer','ct_ajaxurl');
|
108 |
+
|
109 |
+
// Fast Secure contact form
|
110 |
+
if(defined('FSCF_VERSION')){
|
111 |
+
add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
|
112 |
+
add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
|
113 |
+
}
|
114 |
+
|
115 |
+
// WooCommerce registration
|
116 |
+
if(class_exists('WooCommerce')){
|
117 |
+
if( $apbct->settings['wc_register_from_order'] == 1 ){
|
118 |
+
add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
// WooCommerce whishlist
|
123 |
+
if(class_exists('WC_Wishlists_Wishlist'))
|
124 |
+
add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
|
125 |
+
|
126 |
+
|
127 |
+
// JetPack Contact form
|
128 |
+
$jetpack_active_modules = false;
|
129 |
+
if(defined('JETPACK__VERSION'))
|
130 |
+
{
|
131 |
+
if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
|
132 |
+
if(JETPACK__VERSION=='3.4-beta')
|
133 |
+
{
|
134 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
135 |
+
}
|
136 |
+
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
137 |
+
{
|
138 |
+
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
|
139 |
+
}
|
140 |
+
else
|
141 |
+
{
|
142 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
143 |
+
}
|
144 |
+
$jetpack_active_modules = get_option('jetpack_active_modules');
|
145 |
+
if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
|
146 |
+
{
|
147 |
+
$ct_jp_comments = true;
|
148 |
+
}
|
149 |
+
}else
|
150 |
+
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
151 |
+
}
|
152 |
+
|
153 |
+
// WP Maintenance Mode (wpmm)
|
154 |
+
add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
|
155 |
+
|
156 |
+
// Contact Form7
|
157 |
+
if(defined('WPCF7_VERSION')){
|
158 |
+
add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
|
159 |
+
add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
|
160 |
+
add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
|
161 |
+
}
|
162 |
+
|
163 |
+
// Formidable
|
164 |
+
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
165 |
+
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
166 |
+
|
167 |
+
// BuddyPress
|
168 |
+
if(class_exists('BuddyPress')){
|
169 |
+
add_action('bp_before_registration_submit_buttons','ct_register_form',1);
|
170 |
+
add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
|
171 |
+
add_filter('bp_signup_validate', 'ct_registration_errors',1);
|
172 |
+
add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
|
173 |
+
}
|
174 |
+
|
175 |
+
if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
|
176 |
+
add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
|
177 |
+
}
|
178 |
+
|
179 |
+
|
180 |
+
// bbPress
|
181 |
+
if(class_exists('bbPress')){
|
182 |
+
add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
|
183 |
+
add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
|
184 |
+
add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
|
185 |
+
add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
|
186 |
+
add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
|
187 |
+
}
|
188 |
+
|
189 |
+
//Custom Contact Forms
|
190 |
+
if(defined('CCF_VERSION'))
|
191 |
+
add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
|
192 |
+
|
193 |
+
add_action('comment_form', 'ct_comment_form');
|
194 |
+
|
195 |
+
// intercept WordPress Landing Pages POST
|
196 |
+
if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
|
197 |
+
if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
|
198 |
+
ct_check_wplp();
|
199 |
+
}else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
|
200 |
+
ct_check_wplp();
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
// S2member. intercept POST
|
205 |
+
if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
|
206 |
+
$post_keys = array_keys($_POST);
|
207 |
+
foreach($post_keys as $post_key){
|
208 |
+
|
209 |
+
// Detect POST keys like /s2member_pro.*registration/
|
210 |
+
if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
|
211 |
+
ct_s2member_registration_test($post_key);
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
// New user approve hack
|
218 |
+
// https://wordpress.org/plugins/new-user-approve/
|
219 |
+
if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
|
220 |
+
add_action('register_post', 'ct_register_post', 1, 3);
|
221 |
+
}
|
222 |
+
|
223 |
+
// Wilcity theme registration validation fix
|
224 |
+
add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
|
225 |
+
|
226 |
+
|
227 |
+
// Gravity forms
|
228 |
+
if (defined('GF_MIN_WP_VERSION')) {
|
229 |
+
add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
|
230 |
+
add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
|
231 |
+
add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
|
232 |
+
}
|
233 |
+
|
234 |
+
//Pirate forms
|
235 |
+
if(defined('PIRATE_FORMS_VERSION')){
|
236 |
+
if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
|
237 |
+
apbct_form__piratesForm__testSpam();
|
238 |
+
}
|
239 |
+
|
240 |
+
// WPForms
|
241 |
+
// Adding fields
|
242 |
+
add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
|
243 |
+
// Gathering data to validate
|
244 |
+
add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
|
245 |
+
// Do spam check
|
246 |
+
add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
|
247 |
+
|
248 |
+
// QForms integration
|
249 |
+
add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
|
250 |
+
|
251 |
+
// Ultimate Members
|
252 |
+
if (class_exists('UM')) {
|
253 |
+
add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
|
254 |
+
add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
|
255 |
+
}
|
256 |
+
|
257 |
+
//
|
258 |
+
// Load JS code to website footer
|
259 |
+
//
|
260 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
261 |
+
add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
|
262 |
+
add_action('wp_footer', 'apbct_hook__wp_footer', 1);
|
263 |
+
}
|
264 |
+
|
265 |
+
if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
|
266 |
+
ct_contact_form_validate();
|
267 |
+
}
|
268 |
+
|
269 |
+
if (apbct_is_user_enable()) {
|
270 |
+
|
271 |
+
if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
|
272 |
+
add_action( 'init', 'ct_contact_form_validate', 999 );
|
273 |
+
}
|
274 |
+
if(filter_input(INPUT_SERVER, 'REQUEST_METHOD') == 'POST' &&
|
275 |
+
$apbct->settings['general_postdata_test'] == 1 &&
|
276 |
+
!isset($_POST['ct_checkjs_cf7']) &&
|
277 |
+
!is_admin() &&
|
278 |
+
!apbct_is_user_role_in(array('administrator', 'moderator'))
|
279 |
+
){
|
280 |
+
ct_contact_form_validate_postdata();
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
function apbct_buffer__start(){
|
286 |
+
ob_start();
|
287 |
+
}
|
288 |
+
|
289 |
+
function apbct_buffer__end(){
|
290 |
+
|
291 |
+
if(!ob_get_level())
|
292 |
+
return;
|
293 |
+
|
294 |
+
global $apbct;
|
295 |
+
$apbct->buffer = ob_get_contents();
|
296 |
+
ob_end_clean();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Outputs changed buffer
|
301 |
+
*
|
302 |
+
* @global $apbct
|
303 |
+
*/
|
304 |
+
function apbct_buffer__output(){
|
305 |
+
|
306 |
+
global $apbct;
|
307 |
+
|
308 |
+
if(empty($apbct->buffer))
|
309 |
+
return;
|
310 |
+
|
311 |
+
$site_url = get_option('siteurl');
|
312 |
+
$site__host = parse_url($site_url, PHP_URL_HOST);
|
313 |
+
|
314 |
+
$dom = new DOMDocument();
|
315 |
+
@$dom->loadHTML($apbct->buffer);
|
316 |
+
|
317 |
+
$forms = $dom->getElementsByTagName('form');
|
318 |
+
|
319 |
+
foreach($forms as $form){
|
320 |
+
|
321 |
+
$action = $form->getAttribute('action');
|
322 |
+
$action = $action ? $action : $site_url;
|
323 |
+
$action__host = parse_url($action, PHP_URL_HOST);
|
324 |
+
|
325 |
+
// Check if the form directed to the third party site
|
326 |
+
if($site__host != $action__host){
|
327 |
+
|
328 |
+
$method = $form->getAttribute('method');
|
329 |
+
$method = $method ? $method : 'get';
|
330 |
+
// Directs form to our site
|
331 |
+
$form->setAttribute('method', 'POST');
|
332 |
+
$form->setAttribute('action', $site_url);
|
333 |
+
|
334 |
+
// Add cleantalk_hidden_action
|
335 |
+
$new_input = $dom->createElement('input');
|
336 |
+
$new_input->setAttribute('type', 'hidden');
|
337 |
+
$new_input->setAttribute('name', 'cleantalk_hidden_action');
|
338 |
+
$new_input->setAttribute('value', $action);
|
339 |
+
$form->appendChild($new_input);
|
340 |
+
|
341 |
+
// Add cleantalk_hidden_method
|
342 |
+
$new_input = $dom->createElement('input');
|
343 |
+
$new_input->setAttribute('type', 'hidden');
|
344 |
+
$new_input->setAttribute('name', 'cleantalk_hidden_method');
|
345 |
+
$new_input->setAttribute('value', $method);
|
346 |
+
$form->appendChild($new_input);
|
347 |
+
|
348 |
+
}
|
349 |
+
} unset($form);
|
350 |
+
|
351 |
+
$html = $dom->getElementsByTagName('html');
|
352 |
+
|
353 |
+
echo gettype($html) == 'object' && !isset( $html[0], $html[0]->childNodes, $html[0]->childNodes[0] )
|
354 |
+
? $html[0]
|
355 |
+
->childNodes[0]
|
356 |
+
->ownerDocument
|
357 |
+
->saveHTML()
|
358 |
+
: $apbct->buffer;
|
359 |
+
}
|
360 |
+
|
361 |
+
// MailChimp Premium for Wordpress
|
362 |
+
function ct_add_mc4wp_error_message($messages){
|
363 |
+
|
364 |
+
$messages['ct_mc4wp_response'] = array(
|
365 |
+
'type' => 'error',
|
366 |
+
'text' => 'Your message looks like spam.'
|
367 |
+
);
|
368 |
+
return $messages;
|
369 |
+
}
|
370 |
+
add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
|
371 |
+
|
372 |
+
/*
|
373 |
+
* Function to set validate fucntion for CCF form
|
374 |
+
* Input - Сonsistently each form field
|
375 |
+
* Returns - String. Validate function
|
376 |
+
*/
|
377 |
+
function ct_ccf($callback, $value, $field_id, $type){
|
378 |
+
/*
|
379 |
+
if($type == 'name')
|
380 |
+
$ct_global_temporary_data['name'] = $value;
|
381 |
+
elseif($type == 'email')
|
382 |
+
$ct_global_temporary_data['email'] = $value;
|
383 |
+
else
|
384 |
+
$ct_global_temporary_data[] = $value;
|
385 |
+
//*/
|
386 |
+
return 'ct_validate_ccf_submission';
|
387 |
+
}
|
388 |
+
/*
|
389 |
+
* Validate function for CCF form. Gatheering data. Multiple calls.
|
390 |
+
* Input - void. Global $ct_global_temporary_data
|
391 |
+
* Returns - String. CleanTalk comment.
|
392 |
+
*/
|
393 |
+
$ct_global_temporary_data = array();
|
394 |
+
function ct_validate_ccf_submission($value, $field_id, $required){
|
395 |
+
global $ct_global_temporary_data, $apbct;
|
396 |
+
|
397 |
+
|
398 |
+
|
399 |
+
//If the check for contact forms enabled
|
400 |
+
if(!$apbct->settings['contact_forms_test'])
|
401 |
+
return true;
|
402 |
+
//If the check for logged in users enabled
|
403 |
+
if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in())
|
404 |
+
return true;
|
405 |
+
|
406 |
+
//Accumulate data
|
407 |
+
$ct_global_temporary_data[] = $value;
|
408 |
+
|
409 |
+
//If it's the last field of the form
|
410 |
+
(!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
|
411 |
+
$form_id = $_POST['form_id'];
|
412 |
+
if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true )))
|
413 |
+
return true;
|
414 |
+
unset($ct_global_temporary_data['count']);
|
415 |
+
|
416 |
+
//Getting request params
|
417 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
418 |
+
|
419 |
+
unset($ct_global_temporary_data);
|
420 |
+
|
421 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
422 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
423 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
424 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
425 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
426 |
+
|
427 |
+
if ($subject != '')
|
428 |
+
$message['subject'] = $subject;
|
429 |
+
|
430 |
+
$post_info['comment_type'] = 'feedback_custom_contact_forms';
|
431 |
+
$post_info['post_url'] = filter_input(INPUT_SERVER, 'HTTP_REFERER');
|
432 |
+
|
433 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
434 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
435 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
436 |
+
|
437 |
+
//Making a call
|
438 |
+
$base_call_result = apbct_base_call(
|
439 |
+
array(
|
440 |
+
'message' => $message,
|
441 |
+
'sender_email' => $sender_email,
|
442 |
+
'sender_nickname' => $sender_nickname,
|
443 |
+
'post_info' => $post_info,
|
444 |
+
'js_on' => $checkjs,
|
445 |
+
'sender_info' => array('sender_url' => null),
|
446 |
+
)
|
447 |
+
);
|
448 |
+
|
449 |
+
$ct_result = $base_call_result['ct_result'];
|
450 |
+
|
451 |
+
return $ct_result->allow == 0 ? $ct_result->comment : true;;
|
452 |
+
}
|
453 |
+
|
454 |
+
function ct_woocommerce_wishlist_check($args){
|
455 |
+
global $apbct;
|
456 |
+
|
457 |
+
|
458 |
+
|
459 |
+
//Protect logged in users
|
460 |
+
if($args['wishlist_status'])
|
461 |
+
if($apbct->settings['protect_logged_in'] == 0)
|
462 |
+
return $args;
|
463 |
+
|
464 |
+
//If the IP is a Google bot
|
465 |
+
$hostname = gethostbyaddr( filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) );
|
466 |
+
if(!strpos($hostname, 'googlebot.com'))
|
467 |
+
return $args;
|
468 |
+
|
469 |
+
//Getting request params
|
470 |
+
$message = '';
|
471 |
+
$subject = '';
|
472 |
+
$email = $args['wishlist_owner_email'];
|
473 |
+
if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
|
474 |
+
$nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
|
475 |
+
else
|
476 |
+
$nickname = '';
|
477 |
+
|
478 |
+
$post_info['comment_type'] = 'feedback';
|
479 |
+
$post_info['post_url'] = filter_input(INPUT_SERVER, 'HTTP_REFERER');
|
480 |
+
|
481 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
482 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
483 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
484 |
+
|
485 |
+
//Making a call
|
486 |
+
$base_call_result = apbct_base_call(
|
487 |
+
array(
|
488 |
+
'message' => $subject." ".$message,
|
489 |
+
'sender_email' => $email,
|
490 |
+
'sender_nickname' => $nickname,
|
491 |
+
'post_info' => $post_info,
|
492 |
+
'js_on' => $checkjs,
|
493 |
+
'sender_info' => array('sender_url' => null),
|
494 |
+
)
|
495 |
+
);
|
496 |
+
|
497 |
+
$ct_result = $base_call_result['ct_result'];
|
498 |
+
|
499 |
+
if ($ct_result->allow == 0)
|
500 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
501 |
+
else
|
502 |
+
return $args;
|
503 |
+
}
|
504 |
+
|
505 |
+
function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
|
506 |
+
global $apbct;
|
507 |
+
preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
|
508 |
+
$apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Test BuddyPress activity for spam (post update only)
|
513 |
+
*
|
514 |
+
* @global SpbcState $apbct
|
515 |
+
* @param bool $is_spam
|
516 |
+
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
517 |
+
* @return boolean Spam flag
|
518 |
+
*/
|
519 |
+
function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
|
520 |
+
|
521 |
+
global $apbct;
|
522 |
+
|
523 |
+
if($activity_obj === null || !isset($_POST['action']) || $_POST['action'] && $_POST['action'] !== 'post_update')
|
524 |
+
return;
|
525 |
+
|
526 |
+
$curr_user = get_user_by('id', $activity_obj->user_id);
|
527 |
+
|
528 |
+
//Making a call
|
529 |
+
$base_call_result = apbct_base_call(
|
530 |
+
array(
|
531 |
+
'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
|
532 |
+
'sender_email' => $curr_user->data->user_email,
|
533 |
+
'sender_nickname' => $curr_user->data->user_login,
|
534 |
+
'post_info' => array(
|
535 |
+
'post_url' => filter_input(INPUT_SERVER, 'HTTP_REFERER'),
|
536 |
+
'comment_type' => 'buddypress_activitywall',
|
537 |
+
),
|
538 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
539 |
+
'sender_info' => array('sender_url' => null),
|
540 |
+
)
|
541 |
+
);
|
542 |
+
|
543 |
+
$ct_result = $base_call_result['ct_result'];
|
544 |
+
|
545 |
+
if ($ct_result->allow == 0){
|
546 |
+
add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
|
547 |
+
$apbct->spam_notification = $ct_result->comment;
|
548 |
+
return true;
|
549 |
+
}else
|
550 |
+
return $is_spam;
|
551 |
+
}
|
552 |
+
|
553 |
+
/**
|
554 |
+
* Outputs message to AJAX frontend handler
|
555 |
+
*
|
556 |
+
* @global SpbcState $apbct
|
557 |
+
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
558 |
+
*/
|
559 |
+
function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
|
560 |
+
|
561 |
+
global $apbct;
|
562 |
+
|
563 |
+
// Legacy template
|
564 |
+
if($apbct->buddy_press_tmpl === 'bp-legacy'){
|
565 |
+
die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
|
566 |
+
// Nouveau tamplate and others
|
567 |
+
}else{
|
568 |
+
@header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
|
569 |
+
die(json_encode(array(
|
570 |
+
'success' => false,
|
571 |
+
'data' => array('message' => $apbct->spam_notification),
|
572 |
+
)));
|
573 |
+
}
|
574 |
+
}
|
575 |
+
|
576 |
+
/**
|
577 |
+
* Public function - Tests new private messages (dialogs)
|
578 |
+
*
|
579 |
+
* @global SpbcState $apbct
|
580 |
+
* @param type $bp_message_obj
|
581 |
+
* @return array with errors if spam has found
|
582 |
+
*/
|
583 |
+
function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
|
584 |
+
|
585 |
+
global $apbct;
|
586 |
+
|
587 |
+
//Check for enabled option
|
588 |
+
if($apbct->settings['bp_private_messages'] == 0)
|
589 |
+
return;
|
590 |
+
|
591 |
+
//Check for quantity of comments
|
592 |
+
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
|
593 |
+
? CLEANTALK_CHECK_COMMENTS_NUMBER
|
594 |
+
: 3;
|
595 |
+
|
596 |
+
if($apbct->settings['check_comments_number']){
|
597 |
+
$args = array(
|
598 |
+
'user_id' => $bp_message_obj->sender_id,
|
599 |
+
'box' => 'sentbox',
|
600 |
+
'type' => 'all',
|
601 |
+
'limit' => $comments_check_number,
|
602 |
+
'page' => null,
|
603 |
+
'search_terms' => '',
|
604 |
+
'meta_query' => array()
|
605 |
+
);
|
606 |
+
$sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
607 |
+
$cnt_sentbox_msgs = $sentbox_msgs['total'];
|
608 |
+
$args['box'] = 'inbox';
|
609 |
+
$inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
610 |
+
$cnt_inbox_msgs = $inbox_msgs['total'];
|
611 |
+
|
612 |
+
if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
|
613 |
+
$is_max_comments = true;
|
614 |
+
}
|
615 |
+
|
616 |
+
if(!empty($is_max_comments))
|
617 |
+
return;
|
618 |
+
|
619 |
+
$sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
|
620 |
+
|
621 |
+
//Making a call
|
622 |
+
$base_call_result = apbct_base_call(
|
623 |
+
array(
|
624 |
+
'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
|
625 |
+
'sender_email' => $sender_user_obj->data->user_email,
|
626 |
+
'sender_nickname' => $sender_user_obj->data->user_login,
|
627 |
+
'post_info' => array(
|
628 |
+
'comment_type' => 'buddypress_comment',
|
629 |
+
'post_url' => filter_input(INPUT_SERVER, 'HTTP_REFERER'),
|
630 |
+
),
|
631 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
|
632 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
633 |
+
: apbct_js_test('ct_checkjs', $_POST),
|
634 |
+
'sender_info' => array('sender_url' => null),
|
635 |
+
)
|
636 |
+
);
|
637 |
+
|
638 |
+
$ct_result = $base_call_result['ct_result'];
|
639 |
+
|
640 |
+
if ($ct_result->allow == 0)
|
641 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Adds hiden filed to deafualt serach form
|
646 |
+
*
|
647 |
+
* @param $form string
|
648 |
+
* @return string
|
649 |
+
*/
|
650 |
+
function apbct_forms__search__addField( $form ){
|
651 |
+
global $apbct;
|
652 |
+
if($apbct->settings['search_test'] == 1){
|
653 |
+
$js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
|
654 |
+
$form = str_replace('</form>', $js_filed, $form);
|
655 |
+
}
|
656 |
+
return $form;
|
657 |
+
}
|
658 |
+
|
659 |
+
/**
|
660 |
+
* Test default search string for spam
|
661 |
+
*
|
662 |
+
* @param $search string
|
663 |
+
* @return string
|
664 |
+
*/
|
665 |
+
function apbct_forms__search__testSpam( $search ){
|
666 |
+
|
667 |
+
global $apbct, $cleantalk_executed;
|
668 |
+
|
669 |
+
if(
|
670 |
+
empty($search) ||
|
671 |
+
$cleantalk_executed ||
|
672 |
+
$apbct->settings['search_test'] == 0 ||
|
673 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
674 |
+
){
|
675 |
+
return $search;
|
676 |
+
}
|
677 |
+
|
678 |
+
if(apbct_is_user_logged_in())
|
679 |
+
$user = wp_get_current_user();
|
680 |
+
|
681 |
+
$base_call_result = apbct_base_call(
|
682 |
+
array(
|
683 |
+
'message' => $search,
|
684 |
+
'sender_email' => !empty($user) ? $user->user_email : null,
|
685 |
+
'sender_nickname' => !empty($user) ? $user->user_login : null,
|
686 |
+
'post_info' => array('comment_type' => 'site_search_wordpress'),
|
687 |
+
//'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
|
688 |
+
)
|
689 |
+
);
|
690 |
+
$ct_result = $base_call_result['ct_result'];
|
691 |
+
|
692 |
+
$cleantalk_executed = true;
|
693 |
+
|
694 |
+
if ($ct_result->allow == 0){
|
695 |
+
die($ct_result->comment);
|
696 |
+
}
|
697 |
+
|
698 |
+
return $search;
|
699 |
+
}
|
700 |
+
|
701 |
+
/**
|
702 |
+
* Public function - Tests for Pirate contact froms
|
703 |
+
* return NULL
|
704 |
+
*/
|
705 |
+
function apbct_form__piratesForm__testSpam(){
|
706 |
+
|
707 |
+
global $apbct;
|
708 |
+
|
709 |
+
//Check for enabled option
|
710 |
+
if( !$apbct->settings['contact_forms_test'])
|
711 |
+
return;
|
712 |
+
|
713 |
+
//Getting request params
|
714 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
715 |
+
|
716 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
717 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
718 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
719 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
720 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
721 |
+
|
722 |
+
if($subject != '')
|
723 |
+
$message = array_merge(array('subject' => $subject), $message);
|
724 |
+
|
725 |
+
$post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
|
726 |
+
$post_info['post_url'] = filter_input(INPUT_SERVER, 'HTTP_REFERER');
|
727 |
+
|
728 |
+
//Making a call
|
729 |
+
$base_call_result = apbct_base_call(
|
730 |
+
array(
|
731 |
+
'message' => $message,
|
732 |
+
'sender_email' => $sender_email,
|
733 |
+
'sender_nickname' => $sender_nickname,
|
734 |
+
'post_info' => $post_info,
|
735 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
736 |
+
'sender_info' => array('sender_url' => null),
|
737 |
+
)
|
738 |
+
);
|
739 |
+
|
740 |
+
$ct_result = $base_call_result['ct_result'];
|
741 |
+
|
742 |
+
if ($ct_result->allow == 0)
|
743 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Adds hidden filed to comment form
|
748 |
+
*/
|
749 |
+
function ct_comment_form($post_id){
|
750 |
+
|
751 |
+
global $apbct;
|
752 |
+
|
753 |
+
if (apbct_is_user_enable() === false) {
|
754 |
+
return false;
|
755 |
+
}
|
756 |
+
|
757 |
+
if ( !$apbct->settings['comments_test']) {
|
758 |
+
return false;
|
759 |
+
}
|
760 |
+
|
761 |
+
ct_add_hidden_fields('ct_checkjs', false, false);
|
762 |
+
|
763 |
+
return null;
|
764 |
+
}
|
765 |
+
|
766 |
+
/**
|
767 |
+
* Adds cookie script filed to head
|
768 |
+
*/
|
769 |
+
function apbct_hook__wp_head__set_cookie__ct_checkjs() {
|
770 |
+
|
771 |
+
ct_add_hidden_fields('ct_checkjs', false, true, true);
|
772 |
+
|
773 |
+
return null;
|
774 |
+
}
|
775 |
+
|
776 |
+
/**
|
777 |
+
* Adds cookie script filed to footer
|
778 |
+
*/
|
779 |
+
function apbct_hook__wp_footer() {
|
780 |
+
|
781 |
+
//ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
|
782 |
+
|
783 |
+
return null;
|
784 |
+
}
|
785 |
+
|
786 |
+
/**
|
787 |
+
* Adds hidden filed to define avaialbility of client's JavaScript
|
788 |
+
* @param bool $random_key switch on generation random key for every page load
|
789 |
+
*/
|
790 |
+
function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
|
791 |
+
|
792 |
+
global $ct_checkjs_def, $apbct;
|
793 |
+
|
794 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
795 |
+
$field_id_hash = md5(rand(0, 1000));
|
796 |
+
|
797 |
+
// Using only cookies
|
798 |
+
if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
|
799 |
+
|
800 |
+
$html = "<script type='text/javascript'>
|
801 |
+
function ctSetCookie(c_name, value, def_value){
|
802 |
+
document.cookie = c_name + '=' + escape(value) + '; path=/';
|
803 |
+
}
|
804 |
+
ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
|
805 |
+
</script>";
|
806 |
+
|
807 |
+
// Using AJAX to get key
|
808 |
+
}elseif($apbct->settings['use_ajax'] && $ajax){
|
809 |
+
|
810 |
+
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
811 |
+
if($no_print)
|
812 |
+
return;
|
813 |
+
|
814 |
+
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
815 |
+
$field_id = $field_name . '_' . $field_id_hash;
|
816 |
+
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
817 |
+
<script type='text/javascript'>
|
818 |
+
setTimeout(function(){
|
819 |
+
apbct_sendAJAXRequest(
|
820 |
+
{action: 'apbct_js_keys__get'},
|
821 |
+
{callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
|
822 |
+
);
|
823 |
+
}, 1000);
|
824 |
+
</script>";
|
825 |
+
|
826 |
+
// Set KEY from backend
|
827 |
+
}else{
|
828 |
+
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
829 |
+
if($no_print)
|
830 |
+
return;
|
831 |
+
|
832 |
+
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
833 |
+
$field_id = $field_name . '_' . $field_id_hash;
|
834 |
+
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
835 |
+
<script type='text/javascript'>
|
836 |
+
setTimeout(function(){
|
837 |
+
var ct_input_name = '{$field_id}';
|
838 |
+
if (document.getElementById(ct_input_name) !== null) {
|
839 |
+
var ct_input_value = document.getElementById(ct_input_name).value;
|
840 |
+
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
|
841 |
+
}
|
842 |
+
}, 1000);
|
843 |
+
</script>";
|
844 |
+
}
|
845 |
+
|
846 |
+
// Simplify JS code and Fixing issue with wpautop()
|
847 |
+
$html = str_replace(array("\n","\r","\t"),'', $html);
|
848 |
+
|
849 |
+
if ($return_string === true) {
|
850 |
+
return $html;
|
851 |
+
} else {
|
852 |
+
echo $html;
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
/**
|
857 |
+
* Public function - Insert JS code for spam tests
|
858 |
+
* return null;
|
859 |
+
*/
|
860 |
+
function apbct_rorm__formidable__footerScripts($fields, $form) {
|
861 |
+
|
862 |
+
global $apbct, $ct_checkjs_frm;
|
863 |
+
|
864 |
+
if ( !$apbct->settings['contact_forms_test'])
|
865 |
+
return false;
|
866 |
+
|
867 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
868 |
+
$ct_frm_base_name = 'form_';
|
869 |
+
$ct_frm_name = $ct_frm_base_name . $form->form_key;
|
870 |
+
|
871 |
+
echo "var input = document.createElement('input');
|
872 |
+
input.setAttribute('type', 'hidden');
|
873 |
+
input.setAttribute('name', '$ct_checkjs_frm');
|
874 |
+
input.setAttribute('value', '$ct_checkjs_key');
|
875 |
+
for (i = 0; i < document.forms.length; i++) {
|
876 |
+
if (typeof document.forms[i].id == 'string'){
|
877 |
+
if(document.forms[i].id.search('$ct_frm_name') != -1) {
|
878 |
+
document.forms[i].appendChild(input);
|
879 |
+
}
|
880 |
+
}
|
881 |
+
}";
|
882 |
+
|
883 |
+
/* Excessive cookie set
|
884 |
+
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
885 |
+
$js_code = strip_tags($js_code); // Removing <script> tag
|
886 |
+
echo $js_code;
|
887 |
+
//*/
|
888 |
+
}
|
889 |
+
|
890 |
+
/**
|
891 |
+
* Public function - Test Formidable data for spam activity
|
892 |
+
* @param $errors
|
893 |
+
* @param $form
|
894 |
+
*
|
895 |
+
* @return array with errors if spam has found
|
896 |
+
*/
|
897 |
+
function apbct_rorm__formidable__testSpam ( $errors, $form ) {
|
898 |
+
|
899 |
+
global $apbct;
|
900 |
+
|
901 |
+
if ( !$apbct->settings['contact_forms_test']) {
|
902 |
+
return $errors;
|
903 |
+
}
|
904 |
+
|
905 |
+
// Skip processing for logged in users.
|
906 |
+
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
|
907 |
+
return $errors;
|
908 |
+
}
|
909 |
+
|
910 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
|
911 |
+
|
912 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
913 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
914 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
915 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
916 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
917 |
+
|
918 |
+
// Adding 'input_meta[]' to every field /Formidable fix/
|
919 |
+
$message = array_flip($message);
|
920 |
+
foreach($message as &$value){
|
921 |
+
$value = 'item_meta['.$value.']';
|
922 |
+
} unset($value);
|
923 |
+
$message = array_flip($message);
|
924 |
+
|
925 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
926 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
927 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
928 |
+
|
929 |
+
$base_call_result = apbct_base_call(
|
930 |
+
array(
|
931 |
+
'message' => $message,
|
932 |
+
'sender_email' => $sender_email,
|
933 |
+
'sender_nickname' => $sender_nickname,
|
934 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
|
935 |
+
'js_on' => $checkjs
|
936 |
+
)
|
937 |
+
);
|
938 |
+
$ct_result = $base_call_result['ct_result'];
|
939 |
+
|
940 |
+
if ($ct_result->allow == 0) {
|
941 |
+
$errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
|
942 |
+
}
|
943 |
+
|
944 |
+
return $errors;
|
945 |
+
}
|
946 |
+
|
947 |
+
/**
|
948 |
+
* Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
|
949 |
+
* @param mixed[] $comment Comment string
|
950 |
+
* @return mixed[] $comment Comment string
|
951 |
+
*/
|
952 |
+
function ct_bbp_get_topic($topic){
|
953 |
+
global $ct_bbp_topic;
|
954 |
+
|
955 |
+
$ct_bbp_topic=$topic;
|
956 |
+
|
957 |
+
return $topic;
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* Public filter 'bbp_*' - Checks topics, replies by cleantalk
|
962 |
+
* @param mixed[] $comment Comment string
|
963 |
+
* @return mixed[] $comment Comment string
|
964 |
+
*/
|
965 |
+
function ct_bbp_new_pre_content ($comment) {
|
966 |
+
|
967 |
+
global $apbct, $current_user;
|
968 |
+
|
969 |
+
if ( !$apbct->settings['comments_test']) {
|
970 |
+
return $comment;
|
971 |
+
}
|
972 |
+
|
973 |
+
// Skip processing for logged in users and admin.
|
974 |
+
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
|
975 |
+
in_array("administrator", $current_user->roles))
|
976 |
+
return $comment;
|
977 |
+
|
978 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
979 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
980 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
981 |
+
|
982 |
+
$post_info['comment_type'] = 'bbpress_comment';
|
983 |
+
$post_info['post_url'] = bbp_get_topic_permalink();
|
984 |
+
|
985 |
+
if( is_user_logged_in() ) {
|
986 |
+
$sender_email = $current_user->user_email;
|
987 |
+
$sender_nickname = $current_user->display_name;
|
988 |
+
} else {
|
989 |
+
$sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
|
990 |
+
$sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
|
991 |
+
}
|
992 |
+
|
993 |
+
$base_call_result = apbct_base_call(
|
994 |
+
array(
|
995 |
+
'message' => $comment,
|
996 |
+
'sender_email' => $sender_email,
|
997 |
+
'sender_nickname' => $sender_nickname,
|
998 |
+
'post_info' => $post_info,
|
999 |
+
'js_on' => $checkjs,
|
1000 |
+
'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
|
1001 |
+
)
|
1002 |
+
);
|
1003 |
+
$ct_result = $base_call_result['ct_result'];
|
1004 |
+
|
1005 |
+
if ($ct_result->allow == 0) {
|
1006 |
+
bbp_add_error('bbp_reply_content', $ct_result->comment);
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
return $comment;
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
function apbct_comment__sanitize_data__before_wp_die($function){
|
1013 |
+
|
1014 |
+
global $apbct;
|
1015 |
+
|
1016 |
+
$comment_data = wp_unslash($_POST);
|
1017 |
+
|
1018 |
+
$user_ID = 0;
|
1019 |
+
|
1020 |
+
$comment_type = '';
|
1021 |
+
|
1022 |
+
$comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
|
1023 |
+
$comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
|
1024 |
+
|
1025 |
+
$comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
|
1026 |
+
$comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
|
1027 |
+
$comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
|
1028 |
+
$comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
|
1029 |
+
|
1030 |
+
if(isset($comment_content, $comment_parent)){
|
1031 |
+
|
1032 |
+
$user = wp_get_current_user();
|
1033 |
+
|
1034 |
+
if($user->exists()){
|
1035 |
+
$comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
|
1036 |
+
$comment_author_email = $user->user_email;
|
1037 |
+
$comment_author_url = $user->user_url;
|
1038 |
+
$user_ID = $user->ID;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
$apbct->comment_data = compact(
|
1042 |
+
'comment_post_ID',
|
1043 |
+
'comment_author',
|
1044 |
+
'comment_author_email',
|
1045 |
+
'comment_author_url',
|
1046 |
+
'comment_content',
|
1047 |
+
'comment_type',
|
1048 |
+
'comment_parent',
|
1049 |
+
'user_ID'
|
1050 |
+
);
|
1051 |
+
|
1052 |
+
$function = 'apbct_comment__check_via_wp_die';
|
1053 |
+
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
return $function;
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
function apbct_comment__check_via_wp_die($message, $title, $args){
|
1060 |
+
if($title == __('Comment Submission Failure')){
|
1061 |
+
global $apbct;
|
1062 |
+
$apbct->validation_error = $message;
|
1063 |
+
ct_preprocess_comment($apbct->comment_data);
|
1064 |
+
}
|
1065 |
+
_default_wp_die_handler($message, $title, $args);
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
/**
|
1069 |
+
* Public filter 'preprocess_comment' - Checks comment by cleantalk server
|
1070 |
+
* @param mixed[] $comment Comment data array
|
1071 |
+
* @return mixed[] New data array of comment
|
1072 |
+
*/
|
1073 |
+
function ct_preprocess_comment($comment) {
|
1074 |
+
// this action is called just when WP process POST request (adds new comment)
|
1075 |
+
// this action is called by wp-comments-post.php
|
1076 |
+
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
1077 |
+
global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
|
1078 |
+
|
1079 |
+
// Send email notification for chosen groups of users
|
1080 |
+
if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
|
1081 |
+
|
1082 |
+
add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
|
1083 |
+
|
1084 |
+
$users = get_users(array(
|
1085 |
+
'role__in' => $apbct->settings['comment_notify__roles'],
|
1086 |
+
'fileds' => array('user_email')
|
1087 |
+
));
|
1088 |
+
|
1089 |
+
if($users){
|
1090 |
+
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
|
1091 |
+
add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
|
1092 |
+
foreach($users as $user){
|
1093 |
+
$emails[] = $user->user_email;
|
1094 |
+
}
|
1095 |
+
$apbct->comment_notification_recipients = json_encode($emails);
|
1096 |
+
}
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
// Skip processing admin.
|
1100 |
+
if (in_array("administrator", $current_user->roles))
|
1101 |
+
return $comment;
|
1102 |
+
|
1103 |
+
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
|
1104 |
+
|
1105 |
+
if($apbct->settings['check_comments_number']){
|
1106 |
+
$args = array(
|
1107 |
+
'author_email' => $comment['comment_author_email'],
|
1108 |
+
'status' => 'approve',
|
1109 |
+
'count' => false,
|
1110 |
+
'number' => $comments_check_number,
|
1111 |
+
);
|
1112 |
+
$cnt = count(get_comments($args));
|
1113 |
+
$is_max_comments = $cnt >= $comments_check_number ? true : false;
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
if (
|
1117 |
+
($comment['comment_type']!='trackback') &&
|
1118 |
+
(
|
1119 |
+
apbct_is_user_enable() === false ||
|
1120 |
+
$apbct->settings['comments_test'] == 0 ||
|
1121 |
+
$ct_comment_done ||
|
1122 |
+
(stripos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'page=wysija_campaigns&action=editTemplate')!==false) ||
|
1123 |
+
(isset($is_max_comments) && $is_max_comments) ||
|
1124 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/wp-admin/')!==false)
|
1125 |
+
)
|
1126 |
+
{
|
1127 |
+
return $comment;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
$local_blacklists = wp_blacklist_check(
|
1131 |
+
$comment['comment_author'],
|
1132 |
+
$comment['comment_author_email'],
|
1133 |
+
$comment['comment_author_url'],
|
1134 |
+
$comment['comment_content'],
|
1135 |
+
filter_input(INPUT_SERVER, 'REMOTE_ADDR'),
|
1136 |
+
filter_input(INPUT_SERVER, 'HTTP_USER_AGENT')
|
1137 |
+
);
|
1138 |
+
|
1139 |
+
// Go out if author in local blacklists
|
1140 |
+
if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
|
1141 |
+
return $comment;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
// Skip pingback anti-spam test
|
1145 |
+
/*if ($comment['comment_type'] == 'pingback') {
|
1146 |
+
return $comment;
|
1147 |
+
}*/
|
1148 |
+
|
1149 |
+
$ct_comment_done = true;
|
1150 |
+
|
1151 |
+
$comment_post_id = $comment['comment_post_ID'];
|
1152 |
+
|
1153 |
+
// JetPack comments logic
|
1154 |
+
$post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
|
1155 |
+
$post_info['post_url'] = ct_post_url(null, $comment_post_id);
|
1156 |
+
|
1157 |
+
// Comment type
|
1158 |
+
$post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
|
1159 |
+
|
1160 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1161 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1162 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
1163 |
+
|
1164 |
+
|
1165 |
+
$example = null;
|
1166 |
+
if ($apbct->data['relevance_test']) {
|
1167 |
+
$post = get_post($comment_post_id);
|
1168 |
+
if ($post !== null){
|
1169 |
+
$example['title'] = $post->post_title;
|
1170 |
+
$example['body'] = $post->post_content;
|
1171 |
+
$example['comments'] = null;
|
1172 |
+
|
1173 |
+
$last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
|
1174 |
+
foreach ($last_comments as $post_comment){
|
1175 |
+
$example['comments'] .= "\n\n" . $post_comment->comment_content;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
$example = json_encode($example);
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
// Use plain string format if've failed with JSON
|
1182 |
+
if ($example === false || $example === null){
|
1183 |
+
$example = ($post->post_title !== null) ? $post->post_title : '';
|
1184 |
+
$example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
|
1185 |
+
}
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
$base_call_result = apbct_base_call(
|
1189 |
+
array(
|
1190 |
+
'message' => $comment['comment_content'],
|
1191 |
+
'example' => $example,
|
1192 |
+
'sender_email' => $comment['comment_author_email'],
|
1193 |
+
'sender_nickname' => $comment['comment_author'],
|
1194 |
+
'post_info' => $post_info,
|
1195 |
+
'js_on' => $checkjs,
|
1196 |
+
'sender_info' => array(
|
1197 |
+
'sender_url' => @$comment['comment_author_url'],
|
1198 |
+
'form_validation' => !isset($apbct->validation_error)
|
1199 |
+
? null
|
1200 |
+
: json_encode(array(
|
1201 |
+
'validation_notice' => $apbct->validation_error,
|
1202 |
+
'page_url' => filter_input(INPUT_SERVER, 'HTTP_HOST') . filter_input(INPUT_SERVER, 'REQUEST_URI'),
|
1203 |
+
))
|
1204 |
+
),
|
1205 |
+
)
|
1206 |
+
);
|
1207 |
+
$ct_result = $base_call_result['ct_result'];
|
1208 |
+
|
1209 |
+
ct_hash($ct_result->id);
|
1210 |
+
|
1211 |
+
//Don't check trusted users
|
1212 |
+
if (isset($comment['comment_author_email'])){
|
1213 |
+
$approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
|
1214 |
+
$new_user = $approved_comments == 0 ? true : false;
|
1215 |
+
}
|
1216 |
+
|
1217 |
+
// Change comment flow only for new authors
|
1218 |
+
if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
|
1219 |
+
add_action('comment_post', 'ct_set_meta', 10, 2);
|
1220 |
+
|
1221 |
+
if($ct_result->allow){ // Pass if allowed
|
1222 |
+
if(get_option('comment_moderation') === '1') // Wordpress moderation flag
|
1223 |
+
add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
|
1224 |
+
else
|
1225 |
+
add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
|
1226 |
+
}else{
|
1227 |
+
|
1228 |
+
global $ct_comment, $ct_stop_words;
|
1229 |
+
|
1230 |
+
$ct_comment = $ct_result->comment;
|
1231 |
+
$ct_stop_words = $ct_result->stop_words;
|
1232 |
+
|
1233 |
+
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
|
1234 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1235 |
+
|
1236 |
+
// Terminate. Definitely spam.
|
1237 |
+
if($ct_result->stop_queue == 1)
|
1238 |
+
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1239 |
+
|
1240 |
+
// Terminate by user's setting.
|
1241 |
+
if($ct_result->spam == 3)
|
1242 |
+
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1243 |
+
|
1244 |
+
// Trash comment.
|
1245 |
+
if($ct_result->spam == 2){
|
1246 |
+
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1247 |
+
add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
// Spam comment
|
1251 |
+
if($ct_result->spam == 1)
|
1252 |
+
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1253 |
+
|
1254 |
+
// Move to pending folder. Contains stop_words.
|
1255 |
+
if($ct_result->stop_words){
|
1256 |
+
add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
|
1257 |
+
add_action('comment_post', 'ct_mark_red', 998, 2);
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
add_action('comment_post', 'ct_die', 999, 2);
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
if($apbct->settings['remove_comments_links'] == 1){
|
1264 |
+
$comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
// Change mail notification if license is out of date
|
1268 |
+
if($apbct->data['moderate'] == 0){
|
1269 |
+
$apbct->sender_email = $comment['comment_author_email'];
|
1270 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
1271 |
+
add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
|
1272 |
+
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
return $comment;
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
/**
|
1279 |
+
* Changes whether notify admin/athor or not.
|
1280 |
+
*
|
1281 |
+
* @param bool $maybe_notify notify flag
|
1282 |
+
* @param int $comment_ID Comment id
|
1283 |
+
* @return bool flag
|
1284 |
+
*/
|
1285 |
+
function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
|
1286 |
+
return true;
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
/**
|
1290 |
+
* Add notification setting link
|
1291 |
+
*
|
1292 |
+
* @param string $notify_message
|
1293 |
+
* @param integer $comment_id
|
1294 |
+
*
|
1295 |
+
* @return string
|
1296 |
+
*/
|
1297 |
+
function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
|
1298 |
+
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
1299 |
+
return $notify_message
|
1300 |
+
.PHP_EOL
|
1301 |
+
.'---'.PHP_EOL
|
1302 |
+
.'Manage notifications settings: http://'.$website.'/wp-admin/options-general.php?page=cleantalk';
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
/**
|
1306 |
+
* Change email notification recipients
|
1307 |
+
*
|
1308 |
+
* @param array $emails
|
1309 |
+
* @param integer $comment_id
|
1310 |
+
*
|
1311 |
+
* @return array
|
1312 |
+
* @global SpbcState $apbct
|
1313 |
+
*/
|
1314 |
+
function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
|
1315 |
+
global $apbct;
|
1316 |
+
return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
/**
|
1320 |
+
* Changes email notification for spam comment for native Wordpress comment system
|
1321 |
+
*
|
1322 |
+
* @param string $notify_message Body of email notification
|
1323 |
+
* @param int $comment_id Comment id
|
1324 |
+
* @return string Body for email notification
|
1325 |
+
*/
|
1326 |
+
function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
|
1327 |
+
|
1328 |
+
global $apbct;
|
1329 |
+
|
1330 |
+
$notify_message =
|
1331 |
+
PHP_EOL
|
1332 |
+
.__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk')
|
1333 |
+
."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
|
1334 |
+
."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
|
1335 |
+
."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
|
1336 |
+
."\n".PHP_EOL . sprintf(
|
1337 |
+
__('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
|
1338 |
+
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
|
1339 |
+
.($apbct->data['user_token']
|
1340 |
+
? '&iser_token='.$apbct->data['user_token']
|
1341 |
+
: ''
|
1342 |
+
)
|
1343 |
+
)
|
1344 |
+
.PHP_EOL . '---'
|
1345 |
+
.PHP_EOL
|
1346 |
+
.PHP_EOL
|
1347 |
+
.$notify_message;
|
1348 |
+
|
1349 |
+
return $notify_message;
|
1350 |
+
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
/**
|
1354 |
+
* Set die page with Cleantalk comment.
|
1355 |
+
* @global array $ct_comment
|
1356 |
+
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1357 |
+
* @param type $comment_status
|
1358 |
+
*/
|
1359 |
+
function ct_die($comment_id, $comment_status) {
|
1360 |
+
global $ct_comment;
|
1361 |
+
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1362 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1363 |
+
if(isset($_POST['et_pb_contact_email']))
|
1364 |
+
{
|
1365 |
+
$mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
|
1366 |
+
wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
|
1367 |
+
}
|
1368 |
+
else
|
1369 |
+
{
|
1370 |
+
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1371 |
+
}
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
/**
|
1375 |
+
* Set die page with Cleantalk comment from parameter.
|
1376 |
+
* @param type $comment_body
|
1377 |
+
*/
|
1378 |
+
function ct_die_extended($comment_body) {
|
1379 |
+
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
|
1380 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1381 |
+
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
/**
|
1385 |
+
* Validates JavaScript anti-spam test
|
1386 |
+
*
|
1387 |
+
* @param string $field_name filed to serach in data
|
1388 |
+
* @param null $data Data to search in
|
1389 |
+
* @param bool $random_key
|
1390 |
+
*
|
1391 |
+
* @return int|null
|
1392 |
+
*/
|
1393 |
+
function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
|
1394 |
+
|
1395 |
+
global $apbct;
|
1396 |
+
|
1397 |
+
$out = null;
|
1398 |
+
|
1399 |
+
if($data && isset($data[$field_name])){
|
1400 |
+
|
1401 |
+
$js_key = trim($data[$field_name]);
|
1402 |
+
|
1403 |
+
// Check static key
|
1404 |
+
if(
|
1405 |
+
$apbct->settings['use_static_js_key'] == 1 ||
|
1406 |
+
( $apbct->settings['use_static_js_key'] == - 1 &&
|
1407 |
+
( apbct_is_cache_plugins_exists() ||
|
1408 |
+
( strtolower( filter_input(INPUT_SERVER, 'REQUEST_METHOD') ) == 'post' && $apbct->data['cache_detected'] == 1 )
|
1409 |
+
)
|
1410 |
+
)
|
1411 |
+
){
|
1412 |
+
$out = ct_get_checkjs_value() === $js_key ? 1 : 0;
|
1413 |
+
|
1414 |
+
// Random key check
|
1415 |
+
}else{
|
1416 |
+
$out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
|
1417 |
+
}
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
return $out;
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
/**
|
1424 |
+
* Get post url
|
1425 |
+
* @param int $comment_id
|
1426 |
+
* @param int $comment_post_id
|
1427 |
+
* @return string|bool
|
1428 |
+
*/
|
1429 |
+
function ct_post_url($comment_id = null, $comment_post_id) {
|
1430 |
+
|
1431 |
+
if (empty($comment_post_id))
|
1432 |
+
return null;
|
1433 |
+
|
1434 |
+
if ($comment_id === null) {
|
1435 |
+
$last_comment = get_comments('number=1');
|
1436 |
+
$comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
|
1437 |
+
}
|
1438 |
+
$permalink = get_permalink($comment_post_id);
|
1439 |
+
|
1440 |
+
$post_url = null;
|
1441 |
+
if ($permalink !== null)
|
1442 |
+
$post_url = $permalink . '#comment-' . $comment_id;
|
1443 |
+
|
1444 |
+
return $post_url;
|
1445 |
+
}
|
1446 |
+
|
1447 |
+
/**
|
1448 |
+
* Public filter 'pre_comment_approved' - Mark comment unapproved always
|
1449 |
+
* @return int Zero
|
1450 |
+
*/
|
1451 |
+
function ct_set_not_approved() {
|
1452 |
+
return 0;
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
/**
|
1456 |
+
* @author Artem Leontiev
|
1457 |
+
* Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
|
1458 |
+
* @return int 1
|
1459 |
+
*/
|
1460 |
+
function ct_set_approved($approved, $comment) {
|
1461 |
+
if ($approved == 'spam'){
|
1462 |
+
return $approved;
|
1463 |
+
} else {
|
1464 |
+
return 1;
|
1465 |
+
}
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
/**
|
1469 |
+
* Public filter 'pre_comment_approved' - Mark comment unapproved always
|
1470 |
+
* @return int Zero
|
1471 |
+
*/
|
1472 |
+
function ct_set_comment_spam() {
|
1473 |
+
return 'spam';
|
1474 |
+
}
|
1475 |
+
|
1476 |
+
/**
|
1477 |
+
* Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
|
1478 |
+
* @param int $comment_id Comment ID
|
1479 |
+
* @param mixed $comment_status Approval status ("spam", or 0/1), not used
|
1480 |
+
*/
|
1481 |
+
function ct_set_meta($comment_id, $comment_status) {
|
1482 |
+
global $comment_post_id;
|
1483 |
+
$hash1 = ct_hash();
|
1484 |
+
if (!empty($hash1)) {
|
1485 |
+
update_comment_meta($comment_id, 'ct_hash', $hash1);
|
1486 |
+
if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
|
1487 |
+
$post_url = ct_post_url($comment_id, $comment_post_id);
|
1488 |
+
$post_url = base64_encode($post_url);
|
1489 |
+
if ($post_url === false)
|
1490 |
+
return false;
|
1491 |
+
// 01 - URL to approved comment
|
1492 |
+
$feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
|
1493 |
+
ct_send_feedback($feedback_request);
|
1494 |
+
}
|
1495 |
+
}
|
1496 |
+
return true;
|
1497 |
+
}
|
1498 |
+
|
1499 |
+
/**
|
1500 |
+
* Mark bad words
|
1501 |
+
* @global string $ct_stop_words
|
1502 |
+
* @param int $comment_id
|
1503 |
+
* @param int $comment_status Not use
|
1504 |
+
*/
|
1505 |
+
function ct_mark_red($comment_id, $comment_status) {
|
1506 |
+
global $ct_stop_words;
|
1507 |
+
|
1508 |
+
$comment = get_comment($comment_id, 'ARRAY_A');
|
1509 |
+
$message = $comment['comment_content'];
|
1510 |
+
foreach (explode(':', $ct_stop_words) as $word) {
|
1511 |
+
$message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
|
1512 |
+
|
1513 |
+
}
|
1514 |
+
$comment['comment_content'] = $message;
|
1515 |
+
kses_remove_filters();
|
1516 |
+
wp_update_comment($comment);
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
//
|
1520 |
+
//Send post to trash
|
1521 |
+
//
|
1522 |
+
function ct_wp_trash_comment($comment_id, $comment_status){
|
1523 |
+
wp_trash_comment($comment_id);
|
1524 |
+
}
|
1525 |
+
|
1526 |
+
/**
|
1527 |
+
* Tests plugin activation status
|
1528 |
+
* @return bool
|
1529 |
+
*/
|
1530 |
+
function ct_plugin_active($plugin_name){
|
1531 |
+
foreach (get_option('active_plugins') as $k => $v) {
|
1532 |
+
if ($plugin_name == $v)
|
1533 |
+
return true;
|
1534 |
+
}
|
1535 |
+
return false;
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
/**
|
1539 |
+
* Insert a hidden field to registration form
|
1540 |
+
* @return null
|
1541 |
+
*/
|
1542 |
+
function ct_register_form() {
|
1543 |
+
|
1544 |
+
global $ct_checkjs_register_form, $apbct;
|
1545 |
+
|
1546 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
1547 |
+
return false;
|
1548 |
+
}
|
1549 |
+
|
1550 |
+
ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
|
1551 |
+
|
1552 |
+
return null;
|
1553 |
+
}
|
1554 |
+
|
1555 |
+
function apbct_login__scripts(){
|
1556 |
+
echo '<script src="'.APBCT_URL_PATH.'/js/apbct-public.min.js"></script>';
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
/**
|
1560 |
+
* Adds notification text to login form - to inform about approved registration
|
1561 |
+
* @return null
|
1562 |
+
*/
|
1563 |
+
function ct_login_message($message) {
|
1564 |
+
|
1565 |
+
global $errors, $apbct, $apbct_cookie_register_ok_label;
|
1566 |
+
|
1567 |
+
|
1568 |
+
|
1569 |
+
if ($apbct->settings['registrations_test'] != 0){
|
1570 |
+
if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
|
1571 |
+
if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
|
1572 |
+
if(is_wp_error($errors)){
|
1573 |
+
$errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
|
1574 |
+
}
|
1575 |
+
}
|
1576 |
+
}
|
1577 |
+
}
|
1578 |
+
return $message;
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
/**
|
1582 |
+
* Test users registration for pPress
|
1583 |
+
* @return array with errors
|
1584 |
+
*/
|
1585 |
+
function ct_registration_errors_ppress($reg_errors, $form_id) {
|
1586 |
+
|
1587 |
+
$email = $_POST['reg_email'];
|
1588 |
+
$login = $_POST['reg_username'];
|
1589 |
+
|
1590 |
+
$reg_errors = ct_registration_errors($reg_errors, $login, $email);
|
1591 |
+
|
1592 |
+
return $reg_errors;
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
/**
|
1596 |
+
* Test users registration for multisite enviroment
|
1597 |
+
* @return array with errors
|
1598 |
+
*/
|
1599 |
+
function ct_registration_errors_wpmu($errors) {
|
1600 |
+
global $ct_signup_done;
|
1601 |
+
|
1602 |
+
//
|
1603 |
+
// Multisite actions
|
1604 |
+
//
|
1605 |
+
$sanitized_user_login = null;
|
1606 |
+
if (isset($errors['user_name'])) {
|
1607 |
+
$sanitized_user_login = $errors['user_name'];
|
1608 |
+
$wpmu = true;
|
1609 |
+
}
|
1610 |
+
$user_email = null;
|
1611 |
+
if (isset($errors['user_email'])) {
|
1612 |
+
$user_email = $errors['user_email'];
|
1613 |
+
$wpmu = true;
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
|
1617 |
+
return $errors;
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
$errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
|
1621 |
+
|
1622 |
+
// Show CleanTalk errors in user_name field
|
1623 |
+
if (isset($errors['errors']->errors['ct_error'])) {
|
1624 |
+
$errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
|
1625 |
+
unset($errors['errors']->errors['ct_error']);
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
return $errors;
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
/**
|
1632 |
+
* Shell for action register_post
|
1633 |
+
* @return array with errors
|
1634 |
+
*/
|
1635 |
+
function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
|
1636 |
+
return ct_registration_errors($errors, $sanitized_user_login, $user_email);
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
/**
|
1640 |
+
* Check messages for external plugins
|
1641 |
+
* @return array with checking result;
|
1642 |
+
*/
|
1643 |
+
|
1644 |
+
function ct_test_message($nickname, $email, $ip, $text){
|
1645 |
+
|
1646 |
+
$base_call_result = apbct_base_call(
|
1647 |
+
array(
|
1648 |
+
'message' => $text,
|
1649 |
+
'sender_email' => $email,
|
1650 |
+
'sender_nickname' => $nickname,
|
1651 |
+
'post_info' => array('comment_type' => 'feedback_plugin_check'),
|
1652 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
1653 |
+
)
|
1654 |
+
);
|
1655 |
+
|
1656 |
+
$ct_result = $base_call_result['ct_result'];
|
1657 |
+
|
1658 |
+
$result=Array(
|
1659 |
+
'allow' => $ct_result->allow,
|
1660 |
+
'comment' => $ct_result->comment,
|
1661 |
+
);
|
1662 |
+
return $result;
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
/**
|
1666 |
+
* Check registrations for external plugins
|
1667 |
+
* @return array with checking result;
|
1668 |
+
*/
|
1669 |
+
function ct_test_registration($nickname, $email, $ip){
|
1670 |
+
|
1671 |
+
global $ct_checkjs_register_form, $apbct;
|
1672 |
+
|
1673 |
+
if(apbct_js_test($ct_checkjs_register_form, $_POST)){
|
1674 |
+
$checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
|
1675 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
1676 |
+
}else{
|
1677 |
+
$checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
1678 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
//Making a call
|
1682 |
+
$base_call_result = apbct_base_call(
|
1683 |
+
array(
|
1684 |
+
'sender_ip' => $ip,
|
1685 |
+
'sender_email' => $email,
|
1686 |
+
'sender_nickname' => $nickname,
|
1687 |
+
'sender_info' => $sender_info,
|
1688 |
+
'js_on' => $checkjs,
|
1689 |
+
),
|
1690 |
+
true
|
1691 |
+
);
|
1692 |
+
$ct_result = $base_call_result['ct_result'];
|
1693 |
+
|
1694 |
+
$result = array(
|
1695 |
+
'allow' => $ct_result->allow,
|
1696 |
+
'comment' => $ct_result->comment,
|
1697 |
+
);
|
1698 |
+
return $result;
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
/**
|
1702 |
+
* Test users registration
|
1703 |
+
*
|
1704 |
+
* @param $errors
|
1705 |
+
* @param null $sanitized_user_login
|
1706 |
+
* @param null $user_email
|
1707 |
+
*
|
1708 |
+
* @return void with errors
|
1709 |
+
*/
|
1710 |
+
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1711 |
+
|
1712 |
+
global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment, $cleantalk_executed;
|
1713 |
+
|
1714 |
+
// Go out if a registrered user action
|
1715 |
+
if (apbct_is_user_enable() === false) {
|
1716 |
+
return $errors;
|
1717 |
+
}
|
1718 |
+
|
1719 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
1720 |
+
return $errors;
|
1721 |
+
}
|
1722 |
+
|
1723 |
+
// The function already executed
|
1724 |
+
// It happens when used ct_register_post();
|
1725 |
+
if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
|
1726 |
+
return $errors;
|
1727 |
+
}
|
1728 |
+
|
1729 |
+
// Facebook registration
|
1730 |
+
if ($sanitized_user_login === null && isset($_POST['FB_userdata'])){
|
1731 |
+
$sanitized_user_login = $_POST['FB_userdata']['name'];
|
1732 |
+
$facebook = true;
|
1733 |
+
}
|
1734 |
+
if ($user_email === null && isset($_POST['FB_userdata'])){
|
1735 |
+
$user_email = $_POST['FB_userdata']['email'];
|
1736 |
+
$facebook = true;
|
1737 |
+
}
|
1738 |
+
|
1739 |
+
// BuddyPress actions
|
1740 |
+
$buddypress = false;
|
1741 |
+
if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
|
1742 |
+
$sanitized_user_login = $_POST['signup_username'];
|
1743 |
+
$buddypress = true;
|
1744 |
+
}
|
1745 |
+
if ($user_email === null && isset($_POST['signup_email'])) {
|
1746 |
+
$user_email = $_POST['signup_email'];
|
1747 |
+
$buddypress = true;
|
1748 |
+
}
|
1749 |
+
|
1750 |
+
//
|
1751 |
+
// Break tests because we already have servers response
|
1752 |
+
//
|
1753 |
+
if ($buddypress && $ct_signup_done) {
|
1754 |
+
if ($ct_negative_comment) {
|
1755 |
+
$bp->signup->errors['signup_username'] = $ct_negative_comment;
|
1756 |
+
}
|
1757 |
+
return $errors;
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
|
1761 |
+
if(current_filter() == 'woocommerce_registration_errors'){
|
1762 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
1763 |
+
$checkjs_post = null;
|
1764 |
+
$checkjs_cookie = $checkjs;
|
1765 |
+
}else{
|
1766 |
+
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
1767 |
+
$checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
|
1768 |
+
$checkjs_cookie = apbct_js_test($ct_checkjs_register_form, $_COOKIE);
|
1769 |
+
$checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
$sender_info = array(
|
1773 |
+
'post_checkjs_passed' => $checkjs_post,
|
1774 |
+
'cookie_checkjs_passed' => $checkjs_cookie,
|
1775 |
+
'form_validation' => ! empty( $errors )
|
1776 |
+
? json_encode( array(
|
1777 |
+
'validation_notice' => $errors->get_error_message(),
|
1778 |
+
'page_url' => filter_input( INPUT_SERVER, 'HTTP_HOST' ) . filter_input( INPUT_SERVER, 'REQUEST_URI' ),
|
1779 |
+
) )
|
1780 |
+
: null,
|
1781 |
+
);
|
1782 |
+
|
1783 |
+
$base_call_result = apbct_base_call(
|
1784 |
+
array(
|
1785 |
+
'sender_email' => $user_email,
|
1786 |
+
'sender_nickname' => $sanitized_user_login,
|
1787 |
+
'sender_info' => $sender_info,
|
1788 |
+
'js_on' => $checkjs,
|
1789 |
+
),
|
1790 |
+
true
|
1791 |
+
);
|
1792 |
+
$ct_result = $base_call_result['ct_result'];
|
1793 |
+
|
1794 |
+
// Change mail notification if license is out of date
|
1795 |
+
if($apbct->data['moderate'] == 0 &&
|
1796 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
1797 |
+
){
|
1798 |
+
$apbct->sender_email = $user_email;
|
1799 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
1800 |
+
add_filter('wp_new_user_notification_email_admin', 'apbct_registration__Wordpress__changeMailNotification', 100, 3);
|
1801 |
+
}
|
1802 |
+
|
1803 |
+
$ct_signup_done = true;
|
1804 |
+
|
1805 |
+
$ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
|
1806 |
+
|
1807 |
+
$cleantalk_executed = true;
|
1808 |
+
|
1809 |
+
if ($ct_result->inactive != 0) {
|
1810 |
+
ct_send_error_notice($ct_result->comment);
|
1811 |
+
return $errors;
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
if ($ct_result->allow == 0) {
|
1815 |
+
|
1816 |
+
if ($buddypress === true) {
|
1817 |
+
$bp->signup->errors['signup_username'] = $ct_result->comment;
|
1818 |
+
}elseif(!empty($facebook)){
|
1819 |
+
$_POST['FB_userdata']['email'] = '';
|
1820 |
+
$_POST['FB_userdata']['name'] = '';
|
1821 |
+
return;
|
1822 |
+
}else{
|
1823 |
+
if(is_wp_error($errors))
|
1824 |
+
$errors->add('ct_error', $ct_result->comment);
|
1825 |
+
$ct_negative_comment = $ct_result->comment;
|
1826 |
+
}
|
1827 |
+
|
1828 |
+
$ct_registration_error_comment = $ct_result->comment;
|
1829 |
+
|
1830 |
+
} else {
|
1831 |
+
if ($ct_result->id !== null) {
|
1832 |
+
setcookie($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
|
1833 |
+
setcookie($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
|
1834 |
+
}
|
1835 |
+
}
|
1836 |
+
|
1837 |
+
return $errors;
|
1838 |
+
}
|
1839 |
+
|
1840 |
+
/**
|
1841 |
+
* Changes email notification for newly registred user
|
1842 |
+
*
|
1843 |
+
* @param string $wp_new_user_notification_email_admin Body of email notification
|
1844 |
+
* @param array $user User inof
|
1845 |
+
* @param string $blogname Blog name
|
1846 |
+
* @return string Body for email notification
|
1847 |
+
*/
|
1848 |
+
function apbct_registration__Wordpress__changeMailNotification($wp_new_user_notification_email_admin, $user, $blogname){
|
1849 |
+
|
1850 |
+
global $apbct;
|
1851 |
+
|
1852 |
+
$wp_new_user_notification_email_admin['message'] = PHP_EOL
|
1853 |
+
.__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk')
|
1854 |
+
."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
1855 |
+
."\n" . 'IP: ' . $apbct->sender_ip
|
1856 |
+
."\n" . 'Email: ' . $apbct->sender_email
|
1857 |
+
.PHP_EOL . PHP_EOL .
|
1858 |
+
__('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
|
1859 |
+
.'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
|
1860 |
+
.($apbct->data['user_token']
|
1861 |
+
? '&iser_token='.$apbct->data['user_token']
|
1862 |
+
: ''
|
1863 |
+
)
|
1864 |
+
.PHP_EOL . '---'
|
1865 |
+
.PHP_EOL
|
1866 |
+
.$wp_new_user_notification_email_admin['message'];
|
1867 |
+
|
1868 |
+
return $wp_new_user_notification_email_admin;
|
1869 |
+
|
1870 |
+
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
/**
|
1874 |
+
* Checks Ultimate Members registration for spam
|
1875 |
+
*
|
1876 |
+
* @param $args forms arguments with names and values
|
1877 |
+
*
|
1878 |
+
* @return mixed
|
1879 |
+
*
|
1880 |
+
*/
|
1881 |
+
function apbct_registration__UltimateMembers__check( $args ){
|
1882 |
+
|
1883 |
+
global $apbct, $cleantalk_executed;
|
1884 |
+
|
1885 |
+
if ($apbct->settings['registrations_test'] == 0)
|
1886 |
+
return $args;
|
1887 |
+
|
1888 |
+
$checkjs = apbct_js_test('ct_checkjs_register_form', $args);
|
1889 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
1890 |
+
|
1891 |
+
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
1892 |
+
if ($checkjs == 0) {
|
1893 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
1894 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
1895 |
+
}
|
1896 |
+
|
1897 |
+
$base_call_result = apbct_base_call(
|
1898 |
+
array(
|
1899 |
+
'sender_email' => $args['user_email'],
|
1900 |
+
'sender_nickname' => $args['user_login'],
|
1901 |
+
'sender_info' => $sender_info,
|
1902 |
+
'js_on' => $checkjs,
|
1903 |
+
),
|
1904 |
+
true
|
1905 |
+
);
|
1906 |
+
$ct_result = $base_call_result['ct_result'];
|
1907 |
+
|
1908 |
+
$cleantalk_executed = true;
|
1909 |
+
|
1910 |
+
if ($ct_result->inactive != 0) {
|
1911 |
+
ct_send_error_notice($ct_result->comment);
|
1912 |
+
return $args;
|
1913 |
+
}
|
1914 |
+
|
1915 |
+
if ($ct_result->allow == 0)
|
1916 |
+
UM()->form()->add_error('user_password', $ct_result->comment );
|
1917 |
+
|
1918 |
+
return $args;
|
1919 |
+
}
|
1920 |
+
|
1921 |
+
/**
|
1922 |
+
* Checks registration error and set it if it was dropped
|
1923 |
+
* @return errors
|
1924 |
+
*/
|
1925 |
+
function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
|
1926 |
+
global $bp, $ct_registration_error_comment;
|
1927 |
+
|
1928 |
+
if($ct_registration_error_comment){
|
1929 |
+
|
1930 |
+
if(isset($bp))
|
1931 |
+
if(method_exists($bp, 'signup'))
|
1932 |
+
if(method_exists($bp->signup, 'errors'))
|
1933 |
+
if(isset($bp->signup->errors['signup_username']))
|
1934 |
+
if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
|
1935 |
+
$bp->signup->errors['signup_username'] = $ct_registration_error_comment;
|
1936 |
+
|
1937 |
+
if(isset($errors))
|
1938 |
+
if(method_exists($errors, 'errors'))
|
1939 |
+
if(isset($errors->errors['ct_error']))
|
1940 |
+
if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
|
1941 |
+
$errors->add('ct_error', $ct_registration_error_comment);
|
1942 |
+
|
1943 |
+
}
|
1944 |
+
return $errors;
|
1945 |
+
}
|
1946 |
+
|
1947 |
+
/**
|
1948 |
+
* Set user meta (ct_hash) for successed registration
|
1949 |
+
* @return null
|
1950 |
+
*/
|
1951 |
+
function apbct_user_register($user_id) {
|
1952 |
+
global $apbct_cookie_request_id_label;
|
1953 |
+
if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
|
1954 |
+
if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
|
1955 |
+
setcookie($apbct_cookie_request_id_label, '0', 1, '/');
|
1956 |
+
}
|
1957 |
+
}
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
|
1961 |
+
/**
|
1962 |
+
* Test for JetPack contact form
|
1963 |
+
*/
|
1964 |
+
function ct_grunion_contact_form_field_html($r, $field_label) {
|
1965 |
+
global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $apbct;
|
1966 |
+
|
1967 |
+
|
1968 |
+
|
1969 |
+
|
1970 |
+
if ($apbct->settings['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match("/[text|email]/i", $r)) {
|
1971 |
+
|
1972 |
+
// Looking for element name prefix
|
1973 |
+
$name_patched = false;
|
1974 |
+
foreach ($ct_jpcf_fields as $v) {
|
1975 |
+
if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
|
1976 |
+
$ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
|
1977 |
+
$name_patched = true;
|
1978 |
+
}
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
$r .= ct_add_hidden_fields($ct_checkjs_jpcf, true);
|
1982 |
+
$ct_jpcf_patched = true;
|
1983 |
+
}
|
1984 |
+
|
1985 |
+
return $r;
|
1986 |
+
}
|
1987 |
+
/**
|
1988 |
+
* Test for JetPack contact form
|
1989 |
+
*/
|
1990 |
+
function ct_contact_form_is_spam($form) {
|
1991 |
+
|
1992 |
+
global $ct_checkjs_jpcf, $apbct;
|
1993 |
+
|
1994 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
1995 |
+
return null;
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
$js_field_name = $ct_checkjs_jpcf;
|
1999 |
+
foreach ($_POST as $k => $v) {
|
2000 |
+
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
2001 |
+
$js_field_name = $k;
|
2002 |
+
}
|
2003 |
+
|
2004 |
+
$sender_email = null;
|
2005 |
+
$sender_nickname = null;
|
2006 |
+
$message = '';
|
2007 |
+
if (isset($form['comment_author_email']))
|
2008 |
+
$sender_email = $form['comment_author_email'];
|
2009 |
+
|
2010 |
+
if (isset($form['comment_author']))
|
2011 |
+
$sender_nickname = $form['comment_author'];
|
2012 |
+
|
2013 |
+
if (isset($form['comment_content']))
|
2014 |
+
$message = $form['comment_content'];
|
2015 |
+
|
2016 |
+
$base_call_result = apbct_base_call(
|
2017 |
+
array(
|
2018 |
+
'message' => $message,
|
2019 |
+
'sender_email' => $sender_email,
|
2020 |
+
'sender_nickname' => $sender_nickname,
|
2021 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
|
2022 |
+
'sender_info' => array('sender_url' => @$form['comment_author_url']),
|
2023 |
+
'js_on' => apbct_js_test($js_field_name, $_POST),
|
2024 |
+
)
|
2025 |
+
);
|
2026 |
+
$ct_result = $base_call_result['ct_result'];
|
2027 |
+
|
2028 |
+
if ($ct_result->allow == 0) {
|
2029 |
+
global $ct_comment;
|
2030 |
+
$ct_comment = $ct_result->comment;
|
2031 |
+
ct_die(null, null);
|
2032 |
+
exit;
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
return (bool) !$ct_result->allow;
|
2036 |
+
}
|
2037 |
+
|
2038 |
+
function ct_contact_form_is_spam_jetpack($is_spam,$form) {
|
2039 |
+
global $ct_checkjs_jpcf, $apbct;
|
2040 |
+
|
2041 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2042 |
+
return null;
|
2043 |
+
}
|
2044 |
+
|
2045 |
+
$js_field_name = $ct_checkjs_jpcf;
|
2046 |
+
foreach ($_POST as $k => $v) {
|
2047 |
+
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
2048 |
+
$js_field_name = $k;
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
$base_call_result = apbct_base_call(
|
2052 |
+
array(
|
2053 |
+
'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
|
2054 |
+
'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
|
2055 |
+
'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
|
2056 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
|
2057 |
+
'sender_info' => array('sender_url' => @$form['comment_author_url']),
|
2058 |
+
)
|
2059 |
+
);
|
2060 |
+
$ct_result = $base_call_result['ct_result'];
|
2061 |
+
|
2062 |
+
if ($ct_result->allow == 0) {
|
2063 |
+
global $ct_comment;
|
2064 |
+
$ct_comment = $ct_result->comment;
|
2065 |
+
ct_die(null, null);
|
2066 |
+
exit;
|
2067 |
+
}
|
2068 |
+
|
2069 |
+
return (bool) !$ct_result->allow;
|
2070 |
+
}
|
2071 |
+
|
2072 |
+
/**
|
2073 |
+
* Inserts anti-spam hidden to WP Maintenance Mode (wpmm)
|
2074 |
+
*/
|
2075 |
+
function apbct_form__wpmm__addField(){
|
2076 |
+
ct_add_hidden_fields('ct_checkjs', false, true, true);
|
2077 |
+
}
|
2078 |
+
|
2079 |
+
/**
|
2080 |
+
* Inserts anti-spam hidden to CF7
|
2081 |
+
*/
|
2082 |
+
function apbct_form__contactForm7__addField($html) {
|
2083 |
+
global $ct_checkjs_cf7, $apbct;
|
2084 |
+
|
2085 |
+
|
2086 |
+
|
2087 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2088 |
+
return $html;
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
$html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
|
2092 |
+
|
2093 |
+
return $html;
|
2094 |
+
}
|
2095 |
+
|
2096 |
+
/**
|
2097 |
+
* Test spam for Contact Fomr 7 (CF7) right before validation
|
2098 |
+
*
|
2099 |
+
* @global SpbcState $apbct
|
2100 |
+
* @param type $result
|
2101 |
+
* @param type $tags
|
2102 |
+
* @return type
|
2103 |
+
*/
|
2104 |
+
function apbct_form__contactForm7__tesSpam__before_validate($result = null, $tags = null) {
|
2105 |
+
global $apbct;
|
2106 |
+
|
2107 |
+
if ($result && method_exists($result, 'get_invalid_fields')){
|
2108 |
+
$invalid_fields = $result->get_invalid_fields();
|
2109 |
+
if(!empty($invalid_fields) && is_array($invalid_fields)){
|
2110 |
+
$apbct->validation_error = $invalid_fields[key($invalid_fields)]['reason'];
|
2111 |
+
apbct_form__contactForm7__testSpam(false);
|
2112 |
+
}
|
2113 |
+
}
|
2114 |
+
|
2115 |
+
return $result;
|
2116 |
+
}
|
2117 |
+
|
2118 |
+
/**
|
2119 |
+
* Test CF7 message for spam
|
2120 |
+
*/
|
2121 |
+
function apbct_form__contactForm7__testSpam($param) {
|
2122 |
+
|
2123 |
+
global $ct_checkjs_cf7, $apbct;
|
2124 |
+
|
2125 |
+
if(
|
2126 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
2127 |
+
$param == false && WPCF7_VERSION < '3.0.0' ||
|
2128 |
+
$param === true && WPCF7_VERSION >= '3.0.0' ||
|
2129 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
|
2130 |
+
apbct_exclusions_check__url() ||
|
2131 |
+
apbct_exclusions_check__ip() ||
|
2132 |
+
isset($apbct->cf7_checked)
|
2133 |
+
){
|
2134 |
+
return $param;
|
2135 |
+
}
|
2136 |
+
|
2137 |
+
$checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
|
2138 |
+
? apbct_js_test($ct_checkjs_cf7, $_POST)
|
2139 |
+
: apbct_js_test('ct_checkjs', $_COOKIE);
|
2140 |
+
|
2141 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
2142 |
+
|
2143 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2144 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2145 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2146 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
2147 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2148 |
+
if ($subject != '') {
|
2149 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2150 |
+
}
|
2151 |
+
|
2152 |
+
$base_call_result = apbct_base_call(
|
2153 |
+
array(
|
2154 |
+
'message' => $message,
|
2155 |
+
'sender_email' => $sender_email,
|
2156 |
+
'sender_nickname' => $sender_nickname,
|
2157 |
+
'js_on' => $checkjs,
|
2158 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'),
|
2159 |
+
'sender_info' => array(
|
2160 |
+
'form_validation' => !isset($apbct->validation_error)
|
2161 |
+
? null
|
2162 |
+
: json_encode(array(
|
2163 |
+
'validation_notice' => $apbct->validation_error,
|
2164 |
+
'page_url' => filter_input(INPUT_SERVER, 'HTTP_HOST') . filter_input(INPUT_SERVER, 'REQUEST_URI'),
|
2165 |
+
))
|
2166 |
+
),
|
2167 |
+
)
|
2168 |
+
);
|
2169 |
+
|
2170 |
+
$ct_result = $base_call_result['ct_result'];
|
2171 |
+
|
2172 |
+
// Change mail notification if license is out of date
|
2173 |
+
if($apbct->data['moderate'] == 0 &&
|
2174 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
2175 |
+
){
|
2176 |
+
$apbct->sender_email = $sender_email;
|
2177 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
2178 |
+
add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification');
|
2179 |
+
}
|
2180 |
+
|
2181 |
+
if ($ct_result->allow == 0) {
|
2182 |
+
|
2183 |
+
global $ct_cf7_comment;
|
2184 |
+
$ct_cf7_comment = $ct_result->comment;
|
2185 |
+
|
2186 |
+
add_filter('wpcf7_display_message', 'apbct_form__contactForm7__showResponse', 10, 2);
|
2187 |
+
|
2188 |
+
$param = WPCF7_VERSION >= '3.0.0' ? true : false;
|
2189 |
+
|
2190 |
+
}
|
2191 |
+
|
2192 |
+
$apbct->cf7_checked = true;
|
2193 |
+
|
2194 |
+
return $param;
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
/**
|
2198 |
+
* Changes CF7 status message
|
2199 |
+
* @param string $hook URL of hooked page
|
2200 |
+
*/
|
2201 |
+
function apbct_form__contactForm7__showResponse($message, $status = 'spam') {
|
2202 |
+
global $ct_cf7_comment;
|
2203 |
+
|
2204 |
+
if ($status == 'spam') {
|
2205 |
+
$message = $ct_cf7_comment;
|
2206 |
+
}
|
2207 |
+
|
2208 |
+
return $message;
|
2209 |
+
}
|
2210 |
+
|
2211 |
+
/**
|
2212 |
+
* Changes email notification for succes subscription for Contact Form 7
|
2213 |
+
*
|
2214 |
+
* @param array $component Arguments for email notification
|
2215 |
+
* @return array Arguments for email notification
|
2216 |
+
*/
|
2217 |
+
function apbct_form__contactForm7__changeMailNotification($component){
|
2218 |
+
|
2219 |
+
global $apbct;
|
2220 |
+
|
2221 |
+
$component['body'] =
|
2222 |
+
__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
|
2223 |
+
.PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2224 |
+
.PHP_EOL . 'IP: ' . $apbct->sender_ip
|
2225 |
+
.PHP_EOL . 'Email: ' . $apbct->sender_email
|
2226 |
+
.PHP_EOL . sprintf(
|
2227 |
+
__('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
|
2228 |
+
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token='.$apbct->user_token
|
2229 |
+
)
|
2230 |
+
.PHP_EOL . '---' . PHP_EOL . PHP_EOL
|
2231 |
+
.$component['body'];
|
2232 |
+
|
2233 |
+
return (array) $component;
|
2234 |
+
}
|
2235 |
+
|
2236 |
+
/**
|
2237 |
+
* Test Ninja Forms message for spam
|
2238 |
+
*
|
2239 |
+
* @global SpbcState $apbct
|
2240 |
+
* @return void
|
2241 |
+
*/
|
2242 |
+
function apbct_form__ninjaForms__testSpam() {
|
2243 |
+
|
2244 |
+
global $apbct;
|
2245 |
+
|
2246 |
+
if(
|
2247 |
+
$apbct->settings['contact_forms_test'] == 0
|
2248 |
+
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
2249 |
+
|| apbct_exclusions_check__url()
|
2250 |
+
){
|
2251 |
+
return;
|
2252 |
+
}
|
2253 |
+
|
2254 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
2255 |
+
|
2256 |
+
// Choosing between POST and GET
|
2257 |
+
$params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
|
2258 |
+
|
2259 |
+
$sender_email = ($params['email'] ? $params['email'] : '');
|
2260 |
+
$sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
|
2261 |
+
$subject = ($params['subject'] ? $params['subject'] : '');
|
2262 |
+
$message = ($params['message'] ? $params['message'] : array());
|
2263 |
+
if ($subject != '') {
|
2264 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2265 |
+
}
|
2266 |
+
|
2267 |
+
//Ninja Forms xml fix
|
2268 |
+
foreach ($message as $key => $value){
|
2269 |
+
if (strpos($value, '<xml>') !== false)
|
2270 |
+
unset($message[$key]);
|
2271 |
+
}
|
2272 |
+
|
2273 |
+
$base_call_result = apbct_base_call(
|
2274 |
+
array(
|
2275 |
+
'message' => $message,
|
2276 |
+
'sender_email' => $sender_email,
|
2277 |
+
'sender_nickname' => $sender_nickname,
|
2278 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_ninja_froms'),
|
2279 |
+
'js_on' => $checkjs,
|
2280 |
+
)
|
2281 |
+
);
|
2282 |
+
$ct_result = $base_call_result['ct_result'];
|
2283 |
+
|
2284 |
+
// Change mail notification if license is out of date
|
2285 |
+
if($apbct->data['moderate'] == 0 &&
|
2286 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
2287 |
+
){
|
2288 |
+
$apbct->sender_email = $sender_email;
|
2289 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
2290 |
+
add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
|
2291 |
+
}
|
2292 |
+
|
2293 |
+
if ($ct_result->allow == 0) {
|
2294 |
+
|
2295 |
+
// We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
|
2296 |
+
$apbct->response = $ct_result->comment;
|
2297 |
+
add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
|
2298 |
+
}
|
2299 |
+
}
|
2300 |
+
|
2301 |
+
function apbct_form__ninjaForms__changeResponse( $data ) {
|
2302 |
+
|
2303 |
+
global $apbct;
|
2304 |
+
|
2305 |
+
// Show error message below field found by ID
|
2306 |
+
if(array_key_exists('email', $data['fields_by_key'])){
|
2307 |
+
// Find ID of EMAIL field
|
2308 |
+
$nf_field_id = $data['fields_by_key']['email']['id'];
|
2309 |
+
}else{
|
2310 |
+
// Find ID of last field (usually SUBMIT)
|
2311 |
+
$nf_field_id = array_pop(array_keys($data['fields']));
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
// Below is modified NJ logic
|
2315 |
+
$error = array(
|
2316 |
+
'fields' => array(
|
2317 |
+
$nf_field_id => $apbct->response,
|
2318 |
+
),
|
2319 |
+
);
|
2320 |
+
|
2321 |
+
$response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
|
2322 |
+
|
2323 |
+
die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
|
2324 |
+
|
2325 |
+
}
|
2326 |
+
|
2327 |
+
function apbct_form__seedprod_coming_soon__testSpam() {
|
2328 |
+
|
2329 |
+
global $apbct;
|
2330 |
+
|
2331 |
+
if(
|
2332 |
+
$apbct->settings['contact_forms_test'] == 0
|
2333 |
+
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
2334 |
+
|| apbct_exclusions_check__url()
|
2335 |
+
){
|
2336 |
+
return;
|
2337 |
+
}
|
2338 |
+
|
2339 |
+
$ct_temp_msg_data = ct_get_fields_any($_REQUEST);
|
2340 |
+
|
2341 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2342 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2343 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2344 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2345 |
+
if ($subject != '') {
|
2346 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2347 |
+
}
|
2348 |
+
|
2349 |
+
$post_info['comment_type'] = 'contact_form_wordpress_seedprod_coming_soon';
|
2350 |
+
|
2351 |
+
$base_call_result = apbct_base_call(
|
2352 |
+
array(
|
2353 |
+
'message' => $message,
|
2354 |
+
'sender_email' => $sender_email,
|
2355 |
+
'sender_nickname' => $sender_nickname,
|
2356 |
+
'post_info' => $post_info,
|
2357 |
+
)
|
2358 |
+
);
|
2359 |
+
|
2360 |
+
$ct_result = $base_call_result['ct_result'];
|
2361 |
+
if ($ct_result->allow == 0) {
|
2362 |
+
global $ct_comment;
|
2363 |
+
$ct_comment = $ct_result->comment;
|
2364 |
+
|
2365 |
+
$response = array(
|
2366 |
+
'status' => 200,
|
2367 |
+
'html' => "<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>"
|
2368 |
+
);
|
2369 |
+
|
2370 |
+
echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
|
2371 |
+
exit();
|
2372 |
+
}
|
2373 |
+
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
/**
|
2377 |
+
* Changes email notification for succes subscription for Ninja Forms
|
2378 |
+
*
|
2379 |
+
* @param string $message Body of email notification
|
2380 |
+
* @return string Body for email notification
|
2381 |
+
*/
|
2382 |
+
function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
|
2383 |
+
|
2384 |
+
global $apbct;
|
2385 |
+
|
2386 |
+
if($action_settings['to'] !== $apbct->sender_email){
|
2387 |
+
|
2388 |
+
$message .= wpautop(PHP_EOL . '---'
|
2389 |
+
.PHP_EOL
|
2390 |
+
.__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
|
2391 |
+
.PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2392 |
+
.PHP_EOL . 'IP: ' . $apbct->sender_ip
|
2393 |
+
.PHP_EOL . 'Email: ' . $apbct->sender_email
|
2394 |
+
.PHP_EOL .
|
2395 |
+
__('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
|
2396 |
+
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
|
2397 |
+
);
|
2398 |
+
}
|
2399 |
+
|
2400 |
+
return $message;
|
2401 |
+
}
|
2402 |
+
|
2403 |
+
/**
|
2404 |
+
* Inserts anti-spam hidden to WPForms
|
2405 |
+
*
|
2406 |
+
* @global SpbcState $apbct
|
2407 |
+
* @return void
|
2408 |
+
*/
|
2409 |
+
function apbct_form__WPForms__addField($form_data, $some, $title, $description, $errors) {
|
2410 |
+
|
2411 |
+
global $apbct;
|
2412 |
+
|
2413 |
+
if($apbct->settings['contact_forms_test'] == 1)
|
2414 |
+
ct_add_hidden_fields('checkjs_wpforms', false);
|
2415 |
+
|
2416 |
+
}
|
2417 |
+
|
2418 |
+
/**
|
2419 |
+
* Gather fields data from submission and store it
|
2420 |
+
*
|
2421 |
+
* @param array $entry
|
2422 |
+
* @param $form
|
2423 |
+
*
|
2424 |
+
* @return array
|
2425 |
+
* @global SpbcState $apbct
|
2426 |
+
*/
|
2427 |
+
function apbct_from__WPForms__gatherData($entry, $form){
|
2428 |
+
|
2429 |
+
global $apbct;
|
2430 |
+
|
2431 |
+
$data = array();
|
2432 |
+
foreach($entry['fields'] as $key => $val){
|
2433 |
+
$true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
|
2434 |
+
$true_key = $true_key ? $true_key : $key;
|
2435 |
+
$data[$true_key] = $val;
|
2436 |
+
} unset($key, $val);
|
2437 |
+
|
2438 |
+
$apbct->form_data = $data;
|
2439 |
+
|
2440 |
+
return $entry;
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
/**
|
2444 |
+
* Adding error to form entry if message is spam
|
2445 |
+
* Call spam test from here
|
2446 |
+
*
|
2447 |
+
* @param array $errors
|
2448 |
+
* @param array $form_data
|
2449 |
+
* @return array
|
2450 |
+
*/
|
2451 |
+
function apbct_form__WPForms__showResponse($errors, $form_data) {
|
2452 |
+
|
2453 |
+
if(empty($errors) || ( isset($form_data['id'], $errors[$form_data['id']]) && !count($errors[$form_data['id']]) ) ){
|
2454 |
+
|
2455 |
+
$spam_comment = apbct_form__WPForms__testSpam();
|
2456 |
+
|
2457 |
+
$filed_id = $form_data && !empty($form_data['fields']) && is_array($form_data['fields'])
|
2458 |
+
? key($form_data['fields'])
|
2459 |
+
: 0;
|
2460 |
+
|
2461 |
+
if($spam_comment)
|
2462 |
+
$errors[ $form_data['id'] ][ $filed_id ] = $spam_comment;
|
2463 |
+
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
return $errors;
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
/**
|
2470 |
+
* Test WPForms message for spam
|
2471 |
+
* Doesn't hooked anywhere.
|
2472 |
+
* Called directly from apbct_form__WPForms__showResponse()
|
2473 |
+
*
|
2474 |
+
* @global SpbcState $apbct
|
2475 |
+
* @global array $apbct->form_data Contains form data
|
2476 |
+
* @param array $errors Array of errors to write false result in
|
2477 |
+
* @return void|array|null
|
2478 |
+
*/
|
2479 |
+
function apbct_form__WPForms__testSpam() {
|
2480 |
+
|
2481 |
+
global $apbct;
|
2482 |
+
|
2483 |
+
if(
|
2484 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
2485 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
2486 |
+
){
|
2487 |
+
return;
|
2488 |
+
}
|
2489 |
+
|
2490 |
+
$checkjs = apbct_js_test('checkjs_wpforms', $_POST);
|
2491 |
+
|
2492 |
+
$params = ct_get_fields_any($apbct->form_data);
|
2493 |
+
|
2494 |
+
$sender_email = ($params['email'] ? $params['email'] : '');
|
2495 |
+
$sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
|
2496 |
+
$subject = ($params['subject'] ? $params['subject'] : '');
|
2497 |
+
$message = ($params['message'] ? $params['message'] : array());
|
2498 |
+
if ($subject != '') {
|
2499 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2500 |
+
}
|
2501 |
+
|
2502 |
+
$base_call_result = apbct_base_call(
|
2503 |
+
array(
|
2504 |
+
'message' => $message,
|
2505 |
+
'sender_email' => $sender_email,
|
2506 |
+
'sender_nickname' => $sender_nickname,
|
2507 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_wp_forms'),
|
2508 |
+
'js_on' => $checkjs,
|
2509 |
+
)
|
2510 |
+
);
|
2511 |
+
$ct_result = $base_call_result['ct_result'];
|
2512 |
+
|
2513 |
+
// Change mail notification if license is out of date
|
2514 |
+
if($apbct->data['moderate'] == 0 &&
|
2515 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
2516 |
+
){
|
2517 |
+
$apbct->sender_email = $sender_email;
|
2518 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
2519 |
+
add_filter('wpforms_email_message', 'apbct_form__WPForms__changeMailNotification', 100, 2);
|
2520 |
+
}
|
2521 |
+
|
2522 |
+
if ($ct_result->allow == 0){
|
2523 |
+
return $ct_result->comment;
|
2524 |
+
}
|
2525 |
+
|
2526 |
+
return null;
|
2527 |
+
|
2528 |
+
}
|
2529 |
+
|
2530 |
+
/**
|
2531 |
+
* Changes email notification for succes subscription for Ninja Forms
|
2532 |
+
*
|
2533 |
+
* @param string $message Body of email notification
|
2534 |
+
* @param WPForms_WP_Emails $wpforms_email WPForms email class object
|
2535 |
+
* @return string Body for email notification
|
2536 |
+
*/
|
2537 |
+
function apbct_form__WPForms__changeMailNotification($message, $wpforms_email){
|
2538 |
+
|
2539 |
+
global $apbct;
|
2540 |
+
|
2541 |
+
$message = str_replace('</html>', '', $message);
|
2542 |
+
$message = str_replace('</body>', '', $message);
|
2543 |
+
$message .= wpautop(PHP_EOL . '---'
|
2544 |
+
.PHP_EOL
|
2545 |
+
.__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
|
2546 |
+
.PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2547 |
+
.PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
|
2548 |
+
.PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
|
2549 |
+
.PHP_EOL . sprintf(
|
2550 |
+
__('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
|
2551 |
+
'<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_activate_antispam" target="_blank">',
|
2552 |
+
'</a>'
|
2553 |
+
))
|
2554 |
+
.'</body></html>';
|
2555 |
+
|
2556 |
+
return $message;
|
2557 |
+
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
/*
|
2561 |
+
* QuForms check spam
|
2562 |
+
* works with singl-paged forms
|
2563 |
+
* and with multi-paged forms - check only last step of the forms
|
2564 |
+
*/
|
2565 |
+
function ct_quform_post_validate($result, $form) {
|
2566 |
+
|
2567 |
+
if ( $form->hasPages() ) {
|
2568 |
+
$comment_type = 'contact_form_wordpress_quforms_multipage';
|
2569 |
+
} else {
|
2570 |
+
$comment_type = 'contact_form_wordpress_quforms_singlepage';
|
2571 |
+
}
|
2572 |
+
|
2573 |
+
$ct_temp_msg_data = ct_get_fields_any( $form->getValues() );
|
2574 |
+
// @ToDo If we have several emails at the form - will be used only the first detected!
|
2575 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2576 |
+
|
2577 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
2578 |
+
$base_call_result = apbct_base_call(
|
2579 |
+
array(
|
2580 |
+
'message' => $form->getValues(),
|
2581 |
+
'sender_email' => $sender_email,
|
2582 |
+
'post_info' => array('comment_type' => $comment_type),
|
2583 |
+
'js_on' => $checkjs,
|
2584 |
+
)
|
2585 |
+
);
|
2586 |
+
|
2587 |
+
$ct_result = $base_call_result['ct_result'];
|
2588 |
+
if ($ct_result->allow == 0) {
|
2589 |
+
die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
|
2590 |
+
} else {
|
2591 |
+
return $result;
|
2592 |
+
}
|
2593 |
+
|
2594 |
+
return $result;
|
2595 |
+
|
2596 |
+
}
|
2597 |
+
|
2598 |
+
/**
|
2599 |
+
* Inserts anti-spam hidden to Fast Secure contact form
|
2600 |
+
*/
|
2601 |
+
function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
|
2602 |
+
$string .= ct_add_hidden_fields('ct_checkjs', true);
|
2603 |
+
return $string;
|
2604 |
+
}
|
2605 |
+
|
2606 |
+
/**
|
2607 |
+
* Test for Fast Secure contact form
|
2608 |
+
*/
|
2609 |
+
function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
2610 |
+
global $apbct, $cleantalk_executed;
|
2611 |
+
|
2612 |
+
if (!empty($form_errors))
|
2613 |
+
return $form_errors;
|
2614 |
+
|
2615 |
+
if ($apbct->settings['contact_forms_test'] == 0)
|
2616 |
+
return $form_errors;
|
2617 |
+
|
2618 |
+
// Skip processing because data already processed.
|
2619 |
+
if ($cleantalk_executed) {
|
2620 |
+
return $form_errors;
|
2621 |
+
}
|
2622 |
+
|
2623 |
+
//getting info from custom fields
|
2624 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
2625 |
+
|
2626 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2627 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2628 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2629 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
2630 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2631 |
+
if($subject != '') {
|
2632 |
+
$message['subject'] = $subject;
|
2633 |
+
}
|
2634 |
+
|
2635 |
+
$base_call_result = apbct_base_call(
|
2636 |
+
array(
|
2637 |
+
'message' => $message,
|
2638 |
+
'sender_email' => $sender_email,
|
2639 |
+
'sender_nickname' => $sender_nickname,
|
2640 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
|
2641 |
+
'js_on' => apbct_js_test('ct_checkjs', $_POST),
|
2642 |
+
)
|
2643 |
+
);
|
2644 |
+
|
2645 |
+
$ct_result = $base_call_result['ct_result'];
|
2646 |
+
|
2647 |
+
$cleantalk_executed = true;
|
2648 |
+
|
2649 |
+
if ($ct_result->allow == 0) {
|
2650 |
+
global $ct_comment;
|
2651 |
+
$ct_comment = $ct_result->comment;
|
2652 |
+
ct_die(null, null);
|
2653 |
+
exit;
|
2654 |
+
}
|
2655 |
+
|
2656 |
+
return $form_errors;
|
2657 |
+
}
|
2658 |
+
|
2659 |
+
/**
|
2660 |
+
* Notice for commentators which comment has automatically approved by plugin
|
2661 |
+
* @param string $hook URL of hooked page
|
2662 |
+
*/
|
2663 |
+
function ct_comment_text($comment_text) {
|
2664 |
+
global $comment, $ct_approved_request_id_label;
|
2665 |
+
|
2666 |
+
if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
|
2667 |
+
$ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
2668 |
+
|
2669 |
+
if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
|
2670 |
+
$comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
|
2671 |
+
}
|
2672 |
+
}
|
2673 |
+
|
2674 |
+
return $comment_text;
|
2675 |
+
}
|
2676 |
+
|
2677 |
+
|
2678 |
+
/**
|
2679 |
+
* Checks WordPress Landing Pages raw $_POST values
|
2680 |
+
*/
|
2681 |
+
function ct_check_wplp(){
|
2682 |
+
|
2683 |
+
global $ct_wplp_result_label, $apbct;
|
2684 |
+
|
2685 |
+
if (!isset($_COOKIE[$ct_wplp_result_label])) {
|
2686 |
+
// First AJAX submit of WPLP form
|
2687 |
+
if ($apbct->settings['contact_forms_test'] == 0)
|
2688 |
+
return;
|
2689 |
+
|
2690 |
+
$post_info['comment_type'] = 'feedback';
|
2691 |
+
$post_info = json_encode($post_info);
|
2692 |
+
if ($post_info === false)
|
2693 |
+
$post_info = '';
|
2694 |
+
|
2695 |
+
$sender_email = '';
|
2696 |
+
foreach ($_POST as $v) {
|
2697 |
+
if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
|
2698 |
+
$sender_email = $v;
|
2699 |
+
break;
|
2700 |
+
}
|
2701 |
+
}
|
2702 |
+
|
2703 |
+
$message = '';
|
2704 |
+
if(array_key_exists('form_input_values', $_POST)){
|
2705 |
+
$form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
|
2706 |
+
if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
|
2707 |
+
$message = $form_input_values['null'];
|
2708 |
+
} else if (array_key_exists('null', $_POST)) {
|
2709 |
+
$message = $_POST['null'];
|
2710 |
+
}
|
2711 |
+
|
2712 |
+
$base_call_result = apbct_base_call(
|
2713 |
+
array(
|
2714 |
+
'message' => $message,
|
2715 |
+
'sender_email' => $sender_email,
|
2716 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_wplp'),
|
2717 |
+
)
|
2718 |
+
);
|
2719 |
+
|
2720 |
+
$ct_result = $base_call_result['ct_result'];
|
2721 |
+
|
2722 |
+
if ($ct_result->allow == 0) {
|
2723 |
+
$cleantalk_comment = $ct_result->comment;
|
2724 |
+
} else {
|
2725 |
+
$cleantalk_comment = 'OK';
|
2726 |
+
}
|
2727 |
+
|
2728 |
+
setcookie($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
|
2729 |
+
} else {
|
2730 |
+
// Next POST/AJAX submit(s) of same WPLP form
|
2731 |
+
$cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
|
2732 |
+
}
|
2733 |
+
if ($cleantalk_comment !== 'OK')
|
2734 |
+
ct_die_extended($cleantalk_comment);
|
2735 |
+
}
|
2736 |
+
|
2737 |
+
/**
|
2738 |
+
* Places a hidding field to Gravity forms.
|
2739 |
+
* @return string
|
2740 |
+
*/
|
2741 |
+
function apbct_form__gravityForms__addField($form_string, $form){
|
2742 |
+
$ct_hidden_field = 'ct_checkjs';
|
2743 |
+
|
2744 |
+
// Do not add a hidden field twice.
|
2745 |
+
if (preg_match("/$ct_hidden_field/", $form_string)) {
|
2746 |
+
return $form_string;
|
2747 |
+
}
|
2748 |
+
|
2749 |
+
$search = "</form>";
|
2750 |
+
|
2751 |
+
// Adding JS code
|
2752 |
+
$js_code = ct_add_hidden_fields($ct_hidden_field, true, false);
|
2753 |
+
$form_string = str_replace($search, $js_code . $search, $form_string);
|
2754 |
+
|
2755 |
+
// Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
|
2756 |
+
$append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
|
2757 |
+
$form_string = str_replace($search, $append_string.$search, $form_string);
|
2758 |
+
|
2759 |
+
return $form_string;
|
2760 |
+
}
|
2761 |
+
|
2762 |
+
/**
|
2763 |
+
* Gravity forms anti-spam test.
|
2764 |
+
* @return boolean
|
2765 |
+
*/
|
2766 |
+
function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
|
2767 |
+
|
2768 |
+
global $apbct, $cleantalk_executed, $ct_gform_is_spam, $ct_gform_response;
|
2769 |
+
|
2770 |
+
if (
|
2771 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
2772 |
+
$is_spam ||
|
2773 |
+
$cleantalk_executed // Return unchanged result if the submission was already tested.
|
2774 |
+
)
|
2775 |
+
return $is_spam;
|
2776 |
+
|
2777 |
+
$ct_temp = array();
|
2778 |
+
foreach($entry as $key => $value){
|
2779 |
+
if(is_numeric($key))
|
2780 |
+
$ct_temp[$key]=$value;
|
2781 |
+
} unset($key, $value);
|
2782 |
+
|
2783 |
+
$ct_temp_msg_data = ct_get_fields_any($ct_temp);
|
2784 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2785 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2786 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2787 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
2788 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2789 |
+
|
2790 |
+
// Adding 'input_' to every field /Gravity Forms fix/
|
2791 |
+
$message = array_flip($message);
|
2792 |
+
foreach($message as &$value){
|
2793 |
+
$value = 'input_'.$value;
|
2794 |
+
} unset($value);
|
2795 |
+
$message = array_flip($message);
|
2796 |
+
|
2797 |
+
if($subject != '')
|
2798 |
+
$message['subject'] = $subject;
|
2799 |
+
|
2800 |
+
$checkjs = apbct_js_test('ct_checkjs', $_POST)
|
2801 |
+
? apbct_js_test('ct_checkjs', $_POST)
|
2802 |
+
: apbct_js_test('ct_checkjs', $_COOKIE);
|
2803 |
+
|
2804 |
+
$base_call_result = apbct_base_call(
|
2805 |
+
array(
|
2806 |
+
'message' => $message,
|
2807 |
+
'sender_email' => $sender_email,
|
2808 |
+
'sender_nickname' => $sender_nickname,
|
2809 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_gravity_forms'),
|
2810 |
+
'js_on' => $checkjs,
|
2811 |
+
)
|
2812 |
+
);
|
2813 |
+
|
2814 |
+
$ct_result = $base_call_result['ct_result'];
|
2815 |
+
if ($ct_result->allow == 0) {
|
2816 |
+
$is_spam = true;
|
2817 |
+
$ct_gform_is_spam = true;
|
2818 |
+
$ct_gform_response = $ct_result->comment;
|
2819 |
+
}
|
2820 |
+
|
2821 |
+
return $is_spam;
|
2822 |
+
}
|
2823 |
+
|
2824 |
+
function apbct_form__gravityForms__showResponse( $confirmation, $form, $entry, $ajax ){
|
2825 |
+
|
2826 |
+
global $ct_gform_is_spam, $ct_gform_response;
|
2827 |
+
|
2828 |
+
if(!empty($ct_gform_is_spam)){
|
2829 |
+
$confirmation = '<a id="gf_'.$form['id'].'" class="gform_anchor" ></a><div id="gform_confirmation_wrapper_'.$form['id'].'" class="gform_confirmation_wrapper "><div id="gform_confirmation_message_'.$form['id'].'" class="gform_confirmation_message_'.$form['id'].' gform_confirmation_message"><font style="color: red">'.$ct_gform_response.'</font></div></div>';
|
2830 |
+
}
|
2831 |
+
|
2832 |
+
return $confirmation;
|
2833 |
+
}
|
2834 |
+
|
2835 |
+
/**
|
2836 |
+
* Test S2member registration
|
2837 |
+
* @return array with errors
|
2838 |
+
*/
|
2839 |
+
function ct_s2member_registration_test($post_key) {
|
2840 |
+
|
2841 |
+
global $apbct;
|
2842 |
+
|
2843 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
2844 |
+
return null;
|
2845 |
+
}
|
2846 |
+
|
2847 |
+
$sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
|
2848 |
+
$sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
|
2849 |
+
|
2850 |
+
//Making a call
|
2851 |
+
$base_call_result = apbct_base_call(
|
2852 |
+
array(
|
2853 |
+
'sender_email' => $sender_email,
|
2854 |
+
'sender_nickname' => $sender_nickname,
|
2855 |
+
),
|
2856 |
+
true
|
2857 |
+
);
|
2858 |
+
$ct_result = $base_call_result['ct_result'];
|
2859 |
+
|
2860 |
+
if ($ct_result->allow == 0) {
|
2861 |
+
ct_die_extended($ct_result->comment);
|
2862 |
+
}
|
2863 |
+
|
2864 |
+
return true;
|
2865 |
+
}
|
2866 |
+
|
2867 |
+
function apbct_form__the7_contact_form() {
|
2868 |
+
|
2869 |
+
global $cleantalk_executed;
|
2870 |
+
|
2871 |
+
if ( check_ajax_referer( 'dt_contact_form', 'nonce', false ) && isset($_POST) ) {
|
2872 |
+
|
2873 |
+
$post_info['comment_type'] = 'contact_the7_theme_contact_form';
|
2874 |
+
|
2875 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
2876 |
+
|
2877 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2878 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2879 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2880 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
2881 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2882 |
+
if ($subject != '') {
|
2883 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2884 |
+
}
|
2885 |
+
|
2886 |
+
// Skip submission if no data found
|
2887 |
+
if ($sender_email === ''|| !$contact_form) {
|
2888 |
+
return false;
|
2889 |
+
}
|
2890 |
+
$cleantalk_executed = true;
|
2891 |
+
|
2892 |
+
$base_call_result = apbct_base_call(
|
2893 |
+
array(
|
2894 |
+
'message' => $message,
|
2895 |
+
'sender_email' => $sender_email,
|
2896 |
+
'sender_nickname' => $sender_nickname,
|
2897 |
+
'post_info' => $post_info,
|
2898 |
+
)
|
2899 |
+
);
|
2900 |
+
|
2901 |
+
$ct_result = $base_call_result['ct_result'];
|
2902 |
+
if ($ct_result->allow == 0) {
|
2903 |
+
|
2904 |
+
$response = json_encode(
|
2905 |
+
array(
|
2906 |
+
'success' => false ,
|
2907 |
+
'errors' => $ct_result->comment,
|
2908 |
+
'nonce' => wp_create_nonce( 'dt_contact_form' )
|
2909 |
+
)
|
2910 |
+
);
|
2911 |
+
|
2912 |
+
// response output
|
2913 |
+
header( "Content-Type: application/json" );
|
2914 |
+
echo $response;
|
2915 |
+
|
2916 |
+
// IMPORTANT: don't forget to "exit"
|
2917 |
+
exit;
|
2918 |
+
|
2919 |
+
}
|
2920 |
+
|
2921 |
+
}
|
2922 |
+
|
2923 |
+
}
|
2924 |
+
|
2925 |
+
/**
|
2926 |
+
* General test for any contact form
|
2927 |
+
*/
|
2928 |
+
function ct_contact_form_validate() {
|
2929 |
+
|
2930 |
+
global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
|
2931 |
+
|
2932 |
+
// Exclusios common function
|
2933 |
+
if ( apbct_exclusions_check(__FUNCTION__) )
|
2934 |
+
return null;
|
2935 |
+
|
2936 |
+
if (@sizeof($_POST)==0 ||
|
2937 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
|
2938 |
+
(isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
2939 |
+
(isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
|
2940 |
+
strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'lostpassword') !== false ||
|
2941 |
+
(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/wp-admin/')!== false && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
|
2942 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'wp-login.php')!==false||
|
2943 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'wp-comments-post.php')!==false ||
|
2944 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'?provider=facebook&')!==false ||
|
2945 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'reset-password/')!==false || // Ticket #13668. Password reset.
|
2946 |
+
strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'/wp-admin/') !== false ||
|
2947 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/login/')!==false ||
|
2948 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), '/my-account/edit-account/')!==false || // WooCommerce edit account page
|
2949 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), '/my-account/edit-address/')!==false || // WooCommerce edit account page
|
2950 |
+
(isset($_POST['action']) && $_POST['action'] == 'save_account_details') || // WooCommerce edit account action
|
2951 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), '/peepsoajax/profilefieldsajax.validate_register')!== false ||
|
2952 |
+
isset($_GET['ptype']) && $_GET['ptype']=='login' ||
|
2953 |
+
isset($_POST['ct_checkjs_register_form']) ||
|
2954 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
|
2955 |
+
$apbct->settings['general_contact_forms_test'] == 0 ||
|
2956 |
+
isset($_POST['bbp_topic_content']) ||
|
2957 |
+
isset($_POST['bbp_reply_content']) ||
|
2958 |
+
isset($_POST['fscf_submitted']) ||
|
2959 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/wc-api/')!==false ||
|
2960 |
+
isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
|
2961 |
+
isset($_POST[$ct_checkjs_frm]) && $apbct->settings['contact_forms_test'] == 1 ||// Formidable forms
|
2962 |
+
isset($_POST['comment_post_ID']) || // The comment form
|
2963 |
+
isset($_GET['for']) ||
|
2964 |
+
(isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
|
2965 |
+
(isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
|
2966 |
+
((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
|
2967 |
+
(isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
|
2968 |
+
(isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
|
2969 |
+
(isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
|
2970 |
+
isset($_POST['gform_submit']) || //Gravity form
|
2971 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), 'wc-ajax=get_refreshed_fragments') !== false ||
|
2972 |
+
(isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1) ||
|
2973 |
+
(isset($_POST['contact_tags']) && strpos($_POST['contact_tags'], 'MBR:') !== false) ||
|
2974 |
+
(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), 'bizuno.php') && !empty($_POST['bizPass'])) ||
|
2975 |
+
(strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'my-dashboard/') !== false) || // ticket_id=7885
|
2976 |
+
isset($_POST['slm_action'], $_POST['license_key'], $_POST['secret_key'], $_POST['registered_domain']) || // ticket_id=9122
|
2977 |
+
(isset($_POST['wpforms']['submit']) && $_POST['wpforms']['submit'] == 'wpforms-submit') || // WPForms
|
2978 |
+
(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form') || // JetPack
|
2979 |
+
(isset($_POST['action']) && $_POST['action'] == 'bbp-update-user') || //BBP update user info page
|
2980 |
+
(strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'?wc-api=WC_Gateway_Transferuj') !== false) || //WC Gateway
|
2981 |
+
(isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
|
2982 |
+
(strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'lost-password') !== false) || //Skip lost-password form check
|
2983 |
+
(isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
|
2984 |
+
(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'membership-login')!==false ) || // Skip login form
|
2985 |
+
(isset($_GET['cookie-state-change'])) || //skip GDPR plugin
|
2986 |
+
(filter_input(INPUT_SERVER, 'HTTP_USER_AGENT') == 'MailChimp' && strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), 'mc4wp-sync-api/webhook-listener') !== false) || // Mailchimp webhook skip
|
2987 |
+
(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'researcher-log-in')!==false ) || // Skip login form
|
2988 |
+
(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves')!==false ) || // Skip admin save callback
|
2989 |
+
(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'?profile_tab=postjobs')!==false ) || // Skip post vacancies
|
2990 |
+
(isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
|
2991 |
+
(isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
|
2992 |
+
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
2993 |
+
(isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
|
2994 |
+
isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
|
2995 |
+
(isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
|
2996 |
+
(isset($_POST['action']) && $_POST['action'] == 'wilcity_login') // Exception for login form. From Analysis uid=430898
|
2997 |
+
) {
|
2998 |
+
return null;
|
2999 |
+
}
|
3000 |
+
|
3001 |
+
// Do not execute anti-spam test for logged in users.
|
3002 |
+
if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['protect_logged_in'] != 1)
|
3003 |
+
return null;
|
3004 |
+
|
3005 |
+
$post_info['comment_type'] = 'feedback_general_contact_form';
|
3006 |
+
|
3007 |
+
// Skip the test if it's WooCommerce and the checkout test unset
|
3008 |
+
if(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), 'wc-ajax=checkout') !== false ||
|
3009 |
+
(isset($_POST['_wp_http_referer']) && strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), 'wc-ajax=update_order_review') !== false) ||
|
3010 |
+
!empty($_POST['woocommerce_checkout_place_order']) ||
|
3011 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'), 'wc-ajax=wc_ppec_start_checkout') !== false
|
3012 |
+
){
|
3013 |
+
if($apbct->settings['wc_checkout_test'] == 0){
|
3014 |
+
return null;
|
3015 |
+
}
|
3016 |
+
$post_info['comment_type'] = 'order';
|
3017 |
+
}
|
3018 |
+
|
3019 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
3020 |
+
|
3021 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
3022 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
3023 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
3024 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
3025 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
3026 |
+
if ($subject != '') {
|
3027 |
+
$message = array_merge(array('subject' => $subject), $message);
|
3028 |
+
}
|
3029 |
+
|
3030 |
+
// Skip submission if no data found
|
3031 |
+
if ($sender_email === ''|| !$contact_form) {
|
3032 |
+
return false;
|
3033 |
+
}
|
3034 |
+
$cleantalk_executed=true;
|
3035 |
+
|
3036 |
+
if(isset($_POST['TellAFriend_Link'])){
|
3037 |
+
$tmp = $_POST['TellAFriend_Link'];
|
3038 |
+
unset($_POST['TellAFriend_Link']);
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
$base_call_result = apbct_base_call(
|
3042 |
+
array(
|
3043 |
+
'message' => $message,
|
3044 |
+
'sender_email' => $sender_email,
|
3045 |
+
'sender_nickname' => $sender_nickname,
|
3046 |
+
'post_info' => $post_info,
|
3047 |
+
)
|
3048 |
+
);
|
3049 |
+
|
3050 |
+
if(isset($_POST['TellAFriend_Link'])){
|
3051 |
+
$_POST['TellAFriend_Link']=$tmp;
|
3052 |
+
}
|
3053 |
+
|
3054 |
+
$ct_result = $base_call_result['ct_result'];
|
3055 |
+
if ($ct_result->allow == 0) {
|
3056 |
+
|
3057 |
+
// Recognize contact form an set it's name to $contact_form to use later
|
3058 |
+
$contact_form = null;
|
3059 |
+
foreach($_POST as $param => $value){
|
3060 |
+
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
3061 |
+
$contact_form = 'contact_form_divi_theme';
|
3062 |
+
$contact_form_additional = str_replace($param, '', $param);
|
3063 |
+
}
|
3064 |
+
if(strpos($param, 'avia_generated_form') === 0){
|
3065 |
+
$contact_form = 'contact_form_enfold_theme';
|
3066 |
+
$contact_form_additional = str_replace('avia_generated_form', '', $param);
|
3067 |
+
}
|
3068 |
+
if(!empty($contact_form))
|
3069 |
+
break;
|
3070 |
+
}
|
3071 |
+
|
3072 |
+
$ajax_call = false;
|
3073 |
+
if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
|
3074 |
+
) {
|
3075 |
+
$ajax_call = true;
|
3076 |
+
}
|
3077 |
+
if ($ajax_call) {
|
3078 |
+
echo $ct_result->comment;
|
3079 |
+
} else {
|
3080 |
+
|
3081 |
+
global $ct_comment;
|
3082 |
+
$ct_comment = $ct_result->comment;
|
3083 |
+
if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add'){
|
3084 |
+
$result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
|
3085 |
+
header("Content-Type: application/json");
|
3086 |
+
print json_encode($result);
|
3087 |
+
die();
|
3088 |
+
|
3089 |
+
}else if(isset($_POST['TellAFriend_email'])){
|
3090 |
+
echo $ct_result->comment;
|
3091 |
+
die();
|
3092 |
+
|
3093 |
+
}else if(isset($_POST['gform_submit'])){ // Gravity forms submission
|
3094 |
+
$response = sprintf("<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
|
3095 |
+
gform_confirmation_message'>%s</div></div></body></html>",
|
3096 |
+
$ct_result->comment
|
3097 |
+
);
|
3098 |
+
echo $response;
|
3099 |
+
die();
|
3100 |
+
|
3101 |
+
}elseif(isset($_POST['_wp_http_referer']) && strpos($_POST['_wp_http_referer'],'wc-ajax=update_order_review')){ //WooCommerce checkout ("Place Oreder button")
|
3102 |
+
$result = Array(
|
3103 |
+
'result' => 'failure',
|
3104 |
+
'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
|
3105 |
+
'refresh' => 'false',
|
3106 |
+
'reload' => 'false'
|
3107 |
+
);
|
3108 |
+
print json_encode($result);
|
3109 |
+
die();
|
3110 |
+
|
3111 |
+
}elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal'){
|
3112 |
+
return $ct_result->comment;
|
3113 |
+
|
3114 |
+
}elseif(isset($_POST['vfb-submit']) && defined('VFB_VERSION')){
|
3115 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
3116 |
+
// Caldera Contact Forms
|
3117 |
+
}elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
|
3118 |
+
print json_encode("<h3 style='color: red;'><red>".$ct_result->comment);
|
3119 |
+
die();
|
3120 |
+
// Mailster
|
3121 |
+
}elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
|
3122 |
+
$return = array(
|
3123 |
+
'success' => false,
|
3124 |
+
'html' => '<p>' . $ct_result->comment . '</p>',
|
3125 |
+
);
|
3126 |
+
print json_encode($return);
|
3127 |
+
die();
|
3128 |
+
// Divi Theme Contact Form. Using $contact_form
|
3129 |
+
}elseif(!empty($contact_form) && $contact_form == 'contact_form_divi_theme'){
|
3130 |
+
echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
|
3131 |
+
die();
|
3132 |
+
// Enfold Theme Contact Form. Using $contact_form
|
3133 |
+
}elseif(!empty($contact_form) && $contact_form == 'contact_form_enfold_theme'){
|
3134 |
+
echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
|
3135 |
+
die();
|
3136 |
+
}else{
|
3137 |
+
ct_die(null, null);
|
3138 |
+
}
|
3139 |
+
}
|
3140 |
+
exit;
|
3141 |
+
}
|
3142 |
+
|
3143 |
+
return null;
|
3144 |
+
}
|
3145 |
+
|
3146 |
+
/**
|
3147 |
+
* General test for any post data
|
3148 |
+
*/
|
3149 |
+
function ct_contact_form_validate_postdata() {
|
3150 |
+
|
3151 |
+
global $apbct, $pagenow,$cleantalk_executed;
|
3152 |
+
|
3153 |
+
// Exclusios common function
|
3154 |
+
if ( apbct_exclusions_check(__FUNCTION__) )
|
3155 |
+
return null;
|
3156 |
+
|
3157 |
+
if (@sizeof($_POST)==0 ||
|
3158 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
|
3159 |
+
(isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
3160 |
+
(isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
|
3161 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/checkout/')!==false ||
|
3162 |
+
/* WooCommerce Service Requests - skip them */
|
3163 |
+
isset($_GET['wc-ajax']) && (
|
3164 |
+
$_GET['wc-ajax']=='checkout' ||
|
3165 |
+
$_GET['wc-ajax']=='get_refreshed_fragments' ||
|
3166 |
+
$_GET['wc-ajax']=='apply_coupon' ||
|
3167 |
+
$_GET['wc-ajax']=='remove_coupon' ||
|
3168 |
+
$_GET['wc-ajax']=='update_shipping_method' ||
|
3169 |
+
$_GET['wc-ajax']=='get_cart_totals' ||
|
3170 |
+
$_GET['wc-ajax']=='update_order_review' ||
|
3171 |
+
$_GET['wc-ajax']=='add_to_cart' ||
|
3172 |
+
$_GET['wc-ajax']=='remove_from_cart' ||
|
3173 |
+
$_GET['wc-ajax']=='get_variation' ||
|
3174 |
+
$_GET['wc-ajax']=='get_customer_location'
|
3175 |
+
) ||
|
3176 |
+
/* END: WooCommerce Service Requests */
|
3177 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/wp-admin/')!==false ||
|
3178 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'wp-login.php')!==false||
|
3179 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'wp-comments-post.php')!==false ||
|
3180 |
+
strpos(filter_input(INPUT_SERVER, 'HTTP_REFERER'),'/wp-admin/')!==false ||
|
3181 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/login/')!==false||
|
3182 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'?provider=facebook&')!==false ||
|
3183 |
+
isset($_GET['ptype']) && $_GET['ptype']=='login' ||
|
3184 |
+
isset($_POST['ct_checkjs_register_form']) ||
|
3185 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
|
3186 |
+
$apbct->settings['general_contact_forms_test']==0 ||
|
3187 |
+
isset($_POST['bbp_topic_content']) ||
|
3188 |
+
isset($_POST['bbp_reply_content']) ||
|
3189 |
+
isset($_POST['fscf_submitted']) ||
|
3190 |
+
isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
|
3191 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/wc-api/')!==false ||
|
3192 |
+
(isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
|
3193 |
+
(isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
|
3194 |
+
(isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] == 'Two_Factor_Totp') || //TwoFactor authorization
|
3195 |
+
(isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart
|
3196 |
+
strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/wp-json/wpstatistics/v1/hit')!==false || //WPStatistics
|
3197 |
+
(isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
|
3198 |
+
(isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') //Scroll
|
3199 |
+
) {
|
3200 |
+
return null;
|
3201 |
+
}
|
3202 |
+
|
3203 |
+
$message = ct_get_fields_any_postdata($_POST);
|
3204 |
+
|
3205 |
+
// ???
|
3206 |
+
if(strlen(json_encode($message))<10)
|
3207 |
+
return null;
|
3208 |
+
|
3209 |
+
// Skip if request contains params
|
3210 |
+
$skip_params = array(
|
3211 |
+
'ipn_track_id', // PayPal IPN #
|
3212 |
+
'txn_type', // PayPal transaction type
|
3213 |
+
'payment_status', // PayPal payment status
|
3214 |
+
);
|
3215 |
+
foreach($skip_params as $key=>$value){
|
3216 |
+
if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
|
3217 |
+
return null;
|
3218 |
+
}
|
3219 |
+
|
3220 |
+
$base_call_result = apbct_base_call(
|
3221 |
+
array(
|
3222 |
+
'message' => $message,
|
3223 |
+
'post_info' => array('comment_type' => 'feedback_general_postdata'),
|
3224 |
+
)
|
3225 |
+
);
|
3226 |
+
|
3227 |
+
$cleantalk_executed=true;
|
3228 |
+
|
3229 |
+
$ct_result = $base_call_result['ct_result'];
|
3230 |
+
|
3231 |
+
if ($ct_result->allow == 0) {
|
3232 |
+
|
3233 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
3234 |
+
global $ct_comment;
|
3235 |
+
$ct_comment = $ct_result->comment;
|
3236 |
+
if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
|
3237 |
+
{
|
3238 |
+
$result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
|
3239 |
+
header("Content-Type: application/json");
|
3240 |
+
print json_encode($result);
|
3241 |
+
die();
|
3242 |
+
}
|
3243 |
+
else
|
3244 |
+
{
|
3245 |
+
ct_die(null, null);
|
3246 |
+
}
|
3247 |
+
} else {
|
3248 |
+
echo $ct_result->comment;
|
3249 |
+
}
|
3250 |
+
exit;
|
3251 |
+
}
|
3252 |
+
|
3253 |
+
return null;
|
3254 |
+
}
|
3255 |
+
|
3256 |
+
|
3257 |
+
/**
|
3258 |
+
* Inner function - Finds and returns pattern in string
|
3259 |
+
* @return null|bool
|
3260 |
+
*/
|
3261 |
+
function ct_get_data_from_submit($value = null, $field_name = null) {
|
3262 |
+
if (!$value || !$field_name || !is_string($value)) {
|
3263 |
+
return false;
|
3264 |
+
}
|
3265 |
+
if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
|
3266 |
+
return true;
|
3267 |
+
}
|
3268 |
+
}
|
3269 |
+
|
3270 |
+
/**
|
3271 |
+
* Sends error notice to admin
|
3272 |
+
* @return null
|
3273 |
+
*/
|
3274 |
+
function ct_send_error_notice ($comment = '') {
|
3275 |
+
global $ct_admin_notoice_period, $apbct;
|
3276 |
+
|
3277 |
+
$timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
|
3278 |
+
if(time() - $ct_admin_notoice_period > $timelabel_reg){
|
3279 |
+
update_option('cleantalk_timelabel_reg', time());
|
3280 |
+
|
3281 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
3282 |
+
$message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
|
3283 |
+
$message .= sprintf(__('"%s" plugin error on your site "%s":', 'cleantalk'), $apbct->plugin_name, $blogname) . "\r\n\r\n";
|
3284 |
+
$message .= preg_replace('/^(.*?)<a.*?"(.*?)".*?>(.*?)<.a>(.*)$/', '$1. $3: $2?user_token='. $apbct->user_token .' $4', $comment) . "\r\n\r\n";
|
3285 |
+
@wp_mail(ct_get_admin_email(), sprintf(__('[%s] "%s" error!', 'cleantalk'), $apbct->plugin_name, $blogname), $message);
|
3286 |
+
}
|
3287 |
+
|
3288 |
+
return null;
|
3289 |
+
}
|
3290 |
+
|
3291 |
+
function ct_print_form($arr, $k)
|
3292 |
+
{
|
3293 |
+
foreach($arr as $key => $value){
|
3294 |
+
if(!is_array($value)){
|
3295 |
+
if($k == ''){
|
3296 |
+
print '<textarea name="' . $key . '" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
|
3297 |
+
}else{
|
3298 |
+
print '<textarea name="' . $k . '[' . $key . ']" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
|
3299 |
+
}
|
3300 |
+
}else{
|
3301 |
+
if($k == ''){
|
3302 |
+
ct_print_form($value, $key);
|
3303 |
+
}else{
|
3304 |
+
ct_print_form($value, $k . '[' . $key . ']');
|
3305 |
+
}
|
3306 |
+
}
|
3307 |
+
}
|
3308 |
+
}
|
3309 |
+
|
3310 |
+
/**
|
3311 |
+
* Attaches public scripts and styles.
|
3312 |
+
*/
|
3313 |
+
function ct_enqueue_scripts_public($hook){
|
3314 |
+
|
3315 |
+
global $current_user, $apbct;
|
3316 |
+
|
3317 |
+
if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
|
3318 |
+
|
3319 |
+
// Differnt JS params
|
3320 |
+
wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.min.js', array('jquery'), APBCT_VERSION, false /*in header*/);
|
3321 |
+
|
3322 |
+
wp_localize_script('ct_public', 'ctPublic', array(
|
3323 |
+
'_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
|
3324 |
+
'_ajax_url' => admin_url('admin-ajax.php'),
|
3325 |
+
));
|
3326 |
+
|
3327 |
+
// GDPR script
|
3328 |
+
if($apbct->settings['gdpr_enabled']){
|
3329 |
+
|
3330 |
+
wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.min.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
|
3331 |
+
|
3332 |
+
wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
|
3333 |
+
'gdpr_forms' => array(),
|
3334 |
+
'gdpr_text' => $apbct->settings['gdpr_text'] ? $apbct->settings['gdpr_text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk'),
|
3335 |
+
));
|
3336 |
+
}
|
3337 |
+
|
3338 |
+
}
|
3339 |
+
|
3340 |
+
if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
|
3341 |
+
if($apbct->settings['use_ajax'] && stripos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'.xml') === false && stripos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'.xsl') === false){
|
3342 |
+
if(strpos(filter_input(INPUT_SERVER, 'REQUEST_URI'),'jm-ajax') === false){
|
3343 |
+
|
3344 |
+
// Use AJAX for JavaScript check
|
3345 |
+
if($apbct->settings['use_ajax']){
|
3346 |
+
|
3347 |
+
wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
|
3348 |
+
|
3349 |
+
wp_localize_script('ct_nocache', 'ctNocache', array(
|
3350 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
3351 |
+
'info_flag' => $apbct->settings['collect_details'] && $apbct->settings['set_cookies'] ? true : false,
|
3352 |
+
'set_cookies_flag' => $apbct->settings['set_cookies'] ? false : true,
|
3353 |
+
'blog_home' => get_home_url().'/',
|
3354 |
+
));
|
3355 |
+
}
|
3356 |
+
|
3357 |
+
// External forms check
|
3358 |
+
if($apbct->settings['check_external'])
|
3359 |
+
wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3360 |
+
|
3361 |
+
// Internal forms check
|
3362 |
+
if($apbct->settings['check_internal'])
|
3363 |
+
wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3364 |
+
|
3365 |
+
}
|
3366 |
+
}
|
3367 |
+
}
|
3368 |
+
|
3369 |
+
// Show controls for commentaies
|
3370 |
+
if(in_array("administrator", $current_user->roles)){
|
3371 |
+
|
3372 |
+
if($apbct->settings['show_check_links']){
|
3373 |
+
|
3374 |
+
$ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
|
3375 |
+
|
3376 |
+
wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'), array(), APBCT_VERSION, 'all');
|
3377 |
+
wp_enqueue_script('ct_public_admin_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3378 |
+
|
3379 |
+
wp_localize_script('ct_public_admin_js', 'ctPublicAdmin', array(
|
3380 |
+
'ct_ajax_nonce' => $ajax_nonce,
|
3381 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
3382 |
+
'ct_feedback_error' => __('Error occured while sending feedback.', 'cleantalk'),
|
3383 |
+
'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk'),
|
3384 |
+
'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
|
3385 |
+
));
|
3386 |
+
|
3387 |
+
}
|
3388 |
+
}
|
3389 |
+
|
3390 |
+
// Debug
|
3391 |
+
if($apbct->settings['debug_ajax']){
|
3392 |
+
wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3393 |
+
|
3394 |
+
wp_localize_script('ct_debug_js', 'apbctDebug', array(
|
3395 |
+
'reload' => false,
|
3396 |
+
'reload_time' => 10000,
|
3397 |
+
));
|
3398 |
+
}
|
3399 |
+
}
|
3400 |
+
|
3401 |
+
/**
|
3402 |
+
* Reassign callbackback function for the bootom of comment output.
|
3403 |
+
*/
|
3404 |
+
function ct_wp_list_comments_args($options){
|
3405 |
+
|
3406 |
+
global $current_user, $apbct;
|
3407 |
+
|
3408 |
+
if(in_array("administrator", $current_user->roles))
|
3409 |
+
if($apbct->settings['show_check_links'])
|
3410 |
+
$options['end-callback'] = 'ct_comments_output';
|
3411 |
+
|
3412 |
+
return $options;
|
3413 |
+
}
|
3414 |
+
|
3415 |
+
/**
|
3416 |
+
* Callback function for the bootom comment output.
|
3417 |
+
*/
|
3418 |
+
function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
|
3419 |
+
|
3420 |
+
$email = $curr_comment->comment_author_email;
|
3421 |
+
$ip = $curr_comment->comment_author_IP;
|
3422 |
+
$id = $curr_comment->comment_ID;
|
3423 |
+
|
3424 |
+
$settings_link = '/wp-admin/'.(is_network_admin() ? "settings.php?page=cleantalk" : "options-general.php?page=cleantalk");
|
3425 |
+
|
3426 |
+
echo "<div class='ct_comment_info'><div class ='ct_comment_titles'>";
|
3427 |
+
echo "<p class='ct_comment_info_title'>".__('Sender info', 'cleantalk')."</p>";
|
3428 |
+
|
3429 |
+
echo "<p class='ct_comment_logo_title'>
|
3430 |
+
".__('by', 'cleantalk')
|
3431 |
+
." <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='".plugins_url()."/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
|
3432 |
+
." <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
|
3433 |
+
."</p></div>";
|
3434 |
+
// Outputs email if exists
|
3435 |
+
if($email)
|
3436 |
+
echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
|
3437 |
+
."$email"
|
3438 |
+
." <img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
|
3439 |
+
."</a>";
|
3440 |
+
else
|
3441 |
+
echo __('No email', 'cleantalk');
|
3442 |
+
echo " | ";
|
3443 |
+
|
3444 |
+
// Outputs IP if exists
|
3445 |
+
if($ip)
|
3446 |
+
echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
|
3447 |
+
."$ip"
|
3448 |
+
." <img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
|
3449 |
+
."</a>";
|
3450 |
+
else
|
3451 |
+
echo __('No IP', 'cleantalk');
|
3452 |
+
echo ' | ';
|
3453 |
+
|
3454 |
+
echo "<span commentid='$id' class='ct_this_is ct_this_is_spam' href='#'>".__('Mark as spam', 'cleantalk')."</span>";
|
3455 |
+
echo "<span commentid='$id' class='ct_this_is ct_this_is_not_spam ct_hidden' href='#'>".__('Unspam', 'cleantalk')."</span>";
|
3456 |
+
echo "<p class='ct_feedback_wrap'>";
|
3457 |
+
echo "<span class='ct_feedback_result ct_feedback_result_spam'>".__('Marked as spam.', 'cleantalk')."</span>";
|
3458 |
+
echo "<span class='ct_feedback_result ct_feedback_result_not_spam'>".__('Marked as not spam.', 'cleantalk')."</span>";
|
3459 |
+
echo " <span class='ct_feedback_msg'><span>";
|
3460 |
+
echo "</p>";
|
3461 |
+
|
3462 |
+
echo "</div>";
|
3463 |
+
|
3464 |
+
// Ending comment output
|
3465 |
+
echo "</{$wp_list_comments_args['style']}>";
|
3466 |
+
}
|
3467 |
+
|
3468 |
+
/**
|
3469 |
+
* Callback function for the bootom comment output.
|
3470 |
+
*
|
3471 |
+
* attrs = array()
|
3472 |
+
*/
|
3473 |
+
function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
|
3474 |
+
|
3475 |
+
$out = '';
|
3476 |
+
|
3477 |
+
if(isset($attrs['id']))
|
3478 |
+
$out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
|
3479 |
+
|
3480 |
+
if(isset($attrs['text']))
|
3481 |
+
$out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
|
3482 |
+
|
3483 |
+
$out = '<script>'.$out.'</script>';
|
3484 |
+
return $out;
|
3485 |
+
}
|
3486 |
+
|
3487 |
+
/**
|
3488 |
+
* Filters the 'status' array before register the user
|
3489 |
+
* using only by WICITY theme
|
3490 |
+
*
|
3491 |
+
* @param $success array array( 'status' => 'success' )
|
3492 |
+
* @param $data array ['username'] ['password'] ['email']
|
3493 |
+
* @return array array( 'status' => 'error' ) or array( 'status' => 'success' ) by default
|
3494 |
+
*/
|
3495 |
+
function apbct_wilcity_reg_validation( $success, $data ) {
|
3496 |
+
$check = ct_test_registration( $data['username'], $data['email'], '' );
|
3497 |
+
if( $check['allow'] == 0 ) {
|
3498 |
+
return array( 'status' => 'error' );
|
3499 |
+
}
|
3500 |
+
return $success;
|
3501 |
+
}
|
inc/cleantalk-settings.php
CHANGED
@@ -1,1456 +1,1456 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Admin action 'admin_menu' - Add the admin options page
|
5 |
-
*/
|
6 |
-
function apbct_settings_add_page() {
|
7 |
-
|
8 |
-
global $apbct, $pagenow;
|
9 |
-
|
10 |
-
$parent_slug = is_network_admin() ? 'settings.php' : 'options-general.php';
|
11 |
-
$callback = is_network_admin() ? 'apbct_settings__display__network' : 'apbct_settings__display';
|
12 |
-
|
13 |
-
// Adding settings page
|
14 |
-
add_submenu_page(
|
15 |
-
$parent_slug,
|
16 |
-
$apbct->plugin_name.' '.__('settings'),
|
17 |
-
$apbct->plugin_name,
|
18 |
-
'manage_options',
|
19 |
-
'cleantalk',
|
20 |
-
$callback
|
21 |
-
);
|
22 |
-
|
23 |
-
if(!in_array($pagenow, array('options.php', 'options-general.php', 'settings.php', 'admin.php')))
|
24 |
-
return;
|
25 |
-
|
26 |
-
register_setting('cleantalk_settings', 'cleantalk_settings', 'apbct_settings__validate');
|
27 |
-
|
28 |
-
$fields = array();
|
29 |
-
$fields = apbct_settings__set_fileds($fields);
|
30 |
-
$fields = APBCT_WPMS && is_main_site() ? apbct_settings__set_fileds__network($fields) : $fields;
|
31 |
-
apbct_settings__add_groups_and_fields($fields);
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
function apbct_settings__set_fileds( $fields ){
|
36 |
-
global $apbct;
|
37 |
-
|
38 |
-
$fields = array(
|
39 |
-
|
40 |
-
'main' => array(
|
41 |
-
'title' => '',
|
42 |
-
'default_params' => array(),
|
43 |
-
'description' => '',
|
44 |
-
'html_before' => '',
|
45 |
-
'html_after' => '',
|
46 |
-
'fields' => array(
|
47 |
-
'action_buttons' => array(
|
48 |
-
'callback' => 'apbct_settings__field__action_buttons',
|
49 |
-
),
|
50 |
-
'connection_reports' => array(
|
51 |
-
'callback' => 'apbct_settings__field__statistics',
|
52 |
-
),
|
53 |
-
'api_key' => array(
|
54 |
-
'display' => !$apbct->white_label || is_main_site(),
|
55 |
-
'callback' => 'apbct_settings__field__apikey',
|
56 |
-
),
|
57 |
-
),
|
58 |
-
),
|
59 |
-
|
60 |
-
'state' => array(
|
61 |
-
'title' => '',
|
62 |
-
'default_params' => array(),
|
63 |
-
'description' => '',
|
64 |
-
'html_before' => '<hr style="width: 100%;">',
|
65 |
-
'html_after' => '',
|
66 |
-
'fields' => array(
|
67 |
-
'state' => array(
|
68 |
-
'callback' => 'apbct_settings__field__state',
|
69 |
-
),
|
70 |
-
),
|
71 |
-
),
|
72 |
-
|
73 |
-
'debug' => array(
|
74 |
-
'title' => '',
|
75 |
-
'default_params' => array(),
|
76 |
-
'description' => '',
|
77 |
-
'html_before' => '',
|
78 |
-
'html_after' => '',
|
79 |
-
'fields' => array(
|
80 |
-
'state' => array(
|
81 |
-
'callback' => 'apbct_settings__field__debug',
|
82 |
-
),
|
83 |
-
),
|
84 |
-
),
|
85 |
-
|
86 |
-
// Different
|
87 |
-
'different' => array(
|
88 |
-
'title' => '',
|
89 |
-
'default_params' => array(),
|
90 |
-
'description' => '',
|
91 |
-
'html_before' => '<hr>',
|
92 |
-
'html_after' => '',
|
93 |
-
'fields' => array(
|
94 |
-
'spam_firewall' => array(
|
95 |
-
'type' => 'checkbox',
|
96 |
-
'title' => __('SpamFireWall', 'cleantalk'),
|
97 |
-
'description' => __("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'),
|
98 |
-
),
|
99 |
-
),
|
100 |
-
),
|
101 |
-
|
102 |
-
// Forms protection
|
103 |
-
'forms_protection' => array(
|
104 |
-
'title' => __('Forms to protect', 'cleantalk'),
|
105 |
-
'default_params' => array(),
|
106 |
-
'description' => '',
|
107 |
-
'html_before' => '<hr><br>'
|
108 |
-
.'<span id="ct_adv_showhide">'
|
109 |
-
.'<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'apbct_settings__davanced_settings\');">'
|
110 |
-
.__('Advanced settings', 'cleantalk')
|
111 |
-
.'</a>'
|
112 |
-
.'</span>'
|
113 |
-
.'<div id="apbct_settings__davanced_settings" style="display: none;">',
|
114 |
-
'html_after' => '',
|
115 |
-
'fields' => array(
|
116 |
-
'registrations_test' => array(
|
117 |
-
'title' => __('Registration Forms', 'cleantalk'),
|
118 |
-
'description' => __('WordPress, BuddyPress, bbPress, S2Member, WooCommerce.', 'cleantalk'),
|
119 |
-
),
|
120 |
-
'comments_test' => array(
|
121 |
-
'title' => __('Comments form', 'cleantalk'),
|
122 |
-
'description' => __('WordPress, JetPack, WooCommerce.', 'cleantalk'),
|
123 |
-
),
|
124 |
-
'contact_forms_test' => array(
|
125 |
-
'title' => __('Contact forms', 'cleantalk'),
|
126 |
-
'description' => __('Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages, Gravity Forms.', 'cleantalk'),
|
127 |
-
),
|
128 |
-
'general_contact_forms_test' => array(
|
129 |
-
'title' => __('Custom contact forms', 'cleantalk'),
|
130 |
-
'description' => __('Anti spam test for any WordPress themes or contacts forms.', 'cleantalk'),
|
131 |
-
),
|
132 |
-
'wc_checkout_test' => array(
|
133 |
-
'title' => __('WooCommerce checkout form', 'cleantalk'),
|
134 |
-
'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk'),
|
135 |
-
'childrens' => array('wc_register_from_order')
|
136 |
-
),
|
137 |
-
'wc_register_from_order' => array(
|
138 |
-
'title' => __('Spam test for registration during checkout', 'cleantalk'),
|
139 |
-
'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk'),
|
140 |
-
'parent' => 'wc_checkout_test',
|
141 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
142 |
-
'reverse_trigger' => true
|
143 |
-
),
|
144 |
-
'search_test' => array(
|
145 |
-
'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
|
146 |
-
'description' => __('Spam protection for Search form.', 'cleantalk')
|
147 |
-
. (!$apbct->white_label || is_main_site()
|
148 |
-
? sprintf(__('Read more about %sspam protection for Search form%s on our blog.', 'cleantalk'),
|
149 |
-
'<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
|
150 |
-
'</a>'
|
151 |
-
)
|
152 |
-
: ''
|
153 |
-
)
|
154 |
-
),
|
155 |
-
'check_external' => array(
|
156 |
-
'title' => __('Protect external forms', 'cleantalk'),
|
157 |
-
'description' => __('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'),
|
158 |
-
'childrens' => array('check_external__capture_buffer'),
|
159 |
-
),
|
160 |
-
'check_external__capture_buffer' => array(
|
161 |
-
'title' => __('Capture buffer', 'cleantalk'),
|
162 |
-
'description' => __('This setting gives you more sophisticated and strengthened protection for external forms. But it could break plugins which use a buffer like Ninja Forms.', 'cleantalk'),
|
163 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
164 |
-
'parent' => 'check_external',
|
165 |
-
),
|
166 |
-
'check_internal' => array(
|
167 |
-
'title' => __('Protect internal forms', 'cleantalk'),
|
168 |
-
'description' => __('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'),
|
169 |
-
),
|
170 |
-
),
|
171 |
-
),
|
172 |
-
|
173 |
-
// Comments and Messages
|
174 |
-
'comments_and_messages' => array(
|
175 |
-
'title' => __('Comments and Messages', 'cleantalk'),
|
176 |
-
'fields' => array(
|
177 |
-
'bp_private_messages' => array(
|
178 |
-
'title' => __('BuddyPress Private Messages', 'cleantalk'),
|
179 |
-
'description' => __('Check buddyPress private messages.', 'cleantalk'),
|
180 |
-
),
|
181 |
-
'check_comments_number' => array(
|
182 |
-
'title' => __("Don't check trusted user's comments", 'cleantalk'),
|
183 |
-
'description' => sprintf(__("Don't check comments for users with above %d comments.", 'cleantalk'), defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3),
|
184 |
-
),
|
185 |
-
'remove_old_spam' => array(
|
186 |
-
'title' => __('Automatically delete spam comments', 'cleantalk'),
|
187 |
-
'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
|
188 |
-
),
|
189 |
-
'remove_comments_links' => array(
|
190 |
-
'title' => __('Remove links from approved comments', 'cleantalk'),
|
191 |
-
'description' => __('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'),
|
192 |
-
),
|
193 |
-
'show_check_links' => array(
|
194 |
-
'title' => __('Show links to check Emails, IPs for spam.', 'cleantalk'),
|
195 |
-
'description' => __('Shows little icon near IP addresses and Emails allowing you to check it via CleanTalk\'s database. Also allowing you to manage comments from the public post\'s page.', 'cleantalk'),
|
196 |
-
'display' => !$apbct->white_label,
|
197 |
-
),
|
198 |
-
),
|
199 |
-
),
|
200 |
-
|
201 |
-
// Data Processing
|
202 |
-
'data_processing' => array(
|
203 |
-
'title' => __('Data Processing', 'cleantalk'),
|
204 |
-
'fields' => array(
|
205 |
-
'protect_logged_in' => array(
|
206 |
-
'title' => __("Protect logged in Users", 'cleantalk'),
|
207 |
-
'description' => __('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk'),
|
208 |
-
),
|
209 |
-
'use_ajax' => array(
|
210 |
-
'title' => __('Use AJAX for JavaScript check', 'cleantalk'),
|
211 |
-
'description' => __('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'),
|
212 |
-
),
|
213 |
-
'use_static_js_key' => array(
|
214 |
-
'title' => __('Use static keys for JS check.', 'cleantalk'),
|
215 |
-
'description' => __('Could help if you have cache for AJAX requests and you are dealing with false positives. Slightly decreases protection quality. Auto - Static key will be used if caching plugin is spotted.', 'cleantalk'),
|
216 |
-
'options' => array(
|
217 |
-
array('val' => 1, 'label' => __('On'), ),
|
218 |
-
array('val' => 0, 'label' => __('Off'), ),
|
219 |
-
array('val' => -1, 'label' => __('Auto'),),
|
220 |
-
),
|
221 |
-
),
|
222 |
-
'general_postdata_test' => array(
|
223 |
-
'title' => __('Check all post data', 'cleantalk'),
|
224 |
-
'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
|
225 |
-
.(!$apbct->white_label
|
226 |
-
? __(' Or you don`t have records about missed spam here:', 'cleantalk') . ' ' . '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">' . __('CleanTalk dashboard', 'cleantalk') . '</a>.'
|
227 |
-
: ''
|
228 |
-
)
|
229 |
-
.'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'),
|
230 |
-
),
|
231 |
-
'set_cookies' => array(
|
232 |
-
'title' => __("Set cookies", 'cleantalk'),
|
233 |
-
'description' => __('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could cause false positives spam detection.</b>', 'cleantalk'),
|
234 |
-
'childrens' => array('set_cookies__sessions'),
|
235 |
-
),
|
236 |
-
'set_cookies__sessions' => array(
|
237 |
-
'title' => __('Use alternative mechanism for cookies', 'cleantalk'),
|
238 |
-
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
239 |
-
'parent' => 'set_cookies',
|
240 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
241 |
-
),
|
242 |
-
'ssl_on' => array(
|
243 |
-
'title' => __("Use SSL", 'cleantalk'),
|
244 |
-
'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
|
245 |
-
),
|
246 |
-
'use_buitin_http_api' => array(
|
247 |
-
'title' => __("Use Wordpress HTTP API", 'cleantalk'),
|
248 |
-
'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
|
249 |
-
),
|
250 |
-
),
|
251 |
-
),
|
252 |
-
|
253 |
-
// Exclusions
|
254 |
-
'exclusions' => array(
|
255 |
-
'title' => __('Exclusions', 'cleantalk'),
|
256 |
-
'fields' => array(
|
257 |
-
'exclusions__urls' => array(
|
258 |
-
'type' => 'text',
|
259 |
-
'title' => __('URL exclusions', 'cleantalk'),
|
260 |
-
'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
|
261 |
-
),
|
262 |
-
'exclusions__urls__use_regexp' => array(
|
263 |
-
'type' => 'checkbox',
|
264 |
-
'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
|
265 |
-
),
|
266 |
-
'exclusions__fields' => array(
|
267 |
-
'type' => 'text',
|
268 |
-
'title' => __('Field name exclusions', 'cleantalk'),
|
269 |
-
'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
|
270 |
-
),
|
271 |
-
'exclusions__fields__use_regexp' => array(
|
272 |
-
'type' => 'checkbox',
|
273 |
-
'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
|
274 |
-
),
|
275 |
-
'exclusions__roles' => array(
|
276 |
-
'type' => 'select',
|
277 |
-
'multiple' => true,
|
278 |
-
'options_callback' => 'apbct_get_all_roles',
|
279 |
-
'options_callback_params' => array(true),
|
280 |
-
'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
|
281 |
-
),
|
282 |
-
),
|
283 |
-
),
|
284 |
-
|
285 |
-
// Admin bar
|
286 |
-
'admin_bar' => array(
|
287 |
-
'title' => __('Admin bar', 'cleantalk'),
|
288 |
-
'default_params' => array(),
|
289 |
-
'description' => '',
|
290 |
-
'html_before' => '',
|
291 |
-
'html_after' => '',
|
292 |
-
'fields' => array(
|
293 |
-
'show_adminbar' => array(
|
294 |
-
'title' => __('Show statistics in admin bar', 'cleantalk'),
|
295 |
-
'description' => __('Show/hide icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'),
|
296 |
-
'childrens' => array('all_time_counter','daily_counter','sfw_counter'),
|
297 |
-
),
|
298 |
-
'all_time_counter' => array(
|
299 |
-
'title' => __('Show All-time counter', 'cleantalk'),
|
300 |
-
'description' => __('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
301 |
-
'parent' => 'show_adminbar',
|
302 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
303 |
-
),
|
304 |
-
'daily_counter' => array(
|
305 |
-
'title' => __('Show 24 hours counter', 'cleantalk'),
|
306 |
-
'description' => __('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'),
|
307 |
-
'parent' => 'show_adminbar',
|
308 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
309 |
-
),
|
310 |
-
'sfw_counter' => array(
|
311 |
-
'title' => __('SpamFireWall counter', 'cleantalk'),
|
312 |
-
'description' => __('Display SpamFireWall requests in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
313 |
-
'parent' => 'show_adminbar',
|
314 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
315 |
-
),
|
316 |
-
),
|
317 |
-
),
|
318 |
-
|
319 |
-
// Misc
|
320 |
-
'misc' => array(
|
321 |
-
'html_after' => '</div><br>',
|
322 |
-
'fields' => array(
|
323 |
-
'collect_details' => array(
|
324 |
-
'type' => 'checkbox',
|
325 |
-
'title' => __('Collect details about browsers', 'cleantalk'),
|
326 |
-
'description' => __("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'),
|
327 |
-
),
|
328 |
-
'send_connection_reports' => array(
|
329 |
-
'type' => 'checkbox',
|
330 |
-
'title' => __('Send connection reports', 'cleantalk'),
|
331 |
-
'description' => __("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'),
|
332 |
-
),
|
333 |
-
'async_js' => array(
|
334 |
-
'type' => 'checkbox',
|
335 |
-
'title' => __('Async JavaScript loading', 'cleantalk'),
|
336 |
-
'description' => __('Use async loading for scripts. Warning: This could reduce filtration quality.', 'cleantalk'),
|
337 |
-
),
|
338 |
-
'gdpr_enabled' => array(
|
339 |
-
'type' => 'checkbox',
|
340 |
-
'title' => __('Allow to add GDPR notice via shortcode', 'cleantalk'),
|
341 |
-
'description' => __(' Adds small checkbox under your website form. To add it you should use the shortcode on the form\'s page: [cleantalk_gdpr_form id="FORM_ID"]', 'cleantalk'),
|
342 |
-
'childrens' => array('gdpr_text'),
|
343 |
-
),
|
344 |
-
'gdpr_text' => array(
|
345 |
-
'type' => 'text',
|
346 |
-
'title' => __('GDPR text notice', 'cleantalk'),
|
347 |
-
'description' => __('This text will be added as a description to the GDPR checkbox.', 'cleantalk'),
|
348 |
-
'parent' => 'gdpr_enabled',
|
349 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
350 |
-
),
|
351 |
-
'store_urls' => array(
|
352 |
-
'type' => 'checkbox',
|
353 |
-
'title' => __('Store visited URLs', 'cleantalk'),
|
354 |
-
'description' => __("Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits form on the site. You can see stored visited URLS for each visitor in your Dashboard. Turn the option on to improve Anti-Spam protection.", 'cleantalk'),
|
355 |
-
'childrens' => array('store_urls__sessions'),
|
356 |
-
),
|
357 |
-
'store_urls__sessions' => array(
|
358 |
-
'type' => 'checkbox',
|
359 |
-
'title' => __('Use cookies less sessions', 'cleantalk'),
|
360 |
-
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
361 |
-
'parent' => 'store_urls',
|
362 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
363 |
-
),
|
364 |
-
'comment_notify' => array(
|
365 |
-
'type' => 'checkbox',
|
366 |
-
'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
|
367 |
-
'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
|
368 |
-
'childrens' => array('comment_notify__roles'),
|
369 |
-
),
|
370 |
-
'comment_notify__roles' => array(
|
371 |
-
'type' => 'select',
|
372 |
-
'multiple' => true,
|
373 |
-
'parent' => 'comment_notify',
|
374 |
-
'options_callback' => 'apbct_get_all_roles',
|
375 |
-
'options_callback_params' => array(true),
|
376 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
377 |
-
),
|
378 |
-
'complete_deactivation' => array(
|
379 |
-
'type' => 'checkbox',
|
380 |
-
'title' => __('Complete deactivation', 'cleantalk'),
|
381 |
-
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
382 |
-
),
|
383 |
-
|
384 |
-
),
|
385 |
-
),
|
386 |
-
);
|
387 |
-
|
388 |
-
return $fields;
|
389 |
-
}
|
390 |
-
|
391 |
-
function apbct_settings__set_fileds__network( $fields ){
|
392 |
-
global $apbct;
|
393 |
-
$additional_fields = array(
|
394 |
-
'main' => array(
|
395 |
-
'fields' => array(
|
396 |
-
'white_label' => array(
|
397 |
-
'type' => 'checkbox',
|
398 |
-
'title' => __('Enable White Label Mode', 'cleantalk'),
|
399 |
-
'description' => sprintf(__("Learn more information %shere%s.", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">', '</a>'),
|
400 |
-
'childrens' => array('white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key'),
|
401 |
-
'network' => true,
|
402 |
-
),
|
403 |
-
'white_label__hoster_key' => array(
|
404 |
-
'title' => __('Hoster API Key', 'cleantalk'),
|
405 |
-
'description' => sprintf(__("You can get it in %sCleantalk's Control Panel%s", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/my/?cp_mode=hosting-antispam">', '</a>'),
|
406 |
-
'type' => 'text',
|
407 |
-
'parent' => 'white_label',
|
408 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
409 |
-
'network' => true,
|
410 |
-
'required' => true,
|
411 |
-
),
|
412 |
-
'white_label__plugin_name' => array(
|
413 |
-
'title' => __('Plugin name', 'cleantalk'),
|
414 |
-
'description' => sprintf(__("Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s", 'cleantalk'), '<b>', '</b>'),
|
415 |
-
'type' => 'text',
|
416 |
-
'parent' => 'white_label',
|
417 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
418 |
-
'network' => true,
|
419 |
-
'required' => true,
|
420 |
-
),
|
421 |
-
'allow_custom_key' => array(
|
422 |
-
'type' => 'checkbox',
|
423 |
-
'title' => __('Allow users to use other key', 'cleantalk'),
|
424 |
-
'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
|
425 |
-
. (defined('CLEANTALK_ACCESS_KEY')
|
426 |
-
? ' <span style="color: red">'
|
427 |
-
. __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
|
428 |
-
. '</span>'
|
429 |
-
: ''
|
430 |
-
),
|
431 |
-
'display' => APBCT_WPMS && is_main_site(),
|
432 |
-
'disabled' => $apbct->network_settings['white_label'],
|
433 |
-
'network' => true,
|
434 |
-
),
|
435 |
-
)
|
436 |
-
)
|
437 |
-
);
|
438 |
-
|
439 |
-
$fields = array_merge_recursive($fields, $additional_fields);
|
440 |
-
|
441 |
-
return $fields;
|
442 |
-
|
443 |
-
}
|
444 |
-
|
445 |
-
function apbct_settings__add_groups_and_fields( $fields ){
|
446 |
-
|
447 |
-
global $apbct;
|
448 |
-
|
449 |
-
$apbct->settings_fields_in_groups = $fields;
|
450 |
-
|
451 |
-
$field_default_params = array(
|
452 |
-
'callback' => 'apbct_settings__field__draw',
|
453 |
-
'type' => 'radio',
|
454 |
-
'options' => array(
|
455 |
-
array('val' => 1, 'label' => __('On'),),
|
456 |
-
array('val' => 0, 'label' => __('Off'),),
|
457 |
-
),
|
458 |
-
'def_class' => 'apbct_settings-field_wrapper',
|
459 |
-
'class' => '',
|
460 |
-
'parent' => '',
|
461 |
-
'childrens' => array(),
|
462 |
-
'hide' => array(),
|
463 |
-
// 'title' => 'Default title',
|
464 |
-
// 'description' => 'Default description',
|
465 |
-
'display' => true, // Draw settings or not
|
466 |
-
'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
|
467 |
-
'multiple' => false,
|
468 |
-
'description' => '',
|
469 |
-
'network' => false,
|
470 |
-
'disabled' => false,
|
471 |
-
'required' => false,
|
472 |
-
);
|
473 |
-
|
474 |
-
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
475 |
-
|
476 |
-
add_settings_section('apbct_section__'.$group_name, '', 'apbct_section__'.$group_name, 'cleantalk');
|
477 |
-
|
478 |
-
foreach($group['fields'] as $field_name => $field){
|
479 |
-
|
480 |
-
// Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
|
481 |
-
if(!empty($field['options_callback'])){
|
482 |
-
$options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
|
483 |
-
foreach ($options as &$option){
|
484 |
-
$option = array('val' => $option, 'label' => $option);
|
485 |
-
} unset($option);
|
486 |
-
$field['options'] = $options;
|
487 |
-
}
|
488 |
-
|
489 |
-
$params = !empty($group['default_params'])
|
490 |
-
? array_merge($group['default_params'], $field)
|
491 |
-
: array_merge($field_default_params, $field);
|
492 |
-
|
493 |
-
$params['name'] = $field_name;
|
494 |
-
|
495 |
-
if(!$params['display'])
|
496 |
-
continue;
|
497 |
-
|
498 |
-
add_settings_field(
|
499 |
-
'apbct_field__'.$field_name,
|
500 |
-
'',
|
501 |
-
$params['callback'],
|
502 |
-
'cleantalk',
|
503 |
-
'apbct_section__'.$group_name,
|
504 |
-
$params
|
505 |
-
);
|
506 |
-
|
507 |
-
}
|
508 |
-
}
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Admin callback function - Displays plugin options page
|
513 |
-
*/
|
514 |
-
function apbct_settings__display() {
|
515 |
-
|
516 |
-
global $apbct;
|
517 |
-
|
518 |
-
// Title
|
519 |
-
echo '<h2 class="apbct_settings-title">'.__($apbct->plugin_name, 'cleantalk').'</h2>';
|
520 |
-
|
521 |
-
// Subtitle for IP license
|
522 |
-
if($apbct->moderate_ip)
|
523 |
-
echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
|
524 |
-
|
525 |
-
echo '<form action="options.php" method="post">';
|
526 |
-
|
527 |
-
apbct_settings__error__output();
|
528 |
-
|
529 |
-
// Top info
|
530 |
-
if(!$apbct->white_label){
|
531 |
-
echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; top: -55px; background: #f1f1f1;">';
|
532 |
-
|
533 |
-
echo __('CleanTalk\'s tech support:', 'cleantalk')
|
534 |
-
.' '
|
535 |
-
.'<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
|
536 |
-
// .' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
|
537 |
-
// .($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').
|
538 |
-
.'<br>';
|
539 |
-
echo __('Plugin Homepage at', 'cleantalk').' <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
|
540 |
-
echo '<span id="apbct_gdpr_open_modal" style="text-decoration: underline;">'.__('GDPR compliance', 'cleantalk').'</span><br/>';
|
541 |
-
echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
|
542 |
-
echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br/>';
|
543 |
-
if($apbct->key_is_ok)
|
544 |
-
echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
|
545 |
-
apbct_admin__badge__get_premium();
|
546 |
-
echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
|
547 |
-
apbct_settings_show_gdpr_text('print');
|
548 |
-
echo '</div>';
|
549 |
-
echo '</div>';
|
550 |
-
}
|
551 |
-
|
552 |
-
// Output spam count
|
553 |
-
if($apbct->key_is_ok && apbct_api_key__is_correct()){
|
554 |
-
if($apbct->spam_count > 0){
|
555 |
-
echo '<div class="apbct_settings-subtitle" style="top: 0; margin-bottom: 10px; width: 200px;">'
|
556 |
-
.'<br>'
|
557 |
-
.'<span>'
|
558 |
-
.sprintf(
|
559 |
-
__( '%s has blocked <b>%s</b> spam.', 'cleantalk' ),
|
560 |
-
$apbct->plugin_name,
|
561 |
-
number_format($apbct->spam_count, 0, ',', ' ')
|
562 |
-
)
|
563 |
-
.'</span>'
|
564 |
-
.'<br>'
|
565 |
-
.'<br>'
|
566 |
-
.'</div>';
|
567 |
-
}
|
568 |
-
if(!$apbct->white_label){
|
569 |
-
// CP button
|
570 |
-
echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
|
571 |
-
.__('Click here to get anti-spam statistics', 'cleantalk')
|
572 |
-
.'</a>';
|
573 |
-
echo ' ';
|
574 |
-
// Support button
|
575 |
-
echo '<a class="cleantalk_link cleantalk_link-auto" target="__blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>';
|
576 |
-
echo '<br>'
|
577 |
-
.'<br>';
|
578 |
-
}
|
579 |
-
}
|
580 |
-
|
581 |
-
settings_fields('cleantalk_settings');
|
582 |
-
do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
|
583 |
-
|
584 |
-
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
585 |
-
|
586 |
-
echo !empty($group['html_before']) ? $group['html_before'] : '';
|
587 |
-
echo !empty($group['title']) ? '<h3 style="margin-left: 220px;">'.$group['title'].'</h3>' : '';
|
588 |
-
|
589 |
-
do_settings_fields('cleantalk', 'apbct_section__'.$group_name);
|
590 |
-
|
591 |
-
echo !empty($group['html_after']) ? $group['html_after'] : '';
|
592 |
-
|
593 |
-
}
|
594 |
-
|
595 |
-
echo '<br>';
|
596 |
-
echo '<button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'.__('Save Changes').'</button>';
|
597 |
-
|
598 |
-
echo "</form>";
|
599 |
-
|
600 |
-
if(!$apbct->white_label){
|
601 |
-
// Translate banner for non EN locale
|
602 |
-
if(substr(get_locale(), 0, 2) != 'en'){
|
603 |
-
global $ct_translate_banner_template;
|
604 |
-
require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
|
605 |
-
printf($ct_translate_banner_template, substr(get_locale(), 0, 2));
|
606 |
-
}
|
607 |
-
}
|
608 |
-
}
|
609 |
-
|
610 |
-
function apbct_settings__display__network(){
|
611 |
-
// If it's network admin dashboard
|
612 |
-
if(is_network_admin()){
|
613 |
-
$link = get_site_option('siteurl').'wp-admin/options-general.php?page=cleantalk';
|
614 |
-
printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
|
615 |
-
return;
|
616 |
-
}
|
617 |
-
}
|
618 |
-
|
619 |
-
function apbct_settings__error__output($return = false){
|
620 |
-
|
621 |
-
global $apbct;
|
622 |
-
|
623 |
-
// If have error message output error block.
|
624 |
-
|
625 |
-
$out = '';
|
626 |
-
|
627 |
-
if(!empty($apbct->errors) && !defined('CLEANTALK_ACCESS_KEY')){
|
628 |
-
|
629 |
-
$errors = $apbct->errors;
|
630 |
-
|
631 |
-
$error_texts = array(
|
632 |
-
// Misc
|
633 |
-
'key_invalid' => __('Error occured while API key validating. Error: ', 'cleantalk'),
|
634 |
-
'key_get' => __('Error occured while automatically gettings access key. Error: ', 'cleantalk'),
|
635 |
-
'sfw_send_logs' => __('Error occured while sending sending SpamFireWall logs. Error: ', 'cleantalk'),
|
636 |
-
'sfw_update' => __('Error occured while updating SpamFireWall local base. Error: ' , 'cleantalk'),
|
637 |
-
'account_check' => __('Error occured while checking account status. Error: ', 'cleantalk'),
|
638 |
-
'api' => __('Error occured while excuting API call. Error: ', 'cleantalk'),
|
639 |
-
|
640 |
-
// Validating settings
|
641 |
-
'settings_validate' => 'Validate Settings',
|
642 |
-
'exclusions_urls' => 'URL Exclusions',
|
643 |
-
'exclusions_fields' => 'Field Exclusions',
|
644 |
-
|
645 |
-
// Unknown
|
646 |
-
'unknown' => __('Unknown error. Error: ', 'cleantalk'),
|
647 |
-
);
|
648 |
-
|
649 |
-
$errors_out = array();
|
650 |
-
|
651 |
-
foreach($errors as $type => $error){
|
652 |
-
|
653 |
-
if(!empty($error)){
|
654 |
-
|
655 |
-
if(is_array(current($error))){
|
656 |
-
|
657 |
-
foreach($error as $sub_type => $sub_error){
|
658 |
-
$errors_out[$sub_type] = '';
|
659 |
-
if(isset($sub_error['error_time']))
|
660 |
-
$errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
|
661 |
-
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
662 |
-
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
|
663 |
-
}
|
664 |
-
continue;
|
665 |
-
}
|
666 |
-
|
667 |
-
$errors_out[$type] = '';
|
668 |
-
if(isset($error['error_time']))
|
669 |
-
$errors_out[$type] .= date('Y-m-d H:i:s', $error['error_time']) . ': ';
|
670 |
-
$errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
|
671 |
-
|
672 |
-
}
|
673 |
-
}
|
674 |
-
|
675 |
-
if(!empty($errors_out)){
|
676 |
-
$out .= '<div id="apbctTopWarning" class="error" style="position: relative;">'
|
677 |
-
.'<h3 style="display: inline-block;">'.__('Errors:', 'cleantalk').'</h3>';
|
678 |
-
foreach($errors_out as $value){
|
679 |
-
$out .= '<h4>'.$value.'</h4>';
|
680 |
-
}
|
681 |
-
$out .= !$apbct->white_label
|
682 |
-
? '<h4 style="text-align: unset;">'.sprintf(__('You can get support any time here: %s.', 'cleantalk'), '<a target="blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">https://wordpress.org/support/plugin/cleantalk-spam-protect</a>').'</h4>'
|
683 |
-
: '';
|
684 |
-
$out .= '</div>';
|
685 |
-
}
|
686 |
-
}
|
687 |
-
|
688 |
-
if($return) return $out; else echo $out;
|
689 |
-
}
|
690 |
-
|
691 |
-
function apbct_settings__field__debug(){
|
692 |
-
|
693 |
-
global $apbct;
|
694 |
-
|
695 |
-
if($apbct->debug){
|
696 |
-
|
697 |
-
echo '<hr /><h2>Debug:</h2>';
|
698 |
-
echo '<h4>Constants:</h4>';
|
699 |
-
echo 'CLEANTALK_AJAX_USE_BUFFER '. (defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
700 |
-
echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '. (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
701 |
-
echo 'CLEANTALK_ACCESS_KEY '. (defined('CLEANTALK_ACCESS_KEY') ? (CLEANTALK_ACCESS_KEY ? CLEANTALK_ACCESS_KEY : 'flase') : 'NOT_DEFINED')."<br>";
|
702 |
-
echo 'CLEANTALK_CHECK_COMMENTS_NUMBER '. (defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? (CLEANTALK_CHECK_COMMENTS_NUMBER ? CLEANTALK_CHECK_COMMENTS_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
703 |
-
echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
704 |
-
echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
|
705 |
-
echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
|
706 |
-
|
707 |
-
echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
|
708 |
-
echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
|
709 |
-
|
710 |
-
$output = print_r($apbct->debug, true);
|
711 |
-
$output = str_replace("\n", "<br>", $output);
|
712 |
-
$output = preg_replace("/[^\S]{4}/", " ", $output);
|
713 |
-
echo "$output";
|
714 |
-
|
715 |
-
echo "</div>";
|
716 |
-
|
717 |
-
}
|
718 |
-
}
|
719 |
-
|
720 |
-
function apbct_settings__field__state(){
|
721 |
-
|
722 |
-
global $apbct;
|
723 |
-
|
724 |
-
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
725 |
-
|
726 |
-
$img = $path_to_img."yes.png";
|
727 |
-
$img_no = $path_to_img."no.png";
|
728 |
-
$img_no_gray = $path_to_img."no_gray.png";
|
729 |
-
$color="black";
|
730 |
-
|
731 |
-
if(!$apbct->key_is_ok){
|
732 |
-
$img=$path_to_img."no.png";
|
733 |
-
$img_no=$path_to_img."no.png";
|
734 |
-
$color="black";
|
735 |
-
}
|
736 |
-
|
737 |
-
if(!apbct_api_key__is_correct($apbct->api_key)){
|
738 |
-
$img = $path_to_img."yes_gray.png";
|
739 |
-
$img_no = $path_to_img."no_gray.png";
|
740 |
-
$color="gray";
|
741 |
-
}
|
742 |
-
|
743 |
-
if($apbct->moderate_ip){
|
744 |
-
$img = $path_to_img."yes.png";
|
745 |
-
$img_no = $path_to_img."no.png";
|
746 |
-
$color="black";
|
747 |
-
}
|
748 |
-
|
749 |
-
if($apbct->moderate == 0){
|
750 |
-
$img = $path_to_img."no.png";
|
751 |
-
$img_no = $path_to_img."no.png";
|
752 |
-
$color="black";
|
753 |
-
}
|
754 |
-
|
755 |
-
print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
|
756 |
-
|
757 |
-
print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
|
758 |
-
|
759 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['registrations_test'] == 1 ? $img : $img_no).'"/>'.__('Registration forms', 'cleantalk');
|
760 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
|
761 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
|
762 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
|
763 |
-
if(!$apbct->white_label || is_main_site())
|
764 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
|
765 |
-
.'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
|
766 |
-
|
767 |
-
// Autoupdate status
|
768 |
-
if($apbct->notice_auto_update && (!$apbct->white_label || is_main_site())){
|
769 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
|
770 |
-
.' <sup><a href="http://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
|
771 |
-
}
|
772 |
-
|
773 |
-
// WooCommerce
|
774 |
-
if(class_exists('WooCommerce'))
|
775 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
|
776 |
-
if($apbct->moderate_ip)
|
777 |
-
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
|
778 |
-
|
779 |
-
print "</div>";
|
780 |
-
}
|
781 |
-
|
782 |
-
/**
|
783 |
-
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
784 |
-
*/
|
785 |
-
function apbct_settings__field__apikey(){
|
786 |
-
|
787 |
-
global $apbct;
|
788 |
-
|
789 |
-
echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
|
790 |
-
|
791 |
-
// Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
|
792 |
-
if(APBCT_WPMS && !is_main_site() && (!$apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY'))){
|
793 |
-
_e('<h3>Key is provided by Super Admin.</h3>', 'cleantalk');
|
794 |
-
return;
|
795 |
-
}
|
796 |
-
|
797 |
-
echo '<label class="apbct_settings__label" for="cleantalk_apkey">' . __('Access key', 'cleantalk') . '</label>';
|
798 |
-
|
799 |
-
echo '<input
|
800 |
-
id="apbct_setting_apikey"
|
801 |
-
class="apbct_setting_text apbct_setting---apikey"
|
802 |
-
type="text"
|
803 |
-
name="cleantalk_settings[apikey]"
|
804 |
-
value="'
|
805 |
-
. ($apbct->key_is_ok
|
806 |
-
? str_repeat('*', strlen($apbct->api_key))
|
807 |
-
: $apbct->api_key
|
808 |
-
)
|
809 |
-
. '"
|
810 |
-
key="' . $apbct->api_key . '"
|
811 |
-
size="20"
|
812 |
-
placeholder="' . __('Enter the key', 'cleantalk') . '"'
|
813 |
-
. ' />';
|
814 |
-
|
815 |
-
// Show account name associated with key
|
816 |
-
if(!empty($apbct->data['account_name_ob'])){
|
817 |
-
echo '<div class="apbct_display--none">'
|
818 |
-
. sprintf( __('Account at cleantalk.org is %s.', 'cleantalk'),
|
819 |
-
'<b>'.$apbct->data['account_name_ob'].'</b>'
|
820 |
-
)
|
821 |
-
. '</div>';
|
822 |
-
};
|
823 |
-
|
824 |
-
// Show key button
|
825 |
-
if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok)){
|
826 |
-
echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
|
827 |
-
. __('Show the access key', 'cleantalk')
|
828 |
-
. '</a>';
|
829 |
-
|
830 |
-
// "Auto Get Key" buttons. License agreement
|
831 |
-
}else{
|
832 |
-
|
833 |
-
echo '<br /><br />';
|
834 |
-
|
835 |
-
// Auto get key
|
836 |
-
if(!$apbct->ip_license){
|
837 |
-
echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" name="submit" type="submit" value="get_key_auto">'
|
838 |
-
.__('Get Access Key Automatically', 'cleantalk')
|
839 |
-
.'</button>';
|
840 |
-
echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
|
841 |
-
echo '<br />';
|
842 |
-
echo '<br />';
|
843 |
-
}
|
844 |
-
|
845 |
-
// Warnings and GDPR
|
846 |
-
printf( __('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
|
847 |
-
ct_get_admin_email(),
|
848 |
-
'<a target="__blank" href="'
|
849 |
-
. sprintf( 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
|
850 |
-
urlencode(ct_get_admin_email()),
|
851 |
-
urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))
|
852 |
-
)
|
853 |
-
. '">',
|
854 |
-
'</a>'
|
855 |
-
);
|
856 |
-
|
857 |
-
// License agreement
|
858 |
-
if(!$apbct->ip_license){
|
859 |
-
echo '<div>';
|
860 |
-
echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
|
861 |
-
echo '<label for="spbc_license_agreed">';
|
862 |
-
printf( __('I accept %sLicense Agreement%s.', 'cleantalk'),
|
863 |
-
'<a href="https://cleantalk.org/publicoffer" target="_blank" style="color:#66b;">',
|
864 |
-
'</a>'
|
865 |
-
);
|
866 |
-
echo "</label>";
|
867 |
-
echo '</div>';
|
868 |
-
}
|
869 |
-
}
|
870 |
-
|
871 |
-
echo '</div>';
|
872 |
-
}
|
873 |
-
|
874 |
-
function apbct_settings__field__action_buttons(){
|
875 |
-
|
876 |
-
global $apbct;
|
877 |
-
|
878 |
-
echo '<div class="apbct_settings-field_wrapper">';
|
879 |
-
|
880 |
-
if(apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok){
|
881 |
-
echo '<div>'
|
882 |
-
.'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>'
|
883 |
-
.' '
|
884 |
-
.' '
|
885 |
-
.'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>'
|
886 |
-
.' '
|
887 |
-
.' '
|
888 |
-
.'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_statistics\')">' . __('Statistics & Reports', 'cleantalk') . '</a>'
|
889 |
-
.'</div>';
|
890 |
-
|
891 |
-
}
|
892 |
-
|
893 |
-
echo '</div>';
|
894 |
-
}
|
895 |
-
|
896 |
-
function apbct_settings__field__statistics() {
|
897 |
-
|
898 |
-
global $apbct, $wpdb;
|
899 |
-
|
900 |
-
echo '<div id="apbct_statistics" class="apbct_settings-field_wrapper" style="display: none;">';
|
901 |
-
|
902 |
-
// Last request
|
903 |
-
printf(
|
904 |
-
__('Last spam check request to %s server was at %s.', 'cleantalk'),
|
905 |
-
$apbct->stats['last_request']['server'] ? $apbct->stats['last_request']['server'] : __('unknown', 'cleantalk'),
|
906 |
-
$apbct->stats['last_request']['time'] ? date('M d Y H:i:s', $apbct->stats['last_request']['time']) : __('unknown', 'cleantalk')
|
907 |
-
);
|
908 |
-
echo '<br>';
|
909 |
-
|
910 |
-
// Avarage time request
|
911 |
-
printf(
|
912 |
-
__('Average request time for past 7 days: %s seconds.', 'cleantalk'),
|
913 |
-
$apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time']
|
914 |
-
? round($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time'], 3)
|
915 |
-
: __('unknown', 'cleantalk')
|
916 |
-
);
|
917 |
-
echo '<br>';
|
918 |
-
|
919 |
-
// SFW last die
|
920 |
-
printf(
|
921 |
-
__('Last time SpamFireWall was triggered for %s IP at %s', 'cleantalk'),
|
922 |
-
$apbct->stats['last_sfw_block']['ip'] ? $apbct->stats['last_sfw_block']['ip'] : __('unknown', 'cleantalk'),
|
923 |
-
$apbct->stats['last_sfw_block']['time'] ? date('M d Y H:i:s', $apbct->stats['last_sfw_block']['time']) : __('unknown', 'cleantalk')
|
924 |
-
);
|
925 |
-
echo '<br>';
|
926 |
-
|
927 |
-
// SFW last update
|
928 |
-
$sfw_netwoks_amount = $wpdb->get_results("SELECT count(*) AS cnt FROM `".$wpdb->prefix."cleantalk_sfw`", ARRAY_A);
|
929 |
-
printf(
|
930 |
-
__('SpamFireWall was updated %s. Now contains %s entries.', 'cleantalk'),
|
931 |
-
$apbct->stats['sfw']['last_update_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_update_time']) : __('unknown', 'cleantalk'),
|
932 |
-
isset($sfw_netwoks_amount[0]['cnt']) ? $sfw_netwoks_amount[0]['cnt'] : __('unknown', 'cleantalk')
|
933 |
-
);
|
934 |
-
echo '<br>';
|
935 |
-
|
936 |
-
// SFW last sent logs
|
937 |
-
printf(
|
938 |
-
__('SpamFireWall sent %s events at %s.', 'cleantalk'),
|
939 |
-
$apbct->stats['sfw']['last_send_amount'] ? $apbct->stats['sfw']['last_send_amount'] : __('unknown', 'cleantalk'),
|
940 |
-
$apbct->stats['sfw']['last_send_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_send_time']) : __('unknown', 'cleantalk')
|
941 |
-
);
|
942 |
-
echo '<br>';
|
943 |
-
|
944 |
-
// Connection reports
|
945 |
-
if ($apbct->connection_reports){
|
946 |
-
|
947 |
-
if ($apbct->connection_reports['negative'] == 0){
|
948 |
-
_e('There are no failed connections to server.', 'cleantalk');
|
949 |
-
}else{
|
950 |
-
echo "<table id='negative_reports_table''>
|
951 |
-
<tr>
|
952 |
-
<td>#</td>
|
953 |
-
<td><b>Date</b></td>
|
954 |
-
<td><b>Page URL</b></td>
|
955 |
-
<td><b>Report</b></td>
|
956 |
-
<td><b>Server IP</b></td>
|
957 |
-
</tr>";
|
958 |
-
foreach($apbct->connection_reports['negative_report'] as $key => $report){
|
959 |
-
echo '<tr>'
|
960 |
-
. '<td>'.($key+1).'.</td>'
|
961 |
-
. '<td>'.$report['date'].'</td>'
|
962 |
-
. '<td>'.$report['page_url'].'</td>'
|
963 |
-
. '<td>'.$report['lib_report'].'</td>'
|
964 |
-
. '<td>'.$report['work_url'].'</td>'
|
965 |
-
. '</tr>';
|
966 |
-
}
|
967 |
-
echo "</table>";
|
968 |
-
echo '<br/>';
|
969 |
-
echo '<button'
|
970 |
-
. ' name="submit"'
|
971 |
-
. ' class="cleantalk_link cleantalk_link-manual"'
|
972 |
-
. ' value="ct_send_connection_report"'
|
973 |
-
. (!$apbct->settings['send_connection_reports'] ? ' disabled="disabled"' : '')
|
974 |
-
. '>'
|
975 |
-
.__('Send report', 'cleantalk')
|
976 |
-
.'</button>';
|
977 |
-
if (!$apbct->settings['send_connection_reports']){
|
978 |
-
echo '<br><br>';
|
979 |
-
_e('Please, enable "Send connection reports" setting to be able to send reports', 'cleantalk');
|
980 |
-
}
|
981 |
-
}
|
982 |
-
|
983 |
-
}
|
984 |
-
|
985 |
-
echo '</div>';
|
986 |
-
}
|
987 |
-
|
988 |
-
/**
|
989 |
-
* Get all current Wordpress roles, could except 'subscriber' role
|
990 |
-
*
|
991 |
-
* @param bool $except_subscriber
|
992 |
-
*
|
993 |
-
* @return array
|
994 |
-
*/
|
995 |
-
function apbct_get_all_roles($except_subscriber = false) {
|
996 |
-
|
997 |
-
global $wp_roles;
|
998 |
-
|
999 |
-
$wp_roles = new WP_Roles();
|
1000 |
-
$roles = $wp_roles->get_names();
|
1001 |
-
|
1002 |
-
if($except_subscriber) {
|
1003 |
-
$key = array_search( 'Subscriber', $roles );
|
1004 |
-
if ( $key !== false ) {
|
1005 |
-
unset( $roles[ $key ] );
|
1006 |
-
}
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
return $roles;
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
function apbct_settings__field__draw($params = array()){
|
1013 |
-
|
1014 |
-
global $apbct;
|
1015 |
-
|
1016 |
-
$value = $params['network'] ? $apbct->network_settings[$params['name']] : $apbct->settings[$params['name']];
|
1017 |
-
$value_parent = $params['parent']
|
1018 |
-
? ($params['network'] ? $apbct->network_settings[$params['parent']] : $apbct->settings[$params['parent']])
|
1019 |
-
: false;
|
1020 |
-
|
1021 |
-
$disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : '';
|
1022 |
-
$disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled;
|
1023 |
-
|
1024 |
-
$childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---",$params['childrens']) : '';
|
1025 |
-
$hide = $params['hide'] ? implode(",",$params['hide']) : '';
|
1026 |
-
|
1027 |
-
echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
|
1028 |
-
|
1029 |
-
switch($params['type']){
|
1030 |
-
|
1031 |
-
// Checkbox type
|
1032 |
-
case 'checkbox':
|
1033 |
-
echo '<input
|
1034 |
-
type="checkbox"
|
1035 |
-
name="cleantalk_settings['.$params['name'].']"
|
1036 |
-
id="apbct_setting_'.$params['name'].'"
|
1037 |
-
value="1" '
|
1038 |
-
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1039 |
-
.($value == '1' ? ' checked' : '')
|
1040 |
-
.$disabled
|
1041 |
-
.($params['required'] ? ' required="required"' : '')
|
1042 |
-
.' onchange="'
|
1043 |
-
. ($params['childrens'] ? ' apbctSettingsDependencies(\''. $childrens .'\');' : '')
|
1044 |
-
. ($params['hide'] ? ' apbct_show_hide_elem(\''. $hide . '\');' : '')
|
1045 |
-
. '"'
|
1046 |
-
.' />'
|
1047 |
-
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1048 |
-
.$params['title']
|
1049 |
-
.'</label>';
|
1050 |
-
echo isset($params['long_description'])
|
1051 |
-
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1052 |
-
: '';
|
1053 |
-
echo '<div class="apbct_settings-field_description">'
|
1054 |
-
.$params['description']
|
1055 |
-
.'</div>';
|
1056 |
-
break;
|
1057 |
-
|
1058 |
-
// Radio type
|
1059 |
-
case 'radio':
|
1060 |
-
|
1061 |
-
// Title
|
1062 |
-
echo isset($params['title'])
|
1063 |
-
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1064 |
-
: '';
|
1065 |
-
|
1066 |
-
// Popup description
|
1067 |
-
echo isset($params['long_description'])
|
1068 |
-
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1069 |
-
: '';
|
1070 |
-
|
1071 |
-
echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
|
1072 |
-
|
1073 |
-
$disabled = '';
|
1074 |
-
|
1075 |
-
// Disable child option if parent is ON
|
1076 |
-
if($params['reverse_trigger']){
|
1077 |
-
if($params['parent'] && $apbct->settings[$params['parent']]){
|
1078 |
-
$disabled = ' disabled="disabled"';
|
1079 |
-
}
|
1080 |
-
|
1081 |
-
// Disable child option if parent if OFF
|
1082 |
-
}else{
|
1083 |
-
if($params['parent'] && !$apbct->settings[$params['parent']]){
|
1084 |
-
$disabled = ' disabled="disabled"';
|
1085 |
-
}
|
1086 |
-
}
|
1087 |
-
|
1088 |
-
foreach($params['options'] as $option){
|
1089 |
-
echo '<input'
|
1090 |
-
.' type="radio"'
|
1091 |
-
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1092 |
-
." id='apbct_setting_{$params['name']}__{$option['label']}'"
|
1093 |
-
.' name="cleantalk_settings['.$params['name'].']"'
|
1094 |
-
.' value="'.$option['val'].'"'
|
1095 |
-
.($params['parent'] ? $disabled : '')
|
1096 |
-
.($params['childrens']
|
1097 |
-
? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"'
|
1098 |
-
: ''
|
1099 |
-
)
|
1100 |
-
.($value == $option['val'] ? ' checked' : '')
|
1101 |
-
.($params['required'] ? ' required="required"' : '')
|
1102 |
-
.' />';
|
1103 |
-
echo '<label for="apbct_setting_'.$params['name'].'__'.$option['label'].'"> ' . $option['label'] . '</label>';
|
1104 |
-
echo ' ';
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
echo isset($params['description'])
|
1108 |
-
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1109 |
-
: '';
|
1110 |
-
|
1111 |
-
echo '</div>';
|
1112 |
-
break;
|
1113 |
-
|
1114 |
-
// Dropdown list type
|
1115 |
-
case 'select':
|
1116 |
-
echo isset($params['title'])
|
1117 |
-
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1118 |
-
: '';
|
1119 |
-
echo isset($params['long_description'])
|
1120 |
-
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1121 |
-
: '';
|
1122 |
-
echo '<select'
|
1123 |
-
. ' id="apbct_setting_'.$params['name'].'"'
|
1124 |
-
. " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1125 |
-
. ' name="cleantalk_settings['.$params['name'].']'.($params['multiple'] ? '[]"' : '"')
|
1126 |
-
. ($params['multiple'] ? ' size="'. count($params['options']). '""' : '')
|
1127 |
-
. ($params['multiple'] ? ' multiple="multiple"' : '')
|
1128 |
-
. $disabled
|
1129 |
-
. ($params['required'] ? ' required="required"' : '')
|
1130 |
-
. ' >';
|
1131 |
-
|
1132 |
-
foreach($params['options'] as $option){
|
1133 |
-
echo '<option'
|
1134 |
-
. ' value="' . $option['val'] . '"'
|
1135 |
-
. ($params['multiple']
|
1136 |
-
? (in_array($option['val'], $value) ? ' selected="selected"' : '')
|
1137 |
-
: ($value == $option['val'] ? 'selected="selected"' : '')
|
1138 |
-
)
|
1139 |
-
.'>'
|
1140 |
-
. $option['label']
|
1141 |
-
. '</option>';
|
1142 |
-
}
|
1143 |
-
|
1144 |
-
echo '</select>';
|
1145 |
-
echo isset($params['long_description'])
|
1146 |
-
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1147 |
-
: '';
|
1148 |
-
echo isset($params['description'])
|
1149 |
-
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1150 |
-
: '';
|
1151 |
-
|
1152 |
-
break;
|
1153 |
-
|
1154 |
-
// Text type
|
1155 |
-
case 'text':
|
1156 |
-
|
1157 |
-
echo '<input
|
1158 |
-
type="text"
|
1159 |
-
id="apbct_setting_'.$params['name'].'"
|
1160 |
-
name="cleantalk_settings['.$params['name'].']"'
|
1161 |
-
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1162 |
-
.' value="'. $value .'" '
|
1163 |
-
.$disabled
|
1164 |
-
.($params['required'] ? ' required="required"' : '')
|
1165 |
-
.($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
|
1166 |
-
.' />'
|
1167 |
-
. ' '
|
1168 |
-
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1169 |
-
.$params['title']
|
1170 |
-
.'</label>';
|
1171 |
-
echo '<div class="apbct_settings-field_description">'
|
1172 |
-
.$params['description']
|
1173 |
-
.'</div>';
|
1174 |
-
break;
|
1175 |
-
}
|
1176 |
-
|
1177 |
-
echo '</div>';
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
/**
|
1181 |
-
* Admin callback function - Plugin parameters validator
|
1182 |
-
*
|
1183 |
-
* @global CleantalkState $apbct
|
1184 |
-
* @param array $settings Array with passed settings
|
1185 |
-
* @return array Array with processed settings
|
1186 |
-
*/
|
1187 |
-
function apbct_settings__validate($settings) {
|
1188 |
-
|
1189 |
-
global $apbct;
|
1190 |
-
|
1191 |
-
// Set missing settings.
|
1192 |
-
foreach($apbct->def_settings as $setting => $value){
|
1193 |
-
if(!isset($settings[$setting])){
|
1194 |
-
$settings[$setting] = null;
|
1195 |
-
settype($settings[$setting], gettype($value));
|
1196 |
-
}
|
1197 |
-
} unset($setting, $value);
|
1198 |
-
|
1199 |
-
// Set missing settings.
|
1200 |
-
foreach($apbct->def_network_settings as $setting => $value){
|
1201 |
-
if(!isset($settings[$setting])){
|
1202 |
-
$settings[$setting] = null;
|
1203 |
-
settype($settings[$setting], gettype($value));
|
1204 |
-
}
|
1205 |
-
} unset($setting, $value);
|
1206 |
-
|
1207 |
-
// Validating API key
|
1208 |
-
$settings['apikey'] = !empty($settings['apikey']) ? trim($settings['apikey']) : '';
|
1209 |
-
$settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $settings['apikey'];
|
1210 |
-
$settings['apikey'] = is_main_site() || $apbct->allow_custom_key ? $settings['apikey'] : $apbct->network_settings['apikey'];
|
1211 |
-
$settings['apikey'] = is_main_site() || !$settings['white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
|
1212 |
-
$settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
|
1213 |
-
|
1214 |
-
// Validate Exclusions
|
1215 |
-
// URLs
|
1216 |
-
$result = apbct_settings__sanitize__exclusions($settings['exclusions__urls'], $settings['exclusions__urls__use_regexp']);
|
1217 |
-
$result === false
|
1218 |
-
? $apbct->error_add( 'exclusions_urls', 'is not valid: "' . $settings['exclusions__urls'] . '"', 'settings_validate' )
|
1219 |
-
: $apbct->error_delete( 'exclusions_urls', true, 'settings_validate' );
|
1220 |
-
$settings['exclusions_urls'] = $result ? $result: '';
|
1221 |
-
|
1222 |
-
// Fields
|
1223 |
-
$result = apbct_settings__sanitize__exclusions($settings['exclusions__fields'], $settings['exclusions__fields__use_regexp']);
|
1224 |
-
$result === false
|
1225 |
-
? $apbct->error_add( 'exclusions_fields', 'is not valid: "' . $settings['exclusions__fields'] . '"', 'settings_validate' )
|
1226 |
-
: $apbct->error_delete( 'exclusions_fields', true, 'settings_validate' );
|
1227 |
-
$settings['exclusions__fields'] = $result ? $result: '';
|
1228 |
-
|
1229 |
-
// WPMS Logic.
|
1230 |
-
if(APBCT_WPMS && is_main_site()){
|
1231 |
-
$network_settings = array(
|
1232 |
-
'allow_custom_key' => $settings['allow_custom_key'],
|
1233 |
-
'white_label' => $settings['white_label'],
|
1234 |
-
'white_label__hoster_key' => $settings['white_label__hoster_key'],
|
1235 |
-
'white_label__plugin_name' => $settings['white_label__plugin_name'],
|
1236 |
-
);
|
1237 |
-
unset( $settings['allow_custom_key'], $settings['white_label'], $settings['white_label__hoster_key'], $settings['white_label__plugin_name'] );
|
1238 |
-
}
|
1239 |
-
|
1240 |
-
// Drop debug data
|
1241 |
-
if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
|
1242 |
-
$apbct->debug = false;
|
1243 |
-
delete_option('cleantalk_debug');
|
1244 |
-
return $settings;
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
// Send connection reports
|
1248 |
-
if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
|
1249 |
-
ct_mail_send_connection_report();
|
1250 |
-
return $settings;
|
1251 |
-
}
|
1252 |
-
|
1253 |
-
// Auto getting key
|
1254 |
-
if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
|
1255 |
-
|
1256 |
-
$website = parse_url(get_option('siteurl'), PHP_URL_HOST).parse_url(get_option('siteurl'), PHP_URL_PATH);
|
1257 |
-
$platform = 'wordpress';
|
1258 |
-
$user_ip = CleantalkHelper::ip__get(array('real'), false);
|
1259 |
-
$timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
|
1260 |
-
$language = filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE');
|
1261 |
-
$wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
|
1262 |
-
$white_label = $apbct->network_settings['white_label'] ? 1 : 0;
|
1263 |
-
$hoster_api_key = $apbct->network_settings['white_label__hoster_key'] ? $apbct->network_settings['white_label__hoster_key'] : '';
|
1264 |
-
|
1265 |
-
$result = CleantalkAPI::method__get_api_key(
|
1266 |
-
'antispam',
|
1267 |
-
ct_get_admin_email(),
|
1268 |
-
$website,
|
1269 |
-
$platform,
|
1270 |
-
$timezone,
|
1271 |
-
$language,
|
1272 |
-
$user_ip,
|
1273 |
-
$wpms,
|
1274 |
-
$white_label,
|
1275 |
-
$hoster_api_key
|
1276 |
-
);
|
1277 |
-
|
1278 |
-
if(empty($result['error'])){
|
1279 |
-
|
1280 |
-
if(isset($result['user_token'])){
|
1281 |
-
$apbct->data['user_token'] = $result['user_token'];
|
1282 |
-
}
|
1283 |
-
|
1284 |
-
if(!empty($result['auth_key'])){
|
1285 |
-
$settings['apikey'] = $result['auth_key'];
|
1286 |
-
}
|
1287 |
-
|
1288 |
-
}else{
|
1289 |
-
$apbct->error_add(
|
1290 |
-
'key_get',
|
1291 |
-
$result
|
1292 |
-
. ($apbct->white_label
|
1293 |
-
? ' <button name="submit" type="submit" class="cleantalk_link cleantalk_link-manual" value="get_key_auto">'
|
1294 |
-
: ''
|
1295 |
-
)
|
1296 |
-
);
|
1297 |
-
}
|
1298 |
-
}
|
1299 |
-
|
1300 |
-
// Feedback with app_agent
|
1301 |
-
ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
|
1302 |
-
|
1303 |
-
// Key is good by default
|
1304 |
-
$apbct->data['key_is_ok'] = true;
|
1305 |
-
|
1306 |
-
// Check account status and validate key. Even if it's not correct because of IP license.
|
1307 |
-
$result = ct_account_status_check($settings['apikey']);
|
1308 |
-
|
1309 |
-
// Is key valid?
|
1310 |
-
if($result){
|
1311 |
-
|
1312 |
-
// Deleting errors about invalid key
|
1313 |
-
$apbct->error_delete('key_invalid key_get', 'save');
|
1314 |
-
|
1315 |
-
// SFW actions
|
1316 |
-
if($apbct->settings['spam_firewall'] == 1){
|
1317 |
-
ct_sfw_update($settings['apikey']);
|
1318 |
-
ct_sfw_send_logs($settings['apikey']);
|
1319 |
-
}
|
1320 |
-
|
1321 |
-
// Updating brief data for dashboard widget
|
1322 |
-
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1323 |
-
|
1324 |
-
// Key is not valid
|
1325 |
-
}else{
|
1326 |
-
$apbct->data['key_is_ok'] = false;
|
1327 |
-
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
1328 |
-
}
|
1329 |
-
|
1330 |
-
// WPMS Logic.
|
1331 |
-
if(APBCT_WPMS){
|
1332 |
-
if(is_main_site()){
|
1333 |
-
|
1334 |
-
// Network settings
|
1335 |
-
$network_settings['apikey'] = $settings['apikey'];
|
1336 |
-
$apbct->network_settings = $network_settings;
|
1337 |
-
$apbct->saveNetworkSettings();
|
1338 |
-
|
1339 |
-
// Network data
|
1340 |
-
$apbct->network_data = array(
|
1341 |
-
'key_is_ok' => $apbct->data['key_is_ok'],
|
1342 |
-
'moderate' => $apbct->data['moderate'],
|
1343 |
-
'valid' => $apbct->data['valid'],
|
1344 |
-
'auto_update' => $apbct->data['auto_update'],
|
1345 |
-
'user_token' => $apbct->data['user_token'],
|
1346 |
-
'service_id' => $apbct->data['service_id'],
|
1347 |
-
);
|
1348 |
-
$apbct->saveNetworkData();
|
1349 |
-
}
|
1350 |
-
if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
|
1351 |
-
$settings['apikey'] = '';
|
1352 |
-
}
|
1353 |
-
}
|
1354 |
-
|
1355 |
-
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1356 |
-
|
1357 |
-
// Notices
|
1358 |
-
$apbct->data['notice_show'] = 1;
|
1359 |
-
$apbct->data['notice_renew'] = 0;
|
1360 |
-
$apbct->data['notice_trial'] = 0;
|
1361 |
-
$apbct->data['notice_review'] = 0;
|
1362 |
-
$apbct->data['notice_auto_update'] = 0;
|
1363 |
-
|
1364 |
-
// Other
|
1365 |
-
$apbct->data['service_id'] = 0;
|
1366 |
-
$apbct->data['valid'] = 0;
|
1367 |
-
$apbct->data['moderate'] = 0;
|
1368 |
-
$apbct->data['ip_license'] = 0;
|
1369 |
-
$apbct->data['moderate_ip'] = 0;
|
1370 |
-
$apbct->data['spam_count'] = 0;
|
1371 |
-
$apbct->data['auto_update'] = 0;
|
1372 |
-
$apbct->data['user_token'] = '';
|
1373 |
-
$apbct->data['license_trial'] = 0;
|
1374 |
-
$apbct->data['account_name_ob'] = '';
|
1375 |
-
}
|
1376 |
-
|
1377 |
-
$apbct->saveData();
|
1378 |
-
|
1379 |
-
return $settings;
|
1380 |
-
}
|
1381 |
-
|
1382 |
-
/**
|
1383 |
-
* Sanitize and validate exclusions.
|
1384 |
-
* Explode given string by commas and trim each string.
|
1385 |
-
* Skip element if it's empty.
|
1386 |
-
*
|
1387 |
-
* Return false if exclusion is bad
|
1388 |
-
* Return sanitized string if all is ok
|
1389 |
-
*
|
1390 |
-
* @param string $exclusions
|
1391 |
-
* @param bool $regexp
|
1392 |
-
*
|
1393 |
-
* @return bool|string
|
1394 |
-
*/
|
1395 |
-
function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
|
1396 |
-
$result = array();
|
1397 |
-
if( ! empty( $exclusions ) ){
|
1398 |
-
$exclusions = explode( ',', $exclusions );
|
1399 |
-
foreach ( $exclusions as $exclusion ){
|
1400 |
-
$sanitized_exclusion = trim( $exclusion );
|
1401 |
-
if ( ! empty( $sanitized_exclusion ) ) {
|
1402 |
-
if( $regexp && ! apbct_is_regexp( $exclusion ) )
|
1403 |
-
return false;
|
1404 |
-
$result[] = $sanitized_exclusion;
|
1405 |
-
}
|
1406 |
-
}
|
1407 |
-
}
|
1408 |
-
return implode( ',', $result );
|
1409 |
-
}
|
1410 |
-
|
1411 |
-
function apbct_settings_show_gdpr_text($print = false){
|
1412 |
-
|
1413 |
-
$out = wpautop('The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided.
|
1414 |
-
Automated individual decision-making, including profiling (Article 22) is contestable, similarly to the Data Protection Directive (Article 15). Citizens have rights to question and fight significant decisions that affect them that have been made on a solely-algorithmic basis. Many media outlets have commented on the introduction of a "right to explanation" of algorithmic decisions, but legal scholars have since argued that the existence of such a right is highly unclear without judicial tests and is limited at best.
|
1415 |
-
To be able to demonstrate compliance with the GDPR, the data controller should implement measures, which meet the principles of data protection by design and data protection by default. Privacy by design and by default (Article 25) require data protection measures to be designed into the development of business processes for products and services. Such measures include pseudonymising personal data, by the controller, as soon as possible (Recital 78).
|
1416 |
-
It is the responsibility and the liability of the data controller to implement effective measures and be able to demonstrate the compliance of processing activities even if the processing is carried out by a data processor on behalf of the controller (Recital 74).
|
1417 |
-
Data Protection Impact Assessments (Article 35) have to be conducted when specific risks occur to the rights and freedoms of data subjects. Risk assessment and mitigation is required and prior approval of the national data protection authorities (DPAs) is required for high risks. Data protection officers (Articles 37–39) are required to ensure compliance within organisations.
|
1418 |
-
They have to be appointed:')
|
1419 |
-
.'<ul style="padding: 0px 25px; list-style: disc;">'
|
1420 |
-
.'<li>for all public authorities, except for courts acting in their judicial capacity</li>'
|
1421 |
-
.'<li>if the core activities of the controller or the processor are:</li>'
|
1422 |
-
.'<ul style="padding: 0px 25px; list-style: disc;">'
|
1423 |
-
.'<li>processing operations, which, by virtue of their nature, their scope and/or their purposes, require regular and systematic monitoring of data subjects on a large scale</li>'
|
1424 |
-
.'<li>processing on a large scale of special categories of data pursuant to Article 9 and personal data relating to criminal convictions and offences referred to in Article 10;</li>'
|
1425 |
-
.'</ul>'
|
1426 |
-
.'</li>'
|
1427 |
-
.'</ul>';
|
1428 |
-
|
1429 |
-
if($print) echo $out; else return $out;
|
1430 |
-
}
|
1431 |
-
|
1432 |
-
function apbct_settings__get__long_description(){
|
1433 |
-
|
1434 |
-
global $apbct;
|
1435 |
-
|
1436 |
-
check_ajax_referer('ct_secret_nonce' );
|
1437 |
-
|
1438 |
-
$setting_id = $_POST['setting_id'] ? $_POST['setting_id'] : '';
|
1439 |
-
|
1440 |
-
$descriptions = array(
|
1441 |
-
'white_label' => array(
|
1442 |
-
'title' => __( 'XSS check', 'cleantalk' ),
|
1443 |
-
'desc' => __( 'Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to any user. As a result malicious scripts can not get access to the cookie files, session tokens and any other confidential information browsers use and store. Such scripts can even overwrite content of HTML pages. CleanTalk WAF monitors for patterns of these parameters and block them.', 'cleantalk' ),
|
1444 |
-
),
|
1445 |
-
'white_label__hoster_key' => array(
|
1446 |
-
'title' => __( 'SQL-injection check', 'cleantalk' ),
|
1447 |
-
'desc' => __( 'SQL Injection — one of the most popular ways to hack websites and programs that work with databases. It is based on injection of a custom SQL code into database queries. It could transmit data through GET, POST requests or cookie files in an SQL code. If a website is vulnerable and execute such injections then it would allow attackers to apply changes to the website\'s MySQL database.', 'cleantalk' ),
|
1448 |
-
),
|
1449 |
-
'white_label__plugin_name' => array(
|
1450 |
-
'title' => __( 'Check uploaded files', 'cleantalk' ),
|
1451 |
-
'desc' => __( 'The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'cleantalk' ),
|
1452 |
-
),
|
1453 |
-
);
|
1454 |
-
|
1455 |
-
die(json_encode($descriptions[$setting_id]));
|
1456 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Admin action 'admin_menu' - Add the admin options page
|
5 |
+
*/
|
6 |
+
function apbct_settings_add_page() {
|
7 |
+
|
8 |
+
global $apbct, $pagenow;
|
9 |
+
|
10 |
+
$parent_slug = is_network_admin() ? 'settings.php' : 'options-general.php';
|
11 |
+
$callback = is_network_admin() ? 'apbct_settings__display__network' : 'apbct_settings__display';
|
12 |
+
|
13 |
+
// Adding settings page
|
14 |
+
add_submenu_page(
|
15 |
+
$parent_slug,
|
16 |
+
$apbct->plugin_name.' '.__('settings'),
|
17 |
+
$apbct->plugin_name,
|
18 |
+
'manage_options',
|
19 |
+
'cleantalk',
|
20 |
+
$callback
|
21 |
+
);
|
22 |
+
|
23 |
+
if(!in_array($pagenow, array('options.php', 'options-general.php', 'settings.php', 'admin.php')))
|
24 |
+
return;
|
25 |
+
|
26 |
+
register_setting('cleantalk_settings', 'cleantalk_settings', 'apbct_settings__validate');
|
27 |
+
|
28 |
+
$fields = array();
|
29 |
+
$fields = apbct_settings__set_fileds($fields);
|
30 |
+
$fields = APBCT_WPMS && is_main_site() ? apbct_settings__set_fileds__network($fields) : $fields;
|
31 |
+
apbct_settings__add_groups_and_fields($fields);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
function apbct_settings__set_fileds( $fields ){
|
36 |
+
global $apbct;
|
37 |
+
|
38 |
+
$fields = array(
|
39 |
+
|
40 |
+
'main' => array(
|
41 |
+
'title' => '',
|
42 |
+
'default_params' => array(),
|
43 |
+
'description' => '',
|
44 |
+
'html_before' => '',
|
45 |
+
'html_after' => '',
|
46 |
+
'fields' => array(
|
47 |
+
'action_buttons' => array(
|
48 |
+
'callback' => 'apbct_settings__field__action_buttons',
|
49 |
+
),
|
50 |
+
'connection_reports' => array(
|
51 |
+
'callback' => 'apbct_settings__field__statistics',
|
52 |
+
),
|
53 |
+
'api_key' => array(
|
54 |
+
'display' => !$apbct->white_label || is_main_site(),
|
55 |
+
'callback' => 'apbct_settings__field__apikey',
|
56 |
+
),
|
57 |
+
),
|
58 |
+
),
|
59 |
+
|
60 |
+
'state' => array(
|
61 |
+
'title' => '',
|
62 |
+
'default_params' => array(),
|
63 |
+
'description' => '',
|
64 |
+
'html_before' => '<hr style="width: 100%;">',
|
65 |
+
'html_after' => '',
|
66 |
+
'fields' => array(
|
67 |
+
'state' => array(
|
68 |
+
'callback' => 'apbct_settings__field__state',
|
69 |
+
),
|
70 |
+
),
|
71 |
+
),
|
72 |
+
|
73 |
+
'debug' => array(
|
74 |
+
'title' => '',
|
75 |
+
'default_params' => array(),
|
76 |
+
'description' => '',
|
77 |
+
'html_before' => '',
|
78 |
+
'html_after' => '',
|
79 |
+
'fields' => array(
|
80 |
+
'state' => array(
|
81 |
+
'callback' => 'apbct_settings__field__debug',
|
82 |
+
),
|
83 |
+
),
|
84 |
+
),
|
85 |
+
|
86 |
+
// Different
|
87 |
+
'different' => array(
|
88 |
+
'title' => '',
|
89 |
+
'default_params' => array(),
|
90 |
+
'description' => '',
|
91 |
+
'html_before' => '<hr>',
|
92 |
+
'html_after' => '',
|
93 |
+
'fields' => array(
|
94 |
+
'spam_firewall' => array(
|
95 |
+
'type' => 'checkbox',
|
96 |
+
'title' => __('SpamFireWall', 'cleantalk'),
|
97 |
+
'description' => __("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'),
|
98 |
+
),
|
99 |
+
),
|
100 |
+
),
|
101 |
+
|
102 |
+
// Forms protection
|
103 |
+
'forms_protection' => array(
|
104 |
+
'title' => __('Forms to protect', 'cleantalk'),
|
105 |
+
'default_params' => array(),
|
106 |
+
'description' => '',
|
107 |
+
'html_before' => '<hr><br>'
|
108 |
+
.'<span id="ct_adv_showhide">'
|
109 |
+
.'<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'apbct_settings__davanced_settings\');">'
|
110 |
+
.__('Advanced settings', 'cleantalk')
|
111 |
+
.'</a>'
|
112 |
+
.'</span>'
|
113 |
+
.'<div id="apbct_settings__davanced_settings" style="display: none;">',
|
114 |
+
'html_after' => '',
|
115 |
+
'fields' => array(
|
116 |
+
'registrations_test' => array(
|
117 |
+
'title' => __('Registration Forms', 'cleantalk'),
|
118 |
+
'description' => __('WordPress, BuddyPress, bbPress, S2Member, WooCommerce.', 'cleantalk'),
|
119 |
+
),
|
120 |
+
'comments_test' => array(
|
121 |
+
'title' => __('Comments form', 'cleantalk'),
|
122 |
+
'description' => __('WordPress, JetPack, WooCommerce.', 'cleantalk'),
|
123 |
+
),
|
124 |
+
'contact_forms_test' => array(
|
125 |
+
'title' => __('Contact forms', 'cleantalk'),
|
126 |
+
'description' => __('Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages, Gravity Forms.', 'cleantalk'),
|
127 |
+
),
|
128 |
+
'general_contact_forms_test' => array(
|
129 |
+
'title' => __('Custom contact forms', 'cleantalk'),
|
130 |
+
'description' => __('Anti spam test for any WordPress themes or contacts forms.', 'cleantalk'),
|
131 |
+
),
|
132 |
+
'wc_checkout_test' => array(
|
133 |
+
'title' => __('WooCommerce checkout form', 'cleantalk'),
|
134 |
+
'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk'),
|
135 |
+
'childrens' => array('wc_register_from_order')
|
136 |
+
),
|
137 |
+
'wc_register_from_order' => array(
|
138 |
+
'title' => __('Spam test for registration during checkout', 'cleantalk'),
|
139 |
+
'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk'),
|
140 |
+
'parent' => 'wc_checkout_test',
|
141 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
142 |
+
'reverse_trigger' => true
|
143 |
+
),
|
144 |
+
'search_test' => array(
|
145 |
+
'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
|
146 |
+
'description' => __('Spam protection for Search form.', 'cleantalk')
|
147 |
+
. (!$apbct->white_label || is_main_site()
|
148 |
+
? sprintf(__('Read more about %sspam protection for Search form%s on our blog.', 'cleantalk'),
|
149 |
+
'<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
|
150 |
+
'</a>'
|
151 |
+
)
|
152 |
+
: ''
|
153 |
+
)
|
154 |
+
),
|
155 |
+
'check_external' => array(
|
156 |
+
'title' => __('Protect external forms', 'cleantalk'),
|
157 |
+
'description' => __('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'),
|
158 |
+
'childrens' => array('check_external__capture_buffer'),
|
159 |
+
),
|
160 |
+
'check_external__capture_buffer' => array(
|
161 |
+
'title' => __('Capture buffer', 'cleantalk'),
|
162 |
+
'description' => __('This setting gives you more sophisticated and strengthened protection for external forms. But it could break plugins which use a buffer like Ninja Forms.', 'cleantalk'),
|
163 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
164 |
+
'parent' => 'check_external',
|
165 |
+
),
|
166 |
+
'check_internal' => array(
|
167 |
+
'title' => __('Protect internal forms', 'cleantalk'),
|
168 |
+
'description' => __('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'),
|
169 |
+
),
|
170 |
+
),
|
171 |
+
),
|
172 |
+
|
173 |
+
// Comments and Messages
|
174 |
+
'comments_and_messages' => array(
|
175 |
+
'title' => __('Comments and Messages', 'cleantalk'),
|
176 |
+
'fields' => array(
|
177 |
+
'bp_private_messages' => array(
|
178 |
+
'title' => __('BuddyPress Private Messages', 'cleantalk'),
|
179 |
+
'description' => __('Check buddyPress private messages.', 'cleantalk'),
|
180 |
+
),
|
181 |
+
'check_comments_number' => array(
|
182 |
+
'title' => __("Don't check trusted user's comments", 'cleantalk'),
|
183 |
+
'description' => sprintf(__("Don't check comments for users with above %d comments.", 'cleantalk'), defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3),
|
184 |
+
),
|
185 |
+
'remove_old_spam' => array(
|
186 |
+
'title' => __('Automatically delete spam comments', 'cleantalk'),
|
187 |
+
'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
|
188 |
+
),
|
189 |
+
'remove_comments_links' => array(
|
190 |
+
'title' => __('Remove links from approved comments', 'cleantalk'),
|
191 |
+
'description' => __('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'),
|
192 |
+
),
|
193 |
+
'show_check_links' => array(
|
194 |
+
'title' => __('Show links to check Emails, IPs for spam.', 'cleantalk'),
|
195 |
+
'description' => __('Shows little icon near IP addresses and Emails allowing you to check it via CleanTalk\'s database. Also allowing you to manage comments from the public post\'s page.', 'cleantalk'),
|
196 |
+
'display' => !$apbct->white_label,
|
197 |
+
),
|
198 |
+
),
|
199 |
+
),
|
200 |
+
|
201 |
+
// Data Processing
|
202 |
+
'data_processing' => array(
|
203 |
+
'title' => __('Data Processing', 'cleantalk'),
|
204 |
+
'fields' => array(
|
205 |
+
'protect_logged_in' => array(
|
206 |
+
'title' => __("Protect logged in Users", 'cleantalk'),
|
207 |
+
'description' => __('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk'),
|
208 |
+
),
|
209 |
+
'use_ajax' => array(
|
210 |
+
'title' => __('Use AJAX for JavaScript check', 'cleantalk'),
|
211 |
+
'description' => __('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'),
|
212 |
+
),
|
213 |
+
'use_static_js_key' => array(
|
214 |
+
'title' => __('Use static keys for JS check.', 'cleantalk'),
|
215 |
+
'description' => __('Could help if you have cache for AJAX requests and you are dealing with false positives. Slightly decreases protection quality. Auto - Static key will be used if caching plugin is spotted.', 'cleantalk'),
|
216 |
+
'options' => array(
|
217 |
+
array('val' => 1, 'label' => __('On'), ),
|
218 |
+
array('val' => 0, 'label' => __('Off'), ),
|
219 |
+
array('val' => -1, 'label' => __('Auto'),),
|
220 |
+
),
|
221 |
+
),
|
222 |
+
'general_postdata_test' => array(
|
223 |
+
'title' => __('Check all post data', 'cleantalk'),
|
224 |
+
'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
|
225 |
+
.(!$apbct->white_label
|
226 |
+
? __(' Or you don`t have records about missed spam here:', 'cleantalk') . ' ' . '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">' . __('CleanTalk dashboard', 'cleantalk') . '</a>.'
|
227 |
+
: ''
|
228 |
+
)
|
229 |
+
.'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'),
|
230 |
+
),
|
231 |
+
'set_cookies' => array(
|
232 |
+
'title' => __("Set cookies", 'cleantalk'),
|
233 |
+
'description' => __('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could cause false positives spam detection.</b>', 'cleantalk'),
|
234 |
+
'childrens' => array('set_cookies__sessions'),
|
235 |
+
),
|
236 |
+
'set_cookies__sessions' => array(
|
237 |
+
'title' => __('Use alternative mechanism for cookies', 'cleantalk'),
|
238 |
+
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
239 |
+
'parent' => 'set_cookies',
|
240 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
241 |
+
),
|
242 |
+
'ssl_on' => array(
|
243 |
+
'title' => __("Use SSL", 'cleantalk'),
|
244 |
+
'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
|
245 |
+
),
|
246 |
+
'use_buitin_http_api' => array(
|
247 |
+
'title' => __("Use Wordpress HTTP API", 'cleantalk'),
|
248 |
+
'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
|
249 |
+
),
|
250 |
+
),
|
251 |
+
),
|
252 |
+
|
253 |
+
// Exclusions
|
254 |
+
'exclusions' => array(
|
255 |
+
'title' => __('Exclusions', 'cleantalk'),
|
256 |
+
'fields' => array(
|
257 |
+
'exclusions__urls' => array(
|
258 |
+
'type' => 'text',
|
259 |
+
'title' => __('URL exclusions', 'cleantalk'),
|
260 |
+
'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
|
261 |
+
),
|
262 |
+
'exclusions__urls__use_regexp' => array(
|
263 |
+
'type' => 'checkbox',
|
264 |
+
'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
|
265 |
+
),
|
266 |
+
'exclusions__fields' => array(
|
267 |
+
'type' => 'text',
|
268 |
+
'title' => __('Field name exclusions', 'cleantalk'),
|
269 |
+
'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
|
270 |
+
),
|
271 |
+
'exclusions__fields__use_regexp' => array(
|
272 |
+
'type' => 'checkbox',
|
273 |
+
'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
|
274 |
+
),
|
275 |
+
'exclusions__roles' => array(
|
276 |
+
'type' => 'select',
|
277 |
+
'multiple' => true,
|
278 |
+
'options_callback' => 'apbct_get_all_roles',
|
279 |
+
'options_callback_params' => array(true),
|
280 |
+
'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
|
281 |
+
),
|
282 |
+
),
|
283 |
+
),
|
284 |
+
|
285 |
+
// Admin bar
|
286 |
+
'admin_bar' => array(
|
287 |
+
'title' => __('Admin bar', 'cleantalk'),
|
288 |
+
'default_params' => array(),
|
289 |
+
'description' => '',
|
290 |
+
'html_before' => '',
|
291 |
+
'html_after' => '',
|
292 |
+
'fields' => array(
|
293 |
+
'show_adminbar' => array(
|
294 |
+
'title' => __('Show statistics in admin bar', 'cleantalk'),
|
295 |
+
'description' => __('Show/hide icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'),
|
296 |
+
'childrens' => array('all_time_counter','daily_counter','sfw_counter'),
|
297 |
+
),
|
298 |
+
'all_time_counter' => array(
|
299 |
+
'title' => __('Show All-time counter', 'cleantalk'),
|
300 |
+
'description' => __('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
301 |
+
'parent' => 'show_adminbar',
|
302 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
303 |
+
),
|
304 |
+
'daily_counter' => array(
|
305 |
+
'title' => __('Show 24 hours counter', 'cleantalk'),
|
306 |
+
'description' => __('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'),
|
307 |
+
'parent' => 'show_adminbar',
|
308 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
309 |
+
),
|
310 |
+
'sfw_counter' => array(
|
311 |
+
'title' => __('SpamFireWall counter', 'cleantalk'),
|
312 |
+
'description' => __('Display SpamFireWall requests in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
313 |
+
'parent' => 'show_adminbar',
|
314 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
315 |
+
),
|
316 |
+
),
|
317 |
+
),
|
318 |
+
|
319 |
+
// Misc
|
320 |
+
'misc' => array(
|
321 |
+
'html_after' => '</div><br>',
|
322 |
+
'fields' => array(
|
323 |
+
'collect_details' => array(
|
324 |
+
'type' => 'checkbox',
|
325 |
+
'title' => __('Collect details about browsers', 'cleantalk'),
|
326 |
+
'description' => __("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'),
|
327 |
+
),
|
328 |
+
'send_connection_reports' => array(
|
329 |
+
'type' => 'checkbox',
|
330 |
+
'title' => __('Send connection reports', 'cleantalk'),
|
331 |
+
'description' => __("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'),
|
332 |
+
),
|
333 |
+
'async_js' => array(
|
334 |
+
'type' => 'checkbox',
|
335 |
+
'title' => __('Async JavaScript loading', 'cleantalk'),
|
336 |
+
'description' => __('Use async loading for scripts. Warning: This could reduce filtration quality.', 'cleantalk'),
|
337 |
+
),
|
338 |
+
'gdpr_enabled' => array(
|
339 |
+
'type' => 'checkbox',
|
340 |
+
'title' => __('Allow to add GDPR notice via shortcode', 'cleantalk'),
|
341 |
+
'description' => __(' Adds small checkbox under your website form. To add it you should use the shortcode on the form\'s page: [cleantalk_gdpr_form id="FORM_ID"]', 'cleantalk'),
|
342 |
+
'childrens' => array('gdpr_text'),
|
343 |
+
),
|
344 |
+
'gdpr_text' => array(
|
345 |
+
'type' => 'text',
|
346 |
+
'title' => __('GDPR text notice', 'cleantalk'),
|
347 |
+
'description' => __('This text will be added as a description to the GDPR checkbox.', 'cleantalk'),
|
348 |
+
'parent' => 'gdpr_enabled',
|
349 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
350 |
+
),
|
351 |
+
'store_urls' => array(
|
352 |
+
'type' => 'checkbox',
|
353 |
+
'title' => __('Store visited URLs', 'cleantalk'),
|
354 |
+
'description' => __("Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits form on the site. You can see stored visited URLS for each visitor in your Dashboard. Turn the option on to improve Anti-Spam protection.", 'cleantalk'),
|
355 |
+
'childrens' => array('store_urls__sessions'),
|
356 |
+
),
|
357 |
+
'store_urls__sessions' => array(
|
358 |
+
'type' => 'checkbox',
|
359 |
+
'title' => __('Use cookies less sessions', 'cleantalk'),
|
360 |
+
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
361 |
+
'parent' => 'store_urls',
|
362 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
363 |
+
),
|
364 |
+
'comment_notify' => array(
|
365 |
+
'type' => 'checkbox',
|
366 |
+
'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
|
367 |
+
'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
|
368 |
+
'childrens' => array('comment_notify__roles'),
|
369 |
+
),
|
370 |
+
'comment_notify__roles' => array(
|
371 |
+
'type' => 'select',
|
372 |
+
'multiple' => true,
|
373 |
+
'parent' => 'comment_notify',
|
374 |
+
'options_callback' => 'apbct_get_all_roles',
|
375 |
+
'options_callback_params' => array(true),
|
376 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
377 |
+
),
|
378 |
+
'complete_deactivation' => array(
|
379 |
+
'type' => 'checkbox',
|
380 |
+
'title' => __('Complete deactivation', 'cleantalk'),
|
381 |
+
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
382 |
+
),
|
383 |
+
|
384 |
+
),
|
385 |
+
),
|
386 |
+
);
|
387 |
+
|
388 |
+
return $fields;
|
389 |
+
}
|
390 |
+
|
391 |
+
function apbct_settings__set_fileds__network( $fields ){
|
392 |
+
global $apbct;
|
393 |
+
$additional_fields = array(
|
394 |
+
'main' => array(
|
395 |
+
'fields' => array(
|
396 |
+
'white_label' => array(
|
397 |
+
'type' => 'checkbox',
|
398 |
+
'title' => __('Enable White Label Mode', 'cleantalk'),
|
399 |
+
'description' => sprintf(__("Learn more information %shere%s.", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">', '</a>'),
|
400 |
+
'childrens' => array('white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key'),
|
401 |
+
'network' => true,
|
402 |
+
),
|
403 |
+
'white_label__hoster_key' => array(
|
404 |
+
'title' => __('Hoster API Key', 'cleantalk'),
|
405 |
+
'description' => sprintf(__("You can get it in %sCleantalk's Control Panel%s", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/my/?cp_mode=hosting-antispam">', '</a>'),
|
406 |
+
'type' => 'text',
|
407 |
+
'parent' => 'white_label',
|
408 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
409 |
+
'network' => true,
|
410 |
+
'required' => true,
|
411 |
+
),
|
412 |
+
'white_label__plugin_name' => array(
|
413 |
+
'title' => __('Plugin name', 'cleantalk'),
|
414 |
+
'description' => sprintf(__("Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s", 'cleantalk'), '<b>', '</b>'),
|
415 |
+
'type' => 'text',
|
416 |
+
'parent' => 'white_label',
|
417 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
418 |
+
'network' => true,
|
419 |
+
'required' => true,
|
420 |
+
),
|
421 |
+
'allow_custom_key' => array(
|
422 |
+
'type' => 'checkbox',
|
423 |
+
'title' => __('Allow users to use other key', 'cleantalk'),
|
424 |
+
'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
|
425 |
+
. (defined('CLEANTALK_ACCESS_KEY')
|
426 |
+
? ' <span style="color: red">'
|
427 |
+
. __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
|
428 |
+
. '</span>'
|
429 |
+
: ''
|
430 |
+
),
|
431 |
+
'display' => APBCT_WPMS && is_main_site(),
|
432 |
+
'disabled' => $apbct->network_settings['white_label'],
|
433 |
+
'network' => true,
|
434 |
+
),
|
435 |
+
)
|
436 |
+
)
|
437 |
+
);
|
438 |
+
|
439 |
+
$fields = array_merge_recursive($fields, $additional_fields);
|
440 |
+
|
441 |
+
return $fields;
|
442 |
+
|
443 |
+
}
|
444 |
+
|
445 |
+
function apbct_settings__add_groups_and_fields( $fields ){
|
446 |
+
|
447 |
+
global $apbct;
|
448 |
+
|
449 |
+
$apbct->settings_fields_in_groups = $fields;
|
450 |
+
|
451 |
+
$field_default_params = array(
|
452 |
+
'callback' => 'apbct_settings__field__draw',
|
453 |
+
'type' => 'radio',
|
454 |
+
'options' => array(
|
455 |
+
array('val' => 1, 'label' => __('On'),),
|
456 |
+
array('val' => 0, 'label' => __('Off'),),
|
457 |
+
),
|
458 |
+
'def_class' => 'apbct_settings-field_wrapper',
|
459 |
+
'class' => '',
|
460 |
+
'parent' => '',
|
461 |
+
'childrens' => array(),
|
462 |
+
'hide' => array(),
|
463 |
+
// 'title' => 'Default title',
|
464 |
+
// 'description' => 'Default description',
|
465 |
+
'display' => true, // Draw settings or not
|
466 |
+
'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
|
467 |
+
'multiple' => false,
|
468 |
+
'description' => '',
|
469 |
+
'network' => false,
|
470 |
+
'disabled' => false,
|
471 |
+
'required' => false,
|
472 |
+
);
|
473 |
+
|
474 |
+
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
475 |
+
|
476 |
+
add_settings_section('apbct_section__'.$group_name, '', 'apbct_section__'.$group_name, 'cleantalk');
|
477 |
+
|
478 |
+
foreach($group['fields'] as $field_name => $field){
|
479 |
+
|
480 |
+
// Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
|
481 |
+
if(!empty($field['options_callback'])){
|
482 |
+
$options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
|
483 |
+
foreach ($options as &$option){
|
484 |
+
$option = array('val' => $option, 'label' => $option);
|
485 |
+
} unset($option);
|
486 |
+
$field['options'] = $options;
|
487 |
+
}
|
488 |
+
|
489 |
+
$params = !empty($group['default_params'])
|
490 |
+
? array_merge($group['default_params'], $field)
|
491 |
+
: array_merge($field_default_params, $field);
|
492 |
+
|
493 |
+
$params['name'] = $field_name;
|
494 |
+
|
495 |
+
if(!$params['display'])
|
496 |
+
continue;
|
497 |
+
|
498 |
+
add_settings_field(
|
499 |
+
'apbct_field__'.$field_name,
|
500 |
+
'',
|
501 |
+
$params['callback'],
|
502 |
+
'cleantalk',
|
503 |
+
'apbct_section__'.$group_name,
|
504 |
+
$params
|
505 |
+
);
|
506 |
+
|
507 |
+
}
|
508 |
+
}
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Admin callback function - Displays plugin options page
|
513 |
+
*/
|
514 |
+
function apbct_settings__display() {
|
515 |
+
|
516 |
+
global $apbct;
|
517 |
+
|
518 |
+
// Title
|
519 |
+
echo '<h2 class="apbct_settings-title">'.__($apbct->plugin_name, 'cleantalk').'</h2>';
|
520 |
+
|
521 |
+
// Subtitle for IP license
|
522 |
+
if($apbct->moderate_ip)
|
523 |
+
echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
|
524 |
+
|
525 |
+
echo '<form action="options.php" method="post">';
|
526 |
+
|
527 |
+
apbct_settings__error__output();
|
528 |
+
|
529 |
+
// Top info
|
530 |
+
if(!$apbct->white_label){
|
531 |
+
echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; top: -55px; background: #f1f1f1;">';
|
532 |
+
|
533 |
+
echo __('CleanTalk\'s tech support:', 'cleantalk')
|
534 |
+
.' '
|
535 |
+
.'<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
|
536 |
+
// .' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
|
537 |
+
// .($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').
|
538 |
+
.'<br>';
|
539 |
+
echo __('Plugin Homepage at', 'cleantalk').' <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
|
540 |
+
echo '<span id="apbct_gdpr_open_modal" style="text-decoration: underline;">'.__('GDPR compliance', 'cleantalk').'</span><br/>';
|
541 |
+
echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
|
542 |
+
echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br/>';
|
543 |
+
if($apbct->key_is_ok)
|
544 |
+
echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
|
545 |
+
apbct_admin__badge__get_premium();
|
546 |
+
echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
|
547 |
+
apbct_settings_show_gdpr_text('print');
|
548 |
+
echo '</div>';
|
549 |
+
echo '</div>';
|
550 |
+
}
|
551 |
+
|
552 |
+
// Output spam count
|
553 |
+
if($apbct->key_is_ok && apbct_api_key__is_correct()){
|
554 |
+
if($apbct->spam_count > 0){
|
555 |
+
echo '<div class="apbct_settings-subtitle" style="top: 0; margin-bottom: 10px; width: 200px;">'
|
556 |
+
.'<br>'
|
557 |
+
.'<span>'
|
558 |
+
.sprintf(
|
559 |
+
__( '%s has blocked <b>%s</b> spam.', 'cleantalk' ),
|
560 |
+
$apbct->plugin_name,
|
561 |
+
number_format($apbct->spam_count, 0, ',', ' ')
|
562 |
+
)
|
563 |
+
.'</span>'
|
564 |
+
.'<br>'
|
565 |
+
.'<br>'
|
566 |
+
.'</div>';
|
567 |
+
}
|
568 |
+
if(!$apbct->white_label){
|
569 |
+
// CP button
|
570 |
+
echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
|
571 |
+
.__('Click here to get anti-spam statistics', 'cleantalk')
|
572 |
+
.'</a>';
|
573 |
+
echo ' ';
|
574 |
+
// Support button
|
575 |
+
echo '<a class="cleantalk_link cleantalk_link-auto" target="__blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>';
|
576 |
+
echo '<br>'
|
577 |
+
.'<br>';
|
578 |
+
}
|
579 |
+
}
|
580 |
+
|
581 |
+
settings_fields('cleantalk_settings');
|
582 |
+
do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
|
583 |
+
|
584 |
+
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
585 |
+
|
586 |
+
echo !empty($group['html_before']) ? $group['html_before'] : '';
|
587 |
+
echo !empty($group['title']) ? '<h3 style="margin-left: 220px;">'.$group['title'].'</h3>' : '';
|
588 |
+
|
589 |
+
do_settings_fields('cleantalk', 'apbct_section__'.$group_name);
|
590 |
+
|
591 |
+
echo !empty($group['html_after']) ? $group['html_after'] : '';
|
592 |
+
|
593 |
+
}
|
594 |
+
|
595 |
+
echo '<br>';
|
596 |
+
echo '<button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'.__('Save Changes').'</button>';
|
597 |
+
|
598 |
+
echo "</form>";
|
599 |
+
|
600 |
+
if(!$apbct->white_label){
|
601 |
+
// Translate banner for non EN locale
|
602 |
+
if(substr(get_locale(), 0, 2) != 'en'){
|
603 |
+
global $ct_translate_banner_template;
|
604 |
+
require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
|
605 |
+
printf($ct_translate_banner_template, substr(get_locale(), 0, 2));
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
|
610 |
+
function apbct_settings__display__network(){
|
611 |
+
// If it's network admin dashboard
|
612 |
+
if(is_network_admin()){
|
613 |
+
$link = get_site_option('siteurl').'wp-admin/options-general.php?page=cleantalk';
|
614 |
+
printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
|
615 |
+
return;
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
+
function apbct_settings__error__output($return = false){
|
620 |
+
|
621 |
+
global $apbct;
|
622 |
+
|
623 |
+
// If have error message output error block.
|
624 |
+
|
625 |
+
$out = '';
|
626 |
+
|
627 |
+
if(!empty($apbct->errors) && !defined('CLEANTALK_ACCESS_KEY')){
|
628 |
+
|
629 |
+
$errors = $apbct->errors;
|
630 |
+
|
631 |
+
$error_texts = array(
|
632 |
+
// Misc
|
633 |
+
'key_invalid' => __('Error occured while API key validating. Error: ', 'cleantalk'),
|
634 |
+
'key_get' => __('Error occured while automatically gettings access key. Error: ', 'cleantalk'),
|
635 |
+
'sfw_send_logs' => __('Error occured while sending sending SpamFireWall logs. Error: ', 'cleantalk'),
|
636 |
+
'sfw_update' => __('Error occured while updating SpamFireWall local base. Error: ' , 'cleantalk'),
|
637 |
+
'account_check' => __('Error occured while checking account status. Error: ', 'cleantalk'),
|
638 |
+
'api' => __('Error occured while excuting API call. Error: ', 'cleantalk'),
|
639 |
+
|
640 |
+
// Validating settings
|
641 |
+
'settings_validate' => 'Validate Settings',
|
642 |
+
'exclusions_urls' => 'URL Exclusions',
|
643 |
+
'exclusions_fields' => 'Field Exclusions',
|
644 |
+
|
645 |
+
// Unknown
|
646 |
+
'unknown' => __('Unknown error. Error: ', 'cleantalk'),
|
647 |
+
);
|
648 |
+
|
649 |
+
$errors_out = array();
|
650 |
+
|
651 |
+
foreach($errors as $type => $error){
|
652 |
+
|
653 |
+
if(!empty($error)){
|
654 |
+
|
655 |
+
if(is_array(current($error))){
|
656 |
+
|
657 |
+
foreach($error as $sub_type => $sub_error){
|
658 |
+
$errors_out[$sub_type] = '';
|
659 |
+
if(isset($sub_error['error_time']))
|
660 |
+
$errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
|
661 |
+
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
662 |
+
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
|
663 |
+
}
|
664 |
+
continue;
|
665 |
+
}
|
666 |
+
|
667 |
+
$errors_out[$type] = '';
|
668 |
+
if(isset($error['error_time']))
|
669 |
+
$errors_out[$type] .= date('Y-m-d H:i:s', $error['error_time']) . ': ';
|
670 |
+
$errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
|
671 |
+
|
672 |
+
}
|
673 |
+
}
|
674 |
+
|
675 |
+
if(!empty($errors_out)){
|
676 |
+
$out .= '<div id="apbctTopWarning" class="error" style="position: relative;">'
|
677 |
+
.'<h3 style="display: inline-block;">'.__('Errors:', 'cleantalk').'</h3>';
|
678 |
+
foreach($errors_out as $value){
|
679 |
+
$out .= '<h4>'.$value.'</h4>';
|
680 |
+
}
|
681 |
+
$out .= !$apbct->white_label
|
682 |
+
? '<h4 style="text-align: unset;">'.sprintf(__('You can get support any time here: %s.', 'cleantalk'), '<a target="blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">https://wordpress.org/support/plugin/cleantalk-spam-protect</a>').'</h4>'
|
683 |
+
: '';
|
684 |
+
$out .= '</div>';
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
if($return) return $out; else echo $out;
|
689 |
+
}
|
690 |
+
|
691 |
+
function apbct_settings__field__debug(){
|
692 |
+
|
693 |
+
global $apbct;
|
694 |
+
|
695 |
+
if($apbct->debug){
|
696 |
+
|
697 |
+
echo '<hr /><h2>Debug:</h2>';
|
698 |
+
echo '<h4>Constants:</h4>';
|
699 |
+
echo 'CLEANTALK_AJAX_USE_BUFFER '. (defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
700 |
+
echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '. (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
701 |
+
echo 'CLEANTALK_ACCESS_KEY '. (defined('CLEANTALK_ACCESS_KEY') ? (CLEANTALK_ACCESS_KEY ? CLEANTALK_ACCESS_KEY : 'flase') : 'NOT_DEFINED')."<br>";
|
702 |
+
echo 'CLEANTALK_CHECK_COMMENTS_NUMBER '. (defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? (CLEANTALK_CHECK_COMMENTS_NUMBER ? CLEANTALK_CHECK_COMMENTS_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
703 |
+
echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
704 |
+
echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
|
705 |
+
echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
|
706 |
+
|
707 |
+
echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
|
708 |
+
echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
|
709 |
+
|
710 |
+
$output = print_r($apbct->debug, true);
|
711 |
+
$output = str_replace("\n", "<br>", $output);
|
712 |
+
$output = preg_replace("/[^\S]{4}/", " ", $output);
|
713 |
+
echo "$output";
|
714 |
+
|
715 |
+
echo "</div>";
|
716 |
+
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
+
function apbct_settings__field__state(){
|
721 |
+
|
722 |
+
global $apbct;
|
723 |
+
|
724 |
+
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
725 |
+
|
726 |
+
$img = $path_to_img."yes.png";
|
727 |
+
$img_no = $path_to_img."no.png";
|
728 |
+
$img_no_gray = $path_to_img."no_gray.png";
|
729 |
+
$color="black";
|
730 |
+
|
731 |
+
if(!$apbct->key_is_ok){
|
732 |
+
$img=$path_to_img."no.png";
|
733 |
+
$img_no=$path_to_img."no.png";
|
734 |
+
$color="black";
|
735 |
+
}
|
736 |
+
|
737 |
+
if(!apbct_api_key__is_correct($apbct->api_key)){
|
738 |
+
$img = $path_to_img."yes_gray.png";
|
739 |
+
$img_no = $path_to_img."no_gray.png";
|
740 |
+
$color="gray";
|
741 |
+
}
|
742 |
+
|
743 |
+
if($apbct->moderate_ip){
|
744 |
+
$img = $path_to_img."yes.png";
|
745 |
+
$img_no = $path_to_img."no.png";
|
746 |
+
$color="black";
|
747 |
+
}
|
748 |
+
|
749 |
+
if($apbct->moderate == 0){
|
750 |
+
$img = $path_to_img."no.png";
|
751 |
+
$img_no = $path_to_img."no.png";
|
752 |
+
$color="black";
|
753 |
+
}
|
754 |
+
|
755 |
+
print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
|
756 |
+
|
757 |
+
print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
|
758 |
+
|
759 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['registrations_test'] == 1 ? $img : $img_no).'"/>'.__('Registration forms', 'cleantalk');
|
760 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
|
761 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
|
762 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
|
763 |
+
if(!$apbct->white_label || is_main_site())
|
764 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
|
765 |
+
.'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
|
766 |
+
|
767 |
+
// Autoupdate status
|
768 |
+
if($apbct->notice_auto_update && (!$apbct->white_label || is_main_site())){
|
769 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
|
770 |
+
.' <sup><a href="http://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
|
771 |
+
}
|
772 |
+
|
773 |
+
// WooCommerce
|
774 |
+
if(class_exists('WooCommerce'))
|
775 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
|
776 |
+
if($apbct->moderate_ip)
|
777 |
+
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
|
778 |
+
|
779 |
+
print "</div>";
|
780 |
+
}
|
781 |
+
|
782 |
+
/**
|
783 |
+
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
784 |
+
*/
|
785 |
+
function apbct_settings__field__apikey(){
|
786 |
+
|
787 |
+
global $apbct;
|
788 |
+
|
789 |
+
echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
|
790 |
+
|
791 |
+
// Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
|
792 |
+
if(APBCT_WPMS && !is_main_site() && (!$apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY'))){
|
793 |
+
_e('<h3>Key is provided by Super Admin.</h3>', 'cleantalk');
|
794 |
+
return;
|
795 |
+
}
|
796 |
+
|
797 |
+
echo '<label class="apbct_settings__label" for="cleantalk_apkey">' . __('Access key', 'cleantalk') . '</label>';
|
798 |
+
|
799 |
+
echo '<input
|
800 |
+
id="apbct_setting_apikey"
|
801 |
+
class="apbct_setting_text apbct_setting---apikey"
|
802 |
+
type="text"
|
803 |
+
name="cleantalk_settings[apikey]"
|
804 |
+
value="'
|
805 |
+
. ($apbct->key_is_ok
|
806 |
+
? str_repeat('*', strlen($apbct->api_key))
|
807 |
+
: $apbct->api_key
|
808 |
+
)
|
809 |
+
. '"
|
810 |
+
key="' . $apbct->api_key . '"
|
811 |
+
size="20"
|
812 |
+
placeholder="' . __('Enter the key', 'cleantalk') . '"'
|
813 |
+
. ' />';
|
814 |
+
|
815 |
+
// Show account name associated with key
|
816 |
+
if(!empty($apbct->data['account_name_ob'])){
|
817 |
+
echo '<div class="apbct_display--none">'
|
818 |
+
. sprintf( __('Account at cleantalk.org is %s.', 'cleantalk'),
|
819 |
+
'<b>'.$apbct->data['account_name_ob'].'</b>'
|
820 |
+
)
|
821 |
+
. '</div>';
|
822 |
+
};
|
823 |
+
|
824 |
+
// Show key button
|
825 |
+
if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok)){
|
826 |
+
echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
|
827 |
+
. __('Show the access key', 'cleantalk')
|
828 |
+
. '</a>';
|
829 |
+
|
830 |
+
// "Auto Get Key" buttons. License agreement
|
831 |
+
}else{
|
832 |
+
|
833 |
+
echo '<br /><br />';
|
834 |
+
|
835 |
+
// Auto get key
|
836 |
+
if(!$apbct->ip_license){
|
837 |
+
echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" name="submit" type="submit" value="get_key_auto">'
|
838 |
+
.__('Get Access Key Automatically', 'cleantalk')
|
839 |
+
.'</button>';
|
840 |
+
echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
|
841 |
+
echo '<br />';
|
842 |
+
echo '<br />';
|
843 |
+
}
|
844 |
+
|
845 |
+
// Warnings and GDPR
|
846 |
+
printf( __('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
|
847 |
+
ct_get_admin_email(),
|
848 |
+
'<a class="apbct_color--gray" target="__blank" href="'
|
849 |
+
. sprintf( 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
|
850 |
+
urlencode(ct_get_admin_email()),
|
851 |
+
urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))
|
852 |
+
)
|
853 |
+
. '">',
|
854 |
+
'</a>'
|
855 |
+
);
|
856 |
+
|
857 |
+
// License agreement
|
858 |
+
if(!$apbct->ip_license){
|
859 |
+
echo '<div>';
|
860 |
+
echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
|
861 |
+
echo '<label for="spbc_license_agreed">';
|
862 |
+
printf( __('I accept %sLicense Agreement%s.', 'cleantalk'),
|
863 |
+
'<a href="https://cleantalk.org/publicoffer" target="_blank" style="color:#66b;">',
|
864 |
+
'</a>'
|
865 |
+
);
|
866 |
+
echo "</label>";
|
867 |
+
echo '</div>';
|
868 |
+
}
|
869 |
+
}
|
870 |
+
|
871 |
+
echo '</div>';
|
872 |
+
}
|
873 |
+
|
874 |
+
function apbct_settings__field__action_buttons(){
|
875 |
+
|
876 |
+
global $apbct;
|
877 |
+
|
878 |
+
echo '<div class="apbct_settings-field_wrapper">';
|
879 |
+
|
880 |
+
if(apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok){
|
881 |
+
echo '<div>'
|
882 |
+
.'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>'
|
883 |
+
.' '
|
884 |
+
.' '
|
885 |
+
.'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>'
|
886 |
+
.' '
|
887 |
+
.' '
|
888 |
+
.'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_statistics\')">' . __('Statistics & Reports', 'cleantalk') . '</a>'
|
889 |
+
.'</div>';
|
890 |
+
|
891 |
+
}
|
892 |
+
|
893 |
+
echo '</div>';
|
894 |
+
}
|
895 |
+
|
896 |
+
function apbct_settings__field__statistics() {
|
897 |
+
|
898 |
+
global $apbct, $wpdb;
|
899 |
+
|
900 |
+
echo '<div id="apbct_statistics" class="apbct_settings-field_wrapper" style="display: none;">';
|
901 |
+
|
902 |
+
// Last request
|
903 |
+
printf(
|
904 |
+
__('Last spam check request to %s server was at %s.', 'cleantalk'),
|
905 |
+
$apbct->stats['last_request']['server'] ? $apbct->stats['last_request']['server'] : __('unknown', 'cleantalk'),
|
906 |
+
$apbct->stats['last_request']['time'] ? date('M d Y H:i:s', $apbct->stats['last_request']['time']) : __('unknown', 'cleantalk')
|
907 |
+
);
|
908 |
+
echo '<br>';
|
909 |
+
|
910 |
+
// Avarage time request
|
911 |
+
printf(
|
912 |
+
__('Average request time for past 7 days: %s seconds.', 'cleantalk'),
|
913 |
+
$apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time']
|
914 |
+
? round($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time'], 3)
|
915 |
+
: __('unknown', 'cleantalk')
|
916 |
+
);
|
917 |
+
echo '<br>';
|
918 |
+
|
919 |
+
// SFW last die
|
920 |
+
printf(
|
921 |
+
__('Last time SpamFireWall was triggered for %s IP at %s', 'cleantalk'),
|
922 |
+
$apbct->stats['last_sfw_block']['ip'] ? $apbct->stats['last_sfw_block']['ip'] : __('unknown', 'cleantalk'),
|
923 |
+
$apbct->stats['last_sfw_block']['time'] ? date('M d Y H:i:s', $apbct->stats['last_sfw_block']['time']) : __('unknown', 'cleantalk')
|
924 |
+
);
|
925 |
+
echo '<br>';
|
926 |
+
|
927 |
+
// SFW last update
|
928 |
+
$sfw_netwoks_amount = $wpdb->get_results("SELECT count(*) AS cnt FROM `".$wpdb->prefix."cleantalk_sfw`", ARRAY_A);
|
929 |
+
printf(
|
930 |
+
__('SpamFireWall was updated %s. Now contains %s entries.', 'cleantalk'),
|
931 |
+
$apbct->stats['sfw']['last_update_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_update_time']) : __('unknown', 'cleantalk'),
|
932 |
+
isset($sfw_netwoks_amount[0]['cnt']) ? $sfw_netwoks_amount[0]['cnt'] : __('unknown', 'cleantalk')
|
933 |
+
);
|
934 |
+
echo '<br>';
|
935 |
+
|
936 |
+
// SFW last sent logs
|
937 |
+
printf(
|
938 |
+
__('SpamFireWall sent %s events at %s.', 'cleantalk'),
|
939 |
+
$apbct->stats['sfw']['last_send_amount'] ? $apbct->stats['sfw']['last_send_amount'] : __('unknown', 'cleantalk'),
|
940 |
+
$apbct->stats['sfw']['last_send_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_send_time']) : __('unknown', 'cleantalk')
|
941 |
+
);
|
942 |
+
echo '<br>';
|
943 |
+
|
944 |
+
// Connection reports
|
945 |
+
if ($apbct->connection_reports){
|
946 |
+
|
947 |
+
if ($apbct->connection_reports['negative'] == 0){
|
948 |
+
_e('There are no failed connections to server.', 'cleantalk');
|
949 |
+
}else{
|
950 |
+
echo "<table id='negative_reports_table''>
|
951 |
+
<tr>
|
952 |
+
<td>#</td>
|
953 |
+
<td><b>Date</b></td>
|
954 |
+
<td><b>Page URL</b></td>
|
955 |
+
<td><b>Report</b></td>
|
956 |
+
<td><b>Server IP</b></td>
|
957 |
+
</tr>";
|
958 |
+
foreach($apbct->connection_reports['negative_report'] as $key => $report){
|
959 |
+
echo '<tr>'
|
960 |
+
. '<td>'.($key+1).'.</td>'
|
961 |
+
. '<td>'.$report['date'].'</td>'
|
962 |
+
. '<td>'.$report['page_url'].'</td>'
|
963 |
+
. '<td>'.$report['lib_report'].'</td>'
|
964 |
+
. '<td>'.$report['work_url'].'</td>'
|
965 |
+
. '</tr>';
|
966 |
+
}
|
967 |
+
echo "</table>";
|
968 |
+
echo '<br/>';
|
969 |
+
echo '<button'
|
970 |
+
. ' name="submit"'
|
971 |
+
. ' class="cleantalk_link cleantalk_link-manual"'
|
972 |
+
. ' value="ct_send_connection_report"'
|
973 |
+
. (!$apbct->settings['send_connection_reports'] ? ' disabled="disabled"' : '')
|
974 |
+
. '>'
|
975 |
+
.__('Send report', 'cleantalk')
|
976 |
+
.'</button>';
|
977 |
+
if (!$apbct->settings['send_connection_reports']){
|
978 |
+
echo '<br><br>';
|
979 |
+
_e('Please, enable "Send connection reports" setting to be able to send reports', 'cleantalk');
|
980 |
+
}
|
981 |
+
}
|
982 |
+
|
983 |
+
}
|
984 |
+
|
985 |
+
echo '</div>';
|
986 |
+
}
|
987 |
+
|
988 |
+
/**
|
989 |
+
* Get all current Wordpress roles, could except 'subscriber' role
|
990 |
+
*
|
991 |
+
* @param bool $except_subscriber
|
992 |
+
*
|
993 |
+
* @return array
|
994 |
+
*/
|
995 |
+
function apbct_get_all_roles($except_subscriber = false) {
|
996 |
+
|
997 |
+
global $wp_roles;
|
998 |
+
|
999 |
+
$wp_roles = new WP_Roles();
|
1000 |
+
$roles = $wp_roles->get_names();
|
1001 |
+
|
1002 |
+
if($except_subscriber) {
|
1003 |
+
$key = array_search( 'Subscriber', $roles );
|
1004 |
+
if ( $key !== false ) {
|
1005 |
+
unset( $roles[ $key ] );
|
1006 |
+
}
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
return $roles;
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
function apbct_settings__field__draw($params = array()){
|
1013 |
+
|
1014 |
+
global $apbct;
|
1015 |
+
|
1016 |
+
$value = $params['network'] ? $apbct->network_settings[$params['name']] : $apbct->settings[$params['name']];
|
1017 |
+
$value_parent = $params['parent']
|
1018 |
+
? ($params['network'] ? $apbct->network_settings[$params['parent']] : $apbct->settings[$params['parent']])
|
1019 |
+
: false;
|
1020 |
+
|
1021 |
+
$disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : '';
|
1022 |
+
$disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled;
|
1023 |
+
|
1024 |
+
$childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---",$params['childrens']) : '';
|
1025 |
+
$hide = $params['hide'] ? implode(",",$params['hide']) : '';
|
1026 |
+
|
1027 |
+
echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
|
1028 |
+
|
1029 |
+
switch($params['type']){
|
1030 |
+
|
1031 |
+
// Checkbox type
|
1032 |
+
case 'checkbox':
|
1033 |
+
echo '<input
|
1034 |
+
type="checkbox"
|
1035 |
+
name="cleantalk_settings['.$params['name'].']"
|
1036 |
+
id="apbct_setting_'.$params['name'].'"
|
1037 |
+
value="1" '
|
1038 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1039 |
+
.($value == '1' ? ' checked' : '')
|
1040 |
+
.$disabled
|
1041 |
+
.($params['required'] ? ' required="required"' : '')
|
1042 |
+
.' onchange="'
|
1043 |
+
. ($params['childrens'] ? ' apbctSettingsDependencies(\''. $childrens .'\');' : '')
|
1044 |
+
. ($params['hide'] ? ' apbct_show_hide_elem(\''. $hide . '\');' : '')
|
1045 |
+
. '"'
|
1046 |
+
.' />'
|
1047 |
+
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1048 |
+
.$params['title']
|
1049 |
+
.'</label>';
|
1050 |
+
echo isset($params['long_description'])
|
1051 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1052 |
+
: '';
|
1053 |
+
echo '<div class="apbct_settings-field_description">'
|
1054 |
+
.$params['description']
|
1055 |
+
.'</div>';
|
1056 |
+
break;
|
1057 |
+
|
1058 |
+
// Radio type
|
1059 |
+
case 'radio':
|
1060 |
+
|
1061 |
+
// Title
|
1062 |
+
echo isset($params['title'])
|
1063 |
+
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1064 |
+
: '';
|
1065 |
+
|
1066 |
+
// Popup description
|
1067 |
+
echo isset($params['long_description'])
|
1068 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1069 |
+
: '';
|
1070 |
+
|
1071 |
+
echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
|
1072 |
+
|
1073 |
+
$disabled = '';
|
1074 |
+
|
1075 |
+
// Disable child option if parent is ON
|
1076 |
+
if($params['reverse_trigger']){
|
1077 |
+
if($params['parent'] && $apbct->settings[$params['parent']]){
|
1078 |
+
$disabled = ' disabled="disabled"';
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
// Disable child option if parent if OFF
|
1082 |
+
}else{
|
1083 |
+
if($params['parent'] && !$apbct->settings[$params['parent']]){
|
1084 |
+
$disabled = ' disabled="disabled"';
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
foreach($params['options'] as $option){
|
1089 |
+
echo '<input'
|
1090 |
+
.' type="radio"'
|
1091 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1092 |
+
." id='apbct_setting_{$params['name']}__{$option['label']}'"
|
1093 |
+
.' name="cleantalk_settings['.$params['name'].']"'
|
1094 |
+
.' value="'.$option['val'].'"'
|
1095 |
+
.($params['parent'] ? $disabled : '')
|
1096 |
+
.($params['childrens']
|
1097 |
+
? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"'
|
1098 |
+
: ''
|
1099 |
+
)
|
1100 |
+
.($value == $option['val'] ? ' checked' : '')
|
1101 |
+
.($params['required'] ? ' required="required"' : '')
|
1102 |
+
.' />';
|
1103 |
+
echo '<label for="apbct_setting_'.$params['name'].'__'.$option['label'].'"> ' . $option['label'] . '</label>';
|
1104 |
+
echo ' ';
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
echo isset($params['description'])
|
1108 |
+
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1109 |
+
: '';
|
1110 |
+
|
1111 |
+
echo '</div>';
|
1112 |
+
break;
|
1113 |
+
|
1114 |
+
// Dropdown list type
|
1115 |
+
case 'select':
|
1116 |
+
echo isset($params['title'])
|
1117 |
+
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1118 |
+
: '';
|
1119 |
+
echo isset($params['long_description'])
|
1120 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1121 |
+
: '';
|
1122 |
+
echo '<select'
|
1123 |
+
. ' id="apbct_setting_'.$params['name'].'"'
|
1124 |
+
. " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1125 |
+
. ' name="cleantalk_settings['.$params['name'].']'.($params['multiple'] ? '[]"' : '"')
|
1126 |
+
. ($params['multiple'] ? ' size="'. count($params['options']). '""' : '')
|
1127 |
+
. ($params['multiple'] ? ' multiple="multiple"' : '')
|
1128 |
+
. $disabled
|
1129 |
+
. ($params['required'] ? ' required="required"' : '')
|
1130 |
+
. ' >';
|
1131 |
+
|
1132 |
+
foreach($params['options'] as $option){
|
1133 |
+
echo '<option'
|
1134 |
+
. ' value="' . $option['val'] . '"'
|
1135 |
+
. ($params['multiple']
|
1136 |
+
? (in_array($option['val'], $value) ? ' selected="selected"' : '')
|
1137 |
+
: ($value == $option['val'] ? 'selected="selected"' : '')
|
1138 |
+
)
|
1139 |
+
.'>'
|
1140 |
+
. $option['label']
|
1141 |
+
. '</option>';
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
echo '</select>';
|
1145 |
+
echo isset($params['long_description'])
|
1146 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1147 |
+
: '';
|
1148 |
+
echo isset($params['description'])
|
1149 |
+
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1150 |
+
: '';
|
1151 |
+
|
1152 |
+
break;
|
1153 |
+
|
1154 |
+
// Text type
|
1155 |
+
case 'text':
|
1156 |
+
|
1157 |
+
echo '<input
|
1158 |
+
type="text"
|
1159 |
+
id="apbct_setting_'.$params['name'].'"
|
1160 |
+
name="cleantalk_settings['.$params['name'].']"'
|
1161 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1162 |
+
.' value="'. $value .'" '
|
1163 |
+
.$disabled
|
1164 |
+
.($params['required'] ? ' required="required"' : '')
|
1165 |
+
.($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
|
1166 |
+
.' />'
|
1167 |
+
. ' '
|
1168 |
+
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1169 |
+
.$params['title']
|
1170 |
+
.'</label>';
|
1171 |
+
echo '<div class="apbct_settings-field_description">'
|
1172 |
+
.$params['description']
|
1173 |
+
.'</div>';
|
1174 |
+
break;
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
echo '</div>';
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* Admin callback function - Plugin parameters validator
|
1182 |
+
*
|
1183 |
+
* @global CleantalkState $apbct
|
1184 |
+
* @param array $settings Array with passed settings
|
1185 |
+
* @return array Array with processed settings
|
1186 |
+
*/
|
1187 |
+
function apbct_settings__validate($settings) {
|
1188 |
+
|
1189 |
+
global $apbct;
|
1190 |
+
|
1191 |
+
// Set missing settings.
|
1192 |
+
foreach($apbct->def_settings as $setting => $value){
|
1193 |
+
if(!isset($settings[$setting])){
|
1194 |
+
$settings[$setting] = null;
|
1195 |
+
settype($settings[$setting], gettype($value));
|
1196 |
+
}
|
1197 |
+
} unset($setting, $value);
|
1198 |
+
|
1199 |
+
// Set missing settings.
|
1200 |
+
foreach($apbct->def_network_settings as $setting => $value){
|
1201 |
+
if(!isset($settings[$setting])){
|
1202 |
+
$settings[$setting] = null;
|
1203 |
+
settype($settings[$setting], gettype($value));
|
1204 |
+
}
|
1205 |
+
} unset($setting, $value);
|
1206 |
+
|
1207 |
+
// Validating API key
|
1208 |
+
$settings['apikey'] = !empty($settings['apikey']) ? trim($settings['apikey']) : '';
|
1209 |
+
$settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $settings['apikey'];
|
1210 |
+
$settings['apikey'] = is_main_site() || $apbct->allow_custom_key ? $settings['apikey'] : $apbct->network_settings['apikey'];
|
1211 |
+
$settings['apikey'] = is_main_site() || !$settings['white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
|
1212 |
+
$settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
|
1213 |
+
|
1214 |
+
// Validate Exclusions
|
1215 |
+
// URLs
|
1216 |
+
$result = apbct_settings__sanitize__exclusions($settings['exclusions__urls'], $settings['exclusions__urls__use_regexp']);
|
1217 |
+
$result === false
|
1218 |
+
? $apbct->error_add( 'exclusions_urls', 'is not valid: "' . $settings['exclusions__urls'] . '"', 'settings_validate' )
|
1219 |
+
: $apbct->error_delete( 'exclusions_urls', true, 'settings_validate' );
|
1220 |
+
$settings['exclusions_urls'] = $result ? $result: '';
|
1221 |
+
|
1222 |
+
// Fields
|
1223 |
+
$result = apbct_settings__sanitize__exclusions($settings['exclusions__fields'], $settings['exclusions__fields__use_regexp']);
|
1224 |
+
$result === false
|
1225 |
+
? $apbct->error_add( 'exclusions_fields', 'is not valid: "' . $settings['exclusions__fields'] . '"', 'settings_validate' )
|
1226 |
+
: $apbct->error_delete( 'exclusions_fields', true, 'settings_validate' );
|
1227 |
+
$settings['exclusions__fields'] = $result ? $result: '';
|
1228 |
+
|
1229 |
+
// WPMS Logic.
|
1230 |
+
if(APBCT_WPMS && is_main_site()){
|
1231 |
+
$network_settings = array(
|
1232 |
+
'allow_custom_key' => $settings['allow_custom_key'],
|
1233 |
+
'white_label' => $settings['white_label'],
|
1234 |
+
'white_label__hoster_key' => $settings['white_label__hoster_key'],
|
1235 |
+
'white_label__plugin_name' => $settings['white_label__plugin_name'],
|
1236 |
+
);
|
1237 |
+
unset( $settings['allow_custom_key'], $settings['white_label'], $settings['white_label__hoster_key'], $settings['white_label__plugin_name'] );
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
// Drop debug data
|
1241 |
+
if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
|
1242 |
+
$apbct->debug = false;
|
1243 |
+
delete_option('cleantalk_debug');
|
1244 |
+
return $settings;
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
// Send connection reports
|
1248 |
+
if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
|
1249 |
+
ct_mail_send_connection_report();
|
1250 |
+
return $settings;
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
// Auto getting key
|
1254 |
+
if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
|
1255 |
+
|
1256 |
+
$website = parse_url(get_option('siteurl'), PHP_URL_HOST).parse_url(get_option('siteurl'), PHP_URL_PATH);
|
1257 |
+
$platform = 'wordpress';
|
1258 |
+
$user_ip = CleantalkHelper::ip__get(array('real'), false);
|
1259 |
+
$timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
|
1260 |
+
$language = filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE');
|
1261 |
+
$wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
|
1262 |
+
$white_label = $apbct->network_settings['white_label'] ? 1 : 0;
|
1263 |
+
$hoster_api_key = $apbct->network_settings['white_label__hoster_key'] ? $apbct->network_settings['white_label__hoster_key'] : '';
|
1264 |
+
|
1265 |
+
$result = CleantalkAPI::method__get_api_key(
|
1266 |
+
'antispam',
|
1267 |
+
ct_get_admin_email(),
|
1268 |
+
$website,
|
1269 |
+
$platform,
|
1270 |
+
$timezone,
|
1271 |
+
$language,
|
1272 |
+
$user_ip,
|
1273 |
+
$wpms,
|
1274 |
+
$white_label,
|
1275 |
+
$hoster_api_key
|
1276 |
+
);
|
1277 |
+
|
1278 |
+
if(empty($result['error'])){
|
1279 |
+
|
1280 |
+
if(isset($result['user_token'])){
|
1281 |
+
$apbct->data['user_token'] = $result['user_token'];
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
if(!empty($result['auth_key'])){
|
1285 |
+
$settings['apikey'] = $result['auth_key'];
|
1286 |
+
}
|
1287 |
+
|
1288 |
+
}else{
|
1289 |
+
$apbct->error_add(
|
1290 |
+
'key_get',
|
1291 |
+
$result['error']
|
1292 |
+
. ($apbct->white_label
|
1293 |
+
? ' <button name="submit" type="submit" class="cleantalk_link cleantalk_link-manual" value="get_key_auto">'
|
1294 |
+
: ''
|
1295 |
+
)
|
1296 |
+
);
|
1297 |
+
}
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
// Feedback with app_agent
|
1301 |
+
ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
|
1302 |
+
|
1303 |
+
// Key is good by default
|
1304 |
+
$apbct->data['key_is_ok'] = true;
|
1305 |
+
|
1306 |
+
// Check account status and validate key. Even if it's not correct because of IP license.
|
1307 |
+
$result = ct_account_status_check($settings['apikey']);
|
1308 |
+
|
1309 |
+
// Is key valid?
|
1310 |
+
if($result){
|
1311 |
+
|
1312 |
+
// Deleting errors about invalid key
|
1313 |
+
$apbct->error_delete('key_invalid key_get', 'save');
|
1314 |
+
|
1315 |
+
// SFW actions
|
1316 |
+
if($apbct->settings['spam_firewall'] == 1){
|
1317 |
+
ct_sfw_update($settings['apikey']);
|
1318 |
+
ct_sfw_send_logs($settings['apikey']);
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
// Updating brief data for dashboard widget
|
1322 |
+
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1323 |
+
|
1324 |
+
// Key is not valid
|
1325 |
+
}else{
|
1326 |
+
$apbct->data['key_is_ok'] = false;
|
1327 |
+
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
// WPMS Logic.
|
1331 |
+
if(APBCT_WPMS){
|
1332 |
+
if(is_main_site()){
|
1333 |
+
|
1334 |
+
// Network settings
|
1335 |
+
$network_settings['apikey'] = $settings['apikey'];
|
1336 |
+
$apbct->network_settings = $network_settings;
|
1337 |
+
$apbct->saveNetworkSettings();
|
1338 |
+
|
1339 |
+
// Network data
|
1340 |
+
$apbct->network_data = array(
|
1341 |
+
'key_is_ok' => $apbct->data['key_is_ok'],
|
1342 |
+
'moderate' => $apbct->data['moderate'],
|
1343 |
+
'valid' => $apbct->data['valid'],
|
1344 |
+
'auto_update' => $apbct->data['auto_update'],
|
1345 |
+
'user_token' => $apbct->data['user_token'],
|
1346 |
+
'service_id' => $apbct->data['service_id'],
|
1347 |
+
);
|
1348 |
+
$apbct->saveNetworkData();
|
1349 |
+
}
|
1350 |
+
if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
|
1351 |
+
$settings['apikey'] = '';
|
1352 |
+
}
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1356 |
+
|
1357 |
+
// Notices
|
1358 |
+
$apbct->data['notice_show'] = 1;
|
1359 |
+
$apbct->data['notice_renew'] = 0;
|
1360 |
+
$apbct->data['notice_trial'] = 0;
|
1361 |
+
$apbct->data['notice_review'] = 0;
|
1362 |
+
$apbct->data['notice_auto_update'] = 0;
|
1363 |
+
|
1364 |
+
// Other
|
1365 |
+
$apbct->data['service_id'] = 0;
|
1366 |
+
$apbct->data['valid'] = 0;
|
1367 |
+
$apbct->data['moderate'] = 0;
|
1368 |
+
$apbct->data['ip_license'] = 0;
|
1369 |
+
$apbct->data['moderate_ip'] = 0;
|
1370 |
+
$apbct->data['spam_count'] = 0;
|
1371 |
+
$apbct->data['auto_update'] = 0;
|
1372 |
+
$apbct->data['user_token'] = '';
|
1373 |
+
$apbct->data['license_trial'] = 0;
|
1374 |
+
$apbct->data['account_name_ob'] = '';
|
1375 |
+
}
|
1376 |
+
|
1377 |
+
$apbct->saveData();
|
1378 |
+
|
1379 |
+
return $settings;
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
/**
|
1383 |
+
* Sanitize and validate exclusions.
|
1384 |
+
* Explode given string by commas and trim each string.
|
1385 |
+
* Skip element if it's empty.
|
1386 |
+
*
|
1387 |
+
* Return false if exclusion is bad
|
1388 |
+
* Return sanitized string if all is ok
|
1389 |
+
*
|
1390 |
+
* @param string $exclusions
|
1391 |
+
* @param bool $regexp
|
1392 |
+
*
|
1393 |
+
* @return bool|string
|
1394 |
+
*/
|
1395 |
+
function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
|
1396 |
+
$result = array();
|
1397 |
+
if( ! empty( $exclusions ) ){
|
1398 |
+
$exclusions = explode( ',', $exclusions );
|
1399 |
+
foreach ( $exclusions as $exclusion ){
|
1400 |
+
$sanitized_exclusion = trim( $exclusion );
|
1401 |
+
if ( ! empty( $sanitized_exclusion ) ) {
|
1402 |
+
if( $regexp && ! apbct_is_regexp( $exclusion ) )
|
1403 |
+
return false;
|
1404 |
+
$result[] = $sanitized_exclusion;
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
}
|
1408 |
+
return implode( ',', $result );
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
function apbct_settings_show_gdpr_text($print = false){
|
1412 |
+
|
1413 |
+
$out = wpautop('The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided.
|
1414 |
+
Automated individual decision-making, including profiling (Article 22) is contestable, similarly to the Data Protection Directive (Article 15). Citizens have rights to question and fight significant decisions that affect them that have been made on a solely-algorithmic basis. Many media outlets have commented on the introduction of a "right to explanation" of algorithmic decisions, but legal scholars have since argued that the existence of such a right is highly unclear without judicial tests and is limited at best.
|
1415 |
+
To be able to demonstrate compliance with the GDPR, the data controller should implement measures, which meet the principles of data protection by design and data protection by default. Privacy by design and by default (Article 25) require data protection measures to be designed into the development of business processes for products and services. Such measures include pseudonymising personal data, by the controller, as soon as possible (Recital 78).
|
1416 |
+
It is the responsibility and the liability of the data controller to implement effective measures and be able to demonstrate the compliance of processing activities even if the processing is carried out by a data processor on behalf of the controller (Recital 74).
|
1417 |
+
Data Protection Impact Assessments (Article 35) have to be conducted when specific risks occur to the rights and freedoms of data subjects. Risk assessment and mitigation is required and prior approval of the national data protection authorities (DPAs) is required for high risks. Data protection officers (Articles 37–39) are required to ensure compliance within organisations.
|
1418 |
+
They have to be appointed:')
|
1419 |
+
.'<ul style="padding: 0px 25px; list-style: disc;">'
|
1420 |
+
.'<li>for all public authorities, except for courts acting in their judicial capacity</li>'
|
1421 |
+
.'<li>if the core activities of the controller or the processor are:</li>'
|
1422 |
+
.'<ul style="padding: 0px 25px; list-style: disc;">'
|
1423 |
+
.'<li>processing operations, which, by virtue of their nature, their scope and/or their purposes, require regular and systematic monitoring of data subjects on a large scale</li>'
|
1424 |
+
.'<li>processing on a large scale of special categories of data pursuant to Article 9 and personal data relating to criminal convictions and offences referred to in Article 10;</li>'
|
1425 |
+
.'</ul>'
|
1426 |
+
.'</li>'
|
1427 |
+
.'</ul>';
|
1428 |
+
|
1429 |
+
if($print) echo $out; else return $out;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
function apbct_settings__get__long_description(){
|
1433 |
+
|
1434 |
+
global $apbct;
|
1435 |
+
|
1436 |
+
check_ajax_referer('ct_secret_nonce' );
|
1437 |
+
|
1438 |
+
$setting_id = $_POST['setting_id'] ? $_POST['setting_id'] : '';
|
1439 |
+
|
1440 |
+
$descriptions = array(
|
1441 |
+
'white_label' => array(
|
1442 |
+
'title' => __( 'XSS check', 'cleantalk' ),
|
1443 |
+
'desc' => __( 'Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to any user. As a result malicious scripts can not get access to the cookie files, session tokens and any other confidential information browsers use and store. Such scripts can even overwrite content of HTML pages. CleanTalk WAF monitors for patterns of these parameters and block them.', 'cleantalk' ),
|
1444 |
+
),
|
1445 |
+
'white_label__hoster_key' => array(
|
1446 |
+
'title' => __( 'SQL-injection check', 'cleantalk' ),
|
1447 |
+
'desc' => __( 'SQL Injection — one of the most popular ways to hack websites and programs that work with databases. It is based on injection of a custom SQL code into database queries. It could transmit data through GET, POST requests or cookie files in an SQL code. If a website is vulnerable and execute such injections then it would allow attackers to apply changes to the website\'s MySQL database.', 'cleantalk' ),
|
1448 |
+
),
|
1449 |
+
'white_label__plugin_name' => array(
|
1450 |
+
'title' => __( 'Check uploaded files', 'cleantalk' ),
|
1451 |
+
'desc' => __( 'The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'cleantalk' ),
|
1452 |
+
),
|
1453 |
+
);
|
1454 |
+
|
1455 |
+
die(json_encode($descriptions[$setting_id]));
|
1456 |
}
|
inc/cleantalk-users.php
CHANGED
@@ -1,781 +1,781 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
add_action('admin_menu', 'ct_add_users_menu');
|
4 |
-
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
5 |
-
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
6 |
-
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
7 |
-
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
8 |
-
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
9 |
-
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
10 |
-
add_action( 'wp_ajax_ajax_ct_approve_user', 'ct_usercheck_approve_user' );
|
11 |
-
add_action( 'wp_ajax_ajax_ct_get_csv_file', 'ct_usercheck_get_csv_file' );
|
12 |
-
|
13 |
-
function ct_add_users_menu(){
|
14 |
-
if(current_user_can('activate_plugins'))
|
15 |
-
add_users_page( __("Check for spam", 'cleantalk'), __("Find spam users", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
16 |
-
}
|
17 |
-
|
18 |
-
function ct_show_users_page(){
|
19 |
-
|
20 |
-
global $wpdb, $apbct;
|
21 |
-
|
22 |
-
?>
|
23 |
-
<div class="wrap">
|
24 |
-
<h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
|
25 |
-
<a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
|
26 |
-
<br />
|
27 |
-
<?php
|
28 |
-
|
29 |
-
// If access key is unset in
|
30 |
-
if(!apbct_api_key__is_correct()){
|
31 |
-
if($apbct->moderate_ip == 1){
|
32 |
-
echo '<h3>'
|
33 |
-
.sprintf(
|
34 |
-
__('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
|
35 |
-
'<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
|
36 |
-
'</a>'
|
37 |
-
)
|
38 |
-
.'</h3>';
|
39 |
-
return;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
// Getting total spam users
|
45 |
-
$r = $wpdb->get_results("
|
46 |
-
SELECT
|
47 |
-
DISTINCT COUNT($wpdb->users.ID) AS cnt
|
48 |
-
FROM $wpdb->users
|
49 |
-
INNER JOIN $wpdb->usermeta
|
50 |
-
ON $wpdb->users.ID = $wpdb->usermeta.user_id
|
51 |
-
WHERE $wpdb->usermeta.meta_key='ct_marked_as_spam';"
|
52 |
-
, ARRAY_A);
|
53 |
-
$cnt_spam1=$r[0]['cnt'];
|
54 |
-
|
55 |
-
?>
|
56 |
-
|
57 |
-
<!-- AJAX error message -->
|
58 |
-
<div id="ct_error_message" style="display:none">
|
59 |
-
<h3>
|
60 |
-
<?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
|
61 |
-
</h3>
|
62 |
-
<h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
|
63 |
-
</div>
|
64 |
-
|
65 |
-
<!-- Deleting message -->
|
66 |
-
<div id="ct_deleting_message" style="display:none">
|
67 |
-
<?php _e("Please wait for a while. CleanTalk is deleting spam users. Users left: ", 'cleantalk'); ?> <span id="cleantalk_users_left">
|
68 |
-
<?php echo $cnt_spam1;?>
|
69 |
-
</span>
|
70 |
-
</div>
|
71 |
-
|
72 |
-
<!-- Main info -->
|
73 |
-
<h3 id="ct_checking_status"><?php echo ct_ajax_info_users(true); ?></h3>
|
74 |
-
|
75 |
-
<!-- Check options -->
|
76 |
-
<div class="ct_to_hide" id="ct_check_params_wrapper">
|
77 |
-
<button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
|
78 |
-
<?php if(!empty($_COOKIE['ct_paused_users_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
|
79 |
-
<p class="ct_check_params_desc"><?php _e("The plugin will check all users against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
|
80 |
-
<br />
|
81 |
-
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
82 |
-
<input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
|
83 |
-
</div>
|
84 |
-
<p class="ct_check_params_desc"><?php _e("Allows to use user's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
|
85 |
-
<br />
|
86 |
-
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
87 |
-
<input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
|
88 |
-
</div>
|
89 |
-
<div class="ct_check_params_desc">
|
90 |
-
<input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo ct_last_checked_user_register(); ?>" disabled readonly />
|
91 |
-
<input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo date( "M j Y"); ?>" disabled readonly />
|
92 |
-
</div>
|
93 |
-
<div class="ct_check_params_desc">
|
94 |
-
<p>Begin/end dates of creation user to check. If no date is specified, the plugin uses the last users check date.</p>
|
95 |
-
</div>
|
96 |
-
<br>
|
97 |
-
<?php apbct_admin__badge__get_premium(); ?>
|
98 |
-
</div>
|
99 |
-
|
100 |
-
<!-- Cooling notice -->
|
101 |
-
<h3 id="ct_cooling_notice"></h3>
|
102 |
-
|
103 |
-
<!-- Preloader and working message -->
|
104 |
-
<div id="ct_preloader">
|
105 |
-
<img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
|
106 |
-
</div>
|
107 |
-
<div id="ct_working_message">
|
108 |
-
<?php _e("Please wait for a while. CleanTalk is checking all users via blacklist database at cleantalk.org. You will have option to delete found spam users after plugin finish.", 'cleantalk'); ?>
|
109 |
-
</div>
|
110 |
-
|
111 |
-
<!-- Pause button -->
|
112 |
-
<button class="button" id="ct_pause">Pause check</button>
|
113 |
-
|
114 |
-
<?php
|
115 |
-
|
116 |
-
// Pagination
|
117 |
-
$page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
|
118 |
-
$on_page = 20;
|
119 |
-
|
120 |
-
$args_spam = array(
|
121 |
-
'meta_query' => array(
|
122 |
-
Array(
|
123 |
-
'key' => 'ct_marked_as_spam',
|
124 |
-
'value' => '1',
|
125 |
-
'compare' => 'NUMERIC'
|
126 |
-
)
|
127 |
-
),
|
128 |
-
'number'=>$on_page,
|
129 |
-
'offset'=>($page-1)*$on_page
|
130 |
-
);
|
131 |
-
|
132 |
-
$c_spam=get_users($args_spam);
|
133 |
-
if($cnt_spam1 > 0){
|
134 |
-
|
135 |
-
$pages = ceil(intval($cnt_spam1)/$on_page);
|
136 |
-
if($pages && $pages != 1){
|
137 |
-
echo "<div class='ct_to_hide pagination'>"
|
138 |
-
."<b>Pages:</b>"
|
139 |
-
."<ul class='pagination'>";
|
140 |
-
for($i = 1; $i <= $pages; $i++){
|
141 |
-
echo "<li class='pagination'>"
|
142 |
-
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
143 |
-
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
144 |
-
."</a>"
|
145 |
-
."</li>";
|
146 |
-
}
|
147 |
-
echo "</ul>";
|
148 |
-
echo "</div>";
|
149 |
-
}
|
150 |
-
?>
|
151 |
-
<table class="ct_to_hide widefat fixed comments" id="ct_check_users_table">
|
152 |
-
<thead>
|
153 |
-
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
154 |
-
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
155 |
-
<input id="cb-select-all-1" type="checkbox"/>
|
156 |
-
</th>
|
157 |
-
<th scope="col" id="author" class="manage-column column-slug"><?php _e('Username');?></th>
|
158 |
-
<th scope="col" id="comment" class="manage-column column-comment"><?php _e('Name');?></th>
|
159 |
-
<th scope="col" id="response" class="manage-column column-comment"><?php _e('E-mail');?></th>
|
160 |
-
<th scope="col" id="signed_up" class="manage-column column-comment"><?php _e('Signed up');?></th>
|
161 |
-
<th scope="col" id="role" class="manage-column column-response sortable desc"><?php _e('Role');?></th>
|
162 |
-
<th scope="col" id="posts" class="manage-column column-response sortable desc"><?php _e('Posts');?></th>
|
163 |
-
</thead>
|
164 |
-
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
165 |
-
<?php
|
166 |
-
for($i=0;$i<sizeof($c_spam);$i++){
|
167 |
-
$id = $c_spam[$i]->ID;
|
168 |
-
$login = $c_spam[$i]->data->user_login;
|
169 |
-
$email = $c_spam[$i]->data->user_email;
|
170 |
-
$signed = substr($c_spam[$i]->data->user_registered, 0, -3);
|
171 |
-
|
172 |
-
echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_user' data-id='$id'>"
|
173 |
-
."<th scope='row' class='check-column'>"
|
174 |
-
."<label class='screen-reader-text' for='cb-select-$id'>Select user</label>"
|
175 |
-
."<input id='cb-select-$id' type='checkbox' name='del_comments[]' />"
|
176 |
-
."</th>"
|
177 |
-
."<td class='author column-author' nowrap>"
|
178 |
-
."<strong>"
|
179 |
-
.get_avatar( $c_spam[$i]->data->ID , 32)
|
180 |
-
.$login
|
181 |
-
."</strong>"
|
182 |
-
."<br/>"
|
183 |
-
."<br/>";
|
184 |
-
|
185 |
-
// Outputs email if exists
|
186 |
-
if(!empty($email)){
|
187 |
-
echo "<a href='mailto:$email'>$email</a>"
|
188 |
-
.(!$apbct->white_label
|
189 |
-
? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
|
190 |
-
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
191 |
-
."</a>"
|
192 |
-
: '');
|
193 |
-
}else{
|
194 |
-
echo "No email";
|
195 |
-
}
|
196 |
-
echo "<br/>";
|
197 |
-
|
198 |
-
// Outputs IP if exists
|
199 |
-
$user_meta = get_user_meta($id, 'session_tokens', true);
|
200 |
-
if(!empty($user_meta) && is_array($user_meta)){
|
201 |
-
$user_meta=array_values($user_meta);
|
202 |
-
if(!empty($user_meta[0]['ip'])){
|
203 |
-
$ip = $user_meta[0]['ip'];
|
204 |
-
echo "<a href='user-edit.php?user_id=$id'>$ip</a>"
|
205 |
-
.(!$apbct->white_label
|
206 |
-
?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
|
207 |
-
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
208 |
-
."</a>"
|
209 |
-
: '');
|
210 |
-
}else
|
211 |
-
echo "No IP adress";
|
212 |
-
}else
|
213 |
-
echo "No IP adress";
|
214 |
-
echo "</td>";
|
215 |
-
?>
|
216 |
-
<td class="comment column-comment">
|
217 |
-
<div class="submitted-on">
|
218 |
-
<?php print $c_spam[$i]->data->display_name; ?>
|
219 |
-
<div style="height:16px; display: none;" id="cleantalk_button_set_<?php print $id; ?>">
|
220 |
-
<a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
|
221 |
-
|
|
222 |
-
<a href="#" class="cleantalk_delete_user_button" id="cleantalk_delete_user_<?php print $id; ?>" data-id="<?php print $id; ?>" style="color:#a00;display:none;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
|
223 |
-
</div>
|
224 |
-
</div>
|
225 |
-
</td>
|
226 |
-
<td class="comment column-comment">
|
227 |
-
<?php print $email; ?>
|
228 |
-
</td>
|
229 |
-
<td class="comment column-comment">
|
230 |
-
<?php print $signed; ?>
|
231 |
-
</td>
|
232 |
-
<td class="comment column-comment">
|
233 |
-
<?php
|
234 |
-
$info=get_userdata( $id );
|
235 |
-
print implode(', ', $info->roles);
|
236 |
-
?>
|
237 |
-
</td>
|
238 |
-
<td class="comment column-comment">
|
239 |
-
<?php
|
240 |
-
print count_user_posts($id);
|
241 |
-
?>
|
242 |
-
</td>
|
243 |
-
</tr>
|
244 |
-
<?php
|
245 |
-
}
|
246 |
-
?>
|
247 |
-
</tbody>
|
248 |
-
</table>
|
249 |
-
<?php
|
250 |
-
// Pagination
|
251 |
-
if($pages && $pages != 1){
|
252 |
-
echo "<div class='ct_to_hide pagination'>"
|
253 |
-
."<b>Pages:</b>"
|
254 |
-
."<ul class='pagination'>";
|
255 |
-
for($i = 1; $i <= $pages; $i++){
|
256 |
-
echo "<li class='pagination'>"
|
257 |
-
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
258 |
-
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
259 |
-
."</a>"
|
260 |
-
."</li>";
|
261 |
-
}
|
262 |
-
echo "</ul>";
|
263 |
-
echo "</div>";
|
264 |
-
}
|
265 |
-
?>
|
266 |
-
<div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
|
267 |
-
<button class="button" id="ct_delete_all_users"><?php _e('Delete all users from list', 'cleantalk'); ?></button>
|
268 |
-
<button class="button" id="ct_delete_checked_users"><?php _e('Delete selected', 'cleantalk'); ?></button>
|
269 |
-
<button class="button" id="ct_get_csv_file"><?php _e('Download results in CSV', 'cleantalk'); ?></button>
|
270 |
-
</div>
|
271 |
-
<?php
|
272 |
-
}
|
273 |
-
echo
|
274 |
-
echo
|
275 |
-
|
276 |
-
if($cnt_spam1 > 0){
|
277 |
-
echo "<div id='ct_search_info'>"
|
278 |
-
."<br />"
|
279 |
-
.__("There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.", 'cleantalk')
|
280 |
-
."</div>";
|
281 |
-
}
|
282 |
-
?>
|
283 |
-
<div>
|
284 |
-
<button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
|
285 |
-
</div>
|
286 |
-
<div id='ct_csv_wrapper' style="display: none;"></div>
|
287 |
-
</div>
|
288 |
-
<?php
|
289 |
-
}
|
290 |
-
|
291 |
-
function ct_ajax_check_users(){
|
292 |
-
|
293 |
-
check_ajax_referer('ct_secret_nonce', 'security');
|
294 |
-
|
295 |
-
$amount = !empty($_POST['amount']) && intval($_POST['amount'])
|
296 |
-
? intval($_POST['amount'])
|
297 |
-
: 100;
|
298 |
-
|
299 |
-
global $apbct;
|
300 |
-
|
301 |
-
$skip_roles = array(
|
302 |
-
'administrator'
|
303 |
-
);
|
304 |
-
|
305 |
-
$params = array(
|
306 |
-
// 'fields' => array(
|
307 |
-
// 'ID',
|
308 |
-
// 'user_login',
|
309 |
-
// 'user_email',
|
310 |
-
// 'user_registered',
|
311 |
-
// ),
|
312 |
-
'meta_query' => array(
|
313 |
-
'relation' => 'AND',
|
314 |
-
array(
|
315 |
-
'key' => 'ct_checked',
|
316 |
-
'compare' => 'NOT EXISTS'
|
317 |
-
),
|
318 |
-
array(
|
319 |
-
'key' => 'ct_bad',
|
320 |
-
'compare' => 'NOT EXISTS'
|
321 |
-
),
|
322 |
-
),
|
323 |
-
'orderby' => 'registered',
|
324 |
-
'order' => 'ASC',
|
325 |
-
'number' => $amount,
|
326 |
-
);
|
327 |
-
|
328 |
-
if(isset($_POST['from'], $_POST['till'])){
|
329 |
-
|
330 |
-
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
331 |
-
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
332 |
-
|
333 |
-
$params['date_query'] = array(
|
334 |
-
'column' => 'user_registered',
|
335 |
-
'after' => $from_date,
|
336 |
-
'before' => $till_date,
|
337 |
-
'inclusive' => true,
|
338 |
-
);
|
339 |
-
}
|
340 |
-
|
341 |
-
$u = get_users( $params );
|
342 |
-
|
343 |
-
$check_result = array(
|
344 |
-
'end' => 0,
|
345 |
-
'checked' => 0,
|
346 |
-
'spam' => 0,
|
347 |
-
'bad' => 0,
|
348 |
-
'error' => 0
|
349 |
-
);
|
350 |
-
|
351 |
-
if(count($u) > 0){
|
352 |
-
|
353 |
-
if(!empty($_POST['accurate_check'])){
|
354 |
-
// Leaving users only with first comment's date. Unsetting others.
|
355 |
-
foreach($u as $user_index => $user){
|
356 |
-
|
357 |
-
if(!isset($curr_date))
|
358 |
-
$curr_date = (substr($user->data->user_registered, 0, 10) ? substr($user->data->user_registered, 0, 10) : '');
|
359 |
-
|
360 |
-
if(substr($user->data->user_registered, 0, 10) != $curr_date)
|
361 |
-
unset($u[$user_index]);
|
362 |
-
|
363 |
-
}
|
364 |
-
unset($user_index, $user);
|
365 |
-
}
|
366 |
-
|
367 |
-
// Checking comments IP/Email. Gathering $data for check.
|
368 |
-
$data=Array();
|
369 |
-
for($i=0; $i < count($u); $i++){
|
370 |
-
|
371 |
-
$user_meta = get_user_meta($u[$i]->ID, 'session_tokens', true);
|
372 |
-
if(is_array($user_meta))
|
373 |
-
$user_meta = array_values($user_meta);
|
374 |
-
|
375 |
-
$curr_ip = !empty($user_meta[0]['ip']) ? trim($user_meta[0]['ip']) : '';
|
376 |
-
$curr_email = !empty($u[$i]->data->user_email) ? trim($u[$i]->data->user_email) : '';
|
377 |
-
|
378 |
-
// Check for identity
|
379 |
-
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
380 |
-
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
381 |
-
|
382 |
-
if(empty($curr_ip) && empty($curr_email)){
|
383 |
-
$check_result['bad']++;
|
384 |
-
update_user_meta($u[$i]->ID,'ct_bad','1',true);
|
385 |
-
unset($u[$i]);
|
386 |
-
}else{
|
387 |
-
if(!empty($curr_ip))
|
388 |
-
$data[] = $curr_ip;
|
389 |
-
if(!empty($curr_email))
|
390 |
-
$data[] = $curr_email;
|
391 |
-
// Patch for empty IP/Email
|
392 |
-
$u[$i]->data->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
|
393 |
-
$u[$i]->data->user_email = empty($curr_email) ? 'none' : $curr_email;
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
// Recombining after checking and unsettting
|
398 |
-
$u = array_values($u);
|
399 |
-
|
400 |
-
// Drop if data empty and there's no users to check
|
401 |
-
if(count($data) == 0){
|
402 |
-
if($_POST['unchecked'] === 0)
|
403 |
-
$check_result['end'] = 1;
|
404 |
-
print json_encode($check_result);
|
405 |
-
die();
|
406 |
-
}
|
407 |
-
|
408 |
-
$result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
|
409 |
-
|
410 |
-
if(empty($result['error'])){
|
411 |
-
|
412 |
-
// Opening CSV file
|
413 |
-
$current_user = wp_get_current_user();
|
414 |
-
if(!is_dir(APBCT_DIR_PATH .'/check-results/'))
|
415 |
-
mkdir(APBCT_DIR_PATH .'/check-results');
|
416 |
-
$filename = APBCT_DIR_PATH ."/check-results/user_check_by_{$current_user->user_nicename}.csv";
|
417 |
-
$text = '';
|
418 |
-
|
419 |
-
if(isset($_POST['new_check']) && $_POST['new_check'] == 'true'){
|
420 |
-
$file_desc = fopen($filename, 'w');
|
421 |
-
$text .= 'login,email,ip'.PHP_EOL;
|
422 |
-
}else
|
423 |
-
$file_desc = fopen($filename, 'a+');
|
424 |
-
// End of Opening CSV
|
425 |
-
|
426 |
-
for($i=0;$i<sizeof($u);$i++){
|
427 |
-
|
428 |
-
$check_result['checked']++;
|
429 |
-
update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
|
430 |
-
|
431 |
-
// Do not display forbidden roles.
|
432 |
-
foreach ($skip_roles as $role) {
|
433 |
-
if (in_array($role, $u[$i]->roles)){
|
434 |
-
delete_user_meta($u[$i]->ID, 'ct_marked_as_spam');
|
435 |
-
continue 2;
|
436 |
-
}
|
437 |
-
}
|
438 |
-
|
439 |
-
$mark_spam_ip = false;
|
440 |
-
$mark_spam_email = false;
|
441 |
-
|
442 |
-
$uip = $u[$i]->data->user_ip;
|
443 |
-
$uim = $u[$i]->data->user_email;
|
444 |
-
|
445 |
-
if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
|
446 |
-
$mark_spam_ip = true;
|
447 |
-
|
448 |
-
if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
|
449 |
-
$mark_spam_email = true;
|
450 |
-
|
451 |
-
if ($mark_spam_ip || $mark_spam_email){
|
452 |
-
$check_result['spam']++;
|
453 |
-
update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
|
454 |
-
$text .= $u[$i]->user_login.',';
|
455 |
-
$text .= ($mark_spam_email ? $uim : '').',';
|
456 |
-
$text .= ($mark_spam_ip ? $uip : '').PHP_EOL;
|
457 |
-
}
|
458 |
-
|
459 |
-
}
|
460 |
-
if($file_desc){
|
461 |
-
fwrite($file_desc, $text);
|
462 |
-
fclose($file_desc);
|
463 |
-
}
|
464 |
-
print json_encode($check_result);
|
465 |
-
}else{
|
466 |
-
$check_result['error'] = 1;
|
467 |
-
$check_result['error_message'] = $result['error'];
|
468 |
-
echo json_encode($check_result);
|
469 |
-
}
|
470 |
-
}else{
|
471 |
-
$check_result['end'] = 1;
|
472 |
-
print json_encode($check_result);
|
473 |
-
}
|
474 |
-
die;
|
475 |
-
}
|
476 |
-
|
477 |
-
function ct_ajax_info_users($direct_call = false)
|
478 |
-
{
|
479 |
-
if (!$direct_call)
|
480 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
481 |
-
|
482 |
-
// Total users
|
483 |
-
$params_total = array(
|
484 |
-
'fields' => 'ID',
|
485 |
-
'count'=>true,
|
486 |
-
'orderby' => 'user_registered'
|
487 |
-
);
|
488 |
-
$total_users = new WP_User_Query($params_total);
|
489 |
-
$cnt = $total_users->get_total();
|
490 |
-
|
491 |
-
// Checked users
|
492 |
-
$params_checked = array(
|
493 |
-
'fields' => 'ID',
|
494 |
-
'meta_key' => 'ct_checked',
|
495 |
-
'count_total' => true,
|
496 |
-
'orderby' => 'ct_checked'
|
497 |
-
);
|
498 |
-
$checked_users = new WP_User_Query($params_checked);
|
499 |
-
$cnt_checked = $checked_users->get_total();
|
500 |
-
|
501 |
-
// Spam users
|
502 |
-
$params_spam = array(
|
503 |
-
'fields' => 'ID',
|
504 |
-
'meta_key' => 'ct_marked_as_spam',
|
505 |
-
'count_total' => true,
|
506 |
-
);
|
507 |
-
$spam_users = new WP_User_Query($params_spam);
|
508 |
-
$cnt_spam = $spam_users->get_total();
|
509 |
-
|
510 |
-
// Bad users (without IP and Email)
|
511 |
-
$params_bad = array(
|
512 |
-
'fields' => 'ID',
|
513 |
-
'meta_key' => 'ct_bad',
|
514 |
-
'count_total' => true,
|
515 |
-
);
|
516 |
-
$bad_users = new WP_User_Query($params_bad);
|
517 |
-
$cnt_bad = $bad_users->get_total();
|
518 |
-
|
519 |
-
$return = array(
|
520 |
-
'message' => '',
|
521 |
-
'total' => $cnt,
|
522 |
-
'spam' => $cnt_spam,
|
523 |
-
'checked' => $cnt_checked,
|
524 |
-
'bad' => $cnt_bad,
|
525 |
-
);
|
526 |
-
|
527 |
-
$return['message'] .= sprintf (__("Total users %s, checked %s, last check %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'), $cnt, $cnt_checked, ct_get_last_check_date(), $cnt_spam, $cnt_bad);
|
528 |
-
|
529 |
-
$backup_notice = ' ';
|
530 |
-
if ($cnt_spam > 0) {
|
531 |
-
$backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
|
532 |
-
}
|
533 |
-
$return['message'] .= "<p>$backup_notice</p>";
|
534 |
-
|
535 |
-
if($direct_call){
|
536 |
-
return $return['message'];
|
537 |
-
}else{
|
538 |
-
echo json_encode($return);
|
539 |
-
die();
|
540 |
-
}
|
541 |
-
|
542 |
-
return null;
|
543 |
-
}
|
544 |
-
|
545 |
-
function ct_ajax_insert_users()
|
546 |
-
{
|
547 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
548 |
-
|
549 |
-
//* DELETION
|
550 |
-
if(!empty($_POST['delete'])){
|
551 |
-
$users = get_users(array('search' => '*user_*', 'search_columns' => array('login', 'nicename')));
|
552 |
-
$deleted = 0;
|
553 |
-
$amount_to_delete = 15;
|
554 |
-
foreach($users as $user){
|
555 |
-
if($deleted >= $amount_to_delete)
|
556 |
-
break;
|
557 |
-
if(wp_delete_user($user->ID))
|
558 |
-
$deleted++;
|
559 |
-
}
|
560 |
-
print "$deleted";
|
561 |
-
die();
|
562 |
-
}
|
563 |
-
//*/
|
564 |
-
|
565 |
-
//* INSERTION
|
566 |
-
global $wpdb;
|
567 |
-
$to_insert = 100;
|
568 |
-
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
569 |
-
|
570 |
-
if($result){
|
571 |
-
$ip = array();
|
572 |
-
foreach($result as $value){
|
573 |
-
$ips[] = long2ip($value['network']);
|
574 |
-
}
|
575 |
-
unset($value);
|
576 |
-
|
577 |
-
$inserted = 0;
|
578 |
-
for($i=0; $i<$to_insert; $i++){
|
579 |
-
$rnd=mt_rand(1,10000000);
|
580 |
-
|
581 |
-
$user_name = "user_$rnd";
|
582 |
-
$email="stop_email_$rnd@example.com";
|
583 |
-
|
584 |
-
$user_id = wp_create_user(
|
585 |
-
$user_name,
|
586 |
-
rand(),
|
587 |
-
$email
|
588 |
-
);
|
589 |
-
|
590 |
-
$curr_user = get_user_by('email', $email);
|
591 |
-
|
592 |
-
update_user_meta($curr_user->ID, 'session_tokens', array($rnd => array('ip' => $ips[$i])));
|
593 |
-
|
594 |
-
if (is_int($user_id))
|
595 |
-
$inserted++;
|
596 |
-
|
597 |
-
}
|
598 |
-
}else{
|
599 |
-
$inserted = '0';
|
600 |
-
}
|
601 |
-
//*/
|
602 |
-
|
603 |
-
print "$inserted";
|
604 |
-
die();
|
605 |
-
}
|
606 |
-
|
607 |
-
function ct_ajax_delete_checked_users()
|
608 |
-
{
|
609 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
610 |
-
foreach($_POST['ids'] as $key=>$value)
|
611 |
-
{
|
612 |
-
wp_delete_user($value);
|
613 |
-
}
|
614 |
-
die();
|
615 |
-
}
|
616 |
-
|
617 |
-
function ct_ajax_delete_all_users($count_all = 0)
|
618 |
-
{
|
619 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
620 |
-
|
621 |
-
global $wpdb;
|
622 |
-
|
623 |
-
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", OBJECT );
|
624 |
-
|
625 |
-
if(!empty($r)){
|
626 |
-
|
627 |
-
$count_all = $r ? $r[0]->cnt : 0;
|
628 |
-
|
629 |
-
$args = array(
|
630 |
-
'meta_key' => 'ct_marked_as_spam',
|
631 |
-
'meta_value' => '1',
|
632 |
-
'fields' => array('ID'),
|
633 |
-
'number' => 50
|
634 |
-
);
|
635 |
-
$users = get_users($args);
|
636 |
-
|
637 |
-
if ($users){
|
638 |
-
foreach($users as $user){
|
639 |
-
wp_delete_user($user->ID);
|
640 |
-
usleep(5000);
|
641 |
-
}
|
642 |
-
}
|
643 |
-
}
|
644 |
-
|
645 |
-
die($count_all);
|
646 |
-
}
|
647 |
-
|
648 |
-
function ct_ajax_clear_users()
|
649 |
-
{
|
650 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
651 |
-
|
652 |
-
if ( isset($_POST['from']) && isset($_POST['till']) ) {
|
653 |
-
if ( preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['from'] ) && preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['till'] ) ) {
|
654 |
-
|
655 |
-
$from = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
|
656 |
-
$till = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
|
657 |
-
|
658 |
-
global $wpdb;
|
659 |
-
$query_result = $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE
|
660 |
-
meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad')
|
661 |
-
AND meta_value >= '{$from}'
|
662 |
-
AND meta_value <= '{$till}';");
|
663 |
-
|
664 |
-
die();
|
665 |
-
|
666 |
-
}
|
667 |
-
}
|
668 |
-
}
|
669 |
-
|
670 |
-
/**
|
671 |
-
* Admin action 'user_unapproved_to_approved' - Approve user, delete from the deleting list
|
672 |
-
*/
|
673 |
-
function ct_usercheck_approve_user() {
|
674 |
-
|
675 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
676 |
-
|
677 |
-
delete_metadata('user', $_POST['id'], 'ct_marked_as_spam');
|
678 |
-
|
679 |
-
die();
|
680 |
-
}
|
681 |
-
|
682 |
-
/**
|
683 |
-
* Admin action 'wp_ajax_ajax_ct_get_csv_file' - prints CSV file to AJAX
|
684 |
-
*/
|
685 |
-
function ct_usercheck_get_csv_file() {
|
686 |
-
|
687 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
688 |
-
|
689 |
-
$filename = !empty($_POST['filename']) ? $_POST['filename'] : false;
|
690 |
-
|
691 |
-
if($filename !== false && file_exists(WP_PLUGIN_DIR."/cleantalk-spam-protect/check-results/{$filename}.csv"))
|
692 |
-
$output = 1;
|
693 |
-
else
|
694 |
-
$output = 0;
|
695 |
-
|
696 |
-
echo $output;
|
697 |
-
|
698 |
-
die();
|
699 |
-
}
|
700 |
-
|
701 |
-
/**
|
702 |
-
* Get date user registered
|
703 |
-
*
|
704 |
-
* @param $user_id
|
705 |
-
* @return string Date format"M j Y"
|
706 |
-
*/
|
707 |
-
function ct_get_user_register($user_id ) {
|
708 |
-
|
709 |
-
$user_data = get_userdata( $user_id );
|
710 |
-
$registered = $user_data->user_registered;
|
711 |
-
|
712 |
-
return date( "M j Y", strtotime( $registered ) );
|
713 |
-
|
714 |
-
}
|
715 |
-
|
716 |
-
/**
|
717 |
-
* Get date last checked user or date first registered user
|
718 |
-
*
|
719 |
-
* @return string date "M j Y"
|
720 |
-
*/
|
721 |
-
function ct_last_checked_user_register() {
|
722 |
-
|
723 |
-
// Checked users
|
724 |
-
$params = array(
|
725 |
-
'fields' => 'ID',
|
726 |
-
'meta_key' => 'ct_checked',
|
727 |
-
'count_total' => true,
|
728 |
-
'orderby' => 'ct_checked'
|
729 |
-
);
|
730 |
-
$tmp = new WP_User_Query($params);
|
731 |
-
$cnt_checked = $tmp->get_total();
|
732 |
-
|
733 |
-
if( $cnt_checked > 0 ) {
|
734 |
-
|
735 |
-
// If we have checked users return last user reg date
|
736 |
-
$users = $tmp->get_results();
|
737 |
-
return ct_get_user_register( end( $users ) );
|
738 |
-
|
739 |
-
} else {
|
740 |
-
|
741 |
-
// If we have not any checked users return first user registered date
|
742 |
-
$params = array(
|
743 |
-
'fields' => 'ID',
|
744 |
-
'number' => 1,
|
745 |
-
'orderby' => 'user_registered'
|
746 |
-
);
|
747 |
-
$tmp = new WP_User_Query($params);
|
748 |
-
|
749 |
-
return ct_get_user_register( current( $tmp->get_results() ) );
|
750 |
-
|
751 |
-
}
|
752 |
-
|
753 |
-
}
|
754 |
-
|
755 |
-
/**
|
756 |
-
* Get last users check date.
|
757 |
-
*
|
758 |
-
* @return string|null Date format"M j Y" or datetime format or null
|
759 |
-
*/
|
760 |
-
function ct_get_last_check_date( $timestamp = false ) {
|
761 |
-
|
762 |
-
// Checked users
|
763 |
-
$params = array(
|
764 |
-
'fields' => 'ID',
|
765 |
-
'meta_key' => 'ct_checked',
|
766 |
-
'count_total' => true,
|
767 |
-
'orderby' => 'ct_checked'
|
768 |
-
);
|
769 |
-
$tmp = new WP_User_Query($params);
|
770 |
-
$cnt_checked = $tmp->get_total();
|
771 |
-
$last_check = null;
|
772 |
-
|
773 |
-
if( $cnt_checked > 0 ) {
|
774 |
-
|
775 |
-
$users = $tmp->get_results();
|
776 |
-
$last_check = $timestamp ? get_user_meta( end( $users ), 'ct_checked', true ) : date( "M j Y", strtotime( get_user_meta( end( $users ), 'ct_checked', true ) ) );
|
777 |
-
}
|
778 |
-
|
779 |
-
return $last_check;
|
780 |
-
|
781 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action('admin_menu', 'ct_add_users_menu');
|
4 |
+
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
5 |
+
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
6 |
+
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
7 |
+
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
8 |
+
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
9 |
+
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
10 |
+
add_action( 'wp_ajax_ajax_ct_approve_user', 'ct_usercheck_approve_user' );
|
11 |
+
add_action( 'wp_ajax_ajax_ct_get_csv_file', 'ct_usercheck_get_csv_file' );
|
12 |
+
|
13 |
+
function ct_add_users_menu(){
|
14 |
+
if(current_user_can('activate_plugins'))
|
15 |
+
add_users_page( __("Check for spam", 'cleantalk'), __("Find spam users", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
16 |
+
}
|
17 |
+
|
18 |
+
function ct_show_users_page(){
|
19 |
+
|
20 |
+
global $wpdb, $apbct;
|
21 |
+
|
22 |
+
?>
|
23 |
+
<div class="wrap">
|
24 |
+
<h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
|
25 |
+
<a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
|
26 |
+
<br />
|
27 |
+
<?php
|
28 |
+
|
29 |
+
// If access key is unset in
|
30 |
+
if(!apbct_api_key__is_correct()){
|
31 |
+
if($apbct->moderate_ip == 1){
|
32 |
+
echo '<h3>'
|
33 |
+
.sprintf(
|
34 |
+
__('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
|
35 |
+
'<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
|
36 |
+
'</a>'
|
37 |
+
)
|
38 |
+
.'</h3>';
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
// Getting total spam users
|
45 |
+
$r = $wpdb->get_results("
|
46 |
+
SELECT
|
47 |
+
DISTINCT COUNT($wpdb->users.ID) AS cnt
|
48 |
+
FROM $wpdb->users
|
49 |
+
INNER JOIN $wpdb->usermeta
|
50 |
+
ON $wpdb->users.ID = $wpdb->usermeta.user_id
|
51 |
+
WHERE $wpdb->usermeta.meta_key='ct_marked_as_spam';"
|
52 |
+
, ARRAY_A);
|
53 |
+
$cnt_spam1=$r[0]['cnt'];
|
54 |
+
|
55 |
+
?>
|
56 |
+
|
57 |
+
<!-- AJAX error message -->
|
58 |
+
<div id="ct_error_message" style="display:none">
|
59 |
+
<h3>
|
60 |
+
<?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
|
61 |
+
</h3>
|
62 |
+
<h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<!-- Deleting message -->
|
66 |
+
<div id="ct_deleting_message" style="display:none">
|
67 |
+
<?php _e("Please wait for a while. CleanTalk is deleting spam users. Users left: ", 'cleantalk'); ?> <span id="cleantalk_users_left">
|
68 |
+
<?php echo $cnt_spam1;?>
|
69 |
+
</span>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<!-- Main info -->
|
73 |
+
<h3 id="ct_checking_status"><?php echo ct_ajax_info_users(true); ?></h3>
|
74 |
+
|
75 |
+
<!-- Check options -->
|
76 |
+
<div class="ct_to_hide" id="ct_check_params_wrapper">
|
77 |
+
<button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
|
78 |
+
<?php if(!empty($_COOKIE['ct_paused_users_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
|
79 |
+
<p class="ct_check_params_desc"><?php _e("The plugin will check all users against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
|
80 |
+
<br />
|
81 |
+
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
82 |
+
<input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
|
83 |
+
</div>
|
84 |
+
<p class="ct_check_params_desc"><?php _e("Allows to use user's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
|
85 |
+
<br />
|
86 |
+
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
87 |
+
<input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
|
88 |
+
</div>
|
89 |
+
<div class="ct_check_params_desc">
|
90 |
+
<input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo ct_last_checked_user_register(); ?>" disabled readonly />
|
91 |
+
<input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo date( "M j Y"); ?>" disabled readonly />
|
92 |
+
</div>
|
93 |
+
<div class="ct_check_params_desc">
|
94 |
+
<p>Begin/end dates of creation user to check. If no date is specified, the plugin uses the last users check date.</p>
|
95 |
+
</div>
|
96 |
+
<br>
|
97 |
+
<?php apbct_admin__badge__get_premium(); ?>
|
98 |
+
</div>
|
99 |
+
|
100 |
+
<!-- Cooling notice -->
|
101 |
+
<h3 id="ct_cooling_notice"></h3>
|
102 |
+
|
103 |
+
<!-- Preloader and working message -->
|
104 |
+
<div id="ct_preloader">
|
105 |
+
<img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
|
106 |
+
</div>
|
107 |
+
<div id="ct_working_message">
|
108 |
+
<?php _e("Please wait for a while. CleanTalk is checking all users via blacklist database at cleantalk.org. You will have option to delete found spam users after plugin finish.", 'cleantalk'); ?>
|
109 |
+
</div>
|
110 |
+
|
111 |
+
<!-- Pause button -->
|
112 |
+
<button class="button" id="ct_pause">Pause check</button>
|
113 |
+
|
114 |
+
<?php
|
115 |
+
|
116 |
+
// Pagination
|
117 |
+
$page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
|
118 |
+
$on_page = 20;
|
119 |
+
|
120 |
+
$args_spam = array(
|
121 |
+
'meta_query' => array(
|
122 |
+
Array(
|
123 |
+
'key' => 'ct_marked_as_spam',
|
124 |
+
'value' => '1',
|
125 |
+
'compare' => 'NUMERIC'
|
126 |
+
)
|
127 |
+
),
|
128 |
+
'number'=>$on_page,
|
129 |
+
'offset'=>($page-1)*$on_page
|
130 |
+
);
|
131 |
+
|
132 |
+
$c_spam=get_users($args_spam);
|
133 |
+
if($cnt_spam1 > 0){
|
134 |
+
|
135 |
+
$pages = ceil(intval($cnt_spam1)/$on_page);
|
136 |
+
if($pages && $pages != 1){
|
137 |
+
echo "<div class='ct_to_hide pagination'>"
|
138 |
+
."<b>Pages:</b>"
|
139 |
+
."<ul class='pagination'>";
|
140 |
+
for($i = 1; $i <= $pages; $i++){
|
141 |
+
echo "<li class='pagination'>"
|
142 |
+
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
143 |
+
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
144 |
+
."</a>"
|
145 |
+
."</li>";
|
146 |
+
}
|
147 |
+
echo "</ul>";
|
148 |
+
echo "</div>";
|
149 |
+
}
|
150 |
+
?>
|
151 |
+
<table class="ct_to_hide widefat fixed comments" id="ct_check_users_table">
|
152 |
+
<thead>
|
153 |
+
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
154 |
+
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
155 |
+
<input id="cb-select-all-1" type="checkbox"/>
|
156 |
+
</th>
|
157 |
+
<th scope="col" id="author" class="manage-column column-slug"><?php _e('Username');?></th>
|
158 |
+
<th scope="col" id="comment" class="manage-column column-comment"><?php _e('Name');?></th>
|
159 |
+
<th scope="col" id="response" class="manage-column column-comment"><?php _e('E-mail');?></th>
|
160 |
+
<th scope="col" id="signed_up" class="manage-column column-comment"><?php _e('Signed up');?></th>
|
161 |
+
<th scope="col" id="role" class="manage-column column-response sortable desc"><?php _e('Role');?></th>
|
162 |
+
<th scope="col" id="posts" class="manage-column column-response sortable desc"><?php _e('Posts');?></th>
|
163 |
+
</thead>
|
164 |
+
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
165 |
+
<?php
|
166 |
+
for($i=0;$i<sizeof($c_spam);$i++){
|
167 |
+
$id = $c_spam[$i]->ID;
|
168 |
+
$login = $c_spam[$i]->data->user_login;
|
169 |
+
$email = $c_spam[$i]->data->user_email;
|
170 |
+
$signed = substr($c_spam[$i]->data->user_registered, 0, -3);
|
171 |
+
|
172 |
+
echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_user' data-id='$id'>"
|
173 |
+
."<th scope='row' class='check-column'>"
|
174 |
+
."<label class='screen-reader-text' for='cb-select-$id'>Select user</label>"
|
175 |
+
."<input id='cb-select-$id' type='checkbox' name='del_comments[]' />"
|
176 |
+
."</th>"
|
177 |
+
."<td class='author column-author' nowrap>"
|
178 |
+
."<strong>"
|
179 |
+
.get_avatar( $c_spam[$i]->data->ID , 32)
|
180 |
+
.$login
|
181 |
+
."</strong>"
|
182 |
+
."<br/>"
|
183 |
+
."<br/>";
|
184 |
+
|
185 |
+
// Outputs email if exists
|
186 |
+
if(!empty($email)){
|
187 |
+
echo "<a href='mailto:$email'>$email</a>"
|
188 |
+
.(!$apbct->white_label
|
189 |
+
? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
|
190 |
+
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
191 |
+
."</a>"
|
192 |
+
: '');
|
193 |
+
}else{
|
194 |
+
echo "No email";
|
195 |
+
}
|
196 |
+
echo "<br/>";
|
197 |
+
|
198 |
+
// Outputs IP if exists
|
199 |
+
$user_meta = get_user_meta($id, 'session_tokens', true);
|
200 |
+
if(!empty($user_meta) && is_array($user_meta)){
|
201 |
+
$user_meta=array_values($user_meta);
|
202 |
+
if(!empty($user_meta[0]['ip'])){
|
203 |
+
$ip = $user_meta[0]['ip'];
|
204 |
+
echo "<a href='user-edit.php?user_id=$id'>$ip</a>"
|
205 |
+
.(!$apbct->white_label
|
206 |
+
?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
|
207 |
+
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
208 |
+
."</a>"
|
209 |
+
: '');
|
210 |
+
}else
|
211 |
+
echo "No IP adress";
|
212 |
+
}else
|
213 |
+
echo "No IP adress";
|
214 |
+
echo "</td>";
|
215 |
+
?>
|
216 |
+
<td class="comment column-comment">
|
217 |
+
<div class="submitted-on">
|
218 |
+
<?php print $c_spam[$i]->data->display_name; ?>
|
219 |
+
<div style="height:16px; display: none;" id="cleantalk_button_set_<?php print $id; ?>">
|
220 |
+
<a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
|
221 |
+
|
|
222 |
+
<a href="#" class="cleantalk_delete_user_button" id="cleantalk_delete_user_<?php print $id; ?>" data-id="<?php print $id; ?>" style="color:#a00;display:none;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
|
223 |
+
</div>
|
224 |
+
</div>
|
225 |
+
</td>
|
226 |
+
<td class="comment column-comment">
|
227 |
+
<?php print $email; ?>
|
228 |
+
</td>
|
229 |
+
<td class="comment column-comment">
|
230 |
+
<?php print $signed; ?>
|
231 |
+
</td>
|
232 |
+
<td class="comment column-comment">
|
233 |
+
<?php
|
234 |
+
$info=get_userdata( $id );
|
235 |
+
print implode(', ', $info->roles);
|
236 |
+
?>
|
237 |
+
</td>
|
238 |
+
<td class="comment column-comment">
|
239 |
+
<?php
|
240 |
+
print count_user_posts($id);
|
241 |
+
?>
|
242 |
+
</td>
|
243 |
+
</tr>
|
244 |
+
<?php
|
245 |
+
}
|
246 |
+
?>
|
247 |
+
</tbody>
|
248 |
+
</table>
|
249 |
+
<?php
|
250 |
+
// Pagination
|
251 |
+
if($pages && $pages != 1){
|
252 |
+
echo "<div class='ct_to_hide pagination'>"
|
253 |
+
."<b>Pages:</b>"
|
254 |
+
."<ul class='pagination'>";
|
255 |
+
for($i = 1; $i <= $pages; $i++){
|
256 |
+
echo "<li class='pagination'>"
|
257 |
+
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
258 |
+
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
259 |
+
."</a>"
|
260 |
+
."</li>";
|
261 |
+
}
|
262 |
+
echo "</ul>";
|
263 |
+
echo "</div>";
|
264 |
+
}
|
265 |
+
?>
|
266 |
+
<div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
|
267 |
+
<button class="button" id="ct_delete_all_users"><?php _e('Delete all users from list', 'cleantalk'); ?></button>
|
268 |
+
<button class="button" id="ct_delete_checked_users"><?php _e('Delete selected', 'cleantalk'); ?></button>
|
269 |
+
<button class="button" id="ct_get_csv_file"><?php _e('Download results in CSV', 'cleantalk'); ?></button>
|
270 |
+
</div>
|
271 |
+
<?php
|
272 |
+
}
|
273 |
+
echo filter_input(INPUT_SERVER, 'REMOTE_ADDR')=='127.0.0.1' ? '<br /><button class=" ct_to_hide button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). ' (100)</button> ' : '';
|
274 |
+
echo filter_input(INPUT_SERVER, 'REMOTE_ADDR')=='127.0.0.1' ? '<button class="ct_to_hide button" id="ct_delete_users">'. __('Delete accounts', 'cleantalk'). ' (110)</button><br />' : '';
|
275 |
+
|
276 |
+
if($cnt_spam1 > 0){
|
277 |
+
echo "<div id='ct_search_info'>"
|
278 |
+
."<br />"
|
279 |
+
.__("There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.", 'cleantalk')
|
280 |
+
."</div>";
|
281 |
+
}
|
282 |
+
?>
|
283 |
+
<div>
|
284 |
+
<button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
|
285 |
+
</div>
|
286 |
+
<div id='ct_csv_wrapper' style="display: none;"></div>
|
287 |
+
</div>
|
288 |
+
<?php
|
289 |
+
}
|
290 |
+
|
291 |
+
function ct_ajax_check_users(){
|
292 |
+
|
293 |
+
check_ajax_referer('ct_secret_nonce', 'security');
|
294 |
+
|
295 |
+
$amount = !empty($_POST['amount']) && intval($_POST['amount'])
|
296 |
+
? intval($_POST['amount'])
|
297 |
+
: 100;
|
298 |
+
|
299 |
+
global $apbct;
|
300 |
+
|
301 |
+
$skip_roles = array(
|
302 |
+
'administrator'
|
303 |
+
);
|
304 |
+
|
305 |
+
$params = array(
|
306 |
+
// 'fields' => array(
|
307 |
+
// 'ID',
|
308 |
+
// 'user_login',
|
309 |
+
// 'user_email',
|
310 |
+
// 'user_registered',
|
311 |
+
// ),
|
312 |
+
'meta_query' => array(
|
313 |
+
'relation' => 'AND',
|
314 |
+
array(
|
315 |
+
'key' => 'ct_checked',
|
316 |
+
'compare' => 'NOT EXISTS'
|
317 |
+
),
|
318 |
+
array(
|
319 |
+
'key' => 'ct_bad',
|
320 |
+
'compare' => 'NOT EXISTS'
|
321 |
+
),
|
322 |
+
),
|
323 |
+
'orderby' => 'registered',
|
324 |
+
'order' => 'ASC',
|
325 |
+
'number' => $amount,
|
326 |
+
);
|
327 |
+
|
328 |
+
if(isset($_POST['from'], $_POST['till'])){
|
329 |
+
|
330 |
+
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
331 |
+
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
332 |
+
|
333 |
+
$params['date_query'] = array(
|
334 |
+
'column' => 'user_registered',
|
335 |
+
'after' => $from_date,
|
336 |
+
'before' => $till_date,
|
337 |
+
'inclusive' => true,
|
338 |
+
);
|
339 |
+
}
|
340 |
+
|
341 |
+
$u = get_users( $params );
|
342 |
+
|
343 |
+
$check_result = array(
|
344 |
+
'end' => 0,
|
345 |
+
'checked' => 0,
|
346 |
+
'spam' => 0,
|
347 |
+
'bad' => 0,
|
348 |
+
'error' => 0
|
349 |
+
);
|
350 |
+
|
351 |
+
if(count($u) > 0){
|
352 |
+
|
353 |
+
if(!empty($_POST['accurate_check'])){
|
354 |
+
// Leaving users only with first comment's date. Unsetting others.
|
355 |
+
foreach($u as $user_index => $user){
|
356 |
+
|
357 |
+
if(!isset($curr_date))
|
358 |
+
$curr_date = (substr($user->data->user_registered, 0, 10) ? substr($user->data->user_registered, 0, 10) : '');
|
359 |
+
|
360 |
+
if(substr($user->data->user_registered, 0, 10) != $curr_date)
|
361 |
+
unset($u[$user_index]);
|
362 |
+
|
363 |
+
}
|
364 |
+
unset($user_index, $user);
|
365 |
+
}
|
366 |
+
|
367 |
+
// Checking comments IP/Email. Gathering $data for check.
|
368 |
+
$data=Array();
|
369 |
+
for($i=0; $i < count($u); $i++){
|
370 |
+
|
371 |
+
$user_meta = get_user_meta($u[$i]->ID, 'session_tokens', true);
|
372 |
+
if(is_array($user_meta))
|
373 |
+
$user_meta = array_values($user_meta);
|
374 |
+
|
375 |
+
$curr_ip = !empty($user_meta[0]['ip']) ? trim($user_meta[0]['ip']) : '';
|
376 |
+
$curr_email = !empty($u[$i]->data->user_email) ? trim($u[$i]->data->user_email) : '';
|
377 |
+
|
378 |
+
// Check for identity
|
379 |
+
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
380 |
+
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
381 |
+
|
382 |
+
if(empty($curr_ip) && empty($curr_email)){
|
383 |
+
$check_result['bad']++;
|
384 |
+
update_user_meta($u[$i]->ID,'ct_bad','1',true);
|
385 |
+
unset($u[$i]);
|
386 |
+
}else{
|
387 |
+
if(!empty($curr_ip))
|
388 |
+
$data[] = $curr_ip;
|
389 |
+
if(!empty($curr_email))
|
390 |
+
$data[] = $curr_email;
|
391 |
+
// Patch for empty IP/Email
|
392 |
+
$u[$i]->data->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
|
393 |
+
$u[$i]->data->user_email = empty($curr_email) ? 'none' : $curr_email;
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
// Recombining after checking and unsettting
|
398 |
+
$u = array_values($u);
|
399 |
+
|
400 |
+
// Drop if data empty and there's no users to check
|
401 |
+
if(count($data) == 0){
|
402 |
+
if($_POST['unchecked'] === 0)
|
403 |
+
$check_result['end'] = 1;
|
404 |
+
print json_encode($check_result);
|
405 |
+
die();
|
406 |
+
}
|
407 |
+
|
408 |
+
$result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
|
409 |
+
|
410 |
+
if(empty($result['error'])){
|
411 |
+
|
412 |
+
// Opening CSV file
|
413 |
+
$current_user = wp_get_current_user();
|
414 |
+
if(!is_dir(APBCT_DIR_PATH .'/check-results/'))
|
415 |
+
mkdir(APBCT_DIR_PATH .'/check-results');
|
416 |
+
$filename = APBCT_DIR_PATH ."/check-results/user_check_by_{$current_user->user_nicename}.csv";
|
417 |
+
$text = '';
|
418 |
+
|
419 |
+
if(isset($_POST['new_check']) && $_POST['new_check'] == 'true'){
|
420 |
+
$file_desc = fopen($filename, 'w');
|
421 |
+
$text .= 'login,email,ip'.PHP_EOL;
|
422 |
+
}else
|
423 |
+
$file_desc = fopen($filename, 'a+');
|
424 |
+
// End of Opening CSV
|
425 |
+
|
426 |
+
for($i=0;$i<sizeof($u);$i++){
|
427 |
+
|
428 |
+
$check_result['checked']++;
|
429 |
+
update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
|
430 |
+
|
431 |
+
// Do not display forbidden roles.
|
432 |
+
foreach ($skip_roles as $role) {
|
433 |
+
if (in_array($role, $u[$i]->roles)){
|
434 |
+
delete_user_meta($u[$i]->ID, 'ct_marked_as_spam');
|
435 |
+
continue 2;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
$mark_spam_ip = false;
|
440 |
+
$mark_spam_email = false;
|
441 |
+
|
442 |
+
$uip = $u[$i]->data->user_ip;
|
443 |
+
$uim = $u[$i]->data->user_email;
|
444 |
+
|
445 |
+
if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
|
446 |
+
$mark_spam_ip = true;
|
447 |
+
|
448 |
+
if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
|
449 |
+
$mark_spam_email = true;
|
450 |
+
|
451 |
+
if ($mark_spam_ip || $mark_spam_email){
|
452 |
+
$check_result['spam']++;
|
453 |
+
update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
|
454 |
+
$text .= $u[$i]->user_login.',';
|
455 |
+
$text .= ($mark_spam_email ? $uim : '').',';
|
456 |
+
$text .= ($mark_spam_ip ? $uip : '').PHP_EOL;
|
457 |
+
}
|
458 |
+
|
459 |
+
}
|
460 |
+
if($file_desc){
|
461 |
+
fwrite($file_desc, $text);
|
462 |
+
fclose($file_desc);
|
463 |
+
}
|
464 |
+
print json_encode($check_result);
|
465 |
+
}else{
|
466 |
+
$check_result['error'] = 1;
|
467 |
+
$check_result['error_message'] = $result['error'];
|
468 |
+
echo json_encode($check_result);
|
469 |
+
}
|
470 |
+
}else{
|
471 |
+
$check_result['end'] = 1;
|
472 |
+
print json_encode($check_result);
|
473 |
+
}
|
474 |
+
die;
|
475 |
+
}
|
476 |
+
|
477 |
+
function ct_ajax_info_users($direct_call = false)
|
478 |
+
{
|
479 |
+
if (!$direct_call)
|
480 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
481 |
+
|
482 |
+
// Total users
|
483 |
+
$params_total = array(
|
484 |
+
'fields' => 'ID',
|
485 |
+
'count'=>true,
|
486 |
+
'orderby' => 'user_registered'
|
487 |
+
);
|
488 |
+
$total_users = new WP_User_Query($params_total);
|
489 |
+
$cnt = $total_users->get_total();
|
490 |
+
|
491 |
+
// Checked users
|
492 |
+
$params_checked = array(
|
493 |
+
'fields' => 'ID',
|
494 |
+
'meta_key' => 'ct_checked',
|
495 |
+
'count_total' => true,
|
496 |
+
'orderby' => 'ct_checked'
|
497 |
+
);
|
498 |
+
$checked_users = new WP_User_Query($params_checked);
|
499 |
+
$cnt_checked = $checked_users->get_total();
|
500 |
+
|
501 |
+
// Spam users
|
502 |
+
$params_spam = array(
|
503 |
+
'fields' => 'ID',
|
504 |
+
'meta_key' => 'ct_marked_as_spam',
|
505 |
+
'count_total' => true,
|
506 |
+
);
|
507 |
+
$spam_users = new WP_User_Query($params_spam);
|
508 |
+
$cnt_spam = $spam_users->get_total();
|
509 |
+
|
510 |
+
// Bad users (without IP and Email)
|
511 |
+
$params_bad = array(
|
512 |
+
'fields' => 'ID',
|
513 |
+
'meta_key' => 'ct_bad',
|
514 |
+
'count_total' => true,
|
515 |
+
);
|
516 |
+
$bad_users = new WP_User_Query($params_bad);
|
517 |
+
$cnt_bad = $bad_users->get_total();
|
518 |
+
|
519 |
+
$return = array(
|
520 |
+
'message' => '',
|
521 |
+
'total' => $cnt,
|
522 |
+
'spam' => $cnt_spam,
|
523 |
+
'checked' => $cnt_checked,
|
524 |
+
'bad' => $cnt_bad,
|
525 |
+
);
|
526 |
+
|
527 |
+
$return['message'] .= sprintf (__("Total users %s, checked %s, last check %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'), $cnt, $cnt_checked, ct_get_last_check_date(), $cnt_spam, $cnt_bad);
|
528 |
+
|
529 |
+
$backup_notice = ' ';
|
530 |
+
if ($cnt_spam > 0) {
|
531 |
+
$backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
|
532 |
+
}
|
533 |
+
$return['message'] .= "<p>$backup_notice</p>";
|
534 |
+
|
535 |
+
if($direct_call){
|
536 |
+
return $return['message'];
|
537 |
+
}else{
|
538 |
+
echo json_encode($return);
|
539 |
+
die();
|
540 |
+
}
|
541 |
+
|
542 |
+
return null;
|
543 |
+
}
|
544 |
+
|
545 |
+
function ct_ajax_insert_users()
|
546 |
+
{
|
547 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
548 |
+
|
549 |
+
//* DELETION
|
550 |
+
if(!empty($_POST['delete'])){
|
551 |
+
$users = get_users(array('search' => '*user_*', 'search_columns' => array('login', 'nicename')));
|
552 |
+
$deleted = 0;
|
553 |
+
$amount_to_delete = 15;
|
554 |
+
foreach($users as $user){
|
555 |
+
if($deleted >= $amount_to_delete)
|
556 |
+
break;
|
557 |
+
if(wp_delete_user($user->ID))
|
558 |
+
$deleted++;
|
559 |
+
}
|
560 |
+
print "$deleted";
|
561 |
+
die();
|
562 |
+
}
|
563 |
+
//*/
|
564 |
+
|
565 |
+
//* INSERTION
|
566 |
+
global $wpdb;
|
567 |
+
$to_insert = 100;
|
568 |
+
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
569 |
+
|
570 |
+
if($result){
|
571 |
+
$ip = array();
|
572 |
+
foreach($result as $value){
|
573 |
+
$ips[] = long2ip($value['network']);
|
574 |
+
}
|
575 |
+
unset($value);
|
576 |
+
|
577 |
+
$inserted = 0;
|
578 |
+
for($i=0; $i<$to_insert; $i++){
|
579 |
+
$rnd=mt_rand(1,10000000);
|
580 |
+
|
581 |
+
$user_name = "user_$rnd";
|
582 |
+
$email="stop_email_$rnd@example.com";
|
583 |
+
|
584 |
+
$user_id = wp_create_user(
|
585 |
+
$user_name,
|
586 |
+
rand(),
|
587 |
+
$email
|
588 |
+
);
|
589 |
+
|
590 |
+
$curr_user = get_user_by('email', $email);
|
591 |
+
|
592 |
+
update_user_meta($curr_user->ID, 'session_tokens', array($rnd => array('ip' => $ips[$i])));
|
593 |
+
|
594 |
+
if (is_int($user_id))
|
595 |
+
$inserted++;
|
596 |
+
|
597 |
+
}
|
598 |
+
}else{
|
599 |
+
$inserted = '0';
|
600 |
+
}
|
601 |
+
//*/
|
602 |
+
|
603 |
+
print "$inserted";
|
604 |
+
die();
|
605 |
+
}
|
606 |
+
|
607 |
+
function ct_ajax_delete_checked_users()
|
608 |
+
{
|
609 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
610 |
+
foreach($_POST['ids'] as $key=>$value)
|
611 |
+
{
|
612 |
+
wp_delete_user($value);
|
613 |
+
}
|
614 |
+
die();
|
615 |
+
}
|
616 |
+
|
617 |
+
function ct_ajax_delete_all_users($count_all = 0)
|
618 |
+
{
|
619 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
620 |
+
|
621 |
+
global $wpdb;
|
622 |
+
|
623 |
+
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", OBJECT );
|
624 |
+
|
625 |
+
if(!empty($r)){
|
626 |
+
|
627 |
+
$count_all = $r ? $r[0]->cnt : 0;
|
628 |
+
|
629 |
+
$args = array(
|
630 |
+
'meta_key' => 'ct_marked_as_spam',
|
631 |
+
'meta_value' => '1',
|
632 |
+
'fields' => array('ID'),
|
633 |
+
'number' => 50
|
634 |
+
);
|
635 |
+
$users = get_users($args);
|
636 |
+
|
637 |
+
if ($users){
|
638 |
+
foreach($users as $user){
|
639 |
+
wp_delete_user($user->ID);
|
640 |
+
usleep(5000);
|
641 |
+
}
|
642 |
+
}
|
643 |
+
}
|
644 |
+
|
645 |
+
die($count_all);
|
646 |
+
}
|
647 |
+
|
648 |
+
function ct_ajax_clear_users()
|
649 |
+
{
|
650 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
651 |
+
|
652 |
+
if ( isset($_POST['from']) && isset($_POST['till']) ) {
|
653 |
+
if ( preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['from'] ) && preg_match('/[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}/', $_POST['till'] ) ) {
|
654 |
+
|
655 |
+
$from = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
|
656 |
+
$till = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
|
657 |
+
|
658 |
+
global $wpdb;
|
659 |
+
$query_result = $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE
|
660 |
+
meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad')
|
661 |
+
AND meta_value >= '{$from}'
|
662 |
+
AND meta_value <= '{$till}';");
|
663 |
+
|
664 |
+
die();
|
665 |
+
|
666 |
+
}
|
667 |
+
}
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Admin action 'user_unapproved_to_approved' - Approve user, delete from the deleting list
|
672 |
+
*/
|
673 |
+
function ct_usercheck_approve_user() {
|
674 |
+
|
675 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
676 |
+
|
677 |
+
delete_metadata('user', $_POST['id'], 'ct_marked_as_spam');
|
678 |
+
|
679 |
+
die();
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Admin action 'wp_ajax_ajax_ct_get_csv_file' - prints CSV file to AJAX
|
684 |
+
*/
|
685 |
+
function ct_usercheck_get_csv_file() {
|
686 |
+
|
687 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
688 |
+
|
689 |
+
$filename = !empty($_POST['filename']) ? $_POST['filename'] : false;
|
690 |
+
|
691 |
+
if($filename !== false && file_exists(WP_PLUGIN_DIR."/cleantalk-spam-protect/check-results/{$filename}.csv"))
|
692 |
+
$output = 1;
|
693 |
+
else
|
694 |
+
$output = 0;
|
695 |
+
|
696 |
+
echo $output;
|
697 |
+
|
698 |
+
die();
|
699 |
+
}
|
700 |
+
|
701 |
+
/**
|
702 |
+
* Get date user registered
|
703 |
+
*
|
704 |
+
* @param $user_id
|
705 |
+
* @return string Date format"M j Y"
|
706 |
+
*/
|
707 |
+
function ct_get_user_register($user_id ) {
|
708 |
+
|
709 |
+
$user_data = get_userdata( $user_id );
|
710 |
+
$registered = $user_data->user_registered;
|
711 |
+
|
712 |
+
return date( "M j Y", strtotime( $registered ) );
|
713 |
+
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Get date last checked user or date first registered user
|
718 |
+
*
|
719 |
+
* @return string date "M j Y"
|
720 |
+
*/
|
721 |
+
function ct_last_checked_user_register() {
|
722 |
+
|
723 |
+
// Checked users
|
724 |
+
$params = array(
|
725 |
+
'fields' => 'ID',
|
726 |
+
'meta_key' => 'ct_checked',
|
727 |
+
'count_total' => true,
|
728 |
+
'orderby' => 'ct_checked'
|
729 |
+
);
|
730 |
+
$tmp = new WP_User_Query($params);
|
731 |
+
$cnt_checked = $tmp->get_total();
|
732 |
+
|
733 |
+
if( $cnt_checked > 0 ) {
|
734 |
+
|
735 |
+
// If we have checked users return last user reg date
|
736 |
+
$users = $tmp->get_results();
|
737 |
+
return ct_get_user_register( end( $users ) );
|
738 |
+
|
739 |
+
} else {
|
740 |
+
|
741 |
+
// If we have not any checked users return first user registered date
|
742 |
+
$params = array(
|
743 |
+
'fields' => 'ID',
|
744 |
+
'number' => 1,
|
745 |
+
'orderby' => 'user_registered'
|
746 |
+
);
|
747 |
+
$tmp = new WP_User_Query($params);
|
748 |
+
|
749 |
+
return ct_get_user_register( current( $tmp->get_results() ) );
|
750 |
+
|
751 |
+
}
|
752 |
+
|
753 |
+
}
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Get last users check date.
|
757 |
+
*
|
758 |
+
* @return string|null Date format"M j Y" or datetime format or null
|
759 |
+
*/
|
760 |
+
function ct_get_last_check_date( $timestamp = false ) {
|
761 |
+
|
762 |
+
// Checked users
|
763 |
+
$params = array(
|
764 |
+
'fields' => 'ID',
|
765 |
+
'meta_key' => 'ct_checked',
|
766 |
+
'count_total' => true,
|
767 |
+
'orderby' => 'ct_checked'
|
768 |
+
);
|
769 |
+
$tmp = new WP_User_Query($params);
|
770 |
+
$cnt_checked = $tmp->get_total();
|
771 |
+
$last_check = null;
|
772 |
+
|
773 |
+
if( $cnt_checked > 0 ) {
|
774 |
+
|
775 |
+
$users = $tmp->get_results();
|
776 |
+
$last_check = $timestamp ? get_user_meta( end( $users ), 'ct_checked', true ) : date( "M j Y", strtotime( get_user_meta( end( $users ), 'ct_checked', true ) ) );
|
777 |
+
}
|
778 |
+
|
779 |
+
return $last_check;
|
780 |
+
|
781 |
+
}
|
lib/Cleantalk/Antispam/Helper.php
CHANGED
@@ -1,693 +1,693 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Cleantalk\Antispam;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* CleanTalk Helper class.
|
7 |
-
* Compatible with any CMS.
|
8 |
-
*
|
9 |
-
* @package PHP Antispam by CleanTalk
|
10 |
-
* @subpackage Helper
|
11 |
-
* @Version 3.2
|
12 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
13 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
14 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
15 |
-
* @see https://github.com/CleanTalk/php-antispam
|
16 |
-
*/
|
17 |
-
class Helper
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* Default user agent for HTTP requests
|
21 |
-
*/
|
22 |
-
const AGENT = 'Cleatalk-Helper/3.2';
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @var array Set of private networks IPv4 and IPv6
|
26 |
-
*/
|
27 |
-
public static $private_networks = array(
|
28 |
-
'v4' => array(
|
29 |
-
'10.0.0.0/8',
|
30 |
-
'100.64.0.0/10',
|
31 |
-
'172.16.0.0/12',
|
32 |
-
'192.168.0.0/16',
|
33 |
-
'127.0.0.1/32',
|
34 |
-
),
|
35 |
-
'v6' => array(
|
36 |
-
'0:0:0:0:0:0:0:1/128', // localhost
|
37 |
-
'0:0:0:0:0:0:a:1/128', // ::ffff:127.0.0.1
|
38 |
-
),
|
39 |
-
);
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var array Set of CleanTalk servers
|
43 |
-
*/
|
44 |
-
public static $cleantalks_servers = array(
|
45 |
-
// MODERATE
|
46 |
-
'moderate1.cleantalk.org' => '162.243.144.175',
|
47 |
-
'moderate2.cleantalk.org' => '159.203.121.181',
|
48 |
-
'moderate3.cleantalk.org' => '88.198.153.60',
|
49 |
-
'moderate4.cleantalk.org' => '159.69.51.30',
|
50 |
-
'moderate5.cleantalk.org' => '95.216.200.119',
|
51 |
-
'moderate6.cleantalk.org' => '138.68.234.8',
|
52 |
-
// APIX
|
53 |
-
'apix1.cleantalk.org' => '35.158.52.161',
|
54 |
-
'apix2.cleantalk.org' => '18.206.49.217',
|
55 |
-
'apix3.cleantalk.org' => '3.18.23.246',
|
56 |
-
//ns
|
57 |
-
'netserv2.cleantalk.org' => '178.63.60.214',
|
58 |
-
'netserv3.cleantalk.org' => '188.40.14.173',
|
59 |
-
);
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
|
63 |
-
*
|
64 |
-
* @param array $ip_types Type of IP you want to receive
|
65 |
-
* @param bool $v4_only
|
66 |
-
*
|
67 |
-
* @return array|mixed|null
|
68 |
-
*/
|
69 |
-
static public function ip__get($ip_types = array('real', 'remote_addr', 'x_forwarded_for', 'x_real_ip', 'cloud_flare'), $v4_only = true)
|
70 |
-
{
|
71 |
-
$ips = array_flip($ip_types); // Result array with IPs
|
72 |
-
$headers = apache_request_headers();
|
73 |
-
|
74 |
-
// REMOTE_ADDR
|
75 |
-
if(isset($ips['remote_addr'])){
|
76 |
-
$ip_type = self::ip__validate(
|
77 |
-
if($ip_type){
|
78 |
-
$ips['remote_addr'] = $ip_type == 'v6' ? self::ip__v6_normalize(
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
// X-Forwarded-For
|
83 |
-
if(isset($ips['x_forwarded_for'])){
|
84 |
-
if(isset($headers['X-Forwarded-For'])){
|
85 |
-
$tmp = explode(",", trim($headers['X-Forwarded-For']));
|
86 |
-
$tmp = trim($tmp[0]);
|
87 |
-
$ip_type = self::ip__validate($tmp);
|
88 |
-
if($ip_type){
|
89 |
-
$ips['x_forwarded_for'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
// X-Real-Ip
|
95 |
-
if(isset($ips['x_real_ip'])){
|
96 |
-
if(isset($headers['X-Real-Ip'])){
|
97 |
-
$tmp = explode(",", trim($headers['X-Real-Ip']));
|
98 |
-
$tmp = trim($tmp[0]);
|
99 |
-
$ip_type = self::ip__validate($tmp);
|
100 |
-
if($ip_type){
|
101 |
-
$ips['x_forwarded_for'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
// Cloud Flare
|
107 |
-
if(isset($ips['cloud_flare'])){
|
108 |
-
if(isset($headers['CF-Connecting-IP'], $headers['CF-IPCountry'], $headers['CF-RAY']) || isset($headers['Cf-Connecting-Ip'], $headers['Cf-Ipcountry'], $headers['Cf-Ray'])){
|
109 |
-
$tmp = isset($headers['CF-Connecting-IP']) ? $headers['CF-Connecting-IP'] : $headers['Cf-Connecting-Ip'];
|
110 |
-
$tmp = strpos($tmp, ',') !== false ? explode(',', $tmp) : (array)$tmp;
|
111 |
-
$ip_type = self::ip__validate(trim($tmp[0]));
|
112 |
-
if($ip_type){
|
113 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize(trim($tmp[0])) : trim($tmp[0]);
|
114 |
-
}
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
// Getting real IP from REMOTE_ADDR or Cf_Connecting_Ip if set or from (X-Forwarded-For, X-Real-Ip) if REMOTE_ADDR is local.
|
119 |
-
if(isset($ips['real'])){
|
120 |
-
|
121 |
-
// Detect IP type
|
122 |
-
$ip_type = self::ip__validate(
|
123 |
-
if($ip_type)
|
124 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize(
|
125 |
-
|
126 |
-
// Cloud Flare
|
127 |
-
if(isset($headers['CF-Connecting-IP'], $headers['CF-IPCountry'], $headers['CF-RAY']) || isset($headers['Cf-Connecting-Ip'], $headers['Cf-Ipcountry'], $headers['Cf-Ray'])){
|
128 |
-
$tmp = isset($headers['CF-Connecting-IP']) ? $headers['CF-Connecting-IP'] : $headers['Cf-Connecting-Ip'];
|
129 |
-
$tmp = strpos($tmp, ',') !== false ? explode(',', $tmp) : (array)$tmp;
|
130 |
-
$ip_type = self::ip__validate(trim($tmp[0]));
|
131 |
-
if($ip_type)
|
132 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize(trim($tmp[0])) : trim($tmp[0]);
|
133 |
-
|
134 |
-
// Sucury
|
135 |
-
}elseif(isset($headers['X-Sucuri-Clientip'], $headers['X-Sucuri-Country'])){
|
136 |
-
$ip_type = self::ip__validate($headers['X-Sucuri-Clientip']);
|
137 |
-
if($ip_type)
|
138 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($headers['X-Sucuri-Clientip']) : $headers['X-Sucuri-Clientip'];
|
139 |
-
|
140 |
-
// OVH
|
141 |
-
}elseif(isset($headers['X-Cdn-Any-Ip'], $headers['Remote-Ip'])){
|
142 |
-
$ip_type = self::ip__validate($headers['X-Cdn-Any-Ip']);
|
143 |
-
if($ip_type)
|
144 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($headers['X-Cdn-Any-Ip']) : $headers['X-Cdn-Any-Ip'];
|
145 |
-
|
146 |
-
// Incapsula proxy
|
147 |
-
}elseif(isset($headers['Incap-Client-Ip'])){
|
148 |
-
$ip_type = self::ip__validate($headers['Incap-Client-Ip']);
|
149 |
-
if($ip_type)
|
150 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($headers['Incap-Client-Ip']) : $headers['Incap-Client-Ip'];
|
151 |
-
}
|
152 |
-
|
153 |
-
// Is private network
|
154 |
-
if($ip_type === false || ($ip_type && (self::ip__is_private_network($ips['real'], $ip_type) || self::ip__mask_match($ips['real'], filter_input(INPUT_SERVER, 'SERVER_ADDR') . '/24', $ip_type)))){
|
155 |
-
|
156 |
-
// X-Forwarded-For
|
157 |
-
if(isset($headers['X-Forwarded-For'])){
|
158 |
-
$tmp = explode(',', trim($headers['X-Forwarded-For']));
|
159 |
-
$tmp = trim($tmp[0]);
|
160 |
-
$ip_type = self::ip__validate($tmp);
|
161 |
-
if($ip_type)
|
162 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
163 |
-
|
164 |
-
// X-Real-Ip
|
165 |
-
}elseif(isset($headers['X-Real-Ip'])){
|
166 |
-
$tmp = explode(',', trim($headers['X-Real-Ip']));
|
167 |
-
$tmp = trim($tmp[0]);
|
168 |
-
$ip_type = self::ip__validate($tmp);
|
169 |
-
if($ip_type)
|
170 |
-
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
// Validating IPs
|
176 |
-
$result = array();
|
177 |
-
foreach($ips as $key => $ip){
|
178 |
-
$ip_version = self::ip__validate($ip);
|
179 |
-
if($ip && (($v4_only && $ip_version == 'v4') || !$v4_only)){
|
180 |
-
$result[$key] = $ip;
|
181 |
-
}
|
182 |
-
}
|
183 |
-
|
184 |
-
$result = array_unique($result);
|
185 |
-
return count($result) > 1
|
186 |
-
? $result
|
187 |
-
: (reset($result) !== false
|
188 |
-
? reset($result)
|
189 |
-
: null);
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Checks if the IP is in private range
|
194 |
-
*
|
195 |
-
* @param string $ip
|
196 |
-
* @param string $ip_type
|
197 |
-
*
|
198 |
-
* @return bool
|
199 |
-
*/
|
200 |
-
static function ip__is_private_network($ip, $ip_type = 'v4')
|
201 |
-
{
|
202 |
-
return self::ip__mask_match($ip, self::$private_networks[$ip_type], $ip_type);
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Check if the IP belong to mask. Recursive.
|
207 |
-
* Octet by octet for IPv4
|
208 |
-
* Hextet by hextet for IPv6
|
209 |
-
*
|
210 |
-
* @param string $ip
|
211 |
-
* @param string $cidr work to compare with
|
212 |
-
* @param string $ip_type IPv6 or IPv4
|
213 |
-
* @param int $xtet_count Recursive counter. Determs current part of address to check.
|
214 |
-
*
|
215 |
-
* @return bool
|
216 |
-
*/
|
217 |
-
static public function ip__mask_match($ip, $cidr, $ip_type = 'v4', $xtet_count = 0)
|
218 |
-
{
|
219 |
-
if(is_array($cidr)){
|
220 |
-
foreach($cidr as $curr_mask){
|
221 |
-
if(self::ip__mask_match($ip, $curr_mask, $ip_type)){
|
222 |
-
return true;
|
223 |
-
}
|
224 |
-
}
|
225 |
-
unset($curr_mask);
|
226 |
-
return false;
|
227 |
-
}
|
228 |
-
|
229 |
-
$xtet_base = ($ip_type == 'v4') ? 8 : 16;
|
230 |
-
|
231 |
-
// Calculate mask
|
232 |
-
$exploded = explode('/', $cidr);
|
233 |
-
$net_ip = $exploded[0];
|
234 |
-
$mask = $exploded[1];
|
235 |
-
|
236 |
-
// Exit condition
|
237 |
-
$xtet_end = ceil($mask / $xtet_base);
|
238 |
-
if($xtet_count == $xtet_end)
|
239 |
-
return true;
|
240 |
-
|
241 |
-
// Lenght of bits for comparsion
|
242 |
-
$mask = $mask - $xtet_base * $xtet_count >= $xtet_base ? $xtet_base : $mask - $xtet_base * $xtet_count;
|
243 |
-
|
244 |
-
// Explode by octets/hextets from IP and Net
|
245 |
-
$net_ip_xtets = explode($ip_type == 'v4' ? '.' : ':', $net_ip);
|
246 |
-
$ip_xtets = explode($ip_type == 'v4' ? '.' : ':', $ip);
|
247 |
-
|
248 |
-
// Standartizing. Getting current octets/hextets. Adding leading zeros.
|
249 |
-
$net_xtet = str_pad(decbin($ip_type == 'v4' ? $net_ip_xtets[$xtet_count] : hexdec($net_ip_xtets[$xtet_count])), $xtet_base, 0, STR_PAD_LEFT);
|
250 |
-
$ip_xtet = str_pad(decbin($ip_type == 'v4' ? $ip_xtets[$xtet_count] : hexdec($ip_xtets[$xtet_count])), $xtet_base, 0, STR_PAD_LEFT);
|
251 |
-
|
252 |
-
// Comparing bit by bit
|
253 |
-
for($i = 0, $result = true; $mask != 0; $mask--, $i++){
|
254 |
-
if($ip_xtet[$i] != $net_xtet[$i]){
|
255 |
-
$result = false;
|
256 |
-
break;
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
// Recursing. Moving to next octet/hextet.
|
261 |
-
if($result)
|
262 |
-
$result = self::ip__mask_match($ip, $cidr, $ip_type, $xtet_count + 1);
|
263 |
-
|
264 |
-
return $result;
|
265 |
-
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Converts long mask like 4294967295 to number like 32
|
270 |
-
*
|
271 |
-
* @param int $long_mask
|
272 |
-
*
|
273 |
-
* @return int
|
274 |
-
*/
|
275 |
-
static function ip__mask__long_to_number($long_mask)
|
276 |
-
{
|
277 |
-
$num_mask = strpos((string)decbin($long_mask), '0');
|
278 |
-
return $num_mask === false ? 32 : $num_mask;
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* Validating IPv4, IPv6
|
283 |
-
*
|
284 |
-
* @param string $ip
|
285 |
-
*
|
286 |
-
* @return string|bool
|
287 |
-
*/
|
288 |
-
static public function ip__validate($ip)
|
289 |
-
{
|
290 |
-
if(!$ip) return false; // NULL || FALSE || '' || so on...
|
291 |
-
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && $ip != '0.0.0.0') return 'v4'; // IPv4
|
292 |
-
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && self::ip__v6_reduce($ip) != '0::0') return 'v6'; // IPv6
|
293 |
-
return false; // Unknown
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* Expand IPv6
|
298 |
-
*
|
299 |
-
* @param string $ip
|
300 |
-
*
|
301 |
-
* @return string IPv6
|
302 |
-
*/
|
303 |
-
static public function ip__v6_normalize($ip)
|
304 |
-
{
|
305 |
-
$ip = trim($ip);
|
306 |
-
// Searching for ::ffff:xx.xx.xx.xx patterns and turn it to IPv6
|
307 |
-
if(preg_match('/^::ffff:([0-9]{1,3}\.?){4}$/', $ip)){
|
308 |
-
$ip = dechex(sprintf("%u", ip2long(substr($ip, 7))));
|
309 |
-
$ip = '0:0:0:0:0:0:' . (strlen($ip) > 4 ? substr('abcde', 0, -4) : '0') . ':' . substr($ip, -4, 4);
|
310 |
-
// Normalizing hextets number
|
311 |
-
}elseif(strpos($ip, '::') !== false){
|
312 |
-
$ip = str_replace('::', str_repeat(':0', 8 - substr_count($ip, ':')) . ':', $ip);
|
313 |
-
$ip = strpos($ip, ':') === 0 ? '0' . $ip : $ip;
|
314 |
-
$ip = strpos(strrev($ip), ':') === 0 ? $ip . '0' : $ip;
|
315 |
-
}
|
316 |
-
// Simplifyng hextets
|
317 |
-
if(preg_match('/:0(?=[a-z0-9]+)/', $ip)){
|
318 |
-
$ip = preg_replace('/:0(?=[a-z0-9]+)/', ':', strtolower($ip));
|
319 |
-
$ip = self::ip__v6_normalize($ip);
|
320 |
-
}
|
321 |
-
return $ip;
|
322 |
-
}
|
323 |
-
|
324 |
-
/**
|
325 |
-
* Reduce IPv6
|
326 |
-
*
|
327 |
-
* @param string $ip
|
328 |
-
*
|
329 |
-
* @return string IPv6
|
330 |
-
*/
|
331 |
-
static public function ip__v6_reduce($ip)
|
332 |
-
{
|
333 |
-
if(strpos($ip, ':') !== false){
|
334 |
-
$ip = preg_replace('/:0{1,4}/', ':', $ip);
|
335 |
-
$ip = preg_replace('/:{2,}/', '::', $ip);
|
336 |
-
$ip = strpos($ip, '0') === 0 ? substr($ip, 1) : $ip;
|
337 |
-
}
|
338 |
-
return $ip;
|
339 |
-
}
|
340 |
-
|
341 |
-
/**
|
342 |
-
* Get URL form IP. Check if it's belong to cleantalk.
|
343 |
-
*
|
344 |
-
* @param string $ip
|
345 |
-
*
|
346 |
-
* @return false|int|string
|
347 |
-
*/
|
348 |
-
static public function ip__is_cleantalks($ip)
|
349 |
-
{
|
350 |
-
if(self::ip__validate($ip)){
|
351 |
-
$url = array_search($ip, self::$cleantalks_servers);
|
352 |
-
return $url
|
353 |
-
? true
|
354 |
-
: false;
|
355 |
-
}else
|
356 |
-
return false;
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Get URL form IP. Check if it's belong to cleantalk.
|
361 |
-
*
|
362 |
-
* @param $ip
|
363 |
-
*
|
364 |
-
* @return false|int|string
|
365 |
-
*/
|
366 |
-
static public function ip__resolve__cleantalks($ip)
|
367 |
-
{
|
368 |
-
if(self::ip__validate($ip)){
|
369 |
-
$url = array_search($ip, self::$cleantalks_servers);
|
370 |
-
return $url
|
371 |
-
? $url
|
372 |
-
: self::ip__resolve($ip);
|
373 |
-
}else
|
374 |
-
return $ip;
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Get URL form IP
|
379 |
-
*
|
380 |
-
* @param $ip
|
381 |
-
*
|
382 |
-
* @return string
|
383 |
-
*/
|
384 |
-
static public function ip__resolve($ip)
|
385 |
-
{
|
386 |
-
if(self::ip__validate($ip)){
|
387 |
-
$url = gethostbyaddr($ip);
|
388 |
-
if($url)
|
389 |
-
return $url;
|
390 |
-
}
|
391 |
-
return $ip;
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Resolve DNS to IP
|
396 |
-
*
|
397 |
-
* @param $host
|
398 |
-
* @param bool $out
|
399 |
-
*
|
400 |
-
* @return bool
|
401 |
-
*/
|
402 |
-
static public function dns__resolve($host, $out = false)
|
403 |
-
{
|
404 |
-
|
405 |
-
// Get DNS records about URL
|
406 |
-
if(function_exists('dns_get_record')){
|
407 |
-
$records = dns_get_record($host, DNS_A);
|
408 |
-
if($records !== false){
|
409 |
-
$out = $records[0]['ip'];
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
// Another try if first failed
|
414 |
-
if(!$out && function_exists('gethostbynamel')){
|
415 |
-
$records = gethostbynamel($host);
|
416 |
-
if($records !== false){
|
417 |
-
$out = $records[0];
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
return $out;
|
422 |
-
|
423 |
-
}
|
424 |
-
|
425 |
-
/**
|
426 |
-
* Function sends raw http request
|
427 |
-
*
|
428 |
-
* May use 4 presets(combining possible):
|
429 |
-
* get_code - getting only HTTP response code
|
430 |
-
* async - async requests
|
431 |
-
* get - GET-request
|
432 |
-
* ssl - use SSL
|
433 |
-
*
|
434 |
-
* @param string $url URL
|
435 |
-
* @param array $data POST|GET indexed array with data to send
|
436 |
-
* @param string|array $presets String or Array with presets: get_code, async, get, ssl, dont_split_to_array
|
437 |
-
* @param array $opts Optional option for CURL connection
|
438 |
-
*
|
439 |
-
* @return array|bool (array || array('error' => true))
|
440 |
-
*/
|
441 |
-
static public function http__request($url, $data = array(), $presets = null, $opts = array())
|
442 |
-
{
|
443 |
-
if(function_exists('curl_init')){
|
444 |
-
|
445 |
-
$ch = curl_init();
|
446 |
-
|
447 |
-
if(!empty($data)){
|
448 |
-
// If $data scalar converting it to array
|
449 |
-
$data = is_string($data) || is_int($data) ? array($data => 1) : $data;
|
450 |
-
// Build query
|
451 |
-
$opts[CURLOPT_POSTFIELDS] = $data;
|
452 |
-
}
|
453 |
-
|
454 |
-
// Merging OBLIGATORY options with GIVEN options
|
455 |
-
$opts = self::array_merge__save_numeric_keys(
|
456 |
-
array(
|
457 |
-
CURLOPT_URL => $url,
|
458 |
-
CURLOPT_RETURNTRANSFER => true,
|
459 |
-
CURLOPT_CONNECTTIMEOUT_MS => 3000,
|
460 |
-
CURLOPT_FORBID_REUSE => true,
|
461 |
-
CURLOPT_USERAGENT => self::AGENT . '; ' . (
|
462 |
-
CURLOPT_POST => true,
|
463 |
-
CURLOPT_SSL_VERIFYPEER => false,
|
464 |
-
CURLOPT_SSL_VERIFYHOST => 0,
|
465 |
-
CURLOPT_HTTPHEADER => array('Expect:'), // Fix for large data and old servers http://php.net/manual/ru/function.curl-setopt.php#82418
|
466 |
-
CURLOPT_FOLLOWLOCATION => true,
|
467 |
-
CURLOPT_MAXREDIRS => 5,
|
468 |
-
),
|
469 |
-
$opts
|
470 |
-
);
|
471 |
-
|
472 |
-
// Use presets
|
473 |
-
$presets = is_array($presets) ? $presets : explode(' ', $presets);
|
474 |
-
foreach($presets as $preset){
|
475 |
-
|
476 |
-
switch($preset){
|
477 |
-
|
478 |
-
// Do not follow redirects
|
479 |
-
case 'dont_follow_redirects':
|
480 |
-
$opts[CURLOPT_FOLLOWLOCATION] = false;
|
481 |
-
$opts[CURLOPT_MAXREDIRS] = 0;
|
482 |
-
break;
|
483 |
-
|
484 |
-
// Get headers only
|
485 |
-
case 'get_code':
|
486 |
-
$opts[CURLOPT_HEADER] = true;
|
487 |
-
$opts[CURLOPT_NOBODY] = true;
|
488 |
-
break;
|
489 |
-
|
490 |
-
// Make a request, don't wait for an answer
|
491 |
-
case 'async':
|
492 |
-
$opts[CURLOPT_CONNECTTIMEOUT_MS] = 1000;
|
493 |
-
$opts[CURLOPT_TIMEOUT_MS] = 500;
|
494 |
-
break;
|
495 |
-
|
496 |
-
case 'get':
|
497 |
-
$opts[CURLOPT_URL] .= $data ? '?' . str_replace("&", "&", http_build_query($data)) : '';
|
498 |
-
$opts[CURLOPT_POST] = false;
|
499 |
-
$opts[CURLOPT_POSTFIELDS] = null;
|
500 |
-
break;
|
501 |
-
|
502 |
-
case 'ssl':
|
503 |
-
$opts[CURLOPT_SSL_VERIFYPEER] = true;
|
504 |
-
$opts[CURLOPT_SSL_VERIFYHOST] = 2;
|
505 |
-
if(defined('CLEANTALK_CASERT_PATH') && CLEANTALK_CASERT_PATH)
|
506 |
-
$opts[CURLOPT_CAINFO] = CLEANTALK_CASERT_PATH;
|
507 |
-
break;
|
508 |
-
|
509 |
-
default:
|
510 |
-
|
511 |
-
break;
|
512 |
-
}
|
513 |
-
|
514 |
-
}
|
515 |
-
unset($preset);
|
516 |
-
|
517 |
-
curl_setopt_array($ch, $opts);
|
518 |
-
$result = curl_exec($ch);
|
519 |
-
|
520 |
-
// RETURN if async request
|
521 |
-
if(in_array('async', $presets))
|
522 |
-
return true;
|
523 |
-
|
524 |
-
if($result){
|
525 |
-
|
526 |
-
if(strpos($result, PHP_EOL) !== false && !in_array('dont_split_to_array', $presets))
|
527 |
-
$result = explode(PHP_EOL, $result);
|
528 |
-
|
529 |
-
// Get code crossPHP method
|
530 |
-
if(in_array('get_code', $presets)){
|
531 |
-
$curl_info = curl_getinfo($ch);
|
532 |
-
$result = $curl_info['http_code'];
|
533 |
-
}
|
534 |
-
curl_close($ch);
|
535 |
-
$out = $result;
|
536 |
-
}else
|
537 |
-
$out = array('error' => curl_error($ch));
|
538 |
-
}else
|
539 |
-
$out = array('error' => 'CURL_NOT_INSTALLED');
|
540 |
-
|
541 |
-
/**
|
542 |
-
* Getting HTTP-response code without cURL
|
543 |
-
*/
|
544 |
-
if($presets && ($presets == 'get_code' || (is_array($presets) && in_array('get_code', $presets)))
|
545 |
-
&& isset($out['error']) && $out['error'] == 'CURL_NOT_INSTALLED'
|
546 |
-
){
|
547 |
-
$headers = get_headers($url);
|
548 |
-
$out = (int)preg_replace('/.*(\d{3}).*/', '$1', $headers[0]);
|
549 |
-
}
|
550 |
-
|
551 |
-
return $out;
|
552 |
-
}
|
553 |
-
|
554 |
-
/**
|
555 |
-
* Merging arrays without reseting numeric keys
|
556 |
-
*
|
557 |
-
* @param array $arr1 One-dimentional array
|
558 |
-
* @param array $arr2 One-dimentional array
|
559 |
-
*
|
560 |
-
* @return array Merged array
|
561 |
-
*/
|
562 |
-
public static function array_merge__save_numeric_keys($arr1, $arr2)
|
563 |
-
{
|
564 |
-
foreach($arr2 as $key => $val){
|
565 |
-
$arr1[$key] = $val;
|
566 |
-
}
|
567 |
-
return $arr1;
|
568 |
-
}
|
569 |
-
|
570 |
-
/**
|
571 |
-
* Merging arrays without reseting numeric keys recursive
|
572 |
-
*
|
573 |
-
* @param array $arr1 One-dimentional array
|
574 |
-
* @param array $arr2 One-dimentional array
|
575 |
-
*
|
576 |
-
* @return array Merged array
|
577 |
-
*/
|
578 |
-
public static function array_merge__save_numeric_keys__recursive($arr1, $arr2)
|
579 |
-
{
|
580 |
-
foreach($arr2 as $key => $val){
|
581 |
-
|
582 |
-
// Array | array => array
|
583 |
-
if(isset($arr1[$key]) && is_array($arr1[$key]) && is_array($val)){
|
584 |
-
$arr1[$key] = self::array_merge__save_numeric_keys__recursive($arr1[$key], $val);
|
585 |
-
|
586 |
-
// Scalar | array => array
|
587 |
-
}elseif(isset($arr1[$key]) && !is_array($arr1[$key]) && is_array($val)){
|
588 |
-
$tmp = $arr1[$key] =
|
589 |
-
$arr1[$key] = $val;
|
590 |
-
$arr1[$key][] = $tmp;
|
591 |
-
|
592 |
-
// array | scalar => array
|
593 |
-
}elseif(isset($arr1[$key]) && is_array($arr1[$key]) && !is_array($val)){
|
594 |
-
$arr1[$key][] = $val;
|
595 |
-
|
596 |
-
// scalar | scalar => scalar
|
597 |
-
}else{
|
598 |
-
$arr1[$key] = $val;
|
599 |
-
}
|
600 |
-
}
|
601 |
-
return $arr1;
|
602 |
-
}
|
603 |
-
|
604 |
-
/**
|
605 |
-
* Function removing non UTF8 characters from array|string|object
|
606 |
-
*
|
607 |
-
* @param array|object|string $data
|
608 |
-
*
|
609 |
-
* @return array|object|string
|
610 |
-
*/
|
611 |
-
public static function removeNonUTF8($data)
|
612 |
-
{
|
613 |
-
// Array || object
|
614 |
-
if(is_array($data) || is_object($data)){
|
615 |
-
foreach($data as $key => &$val){
|
616 |
-
$val = self::removeNonUTF8($val);
|
617 |
-
}
|
618 |
-
unset($key, $val);
|
619 |
-
|
620 |
-
//String
|
621 |
-
}else{
|
622 |
-
if(!preg_match('//u', $data))
|
623 |
-
$data = 'Nulled. Not UTF8 encoded or malformed.';
|
624 |
-
}
|
625 |
-
return $data;
|
626 |
-
}
|
627 |
-
|
628 |
-
/**
|
629 |
-
* Function convert anything to UTF8 and removes non UTF8 characters
|
630 |
-
*
|
631 |
-
* @param array|object|string $obj
|
632 |
-
* @param string $data_codepage
|
633 |
-
*
|
634 |
-
* @return mixed(array|object|string)
|
635 |
-
*/
|
636 |
-
public static function toUTF8($obj, $data_codepage = null)
|
637 |
-
{
|
638 |
-
// Array || object
|
639 |
-
if(is_array($obj) || is_object($obj)){
|
640 |
-
foreach($obj as $key => &$val){
|
641 |
-
$val = self::toUTF8($val, $data_codepage);
|
642 |
-
}
|
643 |
-
unset($key, $val);
|
644 |
-
|
645 |
-
//String
|
646 |
-
}else{
|
647 |
-
if(!preg_match('//u', $obj) && function_exists('mb_detect_encoding') && function_exists('mb_convert_encoding')){
|
648 |
-
$encoding = mb_detect_encoding($obj);
|
649 |
-
$encoding = $encoding ? $encoding : $data_codepage;
|
650 |
-
if($encoding)
|
651 |
-
$obj = mb_convert_encoding($obj, 'UTF-8', $encoding);
|
652 |
-
}
|
653 |
-
}
|
654 |
-
return $obj;
|
655 |
-
}
|
656 |
-
|
657 |
-
/**
|
658 |
-
* Function convert from UTF8
|
659 |
-
*
|
660 |
-
* @param array|object|string $obj
|
661 |
-
* @param string $data_codepage
|
662 |
-
*
|
663 |
-
* @return mixed (array|object|string)
|
664 |
-
*/
|
665 |
-
public static function fromUTF8($obj, $data_codepage = null)
|
666 |
-
{
|
667 |
-
// Array || object
|
668 |
-
if(is_array($obj) || is_object($obj)){
|
669 |
-
foreach($obj as $key => &$val){
|
670 |
-
$val = self::fromUTF8($val, $data_codepage);
|
671 |
-
}
|
672 |
-
unset($key, $val);
|
673 |
-
|
674 |
-
//String
|
675 |
-
}else{
|
676 |
-
if(preg_match('u', $obj) && function_exists('mb_convert_encoding') && $data_codepage !== null)
|
677 |
-
$obj = mb_convert_encoding($obj, $data_codepage, 'UTF-8');
|
678 |
-
}
|
679 |
-
return $obj;
|
680 |
-
}
|
681 |
-
|
682 |
-
/**
|
683 |
-
* Checks if the string is JSON type
|
684 |
-
*
|
685 |
-
* @param string
|
686 |
-
*
|
687 |
-
* @return bool
|
688 |
-
*/
|
689 |
-
static public function is_json($string)
|
690 |
-
{
|
691 |
-
return is_string($string) && is_array(json_decode($string, true)) ? true : false;
|
692 |
-
}
|
693 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Cleantalk\Antispam;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* CleanTalk Helper class.
|
7 |
+
* Compatible with any CMS.
|
8 |
+
*
|
9 |
+
* @package PHP Antispam by CleanTalk
|
10 |
+
* @subpackage Helper
|
11 |
+
* @Version 3.2
|
12 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
13 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
14 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
15 |
+
* @see https://github.com/CleanTalk/php-antispam
|
16 |
+
*/
|
17 |
+
class Helper
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* Default user agent for HTTP requests
|
21 |
+
*/
|
22 |
+
const AGENT = 'Cleatalk-Helper/3.2';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var array Set of private networks IPv4 and IPv6
|
26 |
+
*/
|
27 |
+
public static $private_networks = array(
|
28 |
+
'v4' => array(
|
29 |
+
'10.0.0.0/8',
|
30 |
+
'100.64.0.0/10',
|
31 |
+
'172.16.0.0/12',
|
32 |
+
'192.168.0.0/16',
|
33 |
+
'127.0.0.1/32',
|
34 |
+
),
|
35 |
+
'v6' => array(
|
36 |
+
'0:0:0:0:0:0:0:1/128', // localhost
|
37 |
+
'0:0:0:0:0:0:a:1/128', // ::ffff:127.0.0.1
|
38 |
+
),
|
39 |
+
);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var array Set of CleanTalk servers
|
43 |
+
*/
|
44 |
+
public static $cleantalks_servers = array(
|
45 |
+
// MODERATE
|
46 |
+
'moderate1.cleantalk.org' => '162.243.144.175',
|
47 |
+
'moderate2.cleantalk.org' => '159.203.121.181',
|
48 |
+
'moderate3.cleantalk.org' => '88.198.153.60',
|
49 |
+
'moderate4.cleantalk.org' => '159.69.51.30',
|
50 |
+
'moderate5.cleantalk.org' => '95.216.200.119',
|
51 |
+
'moderate6.cleantalk.org' => '138.68.234.8',
|
52 |
+
// APIX
|
53 |
+
'apix1.cleantalk.org' => '35.158.52.161',
|
54 |
+
'apix2.cleantalk.org' => '18.206.49.217',
|
55 |
+
'apix3.cleantalk.org' => '3.18.23.246',
|
56 |
+
//ns
|
57 |
+
'netserv2.cleantalk.org' => '178.63.60.214',
|
58 |
+
'netserv3.cleantalk.org' => '188.40.14.173',
|
59 |
+
);
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
|
63 |
+
*
|
64 |
+
* @param array $ip_types Type of IP you want to receive
|
65 |
+
* @param bool $v4_only
|
66 |
+
*
|
67 |
+
* @return array|mixed|null
|
68 |
+
*/
|
69 |
+
static public function ip__get($ip_types = array('real', 'remote_addr', 'x_forwarded_for', 'x_real_ip', 'cloud_flare'), $v4_only = true)
|
70 |
+
{
|
71 |
+
$ips = array_flip($ip_types); // Result array with IPs
|
72 |
+
$headers = apache_request_headers();
|
73 |
+
|
74 |
+
// REMOTE_ADDR
|
75 |
+
if(isset($ips['remote_addr'])){
|
76 |
+
$ip_type = self::ip__validate(filter_input(INPUT_SERVER, 'REMOTE_ADDR'));
|
77 |
+
if($ip_type){
|
78 |
+
$ips['remote_addr'] = $ip_type == 'v6' ? self::ip__v6_normalize(filter_input(INPUT_SERVER, 'REMOTE_ADDR')) : filter_input(INPUT_SERVER, 'REMOTE_ADDR');
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
// X-Forwarded-For
|
83 |
+
if(isset($ips['x_forwarded_for'])){
|
84 |
+
if(isset($headers['X-Forwarded-For'])){
|
85 |
+
$tmp = explode(",", trim($headers['X-Forwarded-For']));
|
86 |
+
$tmp = trim($tmp[0]);
|
87 |
+
$ip_type = self::ip__validate($tmp);
|
88 |
+
if($ip_type){
|
89 |
+
$ips['x_forwarded_for'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
// X-Real-Ip
|
95 |
+
if(isset($ips['x_real_ip'])){
|
96 |
+
if(isset($headers['X-Real-Ip'])){
|
97 |
+
$tmp = explode(",", trim($headers['X-Real-Ip']));
|
98 |
+
$tmp = trim($tmp[0]);
|
99 |
+
$ip_type = self::ip__validate($tmp);
|
100 |
+
if($ip_type){
|
101 |
+
$ips['x_forwarded_for'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
// Cloud Flare
|
107 |
+
if(isset($ips['cloud_flare'])){
|
108 |
+
if(isset($headers['CF-Connecting-IP'], $headers['CF-IPCountry'], $headers['CF-RAY']) || isset($headers['Cf-Connecting-Ip'], $headers['Cf-Ipcountry'], $headers['Cf-Ray'])){
|
109 |
+
$tmp = isset($headers['CF-Connecting-IP']) ? $headers['CF-Connecting-IP'] : $headers['Cf-Connecting-Ip'];
|
110 |
+
$tmp = strpos($tmp, ',') !== false ? explode(',', $tmp) : (array)$tmp;
|
111 |
+
$ip_type = self::ip__validate(trim($tmp[0]));
|
112 |
+
if($ip_type){
|
113 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize(trim($tmp[0])) : trim($tmp[0]);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
// Getting real IP from REMOTE_ADDR or Cf_Connecting_Ip if set or from (X-Forwarded-For, X-Real-Ip) if REMOTE_ADDR is local.
|
119 |
+
if(isset($ips['real'])){
|
120 |
+
|
121 |
+
// Detect IP type
|
122 |
+
$ip_type = self::ip__validate(filter_input(INPUT_SERVER, 'REMOTE_ADDR'));
|
123 |
+
if($ip_type)
|
124 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize(filter_input(INPUT_SERVER, 'REMOTE_ADDR')) : filter_input(INPUT_SERVER, 'REMOTE_ADDR');
|
125 |
+
|
126 |
+
// Cloud Flare
|
127 |
+
if(isset($headers['CF-Connecting-IP'], $headers['CF-IPCountry'], $headers['CF-RAY']) || isset($headers['Cf-Connecting-Ip'], $headers['Cf-Ipcountry'], $headers['Cf-Ray'])){
|
128 |
+
$tmp = isset($headers['CF-Connecting-IP']) ? $headers['CF-Connecting-IP'] : $headers['Cf-Connecting-Ip'];
|
129 |
+
$tmp = strpos($tmp, ',') !== false ? explode(',', $tmp) : (array)$tmp;
|
130 |
+
$ip_type = self::ip__validate(trim($tmp[0]));
|
131 |
+
if($ip_type)
|
132 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize(trim($tmp[0])) : trim($tmp[0]);
|
133 |
+
|
134 |
+
// Sucury
|
135 |
+
}elseif(isset($headers['X-Sucuri-Clientip'], $headers['X-Sucuri-Country'])){
|
136 |
+
$ip_type = self::ip__validate($headers['X-Sucuri-Clientip']);
|
137 |
+
if($ip_type)
|
138 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($headers['X-Sucuri-Clientip']) : $headers['X-Sucuri-Clientip'];
|
139 |
+
|
140 |
+
// OVH
|
141 |
+
}elseif(isset($headers['X-Cdn-Any-Ip'], $headers['Remote-Ip'])){
|
142 |
+
$ip_type = self::ip__validate($headers['X-Cdn-Any-Ip']);
|
143 |
+
if($ip_type)
|
144 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($headers['X-Cdn-Any-Ip']) : $headers['X-Cdn-Any-Ip'];
|
145 |
+
|
146 |
+
// Incapsula proxy
|
147 |
+
}elseif(isset($headers['Incap-Client-Ip'])){
|
148 |
+
$ip_type = self::ip__validate($headers['Incap-Client-Ip']);
|
149 |
+
if($ip_type)
|
150 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($headers['Incap-Client-Ip']) : $headers['Incap-Client-Ip'];
|
151 |
+
}
|
152 |
+
|
153 |
+
// Is private network
|
154 |
+
if($ip_type === false || ($ip_type && (self::ip__is_private_network($ips['real'], $ip_type) || self::ip__mask_match($ips['real'], filter_input(INPUT_SERVER, 'SERVER_ADDR') . '/24', $ip_type)))){
|
155 |
+
|
156 |
+
// X-Forwarded-For
|
157 |
+
if(isset($headers['X-Forwarded-For'])){
|
158 |
+
$tmp = explode(',', trim($headers['X-Forwarded-For']));
|
159 |
+
$tmp = trim($tmp[0]);
|
160 |
+
$ip_type = self::ip__validate($tmp);
|
161 |
+
if($ip_type)
|
162 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
163 |
+
|
164 |
+
// X-Real-Ip
|
165 |
+
}elseif(isset($headers['X-Real-Ip'])){
|
166 |
+
$tmp = explode(',', trim($headers['X-Real-Ip']));
|
167 |
+
$tmp = trim($tmp[0]);
|
168 |
+
$ip_type = self::ip__validate($tmp);
|
169 |
+
if($ip_type)
|
170 |
+
$ips['real'] = $ip_type == 'v6' ? self::ip__v6_normalize($tmp) : $tmp;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
// Validating IPs
|
176 |
+
$result = array();
|
177 |
+
foreach($ips as $key => $ip){
|
178 |
+
$ip_version = self::ip__validate($ip);
|
179 |
+
if($ip && (($v4_only && $ip_version == 'v4') || !$v4_only)){
|
180 |
+
$result[$key] = $ip;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
$result = array_unique($result);
|
185 |
+
return count($result) > 1
|
186 |
+
? $result
|
187 |
+
: (reset($result) !== false
|
188 |
+
? reset($result)
|
189 |
+
: null);
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Checks if the IP is in private range
|
194 |
+
*
|
195 |
+
* @param string $ip
|
196 |
+
* @param string $ip_type
|
197 |
+
*
|
198 |
+
* @return bool
|
199 |
+
*/
|
200 |
+
static function ip__is_private_network($ip, $ip_type = 'v4')
|
201 |
+
{
|
202 |
+
return self::ip__mask_match($ip, self::$private_networks[$ip_type], $ip_type);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Check if the IP belong to mask. Recursive.
|
207 |
+
* Octet by octet for IPv4
|
208 |
+
* Hextet by hextet for IPv6
|
209 |
+
*
|
210 |
+
* @param string $ip
|
211 |
+
* @param string $cidr work to compare with
|
212 |
+
* @param string $ip_type IPv6 or IPv4
|
213 |
+
* @param int $xtet_count Recursive counter. Determs current part of address to check.
|
214 |
+
*
|
215 |
+
* @return bool
|
216 |
+
*/
|
217 |
+
static public function ip__mask_match($ip, $cidr, $ip_type = 'v4', $xtet_count = 0)
|
218 |
+
{
|
219 |
+
if(is_array($cidr)){
|
220 |
+
foreach($cidr as $curr_mask){
|
221 |
+
if(self::ip__mask_match($ip, $curr_mask, $ip_type)){
|
222 |
+
return true;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
unset($curr_mask);
|
226 |
+
return false;
|
227 |
+
}
|
228 |
+
|
229 |
+
$xtet_base = ($ip_type == 'v4') ? 8 : 16;
|
230 |
+
|
231 |
+
// Calculate mask
|
232 |
+
$exploded = explode('/', $cidr);
|
233 |
+
$net_ip = $exploded[0];
|
234 |
+
$mask = $exploded[1];
|
235 |
+
|
236 |
+
// Exit condition
|
237 |
+
$xtet_end = ceil($mask / $xtet_base);
|
238 |
+
if($xtet_count == $xtet_end)
|
239 |
+
return true;
|
240 |
+
|
241 |
+
// Lenght of bits for comparsion
|
242 |
+
$mask = $mask - $xtet_base * $xtet_count >= $xtet_base ? $xtet_base : $mask - $xtet_base * $xtet_count;
|
243 |
+
|
244 |
+
// Explode by octets/hextets from IP and Net
|
245 |
+
$net_ip_xtets = explode($ip_type == 'v4' ? '.' : ':', $net_ip);
|
246 |
+
$ip_xtets = explode($ip_type == 'v4' ? '.' : ':', $ip);
|
247 |
+
|
248 |
+
// Standartizing. Getting current octets/hextets. Adding leading zeros.
|
249 |
+
$net_xtet = str_pad(decbin($ip_type == 'v4' ? $net_ip_xtets[$xtet_count] : hexdec($net_ip_xtets[$xtet_count])), $xtet_base, 0, STR_PAD_LEFT);
|
250 |
+
$ip_xtet = str_pad(decbin($ip_type == 'v4' ? $ip_xtets[$xtet_count] : hexdec($ip_xtets[$xtet_count])), $xtet_base, 0, STR_PAD_LEFT);
|
251 |
+
|
252 |
+
// Comparing bit by bit
|
253 |
+
for($i = 0, $result = true; $mask != 0; $mask--, $i++){
|
254 |
+
if($ip_xtet[$i] != $net_xtet[$i]){
|
255 |
+
$result = false;
|
256 |
+
break;
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
// Recursing. Moving to next octet/hextet.
|
261 |
+
if($result)
|
262 |
+
$result = self::ip__mask_match($ip, $cidr, $ip_type, $xtet_count + 1);
|
263 |
+
|
264 |
+
return $result;
|
265 |
+
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Converts long mask like 4294967295 to number like 32
|
270 |
+
*
|
271 |
+
* @param int $long_mask
|
272 |
+
*
|
273 |
+
* @return int
|
274 |
+
*/
|
275 |
+
static function ip__mask__long_to_number($long_mask)
|
276 |
+
{
|
277 |
+
$num_mask = strpos((string)decbin($long_mask), '0');
|
278 |
+
return $num_mask === false ? 32 : $num_mask;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Validating IPv4, IPv6
|
283 |
+
*
|
284 |
+
* @param string $ip
|
285 |
+
*
|
286 |
+
* @return string|bool
|
287 |
+
*/
|
288 |
+
static public function ip__validate($ip)
|
289 |
+
{
|
290 |
+
if(!$ip) return false; // NULL || FALSE || '' || so on...
|
291 |
+
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && $ip != '0.0.0.0') return 'v4'; // IPv4
|
292 |
+
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && self::ip__v6_reduce($ip) != '0::0') return 'v6'; // IPv6
|
293 |
+
return false; // Unknown
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Expand IPv6
|
298 |
+
*
|
299 |
+
* @param string $ip
|
300 |
+
*
|
301 |
+
* @return string IPv6
|
302 |
+
*/
|
303 |
+
static public function ip__v6_normalize($ip)
|
304 |
+
{
|
305 |
+
$ip = trim($ip);
|
306 |
+
// Searching for ::ffff:xx.xx.xx.xx patterns and turn it to IPv6
|
307 |
+
if(preg_match('/^::ffff:([0-9]{1,3}\.?){4}$/', $ip)){
|
308 |
+
$ip = dechex(sprintf("%u", ip2long(substr($ip, 7))));
|
309 |
+
$ip = '0:0:0:0:0:0:' . (strlen($ip) > 4 ? substr('abcde', 0, -4) : '0') . ':' . substr($ip, -4, 4);
|
310 |
+
// Normalizing hextets number
|
311 |
+
}elseif(strpos($ip, '::') !== false){
|
312 |
+
$ip = str_replace('::', str_repeat(':0', 8 - substr_count($ip, ':')) . ':', $ip);
|
313 |
+
$ip = strpos($ip, ':') === 0 ? '0' . $ip : $ip;
|
314 |
+
$ip = strpos(strrev($ip), ':') === 0 ? $ip . '0' : $ip;
|
315 |
+
}
|
316 |
+
// Simplifyng hextets
|
317 |
+
if(preg_match('/:0(?=[a-z0-9]+)/', $ip)){
|
318 |
+
$ip = preg_replace('/:0(?=[a-z0-9]+)/', ':', strtolower($ip));
|
319 |
+
$ip = self::ip__v6_normalize($ip);
|
320 |
+
}
|
321 |
+
return $ip;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Reduce IPv6
|
326 |
+
*
|
327 |
+
* @param string $ip
|
328 |
+
*
|
329 |
+
* @return string IPv6
|
330 |
+
*/
|
331 |
+
static public function ip__v6_reduce($ip)
|
332 |
+
{
|
333 |
+
if(strpos($ip, ':') !== false){
|
334 |
+
$ip = preg_replace('/:0{1,4}/', ':', $ip);
|
335 |
+
$ip = preg_replace('/:{2,}/', '::', $ip);
|
336 |
+
$ip = strpos($ip, '0') === 0 ? substr($ip, 1) : $ip;
|
337 |
+
}
|
338 |
+
return $ip;
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Get URL form IP. Check if it's belong to cleantalk.
|
343 |
+
*
|
344 |
+
* @param string $ip
|
345 |
+
*
|
346 |
+
* @return false|int|string
|
347 |
+
*/
|
348 |
+
static public function ip__is_cleantalks($ip)
|
349 |
+
{
|
350 |
+
if(self::ip__validate($ip)){
|
351 |
+
$url = array_search($ip, self::$cleantalks_servers);
|
352 |
+
return $url
|
353 |
+
? true
|
354 |
+
: false;
|
355 |
+
}else
|
356 |
+
return false;
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Get URL form IP. Check if it's belong to cleantalk.
|
361 |
+
*
|
362 |
+
* @param $ip
|
363 |
+
*
|
364 |
+
* @return false|int|string
|
365 |
+
*/
|
366 |
+
static public function ip__resolve__cleantalks($ip)
|
367 |
+
{
|
368 |
+
if(self::ip__validate($ip)){
|
369 |
+
$url = array_search($ip, self::$cleantalks_servers);
|
370 |
+
return $url
|
371 |
+
? $url
|
372 |
+
: self::ip__resolve($ip);
|
373 |
+
}else
|
374 |
+
return $ip;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Get URL form IP
|
379 |
+
*
|
380 |
+
* @param $ip
|
381 |
+
*
|
382 |
+
* @return string
|
383 |
+
*/
|
384 |
+
static public function ip__resolve($ip)
|
385 |
+
{
|
386 |
+
if(self::ip__validate($ip)){
|
387 |
+
$url = gethostbyaddr($ip);
|
388 |
+
if($url)
|
389 |
+
return $url;
|
390 |
+
}
|
391 |
+
return $ip;
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Resolve DNS to IP
|
396 |
+
*
|
397 |
+
* @param $host
|
398 |
+
* @param bool $out
|
399 |
+
*
|
400 |
+
* @return bool
|
401 |
+
*/
|
402 |
+
static public function dns__resolve($host, $out = false)
|
403 |
+
{
|
404 |
+
|
405 |
+
// Get DNS records about URL
|
406 |
+
if(function_exists('dns_get_record')){
|
407 |
+
$records = dns_get_record($host, DNS_A);
|
408 |
+
if($records !== false){
|
409 |
+
$out = $records[0]['ip'];
|
410 |
+
}
|
411 |
+
}
|
412 |
+
|
413 |
+
// Another try if first failed
|
414 |
+
if(!$out && function_exists('gethostbynamel')){
|
415 |
+
$records = gethostbynamel($host);
|
416 |
+
if($records !== false){
|
417 |
+
$out = $records[0];
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
return $out;
|
422 |
+
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Function sends raw http request
|
427 |
+
*
|
428 |
+
* May use 4 presets(combining possible):
|
429 |
+
* get_code - getting only HTTP response code
|
430 |
+
* async - async requests
|
431 |
+
* get - GET-request
|
432 |
+
* ssl - use SSL
|
433 |
+
*
|
434 |
+
* @param string $url URL
|
435 |
+
* @param array $data POST|GET indexed array with data to send
|
436 |
+
* @param string|array $presets String or Array with presets: get_code, async, get, ssl, dont_split_to_array
|
437 |
+
* @param array $opts Optional option for CURL connection
|
438 |
+
*
|
439 |
+
* @return array|bool (array || array('error' => true))
|
440 |
+
*/
|
441 |
+
static public function http__request($url, $data = array(), $presets = null, $opts = array())
|
442 |
+
{
|
443 |
+
if(function_exists('curl_init')){
|
444 |
+
|
445 |
+
$ch = curl_init();
|
446 |
+
|
447 |
+
if(!empty($data)){
|
448 |
+
// If $data scalar converting it to array
|
449 |
+
$data = is_string($data) || is_int($data) ? array($data => 1) : $data;
|
450 |
+
// Build query
|
451 |
+
$opts[CURLOPT_POSTFIELDS] = $data;
|
452 |
+
}
|
453 |
+
|
454 |
+
// Merging OBLIGATORY options with GIVEN options
|
455 |
+
$opts = self::array_merge__save_numeric_keys(
|
456 |
+
array(
|
457 |
+
CURLOPT_URL => $url,
|
458 |
+
CURLOPT_RETURNTRANSFER => true,
|
459 |
+
CURLOPT_CONNECTTIMEOUT_MS => 3000,
|
460 |
+
CURLOPT_FORBID_REUSE => true,
|
461 |
+
CURLOPT_USERAGENT => self::AGENT . '; ' . (filter_input(INPUT_SERVER, 'REMOTE_ADDR') ? filter_input(INPUT_SERVER, 'REMOTE_ADDR') : 'UNKNOWN_HOST'),
|
462 |
+
CURLOPT_POST => true,
|
463 |
+
CURLOPT_SSL_VERIFYPEER => false,
|
464 |
+
CURLOPT_SSL_VERIFYHOST => 0,
|
465 |
+
CURLOPT_HTTPHEADER => array('Expect:'), // Fix for large data and old servers http://php.net/manual/ru/function.curl-setopt.php#82418
|
466 |
+
CURLOPT_FOLLOWLOCATION => true,
|
467 |
+
CURLOPT_MAXREDIRS => 5,
|
468 |
+
),
|
469 |
+
$opts
|
470 |
+
);
|
471 |
+
|
472 |
+
// Use presets
|
473 |
+
$presets = is_array($presets) ? $presets : explode(' ', $presets);
|
474 |
+
foreach($presets as $preset){
|
475 |
+
|
476 |
+
switch($preset){
|
477 |
+
|
478 |
+
// Do not follow redirects
|
479 |
+
case 'dont_follow_redirects':
|
480 |
+
$opts[CURLOPT_FOLLOWLOCATION] = false;
|
481 |
+
$opts[CURLOPT_MAXREDIRS] = 0;
|
482 |
+
break;
|
483 |
+
|
484 |
+
// Get headers only
|
485 |
+
case 'get_code':
|
486 |
+
$opts[CURLOPT_HEADER] = true;
|
487 |
+
$opts[CURLOPT_NOBODY] = true;
|
488 |
+
break;
|
489 |
+
|
490 |
+
// Make a request, don't wait for an answer
|
491 |
+
case 'async':
|
492 |
+
$opts[CURLOPT_CONNECTTIMEOUT_MS] = 1000;
|
493 |
+
$opts[CURLOPT_TIMEOUT_MS] = 500;
|
494 |
+
break;
|
495 |
+
|
496 |
+
case 'get':
|
497 |
+
$opts[CURLOPT_URL] .= $data ? '?' . str_replace("&", "&", http_build_query($data)) : '';
|
498 |
+
$opts[CURLOPT_POST] = false;
|
499 |
+
$opts[CURLOPT_POSTFIELDS] = null;
|
500 |
+
break;
|
501 |
+
|
502 |
+
case 'ssl':
|
503 |
+
$opts[CURLOPT_SSL_VERIFYPEER] = true;
|
504 |
+
$opts[CURLOPT_SSL_VERIFYHOST] = 2;
|
505 |
+
if(defined('CLEANTALK_CASERT_PATH') && CLEANTALK_CASERT_PATH)
|
506 |
+
$opts[CURLOPT_CAINFO] = CLEANTALK_CASERT_PATH;
|
507 |
+
break;
|
508 |
+
|
509 |
+
default:
|
510 |
+
|
511 |
+
break;
|
512 |
+
}
|
513 |
+
|
514 |
+
}
|
515 |
+
unset($preset);
|
516 |
+
|
517 |
+
curl_setopt_array($ch, $opts);
|
518 |
+
$result = curl_exec($ch);
|
519 |
+
|
520 |
+
// RETURN if async request
|
521 |
+
if(in_array('async', $presets))
|
522 |
+
return true;
|
523 |
+
|
524 |
+
if($result){
|
525 |
+
|
526 |
+
if(strpos($result, PHP_EOL) !== false && !in_array('dont_split_to_array', $presets))
|
527 |
+
$result = explode(PHP_EOL, $result);
|
528 |
+
|
529 |
+
// Get code crossPHP method
|
530 |
+
if(in_array('get_code', $presets)){
|
531 |
+
$curl_info = curl_getinfo($ch);
|
532 |
+
$result = $curl_info['http_code'];
|
533 |
+
}
|
534 |
+
curl_close($ch);
|
535 |
+
$out = $result;
|
536 |
+
}else
|
537 |
+
$out = array('error' => curl_error($ch));
|
538 |
+
}else
|
539 |
+
$out = array('error' => 'CURL_NOT_INSTALLED');
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Getting HTTP-response code without cURL
|
543 |
+
*/
|
544 |
+
if($presets && ($presets == 'get_code' || (is_array($presets) && in_array('get_code', $presets)))
|
545 |
+
&& isset($out['error']) && $out['error'] == 'CURL_NOT_INSTALLED'
|
546 |
+
){
|
547 |
+
$headers = get_headers($url);
|
548 |
+
$out = (int)preg_replace('/.*(\d{3}).*/', '$1', $headers[0]);
|
549 |
+
}
|
550 |
+
|
551 |
+
return $out;
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Merging arrays without reseting numeric keys
|
556 |
+
*
|
557 |
+
* @param array $arr1 One-dimentional array
|
558 |
+
* @param array $arr2 One-dimentional array
|
559 |
+
*
|
560 |
+
* @return array Merged array
|
561 |
+
*/
|
562 |
+
public static function array_merge__save_numeric_keys($arr1, $arr2)
|
563 |
+
{
|
564 |
+
foreach($arr2 as $key => $val){
|
565 |
+
$arr1[$key] = $val;
|
566 |
+
}
|
567 |
+
return $arr1;
|
568 |
+
}
|
569 |
+
|
570 |
+
/**
|
571 |
+
* Merging arrays without reseting numeric keys recursive
|
572 |
+
*
|
573 |
+
* @param array $arr1 One-dimentional array
|
574 |
+
* @param array $arr2 One-dimentional array
|
575 |
+
*
|
576 |
+
* @return array Merged array
|
577 |
+
*/
|
578 |
+
public static function array_merge__save_numeric_keys__recursive($arr1, $arr2)
|
579 |
+
{
|
580 |
+
foreach($arr2 as $key => $val){
|
581 |
+
|
582 |
+
// Array | array => array
|
583 |
+
if(isset($arr1[$key]) && is_array($arr1[$key]) && is_array($val)){
|
584 |
+
$arr1[$key] = self::array_merge__save_numeric_keys__recursive($arr1[$key], $val);
|
585 |
+
|
586 |
+
// Scalar | array => array
|
587 |
+
}elseif(isset($arr1[$key]) && !is_array($arr1[$key]) && is_array($val)){
|
588 |
+
$tmp = $arr1[$key] =
|
589 |
+
$arr1[$key] = $val;
|
590 |
+
$arr1[$key][] = $tmp;
|
591 |
+
|
592 |
+
// array | scalar => array
|
593 |
+
}elseif(isset($arr1[$key]) && is_array($arr1[$key]) && !is_array($val)){
|
594 |
+
$arr1[$key][] = $val;
|
595 |
+
|
596 |
+
// scalar | scalar => scalar
|
597 |
+
}else{
|
598 |
+
$arr1[$key] = $val;
|
599 |
+
}
|
600 |
+
}
|
601 |
+
return $arr1;
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Function removing non UTF8 characters from array|string|object
|
606 |
+
*
|
607 |
+
* @param array|object|string $data
|
608 |
+
*
|
609 |
+
* @return array|object|string
|
610 |
+
*/
|
611 |
+
public static function removeNonUTF8($data)
|
612 |
+
{
|
613 |
+
// Array || object
|
614 |
+
if(is_array($data) || is_object($data)){
|
615 |
+
foreach($data as $key => &$val){
|
616 |
+
$val = self::removeNonUTF8($val);
|
617 |
+
}
|
618 |
+
unset($key, $val);
|
619 |
+
|
620 |
+
//String
|
621 |
+
}else{
|
622 |
+
if(!preg_match('//u', $data))
|
623 |
+
$data = 'Nulled. Not UTF8 encoded or malformed.';
|
624 |
+
}
|
625 |
+
return $data;
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Function convert anything to UTF8 and removes non UTF8 characters
|
630 |
+
*
|
631 |
+
* @param array|object|string $obj
|
632 |
+
* @param string $data_codepage
|
633 |
+
*
|
634 |
+
* @return mixed(array|object|string)
|
635 |
+
*/
|
636 |
+
public static function toUTF8($obj, $data_codepage = null)
|
637 |
+
{
|
638 |
+
// Array || object
|
639 |
+
if(is_array($obj) || is_object($obj)){
|
640 |
+
foreach($obj as $key => &$val){
|
641 |
+
$val = self::toUTF8($val, $data_codepage);
|
642 |
+
}
|
643 |
+
unset($key, $val);
|
644 |
+
|
645 |
+
//String
|
646 |
+
}else{
|
647 |
+
if(!preg_match('//u', $obj) && function_exists('mb_detect_encoding') && function_exists('mb_convert_encoding')){
|
648 |
+
$encoding = mb_detect_encoding($obj);
|
649 |
+
$encoding = $encoding ? $encoding : $data_codepage;
|
650 |
+
if($encoding)
|
651 |
+
$obj = mb_convert_encoding($obj, 'UTF-8', $encoding);
|
652 |
+
}
|
653 |
+
}
|
654 |
+
return $obj;
|
655 |
+
}
|
656 |
+
|
657 |
+
/**
|
658 |
+
* Function convert from UTF8
|
659 |
+
*
|
660 |
+
* @param array|object|string $obj
|
661 |
+
* @param string $data_codepage
|
662 |
+
*
|
663 |
+
* @return mixed (array|object|string)
|
664 |
+
*/
|
665 |
+
public static function fromUTF8($obj, $data_codepage = null)
|
666 |
+
{
|
667 |
+
// Array || object
|
668 |
+
if(is_array($obj) || is_object($obj)){
|
669 |
+
foreach($obj as $key => &$val){
|
670 |
+
$val = self::fromUTF8($val, $data_codepage);
|
671 |
+
}
|
672 |
+
unset($key, $val);
|
673 |
+
|
674 |
+
//String
|
675 |
+
}else{
|
676 |
+
if(preg_match('u', $obj) && function_exists('mb_convert_encoding') && $data_codepage !== null)
|
677 |
+
$obj = mb_convert_encoding($obj, $data_codepage, 'UTF-8');
|
678 |
+
}
|
679 |
+
return $obj;
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Checks if the string is JSON type
|
684 |
+
*
|
685 |
+
* @param string
|
686 |
+
*
|
687 |
+
* @return bool
|
688 |
+
*/
|
689 |
+
static public function is_json($string)
|
690 |
+
{
|
691 |
+
return is_string($string) && is_array(json_decode($string, true)) ? true : false;
|
692 |
+
}
|
693 |
}
|
lib/CleantalkSFW.php
CHANGED
@@ -1,141 +1,141 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* CleanTalk SpamFireWall Wordpress class
|
5 |
-
* Compatible only with Wordpress.
|
6 |
-
*
|
7 |
-
* @depends Cleantalk\Antispam\SFW
|
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 Cleantalk\Antispam\SFW
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* CleantalkSFW_Base constructor.
|
19 |
-
* Creates Database driver instance.
|
20 |
-
*/
|
21 |
-
public function __construct()
|
22 |
-
{
|
23 |
-
|
24 |
-
// Creating database object. Depends on current CMS.
|
25 |
-
$this->db = CleantalkDB::getInstance();
|
26 |
-
|
27 |
-
// Use default tables if not specified
|
28 |
-
$this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
|
29 |
-
$this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
|
30 |
-
|
31 |
-
parent::__construct();
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Shows DIE page.
|
36 |
-
* Stops script executing.
|
37 |
-
*
|
38 |
-
* @param string $api_key
|
39 |
-
* @param string $cookie_prefix
|
40 |
-
* @param string $cookie_domain
|
41 |
-
* @param bool $test
|
42 |
-
*/
|
43 |
-
public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = '', $test = false){
|
44 |
-
|
45 |
-
global $apbct;
|
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 |
-
|
55 |
-
// Headers
|
56 |
-
if(headers_sent() === false){
|
57 |
-
header('Expires: '.date(DATE_RFC822, mktime(0, 0, 0, 1, 1, 1971)));
|
58 |
-
header('Cache-Control: no-store, no-cache, must-revalidate');
|
59 |
-
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
60 |
-
header('Pragma: no-cache');
|
61 |
-
header("HTTP/1.0 403 Forbidden");
|
62 |
-
}
|
63 |
-
|
64 |
-
// File exists?
|
65 |
-
if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
|
66 |
-
|
67 |
-
$sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
|
68 |
-
|
69 |
-
// Translation
|
70 |
-
$request_uri =
|
71 |
-
$sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', __('SpamFireWall is activated for your IP ', 'cleantalk'), $sfw_die_page);
|
72 |
-
$sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', __('To continue working with web site, please make sure that you have enabled JavaScript.', 'cleantalk'), $sfw_die_page);
|
73 |
-
$sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', __('Please click below to pass protection,', 'cleantalk'), $sfw_die_page);
|
74 |
-
$sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', sprintf(__('Or you will be automatically redirected to the requested page after %d seconds.', 'cleantalk'), 1), $sfw_die_page);
|
75 |
-
$sfw_die_page = str_replace('{CLEANTALK_TITLE}', __('Antispam by CleanTalk', 'cleantalk'), $sfw_die_page);
|
76 |
-
$sfw_die_page = str_replace('{TEST_TITLE}', ($this->test ? __('This is the testing page for SpamFireWall', 'cleantalk') : ''), $sfw_die_page);
|
77 |
-
|
78 |
-
if($this->test){
|
79 |
-
$sfw_die_page = str_replace('{REAL_IP__HEADER}', 'Real IP:', $sfw_die_page);
|
80 |
-
$sfw_die_page = str_replace('{TEST_IP__HEADER}', 'Test IP:', $sfw_die_page);
|
81 |
-
$sfw_die_page = str_replace('{TEST_IP}', $this->all_ips['sfw_test']['ip'], $sfw_die_page);
|
82 |
-
$sfw_die_page = str_replace('{REAL_IP}', $this->all_ips['real']['ip'], $sfw_die_page);
|
83 |
-
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', $this->all_ips['sfw_test']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
84 |
-
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', $this->all_ips['real']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
85 |
-
}else{
|
86 |
-
$sfw_die_page = str_replace('{REAL_IP__HEADER}', '', $sfw_die_page);
|
87 |
-
$sfw_die_page = str_replace('{TEST_IP__HEADER}', '', $sfw_die_page);
|
88 |
-
$sfw_die_page = str_replace('{TEST_IP}', '', $sfw_die_page);
|
89 |
-
$sfw_die_page = str_replace('{REAL_IP}', '', $sfw_die_page);
|
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
|
97 |
-
$sfw_die_page = str_replace('{REQUEST_URI}', $request_uri, $sfw_die_page);
|
98 |
-
$sfw_die_page = str_replace('{COOKIE_PREFIX}', $cookie_prefix, $sfw_die_page);
|
99 |
-
$sfw_die_page = str_replace('{COOKIE_DOMAIN}', $cookie_domain, $sfw_die_page);
|
100 |
-
$sfw_die_page = str_replace('{SERVICE_ID}', $apbct->data['service_id'], $sfw_die_page);
|
101 |
-
$sfw_die_page = str_replace('{HOST}',
|
102 |
-
|
103 |
-
$sfw_die_page = str_replace(
|
104 |
-
'{SFW_COOKIE}',
|
105 |
-
$this->test
|
106 |
-
? $this->all_ips['sfw_test']['ip']
|
107 |
-
: md5(current(end($this->blocked_ips)).$api_key),
|
108 |
-
$sfw_die_page
|
109 |
-
);
|
110 |
-
|
111 |
-
if($this->debug){
|
112 |
-
$debug = '<h1>IP and Networks</h1>'
|
113 |
-
. var_export($this->all_ips, true)
|
114 |
-
.'<h1>Blocked IPs</h1>'
|
115 |
-
. var_export($this->passed_ips, true)
|
116 |
-
.'<h1>Passed IPs</h1>'
|
117 |
-
. var_export($this->blocked_ips, true)
|
118 |
-
. '<h1>Headers</h1>'
|
119 |
-
. var_export(apache_request_headers(), true)
|
120 |
-
. '<h1>REMOTE_ADDR</h1>'
|
121 |
-
. var_export(
|
122 |
-
. '<h1>SERVER_ADDR</h1>'
|
123 |
-
. var_export(
|
124 |
-
. '<h1>IP_ARRAY</h1>'
|
125 |
-
. var_export($this->ip_array, true)
|
126 |
-
. '<h1>ADDITIONAL</h1>'
|
127 |
-
. var_export($this->debug_data, true);
|
128 |
-
}else
|
129 |
-
$debug = '';
|
130 |
-
|
131 |
-
$sfw_die_page = str_replace( "{DEBUG}", $debug, $sfw_die_page );
|
132 |
-
$sfw_die_page = str_replace('{GENERATED}', "<p>The page was generated at ".date("D, d M Y H:i:s")."</p>",$sfw_die_page);
|
133 |
-
|
134 |
-
wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
|
135 |
-
|
136 |
-
}else{
|
137 |
-
wp_die("IP BLACKLISTED", "Blacklisted", Array('response'=>403));
|
138 |
-
}
|
139 |
-
|
140 |
-
}
|
141 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* CleanTalk SpamFireWall Wordpress class
|
5 |
+
* Compatible only with Wordpress.
|
6 |
+
*
|
7 |
+
* @depends Cleantalk\Antispam\SFW
|
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 Cleantalk\Antispam\SFW
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* CleantalkSFW_Base constructor.
|
19 |
+
* Creates Database driver instance.
|
20 |
+
*/
|
21 |
+
public function __construct()
|
22 |
+
{
|
23 |
+
|
24 |
+
// Creating database object. Depends on current CMS.
|
25 |
+
$this->db = CleantalkDB::getInstance();
|
26 |
+
|
27 |
+
// Use default tables if not specified
|
28 |
+
$this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
|
29 |
+
$this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
|
30 |
+
|
31 |
+
parent::__construct();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Shows DIE page.
|
36 |
+
* Stops script executing.
|
37 |
+
*
|
38 |
+
* @param string $api_key
|
39 |
+
* @param string $cookie_prefix
|
40 |
+
* @param string $cookie_domain
|
41 |
+
* @param bool $test
|
42 |
+
*/
|
43 |
+
public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = '', $test = false){
|
44 |
+
|
45 |
+
global $apbct;
|
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 |
+
|
55 |
+
// Headers
|
56 |
+
if(headers_sent() === false){
|
57 |
+
header('Expires: '.date(DATE_RFC822, mktime(0, 0, 0, 1, 1, 1971)));
|
58 |
+
header('Cache-Control: no-store, no-cache, must-revalidate');
|
59 |
+
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
60 |
+
header('Pragma: no-cache');
|
61 |
+
header("HTTP/1.0 403 Forbidden");
|
62 |
+
}
|
63 |
+
|
64 |
+
// File exists?
|
65 |
+
if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
|
66 |
+
|
67 |
+
$sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
|
68 |
+
|
69 |
+
// Translation
|
70 |
+
$request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
|
71 |
+
$sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', __('SpamFireWall is activated for your IP ', 'cleantalk'), $sfw_die_page);
|
72 |
+
$sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', __('To continue working with web site, please make sure that you have enabled JavaScript.', 'cleantalk'), $sfw_die_page);
|
73 |
+
$sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', __('Please click below to pass protection,', 'cleantalk'), $sfw_die_page);
|
74 |
+
$sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', sprintf(__('Or you will be automatically redirected to the requested page after %d seconds.', 'cleantalk'), 1), $sfw_die_page);
|
75 |
+
$sfw_die_page = str_replace('{CLEANTALK_TITLE}', __('Antispam by CleanTalk', 'cleantalk'), $sfw_die_page);
|
76 |
+
$sfw_die_page = str_replace('{TEST_TITLE}', ($this->test ? __('This is the testing page for SpamFireWall', 'cleantalk') : ''), $sfw_die_page);
|
77 |
+
|
78 |
+
if($this->test){
|
79 |
+
$sfw_die_page = str_replace('{REAL_IP__HEADER}', 'Real IP:', $sfw_die_page);
|
80 |
+
$sfw_die_page = str_replace('{TEST_IP__HEADER}', 'Test IP:', $sfw_die_page);
|
81 |
+
$sfw_die_page = str_replace('{TEST_IP}', $this->all_ips['sfw_test']['ip'], $sfw_die_page);
|
82 |
+
$sfw_die_page = str_replace('{REAL_IP}', $this->all_ips['real']['ip'], $sfw_die_page);
|
83 |
+
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', $this->all_ips['sfw_test']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
84 |
+
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', $this->all_ips['real']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
85 |
+
}else{
|
86 |
+
$sfw_die_page = str_replace('{REAL_IP__HEADER}', '', $sfw_die_page);
|
87 |
+
$sfw_die_page = str_replace('{TEST_IP__HEADER}', '', $sfw_die_page);
|
88 |
+
$sfw_die_page = str_replace('{TEST_IP}', '', $sfw_die_page);
|
89 |
+
$sfw_die_page = str_replace('{REAL_IP}', '', $sfw_die_page);
|
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
|
97 |
+
$sfw_die_page = str_replace('{REQUEST_URI}', $request_uri, $sfw_die_page);
|
98 |
+
$sfw_die_page = str_replace('{COOKIE_PREFIX}', $cookie_prefix, $sfw_die_page);
|
99 |
+
$sfw_die_page = str_replace('{COOKIE_DOMAIN}', $cookie_domain, $sfw_die_page);
|
100 |
+
$sfw_die_page = str_replace('{SERVICE_ID}', $apbct->data['service_id'], $sfw_die_page);
|
101 |
+
$sfw_die_page = str_replace('{HOST}', filter_input(INPUT_SERVER, 'HTTP_HOST'), $sfw_die_page);
|
102 |
+
|
103 |
+
$sfw_die_page = str_replace(
|
104 |
+
'{SFW_COOKIE}',
|
105 |
+
$this->test
|
106 |
+
? $this->all_ips['sfw_test']['ip']
|
107 |
+
: md5(current(end($this->blocked_ips)).$api_key),
|
108 |
+
$sfw_die_page
|
109 |
+
);
|
110 |
+
|
111 |
+
if($this->debug){
|
112 |
+
$debug = '<h1>IP and Networks</h1>'
|
113 |
+
. var_export($this->all_ips, true)
|
114 |
+
.'<h1>Blocked IPs</h1>'
|
115 |
+
. var_export($this->passed_ips, true)
|
116 |
+
.'<h1>Passed IPs</h1>'
|
117 |
+
. var_export($this->blocked_ips, true)
|
118 |
+
. '<h1>Headers</h1>'
|
119 |
+
. var_export(apache_request_headers(), true)
|
120 |
+
. '<h1>REMOTE_ADDR</h1>'
|
121 |
+
. var_export(filter_input(INPUT_SERVER, 'REMOTE_ADDR'), true)
|
122 |
+
. '<h1>SERVER_ADDR</h1>'
|
123 |
+
. var_export(filter_input(INPUT_SERVER, 'REMOTE_ADDR'), true)
|
124 |
+
. '<h1>IP_ARRAY</h1>'
|
125 |
+
. var_export($this->ip_array, true)
|
126 |
+
. '<h1>ADDITIONAL</h1>'
|
127 |
+
. var_export($this->debug_data, true);
|
128 |
+
}else
|
129 |
+
$debug = '';
|
130 |
+
|
131 |
+
$sfw_die_page = str_replace( "{DEBUG}", $debug, $sfw_die_page );
|
132 |
+
$sfw_die_page = str_replace('{GENERATED}', "<p>The page was generated at ".date("D, d M Y H:i:s")."</p>",$sfw_die_page);
|
133 |
+
|
134 |
+
wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
|
135 |
+
|
136 |
+
}else{
|
137 |
+
wp_die("IP BLACKLISTED", "Blacklisted", Array('response'=>403));
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
141 |
+
}
|
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.
|
@@ -214,7 +214,7 @@ CleanTalk has an advanced option "Spam FireWall". This option allows you to bloc
|
|
214 |
|
215 |
= White Label Mode =
|
216 |
|
217 |
-
To switch the plugin work in the white-label mode you should set up a few settings on your main site in Wordpress Multisite Network:
|
218 |
|
219 |
1. Check setting "Enable White Label Mode".
|
220 |
2. Fill "Hoster API Key" field with key from CleanTalk's hoster panel.
|
@@ -566,6 +566,13 @@ If your website has forms that send data to external sources, you can enable opt
|
|
566 |
10. Website's options.
|
567 |
|
568 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
= 5.128.1 October 23 2019 =
|
570 |
* Fix: Fatal error when using buffer output.
|
571 |
* Fix: Translate domain for errors.
|
@@ -573,7 +580,7 @@ If your website has forms that send data to external sources, you can enable opt
|
|
573 |
* Fix: JS disabled error.
|
574 |
* Upd: Comment edit screen updated.
|
575 |
* Fix: Cleantalk\Arr::search() fixed.
|
576 |
-
|
577 |
= 5.128 October 17 2019 =
|
578 |
* Mod: Users check - functionality updated.
|
579 |
* Fix: Users check - dates format updated.
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 5.129
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
214 |
|
215 |
= White Label Mode =
|
216 |
|
217 |
+
To switch the plugin work in the white-label mode you should set up a few settings on your main site in Wordpress Multisite Network:
|
218 |
|
219 |
1. Check setting "Enable White Label Mode".
|
220 |
2. Fill "Hoster API Key" field with key from CleanTalk's hoster panel.
|
566 |
10. Website's options.
|
567 |
|
568 |
== Changelog ==
|
569 |
+
= 5.129 October 30 2019 =
|
570 |
+
* Upd: Localize updated.
|
571 |
+
* Fix: Direct $_SERVER access replaced.
|
572 |
+
* Integration: The 7 theme contact form.
|
573 |
+
* Fix: Minor improvements and bug fixes.
|
574 |
+
* Mod: Putting site in maintenance mode during plugin update.
|
575 |
+
|
576 |
= 5.128.1 October 23 2019 =
|
577 |
* Fix: Fatal error when using buffer output.
|
578 |
* Fix: Translate domain for errors.
|
580 |
* Fix: JS disabled error.
|
581 |
* Upd: Comment edit screen updated.
|
582 |
* Fix: Cleantalk\Arr::search() fixed.
|
583 |
+
|
584 |
= 5.128 October 17 2019 =
|
585 |
* Mod: Users check - functionality updated.
|
586 |
* Fix: Users check - dates format updated.
|