Version Description
Jun 18 2020 = * New: Add SFW status in plugin settings. * Fix: Remove sleep for sfw update. * Fix: Check account status only once in 86400 seconds. * Fix: Postmark avocet theme. * Fix: Find spam users - from-till implemented. * Upd: Add common.js. * Fix: Bookly admin action excluded. * Fix: sfw_pass_key cookie domain attribute removed. * Fix: SFW no cache meta tags added. * Fix: MEC Pro plugin compatibility fixed. * Mod: Catching SpamFireWall update errors. * Fix: UltimateBuilder skip fields. * Fix: Strip tags on comment.
Download this release
Release Info
Developer | glomberg |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.140 |
Comparing to | |
See all releases |
Code changes from version 5.139 to 5.140
- cleantalk.php +2034 -2027
- i18n/cleantalk-ru_RU.mo +0 -0
- i18n/cleantalk-ru_RU.po +1547 -1536
- i18n/cleantalk.pot +1426 -1388
- inc/cleantalk-admin.php +709 -700
- inc/cleantalk-ajax.php +775 -766
- inc/cleantalk-autoloader.php +21 -21
- inc/cleantalk-common.php +1009 -1006
- inc/cleantalk-find-spam.php +65 -65
- inc/cleantalk-pluggable.php +287 -287
- inc/cleantalk-public.php +3848 -3845
- inc/cleantalk-settings.php +1540 -1527
- inc/cleantalk-updater.php +517 -517
- inc/find-spam/ClassCleantalkFindSpamUsersChecker.php +628 -632
cleantalk.php
CHANGED
@@ -1,2027 +1,2034 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Anti-Spam by CleanTalk
|
4 |
-
Plugin URI: https://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: https://cleantalk.org
|
9 |
-
Text Domain: cleantalk
|
10 |
-
Domain Path: /i18n
|
11 |
-
*/
|
12 |
-
|
13 |
-
$cleantalk_executed = false;
|
14 |
-
|
15 |
-
// Getting version form main file (look above)
|
16 |
-
$plugin_info = get_file_data(__FILE__, array('Version' => 'Version', 'Name' => 'Plugin Name',));
|
17 |
-
|
18 |
-
// Common params
|
19 |
-
define('APBCT_NAME', $plugin_info['Name']);
|
20 |
-
define('APBCT_VERSION', $plugin_info['Version']);
|
21 |
-
define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP path. Plugin root folder without '/'.
|
22 |
-
define('APBCT_DIR_PATH', dirname(__FILE__ ) . '/'); //System path. Plugin root folder with '/'.
|
23 |
-
define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
|
24 |
-
define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt') ? ABSPATH . WPINC . '/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
|
25 |
-
|
26 |
-
// API params
|
27 |
-
define('APBCT_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
|
28 |
-
define('APBCT_MODERATE_URL', 'http://moderate.cleantalk.org'); //Api URL
|
29 |
-
|
30 |
-
// Option names
|
31 |
-
define('APBCT_DATA', 'cleantalk_data'); //Option name with different plugin data.
|
32 |
-
define('APBCT_SETTINGS', 'cleantalk_settings'); //Option name with plugin settings.
|
33 |
-
define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
|
34 |
-
define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
|
35 |
-
|
36 |
-
// Multisite
|
37 |
-
define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
|
38 |
-
|
39 |
-
// Sessions
|
40 |
-
define('APBCT_SEESION__LIVE_TIME', 86400*2);
|
41 |
-
define('APBCT_SEESION__CHANCE_TO_CLEAN', 100);
|
42 |
-
|
43 |
-
// Different params
|
44 |
-
define('APBCT_REMOTE_CALL_SLEEP', 5); // Minimum time between remote call
|
45 |
-
|
46 |
-
if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
47 |
-
|
48 |
-
define('CLEANTALK_PLUGIN_DIR', dirname(__FILE__ ) . '/');
|
49 |
-
|
50 |
-
// PHP functions patches
|
51 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
|
52 |
-
|
53 |
-
// Base classes
|
54 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/autoloader.php'); // Autoloader
|
55 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
|
56 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
|
57 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
|
58 |
-
include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/SFW.php'); // SpamFireWall
|
59 |
-
include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Arr.php'); // Array functions
|
60 |
-
|
61 |
-
// Child classes
|
62 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkAPI.php'); // API for Wordpress
|
63 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB.php'); // Database class for Wordpress
|
64 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkHelper.php'); // Helper for Worpdress
|
65 |
-
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php"); // SpamFireWall for Wordpress
|
66 |
-
|
67 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk.php'); // Main class for request
|
68 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkRequest.php'); // Holds request data
|
69 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkResponse.php'); // Holds response data
|
70 |
-
|
71 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkCron.php'); // Cron handling
|
72 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkState.php'); // State class
|
73 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-pluggable.php'); // Pluggable functions
|
74 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
|
75 |
-
|
76 |
-
// Global ArrayObject with settings and other global varables
|
77 |
-
global $apbct;
|
78 |
-
$apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors', 'remote_calls', 'stats'));
|
79 |
-
|
80 |
-
$apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
|
81 |
-
|
82 |
-
$apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
|
83 |
-
$apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
|
84 |
-
$apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
|
85 |
-
|
86 |
-
// Customize CleantalkState
|
87 |
-
// Account status
|
88 |
-
|
89 |
-
$apbct->white_label = $apbct->network_settings['white_label'];
|
90 |
-
$apbct->allow_custom_key = $apbct->network_settings['allow_custom_key'];
|
91 |
-
$apbct->plugin_name = $apbct->network_settings['white_label__plugin_name'] ? $apbct->network_settings['white_label__plugin_name'] : APBCT_NAME;
|
92 |
-
$apbct->api_key = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
|
93 |
-
$apbct->key_is_ok = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['key_is_ok'] : $apbct->network_data['key_is_ok'];
|
94 |
-
$apbct->moderate = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['moderate'] : $apbct->network_data['moderate'];
|
95 |
-
|
96 |
-
$apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
97 |
-
$apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
98 |
-
|
99 |
-
$apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
|
100 |
-
|
101 |
-
if(!$apbct->white_label){
|
102 |
-
require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
103 |
-
}
|
104 |
-
|
105 |
-
// Disabling comments
|
106 |
-
if($apbct->settings['disable_comments__all'] || $apbct->settings['disable_comments__posts'] || $apbct->settings['disable_comments__pages'] || $apbct->settings['disable_comments__media']){
|
107 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Templates/Singleton.php');
|
108 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/DisableComments.php');
|
109 |
-
\Cleantalk\DisableComments::getInstance();
|
110 |
-
}
|
111 |
-
|
112 |
-
// Passing JS key to frontend
|
113 |
-
add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
114 |
-
add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
115 |
-
|
116 |
-
// Database prefix
|
117 |
-
global $wpdb;
|
118 |
-
$apbct->db_prefix = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
|
119 |
-
$apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
|
120 |
-
// Database constants
|
121 |
-
define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
|
122 |
-
define('APBCT_TBL_FIREWALL_LOG', $apbct->db_prefix . 'cleantalk_sfw_logs'); // Table with firewall logs.
|
123 |
-
define('APBCT_TBL_SESSIONS', $apbct->db_prefix . 'cleantalk_sessions'); // Table with session data.
|
124 |
-
define('APBCT_SPAMSCAN_LOGS', $apbct->db_prefix . 'cleantalk_spamscan_logs'); // Table with session data.
|
125 |
-
define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs.
|
126 |
-
define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data.
|
127 |
-
|
128 |
-
/** @todo HARDCODE FIX */
|
129 |
-
if($apbct->plugin_version === '1.0.0')
|
130 |
-
$apbct->plugin_version = '5.100';
|
131 |
-
|
132 |
-
// Do update actions if version is changed
|
133 |
-
apbct_update_actions();
|
134 |
-
|
135 |
-
// Self cron
|
136 |
-
if(!defined('DOING_CRON') || (defined('DOING_CRON') && DOING_CRON !== true)){
|
137 |
-
|
138 |
-
$ct_cron = new CleantalkCron();
|
139 |
-
$ct_cron->checkTasks();
|
140 |
-
|
141 |
-
if(!empty($ct_cron->tasks_to_run)){
|
142 |
-
|
143 |
-
define('CT_CRON', true); // Letting know functions that they are running under CT_CRON
|
144 |
-
$ct_cron->runTasks();
|
145 |
-
unset($ct_cron);
|
146 |
-
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
//Delete cookie for admin trial notice
|
151 |
-
add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
|
152 |
-
|
153 |
-
// Set cookie only for public pages and for non-AJAX requests
|
154 |
-
if (!is_admin() && !apbct_is_ajax() && !defined('DOING_CRON')
|
155 |
-
&& empty($_POST['ct_checkjs_register_form']) // Buddy press registration fix
|
156 |
-
&& empty($_GET['ct_checkjs_search_default']) // Search form fix
|
157 |
-
&& empty($_POST['action']) //bbPress
|
158 |
-
){
|
159 |
-
add_action('template_redirect','apbct_cookie', 2);
|
160 |
-
add_action('template_redirect','apbct_store__urls', 2);
|
161 |
-
if (empty($_POST) && empty($_GET)){
|
162 |
-
apbct_cookie();
|
163 |
-
apbct_store__urls();
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
// Early checks
|
168 |
-
|
169 |
-
// Iphorm
|
170 |
-
if( isset( $_POST['iphorm_ajax'], $_POST['iphorm_id'], $_POST['iphorm_uid'] ) ){
|
171 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
172 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
173 |
-
ct_ajax_hook();
|
174 |
-
}
|
175 |
-
|
176 |
-
// Facebook
|
177 |
-
if ($apbct->settings['general_contact_forms_test'] == 1
|
178 |
-
&& (!empty($_POST['action']) && $_POST['action'] == 'fb_intialize')
|
179 |
-
&& !empty($_POST['FB_userdata'])
|
180 |
-
){
|
181 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
182 |
-
if (apbct_is_user_enable()){
|
183 |
-
$ct_check_post_result=false;
|
184 |
-
ct_registration_errors(null);
|
185 |
-
}
|
186 |
-
|
187 |
-
}
|
188 |
-
|
189 |
-
$apbct_active_integrations = array(
|
190 |
-
'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
|
191 |
-
'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
|
192 |
-
'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ),
|
193 |
-
'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false )
|
194 |
-
);
|
195 |
-
new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
|
196 |
-
|
197 |
-
// Ninja Forms. Making GET action to POST action
|
198 |
-
if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
|
199 |
-
$_POST['action']='ninja_forms_ajax_submit';
|
200 |
-
|
201 |
-
add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
202 |
-
add_action( 'wp_ajax_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
203 |
-
add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
204 |
-
add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
205 |
-
add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
|
206 |
-
|
207 |
-
// SeedProd Coming Soon Page Pro integration
|
208 |
-
add_action( 'wp_ajax_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
209 |
-
add_action( 'wp_ajax_nopriv_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
210 |
-
add_action( 'wp_ajax_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
211 |
-
add_action( 'wp_ajax_nopriv_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
212 |
-
|
213 |
-
// The 7 theme contact form integration
|
214 |
-
add_action( 'wp_ajax_nopriv_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
|
215 |
-
add_action( 'wp_ajax_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
|
216 |
-
|
217 |
-
// Elementor Pro page builder forms
|
218 |
-
add_action( 'wp_ajax_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
|
219 |
-
add_action( 'wp_ajax_nopriv_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
|
220 |
-
|
221 |
-
// Custom register form (ticket_id=13668)
|
222 |
-
add_action('website_neotrends_signup_fields_check',function( $username, $fields ){
|
223 |
-
$ip = CleantalkHelper::ip__get( array('real'), false );
|
224 |
-
$ct_result = ct_test_registration( $username, $fields['email'], $ip );
|
225 |
-
if( $ct_result['allow'] == 0 ) {
|
226 |
-
ct_die_extended( $ct_result['comment'] );
|
227 |
-
}
|
228 |
-
}, 1, 2);
|
229 |
-
|
230 |
-
// INEVIO theme integration
|
231 |
-
add_action( 'wp_ajax_contact_form_handler', 'apbct_form__inevio__testSpam', 1 );
|
232 |
-
add_action( 'wp_ajax_nopriv_contact_form_handler', 'apbct_form__inevio__testSpam', 1 );
|
233 |
-
|
234 |
-
// Public actions
|
235 |
-
if(!is_admin() && !apbct_is_ajax()){
|
236 |
-
|
237 |
-
// Default search
|
238 |
-
//add_filter( 'get_search_form', 'apbct_forms__search__addField' );
|
239 |
-
add_filter( 'get_search_query', 'apbct_forms__search__testSpam' );
|
240 |
-
add_action( 'wp_head', 'apbct_search_add_noindex', 1 );
|
241 |
-
|
242 |
-
// Remote calls
|
243 |
-
if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name']) && in_array($_GET['plugin_name'], array('antispam','anti-spam', 'apbct'))){
|
244 |
-
apbct_remote_call__perform();
|
245 |
-
}
|
246 |
-
|
247 |
-
// SpamFireWall check
|
248 |
-
if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
|
249 |
-
$apbct->settings['spam_firewall'] == 1 &&
|
250 |
-
apbct_is_get() &&
|
251 |
-
! apbct_wp_doing_cron()
|
252 |
-
){
|
253 |
-
apbct_sfw__check();
|
254 |
-
}
|
255 |
-
|
256 |
-
}
|
257 |
-
|
258 |
-
|
259 |
-
// Activation/deactivation functions must be in main plugin file.
|
260 |
-
// http://codex.wordpress.org/Function_Reference/register_activation_hook
|
261 |
-
register_activation_hook( __FILE__, 'apbct_activation' );
|
262 |
-
register_deactivation_hook( __FILE__, 'apbct_deactivation' );
|
263 |
-
|
264 |
-
// Hook for newly added blog
|
265 |
-
add_action('wpmu_new_blog', 'apbct_activation__new_blog', 10, 6);
|
266 |
-
|
267 |
-
// Async loading for JavaScript
|
268 |
-
add_filter('script_loader_tag', 'apbct_add_async_attribute', 10, 3);
|
269 |
-
|
270 |
-
// Redirect admin to plugin settings.
|
271 |
-
if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
|
272 |
-
add_action('admin_init', 'apbct_plugin_redirect');
|
273 |
-
|
274 |
-
// Deleting SFW tables when deleting websites
|
275 |
-
if(defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE === true)
|
276 |
-
add_action( 'delete_blog', 'apbct_sfw__delete_tables', 10, 2 );
|
277 |
-
|
278 |
-
// After plugin loaded - to load locale as described in manual
|
279 |
-
add_action('plugins_loaded', 'apbct_plugin_loaded' );
|
280 |
-
|
281 |
-
if( !empty($apbct->settings['use_ajax']) &&
|
282 |
-
! apbct_is_in_uri( '.xml' ) &&
|
283 |
-
! apbct_is_in_uri( '.xsl' ) )
|
284 |
-
{
|
285 |
-
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
286 |
-
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
287 |
-
}
|
288 |
-
|
289 |
-
// Admin panel actions
|
290 |
-
if (is_admin() || is_network_admin()){
|
291 |
-
|
292 |
-
require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-find-spam.php' );
|
293 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
|
294 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-settings.php');
|
295 |
-
|
296 |
-
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
|
297 |
-
|
298 |
-
add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
|
299 |
-
|
300 |
-
add_action('admin_init', 'apbct_admin__init', 1);
|
301 |
-
add_action('admin_menu', 'apbct_settings_add_page');
|
302 |
-
add_action('network_admin_menu', 'apbct_settings_add_page');
|
303 |
-
add_action('admin_notices', 'apbct_admin__notice_message');
|
304 |
-
add_action('network_admin_notices', 'apbct_admin__notice_message');
|
305 |
-
|
306 |
-
//Show widget only if not IP license
|
307 |
-
if(!$apbct->moderate_ip)
|
308 |
-
add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
|
309 |
-
}
|
310 |
-
|
311 |
-
if(apbct_is_ajax() || isset($_POST['cma-action'])){
|
312 |
-
|
313 |
-
$cleantalk_hooked_actions = array();
|
314 |
-
$cleantalk_ajax_actions_to_check = array();
|
315 |
-
|
316 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
317 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
318 |
-
|
319 |
-
// Feedback for comments
|
320 |
-
if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment'){
|
321 |
-
add_action( 'wp_ajax_nopriv_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
|
322 |
-
add_action( 'wp_ajax_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
|
323 |
-
}
|
324 |
-
if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_user'){
|
325 |
-
add_action( 'wp_ajax_nopriv_ct_feedback_user', 'apbct_user__send_feedback',1 );
|
326 |
-
add_action( 'wp_ajax_ct_feedback_user', 'apbct_user__send_feedback',1 );
|
327 |
-
}
|
328 |
-
|
329 |
-
// Check AJAX requests
|
330 |
-
// if User is not logged in
|
331 |
-
// if Unknown action or Known action with mandatory check
|
332 |
-
if( ( ! apbct_is_user_logged_in() || $apbct->settings['protect_logged_in'] == 1) &&
|
333 |
-
isset( $_POST['action'] ) &&
|
334 |
-
( ! in_array( $_POST['action'], $cleantalk_hooked_actions ) || in_array( $_POST['action'], $cleantalk_ajax_actions_to_check ) ) &&
|
335 |
-
! array_search( $_POST['action'], array_column( $apbct_active_integrations, 'hook' ) )
|
336 |
-
){
|
337 |
-
ct_ajax_hook();
|
338 |
-
}
|
339 |
-
|
340 |
-
//QAEngine Theme answers
|
341 |
-
if (intval($apbct->settings['general_contact_forms_test']))
|
342 |
-
add_filter('et_pre_insert_question', 'ct_ajax_hook', 1, 1); // Questions
|
343 |
-
add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
|
344 |
-
|
345 |
-
// Formidable
|
346 |
-
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
347 |
-
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
348 |
-
|
349 |
-
// Some of plugins to register a users use AJAX context.
|
350 |
-
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
351 |
-
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
352 |
-
add_action('user_register', 'apbct_user_register');
|
353 |
-
|
354 |
-
if(class_exists('BuddyPress')){
|
355 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
356 |
-
add_filter('bp_activity_is_spam_before_save', 'apbct_integration__buddyPres__activityWall', 999 ,2); /* ActivityWall */
|
357 |
-
add_action('bp_locate_template', 'apbct_integration__buddyPres__getTemplateName', 10, 6);
|
358 |
-
}
|
359 |
-
|
360 |
-
}
|
361 |
-
|
362 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
363 |
-
//Bitrix24 contact form
|
364 |
-
if ($apbct->settings['general_contact_forms_test'] == 1 &&
|
365 |
-
!empty($_POST['your-phone']) &&
|
366 |
-
!empty($_POST['your-email']) &&
|
367 |
-
!empty($_POST['your-message'])
|
368 |
-
){
|
369 |
-
$ct_check_post_result=false;
|
370 |
-
ct_contact_form_validate();
|
371 |
-
}
|
372 |
-
|
373 |
-
// Sends feedback to the cloud about comments
|
374 |
-
// add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
|
375 |
-
|
376 |
-
// Sends feedback to the cloud about deleted users
|
377 |
-
global $pagenow;
|
378 |
-
if($pagenow=='users.php')
|
379 |
-
add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
|
380 |
-
|
381 |
-
if( $pagenow=='plugins.php' || apbct_is_in_uri( 'plugins.php' ) ){
|
382 |
-
|
383 |
-
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
384 |
-
add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
385 |
-
|
386 |
-
add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
|
387 |
-
}
|
388 |
-
|
389 |
-
// Public pages actions
|
390 |
-
}else{
|
391 |
-
|
392 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
|
397 |
-
|
398 |
-
// Init action.
|
399 |
-
add_action('plugins_loaded', 'apbct_init', 1);
|
400 |
-
|
401 |
-
// Comments
|
402 |
-
add_filter('preprocess_comment', 'ct_preprocess_comment', 1, 1); // param - comment data array
|
403 |
-
add_filter('comment_text', 'ct_comment_text' );
|
404 |
-
add_filter('wp_die_handler', 'apbct_comment__sanitize_data__before_wp_die', 1); // Check comments after validation
|
405 |
-
|
406 |
-
// Registrations
|
407 |
-
if(!isset($_POST['wp-submit'])){
|
408 |
-
add_action('login_form_register', 'apbct_cookie');
|
409 |
-
add_action('login_form_register', 'apbct_store__urls');
|
410 |
-
}
|
411 |
-
add_action('login_enqueue_scripts', 'apbct_login__scripts');
|
412 |
-
add_action('register_form', 'ct_register_form');
|
413 |
-
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
414 |
-
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
415 |
-
add_action('user_register', 'apbct_user_register');
|
416 |
-
|
417 |
-
// Multisite registrations
|
418 |
-
add_action('signup_extra_fields','ct_register_form');
|
419 |
-
add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
|
420 |
-
|
421 |
-
// Login form - for notifications only
|
422 |
-
add_filter('login_message', 'ct_login_message');
|
423 |
-
|
424 |
-
// Comments output hook
|
425 |
-
add_filter('wp_list_comments_args', 'ct_wp_list_comments_args');
|
426 |
-
|
427 |
-
// Ait-Themes fix
|
428 |
-
if(isset($_GET['ait-action']) && $_GET['ait-action']=='register'){
|
429 |
-
$tmp=$_POST['redirect_to'];
|
430 |
-
unset($_POST['redirect_to']);
|
431 |
-
ct_contact_form_validate();
|
432 |
-
$_POST['redirect_to']=$tmp;
|
433 |
-
}
|
434 |
-
}
|
435 |
-
|
436 |
-
// Short code for GDPR
|
437 |
-
if($apbct->settings['gdpr_enabled'])
|
438 |
-
add_shortcode('cleantalk_gdpr_form', 'apbct_shrotcode_handler__GDPR_public_notice__form');
|
439 |
-
|
440 |
-
}
|
441 |
-
|
442 |
-
/**
|
443 |
-
* Function preforms remote call
|
444 |
-
*/
|
445 |
-
function apbct_remote_call__perform()
|
446 |
-
{
|
447 |
-
global $apbct;
|
448 |
-
|
449 |
-
$remote_action = $_GET['spbc_remote_call_action'];
|
450 |
-
|
451 |
-
if( isset( $apbct->remote_calls[$remote_action] ) ){
|
452 |
-
if(time() - $apbct->remote_calls[$remote_action]['last_call'] > APBCT_REMOTE_CALL_SLEEP || ($remote_action == 'sfw_update' && isset($_GET['file_urls']))) {
|
453 |
-
|
454 |
-
$apbct->remote_calls[$remote_action]['last_call'] = time();
|
455 |
-
$apbct->save('remote_calls');
|
456 |
-
|
457 |
-
if(strtolower($_GET['spbc_remote_call_token']) == strtolower(md5($apbct->api_key))){
|
458 |
-
|
459 |
-
// Flag to let plugin know that Remote Call is running.
|
460 |
-
$apbct->rc_running = true;
|
461 |
-
|
462 |
-
switch ($remote_action) {
|
463 |
-
|
464 |
-
// Close renew banner
|
465 |
-
case 'close_renew_banner':
|
466 |
-
$apbct->data['notice_trial'] = 0;
|
467 |
-
$apbct->data['notice_renew'] = 0;
|
468 |
-
$apbct->saveData();
|
469 |
-
CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
|
470 |
-
die('OK');
|
471 |
-
break;
|
472 |
-
|
473 |
-
// SFW update
|
474 |
-
case 'sfw_update':
|
475 |
-
$result = ct_sfw_update(true);
|
476 |
-
/**
|
477 |
-
* @todo CRUNCH
|
478 |
-
*/
|
479 |
-
if(is_string($result) && strpos($result, 'FAIL') !== false){
|
480 |
-
$result = json_decode(substr($result, 5), true);
|
481 |
-
}
|
482 |
-
die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
|
483 |
-
break;
|
484 |
-
|
485 |
-
// SFW send logs
|
486 |
-
case 'sfw_send_logs':
|
487 |
-
$result = ct_sfw_send_logs();
|
488 |
-
die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
|
489 |
-
break;
|
490 |
-
|
491 |
-
// Update plugin
|
492 |
-
case 'update_plugin':
|
493 |
-
add_action('wp', 'apbct_rc__update', 1);
|
494 |
-
break;
|
495 |
-
|
496 |
-
// Install plugin
|
497 |
-
case 'install_plugin':
|
498 |
-
add_action('wp', 'apbct_rc__install_plugin', 1);
|
499 |
-
break;
|
500 |
-
// Activate plugin
|
501 |
-
case 'activate_plugin':
|
502 |
-
$result = apbct_rc__activate_plugin($_GET['plugin']);
|
503 |
-
die(empty($result['error'])
|
504 |
-
? 'OK'
|
505 |
-
: 'FAIL '.json_encode(array('error' => $result['error'])));
|
506 |
-
break;
|
507 |
-
|
508 |
-
// Insert API key
|
509 |
-
case 'insert_auth_key':
|
510 |
-
$result = apbct_rc__insert_auth_key($_GET['auth_key'], $_GET['plugin']);
|
511 |
-
die(empty($result['error'])
|
512 |
-
? 'OK'
|
513 |
-
: 'FAIL '.json_encode(array('error' => $result['error'])));
|
514 |
-
break;
|
515 |
-
|
516 |
-
// Update settins
|
517 |
-
case 'update_settings':
|
518 |
-
$result = apbct_rc__update_settings($_GET);
|
519 |
-
die(empty($result['error'])
|
520 |
-
? 'OK'
|
521 |
-
: 'FAIL '.json_encode(array('error' => $result['error'])));
|
522 |
-
break;
|
523 |
-
// Deactivate plugin
|
524 |
-
case 'deactivate_plugin':
|
525 |
-
add_action('plugins_loaded', 'apbct_rc__deactivate_plugin', 1);
|
526 |
-
break;
|
527 |
-
|
528 |
-
// Uninstall plugin
|
529 |
-
case 'uninstall_plugin':
|
530 |
-
add_action('plugins_loaded', 'apbct_rc__uninstall_plugin', 1);
|
531 |
-
break;
|
532 |
-
// No action found
|
533 |
-
default:
|
534 |
-
die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION_2')));
|
535 |
-
break;
|
536 |
-
}
|
537 |
-
|
538 |
-
}else
|
539 |
-
die('FAIL '.json_encode(array('error' => 'WRONG_TOKEN')));
|
540 |
-
}else
|
541 |
-
die('FAIL '.json_encode(array('error' => 'TOO_MANY_ATTEMPTS')));
|
542 |
-
}else
|
543 |
-
die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION')));
|
544 |
-
}
|
545 |
-
|
546 |
-
/**
|
547 |
-
* Function for SpamFireWall check
|
548 |
-
*/
|
549 |
-
function apbct_sfw__check()
|
550 |
-
{
|
551 |
-
global $apbct, $spbc, $cleantalk_url_exclusions;
|
552 |
-
|
553 |
-
// Turn off the SpamFireWall if current url in the exceptions list and WordPress core pages
|
554 |
-
if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
|
555 |
-
$core_page_to_skip_check = array('/feed');
|
556 |
-
foreach (array_merge($cleantalk_url_exclusions, $core_page_to_skip_check) as $v) {
|
557 |
-
if ( apbct_is_in_uri( $v ) ) {
|
558 |
-
return;
|
559 |
-
}
|
560 |
-
}
|
561 |
-
}
|
562 |
-
|
563 |
-
// Turn off the SpamFireWall if Remote Call is in progress
|
564 |
-
if($apbct->rc_running || (!empty($spbc) && $spbc->rc_running))
|
565 |
-
return;
|
566 |
-
|
567 |
-
$is_sfw_check = true;
|
568 |
-
$sfw = new CleantalkSFW();
|
569 |
-
$sfw->ip_array = (array)$sfw->ip__get(array('real'), true);
|
570 |
-
|
571 |
-
// Skip by cookie
|
572 |
-
foreach($sfw->ip_array as $ct_cur_ip){
|
573 |
-
if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$apbct->api_key)){
|
574 |
-
$is_sfw_check=false;
|
575 |
-
if(isset($_COOKIE['ct_sfw_passed'])){
|
576 |
-
$sfw->logs__update($ct_cur_ip, 'passed');
|
577 |
-
$apbct->data['sfw_counter']['all']++;
|
578 |
-
$apbct->saveData();
|
579 |
-
if(!headers_sent())
|
580 |
-
\Cleantalk\Antispam\Helper::apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/',
|
581 |
-
}
|
582 |
-
break;
|
583 |
-
}else{
|
584 |
-
$is_sfw_check = true;
|
585 |
-
}
|
586 |
-
}
|
587 |
-
|
588 |
-
// Skip the check
|
589 |
-
if(!empty($_GET['access'])){
|
590 |
-
$spbc_settings = get_option('spbc_settings');
|
591 |
-
$spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
|
592 |
-
if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
|
593 |
-
$is_sfw_check = false;
|
594 |
-
\Cleantalk\Antispam\Helper::apbct_cookie__set('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/', '');
|
595 |
-
\Cleantalk\Antispam\Helper::apbct_cookie__set('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/',
|
596 |
-
}
|
597 |
-
unset($spbc_settings, $spbc_key);
|
598 |
-
}
|
599 |
-
|
600 |
-
if($is_sfw_check){
|
601 |
-
|
602 |
-
$sfw->ip_check();
|
603 |
-
|
604 |
-
// Pass remote calls
|
605 |
-
if($sfw->pass === false){
|
606 |
-
if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name'])){
|
607 |
-
foreach($sfw->blocked_ips as $ip){
|
608 |
-
$resolved = CleantalkHelper::ip__resolve($ip['ip']);
|
609 |
-
if($resolved && preg_match('/cleantalk\.org/', $resolved) === 1 || $resolved === 'back'){
|
610 |
-
$sfw->pass = true;
|
611 |
-
}
|
612 |
-
} unset($ip);
|
613 |
-
}
|
614 |
-
}
|
615 |
-
|
616 |
-
// if($sfw->test){
|
617 |
-
// $sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST), 'test');
|
618 |
-
// }
|
619 |
-
|
620 |
-
if($sfw->pass === false){
|
621 |
-
foreach($sfw->blocked_ips as $ip){
|
622 |
-
$sfw->logs__update($ip['ip'], 'blocked');
|
623 |
-
}
|
624 |
-
$apbct->data['sfw_counter']['blocked']++;
|
625 |
-
$apbct->saveData();
|
626 |
-
$sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST));
|
627 |
-
}else{
|
628 |
-
reset($sfw->passed_ips);
|
629 |
-
if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
|
630 |
-
\Cleantalk\Antispam\Helper::apbct_cookie__set( 'ct_sfw_pass_key', md5( $sfw->passed_ips[ key( $sfw->passed_ips ) ]['ip'] . $apbct->api_key ), time() + 86400 * 30, '/',
|
631 |
-
}
|
632 |
-
}
|
633 |
-
unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
|
634 |
-
}
|
635 |
-
|
636 |
-
/**
|
637 |
-
* On activation, set a time, frequency and name of an action hook to be scheduled.
|
638 |
-
*/
|
639 |
-
function apbct_activation( $network = false ) {
|
640 |
-
|
641 |
-
global $wpdb;
|
642 |
-
|
643 |
-
// SFW data
|
644 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
645 |
-
`network` int(11) unsigned NOT NULL,
|
646 |
-
`mask` int(11) unsigned NOT NULL,
|
647 |
-
`status` TINYINT(1) NOT NULL DEFAULT 0,
|
648 |
-
INDEX ( `network` , `mask` )
|
649 |
-
);';
|
650 |
-
|
651 |
-
// SFW log
|
652 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
653 |
-
`ip` VARCHAR(15) NOT NULL,
|
654 |
-
`all_entries` INT NOT NULL,
|
655 |
-
`blocked_entries` INT NOT NULL,
|
656 |
-
`entries_timestamp` INT NOT NULL,
|
657 |
-
PRIMARY KEY (`ip`));';
|
658 |
-
|
659 |
-
// Sessions
|
660 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
661 |
-
`id` VARCHAR(64) NOT NULL,
|
662 |
-
`name` VARCHAR(40) NOT NULL,
|
663 |
-
`value` TEXT NULL DEFAULT NULL,
|
664 |
-
`last_update` DATETIME NULL DEFAULT NULL,
|
665 |
-
PRIMARY KEY (`name`(40), `id`(64)));';
|
666 |
-
|
667 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
668 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
669 |
-
`scan_type` varchar(11) NOT NULL,
|
670 |
-
`start_time` datetime NOT NULL,
|
671 |
-
`finish_time` datetime NOT NULL,
|
672 |
-
`count_to_scan` int(11) DEFAULT NULL,
|
673 |
-
`found_spam` int(11) DEFAULT NULL,
|
674 |
-
`found_bad` int(11) DEFAULT NULL,
|
675 |
-
PRIMARY KEY (`id`));';
|
676 |
-
|
677 |
-
if($network && !defined('CLEANTALK_ACCESS_KEY')){
|
678 |
-
$initial_blog = get_current_blog_id();
|
679 |
-
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
680 |
-
foreach ($blogs as $blog) {
|
681 |
-
switch_to_blog($blog);
|
682 |
-
apbct_activation__create_tables($sqls);
|
683 |
-
// Cron tasks
|
684 |
-
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
685 |
-
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
686 |
-
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
687 |
-
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
|
688 |
-
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
689 |
-
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
690 |
-
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
691 |
-
}
|
692 |
-
switch_to_blog($initial_blog);
|
693 |
-
}else{
|
694 |
-
|
695 |
-
// Cron tasks
|
696 |
-
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
697 |
-
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
698 |
-
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
699 |
-
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
|
700 |
-
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
701 |
-
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
702 |
-
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
703 |
-
|
704 |
-
apbct_activation__create_tables($sqls);
|
705 |
-
ct_sfw_update(); // Updating SFW
|
706 |
-
ct_account_status_check(null, false);
|
707 |
-
}
|
708 |
-
|
709 |
-
// Additional options
|
710 |
-
add_option('ct_plugin_do_activation_redirect', true);
|
711 |
-
}
|
712 |
-
|
713 |
-
function apbct_activation__create_tables($sqls) {
|
714 |
-
global $wpdb;
|
715 |
-
$wpdb->show_errors = false;
|
716 |
-
foreach($sqls as $sql){
|
717 |
-
$sql = sprintf($sql, $wpdb->prefix); // Adding current blog prefix
|
718 |
-
$result = $wpdb->query($sql);
|
719 |
-
if($result === false)
|
720 |
-
$errors[] = "Failed.\nQuery: {$wpdb->last_query}\nError: {$wpdb->last_error}";
|
721 |
-
}
|
722 |
-
$wpdb->show_errors = true;
|
723 |
-
|
724 |
-
// Logging errors
|
725 |
-
if(!empty($errors))
|
726 |
-
apbct_log($errors);
|
727 |
-
}
|
728 |
-
|
729 |
-
function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
|
730 |
-
if (apbct_is_plugin_active_for_network('cleantalk-spam-protect/cleantalk.php')){
|
731 |
-
|
732 |
-
switch_to_blog($blog_id);
|
733 |
-
|
734 |
-
global $wpdb;
|
735 |
-
|
736 |
-
// SFW data
|
737 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
738 |
-
`network` int(11) unsigned NOT NULL,
|
739 |
-
`mask` int(11) unsigned NOT NULL,
|
740 |
-
INDEX ( `network` , `mask` )
|
741 |
-
);';
|
742 |
-
|
743 |
-
// SFW log
|
744 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
745 |
-
`ip` VARCHAR(15) NOT NULL,
|
746 |
-
`all_entries` INT NOT NULL,
|
747 |
-
`blocked_entries` INT NOT NULL,
|
748 |
-
`entries_timestamp` INT NOT NULL,
|
749 |
-
PRIMARY KEY (`ip`));';
|
750 |
-
|
751 |
-
// Sessions
|
752 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
753 |
-
`id` VARCHAR(64) NOT NULL,
|
754 |
-
`name` TEXT NOT NULL,
|
755 |
-
`value` TEXT NULL DEFAULT NULL,
|
756 |
-
`last_update` DATETIME NULL DEFAULT NULL,
|
757 |
-
PRIMARY KEY (`id`(64), `name`(64)));';
|
758 |
-
|
759 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
760 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
761 |
-
`scan_type` varchar(11) NOT NULL,
|
762 |
-
`start_time` datetime NOT NULL,
|
763 |
-
`finish_time` datetime NOT NULL,
|
764 |
-
`count_to_scan` int(11) DEFAULT NULL,
|
765 |
-
`found_spam` int(11) DEFAULT NULL,
|
766 |
-
`found_bad` int(11) DEFAULT NULL,
|
767 |
-
PRIMARY KEY (`id`));';
|
768 |
-
|
769 |
-
// Cron tasks
|
770 |
-
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
771 |
-
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
772 |
-
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
773 |
-
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
|
774 |
-
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
775 |
-
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
776 |
-
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
777 |
-
apbct_activation__create_tables($sqls);
|
778 |
-
ct_sfw_update(); // Updating SFW
|
779 |
-
ct_account_status_check(null, false);
|
780 |
-
restore_current_blog();
|
781 |
-
}
|
782 |
-
}
|
783 |
-
|
784 |
-
/**
|
785 |
-
* On deactivation, clear schedule.
|
786 |
-
*/
|
787 |
-
function apbct_deactivation( $network ) {
|
788 |
-
|
789 |
-
global $apbct, $wpdb;
|
790 |
-
|
791 |
-
// Deactivation for network
|
792 |
-
if(is_multisite() && $network){
|
793 |
-
|
794 |
-
$initial_blog = get_current_blog_id();
|
795 |
-
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
796 |
-
foreach ($blogs as $blog) {
|
797 |
-
switch_to_blog($blog);
|
798 |
-
apbct_deactivation__delete_blog_tables();
|
799 |
-
delete_option('cleantalk_cron'); // Deleting cron entries
|
800 |
-
|
801 |
-
if($apbct->settings['complete_deactivation']){
|
802 |
-
apbct_deactivation__delete_all_options();
|
803 |
-
apbct_deactivation__delete_meta();
|
804 |
-
apbct_deactivation__delete_all_options__in_network();
|
805 |
-
}
|
806 |
-
|
807 |
-
}
|
808 |
-
switch_to_blog($initial_blog);
|
809 |
-
|
810 |
-
// Deactivation for blog
|
811 |
-
}elseif(is_multisite()){
|
812 |
-
|
813 |
-
apbct_deactivation__delete_common_tables();
|
814 |
-
delete_option('cleantalk_cron'); // Deleting cron entries
|
815 |
-
|
816 |
-
if($apbct->settings['complete_deactivation']) {
|
817 |
-
apbct_deactivation__delete_all_options();
|
818 |
-
apbct_deactivation__delete_meta();
|
819 |
-
}
|
820 |
-
|
821 |
-
// Deactivation on standalone blog
|
822 |
-
}elseif(!is_multisite()){
|
823 |
-
|
824 |
-
apbct_deactivation__delete_common_tables();
|
825 |
-
delete_option('cleantalk_cron'); // Deleting cron entries
|
826 |
-
|
827 |
-
if($apbct->settings['complete_deactivation']) {
|
828 |
-
apbct_deactivation__delete_all_options();
|
829 |
-
apbct_deactivation__delete_meta();
|
830 |
-
}
|
831 |
-
|
832 |
-
}
|
833 |
-
}
|
834 |
-
|
835 |
-
/**
|
836 |
-
* Delete all cleantalk_* entries from _options table
|
837 |
-
*/
|
838 |
-
function apbct_deactivation__delete_all_options(){
|
839 |
-
delete_option('cleantalk_settings');
|
840 |
-
delete_option('cleantalk_data');
|
841 |
-
delete_option('cleantalk_cron');
|
842 |
-
delete_option('cleantalk_errors');
|
843 |
-
delete_option('cleantalk_remote_calls');
|
844 |
-
delete_option('cleantalk_server');
|
845 |
-
delete_option('cleantalk_stats');
|
846 |
-
delete_option('cleantalk_timelabel_reg');
|
847 |
-
delete_option('cleantalk_debug');
|
848 |
-
}
|
849 |
-
|
850 |
-
/**
|
851 |
-
* Delete all cleantalk_* entries from _sitemeta table
|
852 |
-
*/
|
853 |
-
function apbct_deactivation__delete_all_options__in_network(){
|
854 |
-
delete_site_option('cleantalk_network_settings');
|
855 |
-
delete_site_option('cleantalk_network_data');
|
856 |
-
}
|
857 |
-
|
858 |
-
function apbct_deactivation__delete_common_tables() {
|
859 |
-
global $wpdb;
|
860 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
861 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
862 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sessions`;'); // Deleting session table
|
863 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_spamscan_logs`;'); // Deleting user/comments scan result table
|
864 |
-
}
|
865 |
-
|
866 |
-
function apbct_deactivation__delete_blog_tables() {
|
867 |
-
global $wpdb;
|
868 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
869 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
870 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
871 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_spamscan_logs`;'); // Deleting user/comments scan result table
|
872 |
-
}
|
873 |
-
|
874 |
-
function apbct_deactivation__delete_meta(){
|
875 |
-
global $wpdb;
|
876 |
-
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_bad', 'ct_checked', 'ct_checked_now', 'ct_marked_as_spam', 'ct_hash');");
|
877 |
-
}
|
878 |
-
|
879 |
-
/**
|
880 |
-
* Redirects admin to plugin settings after activation.
|
881 |
-
*/
|
882 |
-
function apbct_plugin_redirect()
|
883 |
-
{
|
884 |
-
global $apbct;
|
885 |
-
if (get_option('ct_plugin_do_activation_redirect', false) && !isset($_GET['activate-multi'])){
|
886 |
-
delete_option('ct_plugin_do_activation_redirect');
|
887 |
-
wp_redirect($apbct->settings_link);
|
888 |
-
}
|
889 |
-
}
|
890 |
-
|
891 |
-
function ct_add_event($event_type)
|
892 |
-
{
|
893 |
-
global $apbct, $cleantalk_executed;
|
894 |
-
|
895 |
-
//
|
896 |
-
// To migrate on the new version of ct_add_event().
|
897 |
-
//
|
898 |
-
switch ($event_type) {
|
899 |
-
case '0': $event_type = 'no';break;
|
900 |
-
case '1': $event_type = 'yes';break;
|
901 |
-
}
|
902 |
-
|
903 |
-
$current_hour = intval(date('G'));
|
904 |
-
|
905 |
-
// Updating current hour
|
906 |
-
if($current_hour!=$apbct->data['current_hour']){
|
907 |
-
$apbct->data['current_hour'] = $current_hour;
|
908 |
-
$apbct->data['array_accepted'][$current_hour] = 0;
|
909 |
-
$apbct->data['array_blocked'][$current_hour] = 0;
|
910 |
-
}
|
911 |
-
|
912 |
-
//Add 1 to counters
|
913 |
-
if($event_type=='yes'){
|
914 |
-
$apbct->data['array_accepted'][$current_hour]++;
|
915 |
-
$apbct->data['all_time_counter']['accepted']++;
|
916 |
-
$apbct->data['user_counter']['accepted']++;
|
917 |
-
}
|
918 |
-
if($event_type=='no'){
|
919 |
-
$apbct->data['array_blocked'][$current_hour]++;
|
920 |
-
$apbct->data['all_time_counter']['blocked']++;
|
921 |
-
$apbct->data['user_counter']['blocked']++;
|
922 |
-
}
|
923 |
-
|
924 |
-
$apbct->saveData();
|
925 |
-
|
926 |
-
$cleantalk_executed=true;
|
927 |
-
}
|
928 |
-
|
929 |
-
/**
|
930 |
-
* return new cookie value
|
931 |
-
*/
|
932 |
-
function ct_get_cookie()
|
933 |
-
{
|
934 |
-
global $ct_checkjs_def;
|
935 |
-
$ct_checkjs_key = ct_get_checkjs_value();
|
936 |
-
print $ct_checkjs_key;
|
937 |
-
die();
|
938 |
-
}
|
939 |
-
|
940 |
-
function ct_sfw_update($immediate = false){
|
941 |
-
|
942 |
-
global $apbct;
|
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 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
$
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
if($
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
}
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
$
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
$
|
1394 |
-
$
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
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 |
-
$session_id, $name
|
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 |
-
|
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 |
-
? apbct_alt_session__get('
|
1671 |
-
: filter_input(INPUT_COOKIE, '
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
$cookie_test_value['
|
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 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
{
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
return
|
1753 |
-
}
|
1754 |
-
|
1755 |
-
|
1756 |
-
*
|
1757 |
-
*
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
$
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
$apbct->
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
$apbct->data['
|
1788 |
-
$apbct->data['
|
1789 |
-
$apbct->data['
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
$apbct->
|
1801 |
-
|
1802 |
-
$apbct->
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
$apbct->
|
1810 |
-
|
1811 |
-
}
|
1812 |
-
$apbct->
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Anti-Spam by CleanTalk
|
4 |
+
Plugin URI: https://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.140
|
7 |
+
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
+
Author URI: https://cleantalk.org
|
9 |
+
Text Domain: cleantalk
|
10 |
+
Domain Path: /i18n
|
11 |
+
*/
|
12 |
+
|
13 |
+
$cleantalk_executed = false;
|
14 |
+
|
15 |
+
// Getting version form main file (look above)
|
16 |
+
$plugin_info = get_file_data(__FILE__, array('Version' => 'Version', 'Name' => 'Plugin Name',));
|
17 |
+
|
18 |
+
// Common params
|
19 |
+
define('APBCT_NAME', $plugin_info['Name']);
|
20 |
+
define('APBCT_VERSION', $plugin_info['Version']);
|
21 |
+
define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP path. Plugin root folder without '/'.
|
22 |
+
define('APBCT_DIR_PATH', dirname(__FILE__ ) . '/'); //System path. Plugin root folder with '/'.
|
23 |
+
define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
|
24 |
+
define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt') ? ABSPATH . WPINC . '/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
|
25 |
+
|
26 |
+
// API params
|
27 |
+
define('APBCT_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
|
28 |
+
define('APBCT_MODERATE_URL', 'http://moderate.cleantalk.org'); //Api URL
|
29 |
+
|
30 |
+
// Option names
|
31 |
+
define('APBCT_DATA', 'cleantalk_data'); //Option name with different plugin data.
|
32 |
+
define('APBCT_SETTINGS', 'cleantalk_settings'); //Option name with plugin settings.
|
33 |
+
define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
|
34 |
+
define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
|
35 |
+
|
36 |
+
// Multisite
|
37 |
+
define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
|
38 |
+
|
39 |
+
// Sessions
|
40 |
+
define('APBCT_SEESION__LIVE_TIME', 86400*2);
|
41 |
+
define('APBCT_SEESION__CHANCE_TO_CLEAN', 100);
|
42 |
+
|
43 |
+
// Different params
|
44 |
+
define('APBCT_REMOTE_CALL_SLEEP', 5); // Minimum time between remote call
|
45 |
+
|
46 |
+
if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
|
47 |
+
|
48 |
+
define('CLEANTALK_PLUGIN_DIR', dirname(__FILE__ ) . '/');
|
49 |
+
|
50 |
+
// PHP functions patches
|
51 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
|
52 |
+
|
53 |
+
// Base classes
|
54 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/autoloader.php'); // Autoloader
|
55 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
|
56 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
|
57 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
|
58 |
+
include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/SFW.php'); // SpamFireWall
|
59 |
+
include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Arr.php'); // Array functions
|
60 |
+
|
61 |
+
// Child classes
|
62 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkAPI.php'); // API for Wordpress
|
63 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB.php'); // Database class for Wordpress
|
64 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkHelper.php'); // Helper for Worpdress
|
65 |
+
include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php"); // SpamFireWall for Wordpress
|
66 |
+
|
67 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk.php'); // Main class for request
|
68 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkRequest.php'); // Holds request data
|
69 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkResponse.php'); // Holds response data
|
70 |
+
|
71 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkCron.php'); // Cron handling
|
72 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkState.php'); // State class
|
73 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-pluggable.php'); // Pluggable functions
|
74 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
|
75 |
+
|
76 |
+
// Global ArrayObject with settings and other global varables
|
77 |
+
global $apbct;
|
78 |
+
$apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors', 'remote_calls', 'stats'));
|
79 |
+
|
80 |
+
$apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
|
81 |
+
|
82 |
+
$apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
|
83 |
+
$apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
|
84 |
+
$apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
|
85 |
+
|
86 |
+
// Customize CleantalkState
|
87 |
+
// Account status
|
88 |
+
|
89 |
+
$apbct->white_label = $apbct->network_settings['white_label'];
|
90 |
+
$apbct->allow_custom_key = $apbct->network_settings['allow_custom_key'];
|
91 |
+
$apbct->plugin_name = $apbct->network_settings['white_label__plugin_name'] ? $apbct->network_settings['white_label__plugin_name'] : APBCT_NAME;
|
92 |
+
$apbct->api_key = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
|
93 |
+
$apbct->key_is_ok = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['key_is_ok'] : $apbct->network_data['key_is_ok'];
|
94 |
+
$apbct->moderate = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['moderate'] : $apbct->network_data['moderate'];
|
95 |
+
|
96 |
+
$apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
97 |
+
$apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
98 |
+
|
99 |
+
$apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
|
100 |
+
|
101 |
+
if(!$apbct->white_label){
|
102 |
+
require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
103 |
+
}
|
104 |
+
|
105 |
+
// Disabling comments
|
106 |
+
if($apbct->settings['disable_comments__all'] || $apbct->settings['disable_comments__posts'] || $apbct->settings['disable_comments__pages'] || $apbct->settings['disable_comments__media']){
|
107 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Templates/Singleton.php');
|
108 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/DisableComments.php');
|
109 |
+
\Cleantalk\DisableComments::getInstance();
|
110 |
+
}
|
111 |
+
|
112 |
+
// Passing JS key to frontend
|
113 |
+
add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
114 |
+
add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
|
115 |
+
|
116 |
+
// Database prefix
|
117 |
+
global $wpdb;
|
118 |
+
$apbct->db_prefix = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
|
119 |
+
$apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
|
120 |
+
// Database constants
|
121 |
+
define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
|
122 |
+
define('APBCT_TBL_FIREWALL_LOG', $apbct->db_prefix . 'cleantalk_sfw_logs'); // Table with firewall logs.
|
123 |
+
define('APBCT_TBL_SESSIONS', $apbct->db_prefix . 'cleantalk_sessions'); // Table with session data.
|
124 |
+
define('APBCT_SPAMSCAN_LOGS', $apbct->db_prefix . 'cleantalk_spamscan_logs'); // Table with session data.
|
125 |
+
define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs.
|
126 |
+
define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data.
|
127 |
+
|
128 |
+
/** @todo HARDCODE FIX */
|
129 |
+
if($apbct->plugin_version === '1.0.0')
|
130 |
+
$apbct->plugin_version = '5.100';
|
131 |
+
|
132 |
+
// Do update actions if version is changed
|
133 |
+
apbct_update_actions();
|
134 |
+
|
135 |
+
// Self cron
|
136 |
+
if(!defined('DOING_CRON') || (defined('DOING_CRON') && DOING_CRON !== true)){
|
137 |
+
|
138 |
+
$ct_cron = new CleantalkCron();
|
139 |
+
$ct_cron->checkTasks();
|
140 |
+
|
141 |
+
if(!empty($ct_cron->tasks_to_run)){
|
142 |
+
|
143 |
+
define('CT_CRON', true); // Letting know functions that they are running under CT_CRON
|
144 |
+
$ct_cron->runTasks();
|
145 |
+
unset($ct_cron);
|
146 |
+
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
//Delete cookie for admin trial notice
|
151 |
+
add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
|
152 |
+
|
153 |
+
// Set cookie only for public pages and for non-AJAX requests
|
154 |
+
if (!is_admin() && !apbct_is_ajax() && !defined('DOING_CRON')
|
155 |
+
&& empty($_POST['ct_checkjs_register_form']) // Buddy press registration fix
|
156 |
+
&& empty($_GET['ct_checkjs_search_default']) // Search form fix
|
157 |
+
&& empty($_POST['action']) //bbPress
|
158 |
+
){
|
159 |
+
add_action('template_redirect','apbct_cookie', 2);
|
160 |
+
add_action('template_redirect','apbct_store__urls', 2);
|
161 |
+
if (empty($_POST) && empty($_GET)){
|
162 |
+
apbct_cookie();
|
163 |
+
apbct_store__urls();
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
// Early checks
|
168 |
+
|
169 |
+
// Iphorm
|
170 |
+
if( isset( $_POST['iphorm_ajax'], $_POST['iphorm_id'], $_POST['iphorm_uid'] ) ){
|
171 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
172 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
173 |
+
ct_ajax_hook();
|
174 |
+
}
|
175 |
+
|
176 |
+
// Facebook
|
177 |
+
if ($apbct->settings['general_contact_forms_test'] == 1
|
178 |
+
&& (!empty($_POST['action']) && $_POST['action'] == 'fb_intialize')
|
179 |
+
&& !empty($_POST['FB_userdata'])
|
180 |
+
){
|
181 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
182 |
+
if (apbct_is_user_enable()){
|
183 |
+
$ct_check_post_result=false;
|
184 |
+
ct_registration_errors(null);
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
$apbct_active_integrations = array(
|
190 |
+
'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
|
191 |
+
'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
|
192 |
+
'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ),
|
193 |
+
'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false )
|
194 |
+
);
|
195 |
+
new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
|
196 |
+
|
197 |
+
// Ninja Forms. Making GET action to POST action
|
198 |
+
if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
|
199 |
+
$_POST['action']='ninja_forms_ajax_submit';
|
200 |
+
|
201 |
+
add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
202 |
+
add_action( 'wp_ajax_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
203 |
+
add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
204 |
+
add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
|
205 |
+
add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
|
206 |
+
|
207 |
+
// SeedProd Coming Soon Page Pro integration
|
208 |
+
add_action( 'wp_ajax_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
209 |
+
add_action( 'wp_ajax_nopriv_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
210 |
+
add_action( 'wp_ajax_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
211 |
+
add_action( 'wp_ajax_nopriv_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
|
212 |
+
|
213 |
+
// The 7 theme contact form integration
|
214 |
+
add_action( 'wp_ajax_nopriv_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
|
215 |
+
add_action( 'wp_ajax_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
|
216 |
+
|
217 |
+
// Elementor Pro page builder forms
|
218 |
+
add_action( 'wp_ajax_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
|
219 |
+
add_action( 'wp_ajax_nopriv_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
|
220 |
+
|
221 |
+
// Custom register form (ticket_id=13668)
|
222 |
+
add_action('website_neotrends_signup_fields_check',function( $username, $fields ){
|
223 |
+
$ip = CleantalkHelper::ip__get( array('real'), false );
|
224 |
+
$ct_result = ct_test_registration( $username, $fields['email'], $ip );
|
225 |
+
if( $ct_result['allow'] == 0 ) {
|
226 |
+
ct_die_extended( $ct_result['comment'] );
|
227 |
+
}
|
228 |
+
}, 1, 2);
|
229 |
+
|
230 |
+
// INEVIO theme integration
|
231 |
+
add_action( 'wp_ajax_contact_form_handler', 'apbct_form__inevio__testSpam', 1 );
|
232 |
+
add_action( 'wp_ajax_nopriv_contact_form_handler', 'apbct_form__inevio__testSpam', 1 );
|
233 |
+
|
234 |
+
// Public actions
|
235 |
+
if(!is_admin() && !apbct_is_ajax()){
|
236 |
+
|
237 |
+
// Default search
|
238 |
+
//add_filter( 'get_search_form', 'apbct_forms__search__addField' );
|
239 |
+
add_filter( 'get_search_query', 'apbct_forms__search__testSpam' );
|
240 |
+
add_action( 'wp_head', 'apbct_search_add_noindex', 1 );
|
241 |
+
|
242 |
+
// Remote calls
|
243 |
+
if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name']) && in_array($_GET['plugin_name'], array('antispam','anti-spam', 'apbct'))){
|
244 |
+
apbct_remote_call__perform();
|
245 |
+
}
|
246 |
+
|
247 |
+
// SpamFireWall check
|
248 |
+
if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
|
249 |
+
$apbct->settings['spam_firewall'] == 1 &&
|
250 |
+
apbct_is_get() &&
|
251 |
+
! apbct_wp_doing_cron()
|
252 |
+
){
|
253 |
+
apbct_sfw__check();
|
254 |
+
}
|
255 |
+
|
256 |
+
}
|
257 |
+
|
258 |
+
|
259 |
+
// Activation/deactivation functions must be in main plugin file.
|
260 |
+
// http://codex.wordpress.org/Function_Reference/register_activation_hook
|
261 |
+
register_activation_hook( __FILE__, 'apbct_activation' );
|
262 |
+
register_deactivation_hook( __FILE__, 'apbct_deactivation' );
|
263 |
+
|
264 |
+
// Hook for newly added blog
|
265 |
+
add_action('wpmu_new_blog', 'apbct_activation__new_blog', 10, 6);
|
266 |
+
|
267 |
+
// Async loading for JavaScript
|
268 |
+
add_filter('script_loader_tag', 'apbct_add_async_attribute', 10, 3);
|
269 |
+
|
270 |
+
// Redirect admin to plugin settings.
|
271 |
+
if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
|
272 |
+
add_action('admin_init', 'apbct_plugin_redirect');
|
273 |
+
|
274 |
+
// Deleting SFW tables when deleting websites
|
275 |
+
if(defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE === true)
|
276 |
+
add_action( 'delete_blog', 'apbct_sfw__delete_tables', 10, 2 );
|
277 |
+
|
278 |
+
// After plugin loaded - to load locale as described in manual
|
279 |
+
add_action('plugins_loaded', 'apbct_plugin_loaded' );
|
280 |
+
|
281 |
+
if( !empty($apbct->settings['use_ajax']) &&
|
282 |
+
! apbct_is_in_uri( '.xml' ) &&
|
283 |
+
! apbct_is_in_uri( '.xsl' ) )
|
284 |
+
{
|
285 |
+
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
286 |
+
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
287 |
+
}
|
288 |
+
|
289 |
+
// Admin panel actions
|
290 |
+
if (is_admin() || is_network_admin()){
|
291 |
+
|
292 |
+
require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-find-spam.php' );
|
293 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
|
294 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-settings.php');
|
295 |
+
|
296 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
|
297 |
+
|
298 |
+
add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
|
299 |
+
|
300 |
+
add_action('admin_init', 'apbct_admin__init', 1);
|
301 |
+
add_action('admin_menu', 'apbct_settings_add_page');
|
302 |
+
add_action('network_admin_menu', 'apbct_settings_add_page');
|
303 |
+
add_action('admin_notices', 'apbct_admin__notice_message');
|
304 |
+
add_action('network_admin_notices', 'apbct_admin__notice_message');
|
305 |
+
|
306 |
+
//Show widget only if not IP license
|
307 |
+
if(!$apbct->moderate_ip)
|
308 |
+
add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
|
309 |
+
}
|
310 |
+
|
311 |
+
if(apbct_is_ajax() || isset($_POST['cma-action'])){
|
312 |
+
|
313 |
+
$cleantalk_hooked_actions = array();
|
314 |
+
$cleantalk_ajax_actions_to_check = array();
|
315 |
+
|
316 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
317 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
318 |
+
|
319 |
+
// Feedback for comments
|
320 |
+
if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment'){
|
321 |
+
add_action( 'wp_ajax_nopriv_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
|
322 |
+
add_action( 'wp_ajax_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
|
323 |
+
}
|
324 |
+
if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_user'){
|
325 |
+
add_action( 'wp_ajax_nopriv_ct_feedback_user', 'apbct_user__send_feedback',1 );
|
326 |
+
add_action( 'wp_ajax_ct_feedback_user', 'apbct_user__send_feedback',1 );
|
327 |
+
}
|
328 |
+
|
329 |
+
// Check AJAX requests
|
330 |
+
// if User is not logged in
|
331 |
+
// if Unknown action or Known action with mandatory check
|
332 |
+
if( ( ! apbct_is_user_logged_in() || $apbct->settings['protect_logged_in'] == 1) &&
|
333 |
+
isset( $_POST['action'] ) &&
|
334 |
+
( ! in_array( $_POST['action'], $cleantalk_hooked_actions ) || in_array( $_POST['action'], $cleantalk_ajax_actions_to_check ) ) &&
|
335 |
+
! array_search( $_POST['action'], array_column( $apbct_active_integrations, 'hook' ) )
|
336 |
+
){
|
337 |
+
ct_ajax_hook();
|
338 |
+
}
|
339 |
+
|
340 |
+
//QAEngine Theme answers
|
341 |
+
if (intval($apbct->settings['general_contact_forms_test']))
|
342 |
+
add_filter('et_pre_insert_question', 'ct_ajax_hook', 1, 1); // Questions
|
343 |
+
add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
|
344 |
+
|
345 |
+
// Formidable
|
346 |
+
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
347 |
+
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
348 |
+
|
349 |
+
// Some of plugins to register a users use AJAX context.
|
350 |
+
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
351 |
+
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
352 |
+
add_action('user_register', 'apbct_user_register');
|
353 |
+
|
354 |
+
if(class_exists('BuddyPress')){
|
355 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
356 |
+
add_filter('bp_activity_is_spam_before_save', 'apbct_integration__buddyPres__activityWall', 999 ,2); /* ActivityWall */
|
357 |
+
add_action('bp_locate_template', 'apbct_integration__buddyPres__getTemplateName', 10, 6);
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
363 |
+
//Bitrix24 contact form
|
364 |
+
if ($apbct->settings['general_contact_forms_test'] == 1 &&
|
365 |
+
!empty($_POST['your-phone']) &&
|
366 |
+
!empty($_POST['your-email']) &&
|
367 |
+
!empty($_POST['your-message'])
|
368 |
+
){
|
369 |
+
$ct_check_post_result=false;
|
370 |
+
ct_contact_form_validate();
|
371 |
+
}
|
372 |
+
|
373 |
+
// Sends feedback to the cloud about comments
|
374 |
+
// add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
|
375 |
+
|
376 |
+
// Sends feedback to the cloud about deleted users
|
377 |
+
global $pagenow;
|
378 |
+
if($pagenow=='users.php')
|
379 |
+
add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
|
380 |
+
|
381 |
+
if( $pagenow=='plugins.php' || apbct_is_in_uri( 'plugins.php' ) ){
|
382 |
+
|
383 |
+
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
384 |
+
add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
|
385 |
+
|
386 |
+
add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
|
387 |
+
}
|
388 |
+
|
389 |
+
// Public pages actions
|
390 |
+
}else{
|
391 |
+
|
392 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
393 |
+
|
394 |
+
|
395 |
+
|
396 |
+
add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
|
397 |
+
|
398 |
+
// Init action.
|
399 |
+
add_action('plugins_loaded', 'apbct_init', 1);
|
400 |
+
|
401 |
+
// Comments
|
402 |
+
add_filter('preprocess_comment', 'ct_preprocess_comment', 1, 1); // param - comment data array
|
403 |
+
add_filter('comment_text', 'ct_comment_text' );
|
404 |
+
add_filter('wp_die_handler', 'apbct_comment__sanitize_data__before_wp_die', 1); // Check comments after validation
|
405 |
+
|
406 |
+
// Registrations
|
407 |
+
if(!isset($_POST['wp-submit'])){
|
408 |
+
add_action('login_form_register', 'apbct_cookie');
|
409 |
+
add_action('login_form_register', 'apbct_store__urls');
|
410 |
+
}
|
411 |
+
add_action('login_enqueue_scripts', 'apbct_login__scripts');
|
412 |
+
add_action('register_form', 'ct_register_form');
|
413 |
+
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
414 |
+
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
415 |
+
add_action('user_register', 'apbct_user_register');
|
416 |
+
|
417 |
+
// Multisite registrations
|
418 |
+
add_action('signup_extra_fields','ct_register_form');
|
419 |
+
add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
|
420 |
+
|
421 |
+
// Login form - for notifications only
|
422 |
+
add_filter('login_message', 'ct_login_message');
|
423 |
+
|
424 |
+
// Comments output hook
|
425 |
+
add_filter('wp_list_comments_args', 'ct_wp_list_comments_args');
|
426 |
+
|
427 |
+
// Ait-Themes fix
|
428 |
+
if(isset($_GET['ait-action']) && $_GET['ait-action']=='register'){
|
429 |
+
$tmp=$_POST['redirect_to'];
|
430 |
+
unset($_POST['redirect_to']);
|
431 |
+
ct_contact_form_validate();
|
432 |
+
$_POST['redirect_to']=$tmp;
|
433 |
+
}
|
434 |
+
}
|
435 |
+
|
436 |
+
// Short code for GDPR
|
437 |
+
if($apbct->settings['gdpr_enabled'])
|
438 |
+
add_shortcode('cleantalk_gdpr_form', 'apbct_shrotcode_handler__GDPR_public_notice__form');
|
439 |
+
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Function preforms remote call
|
444 |
+
*/
|
445 |
+
function apbct_remote_call__perform()
|
446 |
+
{
|
447 |
+
global $apbct;
|
448 |
+
|
449 |
+
$remote_action = $_GET['spbc_remote_call_action'];
|
450 |
+
|
451 |
+
if( isset( $apbct->remote_calls[$remote_action] ) ){
|
452 |
+
if(time() - $apbct->remote_calls[$remote_action]['last_call'] > APBCT_REMOTE_CALL_SLEEP || ($remote_action == 'sfw_update' && isset($_GET['file_urls']))) {
|
453 |
+
|
454 |
+
$apbct->remote_calls[$remote_action]['last_call'] = time();
|
455 |
+
$apbct->save('remote_calls');
|
456 |
+
|
457 |
+
if(strtolower($_GET['spbc_remote_call_token']) == strtolower(md5($apbct->api_key))){
|
458 |
+
|
459 |
+
// Flag to let plugin know that Remote Call is running.
|
460 |
+
$apbct->rc_running = true;
|
461 |
+
|
462 |
+
switch ($remote_action) {
|
463 |
+
|
464 |
+
// Close renew banner
|
465 |
+
case 'close_renew_banner':
|
466 |
+
$apbct->data['notice_trial'] = 0;
|
467 |
+
$apbct->data['notice_renew'] = 0;
|
468 |
+
$apbct->saveData();
|
469 |
+
CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
|
470 |
+
die('OK');
|
471 |
+
break;
|
472 |
+
|
473 |
+
// SFW update
|
474 |
+
case 'sfw_update':
|
475 |
+
$result = ct_sfw_update(true);
|
476 |
+
/**
|
477 |
+
* @todo CRUNCH
|
478 |
+
*/
|
479 |
+
if(is_string($result) && strpos($result, 'FAIL') !== false){
|
480 |
+
$result = json_decode(substr($result, 5), true);
|
481 |
+
}
|
482 |
+
die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
|
483 |
+
break;
|
484 |
+
|
485 |
+
// SFW send logs
|
486 |
+
case 'sfw_send_logs':
|
487 |
+
$result = ct_sfw_send_logs();
|
488 |
+
die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
|
489 |
+
break;
|
490 |
+
|
491 |
+
// Update plugin
|
492 |
+
case 'update_plugin':
|
493 |
+
add_action('wp', 'apbct_rc__update', 1);
|
494 |
+
break;
|
495 |
+
|
496 |
+
// Install plugin
|
497 |
+
case 'install_plugin':
|
498 |
+
add_action('wp', 'apbct_rc__install_plugin', 1);
|
499 |
+
break;
|
500 |
+
// Activate plugin
|
501 |
+
case 'activate_plugin':
|
502 |
+
$result = apbct_rc__activate_plugin($_GET['plugin']);
|
503 |
+
die(empty($result['error'])
|
504 |
+
? 'OK'
|
505 |
+
: 'FAIL '.json_encode(array('error' => $result['error'])));
|
506 |
+
break;
|
507 |
+
|
508 |
+
// Insert API key
|
509 |
+
case 'insert_auth_key':
|
510 |
+
$result = apbct_rc__insert_auth_key($_GET['auth_key'], $_GET['plugin']);
|
511 |
+
die(empty($result['error'])
|
512 |
+
? 'OK'
|
513 |
+
: 'FAIL '.json_encode(array('error' => $result['error'])));
|
514 |
+
break;
|
515 |
+
|
516 |
+
// Update settins
|
517 |
+
case 'update_settings':
|
518 |
+
$result = apbct_rc__update_settings($_GET);
|
519 |
+
die(empty($result['error'])
|
520 |
+
? 'OK'
|
521 |
+
: 'FAIL '.json_encode(array('error' => $result['error'])));
|
522 |
+
break;
|
523 |
+
// Deactivate plugin
|
524 |
+
case 'deactivate_plugin':
|
525 |
+
add_action('plugins_loaded', 'apbct_rc__deactivate_plugin', 1);
|
526 |
+
break;
|
527 |
+
|
528 |
+
// Uninstall plugin
|
529 |
+
case 'uninstall_plugin':
|
530 |
+
add_action('plugins_loaded', 'apbct_rc__uninstall_plugin', 1);
|
531 |
+
break;
|
532 |
+
// No action found
|
533 |
+
default:
|
534 |
+
die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION_2')));
|
535 |
+
break;
|
536 |
+
}
|
537 |
+
|
538 |
+
}else
|
539 |
+
die('FAIL '.json_encode(array('error' => 'WRONG_TOKEN')));
|
540 |
+
}else
|
541 |
+
die('FAIL '.json_encode(array('error' => 'TOO_MANY_ATTEMPTS')));
|
542 |
+
}else
|
543 |
+
die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION')));
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Function for SpamFireWall check
|
548 |
+
*/
|
549 |
+
function apbct_sfw__check()
|
550 |
+
{
|
551 |
+
global $apbct, $spbc, $cleantalk_url_exclusions;
|
552 |
+
|
553 |
+
// Turn off the SpamFireWall if current url in the exceptions list and WordPress core pages
|
554 |
+
if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
|
555 |
+
$core_page_to_skip_check = array('/feed');
|
556 |
+
foreach (array_merge($cleantalk_url_exclusions, $core_page_to_skip_check) as $v) {
|
557 |
+
if ( apbct_is_in_uri( $v ) ) {
|
558 |
+
return;
|
559 |
+
}
|
560 |
+
}
|
561 |
+
}
|
562 |
+
|
563 |
+
// Turn off the SpamFireWall if Remote Call is in progress
|
564 |
+
if($apbct->rc_running || (!empty($spbc) && $spbc->rc_running))
|
565 |
+
return;
|
566 |
+
|
567 |
+
$is_sfw_check = true;
|
568 |
+
$sfw = new CleantalkSFW();
|
569 |
+
$sfw->ip_array = (array)$sfw->ip__get(array('real'), true);
|
570 |
+
|
571 |
+
// Skip by cookie
|
572 |
+
foreach($sfw->ip_array as $ct_cur_ip){
|
573 |
+
if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$apbct->api_key)){
|
574 |
+
$is_sfw_check=false;
|
575 |
+
if(isset($_COOKIE['ct_sfw_passed'])){
|
576 |
+
$sfw->logs__update($ct_cur_ip, 'passed');
|
577 |
+
$apbct->data['sfw_counter']['all']++;
|
578 |
+
$apbct->saveData();
|
579 |
+
if(!headers_sent())
|
580 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', null, false, true, 'Lax' );
|
581 |
+
}
|
582 |
+
break;
|
583 |
+
}else{
|
584 |
+
$is_sfw_check = true;
|
585 |
+
}
|
586 |
+
}
|
587 |
+
|
588 |
+
// Skip the check
|
589 |
+
if(!empty($_GET['access'])){
|
590 |
+
$spbc_settings = get_option('spbc_settings');
|
591 |
+
$spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
|
592 |
+
if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
|
593 |
+
$is_sfw_check = false;
|
594 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/', '');
|
595 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/', null);
|
596 |
+
}
|
597 |
+
unset($spbc_settings, $spbc_key);
|
598 |
+
}
|
599 |
+
|
600 |
+
if($is_sfw_check){
|
601 |
+
|
602 |
+
$sfw->ip_check();
|
603 |
+
|
604 |
+
// Pass remote calls
|
605 |
+
if($sfw->pass === false){
|
606 |
+
if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name'])){
|
607 |
+
foreach($sfw->blocked_ips as $ip){
|
608 |
+
$resolved = CleantalkHelper::ip__resolve($ip['ip']);
|
609 |
+
if($resolved && preg_match('/cleantalk\.org/', $resolved) === 1 || $resolved === 'back'){
|
610 |
+
$sfw->pass = true;
|
611 |
+
}
|
612 |
+
} unset($ip);
|
613 |
+
}
|
614 |
+
}
|
615 |
+
|
616 |
+
// if($sfw->test){
|
617 |
+
// $sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST), 'test');
|
618 |
+
// }
|
619 |
+
|
620 |
+
if($sfw->pass === false){
|
621 |
+
foreach($sfw->blocked_ips as $ip){
|
622 |
+
$sfw->logs__update($ip['ip'], 'blocked');
|
623 |
+
}
|
624 |
+
$apbct->data['sfw_counter']['blocked']++;
|
625 |
+
$apbct->saveData();
|
626 |
+
$sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST));
|
627 |
+
}else{
|
628 |
+
reset($sfw->passed_ips);
|
629 |
+
if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
|
630 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set( 'ct_sfw_pass_key', md5( $sfw->passed_ips[ key( $sfw->passed_ips ) ]['ip'] . $apbct->api_key ), time() + 86400 * 30, '/', null, false );
|
631 |
+
}
|
632 |
+
}
|
633 |
+
unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
|
634 |
+
}
|
635 |
+
|
636 |
+
/**
|
637 |
+
* On activation, set a time, frequency and name of an action hook to be scheduled.
|
638 |
+
*/
|
639 |
+
function apbct_activation( $network = false ) {
|
640 |
+
|
641 |
+
global $wpdb;
|
642 |
+
|
643 |
+
// SFW data
|
644 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
645 |
+
`network` int(11) unsigned NOT NULL,
|
646 |
+
`mask` int(11) unsigned NOT NULL,
|
647 |
+
`status` TINYINT(1) NOT NULL DEFAULT 0,
|
648 |
+
INDEX ( `network` , `mask` )
|
649 |
+
);';
|
650 |
+
|
651 |
+
// SFW log
|
652 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
653 |
+
`ip` VARCHAR(15) NOT NULL,
|
654 |
+
`all_entries` INT NOT NULL,
|
655 |
+
`blocked_entries` INT NOT NULL,
|
656 |
+
`entries_timestamp` INT NOT NULL,
|
657 |
+
PRIMARY KEY (`ip`));';
|
658 |
+
|
659 |
+
// Sessions
|
660 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
661 |
+
`id` VARCHAR(64) NOT NULL,
|
662 |
+
`name` VARCHAR(40) NOT NULL,
|
663 |
+
`value` TEXT NULL DEFAULT NULL,
|
664 |
+
`last_update` DATETIME NULL DEFAULT NULL,
|
665 |
+
PRIMARY KEY (`name`(40), `id`(64)));';
|
666 |
+
|
667 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
668 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
669 |
+
`scan_type` varchar(11) NOT NULL,
|
670 |
+
`start_time` datetime NOT NULL,
|
671 |
+
`finish_time` datetime NOT NULL,
|
672 |
+
`count_to_scan` int(11) DEFAULT NULL,
|
673 |
+
`found_spam` int(11) DEFAULT NULL,
|
674 |
+
`found_bad` int(11) DEFAULT NULL,
|
675 |
+
PRIMARY KEY (`id`));';
|
676 |
+
|
677 |
+
if($network && !defined('CLEANTALK_ACCESS_KEY')){
|
678 |
+
$initial_blog = get_current_blog_id();
|
679 |
+
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
680 |
+
foreach ($blogs as $blog) {
|
681 |
+
switch_to_blog($blog);
|
682 |
+
apbct_activation__create_tables($sqls);
|
683 |
+
// Cron tasks
|
684 |
+
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
685 |
+
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
686 |
+
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
687 |
+
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
|
688 |
+
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
689 |
+
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
690 |
+
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
691 |
+
}
|
692 |
+
switch_to_blog($initial_blog);
|
693 |
+
}else{
|
694 |
+
|
695 |
+
// Cron tasks
|
696 |
+
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
697 |
+
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
698 |
+
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
699 |
+
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
|
700 |
+
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
701 |
+
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
702 |
+
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
703 |
+
|
704 |
+
apbct_activation__create_tables($sqls);
|
705 |
+
ct_sfw_update(); // Updating SFW
|
706 |
+
ct_account_status_check(null, false);
|
707 |
+
}
|
708 |
+
|
709 |
+
// Additional options
|
710 |
+
add_option('ct_plugin_do_activation_redirect', true);
|
711 |
+
}
|
712 |
+
|
713 |
+
function apbct_activation__create_tables($sqls) {
|
714 |
+
global $wpdb;
|
715 |
+
$wpdb->show_errors = false;
|
716 |
+
foreach($sqls as $sql){
|
717 |
+
$sql = sprintf($sql, $wpdb->prefix); // Adding current blog prefix
|
718 |
+
$result = $wpdb->query($sql);
|
719 |
+
if($result === false)
|
720 |
+
$errors[] = "Failed.\nQuery: {$wpdb->last_query}\nError: {$wpdb->last_error}";
|
721 |
+
}
|
722 |
+
$wpdb->show_errors = true;
|
723 |
+
|
724 |
+
// Logging errors
|
725 |
+
if(!empty($errors))
|
726 |
+
apbct_log($errors);
|
727 |
+
}
|
728 |
+
|
729 |
+
function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
|
730 |
+
if (apbct_is_plugin_active_for_network('cleantalk-spam-protect/cleantalk.php')){
|
731 |
+
|
732 |
+
switch_to_blog($blog_id);
|
733 |
+
|
734 |
+
global $wpdb;
|
735 |
+
|
736 |
+
// SFW data
|
737 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
738 |
+
`network` int(11) unsigned NOT NULL,
|
739 |
+
`mask` int(11) unsigned NOT NULL,
|
740 |
+
INDEX ( `network` , `mask` )
|
741 |
+
);';
|
742 |
+
|
743 |
+
// SFW log
|
744 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
745 |
+
`ip` VARCHAR(15) NOT NULL,
|
746 |
+
`all_entries` INT NOT NULL,
|
747 |
+
`blocked_entries` INT NOT NULL,
|
748 |
+
`entries_timestamp` INT NOT NULL,
|
749 |
+
PRIMARY KEY (`ip`));';
|
750 |
+
|
751 |
+
// Sessions
|
752 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
753 |
+
`id` VARCHAR(64) NOT NULL,
|
754 |
+
`name` TEXT NOT NULL,
|
755 |
+
`value` TEXT NULL DEFAULT NULL,
|
756 |
+
`last_update` DATETIME NULL DEFAULT NULL,
|
757 |
+
PRIMARY KEY (`id`(64), `name`(64)));';
|
758 |
+
|
759 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
760 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
761 |
+
`scan_type` varchar(11) NOT NULL,
|
762 |
+
`start_time` datetime NOT NULL,
|
763 |
+
`finish_time` datetime NOT NULL,
|
764 |
+
`count_to_scan` int(11) DEFAULT NULL,
|
765 |
+
`found_spam` int(11) DEFAULT NULL,
|
766 |
+
`found_bad` int(11) DEFAULT NULL,
|
767 |
+
PRIMARY KEY (`id`));';
|
768 |
+
|
769 |
+
// Cron tasks
|
770 |
+
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
771 |
+
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
772 |
+
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
773 |
+
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
|
774 |
+
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
775 |
+
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
776 |
+
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
777 |
+
apbct_activation__create_tables($sqls);
|
778 |
+
ct_sfw_update(); // Updating SFW
|
779 |
+
ct_account_status_check(null, false);
|
780 |
+
restore_current_blog();
|
781 |
+
}
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
* On deactivation, clear schedule.
|
786 |
+
*/
|
787 |
+
function apbct_deactivation( $network ) {
|
788 |
+
|
789 |
+
global $apbct, $wpdb;
|
790 |
+
|
791 |
+
// Deactivation for network
|
792 |
+
if(is_multisite() && $network){
|
793 |
+
|
794 |
+
$initial_blog = get_current_blog_id();
|
795 |
+
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
796 |
+
foreach ($blogs as $blog) {
|
797 |
+
switch_to_blog($blog);
|
798 |
+
apbct_deactivation__delete_blog_tables();
|
799 |
+
delete_option('cleantalk_cron'); // Deleting cron entries
|
800 |
+
|
801 |
+
if($apbct->settings['complete_deactivation']){
|
802 |
+
apbct_deactivation__delete_all_options();
|
803 |
+
apbct_deactivation__delete_meta();
|
804 |
+
apbct_deactivation__delete_all_options__in_network();
|
805 |
+
}
|
806 |
+
|
807 |
+
}
|
808 |
+
switch_to_blog($initial_blog);
|
809 |
+
|
810 |
+
// Deactivation for blog
|
811 |
+
}elseif(is_multisite()){
|
812 |
+
|
813 |
+
apbct_deactivation__delete_common_tables();
|
814 |
+
delete_option('cleantalk_cron'); // Deleting cron entries
|
815 |
+
|
816 |
+
if($apbct->settings['complete_deactivation']) {
|
817 |
+
apbct_deactivation__delete_all_options();
|
818 |
+
apbct_deactivation__delete_meta();
|
819 |
+
}
|
820 |
+
|
821 |
+
// Deactivation on standalone blog
|
822 |
+
}elseif(!is_multisite()){
|
823 |
+
|
824 |
+
apbct_deactivation__delete_common_tables();
|
825 |
+
delete_option('cleantalk_cron'); // Deleting cron entries
|
826 |
+
|
827 |
+
if($apbct->settings['complete_deactivation']) {
|
828 |
+
apbct_deactivation__delete_all_options();
|
829 |
+
apbct_deactivation__delete_meta();
|
830 |
+
}
|
831 |
+
|
832 |
+
}
|
833 |
+
}
|
834 |
+
|
835 |
+
/**
|
836 |
+
* Delete all cleantalk_* entries from _options table
|
837 |
+
*/
|
838 |
+
function apbct_deactivation__delete_all_options(){
|
839 |
+
delete_option('cleantalk_settings');
|
840 |
+
delete_option('cleantalk_data');
|
841 |
+
delete_option('cleantalk_cron');
|
842 |
+
delete_option('cleantalk_errors');
|
843 |
+
delete_option('cleantalk_remote_calls');
|
844 |
+
delete_option('cleantalk_server');
|
845 |
+
delete_option('cleantalk_stats');
|
846 |
+
delete_option('cleantalk_timelabel_reg');
|
847 |
+
delete_option('cleantalk_debug');
|
848 |
+
}
|
849 |
+
|
850 |
+
/**
|
851 |
+
* Delete all cleantalk_* entries from _sitemeta table
|
852 |
+
*/
|
853 |
+
function apbct_deactivation__delete_all_options__in_network(){
|
854 |
+
delete_site_option('cleantalk_network_settings');
|
855 |
+
delete_site_option('cleantalk_network_data');
|
856 |
+
}
|
857 |
+
|
858 |
+
function apbct_deactivation__delete_common_tables() {
|
859 |
+
global $wpdb;
|
860 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
861 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
862 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sessions`;'); // Deleting session table
|
863 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_spamscan_logs`;'); // Deleting user/comments scan result table
|
864 |
+
}
|
865 |
+
|
866 |
+
function apbct_deactivation__delete_blog_tables() {
|
867 |
+
global $wpdb;
|
868 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
869 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
870 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
871 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_spamscan_logs`;'); // Deleting user/comments scan result table
|
872 |
+
}
|
873 |
+
|
874 |
+
function apbct_deactivation__delete_meta(){
|
875 |
+
global $wpdb;
|
876 |
+
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_bad', 'ct_checked', 'ct_checked_now', 'ct_marked_as_spam', 'ct_hash');");
|
877 |
+
}
|
878 |
+
|
879 |
+
/**
|
880 |
+
* Redirects admin to plugin settings after activation.
|
881 |
+
*/
|
882 |
+
function apbct_plugin_redirect()
|
883 |
+
{
|
884 |
+
global $apbct;
|
885 |
+
if (get_option('ct_plugin_do_activation_redirect', false) && !isset($_GET['activate-multi'])){
|
886 |
+
delete_option('ct_plugin_do_activation_redirect');
|
887 |
+
wp_redirect($apbct->settings_link);
|
888 |
+
}
|
889 |
+
}
|
890 |
+
|
891 |
+
function ct_add_event($event_type)
|
892 |
+
{
|
893 |
+
global $apbct, $cleantalk_executed;
|
894 |
+
|
895 |
+
//
|
896 |
+
// To migrate on the new version of ct_add_event().
|
897 |
+
//
|
898 |
+
switch ($event_type) {
|
899 |
+
case '0': $event_type = 'no';break;
|
900 |
+
case '1': $event_type = 'yes';break;
|
901 |
+
}
|
902 |
+
|
903 |
+
$current_hour = intval(date('G'));
|
904 |
+
|
905 |
+
// Updating current hour
|
906 |
+
if($current_hour!=$apbct->data['current_hour']){
|
907 |
+
$apbct->data['current_hour'] = $current_hour;
|
908 |
+
$apbct->data['array_accepted'][$current_hour] = 0;
|
909 |
+
$apbct->data['array_blocked'][$current_hour] = 0;
|
910 |
+
}
|
911 |
+
|
912 |
+
//Add 1 to counters
|
913 |
+
if($event_type=='yes'){
|
914 |
+
$apbct->data['array_accepted'][$current_hour]++;
|
915 |
+
$apbct->data['all_time_counter']['accepted']++;
|
916 |
+
$apbct->data['user_counter']['accepted']++;
|
917 |
+
}
|
918 |
+
if($event_type=='no'){
|
919 |
+
$apbct->data['array_blocked'][$current_hour]++;
|
920 |
+
$apbct->data['all_time_counter']['blocked']++;
|
921 |
+
$apbct->data['user_counter']['blocked']++;
|
922 |
+
}
|
923 |
+
|
924 |
+
$apbct->saveData();
|
925 |
+
|
926 |
+
$cleantalk_executed=true;
|
927 |
+
}
|
928 |
+
|
929 |
+
/**
|
930 |
+
* return new cookie value
|
931 |
+
*/
|
932 |
+
function ct_get_cookie()
|
933 |
+
{
|
934 |
+
global $ct_checkjs_def;
|
935 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
936 |
+
print $ct_checkjs_key;
|
937 |
+
die();
|
938 |
+
}
|
939 |
+
|
940 |
+
function ct_sfw_update($api_key = '', $immediate = false){
|
941 |
+
|
942 |
+
global $apbct;
|
943 |
+
|
944 |
+
$api_key = !empty($apbct->api_key) ? $apbct->api_key : $api_key;
|
945 |
+
|
946 |
+
if($apbct->settings['spam_firewall'] == 1 && !empty($api_key)) {
|
947 |
+
|
948 |
+
$sfw = new CleantalkSFW();
|
949 |
+
|
950 |
+
$file_urls = isset($_GET['file_urls']) ? urldecode( $_GET['file_urls'] ) : null;
|
951 |
+
$file_urls = isset($file_urls) ? explode(',', $file_urls) : null;
|
952 |
+
|
953 |
+
if( ! $file_urls ){
|
954 |
+
|
955 |
+
//Reset previous entries count
|
956 |
+
$apbct->stats['sfw']['entries'] = 0;
|
957 |
+
$apbct->stats['sfw']['update_in_process'] = true;
|
958 |
+
$apbct->save('stats');
|
959 |
+
|
960 |
+
$sfw->sfw_update($api_key, null, $immediate);
|
961 |
+
|
962 |
+
return ! empty( $result['error'] )
|
963 |
+
? $result
|
964 |
+
: true;
|
965 |
+
|
966 |
+
}elseif( is_array( $file_urls ) && count( $file_urls ) ){
|
967 |
+
|
968 |
+
$result = $sfw->sfw_update($api_key, $file_urls[0], $immediate);
|
969 |
+
|
970 |
+
if( empty( $result['error'] ) ){
|
971 |
+
|
972 |
+
array_shift($file_urls);
|
973 |
+
|
974 |
+
//Increment sfw entries
|
975 |
+
$apbct->stats['sfw']['entries'] += $result;
|
976 |
+
$apbct->save('stats');
|
977 |
+
|
978 |
+
if (count($file_urls)) {
|
979 |
+
CleantalkHelper::http__request(
|
980 |
+
get_option('siteurl'),
|
981 |
+
array(
|
982 |
+
'spbc_remote_call_token' => md5($api_key),
|
983 |
+
'spbc_remote_call_action' => 'sfw_update',
|
984 |
+
'plugin_name' => 'apbct',
|
985 |
+
'file_urls' => implode(',', $file_urls),
|
986 |
+
),
|
987 |
+
array('get', 'async')
|
988 |
+
);
|
989 |
+
} else {
|
990 |
+
//Files array is empty update sfw time
|
991 |
+
$apbct->stats['sfw']['last_update_time'] = time();
|
992 |
+
$apbct->stats['sfw']['update_in_process'] = false;
|
993 |
+
$apbct->save('stats');
|
994 |
+
|
995 |
+
return $result;
|
996 |
+
}
|
997 |
+
}else
|
998 |
+
return $result;
|
999 |
+
}else
|
1000 |
+
return array('error' => 'SFW_UPDATE WRONG_FILE_URLS');
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
return array('error' => 'SFW_DISABLED');
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
function ct_sfw_send_logs($api_key = '')
|
1007 |
+
{
|
1008 |
+
global $apbct;
|
1009 |
+
|
1010 |
+
$api_key = !empty($apbct->api_key) ? $apbct->api_key : $api_key;
|
1011 |
+
|
1012 |
+
if($apbct->settings['spam_firewall'] == 1 && !empty($api_key)) {
|
1013 |
+
|
1014 |
+
$sfw = new CleantalkSFW();
|
1015 |
+
$result = $sfw->logs__send($api_key);
|
1016 |
+
|
1017 |
+
if(empty($result['error'])){
|
1018 |
+
$apbct->stats['sfw']['last_send_time'] = time();
|
1019 |
+
$apbct->stats['sfw']['last_send_amount'] = $result['rows'];
|
1020 |
+
$apbct->save('stats');
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
return $result;
|
1024 |
+
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
return array('error' => 'SFW_DISABLED');
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* Wrapper for Cleantalk's remote calls
|
1032 |
+
*
|
1033 |
+
* @param string $action What you want to do?
|
1034 |
+
* @param array $additional_params Additional GET parameters for RC
|
1035 |
+
* @param string $presets Presets for CleantalkHelper::http__request(). 'async' maybe?
|
1036 |
+
* @param string $plugin_name Plugin name 'antispam' by default
|
1037 |
+
* @param string $call_token RC securirty token
|
1038 |
+
* @param string $url Current site URL by default
|
1039 |
+
*
|
1040 |
+
* @return array|bool
|
1041 |
+
*/
|
1042 |
+
function apbct_rc__send($action, $additional_params = array(), $presets = 'get', $plugin_name = 'antispam', $call_token = '', $url = ''){
|
1043 |
+
|
1044 |
+
global $apbct;
|
1045 |
+
|
1046 |
+
$default_params = array(
|
1047 |
+
'plugin_name' => $plugin_name,
|
1048 |
+
'spbc_remote_call_token' => $call_token ? $call_token : md5($apbct->api_key),
|
1049 |
+
'spbc_remote_call_action' => $action,
|
1050 |
+
);
|
1051 |
+
|
1052 |
+
$params = array_merge($additional_params, $default_params);
|
1053 |
+
|
1054 |
+
return apbct_rc__parse_result(
|
1055 |
+
CleantalkHelper::http__request(
|
1056 |
+
$url ? $url : get_option('siteurl'),
|
1057 |
+
$params,
|
1058 |
+
$presets
|
1059 |
+
)
|
1060 |
+
);
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
/**
|
1064 |
+
* Parse different types of remote call results
|
1065 |
+
*
|
1066 |
+
* @param array|string $rc_result
|
1067 |
+
* string - 'FAIL {"some":"result}'
|
1068 |
+
* string - 'OK {"some":"result}'
|
1069 |
+
*
|
1070 |
+
* @return array|string
|
1071 |
+
*/
|
1072 |
+
function apbct_rc__parse_result($rc_result){
|
1073 |
+
if(is_string($rc_result)){
|
1074 |
+
$rc_result = preg_replace('/^(OK\s?|FAIL\s?)(.*)/', '$2', $rc_result, 1);
|
1075 |
+
$rc_result = json_decode($rc_result, true);
|
1076 |
+
$rc_result = $rc_result
|
1077 |
+
? $rc_result
|
1078 |
+
: array('error' => 'FAIL_TO_PARSE_RC_RESULT');
|
1079 |
+
}
|
1080 |
+
return $rc_result;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
/**
|
1084 |
+
* Install plugin from wordpress catalog
|
1085 |
+
*
|
1086 |
+
* @param WP $wp
|
1087 |
+
* @param string $plugin_slug
|
1088 |
+
*/
|
1089 |
+
function apbct_rc__install_plugin($wp = null, $plugin = null){
|
1090 |
+
global $wp_version;
|
1091 |
+
|
1092 |
+
$plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
|
1093 |
+
|
1094 |
+
if($plugin){
|
1095 |
+
|
1096 |
+
if(preg_match('/[a-zA-Z-\d]+[\/\\][a-zA-Z-\d]+\.php/', $plugin)){
|
1097 |
+
|
1098 |
+
$plugin_slug = preg_replace('@([a-zA-Z-\d]+)[\\\/].*@', '$1', $plugin);
|
1099 |
+
|
1100 |
+
if($plugin_slug){
|
1101 |
+
|
1102 |
+
require_once(ABSPATH.'wp-admin/includes/plugin-install.php');
|
1103 |
+
$result = plugins_api(
|
1104 |
+
'plugin_information',
|
1105 |
+
array(
|
1106 |
+
'slug' => $plugin_slug,
|
1107 |
+
'fileds' => array('version' => true, 'download_link' => true,),
|
1108 |
+
)
|
1109 |
+
);
|
1110 |
+
|
1111 |
+
if(!is_wp_error($result)){
|
1112 |
+
|
1113 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
1114 |
+
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
1115 |
+
include_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1116 |
+
include_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
1117 |
+
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
|
1118 |
+
|
1119 |
+
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0) {
|
1120 |
+
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
|
1121 |
+
$installer= new CleantalkUpgrader( new CleantalkUpgraderSkin() );
|
1122 |
+
} else {
|
1123 |
+
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
|
1124 |
+
$installer= new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated() );
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
$installer->install($result->download_link);
|
1128 |
+
|
1129 |
+
if($installer->apbct_result === 'OK'){
|
1130 |
+
die('OK');
|
1131 |
+
|
1132 |
+
}else
|
1133 |
+
die('FAIL '. json_encode(array('error' => $installer->apbct_result)));
|
1134 |
+
}else
|
1135 |
+
die('FAIL '. json_encode(array('error' => 'FAIL_TO_GET_LATEST_VERSION', 'details' => $result->get_error_message(),)));
|
1136 |
+
}else
|
1137 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_SLUG_INCORRECT')));
|
1138 |
+
}else
|
1139 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_INCORRECT')));
|
1140 |
+
}else
|
1141 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
function apbct_rc__activate_plugin($plugin){
|
1145 |
+
|
1146 |
+
$plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
|
1147 |
+
|
1148 |
+
if($plugin){
|
1149 |
+
|
1150 |
+
if(preg_match('@[a-zA-Z-\d]+[\\\/][a-zA-Z-\d]+\.php@', $plugin)){
|
1151 |
+
|
1152 |
+
require_once (ABSPATH .'/wp-admin/includes/plugin.php');
|
1153 |
+
|
1154 |
+
$result = activate_plugins($plugin);
|
1155 |
+
|
1156 |
+
if($result && !is_wp_error($result)){
|
1157 |
+
return array('success' => true);
|
1158 |
+
}else
|
1159 |
+
return array('error' => 'FAIL_TO_ACTIVATE', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''));
|
1160 |
+
}else
|
1161 |
+
return array('error' => 'PLUGIN_NAME_IS_INCORRECT');
|
1162 |
+
}else
|
1163 |
+
return array('error' => 'PLUGIN_NAME_IS_UNSET');
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
/**
|
1167 |
+
* Uninstall plugin from wordpress catalog
|
1168 |
+
*
|
1169 |
+
* @param null $plugin_name
|
1170 |
+
*/
|
1171 |
+
function apbct_rc__deactivate_plugin($plugin = null){
|
1172 |
+
|
1173 |
+
global $apbct;
|
1174 |
+
|
1175 |
+
$plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
|
1176 |
+
|
1177 |
+
if($plugin){
|
1178 |
+
|
1179 |
+
// Switching complete deactivation for security
|
1180 |
+
if($plugin == 'security-malware-firewall/security-malware-firewall.php' && !empty($_GET['complete_deactivation'])){
|
1181 |
+
$spbc_settings = get_option('spbc_settings');
|
1182 |
+
$spbc_settings['complete_deactivation'] = intval($_GET['complete_deactivation']);
|
1183 |
+
update_option('spbc_settings', $spbc_settings);
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
require_once (ABSPATH .'/wp-admin/includes/plugin.php');
|
1187 |
+
|
1188 |
+
if(is_plugin_active( $plugin )){
|
1189 |
+
// Hook to set flag if the plugin is deactivated
|
1190 |
+
add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
|
1191 |
+
deactivate_plugins($plugin, false, is_multisite() ? true : false);
|
1192 |
+
}else{
|
1193 |
+
$apbct->plugin_deactivated = true;
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
// Hook to set flag if the plugin is deactivated
|
1197 |
+
add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
|
1198 |
+
deactivate_plugins($plugin, false, is_multisite() ? true : false);
|
1199 |
+
|
1200 |
+
if($apbct->plugin_deactivated){
|
1201 |
+
die('OK');
|
1202 |
+
}else
|
1203 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
|
1204 |
+
}else
|
1205 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
|
1209 |
+
/**
|
1210 |
+
* Uninstall plugin from wordpress. Delete files.
|
1211 |
+
*
|
1212 |
+
* @param null $plugin
|
1213 |
+
*/
|
1214 |
+
function apbct_rc__uninstall_plugin($plugin = null){
|
1215 |
+
|
1216 |
+
global $apbct;
|
1217 |
+
|
1218 |
+
$plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
|
1219 |
+
|
1220 |
+
if($plugin){
|
1221 |
+
|
1222 |
+
// Switching complete deactivation for security
|
1223 |
+
if($plugin == 'security-malware-firewall/security-malware-firewall.php' && !empty($_GET['complete_deactivation'])){
|
1224 |
+
$spbc_settings = get_option('spbc_settings');
|
1225 |
+
$spbc_settings['complete_deactivation'] = intval($_GET['complete_deactivation']);
|
1226 |
+
update_option('spbc_settings', $spbc_settings);
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
require_once (ABSPATH .'/wp-admin/includes/plugin.php');
|
1230 |
+
|
1231 |
+
if(is_plugin_active( $plugin )){
|
1232 |
+
// Hook to set flag if the plugin is deactivated
|
1233 |
+
add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
|
1234 |
+
deactivate_plugins($plugin, false, is_multisite() ? true : false);
|
1235 |
+
}else{
|
1236 |
+
$apbct->plugin_deactivated = true;
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
if($apbct->plugin_deactivated){
|
1240 |
+
|
1241 |
+
require_once (ABSPATH .'/wp-admin/includes/file.php');
|
1242 |
+
|
1243 |
+
$result = delete_plugins(array($plugin));
|
1244 |
+
|
1245 |
+
if($result && !is_wp_error($result)){
|
1246 |
+
die('OK');
|
1247 |
+
}else
|
1248 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_EXISTS', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''))));
|
1249 |
+
}else
|
1250 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
|
1251 |
+
}else
|
1252 |
+
die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
function apbct_rc__uninstall_plugin__check_deactivate(){
|
1256 |
+
global $apbct;
|
1257 |
+
$apbct->plugin_deactivated = true;
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
function apbct_rc__update(){
|
1261 |
+
global $wp_version;
|
1262 |
+
|
1263 |
+
//Upgrade params
|
1264 |
+
$plugin = 'cleantalk-spam-protect/cleantalk.php';
|
1265 |
+
$plugin_slug = 'cleantalk-spam-protect';
|
1266 |
+
$title = __('Update Plugin');
|
1267 |
+
$nonce = 'upgrade-plugin_' . $plugin;
|
1268 |
+
$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
|
1269 |
+
$activate_for_network = false;
|
1270 |
+
if( APBCT_WPMS && is_main_site() && array_key_exists( $plugin, get_site_option( 'active_sitewide_plugins' ) ) ) {
|
1271 |
+
$activate_for_network = true;
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
$prev_version = APBCT_VERSION;
|
1275 |
+
|
1276 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
1277 |
+
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
1278 |
+
include_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1279 |
+
include_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
1280 |
+
|
1281 |
+
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
|
1282 |
+
|
1283 |
+
apbct_maintance_mode__enable( 30 );
|
1284 |
+
|
1285 |
+
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0){
|
1286 |
+
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
|
1287 |
+
$upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
|
1288 |
+
}else{
|
1289 |
+
include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
|
1290 |
+
$upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated( compact('title', 'nonce', 'url', 'plugin') ) );
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
$upgrader->upgrade($plugin);
|
1294 |
+
|
1295 |
+
apbct_maintance_mode__disable();
|
1296 |
+
|
1297 |
+
$result = activate_plugins( $plugin, '', $activate_for_network );
|
1298 |
+
|
1299 |
+
// Changing response UP_TO_DATE to OK
|
1300 |
+
if($upgrader->apbct_result === 'UP_TO_DATE')
|
1301 |
+
$upgrader->apbct_result = 'OK';
|
1302 |
+
|
1303 |
+
if($upgrader->apbct_result === 'OK'){
|
1304 |
+
|
1305 |
+
if(is_wp_error($result)){
|
1306 |
+
die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
$httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
|
1310 |
+
|
1311 |
+
if( strpos($httpResponseCode, '200') === false ){
|
1312 |
+
|
1313 |
+
apbct_maintance_mode__enable( 30 );
|
1314 |
+
|
1315 |
+
// Rollback
|
1316 |
+
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
|
1317 |
+
$rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
|
1318 |
+
else
|
1319 |
+
$rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
|
1320 |
+
$rollback->rollback($plugin);
|
1321 |
+
|
1322 |
+
apbct_maintance_mode__disable();
|
1323 |
+
|
1324 |
+
// @todo add execution time
|
1325 |
+
|
1326 |
+
$response = array(
|
1327 |
+
'error' => 'BAD_HTTP_CODE',
|
1328 |
+
'http_code' => $httpResponseCode,
|
1329 |
+
'output' => substr(file_get_contents(get_option('siteurl')), 0, 900),
|
1330 |
+
'rollback_result' => $rollback->apbct_result,
|
1331 |
+
);
|
1332 |
+
|
1333 |
+
die('FAIL '.json_encode($response));
|
1334 |
+
}
|
1335 |
+
|
1336 |
+
$plugin_data = get_plugin_data(__FILE__);
|
1337 |
+
$apbct_agent = 'wordpress-'.str_replace('.', '', $plugin_data['Version']);
|
1338 |
+
ct_send_feedback('0:' . $apbct_agent);
|
1339 |
+
|
1340 |
+
die('OK '.json_encode(array('agent' => $apbct_agent)));
|
1341 |
+
|
1342 |
+
}else{
|
1343 |
+
die('FAIL '. json_encode(array('error' => $upgrader->apbct_result)));
|
1344 |
+
}
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
function apbct_rc__update_settings($source) {
|
1348 |
+
|
1349 |
+
global $apbct;
|
1350 |
+
|
1351 |
+
foreach($apbct->def_settings as $setting => $def_value){
|
1352 |
+
if(array_key_exists($setting, $source)){
|
1353 |
+
$var = $source[$setting];
|
1354 |
+
$type = gettype($def_value);
|
1355 |
+
settype($var, $type);
|
1356 |
+
if($type == 'string')
|
1357 |
+
$var = preg_replace(array('/=/', '/`/'), '', $var);
|
1358 |
+
$apbct->settings[$setting] = $var;
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
$apbct->save('settings');
|
1363 |
+
|
1364 |
+
return true;
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
function apbct_rc__insert_auth_key($key, $plugin){
|
1368 |
+
|
1369 |
+
global $apbct;
|
1370 |
+
|
1371 |
+
if($plugin === 'security-malware-firewall/security-malware-firewall.php'){
|
1372 |
+
|
1373 |
+
require_once (ABSPATH .'/wp-admin/includes/plugin.php');
|
1374 |
+
|
1375 |
+
if(is_plugin_active( $plugin )){
|
1376 |
+
|
1377 |
+
$key = trim($key);
|
1378 |
+
|
1379 |
+
if($key && preg_match('/^[a-z\d]{3,15}$/', $key)){
|
1380 |
+
|
1381 |
+
$result = CleantalkAPI::method__notice_paid_till(
|
1382 |
+
$key,
|
1383 |
+
preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1), // Site URL
|
1384 |
+
'security'
|
1385 |
+
);
|
1386 |
+
|
1387 |
+
if( empty( $result['error'] ) ) {
|
1388 |
+
|
1389 |
+
if( $result['valid'] ){
|
1390 |
+
|
1391 |
+
// Set account params
|
1392 |
+
$data = get_option('spbc_data', array());
|
1393 |
+
$data['user_token'] = $result['user_token'];
|
1394 |
+
$data['notice_show'] = $result['show_notice'];
|
1395 |
+
$data['notice_renew'] = $result['renew'];
|
1396 |
+
$data['notice_trial'] = $result['trial'];
|
1397 |
+
$data['auto_update_app'] = isset($result['show_auto_update_notice']) ? $result['show_auto_update_notice'] : 0;
|
1398 |
+
$data['service_id'] = $result['service_id'];
|
1399 |
+
$data['moderate'] = $result['moderate'];
|
1400 |
+
$data['auto_update_app '] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
|
1401 |
+
$data['license_trial'] = isset($result['license_trial']) ? $result['license_trial'] : 0;
|
1402 |
+
$data['account_name_ob'] = isset($result['account_name_ob']) ? $result['account_name_ob'] : '';
|
1403 |
+
$data['key_is_ok'] = true;
|
1404 |
+
update_option('spbc_data', $data);
|
1405 |
+
|
1406 |
+
// Set key
|
1407 |
+
$settings = get_option('spbc_settings', array());
|
1408 |
+
$settings['spbc_key'] = $key;
|
1409 |
+
update_option('spbc_settings', $settings);
|
1410 |
+
|
1411 |
+
return 'OK';
|
1412 |
+
}else
|
1413 |
+
return array('error' => 'KEY_IS_NOT_VALID');
|
1414 |
+
}else
|
1415 |
+
return array('error' => $result);
|
1416 |
+
}else
|
1417 |
+
return array('error' => 'KEY_IS_NOT_CORRECT');
|
1418 |
+
}else
|
1419 |
+
return array('error' => 'PLUGIN_IS_NOT_ACTIVE_OR_NOT_INSTALLED');
|
1420 |
+
}else
|
1421 |
+
return array('error' => 'PLUGIN_SLUG_INCORRECT');
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
/**
|
1425 |
+
* Putting Wordpress to maintenance mode.
|
1426 |
+
* For given duration in seconds
|
1427 |
+
*
|
1428 |
+
* @param $duration
|
1429 |
+
*
|
1430 |
+
* @return bool
|
1431 |
+
*/
|
1432 |
+
function apbct_maintance_mode__enable( $duration ) {
|
1433 |
+
apbct_maintance_mode__disable();
|
1434 |
+
$content = "<?php\n\n"
|
1435 |
+
. '$upgrading = ' . (time() - ( 60 * 10 ) + $duration) . ';';
|
1436 |
+
|
1437 |
+
return (bool)file_put_contents( ABSPATH . '.maintenance', $content );
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
/**
|
1441 |
+
* Disabling maintenance mode by deleting .maintenance file.
|
1442 |
+
*
|
1443 |
+
* @return void
|
1444 |
+
*/
|
1445 |
+
function apbct_maintance_mode__disable() {
|
1446 |
+
$maintenance_file = ABSPATH . '.maintenance';
|
1447 |
+
if ( file_exists( $maintenance_file ) ) {
|
1448 |
+
unlink( $maintenance_file );
|
1449 |
+
}
|
1450 |
+
}
|
1451 |
+
|
1452 |
+
function cleantalk_get_brief_data(){
|
1453 |
+
|
1454 |
+
global $apbct;
|
1455 |
+
|
1456 |
+
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
|
1457 |
+
$apbct->saveData();
|
1458 |
+
|
1459 |
+
return;
|
1460 |
+
}
|
1461 |
+
|
1462 |
+
//Delete cookie for admin trial notice
|
1463 |
+
function apbct__hook__wp_logout__delete_trial_notice_cookie(){
|
1464 |
+
if(!headers_sent())
|
1465 |
+
setcookie('ct_trial_banner_closed', '', time()-3600);
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
function apbct_alt_session__id__get(){
|
1469 |
+
$id = CleantalkHelper::ip__get(array('real'))
|
1470 |
+
.apbct_get_server_variable( 'HTTP_USER_AGENT' )
|
1471 |
+
.apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
|
1472 |
+
return hash('sha256', $id);
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
function apbct_alt_sessions__remove_old(){
|
1476 |
+
if(rand(0, 1000) < APBCT_SEESION__CHANCE_TO_CLEAN){
|
1477 |
+
global $wpdb;
|
1478 |
+
$wpdb->query(
|
1479 |
+
'DELETE
|
1480 |
+
FROM `'. APBCT_TBL_SESSIONS .'`
|
1481 |
+
WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND
|
1482 |
+
LIMIT 100000;'
|
1483 |
+
);
|
1484 |
+
}
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
function apbct_alt_session__save($name, $value){
|
1488 |
+
|
1489 |
+
global $wpdb;
|
1490 |
+
|
1491 |
+
$session_id = apbct_alt_session__id__get();
|
1492 |
+
|
1493 |
+
$wpdb->query(
|
1494 |
+
$wpdb->prepare(
|
1495 |
+
'INSERT INTO '. APBCT_TBL_SESSIONS .'
|
1496 |
+
(id, name, value, last_update)
|
1497 |
+
VALUES (%s, %s, %s, %s)
|
1498 |
+
ON DUPLICATE KEY UPDATE
|
1499 |
+
value = %s,
|
1500 |
+
last_update = %s',
|
1501 |
+
$session_id, $name, $value, date('Y-m-d H:i:s'), $value, date('Y-m-d H:i:s')
|
1502 |
+
)
|
1503 |
+
);
|
1504 |
+
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
function apbct_alt_session__get($name){
|
1508 |
+
global $wpdb;
|
1509 |
+
$session_id = apbct_alt_session__id__get();
|
1510 |
+
$result = $wpdb->get_row(
|
1511 |
+
$wpdb->prepare(
|
1512 |
+
'SELECT value
|
1513 |
+
FROM `'. APBCT_TBL_SESSIONS .'`
|
1514 |
+
WHERE id = %s AND name = %s;',
|
1515 |
+
$session_id, $name
|
1516 |
+
),
|
1517 |
+
OBJECT
|
1518 |
+
);
|
1519 |
+
|
1520 |
+
$result = isset($result->value)
|
1521 |
+
? strpos($result->value, '{') === 0
|
1522 |
+
? (array)json_decode($result->value, true) // JSON
|
1523 |
+
: $result->value
|
1524 |
+
: false;
|
1525 |
+
|
1526 |
+
return $result ? $result : null;
|
1527 |
+
}
|
1528 |
+
|
1529 |
+
function apbct_store__urls(){
|
1530 |
+
|
1531 |
+
global $apbct;
|
1532 |
+
|
1533 |
+
if($apbct->settings['store_urls'] && empty($apbct->flags__url_stored) && !headers_sent()){
|
1534 |
+
|
1535 |
+
// URLs HISTORY
|
1536 |
+
// Get current url
|
1537 |
+
$current_url = apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' );
|
1538 |
+
|
1539 |
+
$current_url = $current_url ? substr($current_url, 0,256) : 'UNKNOWN';
|
1540 |
+
|
1541 |
+
// Get already stored URLs
|
1542 |
+
$urls = $apbct->settings['store_urls__sessions']
|
1543 |
+
? (array)apbct_alt_session__get('apbct_urls')
|
1544 |
+
: (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
|
1545 |
+
|
1546 |
+
$urls[$current_url][] = time();
|
1547 |
+
|
1548 |
+
// Rotating. Saving only latest 10
|
1549 |
+
$urls[$current_url] = count($urls[$current_url]) > 10 ? array_slice($urls[$current_url], 1, 10) : $urls[$current_url];
|
1550 |
+
$urls = count($urls) > 10 ? array_slice($urls, 1, 10) : $urls;
|
1551 |
+
|
1552 |
+
// Saving
|
1553 |
+
$apbct->settings['store_urls__sessions']
|
1554 |
+
? apbct_alt_session__save('apbct_urls', json_encode($urls))
|
1555 |
+
: \Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_urls', json_encode($urls), time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
|
1556 |
+
|
1557 |
+
// REFERER
|
1558 |
+
// Get current fererer
|
1559 |
+
$new_site_referer = apbct_get_server_variable( 'HTTP_REFERER' );
|
1560 |
+
$new_site_referer = $new_site_referer ? $new_site_referer : 'UNKNOWN';
|
1561 |
+
|
1562 |
+
// Get already stored referer
|
1563 |
+
$site_referer = $apbct->settings['store_urls__sessions']
|
1564 |
+
? apbct_alt_session__get('apbct_site_referer')
|
1565 |
+
: filter_input(INPUT_COOKIE, 'apbct_site_referer');
|
1566 |
+
|
1567 |
+
// Save if empty
|
1568 |
+
if( !$site_referer || parse_url($new_site_referer, PHP_URL_HOST) !== apbct_get_server_variable( 'HTTP_HOST' ) ){
|
1569 |
+
|
1570 |
+
$apbct->settings['store_urls__sessions']
|
1571 |
+
? apbct_alt_session__save('apbct_site_referer', $new_site_referer)
|
1572 |
+
: \Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_site_referer', $new_site_referer, time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
|
1573 |
+
}
|
1574 |
+
|
1575 |
+
$apbct->flags__url_stored = true;
|
1576 |
+
|
1577 |
+
}
|
1578 |
+
}
|
1579 |
+
|
1580 |
+
/**
|
1581 |
+
* Universal method to adding cookies.
|
1582 |
+
* Use \Cleantalk\Antispam\Helper::apbct_cookie__set() instead.
|
1583 |
+
* @deprecated
|
1584 |
+
*/
|
1585 |
+
function apbct_cookie__set($name, $value = '', $expires = 0, $path = '', $domain = null, $secure = false, $httponly = false, $samesite = 'Lax' ){
|
1586 |
+
|
1587 |
+
// For PHP 7.3+ and above
|
1588 |
+
if( version_compare( phpversion(), '7.3.0', '>=' ) ){
|
1589 |
+
|
1590 |
+
$params = array(
|
1591 |
+
'expires' => $expires,
|
1592 |
+
'path' => $path,
|
1593 |
+
'domain' => $domain,
|
1594 |
+
'secure' => $secure,
|
1595 |
+
'httponly' => $httponly,
|
1596 |
+
);
|
1597 |
+
|
1598 |
+
if($samesite)
|
1599 |
+
$params['samesite'] = $samesite;
|
1600 |
+
|
1601 |
+
setcookie( $name, $value, $params );
|
1602 |
+
|
1603 |
+
// For PHP 5.6 - 7.2
|
1604 |
+
}else {
|
1605 |
+
if($samesite)
|
1606 |
+
$path = $path . '; samesite=' . $samesite;
|
1607 |
+
setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
}
|
1611 |
+
|
1612 |
+
/*
|
1613 |
+
* Set Cookies test for cookie test
|
1614 |
+
* Sets cookies with pararms timestamp && landing_timestamp && pervious_referer
|
1615 |
+
* Sets test cookie with all other cookies
|
1616 |
+
*/
|
1617 |
+
function apbct_cookie(){
|
1618 |
+
|
1619 |
+
global $apbct;
|
1620 |
+
|
1621 |
+
if($apbct->settings['store_urls__sessions'] || $apbct->settings['set_cookies__sessions'])
|
1622 |
+
apbct_alt_sessions__remove_old();
|
1623 |
+
|
1624 |
+
if(
|
1625 |
+
empty($apbct->settings['set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
|
1626 |
+
!empty($apbct->flags__cookies_setuped) || // Cookies already set
|
1627 |
+
!empty($apbct->headers_sent) // Headers sent
|
1628 |
+
)
|
1629 |
+
return false;
|
1630 |
+
|
1631 |
+
// Prevent headers sent error
|
1632 |
+
if(headers_sent($file, $line)){
|
1633 |
+
$apbct->headers_sent = true;
|
1634 |
+
$apbct->headers_sent__hook = current_action();
|
1635 |
+
$apbct->headers_sent__where = $file.':'.$line;
|
1636 |
+
return false;
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
|
1640 |
+
// Cookie names to validate
|
1641 |
+
$cookie_test_value = array(
|
1642 |
+
'cookies_names' => array(),
|
1643 |
+
'check_value' => $apbct->api_key,
|
1644 |
+
);
|
1645 |
+
|
1646 |
+
// We need to skip the domain attribute for prevent including the dot to the cookie's domain on the client.
|
1647 |
+
$domain = null;
|
1648 |
+
|
1649 |
+
// Submit time
|
1650 |
+
if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
|
1651 |
+
$apbct_timestamp = time();
|
1652 |
+
$apbct->settings['set_cookies__sessions']
|
1653 |
+
? apbct_alt_session__save('apbct_timestamp', $apbct_timestamp)
|
1654 |
+
: \Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_timestamp', $apbct_timestamp, 0, '/', $domain, false, true, 'Lax' );
|
1655 |
+
$cookie_test_value['cookies_names'][] = 'apbct_timestamp';
|
1656 |
+
$cookie_test_value['check_value'] .= $apbct_timestamp;
|
1657 |
+
}
|
1658 |
+
|
1659 |
+
// Pervious referer
|
1660 |
+
if(apbct_get_server_variable( 'HTTP_REFERER' )){
|
1661 |
+
$apbct->settings['set_cookies__sessions']
|
1662 |
+
? apbct_alt_session__save('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ))
|
1663 |
+
: \Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ), 0, '/', $domain, false, true, 'Lax' );
|
1664 |
+
$cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
|
1665 |
+
$cookie_test_value['check_value'] .= apbct_get_server_variable( 'HTTP_REFERER' );
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
// Landing time
|
1669 |
+
$site_landing_timestamp = $apbct->settings['set_cookies__sessions']
|
1670 |
+
? apbct_alt_session__get('apbct_site_landing_ts')
|
1671 |
+
: filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
|
1672 |
+
if(!$site_landing_timestamp){
|
1673 |
+
$site_landing_timestamp = time();
|
1674 |
+
$apbct->settings['set_cookies__sessions']
|
1675 |
+
? apbct_alt_session__save('apbct_site_landing_ts', $site_landing_timestamp)
|
1676 |
+
: \Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_site_landing_ts', $site_landing_timestamp, 0, '/', $domain, false, true, 'Lax' );
|
1677 |
+
}
|
1678 |
+
$cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
|
1679 |
+
$cookie_test_value['check_value'] .= $site_landing_timestamp;
|
1680 |
+
|
1681 |
+
// Page hits
|
1682 |
+
// Get
|
1683 |
+
$page_hits = $apbct->settings['set_cookies__sessions']
|
1684 |
+
? apbct_alt_session__get('apbct_page_hits')
|
1685 |
+
: filter_input(INPUT_COOKIE, 'apbct_page_hits');
|
1686 |
+
// Set / Increase
|
1687 |
+
$page_hits = intval($page_hits) ? $page_hits + 1 : 1;
|
1688 |
+
|
1689 |
+
$apbct->settings['set_cookies__sessions']
|
1690 |
+
? apbct_alt_session__save('apbct_page_hits', $page_hits)
|
1691 |
+
: \Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_page_hits', $page_hits, 0, '/', $domain, false, true, 'Lax' );
|
1692 |
+
|
1693 |
+
$cookie_test_value['cookies_names'][] = 'apbct_page_hits';
|
1694 |
+
$cookie_test_value['check_value'] .= $page_hits;
|
1695 |
+
|
1696 |
+
// Cookies test
|
1697 |
+
$cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
|
1698 |
+
if(!$apbct->settings['set_cookies__sessions'])
|
1699 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, false, true, 'Lax' );
|
1700 |
+
|
1701 |
+
$apbct->flags__cookies_setuped = true;
|
1702 |
+
|
1703 |
+
}
|
1704 |
+
|
1705 |
+
/**
|
1706 |
+
* Cookies test for sender
|
1707 |
+
* Also checks for valid timestamp in $_COOKIE['apbct_timestamp'] and other apbct_ COOKIES
|
1708 |
+
* @return null|0|1;
|
1709 |
+
*/
|
1710 |
+
function apbct_cookies_test()
|
1711 |
+
{
|
1712 |
+
global $apbct;
|
1713 |
+
|
1714 |
+
if($apbct->settings['set_cookies__sessions'])
|
1715 |
+
return 1;
|
1716 |
+
|
1717 |
+
if(isset($_COOKIE['apbct_cookies_test'])){
|
1718 |
+
|
1719 |
+
$cookie_test = json_decode(urldecode($_COOKIE['apbct_cookies_test']),true);
|
1720 |
+
|
1721 |
+
if(!is_array($cookie_test))
|
1722 |
+
return 0;
|
1723 |
+
|
1724 |
+
$check_srting = $apbct->api_key;
|
1725 |
+
foreach($cookie_test['cookies_names'] as $cookie_name){
|
1726 |
+
$check_srting .= isset($_COOKIE[$cookie_name]) ? $_COOKIE[$cookie_name] : '';
|
1727 |
+
} unset($cookie_name);
|
1728 |
+
|
1729 |
+
if($cookie_test['check_value'] == md5($check_srting)){
|
1730 |
+
return 1;
|
1731 |
+
}else{
|
1732 |
+
return 0;
|
1733 |
+
}
|
1734 |
+
}else{
|
1735 |
+
return null;
|
1736 |
+
}
|
1737 |
+
}
|
1738 |
+
|
1739 |
+
function apbct_cookies__delete($cookie){
|
1740 |
+
if(isset($_COOKIE[$cookie]))
|
1741 |
+
setcookie($cookie, '', time()-3600);
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
function apbct_cookies__delete_all(){
|
1745 |
+
if(count($_COOKIE)){
|
1746 |
+
foreach($_COOKIE as $key => $val){
|
1747 |
+
if(preg_match("/apbct_|ct_/", $key)){
|
1748 |
+
setcookie($key, '', time()-3600);
|
1749 |
+
}
|
1750 |
+
} unset($key, $val);
|
1751 |
+
}
|
1752 |
+
return false;
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
/**
|
1756 |
+
* Gets submit time
|
1757 |
+
* Uses Cookies with check via apbct_cookies_test()
|
1758 |
+
* @return null|int;
|
1759 |
+
*/
|
1760 |
+
function apbct_get_submit_time()
|
1761 |
+
{
|
1762 |
+
global $apbct;
|
1763 |
+
$apbct_timestamp = $apbct->settings['set_cookies__sessions']
|
1764 |
+
? apbct_alt_session__get('apbct_timestamp')
|
1765 |
+
: filter_input(INPUT_COOKIE, 'apbct_timestamp');
|
1766 |
+
return apbct_cookies_test() == 1 ? time() - (int)$apbct_timestamp : null;
|
1767 |
+
}
|
1768 |
+
|
1769 |
+
/*
|
1770 |
+
* Inner function - Account status check
|
1771 |
+
* Scheduled in 1800 seconds for default!
|
1772 |
+
*/
|
1773 |
+
function ct_account_status_check($api_key = null, $process_errors = true){
|
1774 |
+
|
1775 |
+
global $apbct;
|
1776 |
+
|
1777 |
+
$api_key = $api_key ? $api_key : $apbct->api_key;
|
1778 |
+
$result = CleantalkAPI::method__notice_paid_till(
|
1779 |
+
$api_key,
|
1780 |
+
preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1),
|
1781 |
+
! is_main_site() && $apbct->white_label ? 'anti-spam-hosting' : 'antispam'
|
1782 |
+
);
|
1783 |
+
|
1784 |
+
if(empty($result['error']) || !empty($result['valid'])){
|
1785 |
+
|
1786 |
+
// Notices
|
1787 |
+
$apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
|
1788 |
+
$apbct->data['notice_renew'] = isset($result['renew']) ? (int)$result['renew'] : 0;
|
1789 |
+
$apbct->data['notice_trial'] = isset($result['trial']) ? (int)$result['trial'] : 0;
|
1790 |
+
$apbct->data['notice_review'] = isset($result['show_review']) ? (int)$result['show_review'] : 0;
|
1791 |
+
$apbct->data['notice_auto_update'] = isset($result['show_auto_update_notice']) ? (int)$result['show_auto_update_notice'] : 0;
|
1792 |
+
|
1793 |
+
// Other
|
1794 |
+
$apbct->data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
|
1795 |
+
$apbct->data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
|
1796 |
+
$apbct->data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
|
1797 |
+
$apbct->data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
|
1798 |
+
$apbct->data['moderate_ip'] = isset($result['moderate_ip'], $result['ip_license']) ? (int)$result['moderate_ip'] : 0;
|
1799 |
+
$apbct->data['spam_count'] = isset($result['spam_count']) ? (int)$result['spam_count'] : 0;
|
1800 |
+
$apbct->data['auto_update'] = isset($result['auto_update_app']) ? (int)$result['auto_update_app'] : 0;
|
1801 |
+
$apbct->data['user_token'] = isset($result['user_token']) ? (string)$result['user_token'] : '';
|
1802 |
+
$apbct->data['license_trial'] = isset($result['license_trial']) ? (int)$result['license_trial'] : 0;
|
1803 |
+
$apbct->data['account_name_ob'] = isset($result['account_name_ob']) ? (string)$result['account_name_ob'] : '';
|
1804 |
+
|
1805 |
+
CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
|
1806 |
+
|
1807 |
+
$apbct->error_delete('account_check', 'save');
|
1808 |
+
|
1809 |
+
$apbct->saveData();
|
1810 |
+
|
1811 |
+
}elseif($process_errors){
|
1812 |
+
$apbct->error_add('account_check', $result);
|
1813 |
+
}
|
1814 |
+
|
1815 |
+
if(!empty($result['valid'])){
|
1816 |
+
$apbct->data['key_is_ok'] = true;
|
1817 |
+
$result = true;
|
1818 |
+
}else{
|
1819 |
+
$apbct->data['key_is_ok'] = false;
|
1820 |
+
$result = false;
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
return $result;
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
function ct_mail_send_connection_report() {
|
1827 |
+
|
1828 |
+
global $apbct;
|
1829 |
+
|
1830 |
+
if (($apbct->settings['send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || !empty($_GET['ct_send_connection_report']))
|
1831 |
+
{
|
1832 |
+
$to = "welcome@cleantalk.org" ;
|
1833 |
+
$subject = "Connection report for " . apbct_get_server_variable( 'HTTP_HOST' );
|
1834 |
+
$message = '
|
1835 |
+
<html>
|
1836 |
+
<head>
|
1837 |
+
<title></title>
|
1838 |
+
</head>
|
1839 |
+
<body>
|
1840 |
+
<p>From '.$apbct->connection_reports['since'].' to '.date('d M').' has been made '.($apbct->connection_reports['success']+$apbct->connection_reports['negative']).' calls, where '.$apbct->connection_reports['success'].' were success and '.$apbct->connection_reports['negative'].' were negative</p>
|
1841 |
+
<p>Negative report:</p>
|
1842 |
+
<table> <tr>
|
1843 |
+
<td> </td>
|
1844 |
+
<td><b>Date</b></td>
|
1845 |
+
<td><b>Page URL</b></td>
|
1846 |
+
<td><b>Library report</b></td>
|
1847 |
+
<td><b>Server IP</b></td>
|
1848 |
+
</tr>
|
1849 |
+
';
|
1850 |
+
foreach ($apbct->connection_reports['negative_report'] as $key => $report)
|
1851 |
+
{
|
1852 |
+
$message.= '<tr>'
|
1853 |
+
. '<td>'.($key+1).'.</td>'
|
1854 |
+
. '<td>'.$report['date'].'</td>'
|
1855 |
+
. '<td>'.$report['page_url'].'</td>'
|
1856 |
+
. '<td>'.$report['lib_report'].'</td>'
|
1857 |
+
. '<td>'.$report['work_url'].'</td>'
|
1858 |
+
. '</tr>';
|
1859 |
+
}
|
1860 |
+
$message.='</table></body></html>';
|
1861 |
+
|
1862 |
+
$headers = 'Content-type: text/html; charset=windows-1251 \r\n';
|
1863 |
+
$headers .= 'From: '.get_option('admin_email');
|
1864 |
+
mail($to, $subject, $message, $headers);
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
$apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
|
1868 |
+
$apbct->data['connection_reports']['since'] = date('d M');
|
1869 |
+
$apbct->saveData();
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
//* Write $message to the plugin's debug option
|
1873 |
+
function apbct_log($message = 'empty', $func = null, $params = array())
|
1874 |
+
{
|
1875 |
+
global $apbct;
|
1876 |
+
|
1877 |
+
$debug = get_option( APBCT_DEBUG );
|
1878 |
+
|
1879 |
+
$function = $func ? $func : '';
|
1880 |
+
$cron = in_array('cron', $params) ? true : false;
|
1881 |
+
$data = in_array('data', $params) ? true : false;
|
1882 |
+
$settings = in_array('settings', $params) ? true : false;
|
1883 |
+
|
1884 |
+
if(is_array($message) or is_object($message))
|
1885 |
+
$message = print_r($message, true);
|
1886 |
+
|
1887 |
+
if($message) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func)] = $message;
|
1888 |
+
if($cron) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_cron'] = $apbct->cron;
|
1889 |
+
if($data) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_data'] = $apbct->data;
|
1890 |
+
if($settings) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_settings'] = $apbct->settings;
|
1891 |
+
|
1892 |
+
update_option(APBCT_DEBUG, $debug);
|
1893 |
+
}
|
1894 |
+
|
1895 |
+
function apbct_sfw__delete_tables( $blog_id, $drop ) {
|
1896 |
+
|
1897 |
+
global $wpdb;
|
1898 |
+
|
1899 |
+
$initial_blog = get_current_blog_id();
|
1900 |
+
|
1901 |
+
switch_to_blog($blog_id);
|
1902 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
1903 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
|
1904 |
+
|
1905 |
+
switch_to_blog($initial_blog);
|
1906 |
+
}
|
1907 |
+
|
1908 |
+
/**
|
1909 |
+
* Is enable for user group
|
1910 |
+
*
|
1911 |
+
* @param WP_User $user
|
1912 |
+
*
|
1913 |
+
* @return boolean
|
1914 |
+
*/
|
1915 |
+
function apbct_is_user_enable($user = null) {
|
1916 |
+
|
1917 |
+
global $current_user;
|
1918 |
+
|
1919 |
+
$user = !empty($user) ? $user : $current_user;
|
1920 |
+
|
1921 |
+
return apbct_is_user_role_in(array('administrator', 'editor', 'author'), $user)
|
1922 |
+
? false
|
1923 |
+
: true;
|
1924 |
+
}
|
1925 |
+
|
1926 |
+
/**
|
1927 |
+
* Checks if the current user has role
|
1928 |
+
*
|
1929 |
+
* @param array $roles array of strings
|
1930 |
+
* @param int|string|WP_User|mixed $user User ID to check|user_login|WP_User
|
1931 |
+
*
|
1932 |
+
* @return boolean Does the user has this role|roles
|
1933 |
+
*/
|
1934 |
+
function apbct_is_user_role_in( $roles, $user = false ){
|
1935 |
+
|
1936 |
+
if( is_numeric($user) && function_exists('get_userdata')) $user = get_userdata( $user );
|
1937 |
+
if( is_string($user) && function_exists('get_user_by')) $user = get_user_by('login', $user );
|
1938 |
+
if( ! $user && function_exists('wp_get_current_user')) $user = wp_get_current_user();
|
1939 |
+
if( ! $user ) $user = apbct_wp_get_current_user();
|
1940 |
+
|
1941 |
+
if( empty($user->ID) )
|
1942 |
+
return false;
|
1943 |
+
|
1944 |
+
foreach( (array) $roles as $role ){
|
1945 |
+
if( isset($user->caps[ strtolower($role) ]) || in_array(strtolower($role), $user->roles) )
|
1946 |
+
return true;
|
1947 |
+
}
|
1948 |
+
|
1949 |
+
return false;
|
1950 |
+
}
|
1951 |
+
|
1952 |
+
/**
|
1953 |
+
* Update and rotate statistics with requests exection time
|
1954 |
+
*
|
1955 |
+
* @param $exec_time
|
1956 |
+
*/
|
1957 |
+
function apbct_statistics__rotate($exec_time){
|
1958 |
+
|
1959 |
+
global $apbct;
|
1960 |
+
|
1961 |
+
// Delete old stats
|
1962 |
+
if(min(array_keys($apbct->stats['requests'])) < time() - (86400 * 7))
|
1963 |
+
unset($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]);
|
1964 |
+
|
1965 |
+
// Create new if newest older than 1 day
|
1966 |
+
if(empty($apbct->stats['requests']) || max(array_keys($apbct->stats['requests'])) < time() - (86400 * 1))
|
1967 |
+
$apbct->stats['requests'][time()] = array('amount' => 0, 'average_time' => 0);
|
1968 |
+
|
1969 |
+
// Update all existing stats
|
1970 |
+
foreach($apbct->stats['requests'] as &$weak_stat){
|
1971 |
+
$weak_stat['average_time'] = ($weak_stat['average_time'] * $weak_stat['amount'] + $exec_time) / ++$weak_stat['amount'];
|
1972 |
+
}
|
1973 |
+
|
1974 |
+
$apbct->save('stats');
|
1975 |
+
}
|
1976 |
+
|
1977 |
+
/**
|
1978 |
+
* Runs update actions for new version.
|
1979 |
+
*
|
1980 |
+
* @global CleantalkState $apbct
|
1981 |
+
*/
|
1982 |
+
function apbct_update_actions(){
|
1983 |
+
|
1984 |
+
global $apbct;
|
1985 |
+
|
1986 |
+
// Update logic
|
1987 |
+
if($apbct->plugin_version != APBCT_VERSION){
|
1988 |
+
|
1989 |
+
// Main blog
|
1990 |
+
if(is_main_site()){
|
1991 |
+
|
1992 |
+
require_once(CLEANTALK_PLUGIN_DIR.'inc/cleantalk-updater.php');
|
1993 |
+
|
1994 |
+
$result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
|
1995 |
+
|
1996 |
+
//If update is successfull
|
1997 |
+
if($result === true)
|
1998 |
+
apbct_update__set_version__from_plugin('from_plugin');
|
1999 |
+
|
2000 |
+
ct_send_feedback('0:' . APBCT_AGENT ); // Send feedback to let cloud know about updated version.
|
2001 |
+
|
2002 |
+
// Side blogs
|
2003 |
+
}else{
|
2004 |
+
apbct_update__set_version__from_plugin('from_plugin');
|
2005 |
+
}
|
2006 |
+
}
|
2007 |
+
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
/**
|
2011 |
+
* Set version of plugin in database
|
2012 |
+
*
|
2013 |
+
* @param string $ver
|
2014 |
+
*
|
2015 |
+
* @return bool
|
2016 |
+
* @global CleantalkState $apbct
|
2017 |
+
*
|
2018 |
+
*/
|
2019 |
+
function apbct_update__set_version__from_plugin($ver){
|
2020 |
+
global $apbct;
|
2021 |
+
switch (true){
|
2022 |
+
case $ver === 'from_plugin':
|
2023 |
+
$apbct->data['plugin_version'] = APBCT_VERSION;
|
2024 |
+
break;
|
2025 |
+
case preg_match('/^\d+\.\d+(\.\d+)?(-[a-zA-Z0-9-_]+)?$/', $ver) === 1;
|
2026 |
+
$apbct->data['plugin_version'] = $ver;
|
2027 |
+
break;
|
2028 |
+
default:
|
2029 |
+
return false;
|
2030 |
+
break;
|
2031 |
+
}
|
2032 |
+
$apbct->saveData();
|
2033 |
+
return true;
|
2034 |
+
}
|
i18n/cleantalk-ru_RU.mo
CHANGED
Binary file
|
i18n/cleantalk-ru_RU.po
CHANGED
@@ -1,1536 +1,1547 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date: 2020-
|
6 |
-
"Last-Translator:
|
7 |
-
"Language-Team:
|
8 |
-
"Language: ru_RU\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Loco https://localise.biz/\n"
|
13 |
-
"X-Poedit-Basepath: ..\n"
|
14 |
-
"X-Poedit-WPHeader: cleantalk.php\n"
|
15 |
-
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
16 |
-
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
17 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
19 |
-
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
20 |
-
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
21 |
-
"Report-Msgid-Bugs-To: \n"
|
22 |
-
"X-Loco-Version: 2.
|
23 |
-
"X-Poedit-SearchPath-0: .\n"
|
24 |
-
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
25 |
-
|
26 |
-
#: inc/
|
27 |
-
|
28 |
-
msgid "
|
29 |
-
msgstr "
|
30 |
-
|
31 |
-
#: inc/
|
32 |
-
|
33 |
-
msgid "
|
34 |
-
msgstr "
|
35 |
-
|
36 |
-
#: inc/
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
"
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
"
|
81 |
-
"
|
82 |
-
|
83 |
-
#: inc/
|
84 |
-
|
85 |
-
msgid "
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
"
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
"
|
105 |
-
"
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
"
|
110 |
-
|
111 |
-
#: inc/
|
112 |
-
msgid "
|
113 |
-
msgstr "
|
114 |
-
|
115 |
-
#: inc/
|
116 |
-
msgid "
|
117 |
-
msgstr "
|
118 |
-
|
119 |
-
#: inc/
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
msgid "Find spam
|
130 |
-
msgstr "Найти спам
|
131 |
-
|
132 |
-
#: inc/cleantalk-admin.php:
|
133 |
-
msgid "
|
134 |
-
msgstr "
|
135 |
-
|
136 |
-
#: inc/cleantalk-admin.php:
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
msgid "
|
152 |
-
msgstr "
|
153 |
-
|
154 |
-
#: inc/cleantalk-admin.php:
|
155 |
-
msgid "Get Access key
|
156 |
-
msgstr "
|
157 |
-
|
158 |
-
#: inc/cleantalk-admin.php:
|
159 |
-
#, php-format
|
160 |
-
msgid "
|
161 |
-
msgstr "
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
"
|
183 |
-
"
|
184 |
-
|
185 |
-
|
186 |
-
"
|
187 |
-
|
188 |
-
|
189 |
-
#: inc/cleantalk-admin.php:
|
190 |
-
#, php-format
|
191 |
-
msgid ""
|
192 |
-
"%s
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
#: inc/cleantalk-admin.php:
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
#: inc/
|
245 |
-
msgid "
|
246 |
-
msgstr "
|
247 |
-
|
248 |
-
#: inc/cleantalk-admin.php:
|
249 |
-
|
250 |
-
msgid ""
|
251 |
-
"
|
252 |
-
|
253 |
-
|
254 |
-
"
|
255 |
-
"
|
256 |
-
|
257 |
-
#: inc/cleantalk-admin.php:
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
"
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
#: inc/cleantalk-
|
282 |
-
msgid "
|
283 |
-
msgstr "
|
284 |
-
|
285 |
-
#: inc/cleantalk-
|
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 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
msgstr "
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
msgid "
|
357 |
-
msgstr "
|
358 |
-
|
359 |
-
#: inc/cleantalk-
|
360 |
-
msgid "
|
361 |
-
msgstr "
|
362 |
-
|
363 |
-
#: inc/cleantalk-
|
364 |
-
|
365 |
-
|
366 |
-
"
|
367 |
-
msgstr "
|
368 |
-
|
369 |
-
#: inc/cleantalk-
|
370 |
-
msgid "
|
371 |
-
msgstr "
|
372 |
-
|
373 |
-
#: inc/cleantalk-
|
374 |
-
msgid ""
|
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 |
-
msgstr "
|
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 |
-
#: inc/cleantalk-
|
466 |
-
msgid "
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
"
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
"
|
482 |
-
"
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
#: inc/cleantalk-
|
487 |
-
msgid "
|
488 |
-
msgstr "
|
489 |
-
|
490 |
-
#: inc/cleantalk-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
msgid "
|
506 |
-
msgstr "
|
507 |
-
|
508 |
-
#: inc/cleantalk-
|
509 |
-
msgid "
|
510 |
-
msgstr "
|
511 |
-
|
512 |
-
#: inc/cleantalk-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
msgid "
|
538 |
-
msgstr "
|
539 |
-
|
540 |
-
#: inc/cleantalk-
|
541 |
-
msgid ""
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
"
|
546 |
-
"
|
547 |
-
|
548 |
-
#: inc/cleantalk-
|
549 |
-
msgid "
|
550 |
-
msgstr "
|
551 |
-
|
552 |
-
#: inc/cleantalk-
|
553 |
-
msgid "
|
554 |
-
msgstr "
|
555 |
-
|
556 |
-
#: inc/cleantalk-
|
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 |
-
msgstr "
|
604 |
-
|
605 |
-
#: inc/cleantalk-settings.php:
|
606 |
-
msgid "
|
607 |
-
msgstr "
|
608 |
-
|
609 |
-
#: inc/cleantalk-settings.php:
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
"
|
632 |
-
"
|
633 |
-
msgstr ""
|
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 |
-
#: inc/cleantalk-settings.php:
|
683 |
-
msgid ""
|
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 |
-
#: inc/cleantalk-settings.php:
|
744 |
-
msgid "
|
745 |
-
msgstr "
|
746 |
-
|
747 |
-
#: inc/cleantalk-settings.php:
|
748 |
-
msgid "
|
749 |
-
msgstr "
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
"
|
759 |
-
"
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
"
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
#: inc/cleantalk-settings.php:
|
770 |
-
msgid "
|
771 |
-
msgstr "
|
772 |
-
|
773 |
-
#: inc/cleantalk-settings.php:
|
774 |
-
msgid ""
|
775 |
-
"
|
776 |
-
"
|
777 |
-
msgstr "
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
#: inc/cleantalk-settings.php:
|
794 |
-
msgid ""
|
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 |
-
msgstr ""
|
826 |
-
"
|
827 |
-
"
|
828 |
-
|
829 |
-
#: inc/cleantalk-settings.php:
|
830 |
-
msgid "
|
831 |
-
msgstr "
|
832 |
-
|
833 |
-
#: inc/cleantalk-settings.php:
|
834 |
-
msgid ""
|
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 |
-
msgstr "
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
"
|
874 |
-
|
875 |
-
|
876 |
-
"
|
877 |
-
"
|
878 |
-
|
879 |
-
#: inc/cleantalk-settings.php:
|
880 |
-
msgid "
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
#: inc/cleantalk-settings.php:
|
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 |
-
#: inc/cleantalk-settings.php:
|
919 |
-
msgid "
|
920 |
-
msgstr "
|
921 |
-
|
922 |
-
#: inc/cleantalk-settings.php:
|
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 |
-
#: inc/cleantalk-settings.php:
|
951 |
-
msgid ""
|
952 |
-
"
|
953 |
-
"
|
954 |
-
msgstr ""
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
"
|
966 |
-
msgstr ""
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
"
|
978 |
-
msgstr ""
|
979 |
-
"
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
msgid ""
|
988 |
-
"
|
989 |
-
|
990 |
-
|
991 |
-
"
|
992 |
-
"
|
993 |
-
|
994 |
-
#: inc/cleantalk-settings.php:
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
"
|
1003 |
-
"
|
1004 |
-
|
1005 |
-
#: inc/cleantalk-settings.php:
|
1006 |
-
msgid "
|
1007 |
-
msgstr "
|
1008 |
-
|
1009 |
-
#: inc/cleantalk-settings.php:
|
1010 |
-
msgid ""
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
"
|
1015 |
-
"
|
1016 |
-
|
1017 |
-
#: inc/cleantalk-settings.php:
|
1018 |
-
msgid "
|
1019 |
-
msgstr "
|
1020 |
-
|
1021 |
-
#: inc/cleantalk-settings.php:
|
1022 |
-
msgid "
|
1023 |
-
msgstr "
|
1024 |
-
|
1025 |
-
#: inc/cleantalk-settings.php:
|
1026 |
-
msgid "
|
1027 |
-
msgstr "
|
1028 |
-
|
1029 |
-
#: inc/cleantalk-settings.php:
|
1030 |
-
msgid ""
|
1031 |
-
"
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
"
|
1036 |
-
"
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
"
|
1048 |
-
msgstr ""
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
msgid "
|
1081 |
-
msgstr "
|
1082 |
-
|
1083 |
-
#: inc/cleantalk-settings.php:
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
"
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
msgid "
|
1096 |
-
msgstr "
|
1097 |
-
|
1098 |
-
#: inc/cleantalk-settings.php:
|
1099 |
-
msgid ""
|
1100 |
-
"
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
"
|
1105 |
-
"
|
1106 |
-
|
1107 |
-
#: inc/cleantalk-settings.php:
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
#: inc/cleantalk-settings.php:
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
#: inc/cleantalk-settings.php:
|
1194 |
-
msgid "
|
1195 |
-
msgstr "
|
1196 |
-
|
1197 |
-
#: inc/cleantalk-settings.php:
|
1198 |
-
msgid "
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
msgstr "
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
msgid "
|
1224 |
-
msgstr "
|
1225 |
-
|
1226 |
-
#: inc/cleantalk-
|
1227 |
-
msgid "
|
1228 |
-
msgstr "
|
1229 |
-
|
1230 |
-
#: inc/cleantalk-
|
1231 |
-
msgid "
|
1232 |
-
msgstr "
|
1233 |
-
|
1234 |
-
#: inc/cleantalk-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
msgid "
|
1256 |
-
msgstr "
|
1257 |
-
|
1258 |
-
#: inc/cleantalk-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
#:
|
1263 |
-
msgid "
|
1264 |
-
msgstr "
|
1265 |
-
|
1266 |
-
#:
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
msgstr ""
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
msgstr "
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
"
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
"
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
"
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
"
|
1354 |
-
msgstr ""
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
"
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
"
|
1371 |
-
"
|
1372 |
-
|
1373 |
-
|
1374 |
-
"
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
"
|
1379 |
-
"
|
1380 |
-
|
1381 |
-
|
1382 |
-
"
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
"
|
1387 |
-
"
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
msgid "
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
msgid "
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
#: inc/
|
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 |
-
msgid ""
|
1477 |
-
"
|
1478 |
-
"
|
1479 |
-
msgstr ""
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
4 |
+
"POT-Creation-Date: 2020-06-21 08:14+0000\n"
|
5 |
+
"PO-Revision-Date: 2020-06-21 08:14+0000\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: Russian\n"
|
8 |
+
"Language: ru_RU\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Loco https://localise.biz/\n"
|
13 |
+
"X-Poedit-Basepath: ..\n"
|
14 |
+
"X-Poedit-WPHeader: cleantalk.php\n"
|
15 |
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
16 |
+
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
19 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
20 |
+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
21 |
+
"Report-Msgid-Bugs-To: \n"
|
22 |
+
"X-Loco-Version: 2.4.0; wp-5.4.2\n"
|
23 |
+
"X-Poedit-SearchPath-0: .\n"
|
24 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
25 |
+
|
26 |
+
#: inc/cleantalk-admin.php:35
|
27 |
+
#, php-format
|
28 |
+
msgid "Find spam %s"
|
29 |
+
msgstr "Найти спам %s"
|
30 |
+
|
31 |
+
#: inc/cleantalk-admin.php:39
|
32 |
+
#, php-format
|
33 |
+
msgid "View spam %s"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: inc/cleantalk-admin.php:43
|
37 |
+
msgid "CleanTalk Anti-Spam Log"
|
38 |
+
msgstr "CleanTalk Anti-Spam лог"
|
39 |
+
|
40 |
+
#: inc/cleantalk-admin.php:62
|
41 |
+
#, php-format
|
42 |
+
msgid "%sRefresh%s"
|
43 |
+
msgstr "%sОбновить%s"
|
44 |
+
|
45 |
+
#: inc/cleantalk-admin.php:63
|
46 |
+
#, php-format
|
47 |
+
msgid "%sConfigure%s"
|
48 |
+
msgstr "%sКонфигурация%s"
|
49 |
+
|
50 |
+
#: inc/cleantalk-admin.php:80
|
51 |
+
msgid "7 days anti-spam stats"
|
52 |
+
msgstr "Статистика атак за 7 дней"
|
53 |
+
|
54 |
+
#: inc/cleantalk-admin.php:84
|
55 |
+
msgid "Top 5 spam IPs blocked"
|
56 |
+
msgstr "Топ 5 cамых заблокированных IP"
|
57 |
+
|
58 |
+
#: inc/cleantalk-admin.php:90
|
59 |
+
msgid "Get Access key to activate Anti-Spam protection!"
|
60 |
+
msgstr "Получите ключ доступа для активации спам защиты!"
|
61 |
+
|
62 |
+
#: inc/cleantalk-admin.php:98
|
63 |
+
#, php-format
|
64 |
+
msgid "Something went wrong! Error: \"%s\"."
|
65 |
+
msgstr "Что-то пошло не так: Ошибка: \"%s\"."
|
66 |
+
|
67 |
+
#: inc/cleantalk-admin.php:102
|
68 |
+
msgid "Please, visit your dashboard."
|
69 |
+
msgstr "Пожалуйста, посетите панель управления."
|
70 |
+
|
71 |
+
#: inc/cleantalk-admin.php:116
|
72 |
+
msgid "IP"
|
73 |
+
msgstr "IP"
|
74 |
+
|
75 |
+
#: inc/cleantalk-admin.php:117
|
76 |
+
msgid "Country"
|
77 |
+
msgstr "Страна"
|
78 |
+
|
79 |
+
#: inc/cleantalk-admin.php:118
|
80 |
+
msgid "Block Count"
|
81 |
+
msgstr "Заблкирован раз"
|
82 |
+
|
83 |
+
#: inc/cleantalk-admin.php:146
|
84 |
+
#, php-format
|
85 |
+
msgid ""
|
86 |
+
"This is the count from the %s's cloud and could be different to admin bar "
|
87 |
+
"counters"
|
88 |
+
msgstr ""
|
89 |
+
"Это счетчик из %s облака, эти данные могут отличаться от данных счетчика в "
|
90 |
+
"админ-баре."
|
91 |
+
|
92 |
+
#. %s: Number of spam messages
|
93 |
+
#: inc/cleantalk-admin.php:149
|
94 |
+
#, php-format
|
95 |
+
msgid ""
|
96 |
+
"%s%s%s has blocked %s spam for all time. The statistics are automatically "
|
97 |
+
"updated every 24 hours."
|
98 |
+
msgstr ""
|
99 |
+
"%s%s%s заблокировал %s спама за все время. Статистика автоматически "
|
100 |
+
"обновляется каждый 24 часа."
|
101 |
+
|
102 |
+
#: inc/cleantalk-admin.php:160 inc/cleantalk-settings.php:597
|
103 |
+
#, php-format
|
104 |
+
msgid "Do you like CleanTalk? %sPost your feedback here%s."
|
105 |
+
msgstr "Вам понравился CleanTalk?%s Напишите свой отзыв здесь%s."
|
106 |
+
|
107 |
+
#: inc/cleantalk-admin.php:242
|
108 |
+
msgid "Translate"
|
109 |
+
msgstr "Перевести"
|
110 |
+
|
111 |
+
#: inc/cleantalk-admin.php:245
|
112 |
+
msgid "Start here"
|
113 |
+
msgstr "Начать здесь"
|
114 |
+
|
115 |
+
#: inc/cleantalk-admin.php:246
|
116 |
+
msgid "FAQ"
|
117 |
+
msgstr "FAQ"
|
118 |
+
|
119 |
+
#: inc/cleantalk-admin.php:247 inc/cleantalk-admin.php:597
|
120 |
+
#: inc/cleantalk-settings.php:628
|
121 |
+
msgid "Support"
|
122 |
+
msgstr "Поддержка"
|
123 |
+
|
124 |
+
#: inc/cleantalk-admin.php:320 inc/cleantalk-settings.php:576
|
125 |
+
msgid "Hosting AntiSpam"
|
126 |
+
msgstr "Hosting AntiSpam"
|
127 |
+
|
128 |
+
#: inc/cleantalk-admin.php:330 inc/cleantalk-find-spam.php:18
|
129 |
+
msgid "Find spam comments"
|
130 |
+
msgstr "Найти спам в комментариях"
|
131 |
+
|
132 |
+
#: inc/cleantalk-admin.php:331
|
133 |
+
msgid "The sender has been whitelisted."
|
134 |
+
msgstr "Отправитель был добавлен в белый список."
|
135 |
+
|
136 |
+
#: inc/cleantalk-admin.php:332
|
137 |
+
msgid "The sender has been blacklisted."
|
138 |
+
msgstr "Отправитель был добавлен в черный список."
|
139 |
+
|
140 |
+
#: inc/cleantalk-admin.php:333 inc/cleantalk-public.php:3719
|
141 |
+
#, php-format
|
142 |
+
msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
|
143 |
+
msgstr "Обратная связь отправлена в панель управления %sCleanTalk%s."
|
144 |
+
|
145 |
+
#: inc/cleantalk-admin.php:344
|
146 |
+
msgid "Find spam-users"
|
147 |
+
msgstr "Найти спам-пользователей"
|
148 |
+
|
149 |
+
#: inc/cleantalk-admin.php:398
|
150 |
+
#, php-format
|
151 |
+
msgid "Unable to get Access key automatically: %s"
|
152 |
+
msgstr "Невозможно получить ключ автоматически: %s"
|
153 |
+
|
154 |
+
#: inc/cleantalk-admin.php:399
|
155 |
+
msgid "Get the Access key"
|
156 |
+
msgstr "Получить ключ вручную"
|
157 |
+
|
158 |
+
#: inc/cleantalk-admin.php:408
|
159 |
+
#, php-format
|
160 |
+
msgid "Please enter Access Key in %s settings to enable anti spam protection!"
|
161 |
+
msgstr ""
|
162 |
+
"Пожалуйста, укажите Ключ доступа в настройках %s для активации защиты от "
|
163 |
+
"спама!"
|
164 |
+
|
165 |
+
#: inc/cleantalk-admin.php:418
|
166 |
+
#, php-format
|
167 |
+
msgid "%s trial period ends, please upgrade to %s!"
|
168 |
+
msgstr ""
|
169 |
+
"%s заканчивается ознакомительный срок пользования антиспам плагином "
|
170 |
+
"CleanTalk, пожалуйста продлите подключение %s."
|
171 |
+
|
172 |
+
#: inc/cleantalk-admin.php:431
|
173 |
+
msgid "RENEW ANTI-SPAM"
|
174 |
+
msgstr "ПРОДЛИТЬ АНТИСПАМ"
|
175 |
+
|
176 |
+
#: inc/cleantalk-admin.php:432
|
177 |
+
msgid "next year"
|
178 |
+
msgstr "следующий год"
|
179 |
+
|
180 |
+
#: inc/cleantalk-admin.php:436
|
181 |
+
#, php-format
|
182 |
+
msgid "Please renew your anti-spam license for %s."
|
183 |
+
msgstr "Пожалуйста, продлите свою антиспам-лицензию на %s."
|
184 |
+
|
185 |
+
#: inc/cleantalk-admin.php:464
|
186 |
+
msgid "Make it right!"
|
187 |
+
msgstr "Сделай все правильно!"
|
188 |
+
|
189 |
+
#: inc/cleantalk-admin.php:466
|
190 |
+
#, php-format
|
191 |
+
msgid "%sGet premium%s"
|
192 |
+
msgstr "%sПолучить премиум%s"
|
193 |
+
|
194 |
+
#: inc/cleantalk-admin.php:505
|
195 |
+
msgid "Since"
|
196 |
+
msgstr "От"
|
197 |
+
|
198 |
+
#: inc/cleantalk-admin.php:511
|
199 |
+
msgid ""
|
200 |
+
"All / Allowed / Blocked submissions. The number of submissions is being "
|
201 |
+
"counted since CleanTalk plugin installation."
|
202 |
+
msgstr "Все / Разрешенные / Запрещенные запросы с момента установки CleanTalk."
|
203 |
+
|
204 |
+
#: inc/cleantalk-admin.php:511
|
205 |
+
msgid "All"
|
206 |
+
msgstr "Все"
|
207 |
+
|
208 |
+
#: inc/cleantalk-admin.php:519
|
209 |
+
msgid ""
|
210 |
+
"Allowed / Blocked submissions. The number of submissions for past 24 hours. "
|
211 |
+
msgstr "Разрешенные / Запрещенные запросы за последние 24 часа."
|
212 |
+
|
213 |
+
#: inc/cleantalk-admin.php:519
|
214 |
+
msgid "Day"
|
215 |
+
msgstr "За день"
|
216 |
+
|
217 |
+
#: inc/cleantalk-admin.php:525
|
218 |
+
msgid ""
|
219 |
+
"All / Blocked events. Access attempts regitred by SpamFireWall counted since "
|
220 |
+
"the last plugin activation."
|
221 |
+
msgstr ""
|
222 |
+
"Все / Запрещенные попытки просмотра сайта. Отображет попытки с момента "
|
223 |
+
"последней активации плагина."
|
224 |
+
|
225 |
+
#: inc/cleantalk-admin.php:535
|
226 |
+
msgid ""
|
227 |
+
"Allowed / Blocked submissions. The number of submissions is being counted "
|
228 |
+
"since "
|
229 |
+
msgstr "Разрешенные / Запрещенные попытки."
|
230 |
+
|
231 |
+
#: inc/cleantalk-admin.php:546
|
232 |
+
msgid "dashboard"
|
233 |
+
msgstr "панель управления"
|
234 |
+
|
235 |
+
#: inc/cleantalk-admin.php:553
|
236 |
+
msgid "Settings"
|
237 |
+
msgstr "Настройки"
|
238 |
+
|
239 |
+
#: inc/cleantalk-admin.php:561
|
240 |
+
msgid "Bulk spam comments removal tool."
|
241 |
+
msgstr "Инструмент массового удаления пользователей."
|
242 |
+
|
243 |
+
#: inc/cleantalk-admin.php:561 inc/cleantalk-settings.php:937
|
244 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:11
|
245 |
+
msgid "Check comments for spam"
|
246 |
+
msgstr "Проверка комментариев"
|
247 |
+
|
248 |
+
#: inc/cleantalk-admin.php:571 inc/cleantalk-settings.php:938
|
249 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:11
|
250 |
+
msgid "Check users for spam"
|
251 |
+
msgstr "Проверить пользователей на спам"
|
252 |
+
|
253 |
+
#: inc/cleantalk-admin.php:580
|
254 |
+
msgid "Reset first counter"
|
255 |
+
msgstr "Сбросить первый счетчик"
|
256 |
+
|
257 |
+
#: inc/cleantalk-admin.php:588
|
258 |
+
msgid "Reset all counters"
|
259 |
+
msgstr "Сбросить все счетчики"
|
260 |
+
|
261 |
+
#: inc/cleantalk-find-spam.php:13 inc/cleantalk-find-spam.php:18
|
262 |
+
msgid "Check for spam"
|
263 |
+
msgstr "Проверить на спам"
|
264 |
+
|
265 |
+
#: inc/cleantalk-find-spam.php:13
|
266 |
+
msgid "Find spam users"
|
267 |
+
msgstr "Найти спам-пользователей"
|
268 |
+
|
269 |
+
#: inc/cleantalk-find-spam.php:14 inc/cleantalk-find-spam.php:19
|
270 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:107
|
271 |
+
msgid "Previous scan results"
|
272 |
+
msgstr ""
|
273 |
+
|
274 |
+
#: inc/cleantalk-find-spam.php:15 inc/cleantalk-find-spam.php:20
|
275 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:108
|
276 |
+
msgid "Scan logs"
|
277 |
+
msgstr ""
|
278 |
+
|
279 |
+
#: inc/cleantalk-public.php:553 inc/cleantalk-public.php:711
|
280 |
+
#: inc/cleantalk-public.php:879 inc/cleantalk-public.php:2578
|
281 |
+
#: inc/cleantalk-public.php:3431
|
282 |
+
msgid "Spam protection by CleanTalk"
|
283 |
+
msgstr "Спам защита CleanTalk"
|
284 |
+
|
285 |
+
#: inc/cleantalk-public.php:1386 inc/cleantalk-public.php:1542
|
286 |
+
#: inc/cleantalk-public.php:1561
|
287 |
+
msgid "Spam protection"
|
288 |
+
msgstr "Защита от спама"
|
289 |
+
|
290 |
+
#: inc/cleantalk-public.php:1484
|
291 |
+
msgid "CleanTalk AntiSpam: This message is possible spam."
|
292 |
+
msgstr "CleanTalk AntiSpam: Это сообщение, возможно, является спамом."
|
293 |
+
|
294 |
+
#: inc/cleantalk-public.php:1485
|
295 |
+
msgid "You could check it in CleanTalk's anti-spam database:"
|
296 |
+
msgstr "Вы можете проверить это по антиспам-базе CleanTalk:"
|
297 |
+
|
298 |
+
#: inc/cleantalk-public.php:1515
|
299 |
+
msgid "Check for spam:"
|
300 |
+
msgstr ""
|
301 |
+
|
302 |
+
#: inc/cleantalk-public.php:1758
|
303 |
+
#, php-format
|
304 |
+
msgid "Registration approved by %s."
|
305 |
+
msgstr "Регистрация одобрена %s."
|
306 |
+
|
307 |
+
#: inc/cleantalk-public.php:2042
|
308 |
+
msgid "CleanTalk AntiSpam: This registration is spam."
|
309 |
+
msgstr "CleanTalk AntiSpam: Эта регистрация - спам."
|
310 |
+
|
311 |
+
#: inc/cleantalk-public.php:2043 inc/cleantalk-public.php:2421
|
312 |
+
#: inc/cleantalk-public.php:2602 inc/cleantalk-public.php:2758
|
313 |
+
msgid "CleanTalk's anti-spam database:"
|
314 |
+
msgstr "Антиспам-база CleanTalk:"
|
315 |
+
|
316 |
+
#: inc/cleantalk-public.php:2420 inc/cleantalk-public.php:2601
|
317 |
+
#: inc/cleantalk-public.php:2757
|
318 |
+
msgid "CleanTalk AntiSpam: This message is spam."
|
319 |
+
msgstr "CleanTalk AntiSpam: Это сообщение - спам."
|
320 |
+
|
321 |
+
#: inc/cleantalk-public.php:2888
|
322 |
+
msgid "Comment approved. Anti-spam by CleanTalk."
|
323 |
+
msgstr "Комментарий одобрен. Антиспам от CleanTalk."
|
324 |
+
|
325 |
+
#: inc/cleantalk-public.php:3609
|
326 |
+
msgid "Attention, please!"
|
327 |
+
msgstr "Внимание!"
|
328 |
+
|
329 |
+
#: inc/cleantalk-public.php:3610
|
330 |
+
#, php-format
|
331 |
+
msgid "\"%s\" plugin error on your site \"%s\":"
|
332 |
+
msgstr "\"%s\" ошибка плагина на сайте \"%s\":"
|
333 |
+
|
334 |
+
#: inc/cleantalk-public.php:3612
|
335 |
+
#, php-format
|
336 |
+
msgid "[%s] \"%s\" error!"
|
337 |
+
msgstr "[%s] \"%s\" ошибка!"
|
338 |
+
|
339 |
+
#: inc/cleantalk-public.php:3669
|
340 |
+
msgid ""
|
341 |
+
"By using this form you agree with the storage and processing of your data by "
|
342 |
+
"using the Privacy Policy on this website."
|
343 |
+
msgstr ""
|
344 |
+
"Используя эту форму, вы соглашаетесь с хранением и обработкой ваших данных, "
|
345 |
+
"в соответствии с Политикой конфиденциальности на этом сайте."
|
346 |
+
|
347 |
+
#: inc/cleantalk-public.php:3717
|
348 |
+
msgid "Error occurred while sending feedback."
|
349 |
+
msgstr "Случилась ошибка при отправке обратной связи."
|
350 |
+
|
351 |
+
#: inc/cleantalk-public.php:3718
|
352 |
+
msgid "Feedback wasn't sent. There is no associated request."
|
353 |
+
msgstr "Обратная связь не была отправлена. Нет связанного запроса."
|
354 |
+
|
355 |
+
#: inc/cleantalk-public.php:3768
|
356 |
+
msgid "Sender info"
|
357 |
+
msgstr "Информация об отправителе"
|
358 |
+
|
359 |
+
#: inc/cleantalk-public.php:3771
|
360 |
+
msgid "by"
|
361 |
+
msgstr " от"
|
362 |
+
|
363 |
+
#: inc/cleantalk-public.php:3782
|
364 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:60
|
365 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:64
|
366 |
+
msgid "No email"
|
367 |
+
msgstr "Email отсутствует"
|
368 |
+
|
369 |
+
#: inc/cleantalk-public.php:3792
|
370 |
+
msgid "No IP"
|
371 |
+
msgstr "IP отсутствует"
|
372 |
+
|
373 |
+
#: inc/cleantalk-public.php:3795
|
374 |
+
msgid "Mark as spam"
|
375 |
+
msgstr "Отметить как спам"
|
376 |
+
|
377 |
+
#: inc/cleantalk-public.php:3796
|
378 |
+
msgid "Unspam"
|
379 |
+
msgstr "Вернуть из спама"
|
380 |
+
|
381 |
+
#: inc/cleantalk-public.php:3798
|
382 |
+
msgid "Marked as spam."
|
383 |
+
msgstr "Отмечено как спам."
|
384 |
+
|
385 |
+
#: inc/cleantalk-public.php:3799
|
386 |
+
msgid "Marked as not spam."
|
387 |
+
msgstr "Отмечено как не спам."
|
388 |
+
|
389 |
+
#: inc/cleantalk-settings.php:96 inc/cleantalk-settings.php:822
|
390 |
+
msgid "SpamFireWall"
|
391 |
+
msgstr "SpamFireWall"
|
392 |
+
|
393 |
+
#: inc/cleantalk-settings.php:97
|
394 |
+
msgid ""
|
395 |
+
"This option allows to filter spam bots before they access website. Also "
|
396 |
+
"reduces CPU usage on hosting server and accelerates pages load time."
|
397 |
+
msgstr ""
|
398 |
+
"Эта опция позволяет фильтровать спам-ботов прежде, чем они войдут на сайт. "
|
399 |
+
"Также уменьшает загрузку процессора на хостинге и ускоряет время загрузки "
|
400 |
+
"страниц."
|
401 |
+
|
402 |
+
#: inc/cleantalk-settings.php:104
|
403 |
+
msgid "Forms to protect"
|
404 |
+
msgstr "Защищаемые формы"
|
405 |
+
|
406 |
+
#: inc/cleantalk-settings.php:110
|
407 |
+
msgid "Advanced settings"
|
408 |
+
msgstr "Продвинутые настройки"
|
409 |
+
|
410 |
+
#: inc/cleantalk-settings.php:117
|
411 |
+
msgid "Registration Forms"
|
412 |
+
msgstr "Формы регистрации"
|
413 |
+
|
414 |
+
#: inc/cleantalk-settings.php:118
|
415 |
+
msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
416 |
+
msgstr "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
417 |
+
|
418 |
+
#: inc/cleantalk-settings.php:121
|
419 |
+
msgid "Comments form"
|
420 |
+
msgstr "Комментарии в блоге"
|
421 |
+
|
422 |
+
#: inc/cleantalk-settings.php:122
|
423 |
+
msgid "WordPress, JetPack, WooCommerce."
|
424 |
+
msgstr "WordPress, JetPack, WooCommerce."
|
425 |
+
|
426 |
+
#: inc/cleantalk-settings.php:125 inc/cleantalk-settings.php:817
|
427 |
+
msgid "Contact forms"
|
428 |
+
msgstr "Контактные формы"
|
429 |
+
|
430 |
+
#: inc/cleantalk-settings.php:126
|
431 |
+
msgid ""
|
432 |
+
"Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
|
433 |
+
"WordPress Landing Pages, Gravity Forms."
|
434 |
+
msgstr ""
|
435 |
+
"Contact Form 7, Formidable Forms, Jetpack, Fast Secure Contact Form, "
|
436 |
+
"WordPress Landing Pages, Gravity Forms."
|
437 |
+
|
438 |
+
#: inc/cleantalk-settings.php:129 inc/cleantalk-settings.php:818
|
439 |
+
msgid "Custom contact forms"
|
440 |
+
msgstr "Произвольные контактные формы"
|
441 |
+
|
442 |
+
#: inc/cleantalk-settings.php:130
|
443 |
+
msgid "Anti spam test for any WordPress themes or contacts forms."
|
444 |
+
msgstr "Защита от спама любой контактной формы или темы."
|
445 |
+
|
446 |
+
#: inc/cleantalk-settings.php:133
|
447 |
+
msgid "Test default Wordpress search form for spam"
|
448 |
+
msgstr "Стандартная форма поиска Wordpress"
|
449 |
+
|
450 |
+
#: inc/cleantalk-settings.php:134
|
451 |
+
msgid "Spam protection for Search form."
|
452 |
+
msgstr "Защита от спама для Форм поиска."
|
453 |
+
|
454 |
+
#: inc/cleantalk-settings.php:136
|
455 |
+
#, php-format
|
456 |
+
msgid ""
|
457 |
+
"Read more about %sspam protection for Search form%s on our blog. “noindex” "
|
458 |
+
"tag will be placed in meta derictive on search page."
|
459 |
+
msgstr ""
|
460 |
+
|
461 |
+
#: inc/cleantalk-settings.php:144
|
462 |
+
msgid "Protect external forms"
|
463 |
+
msgstr "Защита внешних форм"
|
464 |
+
|
465 |
+
#: inc/cleantalk-settings.php:145
|
466 |
+
msgid ""
|
467 |
+
"Turn this option on to protect forms on your WordPress that send data to "
|
468 |
+
"third-part servers (like MailChimp)."
|
469 |
+
msgstr ""
|
470 |
+
"Включите эту опцию, что бы защитить формы, которые отсылают данные на "
|
471 |
+
"сторонние ресурсы, например MailChimp."
|
472 |
+
|
473 |
+
#: inc/cleantalk-settings.php:149
|
474 |
+
msgid "Capture buffer"
|
475 |
+
msgstr "Захват буфера"
|
476 |
+
|
477 |
+
#: inc/cleantalk-settings.php:150
|
478 |
+
msgid ""
|
479 |
+
"This setting gives you more sophisticated and strengthened protection for "
|
480 |
+
"external forms. But it could break plugins which use a buffer like Ninja "
|
481 |
+
"Forms."
|
482 |
+
msgstr ""
|
483 |
+
"Этот параметр дает вам более сложную и усиленную защиту для внешних форм. Но "
|
484 |
+
"это может сломать плагины, которые используют буфер, такой как Ninja Forms."
|
485 |
+
|
486 |
+
#: inc/cleantalk-settings.php:155
|
487 |
+
msgid "Protect internal forms"
|
488 |
+
msgstr "Защита внутренних форм"
|
489 |
+
|
490 |
+
#: inc/cleantalk-settings.php:156
|
491 |
+
msgid ""
|
492 |
+
"This option will enable protection for custom (hand-made) AJAX forms with "
|
493 |
+
"PHP scripts handlers on your WordPress."
|
494 |
+
msgstr "Эта опция обеспечит защиту созданных вручную форм, использующих AJAX."
|
495 |
+
|
496 |
+
#: inc/cleantalk-settings.php:163
|
497 |
+
msgid "WooCommerce"
|
498 |
+
msgstr ""
|
499 |
+
|
500 |
+
#: inc/cleantalk-settings.php:166 inc/cleantalk-settings.php:831
|
501 |
+
msgid "WooCommerce checkout form"
|
502 |
+
msgstr "Форма заказа WooCommerce"
|
503 |
+
|
504 |
+
#: inc/cleantalk-settings.php:167
|
505 |
+
msgid "Anti spam test for WooCommerce checkout form."
|
506 |
+
msgstr "Спам тест для формы заказа WooCommerce"
|
507 |
+
|
508 |
+
#: inc/cleantalk-settings.php:171
|
509 |
+
msgid "Spam test for registration during checkout"
|
510 |
+
msgstr "Регистрация на странице заказа"
|
511 |
+
|
512 |
+
#: inc/cleantalk-settings.php:172
|
513 |
+
msgid ""
|
514 |
+
"Enable anti spam test for registration process which during woocommerce's "
|
515 |
+
"checkout."
|
516 |
+
msgstr ""
|
517 |
+
"Включить защиту от спама в регистрациях, которые проходят во время "
|
518 |
+
"оформления заказа."
|
519 |
+
|
520 |
+
#: inc/cleantalk-settings.php:182
|
521 |
+
msgid "Comments and Messages"
|
522 |
+
msgstr "Комментарии и сообщения"
|
523 |
+
|
524 |
+
#: inc/cleantalk-settings.php:185
|
525 |
+
msgid "Disable all comments"
|
526 |
+
msgstr ""
|
527 |
+
|
528 |
+
#: inc/cleantalk-settings.php:186
|
529 |
+
msgid "Disabling comments for all types of content."
|
530 |
+
msgstr ""
|
531 |
+
|
532 |
+
#: inc/cleantalk-settings.php:198
|
533 |
+
msgid "Disable comments for all posts"
|
534 |
+
msgstr ""
|
535 |
+
|
536 |
+
#: inc/cleantalk-settings.php:204
|
537 |
+
msgid "Disable comments for all pages"
|
538 |
+
msgstr ""
|
539 |
+
|
540 |
+
#: inc/cleantalk-settings.php:210
|
541 |
+
msgid "Disable comments for all media"
|
542 |
+
msgstr ""
|
543 |
+
|
544 |
+
#: inc/cleantalk-settings.php:216
|
545 |
+
msgid "BuddyPress Private Messages"
|
546 |
+
msgstr "Личные сообщения buddyPress"
|
547 |
+
|
548 |
+
#: inc/cleantalk-settings.php:217
|
549 |
+
msgid "Check buddyPress private messages."
|
550 |
+
msgstr "Проверять личные сообщения buddyPress "
|
551 |
+
|
552 |
+
#: inc/cleantalk-settings.php:220
|
553 |
+
msgid "Automatically delete spam comments"
|
554 |
+
msgstr "Автоматически удалять спам-комментарии"
|
555 |
+
|
556 |
+
#: inc/cleantalk-settings.php:221
|
557 |
+
#, php-format
|
558 |
+
msgid "Delete spam comments older than %d days."
|
559 |
+
msgstr "Удалять комментарии старше %d дней."
|
560 |
+
|
561 |
+
#: inc/cleantalk-settings.php:224
|
562 |
+
msgid "Remove links from approved comments"
|
563 |
+
msgstr "Удалять ссылки из одобреных комментариев"
|
564 |
+
|
565 |
+
#: inc/cleantalk-settings.php:225
|
566 |
+
msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
|
567 |
+
msgstr "Удалять ссылки из одобренных сообщений"
|
568 |
+
|
569 |
+
#: inc/cleantalk-settings.php:228
|
570 |
+
#, fuzzy
|
571 |
+
#| msgid "Show links to check Emails, IPs for spam."
|
572 |
+
msgid "Show links to check Emails, IPs for spam"
|
573 |
+
msgstr "Отобразить ссылки для проверки Email'ов и IP адресов."
|
574 |
+
|
575 |
+
#: inc/cleantalk-settings.php:229
|
576 |
+
msgid ""
|
577 |
+
"Shows little icon near IP addresses and Emails allowing you to check it via "
|
578 |
+
"CleanTalk's database."
|
579 |
+
msgstr ""
|
580 |
+
|
581 |
+
#: inc/cleantalk-settings.php:233
|
582 |
+
msgid "Manage comments on public pages"
|
583 |
+
msgstr ""
|
584 |
+
|
585 |
+
#: inc/cleantalk-settings.php:234
|
586 |
+
msgid ""
|
587 |
+
"Allows administrators to manage comments on public post's pages with small "
|
588 |
+
"interactive menu."
|
589 |
+
msgstr ""
|
590 |
+
|
591 |
+
#: inc/cleantalk-settings.php:242
|
592 |
+
msgid "Data Processing"
|
593 |
+
msgstr "Обработка данных"
|
594 |
+
|
595 |
+
#: inc/cleantalk-settings.php:245
|
596 |
+
msgid "Protect logged in Users"
|
597 |
+
msgstr "Проверять залогиненых пользователей"
|
598 |
+
|
599 |
+
#: inc/cleantalk-settings.php:246
|
600 |
+
msgid ""
|
601 |
+
"Turn this option on to check for spam any submissions (comments, contact "
|
602 |
+
"forms and etc.) from registered Users."
|
603 |
+
msgstr "Включите, чтобы проверять зарегистрированных пользователей."
|
604 |
+
|
605 |
+
#: inc/cleantalk-settings.php:249
|
606 |
+
msgid "Don't check trusted user's comments"
|
607 |
+
msgstr "Не проверять доверенных пользователей"
|
608 |
+
|
609 |
+
#: inc/cleantalk-settings.php:250
|
610 |
+
#, php-format
|
611 |
+
msgid "Don't check comments for users with above %d comments."
|
612 |
+
msgstr "Не проверять комментарии пользователей с более %d комментариями."
|
613 |
+
|
614 |
+
#: inc/cleantalk-settings.php:253
|
615 |
+
msgid "Use AJAX for JavaScript check"
|
616 |
+
msgstr "Использовать AJAX для проверки JavaScript"
|
617 |
+
|
618 |
+
#: inc/cleantalk-settings.php:254
|
619 |
+
msgid ""
|
620 |
+
"Options helps protect WordPress against spam with any caching plugins. Turn "
|
621 |
+
"this option on to avoid issues with caching plugins."
|
622 |
+
msgstr "Данная настройка помогает избежать конфликтов с кеширующими плагинами."
|
623 |
+
|
624 |
+
#: inc/cleantalk-settings.php:257
|
625 |
+
msgid "Use static keys for JS check."
|
626 |
+
msgstr "Использовать постоянный (статичный) ключ для проверки JS."
|
627 |
+
|
628 |
+
#: inc/cleantalk-settings.php:258
|
629 |
+
msgid ""
|
630 |
+
"Could help if you have cache for AJAX requests and you are dealing with "
|
631 |
+
"false positives. Slightly decreases protection quality. Auto - Static key "
|
632 |
+
"will be used if caching plugin is spotted."
|
633 |
+
msgstr ""
|
634 |
+
"Может помочь, если у вас кешируются запросы AJAX и вы имеете дело с ложными "
|
635 |
+
"срабатываниями. Немного снижает качество защиты. Статический ключ будет "
|
636 |
+
"использоваться автоматически, если обнаружен плагин кэширования."
|
637 |
+
|
638 |
+
#: inc/cleantalk-settings.php:266
|
639 |
+
msgid "Check all post data"
|
640 |
+
msgstr "Проверять все POST-данные"
|
641 |
+
|
642 |
+
#: inc/cleantalk-settings.php:267
|
643 |
+
msgid ""
|
644 |
+
"Check all POST submissions from website visitors. Enable this option if you "
|
645 |
+
"have spam misses on website."
|
646 |
+
msgstr ""
|
647 |
+
"Проверять все POST-данные, отправляемые посетителями. Активируйте, если у "
|
648 |
+
"вас есть спам на сайте."
|
649 |
+
|
650 |
+
#: inc/cleantalk-settings.php:269
|
651 |
+
msgid " Or you don`t have records about missed spam here:"
|
652 |
+
msgstr " Или у вас нет записей о спаме здесь:"
|
653 |
+
|
654 |
+
#: inc/cleantalk-settings.php:269
|
655 |
+
msgid "CleanTalk dashboard"
|
656 |
+
msgstr "панель управления CleanTalk"
|
657 |
+
|
658 |
+
#: inc/cleantalk-settings.php:272
|
659 |
+
msgid "СAUTION! Option can catch POST requests in WordPress backend"
|
660 |
+
msgstr ""
|
661 |
+
"ВНИМАНИЕ! Опция может перехватывать все POST запросы в панели управления "
|
662 |
+
"Wordpress. Отключите, если возникают проблемы/ошибки."
|
663 |
+
|
664 |
+
#: inc/cleantalk-settings.php:275
|
665 |
+
msgid "Set cookies"
|
666 |
+
msgstr "Устанавливать куки"
|
667 |
+
|
668 |
+
#: inc/cleantalk-settings.php:276
|
669 |
+
msgid ""
|
670 |
+
"Turn this option off to deny plugin generates any cookies on website front-"
|
671 |
+
"end. This option is helpful if you use Varnish. But most of contact forms "
|
672 |
+
"will not be protected if the option is turned off! <b>Warning: We strongly "
|
673 |
+
"recommend you to enable this otherwise it could cause false positives spam "
|
674 |
+
"detection.</b>"
|
675 |
+
msgstr ""
|
676 |
+
"Отключите эту опцию, чтобы запретить плагину создавать любые файлы cookies "
|
677 |
+
"на веб-сайте. Эта опция полезна, если вы используете Varnish. Но большинство "
|
678 |
+
"контактных форм не будут защищены, если опция отключена! <b>ВНИМАНИЕ! Мы "
|
679 |
+
"настоятельно рекомендуем не отключать опцию, иначе это может привести к "
|
680 |
+
"ложному обнаружению спама.</b>"
|
681 |
+
|
682 |
+
#: inc/cleantalk-settings.php:280
|
683 |
+
msgid "Use alternative mechanism for cookies"
|
684 |
+
msgstr "Использовать альтернативный механизм хранения файлов cookie"
|
685 |
+
|
686 |
+
#: inc/cleantalk-settings.php:281 inc/cleantalk-settings.php:403
|
687 |
+
msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
|
688 |
+
msgstr ""
|
689 |
+
"Не использовать файлы cookies или PHP-сессии. Собирать данные обо всех типах "
|
690 |
+
"ботов."
|
691 |
+
|
692 |
+
#: inc/cleantalk-settings.php:286
|
693 |
+
msgid "Use SSL"
|
694 |
+
msgstr "Использовать SSL"
|
695 |
+
|
696 |
+
#: inc/cleantalk-settings.php:287
|
697 |
+
msgid "Turn this option on to use encrypted (SSL) connection with servers."
|
698 |
+
msgstr ""
|
699 |
+
"Включите эту опцию для использования защищенного (SSL) соединения между "
|
700 |
+
"серверами."
|
701 |
+
|
702 |
+
#: inc/cleantalk-settings.php:290
|
703 |
+
msgid "Use Wordpress HTTP API"
|
704 |
+
msgstr "Использовать стандартное Wordpress HTTP API"
|
705 |
+
|
706 |
+
#: inc/cleantalk-settings.php:291
|
707 |
+
msgid ""
|
708 |
+
"Alternative way to connect the Cloud. Use this if you have connection "
|
709 |
+
"problems."
|
710 |
+
msgstr ""
|
711 |
+
"Альтернативный способ подключения к CleanTalk Cloud. Используйте, если вы "
|
712 |
+
"имеете проблемы с подключением."
|
713 |
+
|
714 |
+
#: inc/cleantalk-settings.php:298
|
715 |
+
msgid "Exclusions"
|
716 |
+
msgstr "Исключения"
|
717 |
+
|
718 |
+
#: inc/cleantalk-settings.php:302
|
719 |
+
msgid "URL exclusions"
|
720 |
+
msgstr "Исключения по URL"
|
721 |
+
|
722 |
+
#: inc/cleantalk-settings.php:303
|
723 |
+
msgid "You could type here URL you want to exclude. Use comma as separator."
|
724 |
+
msgstr ""
|
725 |
+
"Вы можете ввести здесь URL, который вы хотите исключить. Используйте запятую "
|
726 |
+
"в качестве разделителя."
|
727 |
+
|
728 |
+
#: inc/cleantalk-settings.php:307
|
729 |
+
msgid "Use Regular Expression in URL Exclusions"
|
730 |
+
msgstr "Использовать регулярное выражение в исключении по URL"
|
731 |
+
|
732 |
+
#: inc/cleantalk-settings.php:311
|
733 |
+
msgid "Field name exclusions"
|
734 |
+
msgstr "Исключение по имени поля"
|
735 |
+
|
736 |
+
#: inc/cleantalk-settings.php:312
|
737 |
+
msgid ""
|
738 |
+
"You could type here fields names you want to exclude. Use comma as separator."
|
739 |
+
msgstr ""
|
740 |
+
"Вы можете ввести здесь имена полей, которые вы хотите исключить. Используйте "
|
741 |
+
"запятую в качестве разделителя."
|
742 |
+
|
743 |
+
#: inc/cleantalk-settings.php:316
|
744 |
+
msgid "Use Regular Expression in Field Exclusions"
|
745 |
+
msgstr "Использовать регулярное выражение в исключении по полю формы."
|
746 |
+
|
747 |
+
#: inc/cleantalk-settings.php:323
|
748 |
+
msgid "Roles which bypass spam test. Hold CTRL to select multiple roles."
|
749 |
+
msgstr ""
|
750 |
+
"Роли, которые обходят проверку на спам. Удерживайте CTRL, чтобы выбрать "
|
751 |
+
"несколько ролей."
|
752 |
+
|
753 |
+
#: inc/cleantalk-settings.php:330
|
754 |
+
msgid "Admin bar"
|
755 |
+
msgstr "Админ-бар"
|
756 |
+
|
757 |
+
#: inc/cleantalk-settings.php:337
|
758 |
+
msgid "Show statistics in admin bar"
|
759 |
+
msgstr "Показывать статистику в админбаре"
|
760 |
+
|
761 |
+
#: inc/cleantalk-settings.php:338
|
762 |
+
msgid ""
|
763 |
+
"Show/hide icon in top level menu in WordPress backend. The number of "
|
764 |
+
"submissions is being counted for past 24 hours."
|
765 |
+
msgstr ""
|
766 |
+
"Показать/скрыть иконку в админ-баре WordPress. Статистика подсчитывается за "
|
767 |
+
"последние 24 часа."
|
768 |
+
|
769 |
+
#: inc/cleantalk-settings.php:342
|
770 |
+
msgid "Show All-time counter"
|
771 |
+
msgstr "Счетчик за все время"
|
772 |
+
|
773 |
+
#: inc/cleantalk-settings.php:343
|
774 |
+
msgid ""
|
775 |
+
"Display all-time requests counter in the admin bar. Counter displays number "
|
776 |
+
"of requests since plugin installation."
|
777 |
+
msgstr ""
|
778 |
+
"Отображать счетчик запросов за все время в админ-баре. Счетчик показывает "
|
779 |
+
"записи с момента установки."
|
780 |
+
|
781 |
+
#: inc/cleantalk-settings.php:348
|
782 |
+
msgid "Show 24 hours counter"
|
783 |
+
msgstr "24-х часовой счетчик"
|
784 |
+
|
785 |
+
#: inc/cleantalk-settings.php:349
|
786 |
+
msgid ""
|
787 |
+
"Display daily requests counter in the admin bar. Counter displays number of "
|
788 |
+
"requests of the past 24 hours."
|
789 |
+
msgstr ""
|
790 |
+
"Отображать 24-х часовой счетчик запросов в админ-баре. Отображает запросы за "
|
791 |
+
"последние 24 часа."
|
792 |
+
|
793 |
+
#: inc/cleantalk-settings.php:354
|
794 |
+
msgid "SpamFireWall counter"
|
795 |
+
msgstr "Счетчик SpamFireWall"
|
796 |
+
|
797 |
+
#: inc/cleantalk-settings.php:355
|
798 |
+
msgid ""
|
799 |
+
"Display SpamFireWall requests in the admin bar. Counter displays number of "
|
800 |
+
"requests since plugin installation."
|
801 |
+
msgstr ""
|
802 |
+
"Отображать счетчик SpamFireWall запросов в админ-баре. Отображает количество "
|
803 |
+
"запросов с момента установки плагина."
|
804 |
+
|
805 |
+
#: inc/cleantalk-settings.php:368
|
806 |
+
msgid "Collect details about browsers"
|
807 |
+
msgstr "Собирать данные браузера"
|
808 |
+
|
809 |
+
#: inc/cleantalk-settings.php:369
|
810 |
+
msgid ""
|
811 |
+
"Checking this box you allow plugin store information about screen size and "
|
812 |
+
"browser plugins of website visitors. The option in a beta state."
|
813 |
+
msgstr ""
|
814 |
+
"Включая эту опцию, Вы разрешаете плагину хранить информацию о размере экрана "
|
815 |
+
"и плагинах браузера посетителей. Бета опция."
|
816 |
+
|
817 |
+
#: inc/cleantalk-settings.php:373
|
818 |
+
msgid "Send connection reports"
|
819 |
+
msgstr "Отправлять отчеты о соединении"
|
820 |
+
|
821 |
+
#: inc/cleantalk-settings.php:374
|
822 |
+
msgid ""
|
823 |
+
"Checking this box you allow plugin to send the information about your "
|
824 |
+
"connection. The option in a beta state."
|
825 |
+
msgstr ""
|
826 |
+
"Ставя эту галочку вы разрешаете плагину отрпавлять информацию о интернет-"
|
827 |
+
"соединении. Опция находится на бета-тестировании."
|
828 |
+
|
829 |
+
#: inc/cleantalk-settings.php:378
|
830 |
+
msgid "Async JavaScript loading"
|
831 |
+
msgstr "Асинхронная загрузка JavaScript"
|
832 |
+
|
833 |
+
#: inc/cleantalk-settings.php:379
|
834 |
+
msgid ""
|
835 |
+
"Use async loading for scripts. Warning: This could reduce filtration quality."
|
836 |
+
msgstr ""
|
837 |
+
"Использовать асинхронную загрузку JS-скриптов. ВНИМАНИЕ! это может понизить "
|
838 |
+
"качество спам-фильтра."
|
839 |
+
|
840 |
+
#: inc/cleantalk-settings.php:383
|
841 |
+
msgid "Allow to add GDPR notice via shortcode"
|
842 |
+
msgstr "Разрешить добавление GDPR-уведомления с помощью шордкода"
|
843 |
+
|
844 |
+
#: inc/cleantalk-settings.php:384
|
845 |
+
msgid ""
|
846 |
+
" Adds small checkbox under your website form. To add it you should use the "
|
847 |
+
"shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
848 |
+
msgstr ""
|
849 |
+
"Добавить не большой чекбокс в форму. Для добавления уведомления вставьте на "
|
850 |
+
"странице с формой этот шорткод: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
851 |
+
|
852 |
+
#: inc/cleantalk-settings.php:389
|
853 |
+
msgid "GDPR text notice"
|
854 |
+
msgstr "Текст GDPR-уведомления"
|
855 |
+
|
856 |
+
#: inc/cleantalk-settings.php:390
|
857 |
+
msgid "This text will be added as a description to the GDPR checkbox."
|
858 |
+
msgstr "Этот текст будет добавлен к чекбоксу как описание."
|
859 |
+
|
860 |
+
#: inc/cleantalk-settings.php:396
|
861 |
+
msgid "Store visited URLs"
|
862 |
+
msgstr "Хранить посещенные URL-ы"
|
863 |
+
|
864 |
+
#: inc/cleantalk-settings.php:397
|
865 |
+
msgid ""
|
866 |
+
"Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
|
867 |
+
"form on the site. You can see stored visited URLS for each visitor in your "
|
868 |
+
"Dashboard. Turn the option on to improve Anti-Spam protection."
|
869 |
+
msgstr ""
|
870 |
+
"Плагин хранит последние 10 посещенных URL (HTTP REFFERERS) до того, как "
|
871 |
+
"посетитель отправит форму на сайт. Вы можете видеть сохраненные посещенные "
|
872 |
+
"URL-адреса для каждого посетителя на своей панели инструментов. Включите эту "
|
873 |
+
"опцию, чтобы улучшить защиту от спама."
|
874 |
+
|
875 |
+
#: inc/cleantalk-settings.php:402
|
876 |
+
msgid "Use cookies less sessions"
|
877 |
+
msgstr "Использовать сеансы без cookies"
|
878 |
+
|
879 |
+
#: inc/cleantalk-settings.php:409
|
880 |
+
msgid ""
|
881 |
+
"Notify users with selected roles about new approved comments. Hold CTRL to "
|
882 |
+
"select multiple roles."
|
883 |
+
msgstr ""
|
884 |
+
"Уведомлять пользователей с выбранными ролями о новых одобренных комментариях."
|
885 |
+
" Удерживайте CTRL для выбора нескольких ролей."
|
886 |
+
|
887 |
+
#: inc/cleantalk-settings.php:410
|
888 |
+
#, php-format
|
889 |
+
msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
|
890 |
+
msgstr "Если включено, переопределяет аналогичные %sнастройки Wordpress%s."
|
891 |
+
|
892 |
+
#: inc/cleantalk-settings.php:423
|
893 |
+
msgid "Complete deactivation"
|
894 |
+
msgstr "Полная деактивация"
|
895 |
+
|
896 |
+
#: inc/cleantalk-settings.php:424
|
897 |
+
msgid "Leave no trace in the system after deactivation."
|
898 |
+
msgstr "Не оставлять следов в системе после деактивации."
|
899 |
+
|
900 |
+
#: inc/cleantalk-settings.php:441
|
901 |
+
msgid "Enable White Label Mode"
|
902 |
+
msgstr "Активировать White Label Mode."
|
903 |
+
|
904 |
+
#: inc/cleantalk-settings.php:442
|
905 |
+
#, php-format
|
906 |
+
msgid "Learn more information %shere%s."
|
907 |
+
msgstr "Узнать больше информации %sздесь%s"
|
908 |
+
|
909 |
+
#: inc/cleantalk-settings.php:448
|
910 |
+
msgid "Hoster API Key"
|
911 |
+
msgstr "Хостинг API ключ"
|
912 |
+
|
913 |
+
#: inc/cleantalk-settings.php:449
|
914 |
+
#, php-format
|
915 |
+
msgid "You can get it in %sCleantalk's Control Panel%s"
|
916 |
+
msgstr "Вы можете получить ключ в вашей %sпанели управления CleanTalk%s"
|
917 |
+
|
918 |
+
#: inc/cleantalk-settings.php:457
|
919 |
+
msgid "Plugin name"
|
920 |
+
msgstr "Наименование плагина"
|
921 |
+
|
922 |
+
#: inc/cleantalk-settings.php:458
|
923 |
+
#, php-format
|
924 |
+
msgid "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s"
|
925 |
+
msgstr ""
|
926 |
+
"Укажите название плагина. Оставьте пустым для названия по умолчанию "
|
927 |
+
"%sAntispam by Cleantalk%s"
|
928 |
+
|
929 |
+
#: inc/cleantalk-settings.php:467
|
930 |
+
msgid "Allow users to use other key"
|
931 |
+
msgstr "Позволяет пользователям использовать другой ключ."
|
932 |
+
|
933 |
+
#: inc/cleantalk-settings.php:468
|
934 |
+
msgid ""
|
935 |
+
"Allow users to use different Access key in their plugin settings on child "
|
936 |
+
"blogs. They could use different CleanTalk account."
|
937 |
+
msgstr ""
|
938 |
+
"Позволяет пользователям использовать разные Ключи доступа в настройках "
|
939 |
+
"плагина на их дочерних блогах. Они могут использовать разные аккаунты "
|
940 |
+
"CleanTalk."
|
941 |
+
|
942 |
+
#: inc/cleantalk-settings.php:471
|
943 |
+
msgid ""
|
944 |
+
"Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key "
|
945 |
+
"from this constant. Look into wp-config.php"
|
946 |
+
msgstr ""
|
947 |
+
"Константа <b>CLEANTALK_ACCESS_KEY</b> установлена. Все дочерние сайты будут "
|
948 |
+
"использовать ключ доступа из этой контсанты. Смотри в wp-config.php"
|
949 |
+
|
950 |
+
#: inc/cleantalk-settings.php:473
|
951 |
+
msgid ""
|
952 |
+
"You are not able to use white label mode while <b>CLEANTALK_ACCESS_KEY</b> "
|
953 |
+
"is defined."
|
954 |
+
msgstr ""
|
955 |
+
|
956 |
+
#: inc/cleantalk-settings.php:483
|
957 |
+
msgid "Allow users to manage plugin settings"
|
958 |
+
msgstr ""
|
959 |
+
|
960 |
+
#: inc/cleantalk-settings.php:484
|
961 |
+
msgid "Allow to change settings on child sites."
|
962 |
+
msgstr ""
|
963 |
+
|
964 |
+
#: inc/cleantalk-settings.php:586
|
965 |
+
msgid "CleanTalk's tech support:"
|
966 |
+
msgstr "Техническия поддержка CleanTalk: "
|
967 |
+
|
968 |
+
#: inc/cleantalk-settings.php:592
|
969 |
+
msgid "Plugin Homepage at"
|
970 |
+
msgstr "Домашняя страница плагина на"
|
971 |
+
|
972 |
+
#: inc/cleantalk-settings.php:593
|
973 |
+
msgid "GDPR compliance"
|
974 |
+
msgstr "Соответствие GDPR"
|
975 |
+
|
976 |
+
#: inc/cleantalk-settings.php:594
|
977 |
+
msgid "Use s@cleantalk.org to test plugin in any WordPress form."
|
978 |
+
msgstr ""
|
979 |
+
"Используйте s@cleantalk.org чтобы проверить плагин в любой форме в WordPress."
|
980 |
+
|
981 |
+
#: inc/cleantalk-settings.php:595
|
982 |
+
msgid "CleanTalk is registered Trademark. All rights reserved."
|
983 |
+
msgstr "CleanTalk - это зарегистрированая торговая марка. Все права защищены."
|
984 |
+
|
985 |
+
#: inc/cleantalk-settings.php:612
|
986 |
+
#, php-format
|
987 |
+
msgid "%s has blocked <b>%s</b> spam."
|
988 |
+
msgstr "%s заблокировал <b>%s</b> спама."
|
989 |
+
|
990 |
+
#: inc/cleantalk-settings.php:624
|
991 |
+
msgid "Click here to get anti-spam statistics"
|
992 |
+
msgstr "Щелкните, чтобы получить статистику"
|
993 |
+
|
994 |
+
#: inc/cleantalk-settings.php:669
|
995 |
+
#, php-format
|
996 |
+
msgid "Please, enter the %splugin settings%s in main site dashboard."
|
997 |
+
msgstr ""
|
998 |
+
"Пожалуйста, перейдите в %sнастройки плагина%s в панели управления на главном "
|
999 |
+
"сайте."
|
1000 |
+
|
1001 |
+
#: inc/cleantalk-settings.php:688
|
1002 |
+
msgid "Error occurred while API key validating. Error: "
|
1003 |
+
msgstr "Произошла ошибка при проверке ключа API. Ошибка: "
|
1004 |
+
|
1005 |
+
#: inc/cleantalk-settings.php:689
|
1006 |
+
msgid "Error occurred while automatically gettings access key. Error: "
|
1007 |
+
msgstr "Произошла ошибка при автоматическом получении ключа доступа. Ошибка: "
|
1008 |
+
|
1009 |
+
#: inc/cleantalk-settings.php:690
|
1010 |
+
msgid "Error occurred while sending SpamFireWall logs. Error: "
|
1011 |
+
msgstr ""
|
1012 |
+
|
1013 |
+
#: inc/cleantalk-settings.php:691
|
1014 |
+
msgid "Error occurred while updating SpamFireWall local base. Error: "
|
1015 |
+
msgstr "Произошла ошибка при обновлении локальной базы Spam FireWall. Ошибка: "
|
1016 |
+
|
1017 |
+
#: inc/cleantalk-settings.php:692
|
1018 |
+
msgid "Error occurred while checking account status. Error: "
|
1019 |
+
msgstr "Произошла ошибка при проверке статуса аккаунта. Ошибка: "
|
1020 |
+
|
1021 |
+
#: inc/cleantalk-settings.php:693
|
1022 |
+
msgid "Error occurred while excuting API call. Error: "
|
1023 |
+
msgstr "Произошла ошибка при выполнении вызова API. Ошибка: "
|
1024 |
+
|
1025 |
+
#: inc/cleantalk-settings.php:701
|
1026 |
+
msgid "Unknown error. Error: "
|
1027 |
+
msgstr "Неизвестная ошибка. Ошибка: "
|
1028 |
+
|
1029 |
+
#: inc/cleantalk-settings.php:732
|
1030 |
+
msgid "Errors:"
|
1031 |
+
msgstr "Ошибки: "
|
1032 |
+
|
1033 |
+
#: inc/cleantalk-settings.php:737
|
1034 |
+
#, php-format
|
1035 |
+
msgid "You can get support any time here: %s."
|
1036 |
+
msgstr "Вы всегда можете получить техническую поддержку здесь: %s."
|
1037 |
+
|
1038 |
+
#: inc/cleantalk-settings.php:813
|
1039 |
+
msgid "Protection is active"
|
1040 |
+
msgstr "Защита включена"
|
1041 |
+
|
1042 |
+
#: inc/cleantalk-settings.php:815
|
1043 |
+
msgid "Registration forms"
|
1044 |
+
msgstr "Регистрации пользователей"
|
1045 |
+
|
1046 |
+
#: inc/cleantalk-settings.php:816
|
1047 |
+
msgid "Comments forms"
|
1048 |
+
msgstr "Формы комментариев"
|
1049 |
+
|
1050 |
+
#: inc/cleantalk-settings.php:821
|
1051 |
+
msgid "Validate email for existence"
|
1052 |
+
msgstr "Проверка e-mail на существование"
|
1053 |
+
|
1054 |
+
#: inc/cleantalk-settings.php:825
|
1055 |
+
msgid "Auto update"
|
1056 |
+
msgstr "Автообновлние"
|
1057 |
+
|
1058 |
+
#: inc/cleantalk-settings.php:849
|
1059 |
+
msgid "<h3>Key is provided by Super Admin.</h3>"
|
1060 |
+
msgstr "<h3>Ключ доступа предоставлен Супер Администратором.</h3>"
|
1061 |
+
|
1062 |
+
#: inc/cleantalk-settings.php:853
|
1063 |
+
msgid "Access key"
|
1064 |
+
msgstr "Ключ доступа"
|
1065 |
+
|
1066 |
+
#: inc/cleantalk-settings.php:868
|
1067 |
+
msgid "Enter the key"
|
1068 |
+
msgstr "Введите ключ"
|
1069 |
+
|
1070 |
+
#: inc/cleantalk-settings.php:874
|
1071 |
+
#, php-format
|
1072 |
+
msgid "Account at cleantalk.org is %s."
|
1073 |
+
msgstr "Аккаунт на cleantalk.org %s."
|
1074 |
+
|
1075 |
+
#: inc/cleantalk-settings.php:883
|
1076 |
+
msgid "Show the access key"
|
1077 |
+
msgstr "Показать ключ доступа"
|
1078 |
+
|
1079 |
+
#: inc/cleantalk-settings.php:894
|
1080 |
+
msgid "Get Access Key Automatically"
|
1081 |
+
msgstr "Получить ключ доступа автоматически"
|
1082 |
+
|
1083 |
+
#: inc/cleantalk-settings.php:902
|
1084 |
+
#, php-format
|
1085 |
+
msgid ""
|
1086 |
+
"Admin e-mail (%s) will be used for registration, if you want to use other "
|
1087 |
+
"email please %sGet Access Key Manually%s."
|
1088 |
+
msgstr ""
|
1089 |
+
"E-mail администратора (%s) будет использован для регистрации. Если вы хотите "
|
1090 |
+
"использовать другой e-mail, пожлуйста, %sполучите ключ доступа "
|
1091 |
+
"самостоятельно%s."
|
1092 |
+
|
1093 |
+
#: inc/cleantalk-settings.php:918
|
1094 |
+
#, php-format
|
1095 |
+
msgid "I accept %sLicense Agreement%s."
|
1096 |
+
msgstr "Я принимаю %sЛицензионно Соглашение%s."
|
1097 |
+
|
1098 |
+
#: inc/cleantalk-settings.php:939
|
1099 |
+
msgid "Statistics & Reports"
|
1100 |
+
msgstr "Статистика и отчеты"
|
1101 |
+
|
1102 |
+
#: inc/cleantalk-settings.php:964
|
1103 |
+
#, php-format
|
1104 |
+
msgid "Last spam check request to %s server was at %s."
|
1105 |
+
msgstr "Последний запрос проверки спама на сервере %s был произведен %s."
|
1106 |
+
|
1107 |
+
#: inc/cleantalk-settings.php:965 inc/cleantalk-settings.php:966
|
1108 |
+
#: inc/cleantalk-settings.php:975 inc/cleantalk-settings.php:982
|
1109 |
+
#: inc/cleantalk-settings.php:983 inc/cleantalk-settings.php:991
|
1110 |
+
#: inc/cleantalk-settings.php:992 inc/cleantalk-settings.php:999
|
1111 |
+
#: inc/cleantalk-settings.php:1000
|
1112 |
+
msgid "unknown"
|
1113 |
+
msgstr "неизвестно"
|
1114 |
+
|
1115 |
+
#: inc/cleantalk-settings.php:972
|
1116 |
+
#, php-format
|
1117 |
+
msgid "Average request time for past 7 days: %s seconds."
|
1118 |
+
msgstr "Среднее время запроса за последние 7 дней: %s секунд."
|
1119 |
+
|
1120 |
+
#: inc/cleantalk-settings.php:981
|
1121 |
+
#, php-format
|
1122 |
+
msgid "Last time SpamFireWall was triggered for %s IP at %s"
|
1123 |
+
msgstr "В последний раз SpamFireWall сработал на %s IP %s"
|
1124 |
+
|
1125 |
+
#: inc/cleantalk-settings.php:990
|
1126 |
+
#, php-format
|
1127 |
+
msgid "SpamFireWall was updated %s. Now contains %s entries."
|
1128 |
+
msgstr "SpamFireWall был обновлен %s. Содержится %s записей."
|
1129 |
+
|
1130 |
+
#: inc/cleantalk-settings.php:998
|
1131 |
+
#, php-format
|
1132 |
+
msgid "SpamFireWall sent %s events at %s."
|
1133 |
+
msgstr "SpamFireWall отправил %s событий %s."
|
1134 |
+
|
1135 |
+
#: inc/cleantalk-settings.php:1008
|
1136 |
+
msgid "There are no failed connections to server."
|
1137 |
+
msgstr "Проблем с подключением к серверу нет."
|
1138 |
+
|
1139 |
+
#: inc/cleantalk-settings.php:1035
|
1140 |
+
msgid "Send report"
|
1141 |
+
msgstr "Отправить отчет"
|
1142 |
+
|
1143 |
+
#: inc/cleantalk-settings.php:1039
|
1144 |
+
msgid ""
|
1145 |
+
"Please, enable \"Send connection reports\" setting to be able to send reports"
|
1146 |
+
msgstr ""
|
1147 |
+
"Пожалуйста, активируйте опцию \"Отправлять отчеты о соединении\" для "
|
1148 |
+
"возможности отправлять отчеты."
|
1149 |
+
|
1150 |
+
#: inc/cleantalk-settings.php:1396
|
1151 |
+
msgid "Testing is failed. Please check the Access key."
|
1152 |
+
msgstr "Ошибка тестирования. Пожалуйста, проверьте ключ доступа."
|
1153 |
+
|
1154 |
+
#: inc/cleantalk-settings.php:1511
|
1155 |
+
msgid "XSS check"
|
1156 |
+
msgstr "Проверка XSS уязвимости"
|
1157 |
+
|
1158 |
+
#: inc/cleantalk-settings.php:1512
|
1159 |
+
msgid ""
|
1160 |
+
"Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to "
|
1161 |
+
"any user. As a result malicious scripts can not get access to the cookie "
|
1162 |
+
"files, session tokens and any other confidential information browsers use "
|
1163 |
+
"and store. Such scripts can even overwrite content of HTML pages. CleanTalk "
|
1164 |
+
"WAF monitors for patterns of these parameters and block them."
|
1165 |
+
msgstr ""
|
1166 |
+
"Межсайтовый скриптинг (XSS) - предотвращает выполнение / отправку "
|
1167 |
+
"вредоносного кода любому пользователю. В результате вредоносные сценарии не "
|
1168 |
+
"могут получить доступ к файлам cookie, токенам сеансов и любой другой "
|
1169 |
+
"конфиденциальной информации, которую используют и хранят браузеры. Такие "
|
1170 |
+
"сценарии могут даже перезаписывать содержимое HTML-страниц. CleanTalk WAF "
|
1171 |
+
"отслеживает шаблоны этих параметров и блокирует их."
|
1172 |
+
|
1173 |
+
#: inc/cleantalk-settings.php:1515
|
1174 |
+
msgid "SQL-injection check"
|
1175 |
+
msgstr "Проверка на наличие SQL-injection"
|
1176 |
+
|
1177 |
+
#: inc/cleantalk-settings.php:1516
|
1178 |
+
msgid ""
|
1179 |
+
"SQL Injection — one of the most popular ways to hack websites and programs "
|
1180 |
+
"that work with databases. It is based on injection of a custom SQL code into "
|
1181 |
+
"database queries. It could transmit data through GET, POST requests or "
|
1182 |
+
"cookie files in an SQL code. If a website is vulnerable and execute such "
|
1183 |
+
"injections then it would allow attackers to apply changes to the website's "
|
1184 |
+
"MySQL database."
|
1185 |
+
msgstr ""
|
1186 |
+
"SQL-инъекция - один из самых популярных способов взлома сайтов и программ, "
|
1187 |
+
"работающих с базами данных. Он основан на внедрении пользовательского кода "
|
1188 |
+
"SQL в запросы к базе данных. Он может передавать данные через запросы GET, "
|
1189 |
+
"POST или файлы cookie в коде SQL. Если веб-сайт уязвим и выполняет такие "
|
1190 |
+
"инъекции, это позволит злоумышленникам применить изменения к базе данных "
|
1191 |
+
"MySQL веб-сайта."
|
1192 |
+
|
1193 |
+
#: inc/cleantalk-settings.php:1519
|
1194 |
+
msgid "Check uploaded files"
|
1195 |
+
msgstr "Проверка загруженных файлов"
|
1196 |
+
|
1197 |
+
#: inc/cleantalk-settings.php:1520
|
1198 |
+
msgid ""
|
1199 |
+
"The option checks each uploaded file to a website for malicious code. If "
|
1200 |
+
"it's possible for visitors to upload files to a website, for instance a work "
|
1201 |
+
"resume, then attackers could abuse it and upload an infected file to execute "
|
1202 |
+
"it later and get access to your website."
|
1203 |
+
msgstr ""
|
1204 |
+
"Опция проверяет каждый загруженный файл на веб-сайт на наличие вредоносного "
|
1205 |
+
"кода. Если посетители могут загружать на сайт файлы, например, резюме, то "
|
1206 |
+
"злоумышленники могут злоупотреблять им и загружать зараженный файл, чтобы "
|
1207 |
+
"выполнить его позднее и получить доступ к вашему сайту."
|
1208 |
+
|
1209 |
+
#. Widget name will appear in UI
|
1210 |
+
#: inc/cleantalk-widget.php:22
|
1211 |
+
msgid "CleanTalk Widget"
|
1212 |
+
msgstr "Виджет CleanTalk"
|
1213 |
+
|
1214 |
+
#: inc/cleantalk-widget.php:25
|
1215 |
+
msgid "CleanTalk widget"
|
1216 |
+
msgstr "виджет CleanTalk"
|
1217 |
+
|
1218 |
+
#: inc/cleantalk-widget.php:35 inc/cleantalk-widget.php:86
|
1219 |
+
msgid "Spam blocked"
|
1220 |
+
msgstr "Спама заблокировано"
|
1221 |
+
|
1222 |
+
#: inc/cleantalk-widget.php:73
|
1223 |
+
msgid "CleanTalk's main page"
|
1224 |
+
msgstr "Главная страница CleanTalk"
|
1225 |
+
|
1226 |
+
#: inc/cleantalk-widget.php:74
|
1227 |
+
msgid "spam"
|
1228 |
+
msgstr "спама"
|
1229 |
+
|
1230 |
+
#: inc/cleantalk-widget.php:74
|
1231 |
+
msgid "blocked by"
|
1232 |
+
msgstr "заблокировано"
|
1233 |
+
|
1234 |
+
#: inc/cleantalk-widget.php:91
|
1235 |
+
msgid "Title:"
|
1236 |
+
msgstr "Заголовок:"
|
1237 |
+
|
1238 |
+
#: inc/cleantalk-widget.php:96
|
1239 |
+
msgid "Style:"
|
1240 |
+
msgstr "Стиль:"
|
1241 |
+
|
1242 |
+
#: inc/cleantalk-widget.php:98
|
1243 |
+
msgid "CleanTalk's Style"
|
1244 |
+
msgstr "Фирменный стиль CleanTalk"
|
1245 |
+
|
1246 |
+
#: inc/cleantalk-widget.php:99
|
1247 |
+
msgid "Light"
|
1248 |
+
msgstr "Лёгкий"
|
1249 |
+
|
1250 |
+
#: inc/cleantalk-widget.php:100
|
1251 |
+
msgid "Extremely Light"
|
1252 |
+
msgstr "Очень легкий"
|
1253 |
+
|
1254 |
+
#: inc/cleantalk-widget.php:101
|
1255 |
+
msgid "Dark"
|
1256 |
+
msgstr "Темный"
|
1257 |
+
|
1258 |
+
#: inc/cleantalk-widget.php:106
|
1259 |
+
msgid "Referal link ID:"
|
1260 |
+
msgstr "ID партнера:"
|
1261 |
+
|
1262 |
+
#: lib/CleantalkSFW.php:71
|
1263 |
+
msgid "SpamFireWall is activated for your IP "
|
1264 |
+
msgstr "Спам Фаервол заблокировал ваш IP"
|
1265 |
+
|
1266 |
+
#: lib/CleantalkSFW.php:72
|
1267 |
+
msgid ""
|
1268 |
+
"To continue working with web site, please make sure that you have enabled "
|
1269 |
+
"JavaScript."
|
1270 |
+
msgstr ""
|
1271 |
+
"Что бы продолжить работу с сайтом, пожалуйста, убедитесь что у вас включен "
|
1272 |
+
"JavaScript."
|
1273 |
+
|
1274 |
+
#: lib/CleantalkSFW.php:73
|
1275 |
+
msgid "Please click below to pass protection,"
|
1276 |
+
msgstr "Пожалуйста, нажмите, чтобы пройти защиту,"
|
1277 |
+
|
1278 |
+
#: lib/CleantalkSFW.php:74
|
1279 |
+
#, php-format
|
1280 |
+
msgid ""
|
1281 |
+
"Or you will be automatically redirected to the requested page after %d "
|
1282 |
+
"seconds."
|
1283 |
+
msgstr ""
|
1284 |
+
"Или вы будете автоматически переадресованы на запрашиваемую страницу через "
|
1285 |
+
"%d секунд."
|
1286 |
+
|
1287 |
+
#: lib/CleantalkSFW.php:75
|
1288 |
+
msgid "Antispam by CleanTalk"
|
1289 |
+
msgstr "Антиспам от CleanTalk"
|
1290 |
+
|
1291 |
+
#: lib/CleantalkSFW.php:76
|
1292 |
+
msgid "This is the testing page for SpamFireWall"
|
1293 |
+
msgstr "Это тестовая страница SpamFireWall"
|
1294 |
+
|
1295 |
+
#: templates/translate_banner.php:6
|
1296 |
+
msgid "Help others use the plugin in your language."
|
1297 |
+
msgstr "Помогите другим пользователям использовать плагин на их языке."
|
1298 |
+
|
1299 |
+
#: templates/translate_banner.php:7
|
1300 |
+
msgid ""
|
1301 |
+
"We ask you to help with the translation of the plugin in your language. "
|
1302 |
+
"Please take a few minutes to make the plugin more comfortable."
|
1303 |
+
msgstr ""
|
1304 |
+
"Мы просим Вас помочь с переводом плагина на ваш язык. Пожалуйста, потратьте "
|
1305 |
+
"несколько минут, чтобы сделать плагин более удобным."
|
1306 |
+
|
1307 |
+
#: templates/translate_banner.php:10
|
1308 |
+
msgid "TRANSLATE"
|
1309 |
+
msgstr "ПЕРЕВЕСТИ"
|
1310 |
+
|
1311 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:29
|
1312 |
+
msgid "Author"
|
1313 |
+
msgstr "Автор"
|
1314 |
+
|
1315 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:30
|
1316 |
+
msgid "Comment"
|
1317 |
+
msgstr "Комментарий"
|
1318 |
+
|
1319 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:31
|
1320 |
+
#, fuzzy
|
1321 |
+
#| msgid "In Response To"
|
1322 |
+
msgid " \tIn Response To"
|
1323 |
+
msgstr "В ответ на"
|
1324 |
+
|
1325 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:74
|
1326 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:81
|
1327 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:83
|
1328 |
+
msgid "No IP adress"
|
1329 |
+
msgstr ""
|
1330 |
+
|
1331 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:187
|
1332 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:145
|
1333 |
+
msgid "No spam found."
|
1334 |
+
msgstr ""
|
1335 |
+
|
1336 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:11
|
1337 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:11
|
1338 |
+
msgid "Start time"
|
1339 |
+
msgstr ""
|
1340 |
+
|
1341 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:12
|
1342 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:12
|
1343 |
+
msgid "Checked"
|
1344 |
+
msgstr ""
|
1345 |
+
|
1346 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:13
|
1347 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:13
|
1348 |
+
msgid "Found spam"
|
1349 |
+
msgstr ""
|
1350 |
+
|
1351 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:14
|
1352 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:14
|
1353 |
+
msgid "Found bad"
|
1354 |
+
msgstr ""
|
1355 |
+
|
1356 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:60
|
1357 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:60
|
1358 |
+
msgid "No logs found."
|
1359 |
+
msgstr ""
|
1360 |
+
|
1361 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableSpam.php:47
|
1362 |
+
msgid "Delete all comments from the list"
|
1363 |
+
msgstr "Удалить все сообщения в списке"
|
1364 |
+
|
1365 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:76
|
1366 |
+
msgid "Start check"
|
1367 |
+
msgstr "Начать проверку"
|
1368 |
+
|
1369 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:77
|
1370 |
+
msgid "Continue check"
|
1371 |
+
msgstr "Продолжить проверку"
|
1372 |
+
|
1373 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:81
|
1374 |
+
msgid "Accurate check"
|
1375 |
+
msgstr "Точная проверка"
|
1376 |
+
|
1377 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:86
|
1378 |
+
msgid "Specify date range"
|
1379 |
+
msgstr "Указать диапазон дат"
|
1380 |
+
|
1381 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:25
|
1382 |
+
msgid "Failed from timeout. Going to check comments again."
|
1383 |
+
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
1384 |
+
|
1385 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:26
|
1386 |
+
msgid "Delete all spam comments?"
|
1387 |
+
msgstr "Удалить ВСЕ найденные спам-комментарии?"
|
1388 |
+
|
1389 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:27
|
1390 |
+
msgid "comments"
|
1391 |
+
msgstr "комментарии"
|
1392 |
+
|
1393 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:28
|
1394 |
+
#, php-format
|
1395 |
+
msgid ""
|
1396 |
+
"Checked %s, found %s spam comments and %s bad comments (without IP or email)."
|
1397 |
+
msgstr ""
|
1398 |
+
|
1399 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:29
|
1400 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:32
|
1401 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:395
|
1402 |
+
msgid "Please do backup of WordPress database before delete any accounts!"
|
1403 |
+
msgstr ""
|
1404 |
+
"Пожалуйста, сделайте резервную копию базы данных Wordpress перед удалением "
|
1405 |
+
"аккаунтов."
|
1406 |
+
|
1407 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:339
|
1408 |
+
#, php-format
|
1409 |
+
msgid ""
|
1410 |
+
"Checked %s, found %s spam comments and %s bad comments (without IP or email)"
|
1411 |
+
msgstr ""
|
1412 |
+
|
1413 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:346
|
1414 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:381
|
1415 |
+
msgid "Never checked yet or no new spam."
|
1416 |
+
msgstr ""
|
1417 |
+
|
1418 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:349
|
1419 |
+
#, php-format
|
1420 |
+
msgid ""
|
1421 |
+
"Last check %s: checked %s comments, found %s spam comments and %s bad "
|
1422 |
+
"comments (without IP or email)."
|
1423 |
+
msgstr ""
|
1424 |
+
|
1425 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:360
|
1426 |
+
msgid "Please do backup of WordPress database before delete any comments!"
|
1427 |
+
msgstr ""
|
1428 |
+
"Пожалуйста, сделайте резервную копию базы данных Wordpress перед удалением "
|
1429 |
+
"комментариев."
|
1430 |
+
|
1431 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:89
|
1432 |
+
#, php-format
|
1433 |
+
msgid ""
|
1434 |
+
"Antispam hosting tariff does not allow you to use this feature. To do so, "
|
1435 |
+
"you need to enter an Access Key in the %splugin settings%s."
|
1436 |
+
msgstr ""
|
1437 |
+
"Тариф на антиспам хостинг не позволяет использовать эту функцию. Для этого "
|
1438 |
+
"вам необходимо ввести ключ доступа в %sнастройках плагина%s."
|
1439 |
+
|
1440 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:101
|
1441 |
+
msgid "Plugin Settings"
|
1442 |
+
msgstr "Настройки плагина"
|
1443 |
+
|
1444 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:106
|
1445 |
+
msgid "Scan and new results"
|
1446 |
+
msgstr ""
|
1447 |
+
|
1448 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:119
|
1449 |
+
msgid "Show per page"
|
1450 |
+
msgstr ""
|
1451 |
+
|
1452 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:26
|
1453 |
+
msgid "Failed from timeout. Going to check users again."
|
1454 |
+
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
1455 |
+
|
1456 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:27
|
1457 |
+
msgid "Failed from timeout. Going to run a new attempt to delete spam users."
|
1458 |
+
msgstr "Ошибка по таймауту. Попробовать еще раз?"
|
1459 |
+
|
1460 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:28
|
1461 |
+
msgid "Delete all spam users?"
|
1462 |
+
msgstr "Удалить ВСЕХ найденых спам-пользователей?"
|
1463 |
+
|
1464 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:29
|
1465 |
+
msgid "users."
|
1466 |
+
msgstr "пользователей."
|
1467 |
+
|
1468 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:31
|
1469 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:374
|
1470 |
+
#, php-format
|
1471 |
+
msgid "Checked %s, found %s spam users and %s bad users (without IP or email)"
|
1472 |
+
msgstr ""
|
1473 |
+
|
1474 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:384
|
1475 |
+
#, php-format
|
1476 |
+
msgid ""
|
1477 |
+
"Last check %s: checked %s users, found %s spam users and %s bad users "
|
1478 |
+
"(without IP or email)."
|
1479 |
+
msgstr ""
|
1480 |
+
|
1481 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:616
|
1482 |
+
#, php-format
|
1483 |
+
msgid "SPAM. Checked %s."
|
1484 |
+
msgstr ""
|
1485 |
+
|
1486 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:619
|
1487 |
+
#, php-format
|
1488 |
+
msgid "Not spam. Checked %s."
|
1489 |
+
msgstr ""
|
1490 |
+
|
1491 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:623
|
1492 |
+
msgid "Not checked yet. Anti-Spam by CleanTalk."
|
1493 |
+
msgstr ""
|
1494 |
+
|
1495 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:31
|
1496 |
+
msgid "Username"
|
1497 |
+
msgstr ""
|
1498 |
+
|
1499 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:32
|
1500 |
+
msgid "Name"
|
1501 |
+
msgstr ""
|
1502 |
+
|
1503 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:33
|
1504 |
+
msgid "E-mail"
|
1505 |
+
msgstr ""
|
1506 |
+
|
1507 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:34
|
1508 |
+
msgid "Signed up"
|
1509 |
+
msgstr ""
|
1510 |
+
|
1511 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:35
|
1512 |
+
msgid "Role"
|
1513 |
+
msgstr ""
|
1514 |
+
|
1515 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:36
|
1516 |
+
msgid "Posts"
|
1517 |
+
msgstr ""
|
1518 |
+
|
1519 |
+
#: inc/find-spam/ClassCleantalkUsersListTableSpam.php:57
|
1520 |
+
msgid "Delete all users from list"
|
1521 |
+
msgstr "Удалить всех пользователей в списке"
|
1522 |
+
|
1523 |
+
#: inc/find-spam/ClassCleantalkUsersListTableSpam.php:58
|
1524 |
+
msgid "Download results in CSV"
|
1525 |
+
msgstr "Загрузить результаты (CSV)"
|
1526 |
+
|
1527 |
+
#. Name of the plugin
|
1528 |
+
msgid "Anti-Spam by CleanTalk"
|
1529 |
+
msgstr ""
|
1530 |
+
|
1531 |
+
#. Description of the plugin
|
1532 |
+
msgid ""
|
1533 |
+
"Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam,"
|
1534 |
+
" no registration spam, no contact spam, protects any WordPress forms."
|
1535 |
+
msgstr ""
|
1536 |
+
"Максимальная эффективность, проверка всех форм, без Сaptcha, премиум "
|
1537 |
+
"антиспам плагин. Нет спаму в комментариях, нет спаму в регистрациях, нету "
|
1538 |
+
"спаму в контактных формах, защита любых форм в WordPress."
|
1539 |
+
|
1540 |
+
#. URI of the plugin
|
1541 |
+
#. Author URI of the plugin
|
1542 |
+
msgid "https://cleantalk.org"
|
1543 |
+
msgstr ""
|
1544 |
+
|
1545 |
+
#. Author of the plugin
|
1546 |
+
msgid "СleanTalk <welcome@cleantalk.org>"
|
1547 |
+
msgstr "СleanTalk <welcome@cleantalk.org>"
|
i18n/cleantalk.pot
CHANGED
@@ -1,1388 +1,1426 @@
|
|
1 |
-
#, fuzzy
|
2 |
-
msgid ""
|
3 |
-
msgstr ""
|
4 |
-
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
-
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
6 |
-
"POT-Creation-Date:
|
7 |
-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
-
"Last-Translator: \n"
|
9 |
-
"Language-Team: \n"
|
10 |
-
"MIME-Version: 1.0\n"
|
11 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
-
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Generator: Loco https://localise.biz/\n"
|
14 |
-
"X-Poedit-Basepath: ..\n"
|
15 |
-
"X-Poedit-WPHeader: cleantalk.php\n"
|
16 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
18 |
-
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
19 |
-
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
20 |
-
"X-Poedit-SearchPath-0: .\n"
|
21 |
-
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
-
"Language: "
|
23 |
-
|
24 |
-
#: inc/
|
25 |
-
|
26 |
-
msgid "
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: inc/
|
30 |
-
|
31 |
-
msgid "
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
#: inc/
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
#: inc/cleantalk-
|
49 |
-
msgid ""
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
msgid ""
|
92 |
-
"
|
93 |
-
"
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
msgid "
|
99 |
-
msgstr ""
|
100 |
-
|
101 |
-
#: inc/
|
102 |
-
msgid "
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
#: inc/
|
106 |
-
msgid "
|
107 |
-
msgstr ""
|
108 |
-
|
109 |
-
#: inc/
|
110 |
-
msgid "
|
111 |
-
msgstr ""
|
112 |
-
|
113 |
-
#: inc/cleantalk-admin.php:
|
114 |
-
|
115 |
-
msgid "
|
116 |
-
msgstr ""
|
117 |
-
|
118 |
-
#: inc/cleantalk-admin.php:
|
119 |
-
msgid "
|
120 |
-
msgstr ""
|
121 |
-
|
122 |
-
#: inc/cleantalk-admin.php:
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
msgid "
|
155 |
-
msgstr ""
|
156 |
-
|
157 |
-
#: inc/cleantalk-admin.php:
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
msgid ""
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
"
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
#: inc/cleantalk-
|
199 |
-
msgid "
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
"
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
#: inc/
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
#: inc/
|
264 |
-
msgid "
|
265 |
-
msgstr ""
|
266 |
-
|
267 |
-
#: inc/cleantalk-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
"
|
284 |
-
msgstr ""
|
285 |
-
|
286 |
-
#: inc/cleantalk-
|
287 |
-
msgid "
|
288 |
-
msgstr ""
|
289 |
-
|
290 |
-
#: inc/cleantalk-
|
291 |
-
#, php-format
|
292 |
-
msgid "
|
293 |
-
msgstr ""
|
294 |
-
|
295 |
-
#: inc/cleantalk-
|
296 |
-
msgid "
|
297 |
-
msgstr ""
|
298 |
-
|
299 |
-
#: inc/cleantalk-
|
300 |
-
|
301 |
-
msgid "
|
302 |
-
msgstr ""
|
303 |
-
|
304 |
-
#: inc/cleantalk-
|
305 |
-
|
306 |
-
msgid "
|
307 |
-
msgstr ""
|
308 |
-
|
309 |
-
#: inc/cleantalk-
|
310 |
-
msgid "
|
311 |
-
msgstr ""
|
312 |
-
|
313 |
-
#: inc/cleantalk-
|
314 |
-
msgid "
|
315 |
-
msgstr ""
|
316 |
-
|
317 |
-
#: inc/cleantalk-
|
318 |
-
#, php-format
|
319 |
-
msgid "
|
320 |
-
msgstr ""
|
321 |
-
|
322 |
-
#: inc/cleantalk-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
msgid "
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
"
|
339 |
-
msgstr ""
|
340 |
-
|
341 |
-
#: inc/cleantalk-
|
342 |
-
msgid "
|
343 |
-
msgstr ""
|
344 |
-
|
345 |
-
#: inc/cleantalk-
|
346 |
-
msgid ""
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
#: inc/
|
351 |
-
|
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 |
-
msgid "
|
465 |
-
msgstr ""
|
466 |
-
|
467 |
-
#: inc/cleantalk-
|
468 |
-
msgid "
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
#: inc/cleantalk-
|
478 |
-
msgid "
|
479 |
-
msgstr ""
|
480 |
-
|
481 |
-
#: inc/cleantalk-
|
482 |
-
msgid "
|
483 |
-
msgstr ""
|
484 |
-
|
485 |
-
#: inc/cleantalk-
|
486 |
-
msgid "
|
487 |
-
msgstr ""
|
488 |
-
|
489 |
-
#: inc/cleantalk-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
msgid "
|
497 |
-
msgstr ""
|
498 |
-
|
499 |
-
#: inc/cleantalk-
|
500 |
-
msgid ""
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
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 |
-
msgid ""
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
msgstr ""
|
596 |
-
|
597 |
-
#: inc/cleantalk-settings.php:
|
598 |
-
msgid "
|
599 |
-
msgstr ""
|
600 |
-
|
601 |
-
#: inc/cleantalk-settings.php:
|
602 |
-
msgid "
|
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 |
-
msgstr ""
|
658 |
-
|
659 |
-
#: inc/cleantalk-settings.php:
|
660 |
-
msgid "
|
661 |
-
msgstr ""
|
662 |
-
|
663 |
-
#: inc/cleantalk-settings.php:
|
664 |
-
msgid "
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
msgid "
|
687 |
-
msgstr ""
|
688 |
-
|
689 |
-
#: inc/cleantalk-settings.php:
|
690 |
-
msgid "
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
"
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
msgstr ""
|
715 |
-
|
716 |
-
#: inc/cleantalk-settings.php:
|
717 |
-
msgid ""
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
msgstr ""
|
725 |
-
|
726 |
-
#: inc/cleantalk-settings.php:
|
727 |
-
msgid ""
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
msgstr ""
|
735 |
-
|
736 |
-
#: inc/cleantalk-settings.php:
|
737 |
-
msgid ""
|
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 |
-
msgstr ""
|
803 |
-
|
804 |
-
#: inc/cleantalk-settings.php:
|
805 |
-
msgid "
|
806 |
-
msgstr ""
|
807 |
-
|
808 |
-
#: inc/cleantalk-settings.php:
|
809 |
-
msgid "
|
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 |
-
msgid "
|
843 |
-
msgstr ""
|
844 |
-
|
845 |
-
#: inc/cleantalk-settings.php:
|
846 |
-
msgid ""
|
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 |
-
msgid ""
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
msgid ""
|
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 |
-
msgid "
|
969 |
-
msgstr ""
|
970 |
-
|
971 |
-
#: inc/cleantalk-settings.php:
|
972 |
-
msgid "
|
973 |
-
msgstr ""
|
974 |
-
|
975 |
-
#: inc/cleantalk-settings.php:
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
msgid "
|
1019 |
-
msgstr ""
|
1020 |
-
|
1021 |
-
#: inc/cleantalk-settings.php:
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
#: inc/cleantalk-settings.php:
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
msgid "
|
1032 |
-
msgstr ""
|
1033 |
-
|
1034 |
-
#: inc/cleantalk-settings.php:
|
1035 |
-
#, php-format
|
1036 |
-
msgid "
|
1037 |
-
msgstr ""
|
1038 |
-
|
1039 |
-
#: inc/cleantalk-settings.php:
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
msgid ""
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
msgid "
|
1140 |
-
msgstr ""
|
1141 |
-
|
1142 |
-
#: inc/cleantalk-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
#: inc/cleantalk-
|
1147 |
-
msgid "
|
1148 |
-
msgstr ""
|
1149 |
-
|
1150 |
-
#: inc/cleantalk-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
msgstr ""
|
1182 |
-
|
1183 |
-
#:
|
1184 |
-
msgid "
|
1185 |
-
msgstr ""
|
1186 |
-
|
1187 |
-
#:
|
1188 |
-
msgid "
|
1189 |
-
msgstr ""
|
1190 |
-
|
1191 |
-
#:
|
1192 |
-
msgid ""
|
1193 |
-
"
|
1194 |
-
"
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
"
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
#: inc/
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
"
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
#: inc/
|
1231 |
-
msgid "
|
1232 |
-
msgstr ""
|
1233 |
-
|
1234 |
-
#: inc/
|
1235 |
-
|
1236 |
-
"
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
#: inc/
|
1241 |
-
msgid ""
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
"
|
1251 |
-
msgstr ""
|
1252 |
-
|
1253 |
-
#: inc/
|
1254 |
-
msgid "
|
1255 |
-
msgstr ""
|
1256 |
-
|
1257 |
-
#: inc/
|
1258 |
-
msgid "
|
1259 |
-
msgstr ""
|
1260 |
-
|
1261 |
-
#: inc/
|
1262 |
-
msgid "
|
1263 |
-
msgstr ""
|
1264 |
-
|
1265 |
-
#: inc/
|
1266 |
-
msgid "
|
1267 |
-
msgstr ""
|
1268 |
-
|
1269 |
-
#: inc/
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
#: inc/
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
#: inc/
|
1301 |
-
msgid "
|
1302 |
-
msgstr ""
|
1303 |
-
|
1304 |
-
#: inc/
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
msgid "
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
"
|
1336 |
-
msgstr ""
|
1337 |
-
|
1338 |
-
#:
|
1339 |
-
msgid "
|
1340 |
-
msgstr ""
|
1341 |
-
|
1342 |
-
#:
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
msgid "
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
msgstr ""
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
+
"Project-Id-Version: Anti-Spam by CleanTalk\n"
|
6 |
+
"POT-Creation-Date: 2020-06-21 08:14+0000\n"
|
7 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
+
"Last-Translator: \n"
|
9 |
+
"Language-Team: \n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Loco https://localise.biz/\n"
|
14 |
+
"X-Poedit-Basepath: ..\n"
|
15 |
+
"X-Poedit-WPHeader: cleantalk.php\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
18 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
19 |
+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
+
"Language: "
|
23 |
+
|
24 |
+
#: inc/cleantalk-admin.php:35
|
25 |
+
#, php-format
|
26 |
+
msgid "Find spam %s"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: inc/cleantalk-admin.php:39
|
30 |
+
#, php-format
|
31 |
+
msgid "View spam %s"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: inc/cleantalk-admin.php:43
|
35 |
+
msgid "CleanTalk Anti-Spam Log"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: inc/cleantalk-admin.php:62
|
39 |
+
#, php-format
|
40 |
+
msgid "%sRefresh%s"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: inc/cleantalk-admin.php:63
|
44 |
+
#, php-format
|
45 |
+
msgid "%sConfigure%s"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: inc/cleantalk-admin.php:80
|
49 |
+
msgid "7 days anti-spam stats"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: inc/cleantalk-admin.php:84
|
53 |
+
msgid "Top 5 spam IPs blocked"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: inc/cleantalk-admin.php:90
|
57 |
+
msgid "Get Access key to activate Anti-Spam protection!"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: inc/cleantalk-admin.php:98
|
61 |
+
#, php-format
|
62 |
+
msgid "Something went wrong! Error: \"%s\"."
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: inc/cleantalk-admin.php:102
|
66 |
+
msgid "Please, visit your dashboard."
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: inc/cleantalk-admin.php:116
|
70 |
+
msgid "IP"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: inc/cleantalk-admin.php:117
|
74 |
+
msgid "Country"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: inc/cleantalk-admin.php:118
|
78 |
+
msgid "Block Count"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: inc/cleantalk-admin.php:146
|
82 |
+
#, php-format
|
83 |
+
msgid ""
|
84 |
+
"This is the count from the %s's cloud and could be different to admin bar "
|
85 |
+
"counters"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#. %s: Number of spam messages
|
89 |
+
#: inc/cleantalk-admin.php:149
|
90 |
+
#, php-format
|
91 |
+
msgid ""
|
92 |
+
"%s%s%s has blocked %s spam for all time. The statistics are automatically "
|
93 |
+
"updated every 24 hours."
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: inc/cleantalk-admin.php:160 inc/cleantalk-settings.php:597
|
97 |
+
#, php-format
|
98 |
+
msgid "Do you like CleanTalk? %sPost your feedback here%s."
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: inc/cleantalk-admin.php:242
|
102 |
+
msgid "Translate"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: inc/cleantalk-admin.php:245
|
106 |
+
msgid "Start here"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: inc/cleantalk-admin.php:246
|
110 |
+
msgid "FAQ"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: inc/cleantalk-admin.php:247 inc/cleantalk-admin.php:597
|
114 |
+
#: inc/cleantalk-settings.php:628
|
115 |
+
msgid "Support"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: inc/cleantalk-admin.php:320 inc/cleantalk-settings.php:576
|
119 |
+
msgid "Hosting AntiSpam"
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: inc/cleantalk-admin.php:330 inc/cleantalk-find-spam.php:18
|
123 |
+
msgid "Find spam comments"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: inc/cleantalk-admin.php:331
|
127 |
+
msgid "The sender has been whitelisted."
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: inc/cleantalk-admin.php:332
|
131 |
+
msgid "The sender has been blacklisted."
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: inc/cleantalk-admin.php:333 inc/cleantalk-public.php:3719
|
135 |
+
#, php-format
|
136 |
+
msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: inc/cleantalk-admin.php:344
|
140 |
+
msgid "Find spam-users"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: inc/cleantalk-admin.php:398
|
144 |
+
#, php-format
|
145 |
+
msgid "Unable to get Access key automatically: %s"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: inc/cleantalk-admin.php:399
|
149 |
+
msgid "Get the Access key"
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: inc/cleantalk-admin.php:408
|
153 |
+
#, php-format
|
154 |
+
msgid "Please enter Access Key in %s settings to enable anti spam protection!"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: inc/cleantalk-admin.php:418
|
158 |
+
#, php-format
|
159 |
+
msgid "%s trial period ends, please upgrade to %s!"
|
160 |
+
msgstr ""
|
161 |
+
|
162 |
+
#: inc/cleantalk-admin.php:431
|
163 |
+
msgid "RENEW ANTI-SPAM"
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#: inc/cleantalk-admin.php:432
|
167 |
+
msgid "next year"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: inc/cleantalk-admin.php:436
|
171 |
+
#, php-format
|
172 |
+
msgid "Please renew your anti-spam license for %s."
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: inc/cleantalk-admin.php:464
|
176 |
+
msgid "Make it right!"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: inc/cleantalk-admin.php:466
|
180 |
+
#, php-format
|
181 |
+
msgid "%sGet premium%s"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: inc/cleantalk-admin.php:505
|
185 |
+
msgid "Since"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: inc/cleantalk-admin.php:511
|
189 |
+
msgid ""
|
190 |
+
"All / Allowed / Blocked submissions. The number of submissions is being "
|
191 |
+
"counted since CleanTalk plugin installation."
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: inc/cleantalk-admin.php:511
|
195 |
+
msgid "All"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: inc/cleantalk-admin.php:519
|
199 |
+
msgid ""
|
200 |
+
"Allowed / Blocked submissions. The number of submissions for past 24 hours. "
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: inc/cleantalk-admin.php:519
|
204 |
+
msgid "Day"
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#: inc/cleantalk-admin.php:525
|
208 |
+
msgid ""
|
209 |
+
"All / Blocked events. Access attempts regitred by SpamFireWall counted since "
|
210 |
+
"the last plugin activation."
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: inc/cleantalk-admin.php:535
|
214 |
+
msgid ""
|
215 |
+
"Allowed / Blocked submissions. The number of submissions is being counted "
|
216 |
+
"since "
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: inc/cleantalk-admin.php:546
|
220 |
+
msgid "dashboard"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: inc/cleantalk-admin.php:553
|
224 |
+
msgid "Settings"
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: inc/cleantalk-admin.php:561
|
228 |
+
msgid "Bulk spam comments removal tool."
|
229 |
+
msgstr ""
|
230 |
+
|
231 |
+
#: inc/cleantalk-admin.php:561 inc/cleantalk-settings.php:937
|
232 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:11
|
233 |
+
msgid "Check comments for spam"
|
234 |
+
msgstr ""
|
235 |
+
|
236 |
+
#: inc/cleantalk-admin.php:571 inc/cleantalk-settings.php:938
|
237 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:11
|
238 |
+
msgid "Check users for spam"
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: inc/cleantalk-admin.php:580
|
242 |
+
msgid "Reset first counter"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: inc/cleantalk-admin.php:588
|
246 |
+
msgid "Reset all counters"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: inc/cleantalk-find-spam.php:13 inc/cleantalk-find-spam.php:18
|
250 |
+
msgid "Check for spam"
|
251 |
+
msgstr ""
|
252 |
+
|
253 |
+
#: inc/cleantalk-find-spam.php:13
|
254 |
+
msgid "Find spam users"
|
255 |
+
msgstr ""
|
256 |
+
|
257 |
+
#: inc/cleantalk-find-spam.php:14 inc/cleantalk-find-spam.php:19
|
258 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:107
|
259 |
+
msgid "Previous scan results"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: inc/cleantalk-find-spam.php:15 inc/cleantalk-find-spam.php:20
|
263 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:108
|
264 |
+
msgid "Scan logs"
|
265 |
+
msgstr ""
|
266 |
+
|
267 |
+
#: inc/cleantalk-public.php:553 inc/cleantalk-public.php:711
|
268 |
+
#: inc/cleantalk-public.php:879 inc/cleantalk-public.php:2578
|
269 |
+
#: inc/cleantalk-public.php:3431
|
270 |
+
msgid "Spam protection by CleanTalk"
|
271 |
+
msgstr ""
|
272 |
+
|
273 |
+
#: inc/cleantalk-public.php:1386 inc/cleantalk-public.php:1542
|
274 |
+
#: inc/cleantalk-public.php:1561
|
275 |
+
msgid "Spam protection"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: inc/cleantalk-public.php:1484
|
279 |
+
msgid "CleanTalk AntiSpam: This message is possible spam."
|
280 |
+
msgstr ""
|
281 |
+
|
282 |
+
#: inc/cleantalk-public.php:1485
|
283 |
+
msgid "You could check it in CleanTalk's anti-spam database:"
|
284 |
+
msgstr ""
|
285 |
+
|
286 |
+
#: inc/cleantalk-public.php:1515
|
287 |
+
msgid "Check for spam:"
|
288 |
+
msgstr ""
|
289 |
+
|
290 |
+
#: inc/cleantalk-public.php:1758
|
291 |
+
#, php-format
|
292 |
+
msgid "Registration approved by %s."
|
293 |
+
msgstr ""
|
294 |
+
|
295 |
+
#: inc/cleantalk-public.php:2042
|
296 |
+
msgid "CleanTalk AntiSpam: This registration is spam."
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: inc/cleantalk-public.php:2043 inc/cleantalk-public.php:2421
|
300 |
+
#: inc/cleantalk-public.php:2602 inc/cleantalk-public.php:2758
|
301 |
+
msgid "CleanTalk's anti-spam database:"
|
302 |
+
msgstr ""
|
303 |
+
|
304 |
+
#: inc/cleantalk-public.php:2420 inc/cleantalk-public.php:2601
|
305 |
+
#: inc/cleantalk-public.php:2757
|
306 |
+
msgid "CleanTalk AntiSpam: This message is spam."
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: inc/cleantalk-public.php:2888
|
310 |
+
msgid "Comment approved. Anti-spam by CleanTalk."
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#: inc/cleantalk-public.php:3609
|
314 |
+
msgid "Attention, please!"
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: inc/cleantalk-public.php:3610
|
318 |
+
#, php-format
|
319 |
+
msgid "\"%s\" plugin error on your site \"%s\":"
|
320 |
+
msgstr ""
|
321 |
+
|
322 |
+
#: inc/cleantalk-public.php:3612
|
323 |
+
#, php-format
|
324 |
+
msgid "[%s] \"%s\" error!"
|
325 |
+
msgstr ""
|
326 |
+
|
327 |
+
#: inc/cleantalk-public.php:3669
|
328 |
+
msgid ""
|
329 |
+
"By using this form you agree with the storage and processing of your data by "
|
330 |
+
"using the Privacy Policy on this website."
|
331 |
+
msgstr ""
|
332 |
+
|
333 |
+
#: inc/cleantalk-public.php:3717
|
334 |
+
msgid "Error occurred while sending feedback."
|
335 |
+
msgstr ""
|
336 |
+
|
337 |
+
#: inc/cleantalk-public.php:3718
|
338 |
+
msgid "Feedback wasn't sent. There is no associated request."
|
339 |
+
msgstr ""
|
340 |
+
|
341 |
+
#: inc/cleantalk-public.php:3768
|
342 |
+
msgid "Sender info"
|
343 |
+
msgstr ""
|
344 |
+
|
345 |
+
#: inc/cleantalk-public.php:3771
|
346 |
+
msgid "by"
|
347 |
+
msgstr ""
|
348 |
+
|
349 |
+
#: inc/cleantalk-public.php:3782
|
350 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:60
|
351 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:64
|
352 |
+
msgid "No email"
|
353 |
+
msgstr ""
|
354 |
+
|
355 |
+
#: inc/cleantalk-public.php:3792
|
356 |
+
msgid "No IP"
|
357 |
+
msgstr ""
|
358 |
+
|
359 |
+
#: inc/cleantalk-public.php:3795
|
360 |
+
msgid "Mark as spam"
|
361 |
+
msgstr ""
|
362 |
+
|
363 |
+
#: inc/cleantalk-public.php:3796
|
364 |
+
msgid "Unspam"
|
365 |
+
msgstr ""
|
366 |
+
|
367 |
+
#: inc/cleantalk-public.php:3798
|
368 |
+
msgid "Marked as spam."
|
369 |
+
msgstr ""
|
370 |
+
|
371 |
+
#: inc/cleantalk-public.php:3799
|
372 |
+
msgid "Marked as not spam."
|
373 |
+
msgstr ""
|
374 |
+
|
375 |
+
#: inc/cleantalk-settings.php:96 inc/cleantalk-settings.php:822
|
376 |
+
msgid "SpamFireWall"
|
377 |
+
msgstr ""
|
378 |
+
|
379 |
+
#: inc/cleantalk-settings.php:97
|
380 |
+
msgid ""
|
381 |
+
"This option allows to filter spam bots before they access website. Also "
|
382 |
+
"reduces CPU usage on hosting server and accelerates pages load time."
|
383 |
+
msgstr ""
|
384 |
+
|
385 |
+
#: inc/cleantalk-settings.php:104
|
386 |
+
msgid "Forms to protect"
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
#: inc/cleantalk-settings.php:110
|
390 |
+
msgid "Advanced settings"
|
391 |
+
msgstr ""
|
392 |
+
|
393 |
+
#: inc/cleantalk-settings.php:117
|
394 |
+
msgid "Registration Forms"
|
395 |
+
msgstr ""
|
396 |
+
|
397 |
+
#: inc/cleantalk-settings.php:118
|
398 |
+
msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
|
399 |
+
msgstr ""
|
400 |
+
|
401 |
+
#: inc/cleantalk-settings.php:121
|
402 |
+
msgid "Comments form"
|
403 |
+
msgstr ""
|
404 |
+
|
405 |
+
#: inc/cleantalk-settings.php:122
|
406 |
+
msgid "WordPress, JetPack, WooCommerce."
|
407 |
+
msgstr ""
|
408 |
+
|
409 |
+
#: inc/cleantalk-settings.php:125 inc/cleantalk-settings.php:817
|
410 |
+
msgid "Contact forms"
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
#: inc/cleantalk-settings.php:126
|
414 |
+
msgid ""
|
415 |
+
"Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
|
416 |
+
"WordPress Landing Pages, Gravity Forms."
|
417 |
+
msgstr ""
|
418 |
+
|
419 |
+
#: inc/cleantalk-settings.php:129 inc/cleantalk-settings.php:818
|
420 |
+
msgid "Custom contact forms"
|
421 |
+
msgstr ""
|
422 |
+
|
423 |
+
#: inc/cleantalk-settings.php:130
|
424 |
+
msgid "Anti spam test for any WordPress themes or contacts forms."
|
425 |
+
msgstr ""
|
426 |
+
|
427 |
+
#: inc/cleantalk-settings.php:133
|
428 |
+
msgid "Test default Wordpress search form for spam"
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
#: inc/cleantalk-settings.php:134
|
432 |
+
msgid "Spam protection for Search form."
|
433 |
+
msgstr ""
|
434 |
+
|
435 |
+
#: inc/cleantalk-settings.php:136
|
436 |
+
#, php-format
|
437 |
+
msgid ""
|
438 |
+
"Read more about %sspam protection for Search form%s on our blog. “noindex” "
|
439 |
+
"tag will be placed in meta derictive on search page."
|
440 |
+
msgstr ""
|
441 |
+
|
442 |
+
#: inc/cleantalk-settings.php:144
|
443 |
+
msgid "Protect external forms"
|
444 |
+
msgstr ""
|
445 |
+
|
446 |
+
#: inc/cleantalk-settings.php:145
|
447 |
+
msgid ""
|
448 |
+
"Turn this option on to protect forms on your WordPress that send data to "
|
449 |
+
"third-part servers (like MailChimp)."
|
450 |
+
msgstr ""
|
451 |
+
|
452 |
+
#: inc/cleantalk-settings.php:149
|
453 |
+
msgid "Capture buffer"
|
454 |
+
msgstr ""
|
455 |
+
|
456 |
+
#: inc/cleantalk-settings.php:150
|
457 |
+
msgid ""
|
458 |
+
"This setting gives you more sophisticated and strengthened protection for "
|
459 |
+
"external forms. But it could break plugins which use a buffer like Ninja "
|
460 |
+
"Forms."
|
461 |
+
msgstr ""
|
462 |
+
|
463 |
+
#: inc/cleantalk-settings.php:155
|
464 |
+
msgid "Protect internal forms"
|
465 |
+
msgstr ""
|
466 |
+
|
467 |
+
#: inc/cleantalk-settings.php:156
|
468 |
+
msgid ""
|
469 |
+
"This option will enable protection for custom (hand-made) AJAX forms with "
|
470 |
+
"PHP scripts handlers on your WordPress."
|
471 |
+
msgstr ""
|
472 |
+
|
473 |
+
#: inc/cleantalk-settings.php:163
|
474 |
+
msgid "WooCommerce"
|
475 |
+
msgstr ""
|
476 |
+
|
477 |
+
#: inc/cleantalk-settings.php:166 inc/cleantalk-settings.php:831
|
478 |
+
msgid "WooCommerce checkout form"
|
479 |
+
msgstr ""
|
480 |
+
|
481 |
+
#: inc/cleantalk-settings.php:167
|
482 |
+
msgid "Anti spam test for WooCommerce checkout form."
|
483 |
+
msgstr ""
|
484 |
+
|
485 |
+
#: inc/cleantalk-settings.php:171
|
486 |
+
msgid "Spam test for registration during checkout"
|
487 |
+
msgstr ""
|
488 |
+
|
489 |
+
#: inc/cleantalk-settings.php:172
|
490 |
+
msgid ""
|
491 |
+
"Enable anti spam test for registration process which during woocommerce's "
|
492 |
+
"checkout."
|
493 |
+
msgstr ""
|
494 |
+
|
495 |
+
#: inc/cleantalk-settings.php:182
|
496 |
+
msgid "Comments and Messages"
|
497 |
+
msgstr ""
|
498 |
+
|
499 |
+
#: inc/cleantalk-settings.php:185
|
500 |
+
msgid "Disable all comments"
|
501 |
+
msgstr ""
|
502 |
+
|
503 |
+
#: inc/cleantalk-settings.php:186
|
504 |
+
msgid "Disabling comments for all types of content."
|
505 |
+
msgstr ""
|
506 |
+
|
507 |
+
#: inc/cleantalk-settings.php:198
|
508 |
+
msgid "Disable comments for all posts"
|
509 |
+
msgstr ""
|
510 |
+
|
511 |
+
#: inc/cleantalk-settings.php:204
|
512 |
+
msgid "Disable comments for all pages"
|
513 |
+
msgstr ""
|
514 |
+
|
515 |
+
#: inc/cleantalk-settings.php:210
|
516 |
+
msgid "Disable comments for all media"
|
517 |
+
msgstr ""
|
518 |
+
|
519 |
+
#: inc/cleantalk-settings.php:216
|
520 |
+
msgid "BuddyPress Private Messages"
|
521 |
+
msgstr ""
|
522 |
+
|
523 |
+
#: inc/cleantalk-settings.php:217
|
524 |
+
msgid "Check buddyPress private messages."
|
525 |
+
msgstr ""
|
526 |
+
|
527 |
+
#: inc/cleantalk-settings.php:220
|
528 |
+
msgid "Automatically delete spam comments"
|
529 |
+
msgstr ""
|
530 |
+
|
531 |
+
#: inc/cleantalk-settings.php:221
|
532 |
+
#, php-format
|
533 |
+
msgid "Delete spam comments older than %d days."
|
534 |
+
msgstr ""
|
535 |
+
|
536 |
+
#: inc/cleantalk-settings.php:224
|
537 |
+
msgid "Remove links from approved comments"
|
538 |
+
msgstr ""
|
539 |
+
|
540 |
+
#: inc/cleantalk-settings.php:225
|
541 |
+
msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
|
542 |
+
msgstr ""
|
543 |
+
|
544 |
+
#: inc/cleantalk-settings.php:228
|
545 |
+
msgid "Show links to check Emails, IPs for spam"
|
546 |
+
msgstr ""
|
547 |
+
|
548 |
+
#: inc/cleantalk-settings.php:229
|
549 |
+
msgid ""
|
550 |
+
"Shows little icon near IP addresses and Emails allowing you to check it via "
|
551 |
+
"CleanTalk's database."
|
552 |
+
msgstr ""
|
553 |
+
|
554 |
+
#: inc/cleantalk-settings.php:233
|
555 |
+
msgid "Manage comments on public pages"
|
556 |
+
msgstr ""
|
557 |
+
|
558 |
+
#: inc/cleantalk-settings.php:234
|
559 |
+
msgid ""
|
560 |
+
"Allows administrators to manage comments on public post's pages with small "
|
561 |
+
"interactive menu."
|
562 |
+
msgstr ""
|
563 |
+
|
564 |
+
#: inc/cleantalk-settings.php:242
|
565 |
+
msgid "Data Processing"
|
566 |
+
msgstr ""
|
567 |
+
|
568 |
+
#: inc/cleantalk-settings.php:245
|
569 |
+
msgid "Protect logged in Users"
|
570 |
+
msgstr ""
|
571 |
+
|
572 |
+
#: inc/cleantalk-settings.php:246
|
573 |
+
msgid ""
|
574 |
+
"Turn this option on to check for spam any submissions (comments, contact "
|
575 |
+
"forms and etc.) from registered Users."
|
576 |
+
msgstr ""
|
577 |
+
|
578 |
+
#: inc/cleantalk-settings.php:249
|
579 |
+
msgid "Don't check trusted user's comments"
|
580 |
+
msgstr ""
|
581 |
+
|
582 |
+
#: inc/cleantalk-settings.php:250
|
583 |
+
#, php-format
|
584 |
+
msgid "Don't check comments for users with above %d comments."
|
585 |
+
msgstr ""
|
586 |
+
|
587 |
+
#: inc/cleantalk-settings.php:253
|
588 |
+
msgid "Use AJAX for JavaScript check"
|
589 |
+
msgstr ""
|
590 |
+
|
591 |
+
#: inc/cleantalk-settings.php:254
|
592 |
+
msgid ""
|
593 |
+
"Options helps protect WordPress against spam with any caching plugins. Turn "
|
594 |
+
"this option on to avoid issues with caching plugins."
|
595 |
+
msgstr ""
|
596 |
+
|
597 |
+
#: inc/cleantalk-settings.php:257
|
598 |
+
msgid "Use static keys for JS check."
|
599 |
+
msgstr ""
|
600 |
+
|
601 |
+
#: inc/cleantalk-settings.php:258
|
602 |
+
msgid ""
|
603 |
+
"Could help if you have cache for AJAX requests and you are dealing with "
|
604 |
+
"false positives. Slightly decreases protection quality. Auto - Static key "
|
605 |
+
"will be used if caching plugin is spotted."
|
606 |
+
msgstr ""
|
607 |
+
|
608 |
+
#: inc/cleantalk-settings.php:266
|
609 |
+
msgid "Check all post data"
|
610 |
+
msgstr ""
|
611 |
+
|
612 |
+
#: inc/cleantalk-settings.php:267
|
613 |
+
msgid ""
|
614 |
+
"Check all POST submissions from website visitors. Enable this option if you "
|
615 |
+
"have spam misses on website."
|
616 |
+
msgstr ""
|
617 |
+
|
618 |
+
#: inc/cleantalk-settings.php:269
|
619 |
+
msgid " Or you don`t have records about missed spam here:"
|
620 |
+
msgstr ""
|
621 |
+
|
622 |
+
#: inc/cleantalk-settings.php:269
|
623 |
+
msgid "CleanTalk dashboard"
|
624 |
+
msgstr ""
|
625 |
+
|
626 |
+
#: inc/cleantalk-settings.php:272
|
627 |
+
msgid "СAUTION! Option can catch POST requests in WordPress backend"
|
628 |
+
msgstr ""
|
629 |
+
|
630 |
+
#: inc/cleantalk-settings.php:275
|
631 |
+
msgid "Set cookies"
|
632 |
+
msgstr ""
|
633 |
+
|
634 |
+
#: inc/cleantalk-settings.php:276
|
635 |
+
msgid ""
|
636 |
+
"Turn this option off to deny plugin generates any cookies on website front-"
|
637 |
+
"end. This option is helpful if you use Varnish. But most of contact forms "
|
638 |
+
"will not be protected if the option is turned off! <b>Warning: We strongly "
|
639 |
+
"recommend you to enable this otherwise it could cause false positives spam "
|
640 |
+
"detection.</b>"
|
641 |
+
msgstr ""
|
642 |
+
|
643 |
+
#: inc/cleantalk-settings.php:280
|
644 |
+
msgid "Use alternative mechanism for cookies"
|
645 |
+
msgstr ""
|
646 |
+
|
647 |
+
#: inc/cleantalk-settings.php:281 inc/cleantalk-settings.php:403
|
648 |
+
msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
|
649 |
+
msgstr ""
|
650 |
+
|
651 |
+
#: inc/cleantalk-settings.php:286
|
652 |
+
msgid "Use SSL"
|
653 |
+
msgstr ""
|
654 |
+
|
655 |
+
#: inc/cleantalk-settings.php:287
|
656 |
+
msgid "Turn this option on to use encrypted (SSL) connection with servers."
|
657 |
+
msgstr ""
|
658 |
+
|
659 |
+
#: inc/cleantalk-settings.php:290
|
660 |
+
msgid "Use Wordpress HTTP API"
|
661 |
+
msgstr ""
|
662 |
+
|
663 |
+
#: inc/cleantalk-settings.php:291
|
664 |
+
msgid ""
|
665 |
+
"Alternative way to connect the Cloud. Use this if you have connection "
|
666 |
+
"problems."
|
667 |
+
msgstr ""
|
668 |
+
|
669 |
+
#: inc/cleantalk-settings.php:298
|
670 |
+
msgid "Exclusions"
|
671 |
+
msgstr ""
|
672 |
+
|
673 |
+
#: inc/cleantalk-settings.php:302
|
674 |
+
msgid "URL exclusions"
|
675 |
+
msgstr ""
|
676 |
+
|
677 |
+
#: inc/cleantalk-settings.php:303
|
678 |
+
msgid "You could type here URL you want to exclude. Use comma as separator."
|
679 |
+
msgstr ""
|
680 |
+
|
681 |
+
#: inc/cleantalk-settings.php:307
|
682 |
+
msgid "Use Regular Expression in URL Exclusions"
|
683 |
+
msgstr ""
|
684 |
+
|
685 |
+
#: inc/cleantalk-settings.php:311
|
686 |
+
msgid "Field name exclusions"
|
687 |
+
msgstr ""
|
688 |
+
|
689 |
+
#: inc/cleantalk-settings.php:312
|
690 |
+
msgid ""
|
691 |
+
"You could type here fields names you want to exclude. Use comma as separator."
|
692 |
+
msgstr ""
|
693 |
+
|
694 |
+
#: inc/cleantalk-settings.php:316
|
695 |
+
msgid "Use Regular Expression in Field Exclusions"
|
696 |
+
msgstr ""
|
697 |
+
|
698 |
+
#: inc/cleantalk-settings.php:323
|
699 |
+
msgid "Roles which bypass spam test. Hold CTRL to select multiple roles."
|
700 |
+
msgstr ""
|
701 |
+
|
702 |
+
#: inc/cleantalk-settings.php:330
|
703 |
+
msgid "Admin bar"
|
704 |
+
msgstr ""
|
705 |
+
|
706 |
+
#: inc/cleantalk-settings.php:337
|
707 |
+
msgid "Show statistics in admin bar"
|
708 |
+
msgstr ""
|
709 |
+
|
710 |
+
#: inc/cleantalk-settings.php:338
|
711 |
+
msgid ""
|
712 |
+
"Show/hide icon in top level menu in WordPress backend. The number of "
|
713 |
+
"submissions is being counted for past 24 hours."
|
714 |
+
msgstr ""
|
715 |
+
|
716 |
+
#: inc/cleantalk-settings.php:342
|
717 |
+
msgid "Show All-time counter"
|
718 |
+
msgstr ""
|
719 |
+
|
720 |
+
#: inc/cleantalk-settings.php:343
|
721 |
+
msgid ""
|
722 |
+
"Display all-time requests counter in the admin bar. Counter displays number "
|
723 |
+
"of requests since plugin installation."
|
724 |
+
msgstr ""
|
725 |
+
|
726 |
+
#: inc/cleantalk-settings.php:348
|
727 |
+
msgid "Show 24 hours counter"
|
728 |
+
msgstr ""
|
729 |
+
|
730 |
+
#: inc/cleantalk-settings.php:349
|
731 |
+
msgid ""
|
732 |
+
"Display daily requests counter in the admin bar. Counter displays number of "
|
733 |
+
"requests of the past 24 hours."
|
734 |
+
msgstr ""
|
735 |
+
|
736 |
+
#: inc/cleantalk-settings.php:354
|
737 |
+
msgid "SpamFireWall counter"
|
738 |
+
msgstr ""
|
739 |
+
|
740 |
+
#: inc/cleantalk-settings.php:355
|
741 |
+
msgid ""
|
742 |
+
"Display SpamFireWall requests in the admin bar. Counter displays number of "
|
743 |
+
"requests since plugin installation."
|
744 |
+
msgstr ""
|
745 |
+
|
746 |
+
#: inc/cleantalk-settings.php:368
|
747 |
+
msgid "Collect details about browsers"
|
748 |
+
msgstr ""
|
749 |
+
|
750 |
+
#: inc/cleantalk-settings.php:369
|
751 |
+
msgid ""
|
752 |
+
"Checking this box you allow plugin store information about screen size and "
|
753 |
+
"browser plugins of website visitors. The option in a beta state."
|
754 |
+
msgstr ""
|
755 |
+
|
756 |
+
#: inc/cleantalk-settings.php:373
|
757 |
+
msgid "Send connection reports"
|
758 |
+
msgstr ""
|
759 |
+
|
760 |
+
#: inc/cleantalk-settings.php:374
|
761 |
+
msgid ""
|
762 |
+
"Checking this box you allow plugin to send the information about your "
|
763 |
+
"connection. The option in a beta state."
|
764 |
+
msgstr ""
|
765 |
+
|
766 |
+
#: inc/cleantalk-settings.php:378
|
767 |
+
msgid "Async JavaScript loading"
|
768 |
+
msgstr ""
|
769 |
+
|
770 |
+
#: inc/cleantalk-settings.php:379
|
771 |
+
msgid ""
|
772 |
+
"Use async loading for scripts. Warning: This could reduce filtration quality."
|
773 |
+
msgstr ""
|
774 |
+
|
775 |
+
#: inc/cleantalk-settings.php:383
|
776 |
+
msgid "Allow to add GDPR notice via shortcode"
|
777 |
+
msgstr ""
|
778 |
+
|
779 |
+
#: inc/cleantalk-settings.php:384
|
780 |
+
msgid ""
|
781 |
+
" Adds small checkbox under your website form. To add it you should use the "
|
782 |
+
"shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
|
783 |
+
msgstr ""
|
784 |
+
|
785 |
+
#: inc/cleantalk-settings.php:389
|
786 |
+
msgid "GDPR text notice"
|
787 |
+
msgstr ""
|
788 |
+
|
789 |
+
#: inc/cleantalk-settings.php:390
|
790 |
+
msgid "This text will be added as a description to the GDPR checkbox."
|
791 |
+
msgstr ""
|
792 |
+
|
793 |
+
#: inc/cleantalk-settings.php:396
|
794 |
+
msgid "Store visited URLs"
|
795 |
+
msgstr ""
|
796 |
+
|
797 |
+
#: inc/cleantalk-settings.php:397
|
798 |
+
msgid ""
|
799 |
+
"Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
|
800 |
+
"form on the site. You can see stored visited URLS for each visitor in your "
|
801 |
+
"Dashboard. Turn the option on to improve Anti-Spam protection."
|
802 |
+
msgstr ""
|
803 |
+
|
804 |
+
#: inc/cleantalk-settings.php:402
|
805 |
+
msgid "Use cookies less sessions"
|
806 |
+
msgstr ""
|
807 |
+
|
808 |
+
#: inc/cleantalk-settings.php:409
|
809 |
+
msgid ""
|
810 |
+
"Notify users with selected roles about new approved comments. Hold CTRL to "
|
811 |
+
"select multiple roles."
|
812 |
+
msgstr ""
|
813 |
+
|
814 |
+
#: inc/cleantalk-settings.php:410
|
815 |
+
#, php-format
|
816 |
+
msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
|
817 |
+
msgstr ""
|
818 |
+
|
819 |
+
#: inc/cleantalk-settings.php:423
|
820 |
+
msgid "Complete deactivation"
|
821 |
+
msgstr ""
|
822 |
+
|
823 |
+
#: inc/cleantalk-settings.php:424
|
824 |
+
msgid "Leave no trace in the system after deactivation."
|
825 |
+
msgstr ""
|
826 |
+
|
827 |
+
#: inc/cleantalk-settings.php:441
|
828 |
+
msgid "Enable White Label Mode"
|
829 |
+
msgstr ""
|
830 |
+
|
831 |
+
#: inc/cleantalk-settings.php:442
|
832 |
+
#, php-format
|
833 |
+
msgid "Learn more information %shere%s."
|
834 |
+
msgstr ""
|
835 |
+
|
836 |
+
#: inc/cleantalk-settings.php:448
|
837 |
+
msgid "Hoster API Key"
|
838 |
+
msgstr ""
|
839 |
+
|
840 |
+
#: inc/cleantalk-settings.php:449
|
841 |
+
#, php-format
|
842 |
+
msgid "You can get it in %sCleantalk's Control Panel%s"
|
843 |
+
msgstr ""
|
844 |
+
|
845 |
+
#: inc/cleantalk-settings.php:457
|
846 |
+
msgid "Plugin name"
|
847 |
+
msgstr ""
|
848 |
+
|
849 |
+
#: inc/cleantalk-settings.php:458
|
850 |
+
#, php-format
|
851 |
+
msgid "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s"
|
852 |
+
msgstr ""
|
853 |
+
|
854 |
+
#: inc/cleantalk-settings.php:467
|
855 |
+
msgid "Allow users to use other key"
|
856 |
+
msgstr ""
|
857 |
+
|
858 |
+
#: inc/cleantalk-settings.php:468
|
859 |
+
msgid ""
|
860 |
+
"Allow users to use different Access key in their plugin settings on child "
|
861 |
+
"blogs. They could use different CleanTalk account."
|
862 |
+
msgstr ""
|
863 |
+
|
864 |
+
#: inc/cleantalk-settings.php:471
|
865 |
+
msgid ""
|
866 |
+
"Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key "
|
867 |
+
"from this constant. Look into wp-config.php"
|
868 |
+
msgstr ""
|
869 |
+
|
870 |
+
#: inc/cleantalk-settings.php:473
|
871 |
+
msgid ""
|
872 |
+
"You are not able to use white label mode while <b>CLEANTALK_ACCESS_KEY</b> "
|
873 |
+
"is defined."
|
874 |
+
msgstr ""
|
875 |
+
|
876 |
+
#: inc/cleantalk-settings.php:483
|
877 |
+
msgid "Allow users to manage plugin settings"
|
878 |
+
msgstr ""
|
879 |
+
|
880 |
+
#: inc/cleantalk-settings.php:484
|
881 |
+
msgid "Allow to change settings on child sites."
|
882 |
+
msgstr ""
|
883 |
+
|
884 |
+
#: inc/cleantalk-settings.php:586
|
885 |
+
msgid "CleanTalk's tech support:"
|
886 |
+
msgstr ""
|
887 |
+
|
888 |
+
#: inc/cleantalk-settings.php:592
|
889 |
+
msgid "Plugin Homepage at"
|
890 |
+
msgstr ""
|
891 |
+
|
892 |
+
#: inc/cleantalk-settings.php:593
|
893 |
+
msgid "GDPR compliance"
|
894 |
+
msgstr ""
|
895 |
+
|
896 |
+
#: inc/cleantalk-settings.php:594
|
897 |
+
msgid "Use s@cleantalk.org to test plugin in any WordPress form."
|
898 |
+
msgstr ""
|
899 |
+
|
900 |
+
#: inc/cleantalk-settings.php:595
|
901 |
+
msgid "CleanTalk is registered Trademark. All rights reserved."
|
902 |
+
msgstr ""
|
903 |
+
|
904 |
+
#: inc/cleantalk-settings.php:612
|
905 |
+
#, php-format
|
906 |
+
msgid "%s has blocked <b>%s</b> spam."
|
907 |
+
msgstr ""
|
908 |
+
|
909 |
+
#: inc/cleantalk-settings.php:624
|
910 |
+
msgid "Click here to get anti-spam statistics"
|
911 |
+
msgstr ""
|
912 |
+
|
913 |
+
#: inc/cleantalk-settings.php:669
|
914 |
+
#, php-format
|
915 |
+
msgid "Please, enter the %splugin settings%s in main site dashboard."
|
916 |
+
msgstr ""
|
917 |
+
|
918 |
+
#: inc/cleantalk-settings.php:688
|
919 |
+
msgid "Error occurred while API key validating. Error: "
|
920 |
+
msgstr ""
|
921 |
+
|
922 |
+
#: inc/cleantalk-settings.php:689
|
923 |
+
msgid "Error occurred while automatically gettings access key. Error: "
|
924 |
+
msgstr ""
|
925 |
+
|
926 |
+
#: inc/cleantalk-settings.php:690
|
927 |
+
msgid "Error occurred while sending SpamFireWall logs. Error: "
|
928 |
+
msgstr ""
|
929 |
+
|
930 |
+
#: inc/cleantalk-settings.php:691
|
931 |
+
msgid "Error occurred while updating SpamFireWall local base. Error: "
|
932 |
+
msgstr ""
|
933 |
+
|
934 |
+
#: inc/cleantalk-settings.php:692
|
935 |
+
msgid "Error occurred while checking account status. Error: "
|
936 |
+
msgstr ""
|
937 |
+
|
938 |
+
#: inc/cleantalk-settings.php:693
|
939 |
+
msgid "Error occurred while excuting API call. Error: "
|
940 |
+
msgstr ""
|
941 |
+
|
942 |
+
#: inc/cleantalk-settings.php:701
|
943 |
+
msgid "Unknown error. Error: "
|
944 |
+
msgstr ""
|
945 |
+
|
946 |
+
#: inc/cleantalk-settings.php:732
|
947 |
+
msgid "Errors:"
|
948 |
+
msgstr ""
|
949 |
+
|
950 |
+
#: inc/cleantalk-settings.php:737
|
951 |
+
#, php-format
|
952 |
+
msgid "You can get support any time here: %s."
|
953 |
+
msgstr ""
|
954 |
+
|
955 |
+
#: inc/cleantalk-settings.php:813
|
956 |
+
msgid "Protection is active"
|
957 |
+
msgstr ""
|
958 |
+
|
959 |
+
#: inc/cleantalk-settings.php:815
|
960 |
+
msgid "Registration forms"
|
961 |
+
msgstr ""
|
962 |
+
|
963 |
+
#: inc/cleantalk-settings.php:816
|
964 |
+
msgid "Comments forms"
|
965 |
+
msgstr ""
|
966 |
+
|
967 |
+
#: inc/cleantalk-settings.php:821
|
968 |
+
msgid "Validate email for existence"
|
969 |
+
msgstr ""
|
970 |
+
|
971 |
+
#: inc/cleantalk-settings.php:825
|
972 |
+
msgid "Auto update"
|
973 |
+
msgstr ""
|
974 |
+
|
975 |
+
#: inc/cleantalk-settings.php:849
|
976 |
+
msgid "<h3>Key is provided by Super Admin.</h3>"
|
977 |
+
msgstr ""
|
978 |
+
|
979 |
+
#: inc/cleantalk-settings.php:853
|
980 |
+
msgid "Access key"
|
981 |
+
msgstr ""
|
982 |
+
|
983 |
+
#: inc/cleantalk-settings.php:868
|
984 |
+
msgid "Enter the key"
|
985 |
+
msgstr ""
|
986 |
+
|
987 |
+
#: inc/cleantalk-settings.php:874
|
988 |
+
#, php-format
|
989 |
+
msgid "Account at cleantalk.org is %s."
|
990 |
+
msgstr ""
|
991 |
+
|
992 |
+
#: inc/cleantalk-settings.php:883
|
993 |
+
msgid "Show the access key"
|
994 |
+
msgstr ""
|
995 |
+
|
996 |
+
#: inc/cleantalk-settings.php:894
|
997 |
+
msgid "Get Access Key Automatically"
|
998 |
+
msgstr ""
|
999 |
+
|
1000 |
+
#: inc/cleantalk-settings.php:902
|
1001 |
+
#, php-format
|
1002 |
+
msgid ""
|
1003 |
+
"Admin e-mail (%s) will be used for registration, if you want to use other "
|
1004 |
+
"email please %sGet Access Key Manually%s."
|
1005 |
+
msgstr ""
|
1006 |
+
|
1007 |
+
#: inc/cleantalk-settings.php:918
|
1008 |
+
#, php-format
|
1009 |
+
msgid "I accept %sLicense Agreement%s."
|
1010 |
+
msgstr ""
|
1011 |
+
|
1012 |
+
#: inc/cleantalk-settings.php:939
|
1013 |
+
msgid "Statistics & Reports"
|
1014 |
+
msgstr ""
|
1015 |
+
|
1016 |
+
#: inc/cleantalk-settings.php:964
|
1017 |
+
#, php-format
|
1018 |
+
msgid "Last spam check request to %s server was at %s."
|
1019 |
+
msgstr ""
|
1020 |
+
|
1021 |
+
#: inc/cleantalk-settings.php:965 inc/cleantalk-settings.php:966
|
1022 |
+
#: inc/cleantalk-settings.php:975 inc/cleantalk-settings.php:982
|
1023 |
+
#: inc/cleantalk-settings.php:983 inc/cleantalk-settings.php:991
|
1024 |
+
#: inc/cleantalk-settings.php:992 inc/cleantalk-settings.php:999
|
1025 |
+
#: inc/cleantalk-settings.php:1000
|
1026 |
+
msgid "unknown"
|
1027 |
+
msgstr ""
|
1028 |
+
|
1029 |
+
#: inc/cleantalk-settings.php:972
|
1030 |
+
#, php-format
|
1031 |
+
msgid "Average request time for past 7 days: %s seconds."
|
1032 |
+
msgstr ""
|
1033 |
+
|
1034 |
+
#: inc/cleantalk-settings.php:981
|
1035 |
+
#, php-format
|
1036 |
+
msgid "Last time SpamFireWall was triggered for %s IP at %s"
|
1037 |
+
msgstr ""
|
1038 |
+
|
1039 |
+
#: inc/cleantalk-settings.php:990
|
1040 |
+
#, php-format
|
1041 |
+
msgid "SpamFireWall was updated %s. Now contains %s entries."
|
1042 |
+
msgstr ""
|
1043 |
+
|
1044 |
+
#: inc/cleantalk-settings.php:998
|
1045 |
+
#, php-format
|
1046 |
+
msgid "SpamFireWall sent %s events at %s."
|
1047 |
+
msgstr ""
|
1048 |
+
|
1049 |
+
#: inc/cleantalk-settings.php:1008
|
1050 |
+
msgid "There are no failed connections to server."
|
1051 |
+
msgstr ""
|
1052 |
+
|
1053 |
+
#: inc/cleantalk-settings.php:1035
|
1054 |
+
msgid "Send report"
|
1055 |
+
msgstr ""
|
1056 |
+
|
1057 |
+
#: inc/cleantalk-settings.php:1039
|
1058 |
+
msgid ""
|
1059 |
+
"Please, enable \"Send connection reports\" setting to be able to send reports"
|
1060 |
+
msgstr ""
|
1061 |
+
|
1062 |
+
#: inc/cleantalk-settings.php:1396
|
1063 |
+
msgid "Testing is failed. Please check the Access key."
|
1064 |
+
msgstr ""
|
1065 |
+
|
1066 |
+
#: inc/cleantalk-settings.php:1511
|
1067 |
+
msgid "XSS check"
|
1068 |
+
msgstr ""
|
1069 |
+
|
1070 |
+
#: inc/cleantalk-settings.php:1512
|
1071 |
+
msgid ""
|
1072 |
+
"Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to "
|
1073 |
+
"any user. As a result malicious scripts can not get access to the cookie "
|
1074 |
+
"files, session tokens and any other confidential information browsers use "
|
1075 |
+
"and store. Such scripts can even overwrite content of HTML pages. CleanTalk "
|
1076 |
+
"WAF monitors for patterns of these parameters and block them."
|
1077 |
+
msgstr ""
|
1078 |
+
|
1079 |
+
#: inc/cleantalk-settings.php:1515
|
1080 |
+
msgid "SQL-injection check"
|
1081 |
+
msgstr ""
|
1082 |
+
|
1083 |
+
#: inc/cleantalk-settings.php:1516
|
1084 |
+
msgid ""
|
1085 |
+
"SQL Injection — one of the most popular ways to hack websites and programs "
|
1086 |
+
"that work with databases. It is based on injection of a custom SQL code into "
|
1087 |
+
"database queries. It could transmit data through GET, POST requests or "
|
1088 |
+
"cookie files in an SQL code. If a website is vulnerable and execute such "
|
1089 |
+
"injections then it would allow attackers to apply changes to the website's "
|
1090 |
+
"MySQL database."
|
1091 |
+
msgstr ""
|
1092 |
+
|
1093 |
+
#: inc/cleantalk-settings.php:1519
|
1094 |
+
msgid "Check uploaded files"
|
1095 |
+
msgstr ""
|
1096 |
+
|
1097 |
+
#: inc/cleantalk-settings.php:1520
|
1098 |
+
msgid ""
|
1099 |
+
"The option checks each uploaded file to a website for malicious code. If "
|
1100 |
+
"it's possible for visitors to upload files to a website, for instance a work "
|
1101 |
+
"resume, then attackers could abuse it and upload an infected file to execute "
|
1102 |
+
"it later and get access to your website."
|
1103 |
+
msgstr ""
|
1104 |
+
|
1105 |
+
#. Widget name will appear in UI
|
1106 |
+
#: inc/cleantalk-widget.php:22
|
1107 |
+
msgid "CleanTalk Widget"
|
1108 |
+
msgstr ""
|
1109 |
+
|
1110 |
+
#: inc/cleantalk-widget.php:25
|
1111 |
+
msgid "CleanTalk widget"
|
1112 |
+
msgstr ""
|
1113 |
+
|
1114 |
+
#: inc/cleantalk-widget.php:35 inc/cleantalk-widget.php:86
|
1115 |
+
msgid "Spam blocked"
|
1116 |
+
msgstr ""
|
1117 |
+
|
1118 |
+
#: inc/cleantalk-widget.php:73
|
1119 |
+
msgid "CleanTalk's main page"
|
1120 |
+
msgstr ""
|
1121 |
+
|
1122 |
+
#: inc/cleantalk-widget.php:74
|
1123 |
+
msgid "spam"
|
1124 |
+
msgstr ""
|
1125 |
+
|
1126 |
+
#: inc/cleantalk-widget.php:74
|
1127 |
+
msgid "blocked by"
|
1128 |
+
msgstr ""
|
1129 |
+
|
1130 |
+
#: inc/cleantalk-widget.php:91
|
1131 |
+
msgid "Title:"
|
1132 |
+
msgstr ""
|
1133 |
+
|
1134 |
+
#: inc/cleantalk-widget.php:96
|
1135 |
+
msgid "Style:"
|
1136 |
+
msgstr ""
|
1137 |
+
|
1138 |
+
#: inc/cleantalk-widget.php:98
|
1139 |
+
msgid "CleanTalk's Style"
|
1140 |
+
msgstr ""
|
1141 |
+
|
1142 |
+
#: inc/cleantalk-widget.php:99
|
1143 |
+
msgid "Light"
|
1144 |
+
msgstr ""
|
1145 |
+
|
1146 |
+
#: inc/cleantalk-widget.php:100
|
1147 |
+
msgid "Extremely Light"
|
1148 |
+
msgstr ""
|
1149 |
+
|
1150 |
+
#: inc/cleantalk-widget.php:101
|
1151 |
+
msgid "Dark"
|
1152 |
+
msgstr ""
|
1153 |
+
|
1154 |
+
#: inc/cleantalk-widget.php:106
|
1155 |
+
msgid "Referal link ID:"
|
1156 |
+
msgstr ""
|
1157 |
+
|
1158 |
+
#: lib/CleantalkSFW.php:71
|
1159 |
+
msgid "SpamFireWall is activated for your IP "
|
1160 |
+
msgstr ""
|
1161 |
+
|
1162 |
+
#: lib/CleantalkSFW.php:72
|
1163 |
+
msgid ""
|
1164 |
+
"To continue working with web site, please make sure that you have enabled "
|
1165 |
+
"JavaScript."
|
1166 |
+
msgstr ""
|
1167 |
+
|
1168 |
+
#: lib/CleantalkSFW.php:73
|
1169 |
+
msgid "Please click below to pass protection,"
|
1170 |
+
msgstr ""
|
1171 |
+
|
1172 |
+
#: lib/CleantalkSFW.php:74
|
1173 |
+
#, php-format
|
1174 |
+
msgid ""
|
1175 |
+
"Or you will be automatically redirected to the requested page after %d "
|
1176 |
+
"seconds."
|
1177 |
+
msgstr ""
|
1178 |
+
|
1179 |
+
#: lib/CleantalkSFW.php:75
|
1180 |
+
msgid "Antispam by CleanTalk"
|
1181 |
+
msgstr ""
|
1182 |
+
|
1183 |
+
#: lib/CleantalkSFW.php:76
|
1184 |
+
msgid "This is the testing page for SpamFireWall"
|
1185 |
+
msgstr ""
|
1186 |
+
|
1187 |
+
#: templates/translate_banner.php:6
|
1188 |
+
msgid "Help others use the plugin in your language."
|
1189 |
+
msgstr ""
|
1190 |
+
|
1191 |
+
#: templates/translate_banner.php:7
|
1192 |
+
msgid ""
|
1193 |
+
"We ask you to help with the translation of the plugin in your language. "
|
1194 |
+
"Please take a few minutes to make the plugin more comfortable."
|
1195 |
+
msgstr ""
|
1196 |
+
|
1197 |
+
#: templates/translate_banner.php:10
|
1198 |
+
msgid "TRANSLATE"
|
1199 |
+
msgstr ""
|
1200 |
+
|
1201 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:29
|
1202 |
+
msgid "Author"
|
1203 |
+
msgstr ""
|
1204 |
+
|
1205 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:30
|
1206 |
+
msgid "Comment"
|
1207 |
+
msgstr ""
|
1208 |
+
|
1209 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:31
|
1210 |
+
msgid " \tIn Response To"
|
1211 |
+
msgstr ""
|
1212 |
+
|
1213 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:74
|
1214 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:81
|
1215 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:83
|
1216 |
+
msgid "No IP adress"
|
1217 |
+
msgstr ""
|
1218 |
+
|
1219 |
+
#: inc/find-spam/ClassCleantalkCommentsListTable.php:187
|
1220 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:145
|
1221 |
+
msgid "No spam found."
|
1222 |
+
msgstr ""
|
1223 |
+
|
1224 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:11
|
1225 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:11
|
1226 |
+
msgid "Start time"
|
1227 |
+
msgstr ""
|
1228 |
+
|
1229 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:12
|
1230 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:12
|
1231 |
+
msgid "Checked"
|
1232 |
+
msgstr ""
|
1233 |
+
|
1234 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:13
|
1235 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:13
|
1236 |
+
msgid "Found spam"
|
1237 |
+
msgstr ""
|
1238 |
+
|
1239 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:14
|
1240 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:14
|
1241 |
+
msgid "Found bad"
|
1242 |
+
msgstr ""
|
1243 |
+
|
1244 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableLogs.php:60
|
1245 |
+
#: inc/find-spam/ClassCleantalkUsersListTableLogs.php:60
|
1246 |
+
msgid "No logs found."
|
1247 |
+
msgstr ""
|
1248 |
+
|
1249 |
+
#: inc/find-spam/ClassCleantalkCommentsListTableSpam.php:47
|
1250 |
+
msgid "Delete all comments from the list"
|
1251 |
+
msgstr ""
|
1252 |
+
|
1253 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:76
|
1254 |
+
msgid "Start check"
|
1255 |
+
msgstr ""
|
1256 |
+
|
1257 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:77
|
1258 |
+
msgid "Continue check"
|
1259 |
+
msgstr ""
|
1260 |
+
|
1261 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:81
|
1262 |
+
msgid "Accurate check"
|
1263 |
+
msgstr ""
|
1264 |
+
|
1265 |
+
#: inc/find-spam/ClassCleantalkFindSpamChecker.php:86
|
1266 |
+
msgid "Specify date range"
|
1267 |
+
msgstr ""
|
1268 |
+
|
1269 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:25
|
1270 |
+
msgid "Failed from timeout. Going to check comments again."
|
1271 |
+
msgstr ""
|
1272 |
+
|
1273 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:26
|
1274 |
+
msgid "Delete all spam comments?"
|
1275 |
+
msgstr ""
|
1276 |
+
|
1277 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:27
|
1278 |
+
msgid "comments"
|
1279 |
+
msgstr ""
|
1280 |
+
|
1281 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:28
|
1282 |
+
#, php-format
|
1283 |
+
msgid ""
|
1284 |
+
"Checked %s, found %s spam comments and %s bad comments (without IP or email)."
|
1285 |
+
msgstr ""
|
1286 |
+
|
1287 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:29
|
1288 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:32
|
1289 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:395
|
1290 |
+
msgid "Please do backup of WordPress database before delete any accounts!"
|
1291 |
+
msgstr ""
|
1292 |
+
|
1293 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:339
|
1294 |
+
#, php-format
|
1295 |
+
msgid ""
|
1296 |
+
"Checked %s, found %s spam comments and %s bad comments (without IP or email)"
|
1297 |
+
msgstr ""
|
1298 |
+
|
1299 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:346
|
1300 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:381
|
1301 |
+
msgid "Never checked yet or no new spam."
|
1302 |
+
msgstr ""
|
1303 |
+
|
1304 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:349
|
1305 |
+
#, php-format
|
1306 |
+
msgid ""
|
1307 |
+
"Last check %s: checked %s comments, found %s spam comments and %s bad "
|
1308 |
+
"comments (without IP or email)."
|
1309 |
+
msgstr ""
|
1310 |
+
|
1311 |
+
#: inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php:360
|
1312 |
+
msgid "Please do backup of WordPress database before delete any comments!"
|
1313 |
+
msgstr ""
|
1314 |
+
|
1315 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:89
|
1316 |
+
#, php-format
|
1317 |
+
msgid ""
|
1318 |
+
"Antispam hosting tariff does not allow you to use this feature. To do so, "
|
1319 |
+
"you need to enter an Access Key in the %splugin settings%s."
|
1320 |
+
msgstr ""
|
1321 |
+
|
1322 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:101
|
1323 |
+
msgid "Plugin Settings"
|
1324 |
+
msgstr ""
|
1325 |
+
|
1326 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:106
|
1327 |
+
msgid "Scan and new results"
|
1328 |
+
msgstr ""
|
1329 |
+
|
1330 |
+
#: inc/find-spam/ClassCleantalkFindSpamPage.php:119
|
1331 |
+
msgid "Show per page"
|
1332 |
+
msgstr ""
|
1333 |
+
|
1334 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:26
|
1335 |
+
msgid "Failed from timeout. Going to check users again."
|
1336 |
+
msgstr ""
|
1337 |
+
|
1338 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:27
|
1339 |
+
msgid "Failed from timeout. Going to run a new attempt to delete spam users."
|
1340 |
+
msgstr ""
|
1341 |
+
|
1342 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:28
|
1343 |
+
msgid "Delete all spam users?"
|
1344 |
+
msgstr ""
|
1345 |
+
|
1346 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:29
|
1347 |
+
msgid "users."
|
1348 |
+
msgstr ""
|
1349 |
+
|
1350 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:31
|
1351 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:374
|
1352 |
+
#, php-format
|
1353 |
+
msgid "Checked %s, found %s spam users and %s bad users (without IP or email)"
|
1354 |
+
msgstr ""
|
1355 |
+
|
1356 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:384
|
1357 |
+
#, php-format
|
1358 |
+
msgid ""
|
1359 |
+
"Last check %s: checked %s users, found %s spam users and %s bad users "
|
1360 |
+
"(without IP or email)."
|
1361 |
+
msgstr ""
|
1362 |
+
|
1363 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:616
|
1364 |
+
#, php-format
|
1365 |
+
msgid "SPAM. Checked %s."
|
1366 |
+
msgstr ""
|
1367 |
+
|
1368 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:619
|
1369 |
+
#, php-format
|
1370 |
+
msgid "Not spam. Checked %s."
|
1371 |
+
msgstr ""
|
1372 |
+
|
1373 |
+
#: inc/find-spam/ClassCleantalkFindSpamUsersChecker.php:623
|
1374 |
+
msgid "Not checked yet. Anti-Spam by CleanTalk."
|
1375 |
+
msgstr ""
|
1376 |
+
|
1377 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:31
|
1378 |
+
msgid "Username"
|
1379 |
+
msgstr ""
|
1380 |
+
|
1381 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:32
|
1382 |
+
msgid "Name"
|
1383 |
+
msgstr ""
|
1384 |
+
|
1385 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:33
|
1386 |
+
msgid "E-mail"
|
1387 |
+
msgstr ""
|
1388 |
+
|
1389 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:34
|
1390 |
+
msgid "Signed up"
|
1391 |
+
msgstr ""
|
1392 |
+
|
1393 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:35
|
1394 |
+
msgid "Role"
|
1395 |
+
msgstr ""
|
1396 |
+
|
1397 |
+
#: inc/find-spam/ClassCleantalkUsersListTable.php:36
|
1398 |
+
msgid "Posts"
|
1399 |
+
msgstr ""
|
1400 |
+
|
1401 |
+
#: inc/find-spam/ClassCleantalkUsersListTableSpam.php:57
|
1402 |
+
msgid "Delete all users from list"
|
1403 |
+
msgstr ""
|
1404 |
+
|
1405 |
+
#: inc/find-spam/ClassCleantalkUsersListTableSpam.php:58
|
1406 |
+
msgid "Download results in CSV"
|
1407 |
+
msgstr ""
|
1408 |
+
|
1409 |
+
#. Name of the plugin
|
1410 |
+
msgid "Anti-Spam by CleanTalk"
|
1411 |
+
msgstr ""
|
1412 |
+
|
1413 |
+
#. Description of the plugin
|
1414 |
+
msgid ""
|
1415 |
+
"Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam,"
|
1416 |
+
" no registration spam, no contact spam, protects any WordPress forms."
|
1417 |
+
msgstr ""
|
1418 |
+
|
1419 |
+
#. URI of the plugin
|
1420 |
+
#. Author URI of the plugin
|
1421 |
+
msgid "https://cleantalk.org"
|
1422 |
+
msgstr ""
|
1423 |
+
|
1424 |
+
#. Author of the plugin
|
1425 |
+
msgid "СleanTalk <welcome@cleantalk.org>"
|
1426 |
+
msgstr ""
|
inc/cleantalk-admin.php
CHANGED
@@ -1,701 +1,710 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once('cleantalk-settings.php');
|
4 |
-
|
5 |
-
// Add buttons to comments list table
|
6 |
-
add_action( 'manage_comments_nav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
|
7 |
-
add_action( 'manage_users_extra_tablenav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
|
8 |
-
|
9 |
-
// Check renew banner
|
10 |
-
add_action( 'wp_ajax_apbct_settings__check_renew_banner', 'apbct_settings__check_renew_banner');
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
<
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
<
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
.'
|
103 |
-
.'</
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
<
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
<?php
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
.'
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
if($apbct->
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
$
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
'
|
270 |
-
'
|
271 |
-
) );
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
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 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
));
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
'
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
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 |
-
</h3>
|
392 |
-
</div>';
|
393 |
-
}
|
394 |
-
|
395 |
-
//key
|
396 |
-
if (!
|
397 |
-
echo
|
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 |
-
$apbct->data['user_counter']
|
488 |
-
$apbct->data['
|
489 |
-
$apbct->data['
|
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 |
-
|
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 |
-
'id' => '
|
588 |
-
'title' => '<
|
589 |
-
'parent' => 'ct_parent_node'
|
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 |
-
$result
|
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 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once('cleantalk-settings.php');
|
4 |
+
|
5 |
+
// Add buttons to comments list table
|
6 |
+
add_action( 'manage_comments_nav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
|
7 |
+
add_action( 'manage_users_extra_tablenav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
|
8 |
+
|
9 |
+
// Check renew banner
|
10 |
+
add_action( 'wp_ajax_apbct_settings__check_renew_banner', 'apbct_settings__check_renew_banner');
|
11 |
+
|
12 |
+
// Check SFW update progress
|
13 |
+
add_action( 'wp_ajax_apbct_settings__check_sfw_update_process', 'apbct_settings__check_sfw_update_process');
|
14 |
+
|
15 |
+
function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
|
16 |
+
|
17 |
+
global $apbct;
|
18 |
+
$current_screen = get_current_screen();
|
19 |
+
|
20 |
+
if( 'users' == $current_screen->base ) {
|
21 |
+
$button_url__check = $current_screen->base . '.php?page=ct_check_users';
|
22 |
+
$button_url__results = $current_screen->base . '.php?page=ct_check_users_total';
|
23 |
+
$button_description = 'users';
|
24 |
+
} elseif ( 'edit-comments' == $current_screen->base ) {
|
25 |
+
$button_url__check = $current_screen->base . '.php?page=ct_check_spam';
|
26 |
+
$button_url__results = $current_screen->base . '.php?page=ct_check_spam_total';
|
27 |
+
$button_description = 'comments';
|
28 |
+
} else {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
echo '
|
33 |
+
<a href="' . $button_url__check . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
|
34 |
+
<img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
|
35 |
+
' . sprintf(__( 'Find spam %s', 'cleantalk' ), $button_description ) . '
|
36 |
+
</a>
|
37 |
+
<a href="' . $button_url__results . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
|
38 |
+
<img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
|
39 |
+
' . sprintf(__( 'View spam %s', 'cleantalk' ), $button_description ) . '
|
40 |
+
</a>
|
41 |
+
<a href="https://cleantalk.org/my/show_requests?service_id=' . $apbct->data['service_id'] . '&int=week" target="_blank" class="button" style="margin:1px 0 0 0; display: inline-block;">
|
42 |
+
<img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
|
43 |
+
' . __( 'CleanTalk Anti-Spam Log', 'cleantalk' ) . '
|
44 |
+
</a>
|
45 |
+
';
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
add_action( 'admin_bar_menu', 'apbct_admin__admin_bar__add', 999 );
|
50 |
+
|
51 |
+
//Adding widjet
|
52 |
+
function ct_dashboard_statistics_widget() {
|
53 |
+
|
54 |
+
global $apbct;
|
55 |
+
|
56 |
+
if(apbct_is_user_role_in(array('administrator'))){
|
57 |
+
wp_add_dashboard_widget(
|
58 |
+
'ct_dashboard_statistics_widget',
|
59 |
+
$apbct->plugin_name
|
60 |
+
."<div class='ct_widget_top_links'>"
|
61 |
+
."<img src='".plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif')."' class='ct_preloader'>"
|
62 |
+
.sprintf(__("%sRefresh%s", 'cleantalk'), "<a href='#ct_widget' class='ct_widget_refresh_link'>", "</a>")
|
63 |
+
.sprintf(__("%sConfigure%s", 'cleantalk'), "<a href='{$apbct->settings_link}' class='ct_widget_settings_link'>", "</a>")
|
64 |
+
."</div>",
|
65 |
+
'ct_dashboard_statistics_widget_output'
|
66 |
+
);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
// Outputs statistics widget content
|
71 |
+
function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
|
72 |
+
|
73 |
+
global $apbct, $current_user;
|
74 |
+
|
75 |
+
echo "<div id='ct_widget_wrapper'>";
|
76 |
+
?>
|
77 |
+
<form id='ct_refresh_form' method='POST' action='#ct_widget'>
|
78 |
+
<input type='hidden' name='ct_brief_refresh' value='1'>
|
79 |
+
</form>
|
80 |
+
<h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk'); ?></h4>
|
81 |
+
<div class='ct_widget_block ct_widget_chart_wrapper'>
|
82 |
+
<div id='ct_widget_chart'></div>
|
83 |
+
</div>
|
84 |
+
<h4 class='ct_widget_block_header'><?php _e('Top 5 spam IPs blocked', 'cleantalk'); ?></h4>
|
85 |
+
<hr class='ct_widget_hr'>
|
86 |
+
<?php
|
87 |
+
if(!apbct_api_key__is_correct() || (isset($apbct->data['brief_data']['error_no']) && $apbct->data['brief_data']['error_no'] == 6)){
|
88 |
+
?> <div class='ct_widget_block'>
|
89 |
+
<form action='<? echo $apbct->settings_link; ?>' method='POST'>
|
90 |
+
<h2 class='ct_widget_activate_header'><?php _e('Get Access key to activate Anti-Spam protection!', 'cleantalk'); ?></h2>
|
91 |
+
<input class='ct_widget_button ct_widget_activate_button' type='submit' name='get_apikey_auto' value='ACTIVATE' />
|
92 |
+
</form>
|
93 |
+
</div>
|
94 |
+
<?php
|
95 |
+
}elseif(!empty($apbct->data['brief_data']['error'])){
|
96 |
+
echo '<div class="ct_widget_block">'
|
97 |
+
.'<h2 class="ct_widget_activate_header">'
|
98 |
+
.sprintf(__('Something went wrong! Error: "%s".', 'cleantalk'), "<u>{$apbct->brief_data['error']}</u>")
|
99 |
+
.'</h2>';
|
100 |
+
if($apbct->user_token && !$apbct->white_label){
|
101 |
+
echo '<h2 class="ct_widget_activate_header">'
|
102 |
+
.__('Please, visit your dashboard.', 'cleantalk')
|
103 |
+
.'</h2>'
|
104 |
+
.'<a target="_blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
|
105 |
+
.'<input class="ct_widget_button ct_widget_activate_button ct_widget_resolve_button" type="button" value="VISIT CONTROL PANEL">'
|
106 |
+
.'</a>';
|
107 |
+
}
|
108 |
+
echo '</div>';
|
109 |
+
}
|
110 |
+
|
111 |
+
if(apbct_api_key__is_correct() && empty($apbct->data['brief_data']['error'])){
|
112 |
+
?>
|
113 |
+
<div class='ct_widget_block'>
|
114 |
+
<table cellspacing="0">
|
115 |
+
<tr>
|
116 |
+
<th><?php _e('IP', 'cleantalk'); ?></th>
|
117 |
+
<th><?php _e('Country', 'cleantalk'); ?></th>
|
118 |
+
<th><?php _e('Block Count', 'cleantalk'); ?></th>
|
119 |
+
</tr>
|
120 |
+
<?php foreach($apbct->brief_data['top5_spam_ip'] as $val){ ?>
|
121 |
+
<tr>
|
122 |
+
<td><?php echo $val[0]; ?></td>
|
123 |
+
<td><?php echo $val[1] ? "<img src='https://cleantalk.org/images/flags/".strtolower($val[1]).".png'>" : ''; ?> <?php
|
124 |
+
echo $val[1]
|
125 |
+
? locale_get_display_region('sl-Latn-'.$val[1].'-nedis', substr(get_locale(), 0, 2))
|
126 |
+
: 'Unknown'; ?></td>
|
127 |
+
<td style='text-align: center;'><?php echo $val[2]; ?></td>
|
128 |
+
</tr>
|
129 |
+
<?php } ?>
|
130 |
+
</table>
|
131 |
+
<?php if($apbct->user_token){ ?>
|
132 |
+
<a target='_blank' href='https://cleantalk.org/my?user_token=<?php echo $apbct->user_token; ?>&cp_mode=antispam'>
|
133 |
+
<input class='ct_widget_button' id='ct_widget_button_view_all' type='button' value='View all'>
|
134 |
+
</a>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<?php
|
139 |
+
}
|
140 |
+
// Notice at the bottom
|
141 |
+
if(isset($current_user) && in_array('administrator', $current_user->roles)){
|
142 |
+
|
143 |
+
if($apbct->spam_count && $apbct->spam_count > 0){
|
144 |
+
echo '<div class="ct_widget_wprapper_total_blocked">'
|
145 |
+
.'<img src="'.$apbct->logo__small__colored.'" class="ct_widget_small_logo"/>'
|
146 |
+
.'<span title="'.sprintf(__('This is the count from the %s\'s cloud and could be different to admin bar counters', 'cleantalk').'">', $apbct->plugin_name)
|
147 |
+
.sprintf(
|
148 |
+
/* translators: %s: Number of spam messages */
|
149 |
+
__( '%s%s%s has blocked %s spam for all time. The statistics are automatically updated every 24 hours.', 'cleantalk'),
|
150 |
+
!$apbct->white_label ? '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=dashboard_widget&cp_mode=antispam" target="_blank">' : '',
|
151 |
+
$apbct->plugin_name,
|
152 |
+
!$apbct->white_label ? '</a>' : '',
|
153 |
+
number_format($apbct->data['spam_count'], 0, ',', ' ')
|
154 |
+
)
|
155 |
+
.'</span>'
|
156 |
+
.(!$apbct->white_label
|
157 |
+
? '<br><br>'
|
158 |
+
.'<b style="font-size: 16px;">'
|
159 |
+
.sprintf(
|
160 |
+
__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'),
|
161 |
+
'<u><a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">',
|
162 |
+
'</a></u>'
|
163 |
+
)
|
164 |
+
.'</b>'
|
165 |
+
: ''
|
166 |
+
)
|
167 |
+
.'</div>';
|
168 |
+
}
|
169 |
+
}
|
170 |
+
echo '</div>';
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Admin action 'admin_init' - Add the admin settings and such
|
175 |
+
*/
|
176 |
+
function apbct_admin__init(){
|
177 |
+
|
178 |
+
global $apbct;
|
179 |
+
|
180 |
+
// Getting dashboard widget statistics
|
181 |
+
if(!empty($_POST['ct_brief_refresh'])){
|
182 |
+
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
|
183 |
+
$apbct->saveData();
|
184 |
+
}
|
185 |
+
|
186 |
+
// Getting key like hoster. Only once!
|
187 |
+
if(!is_main_site() && $apbct->white_label && ( empty($apbct->api_key) || $apbct->settings['apikey'] == $apbct->network_settings['apikey'] ) ){
|
188 |
+
|
189 |
+
$_POST['submit'] = 'get_key_auto';
|
190 |
+
$apbct->save('settings');
|
191 |
+
$settings = get_option('cleantalk_settings');
|
192 |
+
$apbct->api_key = $settings['apikey'];
|
193 |
+
unset($_POST['submit']);
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
// AJAX actions
|
198 |
+
|
199 |
+
// Settings
|
200 |
+
add_action('wp_ajax_apbct_settings__get__long_description', 'apbct_settings__get__long_description'); // Long description
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Manage links in plugins list
|
205 |
+
* @return array
|
206 |
+
*/
|
207 |
+
function apbct_admin__plugin_action_links($links, $file) {
|
208 |
+
|
209 |
+
global $apbct;
|
210 |
+
|
211 |
+
$settings_link = '<a href="' . $apbct->settings_link . '">' . __( 'Settings' ) . '</a>';
|
212 |
+
|
213 |
+
array_unshift( $links, $settings_link ); // before other links
|
214 |
+
return $links;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Manage links and plugins page
|
219 |
+
* @return array
|
220 |
+
*/
|
221 |
+
function apbct_admin__register_plugin_links($links, $file){
|
222 |
+
|
223 |
+
global $apbct;
|
224 |
+
|
225 |
+
//Return if it's not our plugin
|
226 |
+
if ($file != $apbct->base_name)
|
227 |
+
return $links;
|
228 |
+
|
229 |
+
if($apbct->white_label){
|
230 |
+
$links = array_slice($links, 0, 1);
|
231 |
+
$links[] = "<script>jQuery('.plugin-title strong').each(function(i, item){
|
232 |
+
if(jQuery(item).html() == 'Anti-Spam by CleanTalk')
|
233 |
+
jQuery(item).html('{$apbct->plugin_name}');
|
234 |
+
});</script>";
|
235 |
+
return $links;
|
236 |
+
}
|
237 |
+
|
238 |
+
if(substr(get_locale(), 0, 2) != 'en')
|
239 |
+
$links[] = '<a class="ct_meta_links ct_translate_links" href="'
|
240 |
+
.sprintf('https://translate.wordpress.org/locale/%s/default/wp-plugins/cleantalk-spam-protect', substr(get_locale(), 0, 2))
|
241 |
+
.'" target="_blank">'
|
242 |
+
.__('Translate', 'cleantalk')
|
243 |
+
.'</a>';
|
244 |
+
|
245 |
+
$links[] = '<a class="ct_meta_links" href="'.$apbct->settings_link.'" target="_blank">' . __( 'Start here','cleantalk' ) . '</a>';
|
246 |
+
$links[] = '<a class="ct_meta_links ct_faq_links" href="https://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
247 |
+
$links[] = '<a class="ct_meta_links ct_support_links"href="https://wordpress.org/support/plugin/cleantalk-spam-protect" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
248 |
+
$trial = apbct_admin__badge__get_premium(false);
|
249 |
+
if(!empty($trial))
|
250 |
+
$links[] = apbct_admin__badge__get_premium(false);
|
251 |
+
|
252 |
+
return $links;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
257 |
+
* @param string $hook URL of hooked page
|
258 |
+
*/
|
259 |
+
function apbct_admin__enqueue_scripts($hook){
|
260 |
+
|
261 |
+
global $apbct;
|
262 |
+
|
263 |
+
// Scripts to all admin pages
|
264 |
+
wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin.min.js'), array(), APBCT_VERSION);
|
265 |
+
wp_enqueue_script('ct_common_js_funcs', plugins_url('/cleantalk-spam-protect/js/apbct-common.min.js'), array(), APBCT_VERSION);
|
266 |
+
wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.min.css'), array(), APBCT_VERSION, 'all');
|
267 |
+
|
268 |
+
wp_localize_script( 'ct_common_js_funcs', 'ctCommon', array(
|
269 |
+
'_ajax_nonce' => wp_create_nonce( 'ct_secret_nonce' ),
|
270 |
+
'_ajax_url' => admin_url( 'admin-ajax.php' ),
|
271 |
+
) );
|
272 |
+
|
273 |
+
wp_localize_script( 'jquery', 'ctAdminCommon', array(
|
274 |
+
'_ajax_nonce' => wp_create_nonce( 'ct_secret_nonce' ),
|
275 |
+
'_ajax_url' => admin_url( 'admin-ajax.php' ),
|
276 |
+
'plugin_name' => $apbct->plugin_name,
|
277 |
+
'logo' => '<img src="' . $apbct->logo . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
278 |
+
'logo_small' => '<img src="' . $apbct->logo__small . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
279 |
+
'logo_small_colored' => '<img src="' . $apbct->logo__small__colored . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
280 |
+
) );
|
281 |
+
|
282 |
+
// DASHBOARD page JavaScript and CSS
|
283 |
+
if($hook == 'index.php' && apbct_is_user_role_in(array('administrator'))){
|
284 |
+
|
285 |
+
wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.min.css'), array(), APBCT_VERSION, 'all');
|
286 |
+
wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
|
287 |
+
|
288 |
+
wp_enqueue_script('ct_gstatic_charts_loader', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget--google-charts.min.js'), array(), APBCT_VERSION);
|
289 |
+
wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.min.js'), array('ct_gstatic_charts_loader'), APBCT_VERSION);
|
290 |
+
|
291 |
+
// Preparing widget data
|
292 |
+
// Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
|
293 |
+
$to_chart = array();
|
294 |
+
|
295 |
+
// Crunch. Response contains error.
|
296 |
+
if(!empty($apbct->data['brief_data']['error']))
|
297 |
+
$apbct->data['brief_data'] = array_merge($apbct->data['brief_data'], $apbct->def_data['brief_data']);
|
298 |
+
|
299 |
+
foreach( $apbct->data['brief_data']['spam_stat'] as $key => $value ){
|
300 |
+
$to_chart[] = array( $key, $value );
|
301 |
+
} unset( $key, $value );
|
302 |
+
|
303 |
+
wp_localize_script( 'jquery', 'apbctDashboardWidget', array(
|
304 |
+
'data' => $to_chart,
|
305 |
+
));
|
306 |
+
}
|
307 |
+
|
308 |
+
// SETTINGS's page JavaScript and CSS
|
309 |
+
if( $hook == 'settings_page_cleantalk' ){
|
310 |
+
|
311 |
+
// jQueryUI
|
312 |
+
wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'), array('jquery'), '1.12.1' );
|
313 |
+
wp_enqueue_style('jqueryui_css', plugins_url('/cleantalk-spam-protect/css/jquery-ui.min.css'),array(), '1.21.1', 'all');
|
314 |
+
|
315 |
+
wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.min.js'), array(), APBCT_VERSION);
|
316 |
+
wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.min.css'), array(), APBCT_VERSION, 'all');
|
317 |
+
wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
|
318 |
+
|
319 |
+
wp_localize_script( 'jquery', 'ctSettingsPage', array(
|
320 |
+
'ct_subtitle' => $apbct->ip_license ? __('Hosting AntiSpam', 'cleantalk') : '',
|
321 |
+
'ip_license' => $apbct->ip_license ? true : false,
|
322 |
+
));
|
323 |
+
}
|
324 |
+
|
325 |
+
// COMMENTS page JavaScript
|
326 |
+
if($hook == 'edit-comments.php'){
|
327 |
+
wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-editscreen.min.js'), array(), APBCT_VERSION);
|
328 |
+
wp_localize_script( 'jquery', 'ctCommentsScreen', array(
|
329 |
+
'ct_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
|
330 |
+
'spambutton_text' => __("Find spam comments", 'cleantalk'),
|
331 |
+
'ct_feedback_msg_whitelisted' => __("The sender has been whitelisted.", 'cleantalk'),
|
332 |
+
'ct_feedback_msg_blacklisted' => __("The sender has been blacklisted.", 'cleantalk'),
|
333 |
+
'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
|
334 |
+
'ct_show_check_links' => (bool)$apbct->settings['show_check_links'],
|
335 |
+
'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif",
|
336 |
+
));
|
337 |
+
}
|
338 |
+
|
339 |
+
// USERS page JavaScript
|
340 |
+
if($hook == 'users.php'){
|
341 |
+
wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
|
342 |
+
wp_enqueue_script('ct_users_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-editscreen.min.js'), array(), APBCT_VERSION);
|
343 |
+
wp_localize_script( 'jquery', 'ctUsersScreen', array(
|
344 |
+
'spambutton_text' => __("Find spam-users", 'cleantalk'),
|
345 |
+
'ct_show_check_links' => (bool)$apbct->settings['show_check_links'],
|
346 |
+
'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif"
|
347 |
+
));
|
348 |
+
}
|
349 |
+
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Notice blog owner if plugin is used without Access key
|
354 |
+
* @return bool
|
355 |
+
*/
|
356 |
+
function apbct_admin__notice_message(){
|
357 |
+
|
358 |
+
global $apbct;
|
359 |
+
|
360 |
+
$page = get_current_screen();
|
361 |
+
|
362 |
+
//General notice control flags
|
363 |
+
$self_owned_key = ($apbct->moderate_ip == 0 && !defined('CLEANTALK_ACCESS_KEY') ? true : false);
|
364 |
+
$is_dashboard = (is_network_admin() || is_admin() ? true : false);
|
365 |
+
$is_admin = (current_user_can('activate_plugins') ? true : false);
|
366 |
+
|
367 |
+
$page_is_ct_settings = (in_array($page->id, array('settings_page_cleantalk', 'settings_page_cleantalk-network', 'comments_page_ct_check_spam', 'users_page_ct_check_users')) ? true : false);
|
368 |
+
|
369 |
+
//Misc
|
370 |
+
$user_token = ($apbct->user_token ? '&user_token='.$apbct->user_token : '');
|
371 |
+
|
372 |
+
if( is_network_admin() ) {
|
373 |
+
$site_url = get_site_option('siteurl');
|
374 |
+
$site_url = preg_match( '/\/$/', $site_url ) ? $site_url : $site_url . '/';
|
375 |
+
$settings_link = $site_url . 'wp-admin/options-general.php?page=cleantalk';
|
376 |
+
} else {
|
377 |
+
$settings_link = 'options-general.php?page=cleantalk';
|
378 |
+
}
|
379 |
+
|
380 |
+
if($self_owned_key && $is_dashboard && $is_admin){
|
381 |
+
// Auto update notice
|
382 |
+
/* Disabled at 09.09.2018
|
383 |
+
if($apbct->notice_auto_update == 1 && $apbct->auto_update != -1 && empty($_COOKIE['apbct_update_banner_closed'])){
|
384 |
+
$link = '<a href="https://cleantalk.org/help/cleantalk-auto-update" target="_blank">%s</a>';
|
385 |
+
$button = sprintf($link, '<input type="button" class="button button-primary" value="'.__('Learn more', 'cleantalk').'" />');
|
386 |
+
echo '<div class="error notice is-dismissible apbct_update_notice">'
|
387 |
+
.'<h3>'
|
388 |
+
.__('Do you know that Anti-Spam by CleanTalk has auto update option?', 'cleantalk')
|
389 |
+
.'</br></br>'
|
390 |
+
.$button
|
391 |
+
.'</h3>'
|
392 |
+
.'</div>';
|
393 |
+
}
|
394 |
+
*/
|
395 |
+
//Unable to get key automatically (if apbct_admin__init().getAutoKey() returns error)
|
396 |
+
if ($apbct->notice_show && !empty($apbct->errors['get_key']) && !$apbct->white_label){
|
397 |
+
echo '<div class="error">
|
398 |
+
<h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $apbct->api_key).
|
399 |
+
"<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=" . urlencode(ct_get_admin_email())."&website=" . urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a>
|
400 |
+
</h3>
|
401 |
+
</div>';
|
402 |
+
}
|
403 |
+
|
404 |
+
//key == "" || "enter key"
|
405 |
+
if (!apbct_api_key__is_correct() && $apbct->moderate_ip == 0){
|
406 |
+
echo "<div class='error'>"
|
407 |
+
."<h3>"
|
408 |
+
.sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href='{$settings_link}'>$apbct->plugin_name</a>")
|
409 |
+
."</h3>"
|
410 |
+
."</div>";
|
411 |
+
$apbct->notice_show = false;
|
412 |
+
}
|
413 |
+
|
414 |
+
//"Trial period ends" notice from apbct_admin__init().api_method__notice_paid_till()
|
415 |
+
if ($apbct->notice_show && $apbct->notice_trial == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
|
416 |
+
if(isset($_GET['page']) && in_array($_GET['page'], array('cleantalk', 'ct_check_spam', 'ct_check_users'))){
|
417 |
+
echo '<div class="error" id="apbct_trial_notice">
|
418 |
+
<h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
|
419 |
+
"<a href='{$settings_link}'>".$apbct->plugin_name."</a>",
|
420 |
+
"<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") .
|
421 |
+
'</h3>
|
422 |
+
<h4 style = "color: gray">Account status updates every minute.</h4>
|
423 |
+
</div>';
|
424 |
+
$apbct->notice_show = false;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
//Renew notice from apbct_admin_init().api_method__notice_paid_till()
|
429 |
+
if ($apbct->notice_show && $apbct->notice_renew == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
|
430 |
+
$renew_link = "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%%20backend%%20renew$user_token&cp_mode=antispam\" target=\"_blank\">%s</a>";
|
431 |
+
$button_html = sprintf($renew_link, '<input type="button" class="button button-primary" value="'.__('RENEW ANTI-SPAM', 'cleantalk').'" />');
|
432 |
+
$link_html = sprintf($renew_link, "<b>".__('next year', 'cleantalk')."</b>");
|
433 |
+
|
434 |
+
echo '<div class="updated" id="apbct_renew_notice">
|
435 |
+
<h3>'.
|
436 |
+
sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), $link_html).
|
437 |
+
'</h3>
|
438 |
+
<h4 style = "color: gray">Account status updates every minute.</h4>
|
439 |
+
'.$button_html.'
|
440 |
+
<br/><br/>
|
441 |
+
</div>';
|
442 |
+
$apbct->notice_show = false;
|
443 |
+
}
|
444 |
+
|
445 |
+
//"Wrong access key" notice (if ct_update_option().METHOD_notice_validate_key returns a error)
|
446 |
+
if ($apbct->notice_show && $page_is_ct_settings && !$apbct->data['key_is_ok'] && $apbct->moderate_ip == 0 && !$apbct->white_label){
|
447 |
+
echo '<div class="error">
|
448 |
+
<h3><b>'.
|
449 |
+
__("Wrong <a href='{$settings_link}'><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://wordpress.org/support/plugin/cleantalk-spam-protect/\">support</a>.", 'cleantalk').
|
450 |
+
'</b></h3>
|
451 |
+
</div>';
|
452 |
+
}
|
453 |
+
}
|
454 |
+
|
455 |
+
return true;
|
456 |
+
}
|
457 |
+
|
458 |
+
function apbct_admin__badge__get_premium($print = true, $out = ''){
|
459 |
+
|
460 |
+
global $apbct;
|
461 |
+
|
462 |
+
if($apbct->license_trial == 1 && $apbct->user_token){
|
463 |
+
$out .= '<b style="display: inline-block; margin-top: 10px;">'
|
464 |
+
.($print ? __('Make it right!', 'cleantalk').' ' : '')
|
465 |
+
.sprintf(
|
466 |
+
__('%sGet premium%s', 'cleantalk'),
|
467 |
+
'<a href="https://cleantalk.org/my/bill/recharge?user_token='.$apbct->user_token.'" target="_blank">',
|
468 |
+
'</a>'
|
469 |
+
)
|
470 |
+
.'</b>';
|
471 |
+
}
|
472 |
+
|
473 |
+
if($print)
|
474 |
+
echo $out;
|
475 |
+
else
|
476 |
+
return $out;
|
477 |
+
}
|
478 |
+
|
479 |
+
function apbct_admin__admin_bar__add( $wp_admin_bar ) {
|
480 |
+
|
481 |
+
global $apbct;
|
482 |
+
|
483 |
+
if (current_user_can('activate_plugins') && $apbct->settings['show_adminbar'] == 1 && (apbct_api_key__is_correct($apbct->api_key) !== false || (defined('CLEANTALK_SHOW_ADMIN_BAR_FORCE') && CLEANTALK_SHOW_ADMIN_BAR_FORCE))) {
|
484 |
+
|
485 |
+
//Reset or create user counter
|
486 |
+
if(!empty($_GET['ct_reset_user_counter'])){
|
487 |
+
$apbct->data['user_counter']['accepted'] = 0;
|
488 |
+
$apbct->data['user_counter']['blocked'] = 0;
|
489 |
+
$apbct->data['user_counter']['since'] = date('d M');
|
490 |
+
$apbct->saveData();
|
491 |
+
}
|
492 |
+
//Reset or create all counters
|
493 |
+
if(!empty($_GET['ct_reset_all_counters'])){
|
494 |
+
$apbct->data['sfw_counter'] = array('all' => 0, 'blocked' => 0);
|
495 |
+
$apbct->data['all_time_counter'] = array('accepted' => 0, 'blocked' => 0);
|
496 |
+
$apbct->data['user_counter'] = array('all' => 0, 'accepted' => 0, 'blocked' => 0, 'since' => date('d M'));
|
497 |
+
$apbct->data['array_accepted'] = array();
|
498 |
+
$apbct->data['array_blocked'] = array();
|
499 |
+
$apbct->data['current_hour'] = '';
|
500 |
+
$apbct->saveData();
|
501 |
+
}
|
502 |
+
//Compile user's counter string
|
503 |
+
$user_counter=Array('accepted'=>$apbct->data['user_counter']['accepted'], 'blocked'=>$apbct->data['user_counter']['blocked'], 'all'=>$apbct->data['user_counter']['accepted'] + $apbct->data['user_counter']['blocked'], 'since'=>$apbct->data['user_counter']['since']);
|
504 |
+
//Previous version $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': ' .$user_counter['all']*/. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
|
505 |
+
$user_counter_str='<span style="color: white;">' . __('Since', 'cleantalk') . ' ' . $user_counter['since'].': </span><span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
|
506 |
+
|
507 |
+
$all_time_counter_str='';
|
508 |
+
//Don't compile if all time counter disabled
|
509 |
+
if($apbct->settings['all_time_counter'] == 1){
|
510 |
+
$all_time_counter=Array('accepted'=>$apbct->data['all_time_counter']['accepted'], 'blocked'=>$apbct->data['all_time_counter']['blocked'], 'all'=>$apbct->data['all_time_counter']['accepted'] + $apbct->data['all_time_counter']['blocked']);
|
511 |
+
$all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | ' . __('All', 'cleantalk') . ': ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
|
512 |
+
}
|
513 |
+
|
514 |
+
$daily_counter_str='';
|
515 |
+
//Don't compile if daily counter disabled
|
516 |
+
if( $apbct->settings['daily_counter'] == 1){
|
517 |
+
$daily_counter=Array('accepted'=>array_sum($apbct->data['array_accepted']), 'blocked'=>array_sum($apbct->data['array_blocked']), 'all'=>array_sum($apbct->data['array_accepted']) + array_sum($apbct->data['array_blocked']));
|
518 |
+
//Previous version $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
|
519 |
+
$daily_counter_str='<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | ' . __('Day', 'cleantalk') . ': </span><span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
|
520 |
+
}
|
521 |
+
$sfw_counter_str='';
|
522 |
+
//Don't compile if SFW counter disabled
|
523 |
+
if( $apbct->settings['sfw_counter'] == 1 && $apbct->settings['spam_firewall'] == 1){
|
524 |
+
$sfw_counter=Array('all'=>$apbct->data['sfw_counter']['all'], 'blocked'=>$apbct->data['sfw_counter']['blocked']);
|
525 |
+
$sfw_counter_str='<span style="color: white;" title="'.__('All / Blocked events. Access attempts regitred by SpamFireWall counted since the last plugin activation.', 'cleantalk').'"><span style="color: white;"> | SpamFireWall: ' .$sfw_counter['all']. '</span> / <span style="color: red;">' .$sfw_counter['blocked']. '</span></span>';
|
526 |
+
}
|
527 |
+
|
528 |
+
$args = array(
|
529 |
+
'id' => 'ct_parent_node',
|
530 |
+
'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" />'
|
531 |
+
.'<div style="margin: auto 7px;" class="ab-item alignright">'
|
532 |
+
.'<div class="ab-label" id="ct_stats">'
|
533 |
+
.($apbct->notice_trial == 1
|
534 |
+
? "<span><a style='color: red;' href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial&user_token={$apbct->user_token}&cp_mode=antispam\" target=\"_blank\">Renew Anti-Spam</a></span>"
|
535 |
+
: '<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.$sfw_counter_str
|
536 |
+
)
|
537 |
+
.'</div>'
|
538 |
+
.'</div>' //You could change widget string here by simply deleting variables
|
539 |
+
);
|
540 |
+
$wp_admin_bar->add_node( $args );
|
541 |
+
|
542 |
+
// DASHBOARD LINK
|
543 |
+
if(!$apbct->white_label){
|
544 |
+
$wp_admin_bar->add_node( array(
|
545 |
+
'id' => 'ct_dashboard_link',
|
546 |
+
'title' => '<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>',
|
547 |
+
'parent' => 'ct_parent_node'
|
548 |
+
));
|
549 |
+
}
|
550 |
+
|
551 |
+
$wp_admin_bar->add_node( array(
|
552 |
+
'id' => 'ct_settings_link',
|
553 |
+
'title' => '<a href="'.$apbct->settings_link.'">'.__('Settings', 'cleantalk').'</a>',
|
554 |
+
'parent' => 'ct_parent_node'
|
555 |
+
));
|
556 |
+
|
557 |
+
// add a child item to our parent item. Bulk checks.
|
558 |
+
if(!is_network_admin()){
|
559 |
+
$args = array(
|
560 |
+
'id' => 'ct_settings_bulk_comments',
|
561 |
+
'title' => '<hr style="margin-top: 7px;" /><a href="edit-comments.php?page=ct_check_spam" title="'.__('Bulk spam comments removal tool.', 'cleantalk').'">'.__('Check comments for spam', 'cleantalk').'</a>',
|
562 |
+
'parent' => 'ct_parent_node'
|
563 |
+
);
|
564 |
+
}
|
565 |
+
$wp_admin_bar->add_node( $args );
|
566 |
+
|
567 |
+
// add a child item to our parent item. Bulk checks.
|
568 |
+
if(!is_network_admin()){
|
569 |
+
$args = array(
|
570 |
+
'id' => 'ct_settings_bulk_users',
|
571 |
+
'title' => '<a href="users.php?page=ct_check_users" title="Bulk spam users removal tool.">'.__('Check users for spam', 'cleantalk').'</a>',
|
572 |
+
'parent' => 'ct_parent_node'
|
573 |
+
);
|
574 |
+
}
|
575 |
+
$wp_admin_bar->add_node( $args );
|
576 |
+
|
577 |
+
// User counter reset.
|
578 |
+
$args = array(
|
579 |
+
'id' => 'ct_reset_counter',
|
580 |
+
'title' => '<hr style="margin-top: 7px;"><a href="?ct_reset_user_counter=1" title="Reset your personal counter of submissions.">'.__('Reset first counter', 'cleantalk').'</a>',
|
581 |
+
'parent' => 'ct_parent_node'
|
582 |
+
);
|
583 |
+
$wp_admin_bar->add_node( $args );// add a child item to our parent item. Counter reset.
|
584 |
+
|
585 |
+
// Reset ALL counter
|
586 |
+
$args = array(
|
587 |
+
'id' => 'ct_reset_counters_all',
|
588 |
+
'title' => '<a href="?ct_reset_all_counters=1" title="Reset all counters.">'.__('Reset all counters', 'cleantalk').'</a>',
|
589 |
+
'parent' => 'ct_parent_node'
|
590 |
+
);
|
591 |
+
$wp_admin_bar->add_node( $args );
|
592 |
+
|
593 |
+
// Support link
|
594 |
+
if(!$apbct->white_label){
|
595 |
+
$wp_admin_bar->add_node( array(
|
596 |
+
'id' => 'ct_admin_bar_support_link',
|
597 |
+
'title' => '<hr style="margin-top: 7px;" /><a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>',
|
598 |
+
'parent' => 'ct_parent_node'
|
599 |
+
));
|
600 |
+
}
|
601 |
+
}
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Unmark bad words
|
606 |
+
* @param string $message
|
607 |
+
* @return string Cleat comment
|
608 |
+
*/
|
609 |
+
function apbct_comment__unmark_red($message) {
|
610 |
+
$message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
|
611 |
+
|
612 |
+
return $message;
|
613 |
+
}
|
614 |
+
|
615 |
+
// Ajax action feedback form comments page.
|
616 |
+
function apbct_comment__send_feedback($comment_id = null, $comment_status = null, $change_status = false, $direct_call = null){
|
617 |
+
|
618 |
+
// For AJAX call
|
619 |
+
if( ! $direct_call ){
|
620 |
+
check_ajax_referer('ct_secret_nonce', 'security');
|
621 |
+
}
|
622 |
+
|
623 |
+
$comment_id = ! $comment_id && isset( $_POST['comment_id'] ) ? $_POST['comment_id'] : false;
|
624 |
+
$comment_status = ! $comment_status && isset( $_POST['comment_status'] ) ? $_POST['comment_status'] : false;
|
625 |
+
$change_status = ! $change_status && isset( $_POST['change_status'] ) ? $_POST['change_status'] : false;
|
626 |
+
|
627 |
+
// If enter params is empty exit
|
628 |
+
if( ! $comment_id || ! $comment_status )
|
629 |
+
die();
|
630 |
+
|
631 |
+
// $comment = get_comment($comment_id, 'ARRAY_A');
|
632 |
+
$hash = get_comment_meta($comment_id, 'ct_hash', true);
|
633 |
+
|
634 |
+
// If we can send the feedback
|
635 |
+
if($hash){
|
636 |
+
|
637 |
+
// Approving
|
638 |
+
if($comment_status == '1' || $comment_status == 'approve'){
|
639 |
+
$result = ct_send_feedback($hash.":1");
|
640 |
+
// $comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
|
641 |
+
// wp_update_comment($comment);
|
642 |
+
$result === true ? 1 : 0;
|
643 |
+
}
|
644 |
+
|
645 |
+
// Disapproving
|
646 |
+
if($comment_status == 'spam'){
|
647 |
+
$result = ct_send_feedback($hash.":0");
|
648 |
+
$result === true ? 1 : 0;
|
649 |
+
}
|
650 |
+
}else{
|
651 |
+
$result = 'no_hash';
|
652 |
+
}
|
653 |
+
|
654 |
+
// Changing comment status(folder) if flag is set. spam || approve
|
655 |
+
if($change_status !== false)
|
656 |
+
wp_set_comment_status($comment_id, $comment_status);
|
657 |
+
|
658 |
+
if(!$direct_call){
|
659 |
+
echo !empty($result) ? $result : 0;
|
660 |
+
die();
|
661 |
+
}else{
|
662 |
+
|
663 |
+
}
|
664 |
+
}
|
665 |
+
|
666 |
+
// Ajax action feedback form user page.
|
667 |
+
function apbct_user__send_feedback($user_id = null, $status = null, $direct_call = null){
|
668 |
+
|
669 |
+
check_ajax_referer('ct_secret_nonce', 'security');
|
670 |
+
|
671 |
+
if(!$direct_call){
|
672 |
+
$user_id = $_POST['user_id'];
|
673 |
+
$status = $_POST['status'];
|
674 |
+
}
|
675 |
+
|
676 |
+
$hash = get_user_meta($user_id, 'ct_hash', true);
|
677 |
+
|
678 |
+
if($hash){
|
679 |
+
if($status == 'approve' || $status == 1){
|
680 |
+
$result = ct_send_feedback($hash.":1");
|
681 |
+
$result === true ? 1 : 0;
|
682 |
+
}
|
683 |
+
if($status == 'spam' || $status == 'disapprove' || $status == 0){
|
684 |
+
$result = ct_send_feedback($hash.":0");
|
685 |
+
$result === true ? 1 : 0;
|
686 |
+
}
|
687 |
+
}else{
|
688 |
+
$result = 'no_hash';
|
689 |
+
}
|
690 |
+
|
691 |
+
if(!$direct_call){
|
692 |
+
echo !empty($result) ? $result : 0;
|
693 |
+
die();
|
694 |
+
}else{
|
695 |
+
|
696 |
+
}
|
697 |
+
|
698 |
+
}
|
699 |
+
|
700 |
+
/**
|
701 |
+
* Send feedback when user deleted
|
702 |
+
* @return null
|
703 |
+
*/
|
704 |
+
function apbct_user__delete__hook($user_id, $reassign = null){
|
705 |
+
|
706 |
+
$hash = get_user_meta($user_id, 'ct_hash', true);
|
707 |
+
if ($hash !== '') {
|
708 |
+
ct_feedback($hash, 0);
|
709 |
+
}
|
710 |
}
|
inc/cleantalk-ajax.php
CHANGED
@@ -1,766 +1,775 @@
|
|
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 |
-
/* The Fluent Form have the direct integration */
|
147 |
-
$cleantalk_hooked_actions[] = 'fluentform_submit';
|
148 |
-
|
149 |
-
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
150 |
-
|
151 |
-
$email = is_null( $email ) ? $email : $_POST['email'];
|
152 |
-
$email = sanitize_email($email);
|
153 |
-
$is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
|
154 |
-
|
155 |
-
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
|
156 |
-
|
157 |
-
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
158 |
-
$sender_info['post_checkjs_passed'] = $checkjs;
|
159 |
-
if ($checkjs === null){
|
160 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
161 |
-
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
162 |
-
}
|
163 |
-
|
164 |
-
//Making a call
|
165 |
-
$base_call_result = apbct_base_call(
|
166 |
-
array(
|
167 |
-
'sender_email' => $email,
|
168 |
-
'sender_nickname' => '',
|
169 |
-
'sender_info' => $sender_info,
|
170 |
-
'js_on' => $checkjs,
|
171 |
-
),
|
172 |
-
true
|
173 |
-
);
|
174 |
-
|
175 |
-
$ct_result = $base_call_result['ct_result'];
|
176 |
-
|
177 |
-
if ($ct_result->allow===0){
|
178 |
-
$is_good=false;
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
if($is_good){
|
183 |
-
$ajaxresult=array(
|
184 |
-
'description' => null,
|
185 |
-
'cssClass' => 'noon',
|
186 |
-
'code' => 'success'
|
187 |
-
);
|
188 |
-
}else{
|
189 |
-
$ajaxresult=array(
|
190 |
-
'description' => 'Invalid Email',
|
191 |
-
'cssClass' => 'error-container',
|
192 |
-
'code' => 'error'
|
193 |
-
);
|
194 |
-
}
|
195 |
-
|
196 |
-
$ajaxresult = json_encode($ajaxresult);
|
197 |
-
print $ajaxresult;
|
198 |
-
wp_die();
|
199 |
-
}
|
200 |
-
|
201 |
-
function ct_user_register_ajaxlogin($user_id)
|
202 |
-
{
|
203 |
-
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
204 |
-
{
|
205 |
-
|
206 |
-
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
207 |
-
$sender_info['post_checkjs_passed'] = $checkjs;
|
208 |
-
if ($checkjs === null){
|
209 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
210 |
-
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
211 |
-
}
|
212 |
-
|
213 |
-
//Making a call
|
214 |
-
$base_call_result = apbct_base_call(
|
215 |
-
array(
|
216 |
-
'sender_email' => sanitize_email($_POST['email']),
|
217 |
-
'sender_nickname' => sanitize_email($_POST['login']),
|
218 |
-
'sender_info' => $sender_info,
|
219 |
-
'js_on' => $checkjs,
|
220 |
-
),
|
221 |
-
true
|
222 |
-
);
|
223 |
-
|
224 |
-
$ct_result = $base_call_result['ct_result'];
|
225 |
-
|
226 |
-
if ($ct_result->allow === 0)
|
227 |
-
{
|
228 |
-
wp_delete_user($user_id);
|
229 |
-
}
|
230 |
-
}
|
231 |
-
return $user_id;
|
232 |
-
}
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
|
236 |
-
*
|
237 |
-
* @param array $errors
|
238 |
-
* @return array
|
239 |
-
*/
|
240 |
-
function ct_mc4wp_ajax_hook( array $errors )
|
241 |
-
{
|
242 |
-
$result = ct_ajax_hook();
|
243 |
-
|
244 |
-
// only return modified errors array when function returned a string value (the message key)
|
245 |
-
if( is_string( $result ) ) {
|
246 |
-
$errors[] = $result;
|
247 |
-
}
|
248 |
-
|
249 |
-
return $errors;
|
250 |
-
}
|
251 |
-
|
252 |
-
function ct_ajax_hook($message_obj = false, $additional = false)
|
253 |
-
{
|
254 |
-
global $apbct, $current_user;
|
255 |
-
|
256 |
-
$message_obj = (array)$message_obj;
|
257 |
-
|
258 |
-
// Get current_user and set it globaly
|
259 |
-
apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
|
260 |
-
|
261 |
-
// Go out because of not spam data
|
262 |
-
$skip_post = array(
|
263 |
-
'apbct_js_keys__get', // Our service code
|
264 |
-
'gmaps_display_info_window', // Geo My WP pop-up windows.
|
265 |
-
'gmw_ps_display_info_window', // Geo My WP pop-up windows.
|
266 |
-
'the_champ_user_auth', // Super Socializer
|
267 |
-
'simbatfa-init-otp', //Two-Factor Auth
|
268 |
-
'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
|
269 |
-
'boss_we_login', //Login form
|
270 |
-
'sidebar_login_process', // Login CF7
|
271 |
-
'cp_update_style_settings', // Convert Pro. Saving settings
|
272 |
-
'updraft_savesettings', // UpdraftPlus
|
273 |
-
'wpdUpdateAutomatically', //Comments update
|
274 |
-
'upload-attachment', // Skip ulpload attachments
|
275 |
-
'iwj_update_profile', //Skip profile page checker
|
276 |
-
'st_partner_create_service', //Skip add hotel via admin
|
277 |
-
'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
|
278 |
-
'mailster_send_test', //Mailster send test admin
|
279 |
-
'acf/validate_save_post', //ACF validate post admin
|
280 |
-
'admin:saveThemeOptions', //Ait-theme admin checking
|
281 |
-
'save_tourmaster_option', //Tourmaster admin save
|
282 |
-
'validate_register_email', // Service id #313320
|
283 |
-
'elementor_pro_forms_send_form', //Elementor Pro
|
284 |
-
'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
|
285 |
-
'ihc_check_reg_field_ajax', //Ajax check required fields
|
286 |
-
'OSTC_lostPassword', //Lost password ajax form
|
287 |
-
'check_retina_image_availability', //There are too many ajax requests from mobile
|
288 |
-
'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
|
289 |
-
'edit-comment', // Edit comments by admin ??? that shouldn't happen
|
290 |
-
'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
|
291 |
-
'wpdmpp_save_settings', // PayPal save settings.
|
292 |
-
'iwj_login', // Fix for unknown plugin for user #133315
|
293 |
-
'custom_user_login', // Fix for unknown plugin for user #466875
|
294 |
-
'wordfence_ls_authenticate', //Fix for wordfence auth
|
295 |
-
'frm_strp_amount', //Admin stripe form
|
296 |
-
'wouCheckOnlineUsers', //Skip updraft admin checking users
|
297 |
-
'et_fb_get_shortcode_from_fb_object', //Skip generate shortcode
|
298 |
-
'pp_lf_process_login', //Skip login form
|
299 |
-
'check_email', //Ajax email checking
|
300 |
-
'dflg_do_sign_in_user', // Unknown plugin
|
301 |
-
'cartflows_save_cart_abandonment_data', // WooCommerce cartflow
|
302 |
-
'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content
|
303 |
-
'give_process_donation', // GiveWP
|
304 |
-
'apus_ajax_login', // ???? plugin authorization
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
(
|
315 |
-
|
316 |
-
//
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$
|
349 |
-
|
350 |
-
|
351 |
-
|
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 |
-
|
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 |
-
elseif(
|
628 |
-
{
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
}
|
635 |
-
//
|
636 |
-
elseif
|
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 |
-
$result =
|
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 |
-
elseif( isset($_POST['action']) &&
|
734 |
-
wp_send_json_error(
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/* The Fluent Form have the direct integration */
|
147 |
+
$cleantalk_hooked_actions[] = 'fluentform_submit';
|
148 |
+
|
149 |
+
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
150 |
+
|
151 |
+
$email = is_null( $email ) ? $email : $_POST['email'];
|
152 |
+
$email = sanitize_email($email);
|
153 |
+
$is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
|
154 |
+
|
155 |
+
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
|
156 |
+
|
157 |
+
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
158 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
159 |
+
if ($checkjs === null){
|
160 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
161 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
162 |
+
}
|
163 |
+
|
164 |
+
//Making a call
|
165 |
+
$base_call_result = apbct_base_call(
|
166 |
+
array(
|
167 |
+
'sender_email' => $email,
|
168 |
+
'sender_nickname' => '',
|
169 |
+
'sender_info' => $sender_info,
|
170 |
+
'js_on' => $checkjs,
|
171 |
+
),
|
172 |
+
true
|
173 |
+
);
|
174 |
+
|
175 |
+
$ct_result = $base_call_result['ct_result'];
|
176 |
+
|
177 |
+
if ($ct_result->allow===0){
|
178 |
+
$is_good=false;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
if($is_good){
|
183 |
+
$ajaxresult=array(
|
184 |
+
'description' => null,
|
185 |
+
'cssClass' => 'noon',
|
186 |
+
'code' => 'success'
|
187 |
+
);
|
188 |
+
}else{
|
189 |
+
$ajaxresult=array(
|
190 |
+
'description' => 'Invalid Email',
|
191 |
+
'cssClass' => 'error-container',
|
192 |
+
'code' => 'error'
|
193 |
+
);
|
194 |
+
}
|
195 |
+
|
196 |
+
$ajaxresult = json_encode($ajaxresult);
|
197 |
+
print $ajaxresult;
|
198 |
+
wp_die();
|
199 |
+
}
|
200 |
+
|
201 |
+
function ct_user_register_ajaxlogin($user_id)
|
202 |
+
{
|
203 |
+
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
204 |
+
{
|
205 |
+
|
206 |
+
$checkjs = apbct_js_test('ct_checkjs', $_POST);
|
207 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
208 |
+
if ($checkjs === null){
|
209 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
210 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
211 |
+
}
|
212 |
+
|
213 |
+
//Making a call
|
214 |
+
$base_call_result = apbct_base_call(
|
215 |
+
array(
|
216 |
+
'sender_email' => sanitize_email($_POST['email']),
|
217 |
+
'sender_nickname' => sanitize_email($_POST['login']),
|
218 |
+
'sender_info' => $sender_info,
|
219 |
+
'js_on' => $checkjs,
|
220 |
+
),
|
221 |
+
true
|
222 |
+
);
|
223 |
+
|
224 |
+
$ct_result = $base_call_result['ct_result'];
|
225 |
+
|
226 |
+
if ($ct_result->allow === 0)
|
227 |
+
{
|
228 |
+
wp_delete_user($user_id);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
return $user_id;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
|
236 |
+
*
|
237 |
+
* @param array $errors
|
238 |
+
* @return array
|
239 |
+
*/
|
240 |
+
function ct_mc4wp_ajax_hook( array $errors )
|
241 |
+
{
|
242 |
+
$result = ct_ajax_hook();
|
243 |
+
|
244 |
+
// only return modified errors array when function returned a string value (the message key)
|
245 |
+
if( is_string( $result ) ) {
|
246 |
+
$errors[] = $result;
|
247 |
+
}
|
248 |
+
|
249 |
+
return $errors;
|
250 |
+
}
|
251 |
+
|
252 |
+
function ct_ajax_hook($message_obj = false, $additional = false)
|
253 |
+
{
|
254 |
+
global $apbct, $current_user;
|
255 |
+
|
256 |
+
$message_obj = (array)$message_obj;
|
257 |
+
|
258 |
+
// Get current_user and set it globaly
|
259 |
+
apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
|
260 |
+
|
261 |
+
// Go out because of not spam data
|
262 |
+
$skip_post = array(
|
263 |
+
'apbct_js_keys__get', // Our service code
|
264 |
+
'gmaps_display_info_window', // Geo My WP pop-up windows.
|
265 |
+
'gmw_ps_display_info_window', // Geo My WP pop-up windows.
|
266 |
+
'the_champ_user_auth', // Super Socializer
|
267 |
+
'simbatfa-init-otp', //Two-Factor Auth
|
268 |
+
'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
|
269 |
+
'boss_we_login', //Login form
|
270 |
+
'sidebar_login_process', // Login CF7
|
271 |
+
'cp_update_style_settings', // Convert Pro. Saving settings
|
272 |
+
'updraft_savesettings', // UpdraftPlus
|
273 |
+
'wpdUpdateAutomatically', //Comments update
|
274 |
+
'upload-attachment', // Skip ulpload attachments
|
275 |
+
'iwj_update_profile', //Skip profile page checker
|
276 |
+
'st_partner_create_service', //Skip add hotel via admin
|
277 |
+
'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
|
278 |
+
'mailster_send_test', //Mailster send test admin
|
279 |
+
'acf/validate_save_post', //ACF validate post admin
|
280 |
+
'admin:saveThemeOptions', //Ait-theme admin checking
|
281 |
+
'save_tourmaster_option', //Tourmaster admin save
|
282 |
+
'validate_register_email', // Service id #313320
|
283 |
+
'elementor_pro_forms_send_form', //Elementor Pro
|
284 |
+
'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
|
285 |
+
'ihc_check_reg_field_ajax', //Ajax check required fields
|
286 |
+
'OSTC_lostPassword', //Lost password ajax form
|
287 |
+
'check_retina_image_availability', //There are too many ajax requests from mobile
|
288 |
+
'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
|
289 |
+
'edit-comment', // Edit comments by admin ??? that shouldn't happen
|
290 |
+
'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
|
291 |
+
'wpdmpp_save_settings', // PayPal save settings.
|
292 |
+
'iwj_login', // Fix for unknown plugin for user #133315
|
293 |
+
'custom_user_login', // Fix for unknown plugin for user #466875
|
294 |
+
'wordfence_ls_authenticate', //Fix for wordfence auth
|
295 |
+
'frm_strp_amount', //Admin stripe form
|
296 |
+
'wouCheckOnlineUsers', //Skip updraft admin checking users
|
297 |
+
'et_fb_get_shortcode_from_fb_object', //Skip generate shortcode
|
298 |
+
'pp_lf_process_login', //Skip login form
|
299 |
+
'check_email', //Ajax email checking
|
300 |
+
'dflg_do_sign_in_user', // Unknown plugin
|
301 |
+
'cartflows_save_cart_abandonment_data', // WooCommerce cartflow
|
302 |
+
'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content
|
303 |
+
'give_process_donation', // GiveWP
|
304 |
+
'apus_ajax_login', // ???? plugin authorization
|
305 |
+
'bookly_save_customer', //bookly
|
306 |
+
'postmark_test', //Avocet
|
307 |
+
'postmark_save', //Avocet
|
308 |
+
);
|
309 |
+
|
310 |
+
// Skip test if
|
311 |
+
if( !$apbct->settings['general_contact_forms_test'] || // Test disabled
|
312 |
+
!apbct_is_user_enable($apbct->user) || // User is admin, editor, author
|
313 |
+
// (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
|
314 |
+
(!$apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
|
315 |
+
apbct_exclusions_check__url() || // url exclusions
|
316 |
+
(isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
|
317 |
+
(isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
|
318 |
+
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
319 |
+
// QAEngine Theme fix
|
320 |
+
( strval(current_action()) != 'et_pre_insert_answer' &&
|
321 |
+
(
|
322 |
+
(isset($message_obj['author']) && intval($message_obj['author']) == 0) ||
|
323 |
+
(isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)
|
324 |
+
)
|
325 |
+
) ||
|
326 |
+
(isset($_POST['action'], $_POST['arm_action']) && $_POST['action'] == 'arm_shortcode_form_ajax_action' && $_POST['arm_action'] == 'please-login') //arm forms skip login
|
327 |
+
)
|
328 |
+
{
|
329 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
330 |
+
return false;
|
331 |
+
}
|
332 |
+
|
333 |
+
//General post_info for all ajax calls
|
334 |
+
$post_info = array(
|
335 |
+
'comment_type' => 'feedback_ajax',
|
336 |
+
'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
|
337 |
+
);
|
338 |
+
|
339 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
340 |
+
|
341 |
+
if(isset($_POST['user_login']))
|
342 |
+
$sender_nickname = $_POST['user_login'];
|
343 |
+
else
|
344 |
+
$sender_nickname = '';
|
345 |
+
|
346 |
+
//QAEngine Theme answers
|
347 |
+
if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
|
348 |
+
$curr_user = get_user_by('id', $message_obj['author']);
|
349 |
+
if (!$curr_user)
|
350 |
+
$curr_user = get_user_by('id', $message_obj['post_author']);
|
351 |
+
$ct_post_temp['comment'] = $message_obj['post_content'];
|
352 |
+
$ct_post_temp['email'] = $curr_user->data->user_email;
|
353 |
+
$ct_post_temp['name'] = $curr_user->data->user_login;
|
354 |
+
}
|
355 |
+
|
356 |
+
//CSCF fix
|
357 |
+
if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){
|
358 |
+
$ct_post_temp[] = $message_obj['comment_author'];
|
359 |
+
$ct_post_temp[] = $message_obj['comment_author_email'];
|
360 |
+
$ct_post_temp[] = $message_obj['comment_content'];
|
361 |
+
}
|
362 |
+
|
363 |
+
//??? fix
|
364 |
+
if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){
|
365 |
+
$ct_post_temp=$_POST;
|
366 |
+
$ct_post_temp['target']=1;
|
367 |
+
}
|
368 |
+
|
369 |
+
//UserPro fix
|
370 |
+
if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
|
371 |
+
$ct_post_temp = $_POST;
|
372 |
+
$ct_post_temp['shortcode'] = '';
|
373 |
+
}
|
374 |
+
//Reviewer fix
|
375 |
+
if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
|
376 |
+
{
|
377 |
+
$ct_post_temp['name'] = $_POST['user_name'];
|
378 |
+
$ct_post_temp['email'] = $_POST['user_email'];
|
379 |
+
$ct_post_temp['comment'] = $_POST['comment'];
|
380 |
+
}
|
381 |
+
//Woocommerce checkout
|
382 |
+
if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
|
383 |
+
$post_info['comment_type'] = 'order';
|
384 |
+
}
|
385 |
+
//Easy Forms for Mailchimp
|
386 |
+
if( \Cleantalk\Common\Post::get('action') == 'process_form_submission' ){
|
387 |
+
$post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
|
388 |
+
if( \Cleantalk\Common\Post::get('form_data') ) {
|
389 |
+
$form_data = explode( '&', urldecode( \Cleantalk\Common\Post::get('form_data') ) );
|
390 |
+
$form_data_arr = array();
|
391 |
+
foreach ( $form_data as $val ) {
|
392 |
+
$form_data_element = explode( '=', $val );
|
393 |
+
$form_data_arr[$form_data_element[0]] = @$form_data_element[1];
|
394 |
+
}
|
395 |
+
if( isset( $form_data_arr['EMAIL'] ) )
|
396 |
+
$ct_post_temp['email'] = $form_data_arr['EMAIL'];
|
397 |
+
if( isset( $form_data_arr['FNAME'] ) )
|
398 |
+
$ct_post_temp['nickname'] = $form_data_arr['FNAME'];
|
399 |
+
}
|
400 |
+
}
|
401 |
+
if (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
|
402 |
+
foreach ($ct_post_temp as $key => $value) {
|
403 |
+
if (preg_match('/form_data_\d_name/', $key))
|
404 |
+
unset($ct_post_temp[$key]);
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
$ct_temp_msg_data = isset($ct_post_temp)
|
409 |
+
? ct_get_fields_any($ct_post_temp)
|
410 |
+
: ct_get_fields_any($_POST);
|
411 |
+
|
412 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
413 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
414 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
415 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
416 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
417 |
+
if($subject != '') {
|
418 |
+
$message['subject'] = $subject;
|
419 |
+
}
|
420 |
+
|
421 |
+
// Skip submission if no data found
|
422 |
+
if ($sender_email === ''|| !$contact_form) {
|
423 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
424 |
+
return false;
|
425 |
+
}
|
426 |
+
|
427 |
+
|
428 |
+
// Mailpoet fix
|
429 |
+
if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns') {
|
430 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
431 |
+
return false;
|
432 |
+
}
|
433 |
+
|
434 |
+
// Mailpoet3 admin skip fix
|
435 |
+
if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save') {
|
436 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
437 |
+
return false;
|
438 |
+
}
|
439 |
+
|
440 |
+
|
441 |
+
// WP Foto Vote Fix
|
442 |
+
if (!empty($_FILES)){
|
443 |
+
foreach($message as $key => $value){
|
444 |
+
if(strpos($key, 'oje') !== false) {
|
445 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
446 |
+
return false;
|
447 |
+
}
|
448 |
+
} unset($key ,$value);
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* @todo Contact form detect
|
453 |
+
*/
|
454 |
+
// Detect contact form an set it's name to $contact_form to use later
|
455 |
+
$contact_form = null;
|
456 |
+
foreach($_POST as $param => $value){
|
457 |
+
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
458 |
+
$contact_form = 'contact_form_divi_theme';
|
459 |
+
$contact_form_additional = str_replace($param, '', $param);
|
460 |
+
}
|
461 |
+
if(strpos($param, 'avia_generated_form') === 0){
|
462 |
+
$contact_form = 'contact_form_enfold_theme';
|
463 |
+
$contact_form_additional = str_replace('avia_generated_form', '', $param);
|
464 |
+
}
|
465 |
+
if(!empty($contact_form))
|
466 |
+
break;
|
467 |
+
}
|
468 |
+
|
469 |
+
$base_call_result = apbct_base_call(
|
470 |
+
array(
|
471 |
+
'message' => $message,
|
472 |
+
'sender_email' => $sender_email,
|
473 |
+
'sender_nickname' => $sender_nickname,
|
474 |
+
'sender_info' => array('post_checkjs_passed' => $checkjs),
|
475 |
+
'post_info' => $post_info,
|
476 |
+
'js_on' => $checkjs,
|
477 |
+
)
|
478 |
+
);
|
479 |
+
$ct_result = $base_call_result['ct_result'];
|
480 |
+
|
481 |
+
if ($ct_result->allow == 0)
|
482 |
+
{
|
483 |
+
if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){
|
484 |
+
$result=Array('success'=>false,'error'=>$ct_result->comment);
|
485 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
486 |
+
print json_encode($result);
|
487 |
+
die();
|
488 |
+
}
|
489 |
+
else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit')
|
490 |
+
{
|
491 |
+
$result=Array('success'=>false,'html'=>$ct_result->comment);
|
492 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
493 |
+
print json_encode($result);
|
494 |
+
die();
|
495 |
+
}
|
496 |
+
else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail')
|
497 |
+
{
|
498 |
+
$result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
|
499 |
+
//@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
500 |
+
print $_GET['callback'].'('.json_encode($result).');';
|
501 |
+
die();
|
502 |
+
}
|
503 |
+
else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation')
|
504 |
+
{
|
505 |
+
$result=Array("type"=>"error","message"=>$ct_result->comment);
|
506 |
+
print json_encode($result);
|
507 |
+
die();
|
508 |
+
}
|
509 |
+
else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message'))
|
510 |
+
{
|
511 |
+
print $ct_result->comment;
|
512 |
+
die();
|
513 |
+
}
|
514 |
+
else if(isset($_POST['action']) && $_POST['action']=='zn_do_login')
|
515 |
+
{
|
516 |
+
print '<div id="login_error">'.$ct_result->comment.'</div>';
|
517 |
+
die();
|
518 |
+
}
|
519 |
+
else if(isset($_POST['action']) && $_POST['action']=='vfb_submit')
|
520 |
+
{
|
521 |
+
$result=Array('result'=>false,'message'=>$ct_result->comment);
|
522 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
523 |
+
print json_encode($result);
|
524 |
+
die();
|
525 |
+
}
|
526 |
+
else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
|
527 |
+
{
|
528 |
+
print $ct_result->comment;
|
529 |
+
die();
|
530 |
+
}
|
531 |
+
else if(isset($_POST['action']) && $_POST['action']=='frm_entries_create')
|
532 |
+
{
|
533 |
+
$result=Array('112'=>$ct_result->comment);
|
534 |
+
print json_encode($result);
|
535 |
+
die();
|
536 |
+
}
|
537 |
+
else if(isset($_POST['cma-action']) && $_POST['cma-action']=='add')
|
538 |
+
{
|
539 |
+
$result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
|
540 |
+
print json_encode($result);
|
541 |
+
die();
|
542 |
+
}
|
543 |
+
else if(isset($_POST['action']) && $_POST['action']=='td_mod_register')
|
544 |
+
{
|
545 |
+
print json_encode(array('register', 0, $ct_result->comment));
|
546 |
+
die();
|
547 |
+
}
|
548 |
+
else if(isset($_POST['action']) && $_POST['action']=='tmpl_ajax_check_user_email')
|
549 |
+
{
|
550 |
+
print "17,email";
|
551 |
+
die();
|
552 |
+
}
|
553 |
+
else if(isset($_POST['action']) && ($_POST['action']=='tevolution_submit_from_preview' || $_POST['action']=='submit_form_recaptcha_validation'))
|
554 |
+
{
|
555 |
+
print $ct_result->comment;
|
556 |
+
die();
|
557 |
+
}
|
558 |
+
// WooWaitList
|
559 |
+
// http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
|
560 |
+
else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
|
561 |
+
{
|
562 |
+
$result = array();
|
563 |
+
$result['error'] = 1;
|
564 |
+
$result['message'] = $ct_result->comment;
|
565 |
+
$result['code'] = 5; // Unused code number in WooWaitlist
|
566 |
+
print json_encode($result);
|
567 |
+
die();
|
568 |
+
}
|
569 |
+
// UserPro
|
570 |
+
else if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register')
|
571 |
+
{
|
572 |
+
foreach($_POST as $key => $value){
|
573 |
+
$output[$key]=$value;
|
574 |
+
}unset($key, $value);
|
575 |
+
$output['template'] = $ct_result->comment;
|
576 |
+
$output=json_encode($output);
|
577 |
+
print_r($output);
|
578 |
+
die;
|
579 |
+
}
|
580 |
+
// Quick event manager
|
581 |
+
else if(isset($_POST['action']) && $_POST['action']=='qem_validate_form'){
|
582 |
+
$errors[] = 'registration_forbidden';
|
583 |
+
$result = Array(
|
584 |
+
'success' => 'false',
|
585 |
+
'errors' => $errors,
|
586 |
+
'title' => $ct_result->comment
|
587 |
+
);
|
588 |
+
print json_encode($result);
|
589 |
+
die();
|
590 |
+
}
|
591 |
+
// Quick Contact Form
|
592 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'qcf_validate_form')
|
593 |
+
{
|
594 |
+
$result = Array(
|
595 |
+
'blurb' => "<h1>".$ct_result->comment."</h1>",
|
596 |
+
'display' => "Oops, got a few problems here",
|
597 |
+
'errors' => array(
|
598 |
+
0 => array(
|
599 |
+
'error' => 'error',
|
600 |
+
'name' => 'name'
|
601 |
+
),
|
602 |
+
),
|
603 |
+
'success' => 'false',
|
604 |
+
);
|
605 |
+
print json_encode($result);
|
606 |
+
die();
|
607 |
+
}
|
608 |
+
// Usernoise Contact Form
|
609 |
+
elseif(isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']))
|
610 |
+
{
|
611 |
+
return array($ct_result->comment);
|
612 |
+
die();
|
613 |
+
}
|
614 |
+
// amoForms
|
615 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'amoforms_submit')
|
616 |
+
{
|
617 |
+
$result = Array(
|
618 |
+
'result' => true,
|
619 |
+
'type' => "html",
|
620 |
+
'value' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
|
621 |
+
'fast' => false
|
622 |
+
);
|
623 |
+
print json_encode($result);
|
624 |
+
die();
|
625 |
+
}
|
626 |
+
// MailChimp for Wordpress Premium
|
627 |
+
elseif(!empty($_POST['_mc4wp_form_id']))
|
628 |
+
{
|
629 |
+
return 'ct_mc4wp_response';
|
630 |
+
}
|
631 |
+
// QAEngine Theme answers
|
632 |
+
elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
|
633 |
+
throw new Exception($ct_result->comment);
|
634 |
+
}
|
635 |
+
//ES Add subscriber
|
636 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'es_add_subscriber')
|
637 |
+
{
|
638 |
+
$result = Array(
|
639 |
+
'error' => 'unexpected-error',
|
640 |
+
);
|
641 |
+
print json_encode($result);
|
642 |
+
die();
|
643 |
+
}
|
644 |
+
//Convertplug. Strpos because action value dynamically changes and depends on mailing service
|
645 |
+
elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
|
646 |
+
$result = Array(
|
647 |
+
'action' => "message",
|
648 |
+
'detailed_msg' => "",
|
649 |
+
'email_status' => false,
|
650 |
+
'message' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
|
651 |
+
'status' => "error",
|
652 |
+
'url' => "none"
|
653 |
+
);
|
654 |
+
print json_encode($result);
|
655 |
+
die();
|
656 |
+
}
|
657 |
+
// Ultimate Form Builder
|
658 |
+
elseif (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
|
659 |
+
$result = Array(
|
660 |
+
'error_keys' => array(),
|
661 |
+
'error_flag' => 1,
|
662 |
+
'response_message' => $ct_result->comment
|
663 |
+
);
|
664 |
+
print json_encode($result);
|
665 |
+
die();
|
666 |
+
}
|
667 |
+
// Smart Forms
|
668 |
+
elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
|
669 |
+
$result = Array(
|
670 |
+
'message' => $ct_result->comment,
|
671 |
+
'refreshCaptcha' => 'n',
|
672 |
+
'success' => 'n'
|
673 |
+
);
|
674 |
+
print json_encode($result);
|
675 |
+
die();
|
676 |
+
}
|
677 |
+
//cFormsII
|
678 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
|
679 |
+
{
|
680 |
+
header('Content-Type: application/json');
|
681 |
+
$result = Array(
|
682 |
+
'no' => isset($_POST['cforms_id']) ? $_POST['cforms_id'] : '',
|
683 |
+
'result' => 'failure',
|
684 |
+
'html' =>$ct_result->comment,
|
685 |
+
'hide' => false,
|
686 |
+
'redirection' => null
|
687 |
+
);
|
688 |
+
print json_encode($result);
|
689 |
+
die();
|
690 |
+
}
|
691 |
+
//Contact Form by Web-Settler
|
692 |
+
elseif(isset($_POST['smFieldData']))
|
693 |
+
{
|
694 |
+
$result = Array(
|
695 |
+
'signal' => true,
|
696 |
+
'code' => 0,
|
697 |
+
'thanksMsg' => $ct_result->comment,
|
698 |
+
'errors' => array(),
|
699 |
+
'isMsg' => true,
|
700 |
+
'redirectUrl' => null
|
701 |
+
);
|
702 |
+
print json_encode($result);
|
703 |
+
die();
|
704 |
+
}
|
705 |
+
//Reviewer
|
706 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
|
707 |
+
{
|
708 |
+
$result = Array(
|
709 |
+
'success' => false,
|
710 |
+
'data' => array(0=>$ct_result->comment)
|
711 |
+
);
|
712 |
+
print json_encode($result);
|
713 |
+
die();
|
714 |
+
}
|
715 |
+
// CouponXXL Theme
|
716 |
+
elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
|
717 |
+
$result = array(
|
718 |
+
'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
|
719 |
+
);
|
720 |
+
die(json_encode($result));
|
721 |
+
}
|
722 |
+
//ConvertPro
|
723 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'cp_v2_notify_admin' || $_POST['action'] == 'cpro_notify_via_email')
|
724 |
+
{
|
725 |
+
$result = Array(
|
726 |
+
'success' => false,
|
727 |
+
'data' => array('error'=>$ct_result->comment,'style_slug'=>'convertprot-form'),
|
728 |
+
);
|
729 |
+
print json_encode($result);
|
730 |
+
die();
|
731 |
+
}
|
732 |
+
//Easy Forms for Mailchimp
|
733 |
+
elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
|
734 |
+
wp_send_json_error(
|
735 |
+
array(
|
736 |
+
'error' => 1,
|
737 |
+
'response' => $ct_result->comment
|
738 |
+
)
|
739 |
+
);
|
740 |
+
}
|
741 |
+
//Optin wheel
|
742 |
+
elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
|
743 |
+
wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
|
744 |
+
}
|
745 |
+
// Forminator
|
746 |
+
elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
|
747 |
+
wp_send_json_error(
|
748 |
+
array(
|
749 |
+
'message' => $ct_result->comment,
|
750 |
+
'success' => false,
|
751 |
+
'errors' => array(),
|
752 |
+
'behav' => 'behaviour-thankyou',
|
753 |
+
)
|
754 |
+
);
|
755 |
+
}
|
756 |
+
else
|
757 |
+
{
|
758 |
+
http_response_code( 403 );
|
759 |
+
die(json_encode(array( 'apbct' => array(
|
760 |
+
'blocked' => true,
|
761 |
+
'comment' => $ct_result->comment,
|
762 |
+
'stop_script' => \Cleantalk\Common\Post::has_string('action', 'tve_leads_ajax_')
|
763 |
+
? 1
|
764 |
+
: 0
|
765 |
+
))));
|
766 |
+
}
|
767 |
+
}
|
768 |
+
//Allow == 1
|
769 |
+
else{
|
770 |
+
//QAEngine Theme answers
|
771 |
+
if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
|
772 |
+
return $message_obj;
|
773 |
+
}
|
774 |
+
}
|
775 |
+
}
|
inc/cleantalk-autoloader.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Autoloader for \Cleantalk\* classes
|
5 |
-
*
|
6 |
-
* @param string $class
|
7 |
-
*
|
8 |
-
* @return void
|
9 |
-
*/
|
10 |
-
function apbct_autoloader( $class ){
|
11 |
-
// Register class auto loader
|
12 |
-
// Custom modules
|
13 |
-
if( strpos( $class, 'Cleantalk' ) !== false && ! class_exists( '\\' . $class )) {
|
14 |
-
$class_file = CLEANTALK_PLUGIN_DIR . 'lib' . DIRECTORY_SEPARATOR . $class . '.php';
|
15 |
-
if( file_exists( $class_file ) ){
|
16 |
-
require_once( $class_file );
|
17 |
-
}
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
spl_autoload_register( 'apbct_autoloader' );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Autoloader for \Cleantalk\* classes
|
5 |
+
*
|
6 |
+
* @param string $class
|
7 |
+
*
|
8 |
+
* @return void
|
9 |
+
*/
|
10 |
+
function apbct_autoloader( $class ){
|
11 |
+
// Register class auto loader
|
12 |
+
// Custom modules
|
13 |
+
if( strpos( $class, 'Cleantalk' ) !== false && ! class_exists( '\\' . $class )) {
|
14 |
+
$class_file = CLEANTALK_PLUGIN_DIR . 'lib' . DIRECTORY_SEPARATOR . $class . '.php';
|
15 |
+
if( file_exists( $class_file ) ){
|
16 |
+
require_once( $class_file );
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
spl_autoload_register( 'apbct_autoloader' );
|
inc/cleantalk-common.php
CHANGED
@@ -1,1007 +1,1010 @@
|
|
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 |
-
// Fields 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 |
-
// Reversed url exclusions. Pass everything except one.
|
100 |
-
if( ! apbct_exclusions_check__url__reversed() ){
|
101 |
-
return array(
|
102 |
-
'ct' => false,
|
103 |
-
'ct_result' => new CleantalkResponse( null, null )
|
104 |
-
);
|
105 |
-
}
|
106 |
-
|
107 |
-
$default_params = array(
|
108 |
-
|
109 |
-
// IPs
|
110 |
-
'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : CleantalkHelper::ip__get(array('real'), false)),
|
111 |
-
'x_forwarded_for' => CleantalkHelper::ip__get(array('x_forwarded_for'), false),
|
112 |
-
'x_real_ip' => CleantalkHelper::ip__get(array('x_real_ip'), false),
|
113 |
-
|
114 |
-
// Misc
|
115 |
-
'auth_key' => $apbct->api_key,
|
116 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
|
117 |
-
|
118 |
-
'agent' => APBCT_AGENT,
|
119 |
-
'sender_info' => $sender_info,
|
120 |
-
'submit_time' => apbct_get_submit_time(),
|
121 |
-
);
|
122 |
-
|
123 |
-
// Send $_SERVER if couldn't find IP
|
124 |
-
if(empty($default_params['sender_ip']))
|
125 |
-
$default_params['sender_info']['server_info'] = $_SERVER;
|
126 |
-
|
127 |
-
$ct_request = new CleantalkRequest(
|
128 |
-
CleantalkHelper::array_merge__save_numeric_keys__recursive($default_params, $params)
|
129 |
-
);
|
130 |
-
|
131 |
-
$ct = new Cleantalk();
|
132 |
-
|
133 |
-
$ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
|
134 |
-
$ct->ssl_on = $apbct->settings['ssl_on'];
|
135 |
-
$ct->ssl_path = APBCT_CASERT_PATH;
|
136 |
-
|
137 |
-
// Options store url without shceme because of DB error with ''://'
|
138 |
-
$config = ct_get_server();
|
139 |
-
$ct->server_url = APBCT_MODERATE_URL;
|
140 |
-
$ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
|
141 |
-
$ct->server_ttl = $config['ct_server_ttl'];
|
142 |
-
$ct->server_changed = $config['ct_server_changed'];
|
143 |
-
|
144 |
-
$start = microtime(true);
|
145 |
-
$ct_result = $reg_flag
|
146 |
-
? @$ct->isAllowUser($ct_request)
|
147 |
-
: @$ct->isAllowMessage($ct_request);
|
148 |
-
$exec_time = microtime(true) - $start;
|
149 |
-
|
150 |
-
// Statistics
|
151 |
-
// Average request time
|
152 |
-
apbct_statistics__rotate($exec_time);
|
153 |
-
// Last request
|
154 |
-
$apbct->stats['last_request']['time'] = time();
|
155 |
-
$apbct->stats['last_request']['server'] = $ct->work_url;
|
156 |
-
$apbct->save('stats');
|
157 |
-
|
158 |
-
// Connection reports
|
159 |
-
if ($ct_result->errno === 0 && empty($ct_result->errstr))
|
160 |
-
$apbct->data['connection_reports']['success']++;
|
161 |
-
else
|
162 |
-
{
|
163 |
-
$apbct->data['connection_reports']['negative']++;
|
164 |
-
$apbct->data['connection_reports']['negative_report'][] = array(
|
165 |
-
'date' => date("Y-m-d H:i:s"),
|
166 |
-
'page_url' => apbct_get_server_variable( 'REQUEST_URI' ),
|
167 |
-
'lib_report' => $ct_result->errstr,
|
168 |
-
'work_url' => $ct->work_url,
|
169 |
-
);
|
170 |
-
|
171 |
-
if(count($apbct->data['connection_reports']['negative_report']) > 20)
|
172 |
-
$apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
|
173 |
-
|
174 |
-
}
|
175 |
-
|
176 |
-
if ($ct->server_change) {
|
177 |
-
update_option(
|
178 |
-
'cleantalk_server',
|
179 |
-
array(
|
180 |
-
'ct_work_url' => $ct->work_url,
|
181 |
-
'ct_server_ttl' => $ct->server_ttl,
|
182 |
-
'ct_server_changed' => time(),
|
183 |
-
)
|
184 |
-
);
|
185 |
-
}
|
186 |
-
|
187 |
-
$ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
|
188 |
-
|
189 |
-
// Restart submit form counter for failed requests
|
190 |
-
if ($ct_result->allow == 0){
|
191 |
-
apbct_cookie(); // Setting page timer and cookies
|
192 |
-
ct_add_event('no');
|
193 |
-
}else{
|
194 |
-
ct_add_event('yes');
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
break;
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
}
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
}
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
*
|
281 |
-
* @
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
}
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
function
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
$
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
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 |
-
defined('
|
514 |
-
defined('
|
515 |
-
defined('
|
516 |
-
defined('
|
517 |
-
defined('
|
518 |
-
defined('
|
519 |
-
|
520 |
-
defined('
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
function
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
function
|
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 |
-
$ct->
|
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 |
-
if($
|
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 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|| $handle === '
|
1000 |
-
|| $handle === '
|
1001 |
-
|| $handle === '
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
|
|
|
|
|
|
1007 |
}
|
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 |
+
// Fields 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 |
+
// Reversed url exclusions. Pass everything except one.
|
100 |
+
if( ! apbct_exclusions_check__url__reversed() ){
|
101 |
+
return array(
|
102 |
+
'ct' => false,
|
103 |
+
'ct_result' => new CleantalkResponse( null, null )
|
104 |
+
);
|
105 |
+
}
|
106 |
+
|
107 |
+
$default_params = array(
|
108 |
+
|
109 |
+
// IPs
|
110 |
+
'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : CleantalkHelper::ip__get(array('real'), false)),
|
111 |
+
'x_forwarded_for' => CleantalkHelper::ip__get(array('x_forwarded_for'), false),
|
112 |
+
'x_real_ip' => CleantalkHelper::ip__get(array('x_real_ip'), false),
|
113 |
+
|
114 |
+
// Misc
|
115 |
+
'auth_key' => $apbct->api_key,
|
116 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
|
117 |
+
|
118 |
+
'agent' => APBCT_AGENT,
|
119 |
+
'sender_info' => $sender_info,
|
120 |
+
'submit_time' => apbct_get_submit_time(),
|
121 |
+
);
|
122 |
+
|
123 |
+
// Send $_SERVER if couldn't find IP
|
124 |
+
if(empty($default_params['sender_ip']))
|
125 |
+
$default_params['sender_info']['server_info'] = $_SERVER;
|
126 |
+
|
127 |
+
$ct_request = new CleantalkRequest(
|
128 |
+
CleantalkHelper::array_merge__save_numeric_keys__recursive($default_params, $params)
|
129 |
+
);
|
130 |
+
|
131 |
+
$ct = new Cleantalk();
|
132 |
+
|
133 |
+
$ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
|
134 |
+
$ct->ssl_on = $apbct->settings['ssl_on'];
|
135 |
+
$ct->ssl_path = APBCT_CASERT_PATH;
|
136 |
+
|
137 |
+
// Options store url without shceme because of DB error with ''://'
|
138 |
+
$config = ct_get_server();
|
139 |
+
$ct->server_url = APBCT_MODERATE_URL;
|
140 |
+
$ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
|
141 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
142 |
+
$ct->server_changed = $config['ct_server_changed'];
|
143 |
+
|
144 |
+
$start = microtime(true);
|
145 |
+
$ct_result = $reg_flag
|
146 |
+
? @$ct->isAllowUser($ct_request)
|
147 |
+
: @$ct->isAllowMessage($ct_request);
|
148 |
+
$exec_time = microtime(true) - $start;
|
149 |
+
|
150 |
+
// Statistics
|
151 |
+
// Average request time
|
152 |
+
apbct_statistics__rotate($exec_time);
|
153 |
+
// Last request
|
154 |
+
$apbct->stats['last_request']['time'] = time();
|
155 |
+
$apbct->stats['last_request']['server'] = $ct->work_url;
|
156 |
+
$apbct->save('stats');
|
157 |
+
|
158 |
+
// Connection reports
|
159 |
+
if ($ct_result->errno === 0 && empty($ct_result->errstr))
|
160 |
+
$apbct->data['connection_reports']['success']++;
|
161 |
+
else
|
162 |
+
{
|
163 |
+
$apbct->data['connection_reports']['negative']++;
|
164 |
+
$apbct->data['connection_reports']['negative_report'][] = array(
|
165 |
+
'date' => date("Y-m-d H:i:s"),
|
166 |
+
'page_url' => apbct_get_server_variable( 'REQUEST_URI' ),
|
167 |
+
'lib_report' => $ct_result->errstr,
|
168 |
+
'work_url' => $ct->work_url,
|
169 |
+
);
|
170 |
+
|
171 |
+
if(count($apbct->data['connection_reports']['negative_report']) > 20)
|
172 |
+
$apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
if ($ct->server_change) {
|
177 |
+
update_option(
|
178 |
+
'cleantalk_server',
|
179 |
+
array(
|
180 |
+
'ct_work_url' => $ct->work_url,
|
181 |
+
'ct_server_ttl' => $ct->server_ttl,
|
182 |
+
'ct_server_changed' => time(),
|
183 |
+
)
|
184 |
+
);
|
185 |
+
}
|
186 |
+
|
187 |
+
$ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
|
188 |
+
|
189 |
+
// Restart submit form counter for failed requests
|
190 |
+
if ($ct_result->allow == 0){
|
191 |
+
apbct_cookie(); // Setting page timer and cookies
|
192 |
+
ct_add_event('no');
|
193 |
+
}else{
|
194 |
+
ct_add_event('yes');
|
195 |
+
}
|
196 |
+
|
197 |
+
//Strip tags from comment
|
198 |
+
$ct_result->comment = strip_tags($ct_result->comment, '<p><a><br>');
|
199 |
+
|
200 |
+
// Set cookies if it's not.
|
201 |
+
if(empty($apbct->flags__cookies_setuped))
|
202 |
+
apbct_cookie();
|
203 |
+
|
204 |
+
return array('ct' => $ct, 'ct_result' => $ct_result);
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
function apbct_exclusions_check($func = null){
|
209 |
+
|
210 |
+
global $apbct, $cleantalk_executed;
|
211 |
+
|
212 |
+
// Common exclusions
|
213 |
+
if(
|
214 |
+
apbct_exclusions_check__ip() ||
|
215 |
+
apbct_exclusions_check__url() ||
|
216 |
+
apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
|
217 |
+
$cleantalk_executed
|
218 |
+
)
|
219 |
+
return true;
|
220 |
+
|
221 |
+
// Personal exclusions
|
222 |
+
switch ($func){
|
223 |
+
case 'ct_contact_form_validate_postdata':
|
224 |
+
if(
|
225 |
+
(defined( 'DOING_AJAX' ) && DOING_AJAX) ||
|
226 |
+
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
227 |
+
)
|
228 |
+
return true;
|
229 |
+
break;
|
230 |
+
case 'ct_contact_form_validate':
|
231 |
+
if(
|
232 |
+
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
233 |
+
)
|
234 |
+
return true;
|
235 |
+
break;
|
236 |
+
default:
|
237 |
+
return false;
|
238 |
+
break;
|
239 |
+
}
|
240 |
+
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
function apbct_exclusions_check__url__reversed(){
|
245 |
+
return defined( 'APBCT_URL_EXCLUSIONS__REVERSED' ) && ! \Cleantalk\Common\Server::has_string( 'REQUEST_URI', APBCT_URL_EXCLUSIONS__REVERSED )
|
246 |
+
? false
|
247 |
+
: true;
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Checks if reuqest URI is in exclusion list
|
252 |
+
*
|
253 |
+
* @return bool
|
254 |
+
*/
|
255 |
+
function apbct_exclusions_check__url() {
|
256 |
+
|
257 |
+
global $apbct;
|
258 |
+
|
259 |
+
if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
|
260 |
+
|
261 |
+
$exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
|
262 |
+
|
263 |
+
// Fix for AJAX forms
|
264 |
+
$haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
|
265 |
+
? apbct_get_server_variable( 'HTTP_REFERER' )
|
266 |
+
: apbct_get_server_variable( 'REQUEST_URI' );
|
267 |
+
|
268 |
+
foreach ( $exclusions as $exclusion ) {
|
269 |
+
if (
|
270 |
+
($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
|
271 |
+
stripos( $haystack, $exclusion ) !== false
|
272 |
+
){
|
273 |
+
return true;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
return false;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
/**
|
280 |
+
* @deprecated 5.128 Using IP white-lists instead
|
281 |
+
* @deprecated since 18.09.2019
|
282 |
+
* Checks if sender_ip is in exclusion list
|
283 |
+
*
|
284 |
+
* @return bool
|
285 |
+
*/
|
286 |
+
function apbct_exclusions_check__ip(){
|
287 |
+
|
288 |
+
global $cleantalk_ip_exclusions;
|
289 |
+
|
290 |
+
if( apbct_get_server_variable( 'REMOTE_ADDR' ) ){
|
291 |
+
|
292 |
+
if( CleantalkHelper::ip__is_cleantalks( apbct_get_server_variable( 'REMOTE_ADDR' ) ) ){
|
293 |
+
return true;
|
294 |
+
}
|
295 |
+
|
296 |
+
if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
|
297 |
+
foreach ( $cleantalk_ip_exclusions as $exclusion ){
|
298 |
+
if( stripos( apbct_get_server_variable( 'REMOTE_ADDR' ), $exclusion ) !== false ){
|
299 |
+
return true;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
return false;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Inner function - Default data array for senders
|
310 |
+
* @return array
|
311 |
+
*/
|
312 |
+
function apbct_get_sender_info() {
|
313 |
+
|
314 |
+
global $apbct;
|
315 |
+
|
316 |
+
// Validate cookie from the backend
|
317 |
+
$cookie_is_ok = apbct_cookies_test();
|
318 |
+
|
319 |
+
$referer_previous = $apbct->settings['set_cookies__sessions']
|
320 |
+
? apbct_alt_session__get('apbct_prev_referer')
|
321 |
+
: filter_input(INPUT_COOKIE, 'apbct_prev_referer');
|
322 |
+
|
323 |
+
$site_landing_ts = $apbct->settings['set_cookies__sessions']
|
324 |
+
? apbct_alt_session__get('apbct_site_landing_ts')
|
325 |
+
: filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
|
326 |
+
|
327 |
+
$page_hits = $apbct->settings['set_cookies__sessions']
|
328 |
+
? apbct_alt_session__get('apbct_page_hits')
|
329 |
+
: filter_input(INPUT_COOKIE, 'apbct_page_hits');
|
330 |
+
|
331 |
+
if (count($_POST) > 0) {
|
332 |
+
foreach ($_POST as $k => $v) {
|
333 |
+
if (preg_match("/^(ct_check|checkjs).+/", $k)) {
|
334 |
+
$checkjs_data_post = $v;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
// AMP check
|
340 |
+
$amp_detected = apbct_get_server_variable( 'HTTP_REFERER' )
|
341 |
+
? strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '/amp/') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '?amp=1') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '&=1') !== false
|
342 |
+
? 1
|
343 |
+
: 0
|
344 |
+
: null;
|
345 |
+
|
346 |
+
$site_referer = $apbct->settings['store_urls__sessions']
|
347 |
+
? apbct_alt_session__get('apbct_site_referer')
|
348 |
+
: filter_input(INPUT_COOKIE, 'apbct_site_referer');
|
349 |
+
|
350 |
+
$urls = $apbct->settings['store_urls__sessions']
|
351 |
+
? (array)apbct_alt_session__get('apbct_urls')
|
352 |
+
: (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
|
353 |
+
|
354 |
+
return array(
|
355 |
+
'remote_addr' => CleantalkHelper::ip__get(array('remote_addr'), false),
|
356 |
+
'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
|
357 |
+
'USER_AGENT' => apbct_get_server_variable( 'HTTP_USER_AGENT' ),
|
358 |
+
'page_url' => apbct_get_server_variable( 'SERVER_NAME' ) . apbct_get_server_variable( 'REQUEST_URI' ),
|
359 |
+
'cms_lang' => substr(get_locale(), 0, 2),
|
360 |
+
'ct_options' => json_encode($apbct->settings),
|
361 |
+
'fields_number' => sizeof($_POST),
|
362 |
+
'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
|
363 |
+
// Raw data to validated JavaScript test in the cloud
|
364 |
+
'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
|
365 |
+
'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
|
366 |
+
// PHP cookies
|
367 |
+
'cookies_enabled' => $cookie_is_ok,
|
368 |
+
'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
|
369 |
+
'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
|
370 |
+
'page_hits' => !empty($page_hits) ? $page_hits : null,
|
371 |
+
// JS cookies
|
372 |
+
'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
|
373 |
+
'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
|
374 |
+
'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
|
375 |
+
'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
|
376 |
+
'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
|
377 |
+
'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
|
378 |
+
'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
|
379 |
+
// Misc
|
380 |
+
'site_referer' => !empty($site_referer) ? $site_referer : null,
|
381 |
+
'source_url' => !empty($urls) ? json_encode($urls) : null,
|
382 |
+
// Debug stuff
|
383 |
+
'amp_detected' => $amp_detected,
|
384 |
+
'hook' => current_action() ? current_action() : 'no_hook',
|
385 |
+
'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
|
386 |
+
'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : 'no_hook',
|
387 |
+
'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
|
388 |
+
'request_type' => apbct_get_server_variable('REQUEST_METHOD') ? apbct_get_server_variable('REQUEST_METHOD') : 'UNKNOWN',
|
389 |
+
);
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Process visible fields for specific form to match the fields from request
|
394 |
+
*
|
395 |
+
* @param string $visible_fields
|
396 |
+
*
|
397 |
+
* @return string
|
398 |
+
*/
|
399 |
+
function apbct_visibile_fields__process($visible_fields) {
|
400 |
+
if(strpos($visible_fields, 'wpforms') !== false){
|
401 |
+
$visible_fields = preg_replace(
|
402 |
+
array('/\[/', '/\]/'),
|
403 |
+
'',
|
404 |
+
str_replace(
|
405 |
+
'][',
|
406 |
+
'_',
|
407 |
+
str_replace(
|
408 |
+
'wpforms[fields]',
|
409 |
+
'',
|
410 |
+
$visible_fields
|
411 |
+
)
|
412 |
+
)
|
413 |
+
);
|
414 |
+
}
|
415 |
+
|
416 |
+
return $visible_fields;
|
417 |
+
}
|
418 |
+
|
419 |
+
/*
|
420 |
+
* Outputs JS key for AJAX-use only. Stops script.
|
421 |
+
*/
|
422 |
+
function apbct_js_keys__get__ajax($direct_call = false){
|
423 |
+
if(!$direct_call){
|
424 |
+
if(isset($_POST['_ajax_nonce'])){
|
425 |
+
if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
|
426 |
+
wp_doing_ajax()
|
427 |
+
? wp_die( -1, 403 )
|
428 |
+
: die( '-1' );
|
429 |
+
}
|
430 |
+
}else{
|
431 |
+
wp_doing_ajax()
|
432 |
+
? wp_die( -1, 403 )
|
433 |
+
: die( '-1' );
|
434 |
+
}
|
435 |
+
}
|
436 |
+
die(json_encode(array(
|
437 |
+
'js_key' => ct_get_checkjs_value()
|
438 |
+
)));
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Get ct_get_checkjs_value
|
443 |
+
*
|
444 |
+
* @param bool $random_key
|
445 |
+
*
|
446 |
+
* @return int|string|null
|
447 |
+
*/
|
448 |
+
function ct_get_checkjs_value(){
|
449 |
+
|
450 |
+
global $apbct;
|
451 |
+
|
452 |
+
// Use static JS keys
|
453 |
+
if($apbct->settings['use_static_js_key'] == 1){
|
454 |
+
|
455 |
+
$key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
|
456 |
+
|
457 |
+
// Auto detecting. Detected.
|
458 |
+
}elseif(
|
459 |
+
$apbct->settings['use_static_js_key'] == - 1 &&
|
460 |
+
( apbct_is_cache_plugins_exists() ||
|
461 |
+
( apbct_is_post() && $apbct->data['cache_detected'] == 1 )
|
462 |
+
)
|
463 |
+
){
|
464 |
+
$key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
|
465 |
+
if( apbct_is_cache_plugins_exists() )
|
466 |
+
$apbct->data['cache_detected'] = 1;
|
467 |
+
|
468 |
+
// Using dynamic JS keys
|
469 |
+
}else{
|
470 |
+
|
471 |
+
$keys = $apbct->data['js_keys'];
|
472 |
+
$keys_checksum = md5(json_encode($keys));
|
473 |
+
|
474 |
+
$key = null;
|
475 |
+
$latest_key_time = 0;
|
476 |
+
|
477 |
+
foreach ($keys as $k => $t) {
|
478 |
+
|
479 |
+
// Removing key if it's to old
|
480 |
+
if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
|
481 |
+
unset($keys[$k]);
|
482 |
+
continue;
|
483 |
+
}
|
484 |
+
|
485 |
+
if ($t > $latest_key_time) {
|
486 |
+
$latest_key_time = $t;
|
487 |
+
$key = $k;
|
488 |
+
}
|
489 |
+
}
|
490 |
+
|
491 |
+
// Set new key if the latest key is too old
|
492 |
+
if (time() - $latest_key_time > $apbct->data['js_key_lifetime']) {
|
493 |
+
$key = rand();
|
494 |
+
$keys[$key] = time();
|
495 |
+
}
|
496 |
+
|
497 |
+
// Save keys if they were changed
|
498 |
+
if (md5(json_encode($keys)) != $keys_checksum) {
|
499 |
+
$apbct->data['js_keys'] = $keys;
|
500 |
+
// $apbct->saveData();
|
501 |
+
}
|
502 |
+
|
503 |
+
$apbct->data['cache_detected'] = 0;
|
504 |
+
}
|
505 |
+
|
506 |
+
$apbct->saveData();
|
507 |
+
|
508 |
+
return $key;
|
509 |
+
}
|
510 |
+
|
511 |
+
function apbct_is_cache_plugins_exists(){
|
512 |
+
return
|
513 |
+
defined('WP_ROCKET_VERSION') || // WPRocket
|
514 |
+
defined('LSCWP_DIR') || // LiteSpeed Cache
|
515 |
+
defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
|
516 |
+
defined('W3TC') || // W3 Total Cache
|
517 |
+
defined('WPO_VERSION') || // WP-Optimize – Clean, Compress, Cache
|
518 |
+
defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
|
519 |
+
defined('WPCACHEHOME') || // WP Super Cache
|
520 |
+
defined('WPHB_VERSION') || // Hummingbird – Speed up, Cache, Optimize Your CSS and JS
|
521 |
+
defined('CE_FILE') || // Cache Enabler – WordPress Cache
|
522 |
+
class_exists('RedisObjectCache') || // Redis Object Cache
|
523 |
+
defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
|
524 |
+
class_exists('WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Inner function - Current site admin e-mail
|
529 |
+
* @return string Admin e-mail
|
530 |
+
*/
|
531 |
+
function ct_get_admin_email() {
|
532 |
+
global $admin_email;
|
533 |
+
if(!isset($admin_email))
|
534 |
+
{
|
535 |
+
$admin_email = get_option('admin_email');
|
536 |
+
}
|
537 |
+
return $admin_email;
|
538 |
+
}
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Inner function - Current Cleantalk working server info
|
542 |
+
* @return mixed[] Array of server data
|
543 |
+
*/
|
544 |
+
function ct_get_server($force=false) {
|
545 |
+
global $ct_server;
|
546 |
+
if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
|
547 |
+
|
548 |
+
return $ct_server;
|
549 |
+
|
550 |
+
}else{
|
551 |
+
|
552 |
+
$ct_server = get_option('cleantalk_server');
|
553 |
+
if (!is_array($ct_server)){
|
554 |
+
$ct_server = array(
|
555 |
+
'ct_work_url' => NULL,
|
556 |
+
'ct_server_ttl' => NULL,
|
557 |
+
'ct_server_changed' => NULL
|
558 |
+
);
|
559 |
+
}
|
560 |
+
return $ct_server;
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Inner function - Stores ang returns cleantalk hash of current comment
|
566 |
+
* @param string New hash or NULL
|
567 |
+
* @return string New hash or current hash depending on parameter
|
568 |
+
*/
|
569 |
+
function ct_hash($new_hash = '') {
|
570 |
+
/**
|
571 |
+
* Current hash
|
572 |
+
*/
|
573 |
+
static $hash;
|
574 |
+
|
575 |
+
if (!empty($new_hash)) {
|
576 |
+
$hash = $new_hash;
|
577 |
+
}
|
578 |
+
return $hash;
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Inner function - Write manual moderation results to PHP sessions
|
583 |
+
* @param string $hash Cleantalk comment hash
|
584 |
+
* @param string $message comment_content
|
585 |
+
* @param int $allow flag good comment (1) or bad (0)
|
586 |
+
* @return string comment_content w\o cleantalk resume
|
587 |
+
*/
|
588 |
+
function ct_feedback($hash, $allow) {
|
589 |
+
global $apbct;
|
590 |
+
|
591 |
+
$ct_feedback = $hash . ':' . $allow . ';';
|
592 |
+
if($apbct->data['feedback_request'])
|
593 |
+
$apbct->data['feedback_request'] = $ct_feedback;
|
594 |
+
else
|
595 |
+
$apbct->data['feedback_request'] .= $ct_feedback;
|
596 |
+
|
597 |
+
$apbct->saveData();
|
598 |
+
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Inner function - Sends the results of moderation
|
602 |
+
* Scheduled in 3600 seconds!
|
603 |
+
* @param string $feedback_request
|
604 |
+
* @return bool
|
605 |
+
*/
|
606 |
+
function ct_send_feedback($feedback_request = null) {
|
607 |
+
|
608 |
+
global $apbct;
|
609 |
+
|
610 |
+
if (empty($feedback_request) && isset($apbct->data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $apbct->data['feedback_request'])){
|
611 |
+
$feedback_request = $apbct->data['feedback_request'];
|
612 |
+
$apbct->data['feedback_request'] = '';
|
613 |
+
$apbct->saveData();
|
614 |
+
}
|
615 |
+
|
616 |
+
if ($feedback_request !== null) {
|
617 |
+
|
618 |
+
$ct_request = new CleantalkRequest(array(
|
619 |
+
// General
|
620 |
+
'auth_key' => $apbct->api_key,
|
621 |
+
// Additional
|
622 |
+
'feedback' => $feedback_request,
|
623 |
+
));
|
624 |
+
|
625 |
+
$ct = new Cleantalk();
|
626 |
+
|
627 |
+
// Server URL handling
|
628 |
+
$config = ct_get_server();
|
629 |
+
$ct->server_url = APBCT_MODERATE_URL;
|
630 |
+
$ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
|
631 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
632 |
+
$ct->server_changed = $config['ct_server_changed'];
|
633 |
+
|
634 |
+
$ct->sendFeedback($ct_request);
|
635 |
+
|
636 |
+
if ($ct->server_change) {
|
637 |
+
update_option(
|
638 |
+
'cleantalk_server',
|
639 |
+
array(
|
640 |
+
'ct_work_url' => $ct->work_url,
|
641 |
+
'ct_server_ttl' => $ct->server_ttl,
|
642 |
+
'ct_server_changed' => time(),
|
643 |
+
)
|
644 |
+
);
|
645 |
+
}
|
646 |
+
|
647 |
+
return true;
|
648 |
+
}
|
649 |
+
|
650 |
+
return false;
|
651 |
+
}
|
652 |
+
|
653 |
+
/**
|
654 |
+
* Delete old spam comments
|
655 |
+
* Scheduled in 3600 seconds!
|
656 |
+
* @return null
|
657 |
+
*/
|
658 |
+
function ct_delete_spam_comments() {
|
659 |
+
|
660 |
+
global $apbct;
|
661 |
+
|
662 |
+
if ($apbct->settings['remove_old_spam'] == 1) {
|
663 |
+
$last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
|
664 |
+
foreach ($last_comments as $c) {
|
665 |
+
$comment_date_gmt = strtotime($c->comment_date_gmt);
|
666 |
+
if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
|
667 |
+
if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
|
668 |
+
// Force deletion old spam comments
|
669 |
+
wp_delete_comment($c->comment_ID, true);
|
670 |
+
}
|
671 |
+
}
|
672 |
+
}
|
673 |
+
}
|
674 |
+
|
675 |
+
return null;
|
676 |
+
}
|
677 |
+
|
678 |
+
/*
|
679 |
+
* Get data from an ARRAY recursively
|
680 |
+
* @return array
|
681 |
+
*/
|
682 |
+
function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
|
683 |
+
|
684 |
+
//Skip request if fields exists
|
685 |
+
$skip_params = array(
|
686 |
+
'ipn_track_id', // PayPal IPN #
|
687 |
+
'txn_type', // PayPal transaction type
|
688 |
+
'payment_status', // PayPal payment status
|
689 |
+
'ccbill_ipn', // CCBill IPN
|
690 |
+
'ct_checkjs', // skip ct_checkjs field
|
691 |
+
'api_mode', // DigiStore-API
|
692 |
+
'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
|
693 |
+
);
|
694 |
+
|
695 |
+
// Fields to replace with ****
|
696 |
+
$obfuscate_params = array(
|
697 |
+
'password',
|
698 |
+
'pass',
|
699 |
+
'pwd',
|
700 |
+
'pswd'
|
701 |
+
);
|
702 |
+
|
703 |
+
// Skip feilds with these strings and known service fields
|
704 |
+
$skip_fields_with_strings = array(
|
705 |
+
// Common
|
706 |
+
'ct_checkjs', //Do not send ct_checkjs
|
707 |
+
'nonce', //nonce for strings such as 'rsvp_nonce_name'
|
708 |
+
'security',
|
709 |
+
// 'action',
|
710 |
+
'http_referer',
|
711 |
+
'referer-page',
|
712 |
+
'timestamp',
|
713 |
+
'captcha',
|
714 |
+
// Formidable Form
|
715 |
+
'form_key',
|
716 |
+
'submit_entry',
|
717 |
+
// Custom Contact Forms
|
718 |
+
'form_id',
|
719 |
+
'ccf_form',
|
720 |
+
'form_page',
|
721 |
+
// Qu Forms
|
722 |
+
'iphorm_uid',
|
723 |
+
'form_url',
|
724 |
+
'post_id',
|
725 |
+
'iphorm_ajax',
|
726 |
+
'iphorm_id',
|
727 |
+
// Fast SecureContact Froms
|
728 |
+
'fs_postonce_1',
|
729 |
+
'fscf_submitted',
|
730 |
+
'mailto_id',
|
731 |
+
'si_contact_action',
|
732 |
+
// Ninja Forms
|
733 |
+
'formData_id',
|
734 |
+
'formData_settings',
|
735 |
+
'formData_fields_\d+_id',
|
736 |
+
'formData_fields_\d+_files.*',
|
737 |
+
// E_signature
|
738 |
+
'recipient_signature',
|
739 |
+
'output_\d+_\w{0,2}',
|
740 |
+
// Contact Form by Web-Settler protection
|
741 |
+
'_formId',
|
742 |
+
'_returnLink',
|
743 |
+
// Social login and more
|
744 |
+
'_save',
|
745 |
+
'_facebook',
|
746 |
+
'_social',
|
747 |
+
'user_login-',
|
748 |
+
// Contact Form 7
|
749 |
+
'_wpcf7',
|
750 |
+
'ebd_settings',
|
751 |
+
'ebd_downloads_',
|
752 |
+
'ecole_origine',
|
753 |
+
'signature',
|
754 |
+
);
|
755 |
+
|
756 |
+
// Reset $message if we have a sign-up data
|
757 |
+
$skip_message_post = array(
|
758 |
+
'edd_action', // Easy Digital Downloads
|
759 |
+
);
|
760 |
+
|
761 |
+
if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
|
762 |
+
$contact = false;
|
763 |
+
|
764 |
+
if(count($arr)){
|
765 |
+
|
766 |
+
foreach($arr as $key => $value){
|
767 |
+
|
768 |
+
if(gettype($value) == 'string'){
|
769 |
+
|
770 |
+
$tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
|
771 |
+
$decoded_json_value = json_decode($tmp, true);
|
772 |
+
|
773 |
+
// Decoding JSON
|
774 |
+
if($decoded_json_value !== null){
|
775 |
+
$value = $decoded_json_value;
|
776 |
+
|
777 |
+
// Ajax Contact Forms. Get data from such strings:
|
778 |
+
// acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
|
779 |
+
// acfw30_textarea %% msg
|
780 |
+
}elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
|
781 |
+
$value = explode('~', $value);
|
782 |
+
foreach ($value as &$val){
|
783 |
+
$tmp = explode(' %% ', $val);
|
784 |
+
$val = array($tmp[0] => $tmp[1]);
|
785 |
+
}
|
786 |
+
}
|
787 |
+
}
|
788 |
+
|
789 |
+
if(!is_array($value) && !is_object($value)){
|
790 |
+
|
791 |
+
if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
|
792 |
+
$contact = false;
|
793 |
+
|
794 |
+
if($value === '')
|
795 |
+
continue;
|
796 |
+
|
797 |
+
// Skipping fields names with strings from (array)skip_fields_with_strings
|
798 |
+
foreach($skip_fields_with_strings as $needle){
|
799 |
+
if (preg_match("/".$needle."/", $prev_name.$key) == 1){
|
800 |
+
continue(2);
|
801 |
+
}
|
802 |
+
}unset($needle);
|
803 |
+
|
804 |
+
// Obfuscating params
|
805 |
+
foreach($obfuscate_params as $needle){
|
806 |
+
if (strpos($key, $needle) !== false){
|
807 |
+
$value = ct_obfuscate_param($value);
|
808 |
+
continue(2);
|
809 |
+
}
|
810 |
+
}unset($needle);
|
811 |
+
|
812 |
+
$value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
|
813 |
+
|
814 |
+
// Email
|
815 |
+
if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
|
816 |
+
$email = $value_for_email;
|
817 |
+
|
818 |
+
// Removes whitespaces
|
819 |
+
$value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
|
820 |
+
|
821 |
+
// Names
|
822 |
+
}elseif (preg_match("/name/i", $key)){
|
823 |
+
|
824 |
+
preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
|
825 |
+
preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
|
826 |
+
preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
|
827 |
+
|
828 |
+
if(count($match_forename) > 1)
|
829 |
+
$nickname['first'] = $value;
|
830 |
+
elseif(count($match_surname) > 1)
|
831 |
+
$nickname['last'] = $value;
|
832 |
+
elseif(count($match_nickname) > 1)
|
833 |
+
$nickname['nick'] = $value;
|
834 |
+
else
|
835 |
+
$message[$prev_name.$key] = $value;
|
836 |
+
|
837 |
+
// Subject
|
838 |
+
}elseif ($subject === null && preg_match("/subject/i", $key)){
|
839 |
+
$subject = $value;
|
840 |
+
|
841 |
+
// Message
|
842 |
+
}else{
|
843 |
+
$message[$prev_name.$key] = $value;
|
844 |
+
}
|
845 |
+
|
846 |
+
}elseif(!is_object($value)){
|
847 |
+
|
848 |
+
$prev_name_original = $prev_name;
|
849 |
+
$prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
|
850 |
+
|
851 |
+
$temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
|
852 |
+
|
853 |
+
$message = $temp['message'];
|
854 |
+
$email = ($temp['email'] ? $temp['email'] : null);
|
855 |
+
$nickname = ($temp['nickname'] ? $temp['nickname'] : null);
|
856 |
+
$subject = ($temp['subject'] ? $temp['subject'] : null);
|
857 |
+
if($contact === true)
|
858 |
+
$contact = ($temp['contact'] === false ? false : true);
|
859 |
+
$prev_name = $prev_name_original;
|
860 |
+
}
|
861 |
+
} unset($key, $value);
|
862 |
+
}
|
863 |
+
|
864 |
+
foreach ($skip_message_post as $v) {
|
865 |
+
if (isset($_POST[$v])) {
|
866 |
+
$message = null;
|
867 |
+
break;
|
868 |
+
}
|
869 |
+
} unset($v);
|
870 |
+
|
871 |
+
//If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
|
872 |
+
if($prev_name === ''){
|
873 |
+
if(!empty($nickname)){
|
874 |
+
$nickname_str = '';
|
875 |
+
foreach($nickname as $value){
|
876 |
+
$nickname_str .= ($value ? $value." " : "");
|
877 |
+
}unset($value);
|
878 |
+
}
|
879 |
+
$nickname = $nickname_str;
|
880 |
+
}
|
881 |
+
|
882 |
+
$return_param = array(
|
883 |
+
'email' => $email,
|
884 |
+
'nickname' => $nickname,
|
885 |
+
'subject' => $subject,
|
886 |
+
'contact' => $contact,
|
887 |
+
'message' => $message
|
888 |
+
);
|
889 |
+
return $return_param;
|
890 |
+
}
|
891 |
+
|
892 |
+
/**
|
893 |
+
* Masks a value with asterisks (*)
|
894 |
+
* @return string
|
895 |
+
*/
|
896 |
+
function ct_obfuscate_param($value = null) {
|
897 |
+
if ($value && (!is_object($value) || !is_array($value))) {
|
898 |
+
$length = strlen($value);
|
899 |
+
$value = str_repeat('*', $length);
|
900 |
+
}
|
901 |
+
|
902 |
+
return $value;
|
903 |
+
}
|
904 |
+
|
905 |
+
//New ct_get_fields_any_postdata
|
906 |
+
function ct_get_fields_any_postdata($arr, $message=array()){
|
907 |
+
$skip_params = array(
|
908 |
+
'ipn_track_id', // PayPal IPN #
|
909 |
+
'txn_type', // PayPal transaction type
|
910 |
+
'payment_status', // PayPal payment status
|
911 |
+
);
|
912 |
+
|
913 |
+
foreach($arr as $key => $value){
|
914 |
+
if(!is_array($value)){
|
915 |
+
if($value == '')
|
916 |
+
continue;
|
917 |
+
if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
|
918 |
+
$message[$key] = $value;
|
919 |
+
}else{
|
920 |
+
$temp = ct_get_fields_any_postdata($value);
|
921 |
+
$message = (count($temp) == 0 ? $message : array_merge($message, $temp));
|
922 |
+
}
|
923 |
+
}
|
924 |
+
return $message;
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Checks if given string is valid regular expression
|
929 |
+
*
|
930 |
+
* @param string $regexp
|
931 |
+
*
|
932 |
+
* @return bool
|
933 |
+
*/
|
934 |
+
function apbct_is_regexp($regexp){
|
935 |
+
return @preg_match('/' . $regexp . '/', null) !== false;
|
936 |
+
}
|
937 |
+
|
938 |
+
function cleantalk_debug($key,$value)
|
939 |
+
{
|
940 |
+
if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
|
941 |
+
{
|
942 |
+
@header($key.": ".$value);
|
943 |
+
}
|
944 |
+
}
|
945 |
+
|
946 |
+
/**
|
947 |
+
* Function changes CleanTalk result object if an error occurred.
|
948 |
+
* @return object
|
949 |
+
*/
|
950 |
+
function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
|
951 |
+
|
952 |
+
global $apbct;
|
953 |
+
|
954 |
+
if (!$ct_result) {
|
955 |
+
return $ct_result;
|
956 |
+
}
|
957 |
+
|
958 |
+
if(@intval($ct_result->errno) != 0)
|
959 |
+
{
|
960 |
+
if($checkjs === null || $checkjs != 1)
|
961 |
+
{
|
962 |
+
$ct_result->allow = 0;
|
963 |
+
$ct_result->spam = 1;
|
964 |
+
$ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
|
965 |
+
$ct_result->comment,
|
966 |
+
$apbct->plugin_name
|
967 |
+
);
|
968 |
+
}
|
969 |
+
else
|
970 |
+
{
|
971 |
+
$ct_result->allow = 1;
|
972 |
+
$ct_result->comment = 'Allow';
|
973 |
+
}
|
974 |
+
}
|
975 |
+
|
976 |
+
return $ct_result;
|
977 |
+
}
|
978 |
+
|
979 |
+
/**
|
980 |
+
* Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
|
981 |
+
* @param api_key
|
982 |
+
* @return bool
|
983 |
+
*/
|
984 |
+
function apbct_api_key__is_correct($api_key = null)
|
985 |
+
{
|
986 |
+
global $apbct;
|
987 |
+
$api_key = $api_key !== null ? $api_key : $apbct->api_key;
|
988 |
+
return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
|
989 |
+
}
|
990 |
+
|
991 |
+
function apbct_add_async_attribute($tag, $handle, $src) {
|
992 |
+
|
993 |
+
global $apbct;
|
994 |
+
|
995 |
+
if(
|
996 |
+
$apbct->settings['async_js'] &&
|
997 |
+
(
|
998 |
+
$handle === 'ct_public'
|
999 |
+
|| $handle === 'ct_public_gdpr'
|
1000 |
+
|| $handle === 'ct_debug_js'
|
1001 |
+
|| $handle === 'ct_public_admin_js'
|
1002 |
+
|| $handle === 'ct_internal'
|
1003 |
+
|| $handle === 'ct_external'
|
1004 |
+
|| $handle === 'ct_nocache'
|
1005 |
+
)
|
1006 |
+
)
|
1007 |
+
return str_replace( ' src', ' async="async" src', $tag );
|
1008 |
+
else
|
1009 |
+
return $tag;
|
1010 |
}
|
inc/cleantalk-find-spam.php
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamPage.php');
|
4 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamChecker.php');
|
5 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamUsersChecker.php');
|
6 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php');
|
7 |
-
|
8 |
-
// Adding menu items for USERS and COMMENTS spam checking pages
|
9 |
-
add_action( 'admin_menu', 'ct_add_find_spam_pages' );
|
10 |
-
function ct_add_find_spam_pages(){
|
11 |
-
|
12 |
-
// Check users pages
|
13 |
-
$ct_check_users = add_users_page( __( "Check for spam", 'cleantalk' ), __( "Find spam users", 'cleantalk' ), 'activate_plugins', 'ct_check_users', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
14 |
-
$ct_check_users_total = add_users_page( __( "Previous scan results", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
15 |
-
$ct_check_users_logs = add_users_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
16 |
-
|
17 |
-
// Cheack comments pages
|
18 |
-
$ct_check_spam = add_comments_page( __( "Check for spam", 'cleantalk' ), __( "Find spam comments", 'cleantalk' ), 'activate_plugins', 'ct_check_spam', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
19 |
-
$ct_check_spam_total = add_comments_page( __( "Previous scan results", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
20 |
-
$ct_check_spam_logs = add_comments_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
21 |
-
|
22 |
-
// Remove some pages from main menu
|
23 |
-
remove_submenu_page( 'users.php', 'ct_check_users_total' );
|
24 |
-
remove_submenu_page( 'users.php', 'ct_check_users_logs' );
|
25 |
-
remove_submenu_page( 'edit-comments.php', 'ct_check_spam_total' );
|
26 |
-
remove_submenu_page( 'edit-comments.php', 'ct_check_spam_logs' );
|
27 |
-
|
28 |
-
// Set screen option for every pages
|
29 |
-
add_action( "load-$ct_check_users", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
30 |
-
add_action( "load-$ct_check_users_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
31 |
-
add_action( "load-$ct_check_users_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
32 |
-
add_action( "load-$ct_check_spam", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
33 |
-
add_action( "load-$ct_check_spam_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
34 |
-
add_action( "load-$ct_check_spam_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
// Set AJAX actions
|
39 |
-
add_action( 'wp_ajax_ajax_clear_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_clear_users' ) );
|
40 |
-
add_action( 'wp_ajax_ajax_check_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_check_users' ) );
|
41 |
-
add_action( 'wp_ajax_ajax_info_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_info' ) );
|
42 |
-
add_action( 'wp_ajax_ajax_ct_get_csv_file', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_get_csv_file' ) );
|
43 |
-
add_action( 'wp_ajax_ajax_delete_all_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_delete_all_users' ) );
|
44 |
-
|
45 |
-
add_action( 'wp_ajax_ajax_clear_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_clear_comments' ) );
|
46 |
-
add_action( 'wp_ajax_ajax_check_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_check_comments' ) );
|
47 |
-
add_action( 'wp_ajax_ajax_info_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_info' ) );
|
48 |
-
add_action( 'wp_ajax_ajax_delete_all', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_delete_all' ) );
|
49 |
-
|
50 |
-
// Debug
|
51 |
-
add_action( 'wp_ajax_ajax_insert_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_insert_users' ) );
|
52 |
-
|
53 |
-
// Hook for saving "per_page" option
|
54 |
-
add_action( 'wp_loaded', 'ct_save_screen_option' );
|
55 |
-
function ct_save_screen_option() {
|
56 |
-
|
57 |
-
// Saving screen option for the pagination (per page option)
|
58 |
-
add_filter( 'set-screen-option', function( $status, $option, $value ){
|
59 |
-
return ( $option == 'spam_per_page' ) ? (int) $value : $status;
|
60 |
-
}, 10, 3 );
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
// Add checked icons into users table
|
65 |
-
add_filter( 'manage_users_columns', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_manage_users_columns' ), 10, 1 );
|
66 |
add_filter( 'manage_users_custom_column', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_manage_users_custom_column' ), 10, 3 );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamPage.php');
|
4 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamChecker.php');
|
5 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamUsersChecker.php');
|
6 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php');
|
7 |
+
|
8 |
+
// Adding menu items for USERS and COMMENTS spam checking pages
|
9 |
+
add_action( 'admin_menu', 'ct_add_find_spam_pages' );
|
10 |
+
function ct_add_find_spam_pages(){
|
11 |
+
|
12 |
+
// Check users pages
|
13 |
+
$ct_check_users = add_users_page( __( "Check for spam", 'cleantalk' ), __( "Find spam users", 'cleantalk' ), 'activate_plugins', 'ct_check_users', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
14 |
+
$ct_check_users_total = add_users_page( __( "Previous scan results", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
15 |
+
$ct_check_users_logs = add_users_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
16 |
+
|
17 |
+
// Cheack comments pages
|
18 |
+
$ct_check_spam = add_comments_page( __( "Check for spam", 'cleantalk' ), __( "Find spam comments", 'cleantalk' ), 'activate_plugins', 'ct_check_spam', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
19 |
+
$ct_check_spam_total = add_comments_page( __( "Previous scan results", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
20 |
+
$ct_check_spam_logs = add_comments_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
|
21 |
+
|
22 |
+
// Remove some pages from main menu
|
23 |
+
remove_submenu_page( 'users.php', 'ct_check_users_total' );
|
24 |
+
remove_submenu_page( 'users.php', 'ct_check_users_logs' );
|
25 |
+
remove_submenu_page( 'edit-comments.php', 'ct_check_spam_total' );
|
26 |
+
remove_submenu_page( 'edit-comments.php', 'ct_check_spam_logs' );
|
27 |
+
|
28 |
+
// Set screen option for every pages
|
29 |
+
add_action( "load-$ct_check_users", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
30 |
+
add_action( "load-$ct_check_users_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
31 |
+
add_action( "load-$ct_check_users_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
32 |
+
add_action( "load-$ct_check_spam", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
33 |
+
add_action( "load-$ct_check_spam_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
34 |
+
add_action( "load-$ct_check_spam_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
// Set AJAX actions
|
39 |
+
add_action( 'wp_ajax_ajax_clear_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_clear_users' ) );
|
40 |
+
add_action( 'wp_ajax_ajax_check_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_check_users' ) );
|
41 |
+
add_action( 'wp_ajax_ajax_info_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_info' ) );
|
42 |
+
add_action( 'wp_ajax_ajax_ct_get_csv_file', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_get_csv_file' ) );
|
43 |
+
add_action( 'wp_ajax_ajax_delete_all_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_delete_all_users' ) );
|
44 |
+
|
45 |
+
add_action( 'wp_ajax_ajax_clear_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_clear_comments' ) );
|
46 |
+
add_action( 'wp_ajax_ajax_check_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_check_comments' ) );
|
47 |
+
add_action( 'wp_ajax_ajax_info_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_info' ) );
|
48 |
+
add_action( 'wp_ajax_ajax_delete_all', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_delete_all' ) );
|
49 |
+
|
50 |
+
// Debug
|
51 |
+
add_action( 'wp_ajax_ajax_insert_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_insert_users' ) );
|
52 |
+
|
53 |
+
// Hook for saving "per_page" option
|
54 |
+
add_action( 'wp_loaded', 'ct_save_screen_option' );
|
55 |
+
function ct_save_screen_option() {
|
56 |
+
|
57 |
+
// Saving screen option for the pagination (per page option)
|
58 |
+
add_filter( 'set-screen-option', function( $status, $option, $value ){
|
59 |
+
return ( $option == 'spam_per_page' ) ? (int) $value : $status;
|
60 |
+
}, 10, 3 );
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
// Add checked icons into users table
|
65 |
+
add_filter( 'manage_users_columns', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_manage_users_columns' ), 10, 1 );
|
66 |
add_filter( 'manage_users_custom_column', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_manage_users_custom_column' ), 10, 3 );
|
inc/cleantalk-pluggable.php
CHANGED
@@ -1,288 +1,288 @@
|
|
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() || apbct_is_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 = is_array($sessions) ? current($sessions) : $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 |
-
(apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' ) && strtolower(apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' )) == 'xmlhttprequest') || // by Request type
|
218 |
-
!empty($_POST['quform_ajax']) || // special. QForms
|
219 |
-
!empty($_POST['iphorm_ajax']); // special. IPHorm
|
220 |
-
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Checks if the user is logged in
|
225 |
-
*
|
226 |
-
* @return bool
|
227 |
-
*/
|
228 |
-
function apbct_is_user_logged_in(){
|
229 |
-
$siteurl = get_site_option( 'siteurl' );
|
230 |
-
$cookiehash = $siteurl ? md5( $siteurl ) : '';
|
231 |
-
return count($_COOKIE) && isset($_COOKIE['wordpress_logged_in_'.$cookiehash]);
|
232 |
-
}
|
233 |
-
|
234 |
-
/*
|
235 |
-
* GETTING SERVER VARIABLES BY VARIOUS WAYS
|
236 |
-
*/
|
237 |
-
function apbct_get_server_variable( $server_variable_name ){
|
238 |
-
|
239 |
-
$var_name = strtoupper( $server_variable_name );
|
240 |
-
|
241 |
-
if( function_exists( 'filter_input' ) )
|
242 |
-
$value = filter_input( INPUT_SERVER, $var_name );
|
243 |
-
|
244 |
-
if( empty( $value ) )
|
245 |
-
$value = isset( $_SERVER[ $var_name ] ) ? $_SERVER[ $var_name ] : '';
|
246 |
-
|
247 |
-
// Convert to upper case for REQUEST_METHOD
|
248 |
-
if( in_array( $server_variable_name, array( 'REQUEST_METHOD' ) ) )
|
249 |
-
$value = strtoupper( $value );
|
250 |
-
|
251 |
-
// Convert HTML chars for HTTP_USER_AGENT, HTTP_USER_AGENT, SERVER_NAME
|
252 |
-
if( in_array( $server_variable_name, array( 'HTTP_USER_AGENT', 'HTTP_USER_AGENT', 'SERVER_NAME' ) ) )
|
253 |
-
$value = htmlspecialchars( $value );
|
254 |
-
|
255 |
-
return $value;
|
256 |
-
}
|
257 |
-
|
258 |
-
function apbct_is_post(){
|
259 |
-
return apbct_get_server_variable('REQUEST_METHOD') === 'POST';
|
260 |
-
}
|
261 |
-
|
262 |
-
function apbct_is_get(){
|
263 |
-
return apbct_get_server_variable('REQUEST_METHOD') === 'GET';
|
264 |
-
}
|
265 |
-
|
266 |
-
function apbct_is_in_referer( $str ){
|
267 |
-
return stripos( apbct_get_server_variable('HTTP_REFERER'), $str ) !== false;
|
268 |
-
}
|
269 |
-
|
270 |
-
function apbct_is_in_uri( $str ){
|
271 |
-
return stripos( apbct_get_server_variable('REQUEST_URI'), $str ) !== false;
|
272 |
-
}
|
273 |
-
|
274 |
-
/*
|
275 |
-
* Checking if current request is a cron job
|
276 |
-
* Support for wordpress < 4.8.0
|
277 |
-
*
|
278 |
-
* @return bool
|
279 |
-
*/
|
280 |
-
function apbct_wp_doing_cron() {
|
281 |
-
|
282 |
-
if( function_exists( 'wp_doing_cron' ) ) {
|
283 |
-
return wp_doing_cron();
|
284 |
-
} else {
|
285 |
-
return ( defined( 'DOING_CRON' ) && DOING_CRON );
|
286 |
-
}
|
287 |
-
|
288 |
}
|
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() || apbct_is_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 = is_array($sessions) ? current($sessions) : $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 |
+
(apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' ) && strtolower(apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' )) == 'xmlhttprequest') || // by Request type
|
218 |
+
!empty($_POST['quform_ajax']) || // special. QForms
|
219 |
+
!empty($_POST['iphorm_ajax']); // special. IPHorm
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Checks if the user is logged in
|
225 |
+
*
|
226 |
+
* @return bool
|
227 |
+
*/
|
228 |
+
function apbct_is_user_logged_in(){
|
229 |
+
$siteurl = get_site_option( 'siteurl' );
|
230 |
+
$cookiehash = $siteurl ? md5( $siteurl ) : '';
|
231 |
+
return count($_COOKIE) && isset($_COOKIE['wordpress_logged_in_'.$cookiehash]);
|
232 |
+
}
|
233 |
+
|
234 |
+
/*
|
235 |
+
* GETTING SERVER VARIABLES BY VARIOUS WAYS
|
236 |
+
*/
|
237 |
+
function apbct_get_server_variable( $server_variable_name ){
|
238 |
+
|
239 |
+
$var_name = strtoupper( $server_variable_name );
|
240 |
+
|
241 |
+
if( function_exists( 'filter_input' ) )
|
242 |
+
$value = filter_input( INPUT_SERVER, $var_name );
|
243 |
+
|
244 |
+
if( empty( $value ) )
|
245 |
+
$value = isset( $_SERVER[ $var_name ] ) ? $_SERVER[ $var_name ] : '';
|
246 |
+
|
247 |
+
// Convert to upper case for REQUEST_METHOD
|
248 |
+
if( in_array( $server_variable_name, array( 'REQUEST_METHOD' ) ) )
|
249 |
+
$value = strtoupper( $value );
|
250 |
+
|
251 |
+
// Convert HTML chars for HTTP_USER_AGENT, HTTP_USER_AGENT, SERVER_NAME
|
252 |
+
if( in_array( $server_variable_name, array( 'HTTP_USER_AGENT', 'HTTP_USER_AGENT', 'SERVER_NAME' ) ) )
|
253 |
+
$value = htmlspecialchars( $value );
|
254 |
+
|
255 |
+
return $value;
|
256 |
+
}
|
257 |
+
|
258 |
+
function apbct_is_post(){
|
259 |
+
return apbct_get_server_variable('REQUEST_METHOD') === 'POST';
|
260 |
+
}
|
261 |
+
|
262 |
+
function apbct_is_get(){
|
263 |
+
return apbct_get_server_variable('REQUEST_METHOD') === 'GET';
|
264 |
+
}
|
265 |
+
|
266 |
+
function apbct_is_in_referer( $str ){
|
267 |
+
return stripos( apbct_get_server_variable('HTTP_REFERER'), $str ) !== false;
|
268 |
+
}
|
269 |
+
|
270 |
+
function apbct_is_in_uri( $str ){
|
271 |
+
return stripos( apbct_get_server_variable('REQUEST_URI'), $str ) !== false;
|
272 |
+
}
|
273 |
+
|
274 |
+
/*
|
275 |
+
* Checking if current request is a cron job
|
276 |
+
* Support for wordpress < 4.8.0
|
277 |
+
*
|
278 |
+
* @return bool
|
279 |
+
*/
|
280 |
+
function apbct_wp_doing_cron() {
|
281 |
+
|
282 |
+
if( function_exists( 'wp_doing_cron' ) ) {
|
283 |
+
return wp_doing_cron();
|
284 |
+
} else {
|
285 |
+
return ( defined( 'DOING_CRON' ) && DOING_CRON );
|
286 |
+
}
|
287 |
+
|
288 |
}
|
inc/cleantalk-public.php
CHANGED
@@ -1,3845 +1,3848 @@
|
|
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_post() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
|
40 |
-
|
41 |
-
if (defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') && is_string(CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL)) {
|
42 |
-
$catch_buffer = false;
|
43 |
-
$urls = explode(',', CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL);
|
44 |
-
foreach ($urls as $url) {
|
45 |
-
if (apbct_is_in_uri($url))
|
46 |
-
$catch_buffer = true;
|
47 |
-
}
|
48 |
-
}else{
|
49 |
-
$catch_buffer = true;
|
50 |
-
}
|
51 |
-
|
52 |
-
if( $catch_buffer ){
|
53 |
-
add_action('wp', 'apbct_buffer__start');
|
54 |
-
add_action('shutdown', 'apbct_buffer__end', 0);
|
55 |
-
add_action('shutdown', 'apbct_buffer__output', 2);
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
// Check and redirecct
|
60 |
-
if( apbct_is_post()
|
61 |
-
&& isset($_POST['cleantalk_hidden_method'])
|
62 |
-
&& isset($_POST['cleantalk_hidden_action'])
|
63 |
-
){
|
64 |
-
$action = htmlspecialchars($_POST['cleantalk_hidden_action']);
|
65 |
-
$method = htmlspecialchars($_POST['cleantalk_hidden_method']);
|
66 |
-
unset($_POST['cleantalk_hidden_action']);
|
67 |
-
unset($_POST['cleantalk_hidden_method']);
|
68 |
-
ct_contact_form_validate();
|
69 |
-
if(!apbct_is_ajax()){
|
70 |
-
print "<html><body><form method='$method' action='$action'>";
|
71 |
-
ct_print_form($_POST, '');
|
72 |
-
print "</form></body></html>";
|
73 |
-
print "<script>
|
74 |
-
if(document.forms[0].submit !== 'undefined'){
|
75 |
-
var objects = document.getElementsByName('submit');
|
76 |
-
if(objects.length > 0)
|
77 |
-
document.forms[0].removeChild(objects[0]);
|
78 |
-
}
|
79 |
-
document.forms[0].submit();
|
80 |
-
</script>";
|
81 |
-
die();
|
82 |
-
}
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
|
87 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
88 |
-
ct_ajax_hook();
|
89 |
-
}
|
90 |
-
|
91 |
-
/**hooks for cm answers pro */
|
92 |
-
if(defined('CMA_PLUGIN_FILE')){
|
93 |
-
add_action( 'wp', 'ct_ajax_hook',1 );
|
94 |
-
}
|
95 |
-
|
96 |
-
//hook for Anonymous Post
|
97 |
-
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
98 |
-
add_action('wp', 'ct_contact_form_validate_postdata',1);
|
99 |
-
|
100 |
-
if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
|
101 |
-
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
102 |
-
//add_action('init','ct_contact_form_validate',1);
|
103 |
-
ct_contact_form_validate();
|
104 |
-
if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
|
105 |
-
{
|
106 |
-
unset($_POST['ct_checkjs_register_form']);
|
107 |
-
ct_contact_form_validate();
|
108 |
-
}
|
109 |
-
/*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
110 |
-
{
|
111 |
-
$tmp=$_POST['redirect_to'];
|
112 |
-
unset($_POST['redirect_to']);
|
113 |
-
ct_contact_form_validate();
|
114 |
-
$_POST['redirect_to']=$tmp;
|
115 |
-
}*/
|
116 |
-
}
|
117 |
-
|
118 |
-
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
119 |
-
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
120 |
-
|
121 |
-
//add_action('wp_footer','ct_ajaxurl');
|
122 |
-
|
123 |
-
// Fast Secure contact form
|
124 |
-
if(defined('FSCF_VERSION')){
|
125 |
-
add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
|
126 |
-
add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
|
127 |
-
}
|
128 |
-
|
129 |
-
// WooCommerce registration
|
130 |
-
if(class_exists('WooCommerce')){
|
131 |
-
add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
|
132 |
-
if ($apbct->settings['wc_checkout_test'] == 1) {
|
133 |
-
add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
|
134 |
-
}
|
135 |
-
if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && $apbct->settings['wc_checkout_test'] == 0 && $apbct->settings['wc_register_from_order'] == 0 ){
|
136 |
-
remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
// WooCommerce whishlist
|
141 |
-
if(class_exists('WC_Wishlists_Wishlist'))
|
142 |
-
add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
|
143 |
-
|
144 |
-
|
145 |
-
// JetPack Contact form
|
146 |
-
$jetpack_active_modules = false;
|
147 |
-
if(defined('JETPACK__VERSION'))
|
148 |
-
{
|
149 |
-
if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
|
150 |
-
if(JETPACK__VERSION=='3.4-beta')
|
151 |
-
{
|
152 |
-
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
153 |
-
}
|
154 |
-
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
155 |
-
{
|
156 |
-
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
|
157 |
-
}
|
158 |
-
else
|
159 |
-
{
|
160 |
-
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
161 |
-
}
|
162 |
-
$jetpack_active_modules = get_option('jetpack_active_modules');
|
163 |
-
if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
|
164 |
-
{
|
165 |
-
$ct_jp_comments = true;
|
166 |
-
}
|
167 |
-
}else
|
168 |
-
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
169 |
-
}
|
170 |
-
|
171 |
-
// WP Maintenance Mode (wpmm)
|
172 |
-
add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
|
173 |
-
|
174 |
-
// Contact Form7
|
175 |
-
if(defined('WPCF7_VERSION')){
|
176 |
-
add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
|
177 |
-
add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
|
178 |
-
add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
|
179 |
-
}
|
180 |
-
|
181 |
-
// Formidable
|
182 |
-
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
183 |
-
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
184 |
-
|
185 |
-
// BuddyPress
|
186 |
-
if(class_exists('BuddyPress')){
|
187 |
-
add_action('bp_before_registration_submit_buttons','ct_register_form',1);
|
188 |
-
add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
|
189 |
-
add_filter('bp_signup_validate', 'ct_registration_errors',1);
|
190 |
-
add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
|
191 |
-
}
|
192 |
-
|
193 |
-
if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
|
194 |
-
add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
// bbPress
|
199 |
-
if(class_exists('bbPress')){
|
200 |
-
add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
|
201 |
-
add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
|
202 |
-
add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
|
203 |
-
add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
|
204 |
-
add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
|
205 |
-
}
|
206 |
-
|
207 |
-
//Custom Contact Forms
|
208 |
-
if(defined('CCF_VERSION'))
|
209 |
-
add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
|
210 |
-
|
211 |
-
add_action('comment_form', 'ct_comment_form');
|
212 |
-
|
213 |
-
// intercept WordPress Landing Pages POST
|
214 |
-
if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
|
215 |
-
if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
|
216 |
-
ct_check_wplp();
|
217 |
-
}else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
|
218 |
-
ct_check_wplp();
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
// S2member. intercept POST
|
223 |
-
if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
|
224 |
-
$post_keys = array_keys($_POST);
|
225 |
-
foreach($post_keys as $post_key){
|
226 |
-
|
227 |
-
// Detect POST keys like /s2member_pro.*registration/
|
228 |
-
if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
|
229 |
-
ct_s2member_registration_test($post_key);
|
230 |
-
break;
|
231 |
-
}
|
232 |
-
}
|
233 |
-
}
|
234 |
-
|
235 |
-
// New user approve hack
|
236 |
-
// https://wordpress.org/plugins/new-user-approve/
|
237 |
-
if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
|
238 |
-
add_action('register_post', 'ct_register_post', 1, 3);
|
239 |
-
}
|
240 |
-
|
241 |
-
// Wilcity theme registration validation fix
|
242 |
-
add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
|
243 |
-
|
244 |
-
|
245 |
-
// Gravity forms
|
246 |
-
if (defined('GF_MIN_WP_VERSION')) {
|
247 |
-
add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
|
248 |
-
add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
|
249 |
-
add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
|
250 |
-
}
|
251 |
-
|
252 |
-
//Pirate forms
|
253 |
-
if(defined('PIRATE_FORMS_VERSION')){
|
254 |
-
if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
|
255 |
-
apbct_form__piratesForm__testSpam();
|
256 |
-
}
|
257 |
-
|
258 |
-
// WPForms
|
259 |
-
// Adding fields
|
260 |
-
add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
|
261 |
-
// Gathering data to validate
|
262 |
-
add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
|
263 |
-
// Do spam check
|
264 |
-
add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
|
265 |
-
|
266 |
-
// QForms integration
|
267 |
-
add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
|
268 |
-
|
269 |
-
// Ultimate Members
|
270 |
-
if (class_exists('UM')) {
|
271 |
-
add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
|
272 |
-
add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
|
273 |
-
}
|
274 |
-
|
275 |
-
// Paid Memberships Pro integration
|
276 |
-
add_filter( 'pmpro_required_user_fields', function( $pmpro_required_user_fields ){
|
277 |
-
|
278 |
-
if(
|
279 |
-
! empty( $pmpro_required_user_fields['username'] ) &&
|
280 |
-
! empty( $pmpro_required_user_fields['bemail'] ) &&
|
281 |
-
! empty( $pmpro_required_user_fields['bconfirmemail'] ) &&
|
282 |
-
$pmpro_required_user_fields['bemail'] == $pmpro_required_user_fields['bconfirmemail']
|
283 |
-
) {
|
284 |
-
$check = ct_test_registration( $pmpro_required_user_fields['username'], $pmpro_required_user_fields['bemail'], apbct_get_server_variable( 'REMOTE_ADDR' ) );
|
285 |
-
if( $check['allow'] == 0 ) {
|
286 |
-
pmpro_setMessage( $check['comment'], 'pmpro_error' );
|
287 |
-
}
|
288 |
-
}
|
289 |
-
|
290 |
-
return $pmpro_required_user_fields;
|
291 |
-
|
292 |
-
} );
|
293 |
-
|
294 |
-
//
|
295 |
-
// Load JS code to website footer
|
296 |
-
//
|
297 |
-
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
298 |
-
add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
|
299 |
-
add_action('wp_footer', 'apbct_hook__wp_footer', 1);
|
300 |
-
}
|
301 |
-
|
302 |
-
if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
|
303 |
-
ct_contact_form_validate();
|
304 |
-
}
|
305 |
-
|
306 |
-
if (apbct_is_user_enable()) {
|
307 |
-
|
308 |
-
if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
|
309 |
-
add_action( 'init', 'ct_contact_form_validate', 999 );
|
310 |
-
}
|
311 |
-
if( apbct_is_post() &&
|
312 |
-
$apbct->settings['general_postdata_test'] == 1 &&
|
313 |
-
!isset($_POST['ct_checkjs_cf7']) &&
|
314 |
-
!is_admin() &&
|
315 |
-
!apbct_is_user_role_in(array('administrator', 'moderator'))
|
316 |
-
){
|
317 |
-
ct_contact_form_validate_postdata();
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
function apbct_buffer__start(){
|
323 |
-
ob_start();
|
324 |
-
}
|
325 |
-
|
326 |
-
function apbct_buffer__end(){
|
327 |
-
|
328 |
-
if(!ob_get_level())
|
329 |
-
return;
|
330 |
-
|
331 |
-
global $apbct;
|
332 |
-
$apbct->buffer = ob_get_contents();
|
333 |
-
ob_end_clean();
|
334 |
-
}
|
335 |
-
|
336 |
-
/**
|
337 |
-
* Outputs changed buffer
|
338 |
-
*
|
339 |
-
* @global $apbct
|
340 |
-
*/
|
341 |
-
function apbct_buffer__output(){
|
342 |
-
|
343 |
-
global $apbct, $wp;
|
344 |
-
|
345 |
-
if(empty($apbct->buffer))
|
346 |
-
return;
|
347 |
-
|
348 |
-
$site_url = get_option('siteurl');
|
349 |
-
$site__host = parse_url($site_url, PHP_URL_HOST);
|
350 |
-
|
351 |
-
$dom = new DOMDocument();
|
352 |
-
@$dom->loadHTML($apbct->buffer);
|
353 |
-
|
354 |
-
$forms = $dom->getElementsByTagName('form');
|
355 |
-
|
356 |
-
foreach($forms as $form){
|
357 |
-
|
358 |
-
$action = $form->getAttribute('action');
|
359 |
-
$action = $action ? $action : $site_url;
|
360 |
-
$action__host = parse_url($action, PHP_URL_HOST);
|
361 |
-
|
362 |
-
// Check if the form directed to the third party site
|
363 |
-
if($site__host != $action__host){
|
364 |
-
|
365 |
-
$method = $form->getAttribute('method');
|
366 |
-
$method = $method ? $method : 'get';
|
367 |
-
// Directs form to our site
|
368 |
-
$form->setAttribute('method', 'POST');
|
369 |
-
$form->setAttribute('action', home_url(add_query_arg(array(), $wp->request)));
|
370 |
-
|
371 |
-
// Add cleantalk_hidden_action
|
372 |
-
$new_input = $dom->createElement('input');
|
373 |
-
$new_input->setAttribute('type', 'hidden');
|
374 |
-
$new_input->setAttribute('name', 'cleantalk_hidden_action');
|
375 |
-
$new_input->setAttribute('value', $action);
|
376 |
-
$form->appendChild($new_input);
|
377 |
-
|
378 |
-
// Add cleantalk_hidden_method
|
379 |
-
$new_input = $dom->createElement('input');
|
380 |
-
$new_input->setAttribute('type', 'hidden');
|
381 |
-
$new_input->setAttribute('name', 'cleantalk_hidden_method');
|
382 |
-
$new_input->setAttribute('value', $method);
|
383 |
-
$form->appendChild($new_input);
|
384 |
-
|
385 |
-
}
|
386 |
-
|
387 |
-
} unset($form);
|
388 |
-
|
389 |
-
$html = $dom->getElementsByTagName('html');
|
390 |
-
|
391 |
-
$output = gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0])
|
392 |
-
? $dom->saveHTML()
|
393 |
-
: $apbct->buffer;
|
394 |
-
|
395 |
-
echo $output;
|
396 |
-
die();
|
397 |
-
}
|
398 |
-
|
399 |
-
// MailChimp Premium for Wordpress
|
400 |
-
function ct_add_mc4wp_error_message($messages){
|
401 |
-
|
402 |
-
$messages['ct_mc4wp_response'] = array(
|
403 |
-
'type' => 'error',
|
404 |
-
'text' => 'Your message looks like spam.'
|
405 |
-
);
|
406 |
-
return $messages;
|
407 |
-
}
|
408 |
-
add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
|
409 |
-
|
410 |
-
/*
|
411 |
-
* Function to set validate fucntion for CCF form
|
412 |
-
* Input - Сonsistently each form field
|
413 |
-
* Returns - String. Validate function
|
414 |
-
*/
|
415 |
-
function ct_ccf($callback, $value, $field_id, $type){
|
416 |
-
/*
|
417 |
-
if($type == 'name')
|
418 |
-
$ct_global_temporary_data['name'] = $value;
|
419 |
-
elseif($type == 'email')
|
420 |
-
$ct_global_temporary_data['email'] = $value;
|
421 |
-
else
|
422 |
-
$ct_global_temporary_data[] = $value;
|
423 |
-
//*/
|
424 |
-
return 'ct_validate_ccf_submission';
|
425 |
-
}
|
426 |
-
/*
|
427 |
-
* Validate function for CCF form. Gatheering data. Multiple calls.
|
428 |
-
* Input - void. Global $ct_global_temporary_data
|
429 |
-
* Returns - String. CleanTalk comment.
|
430 |
-
*/
|
431 |
-
$ct_global_temporary_data = array();
|
432 |
-
function ct_validate_ccf_submission($value, $field_id, $required){
|
433 |
-
global $ct_global_temporary_data, $apbct;
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
//If the check for contact forms enabled
|
438 |
-
if(!$apbct->settings['contact_forms_test']) {
|
439 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
440 |
-
return true;
|
441 |
-
}
|
442 |
-
|
443 |
-
//If the check for logged in users enabled
|
444 |
-
if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in()) {
|
445 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
446 |
-
return true;
|
447 |
-
}
|
448 |
-
|
449 |
-
|
450 |
-
//Accumulate data
|
451 |
-
$ct_global_temporary_data[] = $value;
|
452 |
-
|
453 |
-
//If it's the last field of the form
|
454 |
-
(!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
|
455 |
-
$form_id = $_POST['form_id'];
|
456 |
-
if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true ))) {
|
457 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
458 |
-
return true;
|
459 |
-
}
|
460 |
-
|
461 |
-
unset($ct_global_temporary_data['count']);
|
462 |
-
|
463 |
-
//Getting request params
|
464 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
465 |
-
|
466 |
-
unset($ct_global_temporary_data);
|
467 |
-
|
468 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
469 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
470 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
471 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
472 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
473 |
-
|
474 |
-
if ($subject != '')
|
475 |
-
$message['subject'] = $subject;
|
476 |
-
|
477 |
-
$post_info['comment_type'] = 'feedback_custom_contact_forms';
|
478 |
-
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
479 |
-
|
480 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
481 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
482 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
483 |
-
|
484 |
-
//Making a call
|
485 |
-
$base_call_result = apbct_base_call(
|
486 |
-
array(
|
487 |
-
'message' => $message,
|
488 |
-
'sender_email' => $sender_email,
|
489 |
-
'sender_nickname' => $sender_nickname,
|
490 |
-
'post_info' => $post_info,
|
491 |
-
'js_on' => $checkjs,
|
492 |
-
'sender_info' => array('sender_url' => null),
|
493 |
-
)
|
494 |
-
);
|
495 |
-
|
496 |
-
$ct_result = $base_call_result['ct_result'];
|
497 |
-
|
498 |
-
return $ct_result->allow == 0 ? $ct_result->comment : true;;
|
499 |
-
}
|
500 |
-
|
501 |
-
function ct_woocommerce_wishlist_check($args){
|
502 |
-
global $apbct;
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
//Protect logged in users
|
507 |
-
if($args['wishlist_status'])
|
508 |
-
if($apbct->settings['protect_logged_in'] == 0) {
|
509 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
510 |
-
return $args;
|
511 |
-
}
|
512 |
-
|
513 |
-
|
514 |
-
//If the IP is a Google bot
|
515 |
-
$hostname = gethostbyaddr( apbct_get_server_variable( 'REMOTE_ADDR' ) );
|
516 |
-
if(!strpos($hostname, 'googlebot.com')) {
|
517 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
518 |
-
return $args;
|
519 |
-
}
|
520 |
-
|
521 |
-
|
522 |
-
//Getting request params
|
523 |
-
$message = '';
|
524 |
-
$subject = '';
|
525 |
-
$email = $args['wishlist_owner_email'];
|
526 |
-
if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
|
527 |
-
$nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
|
528 |
-
else
|
529 |
-
$nickname = '';
|
530 |
-
|
531 |
-
$post_info['comment_type'] = 'feedback';
|
532 |
-
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
533 |
-
|
534 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
535 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
536 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
537 |
-
|
538 |
-
//Making a call
|
539 |
-
$base_call_result = apbct_base_call(
|
540 |
-
array(
|
541 |
-
'message' => $subject." ".$message,
|
542 |
-
'sender_email' => $email,
|
543 |
-
'sender_nickname' => $nickname,
|
544 |
-
'post_info' => $post_info,
|
545 |
-
'js_on' => $checkjs,
|
546 |
-
'sender_info' => array('sender_url' => null),
|
547 |
-
)
|
548 |
-
);
|
549 |
-
|
550 |
-
$ct_result = $base_call_result['ct_result'];
|
551 |
-
|
552 |
-
if ($ct_result->allow == 0)
|
553 |
-
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
554 |
-
else
|
555 |
-
return $args;
|
556 |
-
}
|
557 |
-
|
558 |
-
function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
|
559 |
-
global $apbct;
|
560 |
-
preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
|
561 |
-
$apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
|
562 |
-
}
|
563 |
-
|
564 |
-
/**
|
565 |
-
* Test BuddyPress activity for spam (post update only)
|
566 |
-
*
|
567 |
-
* @global SpbcState $apbct
|
568 |
-
* @param bool $is_spam
|
569 |
-
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
570 |
-
* @return boolean Spam flag
|
571 |
-
*/
|
572 |
-
function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
|
573 |
-
|
574 |
-
global $apbct;
|
575 |
-
|
576 |
-
if( $activity_obj === null ||
|
577 |
-
!isset($_POST['action']) ||
|
578 |
-
$activity_obj->privacy == 'media' ||
|
579 |
-
( ! empty( $_POST['action'] ) && $_POST['action'] !== 'post_update' ) ||
|
580 |
-
apbct_exclusions_check()
|
581 |
-
) {
|
582 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
583 |
-
return false;
|
584 |
-
}
|
585 |
-
|
586 |
-
|
587 |
-
$curr_user = get_user_by('id', $activity_obj->user_id);
|
588 |
-
|
589 |
-
//Making a call
|
590 |
-
$base_call_result = apbct_base_call(
|
591 |
-
array(
|
592 |
-
'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
|
593 |
-
'sender_email' => $curr_user->data->user_email,
|
594 |
-
'sender_nickname' => $curr_user->data->user_login,
|
595 |
-
'post_info' => array(
|
596 |
-
'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
|
597 |
-
'comment_type' => 'buddypress_activitywall',
|
598 |
-
),
|
599 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
600 |
-
'sender_info' => array('sender_url' => null),
|
601 |
-
)
|
602 |
-
);
|
603 |
-
|
604 |
-
$ct_result = $base_call_result['ct_result'];
|
605 |
-
|
606 |
-
if ($ct_result->allow == 0){
|
607 |
-
add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
|
608 |
-
$apbct->spam_notification = $ct_result->comment;
|
609 |
-
return true;
|
610 |
-
}else
|
611 |
-
return $is_spam;
|
612 |
-
}
|
613 |
-
|
614 |
-
/**
|
615 |
-
* Outputs message to AJAX frontend handler
|
616 |
-
*
|
617 |
-
* @global SpbcState $apbct
|
618 |
-
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
619 |
-
*/
|
620 |
-
function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
|
621 |
-
|
622 |
-
global $apbct;
|
623 |
-
|
624 |
-
// Legacy template
|
625 |
-
if($apbct->buddy_press_tmpl === 'bp-legacy'){
|
626 |
-
die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
|
627 |
-
// Nouveau tamplate and others
|
628 |
-
}else{
|
629 |
-
@header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
|
630 |
-
die(json_encode(array(
|
631 |
-
'success' => false,
|
632 |
-
'data' => array('message' => $apbct->spam_notification),
|
633 |
-
)));
|
634 |
-
}
|
635 |
-
}
|
636 |
-
|
637 |
-
/**
|
638 |
-
* Public function - Tests new private messages (dialogs)
|
639 |
-
*
|
640 |
-
* @global SpbcState $apbct
|
641 |
-
* @param type $bp_message_obj
|
642 |
-
* @return void|array with errors if spam has found
|
643 |
-
*/
|
644 |
-
function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
|
645 |
-
|
646 |
-
global $apbct;
|
647 |
-
|
648 |
-
//Check for enabled option
|
649 |
-
if(
|
650 |
-
$apbct->settings['bp_private_messages'] == 0 ||
|
651 |
-
apbct_exclusions_check()
|
652 |
-
) {
|
653 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
654 |
-
return;
|
655 |
-
}
|
656 |
-
|
657 |
-
|
658 |
-
//Check for quantity of comments
|
659 |
-
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
|
660 |
-
? CLEANTALK_CHECK_COMMENTS_NUMBER
|
661 |
-
: 3;
|
662 |
-
|
663 |
-
if($apbct->settings['check_comments_number']){
|
664 |
-
$args = array(
|
665 |
-
'user_id' => $bp_message_obj->sender_id,
|
666 |
-
'box' => 'sentbox',
|
667 |
-
'type' => 'all',
|
668 |
-
'limit' => $comments_check_number,
|
669 |
-
'page' => null,
|
670 |
-
'search_terms' => '',
|
671 |
-
'meta_query' => array()
|
672 |
-
);
|
673 |
-
$sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
674 |
-
$cnt_sentbox_msgs = $sentbox_msgs['total'];
|
675 |
-
$args['box'] = 'inbox';
|
676 |
-
$inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
677 |
-
$cnt_inbox_msgs = $inbox_msgs['total'];
|
678 |
-
|
679 |
-
if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
|
680 |
-
$is_max_comments = true;
|
681 |
-
}
|
682 |
-
|
683 |
-
if(!empty($is_max_comments)) {
|
684 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
685 |
-
return;
|
686 |
-
}
|
687 |
-
|
688 |
-
|
689 |
-
$sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
|
690 |
-
|
691 |
-
//Making a call
|
692 |
-
$base_call_result = apbct_base_call(
|
693 |
-
array(
|
694 |
-
'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
|
695 |
-
'sender_email' => $sender_user_obj->data->user_email,
|
696 |
-
'sender_nickname' => $sender_user_obj->data->user_login,
|
697 |
-
'post_info' => array(
|
698 |
-
'comment_type' => 'buddypress_comment',
|
699 |
-
'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
|
700 |
-
),
|
701 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
|
702 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
703 |
-
: apbct_js_test('ct_checkjs', $_POST),
|
704 |
-
'sender_info' => array('sender_url' => null),
|
705 |
-
)
|
706 |
-
);
|
707 |
-
|
708 |
-
$ct_result = $base_call_result['ct_result'];
|
709 |
-
|
710 |
-
if ($ct_result->allow == 0)
|
711 |
-
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
712 |
-
}
|
713 |
-
|
714 |
-
/**
|
715 |
-
* Adds hiden filed to deafualt serach form
|
716 |
-
*
|
717 |
-
* @param $form string
|
718 |
-
* @return string
|
719 |
-
*/
|
720 |
-
function apbct_forms__search__addField( $form ){
|
721 |
-
global $apbct;
|
722 |
-
if($apbct->settings['search_test'] == 1){
|
723 |
-
$js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
|
724 |
-
$form = str_replace('</form>', $js_filed, $form);
|
725 |
-
}
|
726 |
-
return $form;
|
727 |
-
}
|
728 |
-
|
729 |
-
/**
|
730 |
-
* Test default search string for spam
|
731 |
-
*
|
732 |
-
* @param $search string
|
733 |
-
* @return string
|
734 |
-
*/
|
735 |
-
function apbct_forms__search__testSpam( $search ){
|
736 |
-
|
737 |
-
global $apbct, $cleantalk_executed;
|
738 |
-
|
739 |
-
if(
|
740 |
-
empty($search) ||
|
741 |
-
$cleantalk_executed ||
|
742 |
-
$apbct->settings['search_test'] == 0 ||
|
743 |
-
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
744 |
-
){
|
745 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
746 |
-
return $search;
|
747 |
-
}
|
748 |
-
|
749 |
-
if(apbct_is_user_logged_in())
|
750 |
-
$user = wp_get_current_user();
|
751 |
-
|
752 |
-
$base_call_result = apbct_base_call(
|
753 |
-
array(
|
754 |
-
'message' => $search,
|
755 |
-
'sender_email' => !empty($user) ? $user->user_email : null,
|
756 |
-
'sender_nickname' => !empty($user) ? $user->user_login : null,
|
757 |
-
'post_info' => array('comment_type' => 'site_search_wordpress'),
|
758 |
-
//'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
|
759 |
-
)
|
760 |
-
);
|
761 |
-
$ct_result = $base_call_result['ct_result'];
|
762 |
-
|
763 |
-
$cleantalk_executed = true;
|
764 |
-
|
765 |
-
if ($ct_result->allow == 0){
|
766 |
-
die($ct_result->comment);
|
767 |
-
}
|
768 |
-
|
769 |
-
return $search;
|
770 |
-
}
|
771 |
-
|
772 |
-
function apbct_search_add_noindex() {
|
773 |
-
|
774 |
-
global $apbct;
|
775 |
-
|
776 |
-
if(
|
777 |
-
! is_search() || // If it is search results
|
778 |
-
$apbct->settings['search_test'] == 0 ||
|
779 |
-
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
780 |
-
){
|
781 |
-
return ;
|
782 |
-
}
|
783 |
-
|
784 |
-
echo '<!-- meta by Cleantalk AntiSpam Protection plugin -->' . "\n";
|
785 |
-
echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
|
786 |
-
|
787 |
-
}
|
788 |
-
|
789 |
-
/**
|
790 |
-
* Test woocommerce checkout form for spam
|
791 |
-
*
|
792 |
-
*/
|
793 |
-
function ct_woocommerce_checkout_check() {
|
794 |
-
|
795 |
-
//Getting request params
|
796 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
797 |
-
|
798 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
799 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
800 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
801 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
802 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
803 |
-
|
804 |
-
if($subject != '')
|
805 |
-
$message = array_merge(array('subject' => $subject), $message);
|
806 |
-
|
807 |
-
$post_info['comment_type'] = 'order';
|
808 |
-
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
809 |
-
|
810 |
-
//Making a call
|
811 |
-
$base_call_result = apbct_base_call(
|
812 |
-
array(
|
813 |
-
'message' => $message,
|
814 |
-
'sender_email' => $sender_email,
|
815 |
-
'sender_nickname' => $sender_nickname,
|
816 |
-
'post_info' => $post_info,
|
817 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
818 |
-
'sender_info' => array('sender_url' => null),
|
819 |
-
)
|
820 |
-
);
|
821 |
-
|
822 |
-
$ct_result = $base_call_result['ct_result'];
|
823 |
-
|
824 |
-
if ($ct_result->allow == 0) {
|
825 |
-
wp_send_json(array(
|
826 |
-
'result' => 'failure',
|
827 |
-
'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
|
828 |
-
'refresh' => 'false',
|
829 |
-
'reload' => 'false'
|
830 |
-
));
|
831 |
-
}
|
832 |
-
}
|
833 |
-
|
834 |
-
/**
|
835 |
-
* Public function - Tests for Pirate contact froms
|
836 |
-
* return NULL
|
837 |
-
*/
|
838 |
-
function apbct_form__piratesForm__testSpam(){
|
839 |
-
|
840 |
-
global $apbct;
|
841 |
-
|
842 |
-
//Check for enabled option
|
843 |
-
if( !$apbct->settings['contact_forms_test']) {
|
844 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
845 |
-
return;
|
846 |
-
}
|
847 |
-
|
848 |
-
|
849 |
-
//Getting request params
|
850 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
851 |
-
|
852 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
853 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
854 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
855 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
856 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
857 |
-
|
858 |
-
if($subject != '')
|
859 |
-
$message = array_merge(array('subject' => $subject), $message);
|
860 |
-
|
861 |
-
$post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
|
862 |
-
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
863 |
-
|
864 |
-
//Making a call
|
865 |
-
$base_call_result = apbct_base_call(
|
866 |
-
array(
|
867 |
-
'message' => $message,
|
868 |
-
'sender_email' => $sender_email,
|
869 |
-
'sender_nickname' => $sender_nickname,
|
870 |
-
'post_info' => $post_info,
|
871 |
-
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
872 |
-
'sender_info' => array('sender_url' => null),
|
873 |
-
)
|
874 |
-
);
|
875 |
-
|
876 |
-
$ct_result = $base_call_result['ct_result'];
|
877 |
-
|
878 |
-
if ($ct_result->allow == 0)
|
879 |
-
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
880 |
-
}
|
881 |
-
|
882 |
-
/**
|
883 |
-
* Adds hidden filed to comment form
|
884 |
-
*/
|
885 |
-
function ct_comment_form($post_id){
|
886 |
-
|
887 |
-
global $apbct;
|
888 |
-
|
889 |
-
if (apbct_is_user_enable() === false) {
|
890 |
-
return false;
|
891 |
-
}
|
892 |
-
|
893 |
-
if ( !$apbct->settings['comments_test']) {
|
894 |
-
return false;
|
895 |
-
}
|
896 |
-
|
897 |
-
ct_add_hidden_fields('ct_checkjs', false, false);
|
898 |
-
|
899 |
-
return null;
|
900 |
-
}
|
901 |
-
|
902 |
-
/**
|
903 |
-
* Adds cookie script filed to head
|
904 |
-
*/
|
905 |
-
function apbct_hook__wp_head__set_cookie__ct_checkjs() {
|
906 |
-
|
907 |
-
ct_add_hidden_fields('ct_checkjs', false, true, true);
|
908 |
-
|
909 |
-
return null;
|
910 |
-
}
|
911 |
-
|
912 |
-
/**
|
913 |
-
* Adds cookie script filed to footer
|
914 |
-
*/
|
915 |
-
function apbct_hook__wp_footer() {
|
916 |
-
|
917 |
-
//ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
|
918 |
-
|
919 |
-
return null;
|
920 |
-
}
|
921 |
-
|
922 |
-
/**
|
923 |
-
* Adds hidden filed to define avaialbility of client's JavaScript
|
924 |
-
* @param bool $random_key switch on generation random key for every page load
|
925 |
-
*/
|
926 |
-
function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
|
927 |
-
|
928 |
-
global $ct_checkjs_def, $apbct;
|
929 |
-
|
930 |
-
$ct_checkjs_key = ct_get_checkjs_value();
|
931 |
-
$field_id_hash = md5(rand(0, 1000));
|
932 |
-
|
933 |
-
// Using only cookies
|
934 |
-
if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
|
935 |
-
|
936 |
-
$html = "<script type='text/javascript'>
|
937 |
-
function ctSetCookie(c_name, value, def_value){
|
938 |
-
document.cookie = c_name + '=' + escape(value) + '; path=/; samesite=lax';
|
939 |
-
}
|
940 |
-
ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
|
941 |
-
</script>";
|
942 |
-
|
943 |
-
// Using AJAX to get key
|
944 |
-
}elseif($apbct->settings['use_ajax'] && $ajax){
|
945 |
-
|
946 |
-
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
947 |
-
if($no_print)
|
948 |
-
return;
|
949 |
-
|
950 |
-
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
951 |
-
$field_id = $field_name . '_' . $field_id_hash;
|
952 |
-
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
953 |
-
<script type='text/javascript'>
|
954 |
-
window.addEventListener('load', function () {
|
955 |
-
setTimeout(function(){
|
956 |
-
|
957 |
-
{action: 'apbct_js_keys__get'},
|
958 |
-
{callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
|
959 |
-
);
|
960 |
-
}, 1000);
|
961 |
-
});
|
962 |
-
</script>";
|
963 |
-
|
964 |
-
// Set KEY from backend
|
965 |
-
}else{
|
966 |
-
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
967 |
-
if($no_print)
|
968 |
-
return;
|
969 |
-
|
970 |
-
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
971 |
-
$field_id = $field_name . '_' . $field_id_hash;
|
972 |
-
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
973 |
-
<script type='text/javascript'>
|
974 |
-
setTimeout(function(){
|
975 |
-
var ct_input_name = '{$field_id}';
|
976 |
-
if (document.getElementById(ct_input_name) !== null) {
|
977 |
-
var ct_input_value = document.getElementById(ct_input_name).value;
|
978 |
-
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
|
979 |
-
}
|
980 |
-
}, 1000);
|
981 |
-
</script>";
|
982 |
-
}
|
983 |
-
|
984 |
-
// Simplify JS code and Fixing issue with wpautop()
|
985 |
-
$html = str_replace(array("\n","\r","\t"),'', $html);
|
986 |
-
|
987 |
-
if ($return_string === true) {
|
988 |
-
return $html;
|
989 |
-
} else {
|
990 |
-
echo $html;
|
991 |
-
}
|
992 |
-
}
|
993 |
-
|
994 |
-
/**
|
995 |
-
* Public function - Insert JS code for spam tests
|
996 |
-
* return null;
|
997 |
-
*/
|
998 |
-
function apbct_rorm__formidable__footerScripts($fields, $form) {
|
999 |
-
|
1000 |
-
global $apbct, $ct_checkjs_frm;
|
1001 |
-
|
1002 |
-
if ( !$apbct->settings['contact_forms_test'])
|
1003 |
-
return false;
|
1004 |
-
|
1005 |
-
$ct_checkjs_key = ct_get_checkjs_value();
|
1006 |
-
$ct_frm_base_name = 'form_';
|
1007 |
-
$ct_frm_name = $ct_frm_base_name . $form->form_key;
|
1008 |
-
|
1009 |
-
echo "var input = document.createElement('input');
|
1010 |
-
input.setAttribute('type', 'hidden');
|
1011 |
-
input.setAttribute('name', '$ct_checkjs_frm');
|
1012 |
-
input.setAttribute('value', '$ct_checkjs_key');
|
1013 |
-
for (i = 0; i < document.forms.length; i++) {
|
1014 |
-
if (typeof document.forms[i].id == 'string'){
|
1015 |
-
if(document.forms[i].id.search('$ct_frm_name') != -1) {
|
1016 |
-
document.forms[i].appendChild(input);
|
1017 |
-
}
|
1018 |
-
}
|
1019 |
-
}";
|
1020 |
-
|
1021 |
-
/* Excessive cookie set
|
1022 |
-
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
1023 |
-
$js_code = strip_tags($js_code); // Removing <script> tag
|
1024 |
-
echo $js_code;
|
1025 |
-
//*/
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
/**
|
1029 |
-
* Public function - Test Formidable data for spam activity
|
1030 |
-
* @param $errors
|
1031 |
-
* @param $form
|
1032 |
-
*
|
1033 |
-
* @return array with errors if spam has found
|
1034 |
-
*/
|
1035 |
-
function apbct_rorm__formidable__testSpam ( $errors, $form ) {
|
1036 |
-
|
1037 |
-
global $apbct;
|
1038 |
-
|
1039 |
-
if ( !$apbct->settings['contact_forms_test']) {
|
1040 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1041 |
-
return $errors;
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
// Skip processing for logged in users.
|
1045 |
-
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
|
1046 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1047 |
-
return $errors;
|
1048 |
-
}
|
1049 |
-
|
1050 |
-
$ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
|
1051 |
-
|
1052 |
-
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
1053 |
-
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
1054 |
-
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
1055 |
-
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
1056 |
-
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
1057 |
-
|
1058 |
-
// Adding 'input_meta[]' to every field /Formidable fix/
|
1059 |
-
$message = array_flip($message);
|
1060 |
-
foreach($message as &$value){
|
1061 |
-
$value = 'item_meta['.$value.']';
|
1062 |
-
} unset($value);
|
1063 |
-
$message = array_flip($message);
|
1064 |
-
|
1065 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1066 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1067 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
1068 |
-
|
1069 |
-
$base_call_result = apbct_base_call(
|
1070 |
-
array(
|
1071 |
-
'message' => $message,
|
1072 |
-
'sender_email' => $sender_email,
|
1073 |
-
'sender_nickname' => $sender_nickname,
|
1074 |
-
'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
|
1075 |
-
'js_on' => $checkjs
|
1076 |
-
)
|
1077 |
-
);
|
1078 |
-
$ct_result = $base_call_result['ct_result'];
|
1079 |
-
|
1080 |
-
if ($ct_result->allow == 0) {
|
1081 |
-
$errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
return $errors;
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
/**
|
1088 |
-
* Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
|
1089 |
-
* @param mixed[] $comment Comment string
|
1090 |
-
* @return mixed[] $comment Comment string
|
1091 |
-
*/
|
1092 |
-
function ct_bbp_get_topic($topic){
|
1093 |
-
global $ct_bbp_topic;
|
1094 |
-
|
1095 |
-
$ct_bbp_topic=$topic;
|
1096 |
-
|
1097 |
-
return $topic;
|
1098 |
-
}
|
1099 |
-
|
1100 |
-
/**
|
1101 |
-
* Public filter 'bbp_*' - Checks topics, replies by cleantalk
|
1102 |
-
* @param mixed[] $comment Comment string
|
1103 |
-
* @return mixed[] $comment Comment string
|
1104 |
-
*/
|
1105 |
-
function ct_bbp_new_pre_content ($comment) {
|
1106 |
-
|
1107 |
-
global $apbct, $current_user;
|
1108 |
-
|
1109 |
-
if ( !$apbct->settings['comments_test']) {
|
1110 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1111 |
-
return $comment;
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
// Skip processing for logged in users and admin.
|
1115 |
-
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
|
1116 |
-
apbct_exclusions_check()
|
1117 |
-
) {
|
1118 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1119 |
-
return $comment;
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
|
1123 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1124 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1125 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
1126 |
-
|
1127 |
-
$post_info['comment_type'] = 'bbpress_comment';
|
1128 |
-
$post_info['post_url'] = bbp_get_topic_permalink();
|
1129 |
-
|
1130 |
-
if( is_user_logged_in() ) {
|
1131 |
-
$sender_email = $current_user->user_email;
|
1132 |
-
$sender_nickname = $current_user->display_name;
|
1133 |
-
} else {
|
1134 |
-
$sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
|
1135 |
-
$sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
|
1136 |
-
}
|
1137 |
-
|
1138 |
-
$base_call_result = apbct_base_call(
|
1139 |
-
array(
|
1140 |
-
'message' => $comment,
|
1141 |
-
'sender_email' => $sender_email,
|
1142 |
-
'sender_nickname' => $sender_nickname,
|
1143 |
-
'post_info' => $post_info,
|
1144 |
-
'js_on' => $checkjs,
|
1145 |
-
'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
|
1146 |
-
)
|
1147 |
-
);
|
1148 |
-
$ct_result = $base_call_result['ct_result'];
|
1149 |
-
|
1150 |
-
if ($ct_result->allow == 0) {
|
1151 |
-
bbp_add_error('bbp_reply_content', $ct_result->comment);
|
1152 |
-
}
|
1153 |
-
|
1154 |
-
return $comment;
|
1155 |
-
}
|
1156 |
-
|
1157 |
-
function apbct_comment__sanitize_data__before_wp_die($function){
|
1158 |
-
|
1159 |
-
global $apbct;
|
1160 |
-
|
1161 |
-
$comment_data = wp_unslash($_POST);
|
1162 |
-
|
1163 |
-
$user_ID = 0;
|
1164 |
-
|
1165 |
-
$comment_type = '';
|
1166 |
-
|
1167 |
-
$comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
|
1168 |
-
$comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
|
1169 |
-
|
1170 |
-
$comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
|
1171 |
-
$comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
|
1172 |
-
$comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
|
1173 |
-
$comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
|
1174 |
-
|
1175 |
-
if(isset($comment_content, $comment_parent)){
|
1176 |
-
|
1177 |
-
$user = function_exists('apbct_wp_get_current_user') ? apbct_wp_get_current_user() : null;
|
1178 |
-
|
1179 |
-
if($user && $user->exists()){
|
1180 |
-
$comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
|
1181 |
-
$comment_author_email = $user->user_email;
|
1182 |
-
$comment_author_url = $user->user_url;
|
1183 |
-
$user_ID = $user->ID;
|
1184 |
-
}
|
1185 |
-
|
1186 |
-
$apbct->comment_data = compact(
|
1187 |
-
'comment_post_ID',
|
1188 |
-
'comment_author',
|
1189 |
-
'comment_author_email',
|
1190 |
-
'comment_author_url',
|
1191 |
-
'comment_content',
|
1192 |
-
'comment_type',
|
1193 |
-
'comment_parent',
|
1194 |
-
'user_ID'
|
1195 |
-
);
|
1196 |
-
|
1197 |
-
$function = 'apbct_comment__check_via_wp_die';
|
1198 |
-
|
1199 |
-
}
|
1200 |
-
|
1201 |
-
return $function;
|
1202 |
-
}
|
1203 |
-
|
1204 |
-
function apbct_comment__check_via_wp_die($message, $title, $args){
|
1205 |
-
if($title == __('Comment Submission Failure')){
|
1206 |
-
global $apbct;
|
1207 |
-
$apbct->validation_error = $message;
|
1208 |
-
ct_preprocess_comment($apbct->comment_data);
|
1209 |
-
}
|
1210 |
-
_default_wp_die_handler($message, $title, $args);
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
/**
|
1214 |
-
* Public filter 'preprocess_comment' - Checks comment by cleantalk server
|
1215 |
-
* @param mixed[] $comment Comment data array
|
1216 |
-
* @return mixed[] New data array of comment
|
1217 |
-
*/
|
1218 |
-
function ct_preprocess_comment($comment) {
|
1219 |
-
// this action is called just when WP process POST request (adds new comment)
|
1220 |
-
// this action is called by wp-comments-post.php
|
1221 |
-
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
1222 |
-
global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
|
1223 |
-
|
1224 |
-
// Send email notification for chosen groups of users
|
1225 |
-
if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
|
1226 |
-
|
1227 |
-
add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
|
1228 |
-
|
1229 |
-
$users = get_users(array(
|
1230 |
-
'role__in' => $apbct->settings['comment_notify__roles'],
|
1231 |
-
'fileds' => array('user_email')
|
1232 |
-
));
|
1233 |
-
|
1234 |
-
if($users){
|
1235 |
-
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
|
1236 |
-
add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
|
1237 |
-
foreach($users as $user){
|
1238 |
-
$emails[] = $user->user_email;
|
1239 |
-
}
|
1240 |
-
$apbct->comment_notification_recipients = json_encode($emails);
|
1241 |
-
}
|
1242 |
-
}
|
1243 |
-
|
1244 |
-
// Skip processing admin.
|
1245 |
-
if (in_array("administrator", $current_user->roles)){
|
1246 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1247 |
-
return $comment;
|
1248 |
-
}
|
1249 |
-
|
1250 |
-
|
1251 |
-
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
|
1252 |
-
|
1253 |
-
if($apbct->settings['check_comments_number']){
|
1254 |
-
$args = array(
|
1255 |
-
'author_email' => $comment['comment_author_email'],
|
1256 |
-
'status' => 'approve',
|
1257 |
-
'count' => false,
|
1258 |
-
'number' => $comments_check_number,
|
1259 |
-
);
|
1260 |
-
$cnt = count(get_comments($args));
|
1261 |
-
$is_max_comments = $cnt >= $comments_check_number ? true : false;
|
1262 |
-
}
|
1263 |
-
|
1264 |
-
if (
|
1265 |
-
($comment['comment_type']!='trackback') &&
|
1266 |
-
(
|
1267 |
-
apbct_is_user_enable() === false ||
|
1268 |
-
$apbct->settings['comments_test'] == 0 ||
|
1269 |
-
$ct_comment_done ||
|
1270 |
-
(isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) ||
|
1271 |
-
(isset($is_max_comments) && $is_max_comments) ||
|
1272 |
-
(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)
|
1273 |
-
)
|
1274 |
-
)
|
1275 |
-
{
|
1276 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1277 |
-
return $comment;
|
1278 |
-
}
|
1279 |
-
|
1280 |
-
$local_blacklists = wp_blacklist_check(
|
1281 |
-
$comment['comment_author'],
|
1282 |
-
$comment['comment_author_email'],
|
1283 |
-
$comment['comment_author_url'],
|
1284 |
-
$comment['comment_content'],
|
1285 |
-
apbct_get_server_variable( 'REMOTE_ADDR' ),
|
1286 |
-
apbct_get_server_variable( 'HTTP_USER_AGENT' )
|
1287 |
-
);
|
1288 |
-
|
1289 |
-
// Go out if author in local blacklists
|
1290 |
-
if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
|
1291 |
-
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1292 |
-
return $comment;
|
1293 |
-
}
|
1294 |
-
|
1295 |
-
// Skip pingback anti-spam test
|
1296 |
-
/*if ($comment['comment_type'] == 'pingback') {
|
1297 |
-
return $comment;
|
1298 |
-
}*/
|
1299 |
-
|
1300 |
-
$ct_comment_done = true;
|
1301 |
-
|
1302 |
-
$comment_post_id = $comment['comment_post_ID'];
|
1303 |
-
|
1304 |
-
// JetPack comments logic
|
1305 |
-
$post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
|
1306 |
-
$post_info['post_url'] = ct_post_url(null, $comment_post_id);
|
1307 |
-
|
1308 |
-
// Comment type
|
1309 |
-
$post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
|
1310 |
-
|
1311 |
-
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1312 |
-
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1313 |
-
: apbct_js_test('ct_checkjs', $_POST);
|
1314 |
-
|
1315 |
-
|
1316 |
-
$example = null;
|
1317 |
-
if ($apbct->data['relevance_test']) {
|
1318 |
-
$post = get_post($comment_post_id);
|
1319 |
-
if ($post !== null){
|
1320 |
-
$example['title'] = $post->post_title;
|
1321 |
-
$example['body'] = $post->post_content;
|
1322 |
-
$example['comments'] = null;
|
1323 |
-
|
1324 |
-
$last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
|
1325 |
-
foreach ($last_comments as $post_comment){
|
1326 |
-
$example['comments'] .= "\n\n" . $post_comment->comment_content;
|
1327 |
-
}
|
1328 |
-
|
1329 |
-
$example = json_encode($example);
|
1330 |
-
}
|
1331 |
-
|
1332 |
-
// Use plain string format if've failed with JSON
|
1333 |
-
if ($example === false || $example === null){
|
1334 |
-
$example = ($post->post_title !== null) ? $post->post_title : '';
|
1335 |
-
$example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
|
1336 |
-
}
|
1337 |
-
}
|
1338 |
-
|
1339 |
-
$base_call_result = apbct_base_call(
|
1340 |
-
array(
|
1341 |
-
'message' => $comment['comment_content'],
|
1342 |
-
'example' => $example,
|
1343 |
-
'sender_email' => $comment['comment_author_email'],
|
1344 |
-
'sender_nickname' => $comment['comment_author'],
|
1345 |
-
'post_info' => $post_info,
|
1346 |
-
'js_on' => $checkjs,
|
1347 |
-
'sender_info' => array(
|
1348 |
-
'sender_url' => @$comment['comment_author_url'],
|
1349 |
-
'form_validation' => !isset($apbct->validation_error)
|
1350 |
-
? null
|
1351 |
-
: json_encode(array(
|
1352 |
-
'validation_notice' => $apbct->validation_error,
|
1353 |
-
'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
|
1354 |
-
))
|
1355 |
-
),
|
1356 |
-
)
|
1357 |
-
);
|
1358 |
-
$ct_result = $base_call_result['ct_result'];
|
1359 |
-
|
1360 |
-
ct_hash($ct_result->id);
|
1361 |
-
|
1362 |
-
//Don't check trusted users
|
1363 |
-
if (isset($comment['comment_author_email'])){
|
1364 |
-
$approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
|
1365 |
-
$new_user = $approved_comments == 0 ? true : false;
|
1366 |
-
}
|
1367 |
-
|
1368 |
-
// Change comment flow only for new authors
|
1369 |
-
if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
|
1370 |
-
add_action('comment_post', 'ct_set_meta', 10, 2);
|
1371 |
-
|
1372 |
-
if($ct_result->allow){ // Pass if allowed
|
1373 |
-
if(get_option('comment_moderation') === '1') // Wordpress moderation flag
|
1374 |
-
add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
|
1375 |
-
else
|
1376 |
-
add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
|
1377 |
-
// Modify the email notification
|
1378 |
-
add_filter('comment_notification_text', 'apbct_comment__wordpress__show_blacklists', 100, 2); // Add two blacklist links: by email and IP
|
1379 |
-
}else{
|
1380 |
-
|
1381 |
-
global $ct_comment, $ct_stop_words;
|
1382 |
-
|
1383 |
-
$ct_comment = $ct_result->comment;
|
1384 |
-
$ct_stop_words = $ct_result->stop_words;
|
1385 |
-
|
1386 |
-
$err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
|
1387 |
-
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1388 |
-
|
1389 |
-
// Terminate. Definitely spam.
|
1390 |
-
if($ct_result->stop_queue == 1)
|
1391 |
-
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1392 |
-
|
1393 |
-
// Terminate by user's setting.
|
1394 |
-
if($ct_result->spam == 3)
|
1395 |
-
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1396 |
-
|
1397 |
-
// Trash comment.
|
1398 |
-
if($ct_result->spam == 2){
|
1399 |
-
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1400 |
-
add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
|
1401 |
-
}
|
1402 |
-
|
1403 |
-
// Spam comment
|
1404 |
-
if($ct_result->spam == 1)
|
1405 |
-
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1406 |
-
|
1407 |
-
// Move to pending folder. Contains stop_words.
|
1408 |
-
if($ct_result->stop_words){
|
1409 |
-
add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
|
1410 |
-
add_action('comment_post', 'ct_mark_red', 998, 2);
|
1411 |
-
}
|
1412 |
-
|
1413 |
-
add_action('comment_post', 'ct_die', 999, 2);
|
1414 |
-
}
|
1415 |
-
|
1416 |
-
if($apbct->settings['remove_comments_links'] == 1){
|
1417 |
-
$comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
// Change mail notification if license is out of date
|
1421 |
-
if($apbct->data['moderate'] == 0){
|
1422 |
-
$apbct->sender_email = $comment['comment_author_email'];
|
1423 |
-
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
1424 |
-
add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
|
1425 |
-
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
|
1426 |
-
}
|
1427 |
-
|
1428 |
-
return $comment;
|
1429 |
-
}
|
1430 |
-
|
1431 |
-
/**
|
1432 |
-
* Changes whether notify admin/athor or not.
|
1433 |
-
*
|
1434 |
-
* @param bool $maybe_notify notify flag
|
1435 |
-
* @param int $comment_ID Comment id
|
1436 |
-
* @return bool flag
|
1437 |
-
*/
|
1438 |
-
function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
|
1439 |
-
return true;
|
1440 |
-
}
|
1441 |
-
|
1442 |
-
/**
|
1443 |
-
* Add notification setting link
|
1444 |
-
*
|
1445 |
-
* @param string $notify_message
|
1446 |
-
* @param integer $comment_id
|
1447 |
-
*
|
1448 |
-
* @return string
|
1449 |
-
*/
|
1450 |
-
function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
|
1451 |
-
return $notify_message
|
1452 |
-
.PHP_EOL
|
1453 |
-
.'---'.PHP_EOL
|
1454 |
-
.'Manage notifications settings: '.get_site_url().'/wp-admin/options-general.php?page=cleantalk';
|
1455 |
-
}
|
1456 |
-
|
1457 |
-
/**
|
1458 |
-
* Change email notification recipients
|
1459 |
-
*
|
1460 |
-
* @param array $emails
|
1461 |
-
* @param integer $comment_id
|
1462 |
-
*
|
1463 |
-
* @return array
|
1464 |
-
* @global SpbcState $apbct
|
1465 |
-
*/
|
1466 |
-
function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
|
1467 |
-
global $apbct;
|
1468 |
-
return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
|
1469 |
-
}
|
1470 |
-
|
1471 |
-
/**
|
1472 |
-
* Changes email notification for spam comment for native Wordpress comment system
|
1473 |
-
*
|
1474 |
-
* @param string $notify_message Body of email notification
|
1475 |
-
* @param int $comment_id Comment id
|
1476 |
-
* @return string Body for email notification
|
1477 |
-
*/
|
1478 |
-
function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
|
1479 |
-
|
1480 |
-
global $apbct;
|
1481 |
-
|
1482 |
-
$notify_message =
|
1483 |
-
PHP_EOL
|
1484 |
-
.__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk')
|
1485 |
-
."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
|
1486 |
-
."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
|
1487 |
-
."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
|
1488 |
-
."\n".PHP_EOL . sprintf(
|
1489 |
-
__('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
|
1490 |
-
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
|
1491 |
-
.($apbct->data['user_token']
|
1492 |
-
? '&iser_token='.$apbct->data['user_token']
|
1493 |
-
: ''
|
1494 |
-
)
|
1495 |
-
)
|
1496 |
-
.PHP_EOL . '---'
|
1497 |
-
.PHP_EOL
|
1498 |
-
.PHP_EOL
|
1499 |
-
.$notify_message;
|
1500 |
-
|
1501 |
-
return $notify_message;
|
1502 |
-
|
1503 |
-
}
|
1504 |
-
|
1505 |
-
function apbct_comment__wordpress__show_blacklists( $notify_message, $comment_id ) {
|
1506 |
-
|
1507 |
-
$comment_details = get_comments( array( 'comment__in' => $comment_id ) );
|
1508 |
-
$comment_details = $comment_details[0];
|
1509 |
-
|
1510 |
-
if( isset( $comment_details->comment_author_email ) ) {
|
1511 |
-
|
1512 |
-
$black_list_link = 'https://cleantalk.org/blacklists/';
|
1513 |
-
|
1514 |
-
$links = PHP_EOL;
|
1515 |
-
$links .= esc_html__( 'Check for spam:', 'cleantalk' );
|
1516 |
-
$links .= PHP_EOL;
|
1517 |
-
$links .= $black_list_link . $comment_details->comment_author_email;
|
1518 |
-
$links .= PHP_EOL;
|
1519 |
-
if( ! empty( $comment_details->comment_author_IP ) ) {
|
1520 |
-
$links .= $black_list_link . $comment_details->comment_author_IP;
|
1521 |
-
$links .= PHP_EOL;
|
1522 |
-
}
|
1523 |
-
|
1524 |
-
return $notify_message . $links;
|
1525 |
-
|
1526 |
-
}
|
1527 |
-
|
1528 |
-
return $notify_message;
|
1529 |
-
|
1530 |
-
}
|
1531 |
-
|
1532 |
-
/**
|
1533 |
-
* Set die page with Cleantalk comment.
|
1534 |
-
* @global array $ct_comment
|
1535 |
-
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1536 |
-
* @param type $comment_status
|
1537 |
-
*/
|
1538 |
-
function ct_die($comment_id, $comment_status) {
|
1539 |
-
|
1540 |
-
global $ct_comment;
|
1541 |
-
|
1542 |
-
$err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1543 |
-
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1544 |
-
if(isset($_POST['et_pb_contact_email']))
|
1545 |
-
{
|
1546 |
-
$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>';
|
1547 |
-
wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
|
1548 |
-
}
|
1549 |
-
else
|
1550 |
-
{
|
1551 |
-
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1552 |
-
}
|
1553 |
-
}
|
1554 |
-
|
1555 |
-
/**
|
1556 |
-
* Set die page with Cleantalk comment from parameter.
|
1557 |
-
* @param type $comment_body
|
1558 |
-
*/
|
1559 |
-
function ct_die_extended($comment_body) {
|
1560 |
-
|
1561 |
-
$err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
|
1562 |
-
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1563 |
-
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1564 |
-
}
|
1565 |
-
|
1566 |
-
/**
|
1567 |
-
* Validates JavaScript anti-spam test
|
1568 |
-
*
|
1569 |
-
* @param string $field_name filed to serach in data
|
1570 |
-
* @param null $data Data to search in
|
1571 |
-
* @param bool $random_key
|
1572 |
-
*
|
1573 |
-
* @return int|null
|
1574 |
-
*/
|
1575 |
-
function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
|
1576 |
-
|
1577 |
-
global $apbct;
|
1578 |
-
|
1579 |
-
$out = null;
|
1580 |
-
|
1581 |
-
if($data && isset($data[$field_name])){
|
1582 |
-
|
1583 |
-
$js_key = trim($data[$field_name]);
|
1584 |
-
|
1585 |
-
// Check static key
|
1586 |
-
if(
|
1587 |
-
$apbct->settings['use_static_js_key'] == 1 ||
|
1588 |
-
( $apbct->settings['use_static_js_key'] == - 1 &&
|
1589 |
-
( apbct_is_cache_plugins_exists() ||
|
1590 |
-
( apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1 )
|
1591 |
-
)
|
1592 |
-
)
|
1593 |
-
){
|
1594 |
-
$out = ct_get_checkjs_value() === $js_key ? 1 : 0;
|
1595 |
-
|
1596 |
-
// Random key check
|
1597 |
-
}else{
|
1598 |
-
$out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
|
1599 |
-
}
|
1600 |
-
}
|
1601 |
-
|
1602 |
-
return $out;
|
1603 |
-
}
|
1604 |
-
|
1605 |
-
/**
|
1606 |
-
* Get post url
|
1607 |
-
* @param int $comment_id
|
1608 |
-
* @param int $comment_post_id
|
1609 |
-
* @return string|bool
|
1610 |
-
*/
|
1611 |
-
function ct_post_url($comment_id = null, $comment_post_id) {
|
1612 |
-
|
1613 |
-
if (empty($comment_post_id))
|
1614 |
-
return null;
|
1615 |
-
|
1616 |
-
if ($comment_id === null) {
|
1617 |
-
$last_comment = get_comments('number=1');
|
1618 |
-
$comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
|
1619 |
-
}
|
1620 |
-
$permalink = get_permalink($comment_post_id);
|
1621 |
-
|
1622 |
-
$post_url = null;
|
1623 |
-
if ($permalink !== null)
|
1624 |
-
$post_url = $permalink . '#comment-' . $comment_id;
|
1625 |
-
|
1626 |
-
return $post_url;
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
/**
|
1630 |
-
* Public filter 'pre_comment_approved' - Mark comment unapproved always
|
1631 |
-
* @return int Zero
|
1632 |
-
*/
|
1633 |
-
function ct_set_not_approved() {
|
1634 |
-
return 0;
|
1635 |
-
}
|
1636 |
-
|
1637 |
-
/**
|
1638 |
-
* @author Artem Leontiev
|
1639 |
-
* Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
|
1640 |
-
* @return int 1
|
1641 |
-
*/
|
1642 |
-
function ct_set_approved($approved, $comment) {
|
1643 |
-
if ($approved == 'spam'){
|
1644 |
-
return $approved;
|
1645 |
-
} else {
|
1646 |
-
return 1;
|
1647 |
-
}
|
1648 |
-
}
|
1649 |
-
|
1650 |
-
/**
|
1651 |
-
* Public filter 'pre_comment_approved' - Mark comment unapproved always
|
1652 |
-
* @return int Zero
|
1653 |
-
*/
|
1654 |
-
function ct_set_comment_spam() {
|
1655 |
-
return 'spam';
|
1656 |
-
}
|
1657 |
-
|
1658 |
-
/**
|
1659 |
-
* Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
|
1660 |
-
* @param int $comment_id Comment ID
|
1661 |
-
* @param mixed $comment_status Approval status ("spam", or 0/1), not used
|
1662 |
-
*/
|
1663 |
-
function ct_set_meta($comment_id, $comment_status) {
|
1664 |
-
global $comment_post_id;
|
1665 |
-
$hash1 = ct_hash();
|
1666 |
-
if (!empty($hash1)) {
|
1667 |
-
update_comment_meta($comment_id, 'ct_hash', $hash1);
|
1668 |
-
if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
|
1669 |
-
$post_url = ct_post_url($comment_id, $comment_post_id);
|
1670 |
-
$post_url = base64_encode($post_url);
|
1671 |
-
if ($post_url === false)
|
1672 |
-
return false;
|
1673 |
-
// 01 - URL to approved comment
|
1674 |
-
$feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
|
1675 |
-
ct_send_feedback($feedback_request);
|
1676 |
-
}
|
1677 |
-
}
|
1678 |
-
return true;
|
1679 |
-
}
|
1680 |
-
|
1681 |
-
/**
|
1682 |
-
* Mark bad words
|
1683 |
-
* @global string $ct_stop_words
|
1684 |
-
* @param int $comment_id
|
1685 |
-
* @param int $comment_status Not use
|
1686 |
-
*/
|
1687 |
-
function ct_mark_red($comment_id, $comment_status) {
|
1688 |
-
global $ct_stop_words;
|
1689 |
-
|
1690 |
-
$comment = get_comment($comment_id, 'ARRAY_A');
|
1691 |
-
$message = $comment['comment_content'];
|
1692 |
-
foreach (explode(':', $ct_stop_words) as $word) {
|
1693 |
-
$message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
|
1694 |
-
|
1695 |
-
}
|
1696 |
-
$comment['comment_content'] = $message;
|
1697 |
-
kses_remove_filters();
|
1698 |
-
wp_update_comment($comment);
|
1699 |
-
}
|
1700 |
-
|
1701 |
-
//
|
1702 |
-
//Send post to trash
|
1703 |
-
//
|
1704 |
-
function ct_wp_trash_comment($comment_id, $comment_status){
|
1705 |
-
wp_trash_comment($comment_id);
|
1706 |
-
}
|
1707 |
-
|
1708 |
-
/**
|
1709 |
-
* Tests plugin activation status
|
1710 |
-
* @return bool
|
1711 |
-
*/
|
1712 |
-
function ct_plugin_active($plugin_name){
|
1713 |
-
foreach (get_option('active_plugins') as $k => $v) {
|
1714 |
-
if ($plugin_name == $v)
|
1715 |
-
return true;
|
1716 |
-
}
|
1717 |
-
return false;
|
1718 |
-
}
|
1719 |
-
|
1720 |
-
/**
|
1721 |
-
* Insert a hidden field to registration form
|
1722 |
-
* @return null
|
1723 |
-
*/
|
1724 |
-
function ct_register_form() {
|
1725 |
-
|
1726 |
-
global $ct_checkjs_register_form, $apbct;
|
1727 |
-
|
1728 |
-
if ($apbct->settings['registrations_test'] == 0) {
|
1729 |
-
return false;
|
1730 |
-
}
|
1731 |
-
|
1732 |
-
ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
|
1733 |
-
|
1734 |
-
return null;
|
1735 |
-
}
|
1736 |
-
|
1737 |
-
function apbct_login__scripts(){
|
1738 |
-
global $apbct;
|
1739 |
-
echo '<script src="'.APBCT_URL_PATH.'/js/apbct-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
*
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
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 |
-
* @param
|
1890 |
-
* @param null $
|
1891 |
-
*
|
1892 |
-
*
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
if
|
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 |
-
if
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
$apbct->
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
$_POST['FB_userdata']['
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
$
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
\Cleantalk\Antispam\Helper::apbct_cookie__set($
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
*
|
2031 |
-
*
|
2032 |
-
* @param
|
2033 |
-
* @param
|
2034 |
-
* @
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
.
|
2043 |
-
."\n" . '
|
2044 |
-
."\n" . '
|
2045 |
-
.
|
2046 |
-
|
2047 |
-
|
2048 |
-
.
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
.PHP_EOL
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
*
|
2064 |
-
*
|
2065 |
-
*
|
2066 |
-
*
|
2067 |
-
*
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
$sender_info['
|
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 |
-
$ct_comment
|
2226 |
-
|
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 |
-
$ct_comment
|
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 |
-
* @param type $
|
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 |
-
$param
|
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 |
-
if
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
$apbct->
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
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 |
-
.PHP_EOL . '
|
2422 |
-
.PHP_EOL . '
|
2423 |
-
.PHP_EOL .
|
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 |
-
if
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
$apbct->
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
add_action( '
|
2497 |
-
add_action( '
|
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 |
-
|
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 |
-
$ct_comment
|
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 |
-
.PHP_EOL . '
|
2603 |
-
.PHP_EOL . '
|
2604 |
-
.PHP_EOL .
|
2605 |
-
|
2606 |
-
'
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
*
|
2616 |
-
*
|
2617 |
-
* @
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
*
|
2631 |
-
*
|
2632 |
-
* @param
|
2633 |
-
*
|
2634 |
-
*
|
2635 |
-
* @
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
$true_key =
|
2645 |
-
$
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
*
|
2656 |
-
*
|
2657 |
-
*
|
2658 |
-
* @param array $
|
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 |
-
* @global
|
2686 |
-
* @
|
2687 |
-
* @
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
$apbct->settings['
|
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 |
-
if
|
2726 |
-
|
2727 |
-
|
2728 |
-
|
2729 |
-
$apbct->
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
|
2743 |
-
*
|
2744 |
-
*
|
2745 |
-
* @param
|
2746 |
-
* @
|
2747 |
-
|
2748 |
-
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
$message = str_replace('</
|
2754 |
-
$message
|
2755 |
-
|
2756 |
-
.
|
2757 |
-
.
|
2758 |
-
.PHP_EOL . '
|
2759 |
-
.PHP_EOL . '
|
2760 |
-
.PHP_EOL .
|
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 |
-
|
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 |
-
$ct_comment
|
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 |
-
$post_info =
|
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 |
-
exit
|
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 |
-
|
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 |
-
(isset($pagenow) && $pagenow == 'wp-login.php'
|
3257 |
-
|
3258 |
-
|
3259 |
-
(
|
3260 |
-
apbct_is_in_uri('wp-
|
3261 |
-
apbct_is_in_uri('wp-
|
3262 |
-
apbct_is_in_uri('
|
3263 |
-
apbct_is_in_uri('
|
3264 |
-
|
3265 |
-
|
3266 |
-
apbct_is_in_uri(
|
3267 |
-
apbct_is_in_uri( '/my-account/edit-
|
3268 |
-
(
|
3269 |
-
|
3270 |
-
|
3271 |
-
isset($
|
3272 |
-
|
3273 |
-
$
|
3274 |
-
|
3275 |
-
isset($_POST['
|
3276 |
-
isset($_POST['
|
3277 |
-
|
3278 |
-
|
3279 |
-
isset($_POST[
|
3280 |
-
isset($_POST['
|
3281 |
-
isset($
|
3282 |
-
|
3283 |
-
(isset($_POST['
|
3284 |
-
(
|
3285 |
-
(isset($_POST['
|
3286 |
-
|
3287 |
-
(
|
3288 |
-
|
3289 |
-
isset($_POST['
|
3290 |
-
|
3291 |
-
|
3292 |
-
(isset($_POST['
|
3293 |
-
(
|
3294 |
-
|
3295 |
-
|
3296 |
-
|
3297 |
-
(isset($_POST['
|
3298 |
-
(isset($_POST['action']) && $_POST['action'] == '
|
3299 |
-
|
3300 |
-
|
3301 |
-
(isset($
|
3302 |
-
|
3303 |
-
(
|
3304 |
-
(
|
3305 |
-
|
3306 |
-
apbct_is_in_uri('
|
3307 |
-
apbct_is_in_uri('?
|
3308 |
-
|
3309 |
-
(isset($_POST['
|
3310 |
-
isset($_POST['
|
3311 |
-
|
3312 |
-
isset($_POST['
|
3313 |
-
|
3314 |
-
(isset($_POST['action']) && $_POST['action'] == '
|
3315 |
-
(isset($_POST['
|
3316 |
-
|
3317 |
-
|
3318 |
-
(isset($_POST['
|
3319 |
-
(isset($_POST['
|
3320 |
-
apbct_is_in_uri('
|
3321 |
-
apbct_is_in_uri('
|
3322 |
-
apbct_is_in_uri('
|
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 |
-
|
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 |
-
|
3439 |
-
|
3440 |
-
|
3441 |
-
|
3442 |
-
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
3447 |
-
|
3448 |
-
|
3449 |
-
|
3450 |
-
|
3451 |
-
|
3452 |
-
|
3453 |
-
|
3454 |
-
|
3455 |
-
|
3456 |
-
|
3457 |
-
|
3458 |
-
|
3459 |
-
|
3460 |
-
|
3461 |
-
|
3462 |
-
|
3463 |
-
|
3464 |
-
|
3465 |
-
|
3466 |
-
|
3467 |
-
|
3468 |
-
|
3469 |
-
|
3470 |
-
|
3471 |
-
|
3472 |
-
|
3473 |
-
|
3474 |
-
|
3475 |
-
|
3476 |
-
|
3477 |
-
|
3478 |
-
|
3479 |
-
|
3480 |
-
|
3481 |
-
|
3482 |
-
$_GET['wc-ajax']=='
|
3483 |
-
$_GET['wc-ajax']=='
|
3484 |
-
$_GET['wc-ajax']=='
|
3485 |
-
$_GET['wc-ajax']=='
|
3486 |
-
$_GET['wc-ajax']=='
|
3487 |
-
$_GET['wc-ajax']=='
|
3488 |
-
$_GET['wc-ajax']=='
|
3489 |
-
$_GET['wc-ajax']=='
|
3490 |
-
$_GET['wc-ajax']=='
|
3491 |
-
|
3492 |
-
|
3493 |
-
|
3494 |
-
|
3495 |
-
apbct_is_in_uri('wp-
|
3496 |
-
|
3497 |
-
apbct_is_in_uri('
|
3498 |
-
|
3499 |
-
|
3500 |
-
|
3501 |
-
|
3502 |
-
$
|
3503 |
-
isset($_POST['
|
3504 |
-
|
3505 |
-
isset($_POST['
|
3506 |
-
isset($_POST['
|
3507 |
-
|
3508 |
-
|
3509 |
-
|
3510 |
-
(isset($_POST['
|
3511 |
-
(isset($
|
3512 |
-
|
3513 |
-
(isset($
|
3514 |
-
|
3515 |
-
isset($_POST['
|
3516 |
-
(isset($_POST['
|
3517 |
-
|
3518 |
-
|
3519 |
-
|
3520 |
-
|
3521 |
-
|
3522 |
-
|
3523 |
-
|
3524 |
-
|
3525 |
-
|
3526 |
-
|
3527 |
-
|
3528 |
-
|
3529 |
-
|
3530 |
-
|
3531 |
-
|
3532 |
-
|
3533 |
-
|
3534 |
-
|
3535 |
-
|
3536 |
-
'
|
3537 |
-
|
3538 |
-
|
3539 |
-
|
3540 |
-
|
3541 |
-
|
3542 |
-
|
3543 |
-
|
3544 |
-
|
3545 |
-
|
3546 |
-
|
3547 |
-
|
3548 |
-
|
3549 |
-
|
3550 |
-
|
3551 |
-
|
3552 |
-
|
3553 |
-
|
3554 |
-
$
|
3555 |
-
|
3556 |
-
|
3557 |
-
|
3558 |
-
|
3559 |
-
|
3560 |
-
|
3561 |
-
|
3562 |
-
|
3563 |
-
|
3564 |
-
|
3565 |
-
|
3566 |
-
|
3567 |
-
|
3568 |
-
|
3569 |
-
|
3570 |
-
|
3571 |
-
|
3572 |
-
|
3573 |
-
|
3574 |
-
}
|
3575 |
-
|
3576 |
-
|
3577 |
-
|
3578 |
-
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
3588 |
-
|
3589 |
-
|
3590 |
-
|
3591 |
-
|
3592 |
-
|
3593 |
-
|
3594 |
-
|
3595 |
-
|
3596 |
-
|
3597 |
-
|
3598 |
-
|
3599 |
-
|
3600 |
-
|
3601 |
-
|
3602 |
-
$
|
3603 |
-
|
3604 |
-
|
3605 |
-
|
3606 |
-
|
3607 |
-
|
3608 |
-
$
|
3609 |
-
$message
|
3610 |
-
|
3611 |
-
|
3612 |
-
|
3613 |
-
|
3614 |
-
|
3615 |
-
|
3616 |
-
|
3617 |
-
|
3618 |
-
|
3619 |
-
|
3620 |
-
|
3621 |
-
|
3622 |
-
|
3623 |
-
print '<textarea name="' . $
|
3624 |
-
}
|
3625 |
-
|
3626 |
-
|
3627 |
-
|
3628 |
-
|
3629 |
-
ct_print_form($value, $
|
3630 |
-
}
|
3631 |
-
|
3632 |
-
|
3633 |
-
}
|
3634 |
-
|
3635 |
-
|
3636 |
-
|
3637 |
-
|
3638 |
-
|
3639 |
-
|
3640 |
-
|
3641 |
-
|
3642 |
-
|
3643 |
-
|
3644 |
-
|
3645 |
-
|
3646 |
-
|
3647 |
-
|
3648 |
-
|
3649 |
-
|
3650 |
-
|
3651 |
-
|
3652 |
-
|
3653 |
-
|
3654 |
-
|
3655 |
-
|
3656 |
-
|
3657 |
-
|
3658 |
-
|
3659 |
-
|
3660 |
-
|
3661 |
-
|
3662 |
-
|
3663 |
-
|
3664 |
-
|
3665 |
-
|
3666 |
-
|
3667 |
-
|
3668 |
-
|
3669 |
-
|
3670 |
-
|
3671 |
-
|
3672 |
-
|
3673 |
-
|
3674 |
-
|
3675 |
-
|
3676 |
-
|
3677 |
-
|
3678 |
-
|
3679 |
-
|
3680 |
-
|
3681 |
-
|
3682 |
-
|
3683 |
-
|
3684 |
-
|
3685 |
-
'
|
3686 |
-
|
3687 |
-
|
3688 |
-
|
3689 |
-
|
3690 |
-
|
3691 |
-
|
3692 |
-
|
3693 |
-
|
3694 |
-
|
3695 |
-
|
3696 |
-
|
3697 |
-
|
3698 |
-
|
3699 |
-
|
3700 |
-
|
3701 |
-
|
3702 |
-
|
3703 |
-
|
3704 |
-
|
3705 |
-
|
3706 |
-
|
3707 |
-
|
3708 |
-
|
3709 |
-
|
3710 |
-
|
3711 |
-
|
3712 |
-
|
3713 |
-
|
3714 |
-
|
3715 |
-
'
|
3716 |
-
'
|
3717 |
-
|
3718 |
-
|
3719 |
-
|
3720 |
-
|
3721 |
-
|
3722 |
-
|
3723 |
-
|
3724 |
-
|
3725 |
-
|
3726 |
-
|
3727 |
-
|
3728 |
-
|
3729 |
-
|
3730 |
-
|
3731 |
-
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
|
3736 |
-
|
3737 |
-
|
3738 |
-
|
3739 |
-
|
3740 |
-
|
3741 |
-
|
3742 |
-
|
3743 |
-
|
3744 |
-
|
3745 |
-
|
3746 |
-
|
3747 |
-
|
3748 |
-
|
3749 |
-
}
|
3750 |
-
|
3751 |
-
|
3752 |
-
|
3753 |
-
|
3754 |
-
|
3755 |
-
|
3756 |
-
|
3757 |
-
|
3758 |
-
|
3759 |
-
|
3760 |
-
|
3761 |
-
|
3762 |
-
$
|
3763 |
-
|
3764 |
-
|
3765 |
-
|
3766 |
-
|
3767 |
-
|
3768 |
-
|
3769 |
-
|
3770 |
-
|
3771 |
-
|
3772 |
-
|
3773 |
-
|
3774 |
-
|
3775 |
-
|
3776 |
-
|
3777 |
-
|
3778 |
-
|
3779 |
-
|
3780 |
-
|
3781 |
-
|
3782 |
-
|
3783 |
-
|
3784 |
-
|
3785 |
-
|
3786 |
-
|
3787 |
-
|
3788 |
-
|
3789 |
-
|
3790 |
-
|
3791 |
-
|
3792 |
-
|
3793 |
-
echo
|
3794 |
-
|
3795 |
-
|
3796 |
-
|
3797 |
-
|
3798 |
-
|
3799 |
-
|
3800 |
-
|
3801 |
-
|
3802 |
-
|
3803 |
-
|
3804 |
-
|
3805 |
-
|
3806 |
-
|
3807 |
-
|
3808 |
-
|
3809 |
-
|
3810 |
-
|
3811 |
-
|
3812 |
-
|
3813 |
-
|
3814 |
-
|
3815 |
-
|
3816 |
-
|
3817 |
-
|
3818 |
-
|
3819 |
-
|
3820 |
-
|
3821 |
-
|
3822 |
-
|
3823 |
-
|
3824 |
-
if(isset($attrs['
|
3825 |
-
$out .= 'ctPublicGDPR.
|
3826 |
-
|
3827 |
-
$
|
3828 |
-
|
3829 |
-
|
3830 |
-
|
3831 |
-
|
3832 |
-
|
3833 |
-
|
3834 |
-
|
3835 |
-
*
|
3836 |
-
*
|
3837 |
-
*
|
3838 |
-
|
3839 |
-
|
3840 |
-
|
3841 |
-
|
3842 |
-
|
3843 |
-
|
3844 |
-
|
3845 |
-
|
|
|
|
|
|
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_post() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
|
40 |
+
|
41 |
+
if (defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') && is_string(CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL)) {
|
42 |
+
$catch_buffer = false;
|
43 |
+
$urls = explode(',', CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL);
|
44 |
+
foreach ($urls as $url) {
|
45 |
+
if (apbct_is_in_uri($url))
|
46 |
+
$catch_buffer = true;
|
47 |
+
}
|
48 |
+
}else{
|
49 |
+
$catch_buffer = true;
|
50 |
+
}
|
51 |
+
|
52 |
+
if( $catch_buffer ){
|
53 |
+
add_action('wp', 'apbct_buffer__start');
|
54 |
+
add_action('shutdown', 'apbct_buffer__end', 0);
|
55 |
+
add_action('shutdown', 'apbct_buffer__output', 2);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
// Check and redirecct
|
60 |
+
if( apbct_is_post()
|
61 |
+
&& isset($_POST['cleantalk_hidden_method'])
|
62 |
+
&& isset($_POST['cleantalk_hidden_action'])
|
63 |
+
){
|
64 |
+
$action = htmlspecialchars($_POST['cleantalk_hidden_action']);
|
65 |
+
$method = htmlspecialchars($_POST['cleantalk_hidden_method']);
|
66 |
+
unset($_POST['cleantalk_hidden_action']);
|
67 |
+
unset($_POST['cleantalk_hidden_method']);
|
68 |
+
ct_contact_form_validate();
|
69 |
+
if(!apbct_is_ajax()){
|
70 |
+
print "<html><body><form method='$method' action='$action'>";
|
71 |
+
ct_print_form($_POST, '');
|
72 |
+
print "</form></body></html>";
|
73 |
+
print "<script>
|
74 |
+
if(document.forms[0].submit !== 'undefined'){
|
75 |
+
var objects = document.getElementsByName('submit');
|
76 |
+
if(objects.length > 0)
|
77 |
+
document.forms[0].removeChild(objects[0]);
|
78 |
+
}
|
79 |
+
document.forms[0].submit();
|
80 |
+
</script>";
|
81 |
+
die();
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
|
87 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
88 |
+
ct_ajax_hook();
|
89 |
+
}
|
90 |
+
|
91 |
+
/**hooks for cm answers pro */
|
92 |
+
if(defined('CMA_PLUGIN_FILE')){
|
93 |
+
add_action( 'wp', 'ct_ajax_hook',1 );
|
94 |
+
}
|
95 |
+
|
96 |
+
//hook for Anonymous Post
|
97 |
+
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
98 |
+
add_action('wp', 'ct_contact_form_validate_postdata',1);
|
99 |
+
|
100 |
+
if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
|
101 |
+
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
102 |
+
//add_action('init','ct_contact_form_validate',1);
|
103 |
+
ct_contact_form_validate();
|
104 |
+
if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
|
105 |
+
{
|
106 |
+
unset($_POST['ct_checkjs_register_form']);
|
107 |
+
ct_contact_form_validate();
|
108 |
+
}
|
109 |
+
/*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
110 |
+
{
|
111 |
+
$tmp=$_POST['redirect_to'];
|
112 |
+
unset($_POST['redirect_to']);
|
113 |
+
ct_contact_form_validate();
|
114 |
+
$_POST['redirect_to']=$tmp;
|
115 |
+
}*/
|
116 |
+
}
|
117 |
+
|
118 |
+
if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
|
119 |
+
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
|
120 |
+
|
121 |
+
//add_action('wp_footer','ct_ajaxurl');
|
122 |
+
|
123 |
+
// Fast Secure contact form
|
124 |
+
if(defined('FSCF_VERSION')){
|
125 |
+
add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
|
126 |
+
add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
|
127 |
+
}
|
128 |
+
|
129 |
+
// WooCommerce registration
|
130 |
+
if(class_exists('WooCommerce')){
|
131 |
+
add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
|
132 |
+
if ($apbct->settings['wc_checkout_test'] == 1) {
|
133 |
+
add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
|
134 |
+
}
|
135 |
+
if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && $apbct->settings['wc_checkout_test'] == 0 && $apbct->settings['wc_register_from_order'] == 0 ){
|
136 |
+
remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
// WooCommerce whishlist
|
141 |
+
if(class_exists('WC_Wishlists_Wishlist'))
|
142 |
+
add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
|
143 |
+
|
144 |
+
|
145 |
+
// JetPack Contact form
|
146 |
+
$jetpack_active_modules = false;
|
147 |
+
if(defined('JETPACK__VERSION'))
|
148 |
+
{
|
149 |
+
if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
|
150 |
+
if(JETPACK__VERSION=='3.4-beta')
|
151 |
+
{
|
152 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
153 |
+
}
|
154 |
+
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
155 |
+
{
|
156 |
+
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
|
157 |
+
}
|
158 |
+
else
|
159 |
+
{
|
160 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
161 |
+
}
|
162 |
+
$jetpack_active_modules = get_option('jetpack_active_modules');
|
163 |
+
if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
|
164 |
+
{
|
165 |
+
$ct_jp_comments = true;
|
166 |
+
}
|
167 |
+
}else
|
168 |
+
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
169 |
+
}
|
170 |
+
|
171 |
+
// WP Maintenance Mode (wpmm)
|
172 |
+
add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
|
173 |
+
|
174 |
+
// Contact Form7
|
175 |
+
if(defined('WPCF7_VERSION')){
|
176 |
+
add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
|
177 |
+
add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
|
178 |
+
add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
|
179 |
+
}
|
180 |
+
|
181 |
+
// Formidable
|
182 |
+
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
183 |
+
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
184 |
+
|
185 |
+
// BuddyPress
|
186 |
+
if(class_exists('BuddyPress')){
|
187 |
+
add_action('bp_before_registration_submit_buttons','ct_register_form',1);
|
188 |
+
add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
|
189 |
+
add_filter('bp_signup_validate', 'ct_registration_errors',1);
|
190 |
+
add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
|
191 |
+
}
|
192 |
+
|
193 |
+
if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
|
194 |
+
add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
// bbPress
|
199 |
+
if(class_exists('bbPress')){
|
200 |
+
add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
|
201 |
+
add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
|
202 |
+
add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
|
203 |
+
add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
|
204 |
+
add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
|
205 |
+
}
|
206 |
+
|
207 |
+
//Custom Contact Forms
|
208 |
+
if(defined('CCF_VERSION'))
|
209 |
+
add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
|
210 |
+
|
211 |
+
add_action('comment_form', 'ct_comment_form');
|
212 |
+
|
213 |
+
// intercept WordPress Landing Pages POST
|
214 |
+
if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
|
215 |
+
if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
|
216 |
+
ct_check_wplp();
|
217 |
+
}else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
|
218 |
+
ct_check_wplp();
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
// S2member. intercept POST
|
223 |
+
if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
|
224 |
+
$post_keys = array_keys($_POST);
|
225 |
+
foreach($post_keys as $post_key){
|
226 |
+
|
227 |
+
// Detect POST keys like /s2member_pro.*registration/
|
228 |
+
if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
|
229 |
+
ct_s2member_registration_test($post_key);
|
230 |
+
break;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
// New user approve hack
|
236 |
+
// https://wordpress.org/plugins/new-user-approve/
|
237 |
+
if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
|
238 |
+
add_action('register_post', 'ct_register_post', 1, 3);
|
239 |
+
}
|
240 |
+
|
241 |
+
// Wilcity theme registration validation fix
|
242 |
+
add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
|
243 |
+
|
244 |
+
|
245 |
+
// Gravity forms
|
246 |
+
if (defined('GF_MIN_WP_VERSION')) {
|
247 |
+
add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
|
248 |
+
add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
|
249 |
+
add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
|
250 |
+
}
|
251 |
+
|
252 |
+
//Pirate forms
|
253 |
+
if(defined('PIRATE_FORMS_VERSION')){
|
254 |
+
if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
|
255 |
+
apbct_form__piratesForm__testSpam();
|
256 |
+
}
|
257 |
+
|
258 |
+
// WPForms
|
259 |
+
// Adding fields
|
260 |
+
add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
|
261 |
+
// Gathering data to validate
|
262 |
+
add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
|
263 |
+
// Do spam check
|
264 |
+
add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
|
265 |
+
|
266 |
+
// QForms integration
|
267 |
+
add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
|
268 |
+
|
269 |
+
// Ultimate Members
|
270 |
+
if (class_exists('UM')) {
|
271 |
+
add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
|
272 |
+
add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
|
273 |
+
}
|
274 |
+
|
275 |
+
// Paid Memberships Pro integration
|
276 |
+
add_filter( 'pmpro_required_user_fields', function( $pmpro_required_user_fields ){
|
277 |
+
|
278 |
+
if(
|
279 |
+
! empty( $pmpro_required_user_fields['username'] ) &&
|
280 |
+
! empty( $pmpro_required_user_fields['bemail'] ) &&
|
281 |
+
! empty( $pmpro_required_user_fields['bconfirmemail'] ) &&
|
282 |
+
$pmpro_required_user_fields['bemail'] == $pmpro_required_user_fields['bconfirmemail']
|
283 |
+
) {
|
284 |
+
$check = ct_test_registration( $pmpro_required_user_fields['username'], $pmpro_required_user_fields['bemail'], apbct_get_server_variable( 'REMOTE_ADDR' ) );
|
285 |
+
if( $check['allow'] == 0 ) {
|
286 |
+
pmpro_setMessage( $check['comment'], 'pmpro_error' );
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
return $pmpro_required_user_fields;
|
291 |
+
|
292 |
+
} );
|
293 |
+
|
294 |
+
//
|
295 |
+
// Load JS code to website footer
|
296 |
+
//
|
297 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
298 |
+
add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
|
299 |
+
add_action('wp_footer', 'apbct_hook__wp_footer', 1);
|
300 |
+
}
|
301 |
+
|
302 |
+
if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
|
303 |
+
ct_contact_form_validate();
|
304 |
+
}
|
305 |
+
|
306 |
+
if (apbct_is_user_enable()) {
|
307 |
+
|
308 |
+
if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
|
309 |
+
add_action( 'init', 'ct_contact_form_validate', 999 );
|
310 |
+
}
|
311 |
+
if( apbct_is_post() &&
|
312 |
+
$apbct->settings['general_postdata_test'] == 1 &&
|
313 |
+
!isset($_POST['ct_checkjs_cf7']) &&
|
314 |
+
!is_admin() &&
|
315 |
+
!apbct_is_user_role_in(array('administrator', 'moderator'))
|
316 |
+
){
|
317 |
+
ct_contact_form_validate_postdata();
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
function apbct_buffer__start(){
|
323 |
+
ob_start();
|
324 |
+
}
|
325 |
+
|
326 |
+
function apbct_buffer__end(){
|
327 |
+
|
328 |
+
if(!ob_get_level())
|
329 |
+
return;
|
330 |
+
|
331 |
+
global $apbct;
|
332 |
+
$apbct->buffer = ob_get_contents();
|
333 |
+
ob_end_clean();
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Outputs changed buffer
|
338 |
+
*
|
339 |
+
* @global $apbct
|
340 |
+
*/
|
341 |
+
function apbct_buffer__output(){
|
342 |
+
|
343 |
+
global $apbct, $wp;
|
344 |
+
|
345 |
+
if(empty($apbct->buffer))
|
346 |
+
return;
|
347 |
+
|
348 |
+
$site_url = get_option('siteurl');
|
349 |
+
$site__host = parse_url($site_url, PHP_URL_HOST);
|
350 |
+
|
351 |
+
$dom = new DOMDocument();
|
352 |
+
@$dom->loadHTML($apbct->buffer);
|
353 |
+
|
354 |
+
$forms = $dom->getElementsByTagName('form');
|
355 |
+
|
356 |
+
foreach($forms as $form){
|
357 |
+
|
358 |
+
$action = $form->getAttribute('action');
|
359 |
+
$action = $action ? $action : $site_url;
|
360 |
+
$action__host = parse_url($action, PHP_URL_HOST);
|
361 |
+
|
362 |
+
// Check if the form directed to the third party site
|
363 |
+
if($site__host != $action__host){
|
364 |
+
|
365 |
+
$method = $form->getAttribute('method');
|
366 |
+
$method = $method ? $method : 'get';
|
367 |
+
// Directs form to our site
|
368 |
+
$form->setAttribute('method', 'POST');
|
369 |
+
$form->setAttribute('action', home_url(add_query_arg(array(), $wp->request)));
|
370 |
+
|
371 |
+
// Add cleantalk_hidden_action
|
372 |
+
$new_input = $dom->createElement('input');
|
373 |
+
$new_input->setAttribute('type', 'hidden');
|
374 |
+
$new_input->setAttribute('name', 'cleantalk_hidden_action');
|
375 |
+
$new_input->setAttribute('value', $action);
|
376 |
+
$form->appendChild($new_input);
|
377 |
+
|
378 |
+
// Add cleantalk_hidden_method
|
379 |
+
$new_input = $dom->createElement('input');
|
380 |
+
$new_input->setAttribute('type', 'hidden');
|
381 |
+
$new_input->setAttribute('name', 'cleantalk_hidden_method');
|
382 |
+
$new_input->setAttribute('value', $method);
|
383 |
+
$form->appendChild($new_input);
|
384 |
+
|
385 |
+
}
|
386 |
+
|
387 |
+
} unset($form);
|
388 |
+
|
389 |
+
$html = $dom->getElementsByTagName('html');
|
390 |
+
|
391 |
+
$output = gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0])
|
392 |
+
? $dom->saveHTML()
|
393 |
+
: $apbct->buffer;
|
394 |
+
|
395 |
+
echo $output;
|
396 |
+
die();
|
397 |
+
}
|
398 |
+
|
399 |
+
// MailChimp Premium for Wordpress
|
400 |
+
function ct_add_mc4wp_error_message($messages){
|
401 |
+
|
402 |
+
$messages['ct_mc4wp_response'] = array(
|
403 |
+
'type' => 'error',
|
404 |
+
'text' => 'Your message looks like spam.'
|
405 |
+
);
|
406 |
+
return $messages;
|
407 |
+
}
|
408 |
+
add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
|
409 |
+
|
410 |
+
/*
|
411 |
+
* Function to set validate fucntion for CCF form
|
412 |
+
* Input - Сonsistently each form field
|
413 |
+
* Returns - String. Validate function
|
414 |
+
*/
|
415 |
+
function ct_ccf($callback, $value, $field_id, $type){
|
416 |
+
/*
|
417 |
+
if($type == 'name')
|
418 |
+
$ct_global_temporary_data['name'] = $value;
|
419 |
+
elseif($type == 'email')
|
420 |
+
$ct_global_temporary_data['email'] = $value;
|
421 |
+
else
|
422 |
+
$ct_global_temporary_data[] = $value;
|
423 |
+
//*/
|
424 |
+
return 'ct_validate_ccf_submission';
|
425 |
+
}
|
426 |
+
/*
|
427 |
+
* Validate function for CCF form. Gatheering data. Multiple calls.
|
428 |
+
* Input - void. Global $ct_global_temporary_data
|
429 |
+
* Returns - String. CleanTalk comment.
|
430 |
+
*/
|
431 |
+
$ct_global_temporary_data = array();
|
432 |
+
function ct_validate_ccf_submission($value, $field_id, $required){
|
433 |
+
global $ct_global_temporary_data, $apbct;
|
434 |
+
|
435 |
+
|
436 |
+
|
437 |
+
//If the check for contact forms enabled
|
438 |
+
if(!$apbct->settings['contact_forms_test']) {
|
439 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
440 |
+
return true;
|
441 |
+
}
|
442 |
+
|
443 |
+
//If the check for logged in users enabled
|
444 |
+
if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in()) {
|
445 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
446 |
+
return true;
|
447 |
+
}
|
448 |
+
|
449 |
+
|
450 |
+
//Accumulate data
|
451 |
+
$ct_global_temporary_data[] = $value;
|
452 |
+
|
453 |
+
//If it's the last field of the form
|
454 |
+
(!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
|
455 |
+
$form_id = $_POST['form_id'];
|
456 |
+
if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true ))) {
|
457 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
458 |
+
return true;
|
459 |
+
}
|
460 |
+
|
461 |
+
unset($ct_global_temporary_data['count']);
|
462 |
+
|
463 |
+
//Getting request params
|
464 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
465 |
+
|
466 |
+
unset($ct_global_temporary_data);
|
467 |
+
|
468 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
469 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
470 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
471 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
472 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
473 |
+
|
474 |
+
if ($subject != '')
|
475 |
+
$message['subject'] = $subject;
|
476 |
+
|
477 |
+
$post_info['comment_type'] = 'feedback_custom_contact_forms';
|
478 |
+
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
479 |
+
|
480 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
481 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
482 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
483 |
+
|
484 |
+
//Making a call
|
485 |
+
$base_call_result = apbct_base_call(
|
486 |
+
array(
|
487 |
+
'message' => $message,
|
488 |
+
'sender_email' => $sender_email,
|
489 |
+
'sender_nickname' => $sender_nickname,
|
490 |
+
'post_info' => $post_info,
|
491 |
+
'js_on' => $checkjs,
|
492 |
+
'sender_info' => array('sender_url' => null),
|
493 |
+
)
|
494 |
+
);
|
495 |
+
|
496 |
+
$ct_result = $base_call_result['ct_result'];
|
497 |
+
|
498 |
+
return $ct_result->allow == 0 ? $ct_result->comment : true;;
|
499 |
+
}
|
500 |
+
|
501 |
+
function ct_woocommerce_wishlist_check($args){
|
502 |
+
global $apbct;
|
503 |
+
|
504 |
+
|
505 |
+
|
506 |
+
//Protect logged in users
|
507 |
+
if($args['wishlist_status'])
|
508 |
+
if($apbct->settings['protect_logged_in'] == 0) {
|
509 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
510 |
+
return $args;
|
511 |
+
}
|
512 |
+
|
513 |
+
|
514 |
+
//If the IP is a Google bot
|
515 |
+
$hostname = gethostbyaddr( apbct_get_server_variable( 'REMOTE_ADDR' ) );
|
516 |
+
if(!strpos($hostname, 'googlebot.com')) {
|
517 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
518 |
+
return $args;
|
519 |
+
}
|
520 |
+
|
521 |
+
|
522 |
+
//Getting request params
|
523 |
+
$message = '';
|
524 |
+
$subject = '';
|
525 |
+
$email = $args['wishlist_owner_email'];
|
526 |
+
if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
|
527 |
+
$nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
|
528 |
+
else
|
529 |
+
$nickname = '';
|
530 |
+
|
531 |
+
$post_info['comment_type'] = 'feedback';
|
532 |
+
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
533 |
+
|
534 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
535 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
536 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
537 |
+
|
538 |
+
//Making a call
|
539 |
+
$base_call_result = apbct_base_call(
|
540 |
+
array(
|
541 |
+
'message' => $subject." ".$message,
|
542 |
+
'sender_email' => $email,
|
543 |
+
'sender_nickname' => $nickname,
|
544 |
+
'post_info' => $post_info,
|
545 |
+
'js_on' => $checkjs,
|
546 |
+
'sender_info' => array('sender_url' => null),
|
547 |
+
)
|
548 |
+
);
|
549 |
+
|
550 |
+
$ct_result = $base_call_result['ct_result'];
|
551 |
+
|
552 |
+
if ($ct_result->allow == 0)
|
553 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
554 |
+
else
|
555 |
+
return $args;
|
556 |
+
}
|
557 |
+
|
558 |
+
function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
|
559 |
+
global $apbct;
|
560 |
+
preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
|
561 |
+
$apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Test BuddyPress activity for spam (post update only)
|
566 |
+
*
|
567 |
+
* @global SpbcState $apbct
|
568 |
+
* @param bool $is_spam
|
569 |
+
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
570 |
+
* @return boolean Spam flag
|
571 |
+
*/
|
572 |
+
function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
|
573 |
+
|
574 |
+
global $apbct;
|
575 |
+
|
576 |
+
if( $activity_obj === null ||
|
577 |
+
!isset($_POST['action']) ||
|
578 |
+
$activity_obj->privacy == 'media' ||
|
579 |
+
( ! empty( $_POST['action'] ) && $_POST['action'] !== 'post_update' ) ||
|
580 |
+
apbct_exclusions_check()
|
581 |
+
) {
|
582 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
583 |
+
return false;
|
584 |
+
}
|
585 |
+
|
586 |
+
|
587 |
+
$curr_user = get_user_by('id', $activity_obj->user_id);
|
588 |
+
|
589 |
+
//Making a call
|
590 |
+
$base_call_result = apbct_base_call(
|
591 |
+
array(
|
592 |
+
'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
|
593 |
+
'sender_email' => $curr_user->data->user_email,
|
594 |
+
'sender_nickname' => $curr_user->data->user_login,
|
595 |
+
'post_info' => array(
|
596 |
+
'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
|
597 |
+
'comment_type' => 'buddypress_activitywall',
|
598 |
+
),
|
599 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
600 |
+
'sender_info' => array('sender_url' => null),
|
601 |
+
)
|
602 |
+
);
|
603 |
+
|
604 |
+
$ct_result = $base_call_result['ct_result'];
|
605 |
+
|
606 |
+
if ($ct_result->allow == 0){
|
607 |
+
add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
|
608 |
+
$apbct->spam_notification = $ct_result->comment;
|
609 |
+
return true;
|
610 |
+
}else
|
611 |
+
return $is_spam;
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Outputs message to AJAX frontend handler
|
616 |
+
*
|
617 |
+
* @global SpbcState $apbct
|
618 |
+
* @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
|
619 |
+
*/
|
620 |
+
function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
|
621 |
+
|
622 |
+
global $apbct;
|
623 |
+
|
624 |
+
// Legacy template
|
625 |
+
if($apbct->buddy_press_tmpl === 'bp-legacy'){
|
626 |
+
die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
|
627 |
+
// Nouveau tamplate and others
|
628 |
+
}else{
|
629 |
+
@header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
|
630 |
+
die(json_encode(array(
|
631 |
+
'success' => false,
|
632 |
+
'data' => array('message' => $apbct->spam_notification),
|
633 |
+
)));
|
634 |
+
}
|
635 |
+
}
|
636 |
+
|
637 |
+
/**
|
638 |
+
* Public function - Tests new private messages (dialogs)
|
639 |
+
*
|
640 |
+
* @global SpbcState $apbct
|
641 |
+
* @param type $bp_message_obj
|
642 |
+
* @return void|array with errors if spam has found
|
643 |
+
*/
|
644 |
+
function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
|
645 |
+
|
646 |
+
global $apbct;
|
647 |
+
|
648 |
+
//Check for enabled option
|
649 |
+
if(
|
650 |
+
$apbct->settings['bp_private_messages'] == 0 ||
|
651 |
+
apbct_exclusions_check()
|
652 |
+
) {
|
653 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
654 |
+
return;
|
655 |
+
}
|
656 |
+
|
657 |
+
|
658 |
+
//Check for quantity of comments
|
659 |
+
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
|
660 |
+
? CLEANTALK_CHECK_COMMENTS_NUMBER
|
661 |
+
: 3;
|
662 |
+
|
663 |
+
if($apbct->settings['check_comments_number']){
|
664 |
+
$args = array(
|
665 |
+
'user_id' => $bp_message_obj->sender_id,
|
666 |
+
'box' => 'sentbox',
|
667 |
+
'type' => 'all',
|
668 |
+
'limit' => $comments_check_number,
|
669 |
+
'page' => null,
|
670 |
+
'search_terms' => '',
|
671 |
+
'meta_query' => array()
|
672 |
+
);
|
673 |
+
$sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
674 |
+
$cnt_sentbox_msgs = $sentbox_msgs['total'];
|
675 |
+
$args['box'] = 'inbox';
|
676 |
+
$inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
|
677 |
+
$cnt_inbox_msgs = $inbox_msgs['total'];
|
678 |
+
|
679 |
+
if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
|
680 |
+
$is_max_comments = true;
|
681 |
+
}
|
682 |
+
|
683 |
+
if(!empty($is_max_comments)) {
|
684 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
685 |
+
return;
|
686 |
+
}
|
687 |
+
|
688 |
+
|
689 |
+
$sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
|
690 |
+
|
691 |
+
//Making a call
|
692 |
+
$base_call_result = apbct_base_call(
|
693 |
+
array(
|
694 |
+
'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
|
695 |
+
'sender_email' => $sender_user_obj->data->user_email,
|
696 |
+
'sender_nickname' => $sender_user_obj->data->user_login,
|
697 |
+
'post_info' => array(
|
698 |
+
'comment_type' => 'buddypress_comment',
|
699 |
+
'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
|
700 |
+
),
|
701 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
|
702 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
703 |
+
: apbct_js_test('ct_checkjs', $_POST),
|
704 |
+
'sender_info' => array('sender_url' => null),
|
705 |
+
)
|
706 |
+
);
|
707 |
+
|
708 |
+
$ct_result = $base_call_result['ct_result'];
|
709 |
+
|
710 |
+
if ($ct_result->allow == 0)
|
711 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
712 |
+
}
|
713 |
+
|
714 |
+
/**
|
715 |
+
* Adds hiden filed to deafualt serach form
|
716 |
+
*
|
717 |
+
* @param $form string
|
718 |
+
* @return string
|
719 |
+
*/
|
720 |
+
function apbct_forms__search__addField( $form ){
|
721 |
+
global $apbct;
|
722 |
+
if($apbct->settings['search_test'] == 1){
|
723 |
+
$js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
|
724 |
+
$form = str_replace('</form>', $js_filed, $form);
|
725 |
+
}
|
726 |
+
return $form;
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Test default search string for spam
|
731 |
+
*
|
732 |
+
* @param $search string
|
733 |
+
* @return string
|
734 |
+
*/
|
735 |
+
function apbct_forms__search__testSpam( $search ){
|
736 |
+
|
737 |
+
global $apbct, $cleantalk_executed;
|
738 |
+
|
739 |
+
if(
|
740 |
+
empty($search) ||
|
741 |
+
$cleantalk_executed ||
|
742 |
+
$apbct->settings['search_test'] == 0 ||
|
743 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
744 |
+
){
|
745 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
746 |
+
return $search;
|
747 |
+
}
|
748 |
+
|
749 |
+
if(apbct_is_user_logged_in())
|
750 |
+
$user = wp_get_current_user();
|
751 |
+
|
752 |
+
$base_call_result = apbct_base_call(
|
753 |
+
array(
|
754 |
+
'message' => $search,
|
755 |
+
'sender_email' => !empty($user) ? $user->user_email : null,
|
756 |
+
'sender_nickname' => !empty($user) ? $user->user_login : null,
|
757 |
+
'post_info' => array('comment_type' => 'site_search_wordpress'),
|
758 |
+
//'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
|
759 |
+
)
|
760 |
+
);
|
761 |
+
$ct_result = $base_call_result['ct_result'];
|
762 |
+
|
763 |
+
$cleantalk_executed = true;
|
764 |
+
|
765 |
+
if ($ct_result->allow == 0){
|
766 |
+
die($ct_result->comment);
|
767 |
+
}
|
768 |
+
|
769 |
+
return $search;
|
770 |
+
}
|
771 |
+
|
772 |
+
function apbct_search_add_noindex() {
|
773 |
+
|
774 |
+
global $apbct;
|
775 |
+
|
776 |
+
if(
|
777 |
+
! is_search() || // If it is search results
|
778 |
+
$apbct->settings['search_test'] == 0 ||
|
779 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
780 |
+
){
|
781 |
+
return ;
|
782 |
+
}
|
783 |
+
|
784 |
+
echo '<!-- meta by Cleantalk AntiSpam Protection plugin -->' . "\n";
|
785 |
+
echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
|
786 |
+
|
787 |
+
}
|
788 |
+
|
789 |
+
/**
|
790 |
+
* Test woocommerce checkout form for spam
|
791 |
+
*
|
792 |
+
*/
|
793 |
+
function ct_woocommerce_checkout_check() {
|
794 |
+
|
795 |
+
//Getting request params
|
796 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
797 |
+
|
798 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
799 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
800 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
801 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
802 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
803 |
+
|
804 |
+
if($subject != '')
|
805 |
+
$message = array_merge(array('subject' => $subject), $message);
|
806 |
+
|
807 |
+
$post_info['comment_type'] = 'order';
|
808 |
+
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
809 |
+
|
810 |
+
//Making a call
|
811 |
+
$base_call_result = apbct_base_call(
|
812 |
+
array(
|
813 |
+
'message' => $message,
|
814 |
+
'sender_email' => $sender_email,
|
815 |
+
'sender_nickname' => $sender_nickname,
|
816 |
+
'post_info' => $post_info,
|
817 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
818 |
+
'sender_info' => array('sender_url' => null),
|
819 |
+
)
|
820 |
+
);
|
821 |
+
|
822 |
+
$ct_result = $base_call_result['ct_result'];
|
823 |
+
|
824 |
+
if ($ct_result->allow == 0) {
|
825 |
+
wp_send_json(array(
|
826 |
+
'result' => 'failure',
|
827 |
+
'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
|
828 |
+
'refresh' => 'false',
|
829 |
+
'reload' => 'false'
|
830 |
+
));
|
831 |
+
}
|
832 |
+
}
|
833 |
+
|
834 |
+
/**
|
835 |
+
* Public function - Tests for Pirate contact froms
|
836 |
+
* return NULL
|
837 |
+
*/
|
838 |
+
function apbct_form__piratesForm__testSpam(){
|
839 |
+
|
840 |
+
global $apbct;
|
841 |
+
|
842 |
+
//Check for enabled option
|
843 |
+
if( !$apbct->settings['contact_forms_test']) {
|
844 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
845 |
+
return;
|
846 |
+
}
|
847 |
+
|
848 |
+
|
849 |
+
//Getting request params
|
850 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
851 |
+
|
852 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
853 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
854 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
855 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
856 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
857 |
+
|
858 |
+
if($subject != '')
|
859 |
+
$message = array_merge(array('subject' => $subject), $message);
|
860 |
+
|
861 |
+
$post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
|
862 |
+
$post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
|
863 |
+
|
864 |
+
//Making a call
|
865 |
+
$base_call_result = apbct_base_call(
|
866 |
+
array(
|
867 |
+
'message' => $message,
|
868 |
+
'sender_email' => $sender_email,
|
869 |
+
'sender_nickname' => $sender_nickname,
|
870 |
+
'post_info' => $post_info,
|
871 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
872 |
+
'sender_info' => array('sender_url' => null),
|
873 |
+
)
|
874 |
+
);
|
875 |
+
|
876 |
+
$ct_result = $base_call_result['ct_result'];
|
877 |
+
|
878 |
+
if ($ct_result->allow == 0)
|
879 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
880 |
+
}
|
881 |
+
|
882 |
+
/**
|
883 |
+
* Adds hidden filed to comment form
|
884 |
+
*/
|
885 |
+
function ct_comment_form($post_id){
|
886 |
+
|
887 |
+
global $apbct;
|
888 |
+
|
889 |
+
if (apbct_is_user_enable() === false) {
|
890 |
+
return false;
|
891 |
+
}
|
892 |
+
|
893 |
+
if ( !$apbct->settings['comments_test']) {
|
894 |
+
return false;
|
895 |
+
}
|
896 |
+
|
897 |
+
ct_add_hidden_fields('ct_checkjs', false, false);
|
898 |
+
|
899 |
+
return null;
|
900 |
+
}
|
901 |
+
|
902 |
+
/**
|
903 |
+
* Adds cookie script filed to head
|
904 |
+
*/
|
905 |
+
function apbct_hook__wp_head__set_cookie__ct_checkjs() {
|
906 |
+
|
907 |
+
ct_add_hidden_fields('ct_checkjs', false, true, true);
|
908 |
+
|
909 |
+
return null;
|
910 |
+
}
|
911 |
+
|
912 |
+
/**
|
913 |
+
* Adds cookie script filed to footer
|
914 |
+
*/
|
915 |
+
function apbct_hook__wp_footer() {
|
916 |
+
|
917 |
+
//ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
|
918 |
+
|
919 |
+
return null;
|
920 |
+
}
|
921 |
+
|
922 |
+
/**
|
923 |
+
* Adds hidden filed to define avaialbility of client's JavaScript
|
924 |
+
* @param bool $random_key switch on generation random key for every page load
|
925 |
+
*/
|
926 |
+
function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
|
927 |
+
|
928 |
+
global $ct_checkjs_def, $apbct;
|
929 |
+
|
930 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
931 |
+
$field_id_hash = md5(rand(0, 1000));
|
932 |
+
|
933 |
+
// Using only cookies
|
934 |
+
if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
|
935 |
+
|
936 |
+
$html = "<script type='text/javascript'>
|
937 |
+
function ctSetCookie(c_name, value, def_value){
|
938 |
+
document.cookie = c_name + '=' + escape(value) + '; path=/; samesite=lax';
|
939 |
+
}
|
940 |
+
ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
|
941 |
+
</script>";
|
942 |
+
|
943 |
+
// Using AJAX to get key
|
944 |
+
}elseif($apbct->settings['use_ajax'] && $ajax){
|
945 |
+
|
946 |
+
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
947 |
+
if($no_print)
|
948 |
+
return;
|
949 |
+
|
950 |
+
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
951 |
+
$field_id = $field_name . '_' . $field_id_hash;
|
952 |
+
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
953 |
+
<script type='text/javascript'>
|
954 |
+
window.addEventListener('load', function () {
|
955 |
+
setTimeout(function(){
|
956 |
+
apbct_sendAJAX(
|
957 |
+
{action: 'apbct_js_keys__get'},
|
958 |
+
{callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
|
959 |
+
);
|
960 |
+
}, 1000);
|
961 |
+
});
|
962 |
+
</script>";
|
963 |
+
|
964 |
+
// Set KEY from backend
|
965 |
+
}else{
|
966 |
+
// Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
|
967 |
+
if($no_print)
|
968 |
+
return;
|
969 |
+
|
970 |
+
$ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
|
971 |
+
$field_id = $field_name . '_' . $field_id_hash;
|
972 |
+
$html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
|
973 |
+
<script type='text/javascript'>
|
974 |
+
setTimeout(function(){
|
975 |
+
var ct_input_name = '{$field_id}';
|
976 |
+
if (document.getElementById(ct_input_name) !== null) {
|
977 |
+
var ct_input_value = document.getElementById(ct_input_name).value;
|
978 |
+
document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
|
979 |
+
}
|
980 |
+
}, 1000);
|
981 |
+
</script>";
|
982 |
+
}
|
983 |
+
|
984 |
+
// Simplify JS code and Fixing issue with wpautop()
|
985 |
+
$html = str_replace(array("\n","\r","\t"),'', $html);
|
986 |
+
|
987 |
+
if ($return_string === true) {
|
988 |
+
return $html;
|
989 |
+
} else {
|
990 |
+
echo $html;
|
991 |
+
}
|
992 |
+
}
|
993 |
+
|
994 |
+
/**
|
995 |
+
* Public function - Insert JS code for spam tests
|
996 |
+
* return null;
|
997 |
+
*/
|
998 |
+
function apbct_rorm__formidable__footerScripts($fields, $form) {
|
999 |
+
|
1000 |
+
global $apbct, $ct_checkjs_frm;
|
1001 |
+
|
1002 |
+
if ( !$apbct->settings['contact_forms_test'])
|
1003 |
+
return false;
|
1004 |
+
|
1005 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
1006 |
+
$ct_frm_base_name = 'form_';
|
1007 |
+
$ct_frm_name = $ct_frm_base_name . $form->form_key;
|
1008 |
+
|
1009 |
+
echo "var input = document.createElement('input');
|
1010 |
+
input.setAttribute('type', 'hidden');
|
1011 |
+
input.setAttribute('name', '$ct_checkjs_frm');
|
1012 |
+
input.setAttribute('value', '$ct_checkjs_key');
|
1013 |
+
for (i = 0; i < document.forms.length; i++) {
|
1014 |
+
if (typeof document.forms[i].id == 'string'){
|
1015 |
+
if(document.forms[i].id.search('$ct_frm_name') != -1) {
|
1016 |
+
document.forms[i].appendChild(input);
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
}";
|
1020 |
+
|
1021 |
+
/* Excessive cookie set
|
1022 |
+
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
1023 |
+
$js_code = strip_tags($js_code); // Removing <script> tag
|
1024 |
+
echo $js_code;
|
1025 |
+
//*/
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
/**
|
1029 |
+
* Public function - Test Formidable data for spam activity
|
1030 |
+
* @param $errors
|
1031 |
+
* @param $form
|
1032 |
+
*
|
1033 |
+
* @return array with errors if spam has found
|
1034 |
+
*/
|
1035 |
+
function apbct_rorm__formidable__testSpam ( $errors, $form ) {
|
1036 |
+
|
1037 |
+
global $apbct;
|
1038 |
+
|
1039 |
+
if ( !$apbct->settings['contact_forms_test']) {
|
1040 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1041 |
+
return $errors;
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
// Skip processing for logged in users.
|
1045 |
+
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
|
1046 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1047 |
+
return $errors;
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
|
1051 |
+
|
1052 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
1053 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
1054 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
1055 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
1056 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
1057 |
+
|
1058 |
+
// Adding 'input_meta[]' to every field /Formidable fix/
|
1059 |
+
$message = array_flip($message);
|
1060 |
+
foreach($message as &$value){
|
1061 |
+
$value = 'item_meta['.$value.']';
|
1062 |
+
} unset($value);
|
1063 |
+
$message = array_flip($message);
|
1064 |
+
|
1065 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1066 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1067 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
1068 |
+
|
1069 |
+
$base_call_result = apbct_base_call(
|
1070 |
+
array(
|
1071 |
+
'message' => $message,
|
1072 |
+
'sender_email' => $sender_email,
|
1073 |
+
'sender_nickname' => $sender_nickname,
|
1074 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
|
1075 |
+
'js_on' => $checkjs
|
1076 |
+
)
|
1077 |
+
);
|
1078 |
+
$ct_result = $base_call_result['ct_result'];
|
1079 |
+
|
1080 |
+
if ($ct_result->allow == 0) {
|
1081 |
+
$errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
return $errors;
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
/**
|
1088 |
+
* Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
|
1089 |
+
* @param mixed[] $comment Comment string
|
1090 |
+
* @return mixed[] $comment Comment string
|
1091 |
+
*/
|
1092 |
+
function ct_bbp_get_topic($topic){
|
1093 |
+
global $ct_bbp_topic;
|
1094 |
+
|
1095 |
+
$ct_bbp_topic=$topic;
|
1096 |
+
|
1097 |
+
return $topic;
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
/**
|
1101 |
+
* Public filter 'bbp_*' - Checks topics, replies by cleantalk
|
1102 |
+
* @param mixed[] $comment Comment string
|
1103 |
+
* @return mixed[] $comment Comment string
|
1104 |
+
*/
|
1105 |
+
function ct_bbp_new_pre_content ($comment) {
|
1106 |
+
|
1107 |
+
global $apbct, $current_user;
|
1108 |
+
|
1109 |
+
if ( !$apbct->settings['comments_test']) {
|
1110 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1111 |
+
return $comment;
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
// Skip processing for logged in users and admin.
|
1115 |
+
if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
|
1116 |
+
apbct_exclusions_check()
|
1117 |
+
) {
|
1118 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1119 |
+
return $comment;
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
|
1123 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1124 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1125 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
1126 |
+
|
1127 |
+
$post_info['comment_type'] = 'bbpress_comment';
|
1128 |
+
$post_info['post_url'] = bbp_get_topic_permalink();
|
1129 |
+
|
1130 |
+
if( is_user_logged_in() ) {
|
1131 |
+
$sender_email = $current_user->user_email;
|
1132 |
+
$sender_nickname = $current_user->display_name;
|
1133 |
+
} else {
|
1134 |
+
$sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
|
1135 |
+
$sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
$base_call_result = apbct_base_call(
|
1139 |
+
array(
|
1140 |
+
'message' => $comment,
|
1141 |
+
'sender_email' => $sender_email,
|
1142 |
+
'sender_nickname' => $sender_nickname,
|
1143 |
+
'post_info' => $post_info,
|
1144 |
+
'js_on' => $checkjs,
|
1145 |
+
'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
|
1146 |
+
)
|
1147 |
+
);
|
1148 |
+
$ct_result = $base_call_result['ct_result'];
|
1149 |
+
|
1150 |
+
if ($ct_result->allow == 0) {
|
1151 |
+
bbp_add_error('bbp_reply_content', $ct_result->comment);
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
return $comment;
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
function apbct_comment__sanitize_data__before_wp_die($function){
|
1158 |
+
|
1159 |
+
global $apbct;
|
1160 |
+
|
1161 |
+
$comment_data = wp_unslash($_POST);
|
1162 |
+
|
1163 |
+
$user_ID = 0;
|
1164 |
+
|
1165 |
+
$comment_type = '';
|
1166 |
+
|
1167 |
+
$comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
|
1168 |
+
$comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
|
1169 |
+
|
1170 |
+
$comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
|
1171 |
+
$comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
|
1172 |
+
$comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
|
1173 |
+
$comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
|
1174 |
+
|
1175 |
+
if(isset($comment_content, $comment_parent)){
|
1176 |
+
|
1177 |
+
$user = function_exists('apbct_wp_get_current_user') ? apbct_wp_get_current_user() : null;
|
1178 |
+
|
1179 |
+
if($user && $user->exists()){
|
1180 |
+
$comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
|
1181 |
+
$comment_author_email = $user->user_email;
|
1182 |
+
$comment_author_url = $user->user_url;
|
1183 |
+
$user_ID = $user->ID;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
$apbct->comment_data = compact(
|
1187 |
+
'comment_post_ID',
|
1188 |
+
'comment_author',
|
1189 |
+
'comment_author_email',
|
1190 |
+
'comment_author_url',
|
1191 |
+
'comment_content',
|
1192 |
+
'comment_type',
|
1193 |
+
'comment_parent',
|
1194 |
+
'user_ID'
|
1195 |
+
);
|
1196 |
+
|
1197 |
+
$function = 'apbct_comment__check_via_wp_die';
|
1198 |
+
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
return $function;
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
function apbct_comment__check_via_wp_die($message, $title, $args){
|
1205 |
+
if($title == __('Comment Submission Failure')){
|
1206 |
+
global $apbct;
|
1207 |
+
$apbct->validation_error = $message;
|
1208 |
+
ct_preprocess_comment($apbct->comment_data);
|
1209 |
+
}
|
1210 |
+
_default_wp_die_handler($message, $title, $args);
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
/**
|
1214 |
+
* Public filter 'preprocess_comment' - Checks comment by cleantalk server
|
1215 |
+
* @param mixed[] $comment Comment data array
|
1216 |
+
* @return mixed[] New data array of comment
|
1217 |
+
*/
|
1218 |
+
function ct_preprocess_comment($comment) {
|
1219 |
+
// this action is called just when WP process POST request (adds new comment)
|
1220 |
+
// this action is called by wp-comments-post.php
|
1221 |
+
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
1222 |
+
global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
|
1223 |
+
|
1224 |
+
// Send email notification for chosen groups of users
|
1225 |
+
if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
|
1226 |
+
|
1227 |
+
add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
|
1228 |
+
|
1229 |
+
$users = get_users(array(
|
1230 |
+
'role__in' => $apbct->settings['comment_notify__roles'],
|
1231 |
+
'fileds' => array('user_email')
|
1232 |
+
));
|
1233 |
+
|
1234 |
+
if($users){
|
1235 |
+
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
|
1236 |
+
add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
|
1237 |
+
foreach($users as $user){
|
1238 |
+
$emails[] = $user->user_email;
|
1239 |
+
}
|
1240 |
+
$apbct->comment_notification_recipients = json_encode($emails);
|
1241 |
+
}
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
// Skip processing admin.
|
1245 |
+
if (in_array("administrator", $current_user->roles)){
|
1246 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1247 |
+
return $comment;
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
|
1251 |
+
$comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
|
1252 |
+
|
1253 |
+
if($apbct->settings['check_comments_number']){
|
1254 |
+
$args = array(
|
1255 |
+
'author_email' => $comment['comment_author_email'],
|
1256 |
+
'status' => 'approve',
|
1257 |
+
'count' => false,
|
1258 |
+
'number' => $comments_check_number,
|
1259 |
+
);
|
1260 |
+
$cnt = count(get_comments($args));
|
1261 |
+
$is_max_comments = $cnt >= $comments_check_number ? true : false;
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
if (
|
1265 |
+
($comment['comment_type']!='trackback') &&
|
1266 |
+
(
|
1267 |
+
apbct_is_user_enable() === false ||
|
1268 |
+
$apbct->settings['comments_test'] == 0 ||
|
1269 |
+
$ct_comment_done ||
|
1270 |
+
(isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) ||
|
1271 |
+
(isset($is_max_comments) && $is_max_comments) ||
|
1272 |
+
(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)
|
1273 |
+
)
|
1274 |
+
)
|
1275 |
+
{
|
1276 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1277 |
+
return $comment;
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
$local_blacklists = wp_blacklist_check(
|
1281 |
+
$comment['comment_author'],
|
1282 |
+
$comment['comment_author_email'],
|
1283 |
+
$comment['comment_author_url'],
|
1284 |
+
$comment['comment_content'],
|
1285 |
+
apbct_get_server_variable( 'REMOTE_ADDR' ),
|
1286 |
+
apbct_get_server_variable( 'HTTP_USER_AGENT' )
|
1287 |
+
);
|
1288 |
+
|
1289 |
+
// Go out if author in local blacklists
|
1290 |
+
if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
|
1291 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1292 |
+
return $comment;
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
// Skip pingback anti-spam test
|
1296 |
+
/*if ($comment['comment_type'] == 'pingback') {
|
1297 |
+
return $comment;
|
1298 |
+
}*/
|
1299 |
+
|
1300 |
+
$ct_comment_done = true;
|
1301 |
+
|
1302 |
+
$comment_post_id = $comment['comment_post_ID'];
|
1303 |
+
|
1304 |
+
// JetPack comments logic
|
1305 |
+
$post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
|
1306 |
+
$post_info['post_url'] = ct_post_url(null, $comment_post_id);
|
1307 |
+
|
1308 |
+
// Comment type
|
1309 |
+
$post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
|
1310 |
+
|
1311 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
|
1312 |
+
? apbct_js_test('ct_checkjs', $_COOKIE)
|
1313 |
+
: apbct_js_test('ct_checkjs', $_POST);
|
1314 |
+
|
1315 |
+
|
1316 |
+
$example = null;
|
1317 |
+
if ($apbct->data['relevance_test']) {
|
1318 |
+
$post = get_post($comment_post_id);
|
1319 |
+
if ($post !== null){
|
1320 |
+
$example['title'] = $post->post_title;
|
1321 |
+
$example['body'] = $post->post_content;
|
1322 |
+
$example['comments'] = null;
|
1323 |
+
|
1324 |
+
$last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
|
1325 |
+
foreach ($last_comments as $post_comment){
|
1326 |
+
$example['comments'] .= "\n\n" . $post_comment->comment_content;
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
$example = json_encode($example);
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
// Use plain string format if've failed with JSON
|
1333 |
+
if ($example === false || $example === null){
|
1334 |
+
$example = ($post->post_title !== null) ? $post->post_title : '';
|
1335 |
+
$example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
|
1336 |
+
}
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
$base_call_result = apbct_base_call(
|
1340 |
+
array(
|
1341 |
+
'message' => $comment['comment_content'],
|
1342 |
+
'example' => $example,
|
1343 |
+
'sender_email' => $comment['comment_author_email'],
|
1344 |
+
'sender_nickname' => $comment['comment_author'],
|
1345 |
+
'post_info' => $post_info,
|
1346 |
+
'js_on' => $checkjs,
|
1347 |
+
'sender_info' => array(
|
1348 |
+
'sender_url' => @$comment['comment_author_url'],
|
1349 |
+
'form_validation' => !isset($apbct->validation_error)
|
1350 |
+
? null
|
1351 |
+
: json_encode(array(
|
1352 |
+
'validation_notice' => $apbct->validation_error,
|
1353 |
+
'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
|
1354 |
+
))
|
1355 |
+
),
|
1356 |
+
)
|
1357 |
+
);
|
1358 |
+
$ct_result = $base_call_result['ct_result'];
|
1359 |
+
|
1360 |
+
ct_hash($ct_result->id);
|
1361 |
+
|
1362 |
+
//Don't check trusted users
|
1363 |
+
if (isset($comment['comment_author_email'])){
|
1364 |
+
$approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
|
1365 |
+
$new_user = $approved_comments == 0 ? true : false;
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
// Change comment flow only for new authors
|
1369 |
+
if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
|
1370 |
+
add_action('comment_post', 'ct_set_meta', 10, 2);
|
1371 |
+
|
1372 |
+
if($ct_result->allow){ // Pass if allowed
|
1373 |
+
if(get_option('comment_moderation') === '1') // Wordpress moderation flag
|
1374 |
+
add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
|
1375 |
+
else
|
1376 |
+
add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
|
1377 |
+
// Modify the email notification
|
1378 |
+
add_filter('comment_notification_text', 'apbct_comment__wordpress__show_blacklists', 100, 2); // Add two blacklist links: by email and IP
|
1379 |
+
}else{
|
1380 |
+
|
1381 |
+
global $ct_comment, $ct_stop_words;
|
1382 |
+
|
1383 |
+
$ct_comment = $ct_result->comment;
|
1384 |
+
$ct_stop_words = $ct_result->stop_words;
|
1385 |
+
|
1386 |
+
$err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
|
1387 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1388 |
+
|
1389 |
+
// Terminate. Definitely spam.
|
1390 |
+
if($ct_result->stop_queue == 1)
|
1391 |
+
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1392 |
+
|
1393 |
+
// Terminate by user's setting.
|
1394 |
+
if($ct_result->spam == 3)
|
1395 |
+
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1396 |
+
|
1397 |
+
// Trash comment.
|
1398 |
+
if($ct_result->spam == 2){
|
1399 |
+
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1400 |
+
add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
|
1401 |
+
}
|
1402 |
+
|
1403 |
+
// Spam comment
|
1404 |
+
if($ct_result->spam == 1)
|
1405 |
+
add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
|
1406 |
+
|
1407 |
+
// Move to pending folder. Contains stop_words.
|
1408 |
+
if($ct_result->stop_words){
|
1409 |
+
add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
|
1410 |
+
add_action('comment_post', 'ct_mark_red', 998, 2);
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
add_action('comment_post', 'ct_die', 999, 2);
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
if($apbct->settings['remove_comments_links'] == 1){
|
1417 |
+
$comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
// Change mail notification if license is out of date
|
1421 |
+
if($apbct->data['moderate'] == 0){
|
1422 |
+
$apbct->sender_email = $comment['comment_author_email'];
|
1423 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
1424 |
+
add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
|
1425 |
+
add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
return $comment;
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
/**
|
1432 |
+
* Changes whether notify admin/athor or not.
|
1433 |
+
*
|
1434 |
+
* @param bool $maybe_notify notify flag
|
1435 |
+
* @param int $comment_ID Comment id
|
1436 |
+
* @return bool flag
|
1437 |
+
*/
|
1438 |
+
function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
|
1439 |
+
return true;
|
1440 |
+
}
|
1441 |
+
|
1442 |
+
/**
|
1443 |
+
* Add notification setting link
|
1444 |
+
*
|
1445 |
+
* @param string $notify_message
|
1446 |
+
* @param integer $comment_id
|
1447 |
+
*
|
1448 |
+
* @return string
|
1449 |
+
*/
|
1450 |
+
function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
|
1451 |
+
return $notify_message
|
1452 |
+
.PHP_EOL
|
1453 |
+
.'---'.PHP_EOL
|
1454 |
+
.'Manage notifications settings: '.get_site_url().'/wp-admin/options-general.php?page=cleantalk';
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
/**
|
1458 |
+
* Change email notification recipients
|
1459 |
+
*
|
1460 |
+
* @param array $emails
|
1461 |
+
* @param integer $comment_id
|
1462 |
+
*
|
1463 |
+
* @return array
|
1464 |
+
* @global SpbcState $apbct
|
1465 |
+
*/
|
1466 |
+
function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
|
1467 |
+
global $apbct;
|
1468 |
+
return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
|
1469 |
+
}
|
1470 |
+
|
1471 |
+
/**
|
1472 |
+
* Changes email notification for spam comment for native Wordpress comment system
|
1473 |
+
*
|
1474 |
+
* @param string $notify_message Body of email notification
|
1475 |
+
* @param int $comment_id Comment id
|
1476 |
+
* @return string Body for email notification
|
1477 |
+
*/
|
1478 |
+
function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
|
1479 |
+
|
1480 |
+
global $apbct;
|
1481 |
+
|
1482 |
+
$notify_message =
|
1483 |
+
PHP_EOL
|
1484 |
+
.__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk')
|
1485 |
+
."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
|
1486 |
+
."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
|
1487 |
+
."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
|
1488 |
+
."\n".PHP_EOL . sprintf(
|
1489 |
+
__('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
|
1490 |
+
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
|
1491 |
+
.($apbct->data['user_token']
|
1492 |
+
? '&iser_token='.$apbct->data['user_token']
|
1493 |
+
: ''
|
1494 |
+
)
|
1495 |
+
)
|
1496 |
+
.PHP_EOL . '---'
|
1497 |
+
.PHP_EOL
|
1498 |
+
.PHP_EOL
|
1499 |
+
.$notify_message;
|
1500 |
+
|
1501 |
+
return $notify_message;
|
1502 |
+
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
function apbct_comment__wordpress__show_blacklists( $notify_message, $comment_id ) {
|
1506 |
+
|
1507 |
+
$comment_details = get_comments( array( 'comment__in' => $comment_id ) );
|
1508 |
+
$comment_details = $comment_details[0];
|
1509 |
+
|
1510 |
+
if( isset( $comment_details->comment_author_email ) ) {
|
1511 |
+
|
1512 |
+
$black_list_link = 'https://cleantalk.org/blacklists/';
|
1513 |
+
|
1514 |
+
$links = PHP_EOL;
|
1515 |
+
$links .= esc_html__( 'Check for spam:', 'cleantalk' );
|
1516 |
+
$links .= PHP_EOL;
|
1517 |
+
$links .= $black_list_link . $comment_details->comment_author_email;
|
1518 |
+
$links .= PHP_EOL;
|
1519 |
+
if( ! empty( $comment_details->comment_author_IP ) ) {
|
1520 |
+
$links .= $black_list_link . $comment_details->comment_author_IP;
|
1521 |
+
$links .= PHP_EOL;
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
return $notify_message . $links;
|
1525 |
+
|
1526 |
+
}
|
1527 |
+
|
1528 |
+
return $notify_message;
|
1529 |
+
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
/**
|
1533 |
+
* Set die page with Cleantalk comment.
|
1534 |
+
* @global array $ct_comment
|
1535 |
+
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1536 |
+
* @param type $comment_status
|
1537 |
+
*/
|
1538 |
+
function ct_die($comment_id, $comment_status) {
|
1539 |
+
|
1540 |
+
global $ct_comment;
|
1541 |
+
|
1542 |
+
$err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
|
1543 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1544 |
+
if(isset($_POST['et_pb_contact_email']))
|
1545 |
+
{
|
1546 |
+
$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>';
|
1547 |
+
wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
|
1548 |
+
}
|
1549 |
+
else
|
1550 |
+
{
|
1551 |
+
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1552 |
+
}
|
1553 |
+
}
|
1554 |
+
|
1555 |
+
/**
|
1556 |
+
* Set die page with Cleantalk comment from parameter.
|
1557 |
+
* @param type $comment_body
|
1558 |
+
*/
|
1559 |
+
function ct_die_extended($comment_body) {
|
1560 |
+
|
1561 |
+
$err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
|
1562 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
1563 |
+
wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
/**
|
1567 |
+
* Validates JavaScript anti-spam test
|
1568 |
+
*
|
1569 |
+
* @param string $field_name filed to serach in data
|
1570 |
+
* @param null $data Data to search in
|
1571 |
+
* @param bool $random_key
|
1572 |
+
*
|
1573 |
+
* @return int|null
|
1574 |
+
*/
|
1575 |
+
function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
|
1576 |
+
|
1577 |
+
global $apbct;
|
1578 |
+
|
1579 |
+
$out = null;
|
1580 |
+
|
1581 |
+
if($data && isset($data[$field_name])){
|
1582 |
+
|
1583 |
+
$js_key = trim($data[$field_name]);
|
1584 |
+
|
1585 |
+
// Check static key
|
1586 |
+
if(
|
1587 |
+
$apbct->settings['use_static_js_key'] == 1 ||
|
1588 |
+
( $apbct->settings['use_static_js_key'] == - 1 &&
|
1589 |
+
( apbct_is_cache_plugins_exists() ||
|
1590 |
+
( apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1 )
|
1591 |
+
)
|
1592 |
+
)
|
1593 |
+
){
|
1594 |
+
$out = ct_get_checkjs_value() === $js_key ? 1 : 0;
|
1595 |
+
|
1596 |
+
// Random key check
|
1597 |
+
}else{
|
1598 |
+
$out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
|
1599 |
+
}
|
1600 |
+
}
|
1601 |
+
|
1602 |
+
return $out;
|
1603 |
+
}
|
1604 |
+
|
1605 |
+
/**
|
1606 |
+
* Get post url
|
1607 |
+
* @param int $comment_id
|
1608 |
+
* @param int $comment_post_id
|
1609 |
+
* @return string|bool
|
1610 |
+
*/
|
1611 |
+
function ct_post_url($comment_id = null, $comment_post_id) {
|
1612 |
+
|
1613 |
+
if (empty($comment_post_id))
|
1614 |
+
return null;
|
1615 |
+
|
1616 |
+
if ($comment_id === null) {
|
1617 |
+
$last_comment = get_comments('number=1');
|
1618 |
+
$comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
|
1619 |
+
}
|
1620 |
+
$permalink = get_permalink($comment_post_id);
|
1621 |
+
|
1622 |
+
$post_url = null;
|
1623 |
+
if ($permalink !== null)
|
1624 |
+
$post_url = $permalink . '#comment-' . $comment_id;
|
1625 |
+
|
1626 |
+
return $post_url;
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
/**
|
1630 |
+
* Public filter 'pre_comment_approved' - Mark comment unapproved always
|
1631 |
+
* @return int Zero
|
1632 |
+
*/
|
1633 |
+
function ct_set_not_approved() {
|
1634 |
+
return 0;
|
1635 |
+
}
|
1636 |
+
|
1637 |
+
/**
|
1638 |
+
* @author Artem Leontiev
|
1639 |
+
* Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
|
1640 |
+
* @return int 1
|
1641 |
+
*/
|
1642 |
+
function ct_set_approved($approved, $comment) {
|
1643 |
+
if ($approved == 'spam'){
|
1644 |
+
return $approved;
|
1645 |
+
} else {
|
1646 |
+
return 1;
|
1647 |
+
}
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
/**
|
1651 |
+
* Public filter 'pre_comment_approved' - Mark comment unapproved always
|
1652 |
+
* @return int Zero
|
1653 |
+
*/
|
1654 |
+
function ct_set_comment_spam() {
|
1655 |
+
return 'spam';
|
1656 |
+
}
|
1657 |
+
|
1658 |
+
/**
|
1659 |
+
* Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
|
1660 |
+
* @param int $comment_id Comment ID
|
1661 |
+
* @param mixed $comment_status Approval status ("spam", or 0/1), not used
|
1662 |
+
*/
|
1663 |
+
function ct_set_meta($comment_id, $comment_status) {
|
1664 |
+
global $comment_post_id;
|
1665 |
+
$hash1 = ct_hash();
|
1666 |
+
if (!empty($hash1)) {
|
1667 |
+
update_comment_meta($comment_id, 'ct_hash', $hash1);
|
1668 |
+
if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
|
1669 |
+
$post_url = ct_post_url($comment_id, $comment_post_id);
|
1670 |
+
$post_url = base64_encode($post_url);
|
1671 |
+
if ($post_url === false)
|
1672 |
+
return false;
|
1673 |
+
// 01 - URL to approved comment
|
1674 |
+
$feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
|
1675 |
+
ct_send_feedback($feedback_request);
|
1676 |
+
}
|
1677 |
+
}
|
1678 |
+
return true;
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
/**
|
1682 |
+
* Mark bad words
|
1683 |
+
* @global string $ct_stop_words
|
1684 |
+
* @param int $comment_id
|
1685 |
+
* @param int $comment_status Not use
|
1686 |
+
*/
|
1687 |
+
function ct_mark_red($comment_id, $comment_status) {
|
1688 |
+
global $ct_stop_words;
|
1689 |
+
|
1690 |
+
$comment = get_comment($comment_id, 'ARRAY_A');
|
1691 |
+
$message = $comment['comment_content'];
|
1692 |
+
foreach (explode(':', $ct_stop_words) as $word) {
|
1693 |
+
$message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
|
1694 |
+
|
1695 |
+
}
|
1696 |
+
$comment['comment_content'] = $message;
|
1697 |
+
kses_remove_filters();
|
1698 |
+
wp_update_comment($comment);
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
//
|
1702 |
+
//Send post to trash
|
1703 |
+
//
|
1704 |
+
function ct_wp_trash_comment($comment_id, $comment_status){
|
1705 |
+
wp_trash_comment($comment_id);
|
1706 |
+
}
|
1707 |
+
|
1708 |
+
/**
|
1709 |
+
* Tests plugin activation status
|
1710 |
+
* @return bool
|
1711 |
+
*/
|
1712 |
+
function ct_plugin_active($plugin_name){
|
1713 |
+
foreach (get_option('active_plugins') as $k => $v) {
|
1714 |
+
if ($plugin_name == $v)
|
1715 |
+
return true;
|
1716 |
+
}
|
1717 |
+
return false;
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
/**
|
1721 |
+
* Insert a hidden field to registration form
|
1722 |
+
* @return null
|
1723 |
+
*/
|
1724 |
+
function ct_register_form() {
|
1725 |
+
|
1726 |
+
global $ct_checkjs_register_form, $apbct;
|
1727 |
+
|
1728 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
1729 |
+
return false;
|
1730 |
+
}
|
1731 |
+
|
1732 |
+
ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
|
1733 |
+
|
1734 |
+
return null;
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
function apbct_login__scripts(){
|
1738 |
+
global $apbct;
|
1739 |
+
echo '<script src="'.APBCT_URL_PATH.'/js/apbct-common.min.js"></script>';
|
1740 |
+
echo '<script src="'.APBCT_URL_PATH.'/js/apbct-public.min.js"></script>';
|
1741 |
+
$apbct->public_script_loaded = true;
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
/**
|
1745 |
+
* Adds notification text to login form - to inform about approved registration
|
1746 |
+
* @return null
|
1747 |
+
*/
|
1748 |
+
function ct_login_message($message) {
|
1749 |
+
|
1750 |
+
global $errors, $apbct, $apbct_cookie_register_ok_label;
|
1751 |
+
|
1752 |
+
|
1753 |
+
|
1754 |
+
if ($apbct->settings['registrations_test'] != 0){
|
1755 |
+
if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
|
1756 |
+
if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
|
1757 |
+
if(is_wp_error($errors)){
|
1758 |
+
$errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
|
1759 |
+
}
|
1760 |
+
}
|
1761 |
+
}
|
1762 |
+
}
|
1763 |
+
return $message;
|
1764 |
+
}
|
1765 |
+
|
1766 |
+
/**
|
1767 |
+
* Test users registration for pPress
|
1768 |
+
* @return array with errors
|
1769 |
+
*/
|
1770 |
+
function ct_registration_errors_ppress($reg_errors, $form_id) {
|
1771 |
+
|
1772 |
+
$email = $_POST['reg_email'];
|
1773 |
+
$login = $_POST['reg_username'];
|
1774 |
+
|
1775 |
+
$reg_errors = ct_registration_errors($reg_errors, $login, $email);
|
1776 |
+
|
1777 |
+
return $reg_errors;
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
/**
|
1781 |
+
* Test users registration for multisite enviroment
|
1782 |
+
* @return array with errors
|
1783 |
+
*/
|
1784 |
+
function ct_registration_errors_wpmu($errors) {
|
1785 |
+
global $ct_signup_done;
|
1786 |
+
|
1787 |
+
//
|
1788 |
+
// Multisite actions
|
1789 |
+
//
|
1790 |
+
$sanitized_user_login = null;
|
1791 |
+
if (isset($errors['user_name'])) {
|
1792 |
+
$sanitized_user_login = $errors['user_name'];
|
1793 |
+
$wpmu = true;
|
1794 |
+
}
|
1795 |
+
$user_email = null;
|
1796 |
+
if (isset($errors['user_email'])) {
|
1797 |
+
$user_email = $errors['user_email'];
|
1798 |
+
$wpmu = true;
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
|
1802 |
+
return $errors;
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
$errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
|
1806 |
+
|
1807 |
+
// Show CleanTalk errors in user_name field
|
1808 |
+
if (isset($errors['errors']->errors['ct_error'])) {
|
1809 |
+
$errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
|
1810 |
+
unset($errors['errors']->errors['ct_error']);
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
return $errors;
|
1814 |
+
}
|
1815 |
+
|
1816 |
+
/**
|
1817 |
+
* Shell for action register_post
|
1818 |
+
* @return array with errors
|
1819 |
+
*/
|
1820 |
+
function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
|
1821 |
+
return ct_registration_errors($errors, $sanitized_user_login, $user_email);
|
1822 |
+
}
|
1823 |
+
|
1824 |
+
/**
|
1825 |
+
* Check messages for external plugins
|
1826 |
+
* @return array with checking result;
|
1827 |
+
*/
|
1828 |
+
|
1829 |
+
function ct_test_message($nickname, $email, $ip, $text){
|
1830 |
+
|
1831 |
+
$base_call_result = apbct_base_call(
|
1832 |
+
array(
|
1833 |
+
'message' => $text,
|
1834 |
+
'sender_email' => $email,
|
1835 |
+
'sender_nickname' => $nickname,
|
1836 |
+
'post_info' => array('comment_type' => 'feedback_plugin_check'),
|
1837 |
+
'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
|
1838 |
+
)
|
1839 |
+
);
|
1840 |
+
|
1841 |
+
$ct_result = $base_call_result['ct_result'];
|
1842 |
+
|
1843 |
+
$result=Array(
|
1844 |
+
'allow' => $ct_result->allow,
|
1845 |
+
'comment' => $ct_result->comment,
|
1846 |
+
);
|
1847 |
+
return $result;
|
1848 |
+
}
|
1849 |
+
|
1850 |
+
/**
|
1851 |
+
* Check registrations for external plugins
|
1852 |
+
* @return array with checking result;
|
1853 |
+
*/
|
1854 |
+
function ct_test_registration($nickname, $email, $ip){
|
1855 |
+
|
1856 |
+
global $ct_checkjs_register_form, $apbct;
|
1857 |
+
|
1858 |
+
if(apbct_js_test($ct_checkjs_register_form, $_POST)){
|
1859 |
+
$checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
|
1860 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
1861 |
+
}else{
|
1862 |
+
$checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
1863 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
1864 |
+
}
|
1865 |
+
|
1866 |
+
//Making a call
|
1867 |
+
$base_call_result = apbct_base_call(
|
1868 |
+
array(
|
1869 |
+
'sender_ip' => $ip,
|
1870 |
+
'sender_email' => $email,
|
1871 |
+
'sender_nickname' => $nickname,
|
1872 |
+
'sender_info' => $sender_info,
|
1873 |
+
'js_on' => $checkjs,
|
1874 |
+
),
|
1875 |
+
true
|
1876 |
+
);
|
1877 |
+
$ct_result = $base_call_result['ct_result'];
|
1878 |
+
|
1879 |
+
$result = array(
|
1880 |
+
'allow' => $ct_result->allow,
|
1881 |
+
'comment' => $ct_result->comment,
|
1882 |
+
);
|
1883 |
+
return $result;
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
/**
|
1887 |
+
* Test users registration
|
1888 |
+
*
|
1889 |
+
* @param $errors
|
1890 |
+
* @param null $sanitized_user_login
|
1891 |
+
* @param null $user_email
|
1892 |
+
*
|
1893 |
+
* @return void with errors
|
1894 |
+
*/
|
1895 |
+
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1896 |
+
|
1897 |
+
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;
|
1898 |
+
|
1899 |
+
// Go out if a registrered user action
|
1900 |
+
if (apbct_is_user_enable() === false) {
|
1901 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1902 |
+
return $errors;
|
1903 |
+
}
|
1904 |
+
|
1905 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
1906 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1907 |
+
return $errors;
|
1908 |
+
}
|
1909 |
+
|
1910 |
+
// The function already executed
|
1911 |
+
// It happens when used ct_register_post();
|
1912 |
+
if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
|
1913 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1914 |
+
return $errors;
|
1915 |
+
}
|
1916 |
+
|
1917 |
+
// Facebook registration
|
1918 |
+
if ($sanitized_user_login === null && isset($_POST['FB_userdata'])){
|
1919 |
+
$sanitized_user_login = $_POST['FB_userdata']['name'];
|
1920 |
+
$facebook = true;
|
1921 |
+
}
|
1922 |
+
if ($user_email === null && isset($_POST['FB_userdata'])){
|
1923 |
+
$user_email = $_POST['FB_userdata']['email'];
|
1924 |
+
$facebook = true;
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
// BuddyPress actions
|
1928 |
+
$buddypress = false;
|
1929 |
+
if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
|
1930 |
+
$sanitized_user_login = $_POST['signup_username'];
|
1931 |
+
$buddypress = true;
|
1932 |
+
}
|
1933 |
+
if ($user_email === null && isset($_POST['signup_email'])) {
|
1934 |
+
$user_email = $_POST['signup_email'];
|
1935 |
+
$buddypress = true;
|
1936 |
+
}
|
1937 |
+
|
1938 |
+
//
|
1939 |
+
// Break tests because we already have servers response
|
1940 |
+
//
|
1941 |
+
if ($buddypress && $ct_signup_done) {
|
1942 |
+
if ($ct_negative_comment) {
|
1943 |
+
$bp->signup->errors['signup_username'] = $ct_negative_comment;
|
1944 |
+
}
|
1945 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
1946 |
+
return $errors;
|
1947 |
+
}
|
1948 |
+
|
1949 |
+
|
1950 |
+
if(current_filter() == 'woocommerce_registration_errors'){
|
1951 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
1952 |
+
$checkjs_post = null;
|
1953 |
+
$checkjs_cookie = $checkjs;
|
1954 |
+
}else{
|
1955 |
+
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
1956 |
+
$checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
|
1957 |
+
$checkjs_cookie = apbct_js_test('ct_checkjs', $_COOKIE);
|
1958 |
+
$checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
$sender_info = array(
|
1962 |
+
'post_checkjs_passed' => $checkjs_post,
|
1963 |
+
'cookie_checkjs_passed' => $checkjs_cookie,
|
1964 |
+
'form_validation' => ! empty( $errors )
|
1965 |
+
? json_encode( array(
|
1966 |
+
'validation_notice' => $errors->get_error_message(),
|
1967 |
+
'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
|
1968 |
+
) )
|
1969 |
+
: null,
|
1970 |
+
);
|
1971 |
+
|
1972 |
+
$base_call_result = apbct_base_call(
|
1973 |
+
array(
|
1974 |
+
'sender_email' => $user_email,
|
1975 |
+
'sender_nickname' => $sanitized_user_login,
|
1976 |
+
'sender_info' => $sender_info,
|
1977 |
+
'js_on' => $checkjs,
|
1978 |
+
),
|
1979 |
+
true
|
1980 |
+
);
|
1981 |
+
$ct_result = $base_call_result['ct_result'];
|
1982 |
+
|
1983 |
+
// Change mail notification if license is out of date
|
1984 |
+
if($apbct->data['moderate'] == 0 &&
|
1985 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
1986 |
+
){
|
1987 |
+
$apbct->sender_email = $user_email;
|
1988 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
1989 |
+
add_filter('wp_new_user_notification_email_admin', 'apbct_registration__Wordpress__changeMailNotification', 100, 3);
|
1990 |
+
}
|
1991 |
+
|
1992 |
+
$ct_signup_done = true;
|
1993 |
+
|
1994 |
+
$ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
|
1995 |
+
|
1996 |
+
$cleantalk_executed = true;
|
1997 |
+
|
1998 |
+
if ($ct_result->inactive != 0) {
|
1999 |
+
ct_send_error_notice($ct_result->comment);
|
2000 |
+
return $errors;
|
2001 |
+
}
|
2002 |
+
|
2003 |
+
if ($ct_result->allow == 0) {
|
2004 |
+
|
2005 |
+
if ($buddypress === true) {
|
2006 |
+
$bp->signup->errors['signup_username'] = $ct_result->comment;
|
2007 |
+
}elseif(!empty($facebook)){
|
2008 |
+
$_POST['FB_userdata']['email'] = '';
|
2009 |
+
$_POST['FB_userdata']['name'] = '';
|
2010 |
+
return;
|
2011 |
+
}else{
|
2012 |
+
if(is_wp_error($errors))
|
2013 |
+
$errors->add('ct_error', $ct_result->comment);
|
2014 |
+
$ct_negative_comment = $ct_result->comment;
|
2015 |
+
}
|
2016 |
+
|
2017 |
+
$ct_registration_error_comment = $ct_result->comment;
|
2018 |
+
|
2019 |
+
} else {
|
2020 |
+
if ($ct_result->id !== null) {
|
2021 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
|
2022 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
|
2023 |
+
}
|
2024 |
+
}
|
2025 |
+
|
2026 |
+
return $errors;
|
2027 |
+
}
|
2028 |
+
|
2029 |
+
/**
|
2030 |
+
* Changes email notification for newly registred user
|
2031 |
+
*
|
2032 |
+
* @param string $wp_new_user_notification_email_admin Body of email notification
|
2033 |
+
* @param array $user User inof
|
2034 |
+
* @param string $blogname Blog name
|
2035 |
+
* @return string Body for email notification
|
2036 |
+
*/
|
2037 |
+
function apbct_registration__Wordpress__changeMailNotification($wp_new_user_notification_email_admin, $user, $blogname){
|
2038 |
+
|
2039 |
+
global $apbct;
|
2040 |
+
|
2041 |
+
$wp_new_user_notification_email_admin['message'] = PHP_EOL
|
2042 |
+
.__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk')
|
2043 |
+
."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2044 |
+
."\n" . 'IP: ' . $apbct->sender_ip
|
2045 |
+
."\n" . 'Email: ' . $apbct->sender_email
|
2046 |
+
.PHP_EOL . PHP_EOL .
|
2047 |
+
__('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
|
2048 |
+
.'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
|
2049 |
+
.($apbct->data['user_token']
|
2050 |
+
? '&iser_token='.$apbct->data['user_token']
|
2051 |
+
: ''
|
2052 |
+
)
|
2053 |
+
.PHP_EOL . '---'
|
2054 |
+
.PHP_EOL
|
2055 |
+
.$wp_new_user_notification_email_admin['message'];
|
2056 |
+
|
2057 |
+
return $wp_new_user_notification_email_admin;
|
2058 |
+
|
2059 |
+
|
2060 |
+
}
|
2061 |
+
|
2062 |
+
/**
|
2063 |
+
* Checks Ultimate Members registration for spam
|
2064 |
+
*
|
2065 |
+
* @param $args forms arguments with names and values
|
2066 |
+
*
|
2067 |
+
* @return mixed
|
2068 |
+
*
|
2069 |
+
*/
|
2070 |
+
function apbct_registration__UltimateMembers__check( $args ){
|
2071 |
+
|
2072 |
+
if ( isset( UM()->form()->errors ) ) {
|
2073 |
+
$sender_info['previous_form_validation'] = true;
|
2074 |
+
$sender_info['validation_notice'] = json_encode( UM()->form()->errors );
|
2075 |
+
}
|
2076 |
+
|
2077 |
+
global $apbct, $cleantalk_executed;
|
2078 |
+
|
2079 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
2080 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2081 |
+
return $args;
|
2082 |
+
}
|
2083 |
+
|
2084 |
+
|
2085 |
+
$checkjs = apbct_js_test('ct_checkjs_register_form', $args);
|
2086 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
2087 |
+
|
2088 |
+
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
2089 |
+
if ($checkjs == 0) {
|
2090 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
2091 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
2092 |
+
}
|
2093 |
+
|
2094 |
+
$base_call_result = apbct_base_call(
|
2095 |
+
array(
|
2096 |
+
'sender_email' => $args['user_email'],
|
2097 |
+
'sender_nickname' => $args['user_login'],
|
2098 |
+
'sender_info' => $sender_info,
|
2099 |
+
'js_on' => $checkjs,
|
2100 |
+
),
|
2101 |
+
true
|
2102 |
+
);
|
2103 |
+
$ct_result = $base_call_result['ct_result'];
|
2104 |
+
|
2105 |
+
$cleantalk_executed = true;
|
2106 |
+
|
2107 |
+
if ($ct_result->inactive != 0) {
|
2108 |
+
ct_send_error_notice($ct_result->comment);
|
2109 |
+
return $args;
|
2110 |
+
}
|
2111 |
+
|
2112 |
+
if ($ct_result->allow == 0)
|
2113 |
+
UM()->form()->add_error('user_password', $ct_result->comment );
|
2114 |
+
|
2115 |
+
return $args;
|
2116 |
+
}
|
2117 |
+
|
2118 |
+
/**
|
2119 |
+
* Checks registration error and set it if it was dropped
|
2120 |
+
* @return errors
|
2121 |
+
*/
|
2122 |
+
function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
|
2123 |
+
global $bp, $ct_registration_error_comment;
|
2124 |
+
|
2125 |
+
if($ct_registration_error_comment){
|
2126 |
+
|
2127 |
+
if(isset($bp))
|
2128 |
+
if(method_exists($bp, 'signup'))
|
2129 |
+
if(method_exists($bp->signup, 'errors'))
|
2130 |
+
if(isset($bp->signup->errors['signup_username']))
|
2131 |
+
if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
|
2132 |
+
$bp->signup->errors['signup_username'] = $ct_registration_error_comment;
|
2133 |
+
|
2134 |
+
if(isset($errors))
|
2135 |
+
if(method_exists($errors, 'errors'))
|
2136 |
+
if(isset($errors->errors['ct_error']))
|
2137 |
+
if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
|
2138 |
+
$errors->add('ct_error', $ct_registration_error_comment);
|
2139 |
+
|
2140 |
+
}
|
2141 |
+
return $errors;
|
2142 |
+
}
|
2143 |
+
|
2144 |
+
/**
|
2145 |
+
* Set user meta (ct_hash) for successed registration
|
2146 |
+
* @return null
|
2147 |
+
*/
|
2148 |
+
function apbct_user_register($user_id) {
|
2149 |
+
global $apbct_cookie_request_id_label;
|
2150 |
+
if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
|
2151 |
+
if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
|
2152 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set($apbct_cookie_request_id_label, '0', 1, '/');
|
2153 |
+
}
|
2154 |
+
}
|
2155 |
+
}
|
2156 |
+
|
2157 |
+
|
2158 |
+
/**
|
2159 |
+
* Test for JetPack contact form
|
2160 |
+
*/
|
2161 |
+
function ct_grunion_contact_form_field_html($r, $field_label) {
|
2162 |
+
|
2163 |
+
global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $apbct;
|
2164 |
+
|
2165 |
+
if ($apbct->settings['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match( "/(text|email)/i", $r)) {
|
2166 |
+
|
2167 |
+
// Looking for element name prefix
|
2168 |
+
$name_patched = false;
|
2169 |
+
foreach ($ct_jpcf_fields as $v) {
|
2170 |
+
if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
|
2171 |
+
$ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
|
2172 |
+
$name_patched = true;
|
2173 |
+
}
|
2174 |
+
}
|
2175 |
+
|
2176 |
+
$r .= ct_add_hidden_fields($ct_checkjs_jpcf, true);
|
2177 |
+
$ct_jpcf_patched = true;
|
2178 |
+
}
|
2179 |
+
|
2180 |
+
return $r;
|
2181 |
+
}
|
2182 |
+
/**
|
2183 |
+
* Test for JetPack contact form
|
2184 |
+
*/
|
2185 |
+
function ct_contact_form_is_spam($form) {
|
2186 |
+
|
2187 |
+
global $ct_checkjs_jpcf, $apbct;
|
2188 |
+
|
2189 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2190 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2191 |
+
return null;
|
2192 |
+
}
|
2193 |
+
|
2194 |
+
$js_field_name = $ct_checkjs_jpcf;
|
2195 |
+
foreach ($_POST as $k => $v) {
|
2196 |
+
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
2197 |
+
$js_field_name = $k;
|
2198 |
+
}
|
2199 |
+
|
2200 |
+
$sender_email = null;
|
2201 |
+
$sender_nickname = null;
|
2202 |
+
$message = '';
|
2203 |
+
if (isset($form['comment_author_email']))
|
2204 |
+
$sender_email = $form['comment_author_email'];
|
2205 |
+
|
2206 |
+
if (isset($form['comment_author']))
|
2207 |
+
$sender_nickname = $form['comment_author'];
|
2208 |
+
|
2209 |
+
if (isset($form['comment_content']))
|
2210 |
+
$message = $form['comment_content'];
|
2211 |
+
|
2212 |
+
$base_call_result = apbct_base_call(
|
2213 |
+
array(
|
2214 |
+
'message' => $message,
|
2215 |
+
'sender_email' => $sender_email,
|
2216 |
+
'sender_nickname' => $sender_nickname,
|
2217 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
|
2218 |
+
'sender_info' => array('sender_url' => @$form['comment_author_url']),
|
2219 |
+
'js_on' => apbct_js_test($js_field_name, $_POST),
|
2220 |
+
)
|
2221 |
+
);
|
2222 |
+
$ct_result = $base_call_result['ct_result'];
|
2223 |
+
|
2224 |
+
if ($ct_result->allow == 0) {
|
2225 |
+
global $ct_comment;
|
2226 |
+
$ct_comment = $ct_result->comment;
|
2227 |
+
ct_die(null, null);
|
2228 |
+
exit;
|
2229 |
+
}
|
2230 |
+
|
2231 |
+
return (bool) !$ct_result->allow;
|
2232 |
+
}
|
2233 |
+
|
2234 |
+
function ct_contact_form_is_spam_jetpack($is_spam,$form) {
|
2235 |
+
global $ct_checkjs_jpcf, $apbct;
|
2236 |
+
|
2237 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2238 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2239 |
+
return null;
|
2240 |
+
}
|
2241 |
+
|
2242 |
+
$js_field_name = $ct_checkjs_jpcf;
|
2243 |
+
foreach ($_POST as $k => $v) {
|
2244 |
+
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
2245 |
+
$js_field_name = $k;
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
$base_call_result = apbct_base_call(
|
2249 |
+
array(
|
2250 |
+
'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
|
2251 |
+
'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
|
2252 |
+
'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
|
2253 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
|
2254 |
+
'sender_info' => array('sender_url' => @$form['comment_author_url']),
|
2255 |
+
)
|
2256 |
+
);
|
2257 |
+
$ct_result = $base_call_result['ct_result'];
|
2258 |
+
|
2259 |
+
if ($ct_result->allow == 0) {
|
2260 |
+
global $ct_comment;
|
2261 |
+
$ct_comment = $ct_result->comment;
|
2262 |
+
ct_die(null, null);
|
2263 |
+
exit;
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
return (bool) !$ct_result->allow;
|
2267 |
+
}
|
2268 |
+
|
2269 |
+
/**
|
2270 |
+
* Inserts anti-spam hidden to WP Maintenance Mode (wpmm)
|
2271 |
+
*/
|
2272 |
+
function apbct_form__wpmm__addField(){
|
2273 |
+
ct_add_hidden_fields('ct_checkjs', false, true, true);
|
2274 |
+
}
|
2275 |
+
|
2276 |
+
/**
|
2277 |
+
* Inserts anti-spam hidden to CF7
|
2278 |
+
*/
|
2279 |
+
function apbct_form__contactForm7__addField($html) {
|
2280 |
+
global $ct_checkjs_cf7, $apbct;
|
2281 |
+
|
2282 |
+
|
2283 |
+
|
2284 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2285 |
+
return $html;
|
2286 |
+
}
|
2287 |
+
|
2288 |
+
$html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
|
2289 |
+
|
2290 |
+
return $html;
|
2291 |
+
}
|
2292 |
+
|
2293 |
+
/**
|
2294 |
+
* Test spam for Contact Fomr 7 (CF7) right before validation
|
2295 |
+
*
|
2296 |
+
* @global SpbcState $apbct
|
2297 |
+
* @param type $result
|
2298 |
+
* @param type $tags
|
2299 |
+
* @return type
|
2300 |
+
*/
|
2301 |
+
function apbct_form__contactForm7__tesSpam__before_validate($result = null, $tags = null) {
|
2302 |
+
global $apbct;
|
2303 |
+
|
2304 |
+
if ($result && method_exists($result, 'get_invalid_fields')){
|
2305 |
+
$invalid_fields = $result->get_invalid_fields();
|
2306 |
+
if(!empty($invalid_fields) && is_array($invalid_fields)){
|
2307 |
+
$apbct->validation_error = $invalid_fields[key($invalid_fields)]['reason'];
|
2308 |
+
apbct_form__contactForm7__testSpam(false);
|
2309 |
+
}
|
2310 |
+
}
|
2311 |
+
|
2312 |
+
return $result;
|
2313 |
+
}
|
2314 |
+
|
2315 |
+
/**
|
2316 |
+
* Test CF7 message for spam
|
2317 |
+
*/
|
2318 |
+
function apbct_form__contactForm7__testSpam($param) {
|
2319 |
+
|
2320 |
+
global $ct_checkjs_cf7, $apbct;
|
2321 |
+
|
2322 |
+
if(
|
2323 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
2324 |
+
$param == false && WPCF7_VERSION < '3.0.0' ||
|
2325 |
+
$param === true && WPCF7_VERSION >= '3.0.0' ||
|
2326 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
|
2327 |
+
apbct_exclusions_check__url() ||
|
2328 |
+
apbct_exclusions_check__ip() ||
|
2329 |
+
isset($apbct->cf7_checked)
|
2330 |
+
){
|
2331 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2332 |
+
return $param;
|
2333 |
+
}
|
2334 |
+
|
2335 |
+
$checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
|
2336 |
+
? apbct_js_test($ct_checkjs_cf7, $_POST)
|
2337 |
+
: apbct_js_test('ct_checkjs', $_COOKIE);
|
2338 |
+
|
2339 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
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 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
2345 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2346 |
+
if ($subject != '') {
|
2347 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2348 |
+
}
|
2349 |
+
|
2350 |
+
$base_call_result = apbct_base_call(
|
2351 |
+
array(
|
2352 |
+
'message' => $message,
|
2353 |
+
'sender_email' => $sender_email,
|
2354 |
+
'sender_nickname' => $sender_nickname,
|
2355 |
+
'js_on' => $checkjs,
|
2356 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'),
|
2357 |
+
'sender_info' => array(
|
2358 |
+
'form_validation' => !isset($apbct->validation_error)
|
2359 |
+
? null
|
2360 |
+
: json_encode(array(
|
2361 |
+
'validation_notice' => $apbct->validation_error,
|
2362 |
+
'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
|
2363 |
+
))
|
2364 |
+
),
|
2365 |
+
)
|
2366 |
+
);
|
2367 |
+
|
2368 |
+
$ct_result = $base_call_result['ct_result'];
|
2369 |
+
|
2370 |
+
// Change mail notification if license is out of date
|
2371 |
+
if($apbct->data['moderate'] == 0 &&
|
2372 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
2373 |
+
){
|
2374 |
+
$apbct->sender_email = $sender_email;
|
2375 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
2376 |
+
add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification');
|
2377 |
+
}
|
2378 |
+
|
2379 |
+
if ($ct_result->allow == 0) {
|
2380 |
+
|
2381 |
+
global $ct_cf7_comment;
|
2382 |
+
$ct_cf7_comment = $ct_result->comment;
|
2383 |
+
|
2384 |
+
add_filter('wpcf7_display_message', 'apbct_form__contactForm7__showResponse', 10, 2);
|
2385 |
+
|
2386 |
+
$param = WPCF7_VERSION >= '3.0.0' ? true : false;
|
2387 |
+
|
2388 |
+
}
|
2389 |
+
|
2390 |
+
$apbct->cf7_checked = true;
|
2391 |
+
|
2392 |
+
return $param;
|
2393 |
+
}
|
2394 |
+
|
2395 |
+
/**
|
2396 |
+
* Changes CF7 status message
|
2397 |
+
* @param string $hook URL of hooked page
|
2398 |
+
*/
|
2399 |
+
function apbct_form__contactForm7__showResponse($message, $status = 'spam') {
|
2400 |
+
global $ct_cf7_comment;
|
2401 |
+
|
2402 |
+
if ($status == 'spam') {
|
2403 |
+
$message = $ct_cf7_comment;
|
2404 |
+
}
|
2405 |
+
|
2406 |
+
return $message;
|
2407 |
+
}
|
2408 |
+
|
2409 |
+
/**
|
2410 |
+
* Changes email notification for succes subscription for Contact Form 7
|
2411 |
+
*
|
2412 |
+
* @param array $component Arguments for email notification
|
2413 |
+
* @return array Arguments for email notification
|
2414 |
+
*/
|
2415 |
+
function apbct_form__contactForm7__changeMailNotification($component){
|
2416 |
+
|
2417 |
+
global $apbct;
|
2418 |
+
|
2419 |
+
$component['body'] =
|
2420 |
+
__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
|
2421 |
+
.PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2422 |
+
.PHP_EOL . 'IP: ' . $apbct->sender_ip
|
2423 |
+
.PHP_EOL . 'Email: ' . $apbct->sender_email
|
2424 |
+
.PHP_EOL . sprintf(
|
2425 |
+
__('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
|
2426 |
+
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token='.$apbct->user_token
|
2427 |
+
)
|
2428 |
+
.PHP_EOL . '---' . PHP_EOL . PHP_EOL
|
2429 |
+
.$component['body'];
|
2430 |
+
|
2431 |
+
return (array) $component;
|
2432 |
+
}
|
2433 |
+
|
2434 |
+
/**
|
2435 |
+
* Test Ninja Forms message for spam
|
2436 |
+
*
|
2437 |
+
* @global SpbcState $apbct
|
2438 |
+
* @return void
|
2439 |
+
*/
|
2440 |
+
function apbct_form__ninjaForms__testSpam() {
|
2441 |
+
|
2442 |
+
global $apbct;
|
2443 |
+
|
2444 |
+
if(
|
2445 |
+
$apbct->settings['contact_forms_test'] == 0
|
2446 |
+
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
2447 |
+
|| apbct_exclusions_check__url()
|
2448 |
+
){
|
2449 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2450 |
+
return;
|
2451 |
+
}
|
2452 |
+
|
2453 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
2454 |
+
|
2455 |
+
// Choosing between POST and GET
|
2456 |
+
$params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
|
2457 |
+
|
2458 |
+
$sender_email = ($params['email'] ? $params['email'] : '');
|
2459 |
+
$sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
|
2460 |
+
$subject = ($params['subject'] ? $params['subject'] : '');
|
2461 |
+
$message = ($params['message'] ? $params['message'] : array());
|
2462 |
+
if ($subject != '') {
|
2463 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
//Ninja Forms xml fix
|
2467 |
+
foreach ($message as $key => $value){
|
2468 |
+
if (strpos($value, '<xml>') !== false)
|
2469 |
+
unset($message[$key]);
|
2470 |
+
}
|
2471 |
+
|
2472 |
+
$base_call_result = apbct_base_call(
|
2473 |
+
array(
|
2474 |
+
'message' => $message,
|
2475 |
+
'sender_email' => $sender_email,
|
2476 |
+
'sender_nickname' => $sender_nickname,
|
2477 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_ninja_froms'),
|
2478 |
+
'js_on' => $checkjs,
|
2479 |
+
)
|
2480 |
+
);
|
2481 |
+
$ct_result = $base_call_result['ct_result'];
|
2482 |
+
|
2483 |
+
// Change mail notification if license is out of date
|
2484 |
+
if($apbct->data['moderate'] == 0 &&
|
2485 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
2486 |
+
){
|
2487 |
+
$apbct->sender_email = $sender_email;
|
2488 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
2489 |
+
add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
|
2490 |
+
}
|
2491 |
+
|
2492 |
+
if ($ct_result->allow == 0) {
|
2493 |
+
|
2494 |
+
// We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
|
2495 |
+
$apbct->response = $ct_result->comment;
|
2496 |
+
add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
|
2497 |
+
add_action( 'ninja_forms_action_email_send', 'apbct_form__ninjaForms__stopEmail', 1, 5 ); // Prevent mail notification
|
2498 |
+
add_action( 'ninja_forms_save_submission', 'apbct_form__ninjaForms__preventSubmission', 1, 2 ); // Prevent mail notification
|
2499 |
+
}
|
2500 |
+
}
|
2501 |
+
|
2502 |
+
function apbct_form__ninjaForms__preventSubmission($some, $form_id){
|
2503 |
+
return false;
|
2504 |
+
}
|
2505 |
+
|
2506 |
+
function apbct_form__ninjaForms__stopEmail($some, $action_settings, $message, $headers, $attachments){
|
2507 |
+
global $apbct;
|
2508 |
+
throw new Exception($apbct->response);
|
2509 |
+
}
|
2510 |
+
|
2511 |
+
function apbct_form__ninjaForms__changeResponse( $data ) {
|
2512 |
+
|
2513 |
+
global $apbct;
|
2514 |
+
|
2515 |
+
// Show error message below field found by ID
|
2516 |
+
if(array_key_exists('email', $data['fields_by_key'])){
|
2517 |
+
// Find ID of EMAIL field
|
2518 |
+
$nf_field_id = $data['fields_by_key']['email']['id'];
|
2519 |
+
}else{
|
2520 |
+
// Find ID of last field (usually SUBMIT)
|
2521 |
+
$nf_field_id = array_pop(array_keys($data['fields']));
|
2522 |
+
}
|
2523 |
+
|
2524 |
+
// Below is modified NJ logic
|
2525 |
+
$error = array(
|
2526 |
+
'fields' => array(
|
2527 |
+
$nf_field_id => $apbct->response,
|
2528 |
+
),
|
2529 |
+
);
|
2530 |
+
|
2531 |
+
$response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
|
2532 |
+
|
2533 |
+
die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
|
2534 |
+
|
2535 |
+
}
|
2536 |
+
|
2537 |
+
function apbct_form__seedprod_coming_soon__testSpam() {
|
2538 |
+
|
2539 |
+
global $apbct;
|
2540 |
+
|
2541 |
+
if(
|
2542 |
+
$apbct->settings['contact_forms_test'] == 0
|
2543 |
+
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
2544 |
+
|| apbct_exclusions_check__url()
|
2545 |
+
){
|
2546 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2547 |
+
return;
|
2548 |
+
}
|
2549 |
+
|
2550 |
+
$ct_temp_msg_data = ct_get_fields_any($_REQUEST);
|
2551 |
+
|
2552 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2553 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2554 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2555 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2556 |
+
if ($subject != '') {
|
2557 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
$post_info['comment_type'] = 'contact_form_wordpress_seedprod_coming_soon';
|
2561 |
+
|
2562 |
+
$base_call_result = apbct_base_call(
|
2563 |
+
array(
|
2564 |
+
'message' => $message,
|
2565 |
+
'sender_email' => $sender_email,
|
2566 |
+
'sender_nickname' => $sender_nickname,
|
2567 |
+
'post_info' => $post_info,
|
2568 |
+
)
|
2569 |
+
);
|
2570 |
+
|
2571 |
+
$ct_result = $base_call_result['ct_result'];
|
2572 |
+
if ($ct_result->allow == 0) {
|
2573 |
+
global $ct_comment;
|
2574 |
+
$ct_comment = $ct_result->comment;
|
2575 |
+
|
2576 |
+
$response = array(
|
2577 |
+
'status' => 200,
|
2578 |
+
'html' => "<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>"
|
2579 |
+
);
|
2580 |
+
|
2581 |
+
echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
|
2582 |
+
exit();
|
2583 |
+
}
|
2584 |
+
|
2585 |
+
}
|
2586 |
+
|
2587 |
+
/**
|
2588 |
+
* Changes email notification for succes subscription for Ninja Forms
|
2589 |
+
*
|
2590 |
+
* @param string $message Body of email notification
|
2591 |
+
* @return string Body for email notification
|
2592 |
+
*/
|
2593 |
+
function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
|
2594 |
+
|
2595 |
+
global $apbct;
|
2596 |
+
|
2597 |
+
if($action_settings['to'] !== $apbct->sender_email){
|
2598 |
+
|
2599 |
+
$message .= wpautop(PHP_EOL . '---'
|
2600 |
+
.PHP_EOL
|
2601 |
+
.__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
|
2602 |
+
.PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2603 |
+
.PHP_EOL . 'IP: ' . $apbct->sender_ip
|
2604 |
+
.PHP_EOL . 'Email: ' . $apbct->sender_email
|
2605 |
+
.PHP_EOL .
|
2606 |
+
__('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
|
2607 |
+
'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
|
2608 |
+
);
|
2609 |
+
}
|
2610 |
+
|
2611 |
+
return $message;
|
2612 |
+
}
|
2613 |
+
|
2614 |
+
/**
|
2615 |
+
* Inserts anti-spam hidden to WPForms
|
2616 |
+
*
|
2617 |
+
* @global SpbcState $apbct
|
2618 |
+
* @return void
|
2619 |
+
*/
|
2620 |
+
function apbct_form__WPForms__addField($form_data, $some, $title, $description, $errors) {
|
2621 |
+
|
2622 |
+
global $apbct;
|
2623 |
+
|
2624 |
+
if($apbct->settings['contact_forms_test'] == 1)
|
2625 |
+
ct_add_hidden_fields('checkjs_wpforms', false);
|
2626 |
+
|
2627 |
+
}
|
2628 |
+
|
2629 |
+
/**
|
2630 |
+
* Gather fields data from submission and store it
|
2631 |
+
*
|
2632 |
+
* @param array $entry
|
2633 |
+
* @param $form
|
2634 |
+
*
|
2635 |
+
* @return array
|
2636 |
+
* @global SpbcState $apbct
|
2637 |
+
*/
|
2638 |
+
function apbct_from__WPForms__gatherData($entry, $form){
|
2639 |
+
|
2640 |
+
global $apbct;
|
2641 |
+
|
2642 |
+
$data = array();
|
2643 |
+
foreach($entry['fields'] as $key => $val){
|
2644 |
+
$true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
|
2645 |
+
$true_key = $true_key ? $true_key : $key;
|
2646 |
+
$data[$true_key] = $val;
|
2647 |
+
} unset($key, $val);
|
2648 |
+
|
2649 |
+
$apbct->form_data = $data;
|
2650 |
+
|
2651 |
+
return $entry;
|
2652 |
+
}
|
2653 |
+
|
2654 |
+
/**
|
2655 |
+
* Adding error to form entry if message is spam
|
2656 |
+
* Call spam test from here
|
2657 |
+
*
|
2658 |
+
* @param array $errors
|
2659 |
+
* @param array $form_data
|
2660 |
+
* @return array
|
2661 |
+
*/
|
2662 |
+
function apbct_form__WPForms__showResponse($errors, $form_data) {
|
2663 |
+
|
2664 |
+
if(empty($errors) || ( isset($form_data['id'], $errors[$form_data['id']]) && !count($errors[$form_data['id']]) ) ){
|
2665 |
+
|
2666 |
+
$spam_comment = apbct_form__WPForms__testSpam();
|
2667 |
+
|
2668 |
+
$filed_id = $form_data && !empty($form_data['fields']) && is_array($form_data['fields'])
|
2669 |
+
? key($form_data['fields'])
|
2670 |
+
: 0;
|
2671 |
+
|
2672 |
+
if($spam_comment)
|
2673 |
+
$errors[ $form_data['id'] ][ $filed_id ] = $spam_comment;
|
2674 |
+
|
2675 |
+
}
|
2676 |
+
|
2677 |
+
return $errors;
|
2678 |
+
}
|
2679 |
+
|
2680 |
+
/**
|
2681 |
+
* Test WPForms message for spam
|
2682 |
+
* Doesn't hooked anywhere.
|
2683 |
+
* Called directly from apbct_form__WPForms__showResponse()
|
2684 |
+
*
|
2685 |
+
* @global SpbcState $apbct
|
2686 |
+
* @global array $apbct->form_data Contains form data
|
2687 |
+
* @param array $errors Array of errors to write false result in
|
2688 |
+
* @return void|array|null
|
2689 |
+
*/
|
2690 |
+
function apbct_form__WPForms__testSpam() {
|
2691 |
+
|
2692 |
+
global $apbct;
|
2693 |
+
|
2694 |
+
if(
|
2695 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
2696 |
+
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
|
2697 |
+
){
|
2698 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2699 |
+
return;
|
2700 |
+
}
|
2701 |
+
|
2702 |
+
$checkjs = apbct_js_test('checkjs_wpforms', $_POST);
|
2703 |
+
|
2704 |
+
$params = ct_get_fields_any($apbct->form_data);
|
2705 |
+
|
2706 |
+
$sender_email = ($params['email'] ? $params['email'] : '');
|
2707 |
+
$sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
|
2708 |
+
$subject = ($params['subject'] ? $params['subject'] : '');
|
2709 |
+
$message = ($params['message'] ? $params['message'] : array());
|
2710 |
+
if ($subject != '') {
|
2711 |
+
$message = array_merge(array('subject' => $subject), $message);
|
2712 |
+
}
|
2713 |
+
|
2714 |
+
$base_call_result = apbct_base_call(
|
2715 |
+
array(
|
2716 |
+
'message' => $message,
|
2717 |
+
'sender_email' => $sender_email,
|
2718 |
+
'sender_nickname' => $sender_nickname,
|
2719 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_wp_forms'),
|
2720 |
+
'js_on' => $checkjs,
|
2721 |
+
)
|
2722 |
+
);
|
2723 |
+
$ct_result = $base_call_result['ct_result'];
|
2724 |
+
|
2725 |
+
// Change mail notification if license is out of date
|
2726 |
+
if($apbct->data['moderate'] == 0 &&
|
2727 |
+
($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
|
2728 |
+
){
|
2729 |
+
$apbct->sender_email = $sender_email;
|
2730 |
+
$apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
|
2731 |
+
add_filter('wpforms_email_message', 'apbct_form__WPForms__changeMailNotification', 100, 2);
|
2732 |
+
}
|
2733 |
+
|
2734 |
+
if ($ct_result->allow == 0){
|
2735 |
+
return $ct_result->comment;
|
2736 |
+
}
|
2737 |
+
|
2738 |
+
return null;
|
2739 |
+
|
2740 |
+
}
|
2741 |
+
|
2742 |
+
/**
|
2743 |
+
* Changes email notification for succes subscription for Ninja Forms
|
2744 |
+
*
|
2745 |
+
* @param string $message Body of email notification
|
2746 |
+
* @param WPForms_WP_Emails $wpforms_email WPForms email class object
|
2747 |
+
* @return string Body for email notification
|
2748 |
+
*/
|
2749 |
+
function apbct_form__WPForms__changeMailNotification($message, $wpforms_email){
|
2750 |
+
|
2751 |
+
global $apbct;
|
2752 |
+
|
2753 |
+
$message = str_replace('</html>', '', $message);
|
2754 |
+
$message = str_replace('</body>', '', $message);
|
2755 |
+
$message .= wpautop(PHP_EOL . '---'
|
2756 |
+
.PHP_EOL
|
2757 |
+
.__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
|
2758 |
+
.PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
|
2759 |
+
.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>'
|
2760 |
+
.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>'
|
2761 |
+
.PHP_EOL . sprintf(
|
2762 |
+
__('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
|
2763 |
+
'<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_activate_antispam" target="_blank">',
|
2764 |
+
'</a>'
|
2765 |
+
))
|
2766 |
+
.'</body></html>';
|
2767 |
+
|
2768 |
+
return $message;
|
2769 |
+
|
2770 |
+
}
|
2771 |
+
|
2772 |
+
/*
|
2773 |
+
* QuForms check spam
|
2774 |
+
* works with singl-paged forms
|
2775 |
+
* and with multi-paged forms - check only last step of the forms
|
2776 |
+
*/
|
2777 |
+
function ct_quform_post_validate($result, $form) {
|
2778 |
+
|
2779 |
+
if ( $form->hasPages() ) {
|
2780 |
+
$comment_type = 'contact_form_wordpress_quforms_multipage';
|
2781 |
+
} else {
|
2782 |
+
$comment_type = 'contact_form_wordpress_quforms_singlepage';
|
2783 |
+
}
|
2784 |
+
|
2785 |
+
$ct_temp_msg_data = ct_get_fields_any( $form->getValues() );
|
2786 |
+
// @ToDo If we have several emails at the form - will be used only the first detected!
|
2787 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2788 |
+
|
2789 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
2790 |
+
$base_call_result = apbct_base_call(
|
2791 |
+
array(
|
2792 |
+
'message' => $form->getValues(),
|
2793 |
+
'sender_email' => $sender_email,
|
2794 |
+
'post_info' => array('comment_type' => $comment_type),
|
2795 |
+
'js_on' => $checkjs,
|
2796 |
+
)
|
2797 |
+
);
|
2798 |
+
|
2799 |
+
$ct_result = $base_call_result['ct_result'];
|
2800 |
+
if ($ct_result->allow == 0) {
|
2801 |
+
die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
|
2802 |
+
} else {
|
2803 |
+
return $result;
|
2804 |
+
}
|
2805 |
+
|
2806 |
+
return $result;
|
2807 |
+
|
2808 |
+
}
|
2809 |
+
|
2810 |
+
/**
|
2811 |
+
* Inserts anti-spam hidden to Fast Secure contact form
|
2812 |
+
*/
|
2813 |
+
function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
|
2814 |
+
$string .= ct_add_hidden_fields('ct_checkjs', true);
|
2815 |
+
return $string;
|
2816 |
+
}
|
2817 |
+
|
2818 |
+
/**
|
2819 |
+
* Test for Fast Secure contact form
|
2820 |
+
*/
|
2821 |
+
function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
2822 |
+
global $apbct, $cleantalk_executed;
|
2823 |
+
|
2824 |
+
if (!empty($form_errors)) {
|
2825 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2826 |
+
return $form_errors;
|
2827 |
+
}
|
2828 |
+
|
2829 |
+
|
2830 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2831 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2832 |
+
return $form_errors;
|
2833 |
+
}
|
2834 |
+
|
2835 |
+
// Skip processing because data already processed.
|
2836 |
+
if ($cleantalk_executed) {
|
2837 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2838 |
+
return $form_errors;
|
2839 |
+
}
|
2840 |
+
|
2841 |
+
//getting info from custom fields
|
2842 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
2843 |
+
|
2844 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
2845 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
2846 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
2847 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
2848 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
2849 |
+
if($subject != '') {
|
2850 |
+
$message['subject'] = $subject;
|
2851 |
+
}
|
2852 |
+
|
2853 |
+
$base_call_result = apbct_base_call(
|
2854 |
+
array(
|
2855 |
+
'message' => $message,
|
2856 |
+
'sender_email' => $sender_email,
|
2857 |
+
'sender_nickname' => $sender_nickname,
|
2858 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
|
2859 |
+
'js_on' => apbct_js_test('ct_checkjs', $_POST),
|
2860 |
+
)
|
2861 |
+
);
|
2862 |
+
|
2863 |
+
$ct_result = $base_call_result['ct_result'];
|
2864 |
+
|
2865 |
+
$cleantalk_executed = true;
|
2866 |
+
|
2867 |
+
if ($ct_result->allow == 0) {
|
2868 |
+
global $ct_comment;
|
2869 |
+
$ct_comment = $ct_result->comment;
|
2870 |
+
ct_die(null, null);
|
2871 |
+
exit;
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
return $form_errors;
|
2875 |
+
}
|
2876 |
+
|
2877 |
+
/**
|
2878 |
+
* Notice for commentators which comment has automatically approved by plugin
|
2879 |
+
* @param string $hook URL of hooked page
|
2880 |
+
*/
|
2881 |
+
function ct_comment_text($comment_text) {
|
2882 |
+
global $comment, $ct_approved_request_id_label;
|
2883 |
+
|
2884 |
+
if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
|
2885 |
+
$ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
2886 |
+
|
2887 |
+
if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
|
2888 |
+
$comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
|
2889 |
+
}
|
2890 |
+
}
|
2891 |
+
|
2892 |
+
return $comment_text;
|
2893 |
+
}
|
2894 |
+
|
2895 |
+
|
2896 |
+
/**
|
2897 |
+
* Checks WordPress Landing Pages raw $_POST values
|
2898 |
+
*/
|
2899 |
+
function ct_check_wplp(){
|
2900 |
+
|
2901 |
+
global $ct_wplp_result_label, $apbct;
|
2902 |
+
|
2903 |
+
if (!isset($_COOKIE[$ct_wplp_result_label])) {
|
2904 |
+
// First AJAX submit of WPLP form
|
2905 |
+
if ($apbct->settings['contact_forms_test'] == 0) {
|
2906 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2907 |
+
return;
|
2908 |
+
}
|
2909 |
+
|
2910 |
+
$post_info['comment_type'] = 'feedback';
|
2911 |
+
$post_info = json_encode($post_info);
|
2912 |
+
if ($post_info === false)
|
2913 |
+
$post_info = '';
|
2914 |
+
|
2915 |
+
$sender_email = '';
|
2916 |
+
foreach ($_POST as $v) {
|
2917 |
+
if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
|
2918 |
+
$sender_email = $v;
|
2919 |
+
break;
|
2920 |
+
}
|
2921 |
+
}
|
2922 |
+
|
2923 |
+
$message = '';
|
2924 |
+
if(array_key_exists('form_input_values', $_POST)){
|
2925 |
+
$form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
|
2926 |
+
if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
|
2927 |
+
$message = $form_input_values['null'];
|
2928 |
+
} else if (array_key_exists('null', $_POST)) {
|
2929 |
+
$message = $_POST['null'];
|
2930 |
+
}
|
2931 |
+
|
2932 |
+
$base_call_result = apbct_base_call(
|
2933 |
+
array(
|
2934 |
+
'message' => $message,
|
2935 |
+
'sender_email' => $sender_email,
|
2936 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_wplp'),
|
2937 |
+
)
|
2938 |
+
);
|
2939 |
+
|
2940 |
+
$ct_result = $base_call_result['ct_result'];
|
2941 |
+
|
2942 |
+
if ($ct_result->allow == 0) {
|
2943 |
+
$cleantalk_comment = $ct_result->comment;
|
2944 |
+
} else {
|
2945 |
+
$cleantalk_comment = 'OK';
|
2946 |
+
}
|
2947 |
+
|
2948 |
+
\Cleantalk\Antispam\Helper::apbct_cookie__set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
|
2949 |
+
} else {
|
2950 |
+
// Next POST/AJAX submit(s) of same WPLP form
|
2951 |
+
$cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
|
2952 |
+
}
|
2953 |
+
if ($cleantalk_comment !== 'OK')
|
2954 |
+
ct_die_extended($cleantalk_comment);
|
2955 |
+
}
|
2956 |
+
|
2957 |
+
/**
|
2958 |
+
* Places a hidding field to Gravity forms.
|
2959 |
+
* @return string
|
2960 |
+
*/
|
2961 |
+
function apbct_form__gravityForms__addField($form_string, $form){
|
2962 |
+
$ct_hidden_field = 'ct_checkjs';
|
2963 |
+
|
2964 |
+
// Do not add a hidden field twice.
|
2965 |
+
if (preg_match("/$ct_hidden_field/", $form_string)) {
|
2966 |
+
return $form_string;
|
2967 |
+
}
|
2968 |
+
|
2969 |
+
$search = "</form>";
|
2970 |
+
|
2971 |
+
// Adding JS code
|
2972 |
+
$js_code = ct_add_hidden_fields($ct_hidden_field, true, false);
|
2973 |
+
$form_string = str_replace($search, $js_code . $search, $form_string);
|
2974 |
+
|
2975 |
+
// Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
|
2976 |
+
$append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
|
2977 |
+
$form_string = str_replace($search, $append_string.$search, $form_string);
|
2978 |
+
|
2979 |
+
return $form_string;
|
2980 |
+
}
|
2981 |
+
|
2982 |
+
/**
|
2983 |
+
* Gravity forms anti-spam test.
|
2984 |
+
* @return boolean
|
2985 |
+
*/
|
2986 |
+
function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
|
2987 |
+
|
2988 |
+
global $apbct, $cleantalk_executed, $ct_gform_is_spam, $ct_gform_response;
|
2989 |
+
|
2990 |
+
if (
|
2991 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
2992 |
+
$is_spam ||
|
2993 |
+
$cleantalk_executed // Return unchanged result if the submission was already tested.
|
2994 |
+
) {
|
2995 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
2996 |
+
return $is_spam;
|
2997 |
+
}
|
2998 |
+
|
2999 |
+
$ct_temp = array();
|
3000 |
+
foreach($entry as $key => $value){
|
3001 |
+
if(is_numeric($key))
|
3002 |
+
$ct_temp[$key]=$value;
|
3003 |
+
} unset($key, $value);
|
3004 |
+
|
3005 |
+
$ct_temp_msg_data = ct_get_fields_any($ct_temp);
|
3006 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
3007 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
3008 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
3009 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
3010 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
3011 |
+
|
3012 |
+
// Adding 'input_' to every field /Gravity Forms fix/
|
3013 |
+
$tmp = $message;
|
3014 |
+
$message = array();
|
3015 |
+
foreach($tmp as $key => $value){
|
3016 |
+
$message[ 'input_' . $key] = $value;
|
3017 |
+
} unset( $key, $value, $tmp );
|
3018 |
+
|
3019 |
+
if($subject != '')
|
3020 |
+
$message['subject'] = $subject;
|
3021 |
+
|
3022 |
+
$checkjs = apbct_js_test('ct_checkjs', $_POST)
|
3023 |
+
? apbct_js_test('ct_checkjs', $_POST)
|
3024 |
+
: apbct_js_test('ct_checkjs', $_COOKIE);
|
3025 |
+
|
3026 |
+
$base_call_result = apbct_base_call(
|
3027 |
+
array(
|
3028 |
+
'message' => $message,
|
3029 |
+
'sender_email' => $sender_email,
|
3030 |
+
'sender_nickname' => $sender_nickname,
|
3031 |
+
'post_info' => array('comment_type' => 'contact_form_wordpress_gravity_forms'),
|
3032 |
+
'js_on' => $checkjs,
|
3033 |
+
)
|
3034 |
+
);
|
3035 |
+
|
3036 |
+
$ct_result = $base_call_result['ct_result'];
|
3037 |
+
if ($ct_result->allow == 0) {
|
3038 |
+
$is_spam = true;
|
3039 |
+
$ct_gform_is_spam = true;
|
3040 |
+
$ct_gform_response = $ct_result->comment;
|
3041 |
+
}
|
3042 |
+
|
3043 |
+
return $is_spam;
|
3044 |
+
}
|
3045 |
+
|
3046 |
+
function apbct_form__gravityForms__showResponse( $confirmation, $form, $entry, $ajax ){
|
3047 |
+
|
3048 |
+
global $ct_gform_is_spam, $ct_gform_response;
|
3049 |
+
|
3050 |
+
if(!empty($ct_gform_is_spam)){
|
3051 |
+
$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>';
|
3052 |
+
}
|
3053 |
+
|
3054 |
+
return $confirmation;
|
3055 |
+
}
|
3056 |
+
|
3057 |
+
/**
|
3058 |
+
* Test S2member registration
|
3059 |
+
* @return array with errors
|
3060 |
+
*/
|
3061 |
+
function ct_s2member_registration_test($post_key) {
|
3062 |
+
|
3063 |
+
global $apbct;
|
3064 |
+
|
3065 |
+
if ($apbct->settings['registrations_test'] == 0) {
|
3066 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3067 |
+
return null;
|
3068 |
+
}
|
3069 |
+
|
3070 |
+
$sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
|
3071 |
+
$sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
|
3072 |
+
|
3073 |
+
//Making a call
|
3074 |
+
$base_call_result = apbct_base_call(
|
3075 |
+
array(
|
3076 |
+
'sender_email' => $sender_email,
|
3077 |
+
'sender_nickname' => $sender_nickname,
|
3078 |
+
),
|
3079 |
+
true
|
3080 |
+
);
|
3081 |
+
$ct_result = $base_call_result['ct_result'];
|
3082 |
+
|
3083 |
+
if ($ct_result->allow == 0) {
|
3084 |
+
ct_die_extended($ct_result->comment);
|
3085 |
+
}
|
3086 |
+
|
3087 |
+
return true;
|
3088 |
+
}
|
3089 |
+
|
3090 |
+
function apbct_form__the7_contact_form() {
|
3091 |
+
|
3092 |
+
global $cleantalk_executed;
|
3093 |
+
|
3094 |
+
if ( check_ajax_referer( 'dt_contact_form', 'nonce', false ) && isset($_POST) ) {
|
3095 |
+
|
3096 |
+
$post_info['comment_type'] = 'contact_the7_theme_contact_form';
|
3097 |
+
|
3098 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
3099 |
+
|
3100 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
3101 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
3102 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
3103 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
3104 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
3105 |
+
if ($subject != '') {
|
3106 |
+
$message = array_merge(array('subject' => $subject), $message);
|
3107 |
+
}
|
3108 |
+
|
3109 |
+
// Skip submission if no data found
|
3110 |
+
if ($sender_email === ''|| !$contact_form) {
|
3111 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3112 |
+
return false;
|
3113 |
+
}
|
3114 |
+
$cleantalk_executed = true;
|
3115 |
+
|
3116 |
+
$base_call_result = apbct_base_call(
|
3117 |
+
array(
|
3118 |
+
'message' => $message,
|
3119 |
+
'sender_email' => $sender_email,
|
3120 |
+
'sender_nickname' => $sender_nickname,
|
3121 |
+
'post_info' => $post_info,
|
3122 |
+
)
|
3123 |
+
);
|
3124 |
+
|
3125 |
+
$ct_result = $base_call_result['ct_result'];
|
3126 |
+
if ($ct_result->allow == 0) {
|
3127 |
+
|
3128 |
+
$response = json_encode(
|
3129 |
+
array(
|
3130 |
+
'success' => false ,
|
3131 |
+
'errors' => $ct_result->comment,
|
3132 |
+
'nonce' => wp_create_nonce( 'dt_contact_form' )
|
3133 |
+
)
|
3134 |
+
);
|
3135 |
+
|
3136 |
+
// response output
|
3137 |
+
header( "Content-Type: application/json" );
|
3138 |
+
echo $response;
|
3139 |
+
|
3140 |
+
// IMPORTANT: don't forget to "exit"
|
3141 |
+
exit;
|
3142 |
+
|
3143 |
+
}
|
3144 |
+
|
3145 |
+
}
|
3146 |
+
|
3147 |
+
}
|
3148 |
+
|
3149 |
+
function apbct_form__elementor_pro__testSpam() {
|
3150 |
+
|
3151 |
+
global $apbct, $cleantalk_executed;
|
3152 |
+
|
3153 |
+
if(
|
3154 |
+
$apbct->settings['contact_forms_test'] == 0
|
3155 |
+
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
3156 |
+
|| apbct_exclusions_check__url()
|
3157 |
+
){
|
3158 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3159 |
+
return;
|
3160 |
+
}
|
3161 |
+
|
3162 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
3163 |
+
|
3164 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
3165 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
3166 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
3167 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
3168 |
+
if ($subject != '') {
|
3169 |
+
$message = array_merge(array('subject' => $subject), $message);
|
3170 |
+
}
|
3171 |
+
|
3172 |
+
$post_info['comment_type'] = 'contact_form_wordpress_elementor_pro';
|
3173 |
+
|
3174 |
+
$cleantalk_executed = true;
|
3175 |
+
$base_call_result = apbct_base_call(
|
3176 |
+
array(
|
3177 |
+
'message' => $message,
|
3178 |
+
'sender_email' => $sender_email,
|
3179 |
+
'sender_nickname' => $sender_nickname,
|
3180 |
+
'post_info' => $post_info,
|
3181 |
+
)
|
3182 |
+
);
|
3183 |
+
|
3184 |
+
$ct_result = $base_call_result['ct_result'];
|
3185 |
+
|
3186 |
+
if ($ct_result->allow == 0) {
|
3187 |
+
|
3188 |
+
wp_send_json_error( array(
|
3189 |
+
'message' => $ct_result->comment,
|
3190 |
+
'data' => array()
|
3191 |
+
) );
|
3192 |
+
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
}
|
3196 |
+
|
3197 |
+
// INEVIO theme integration
|
3198 |
+
function apbct_form__inevio__testSpam() {
|
3199 |
+
|
3200 |
+
global $apbct, $cleantalk_executed;
|
3201 |
+
|
3202 |
+
$theme = wp_get_theme();
|
3203 |
+
if(
|
3204 |
+
stripos( $theme->get( 'Name' ), 'INEVIO' ) === false ||
|
3205 |
+
$apbct->settings['contact_forms_test'] == 0 ||
|
3206 |
+
($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) || // Skip processing for logged in users.
|
3207 |
+
apbct_exclusions_check__url()
|
3208 |
+
) {
|
3209 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3210 |
+
return false;
|
3211 |
+
}
|
3212 |
+
$form_data = array();
|
3213 |
+
parse_str($_POST['data'], $form_data);
|
3214 |
+
|
3215 |
+
$name = isset($form_data['name']) ? $form_data['name'] : '';
|
3216 |
+
$email = isset($form_data['email']) ? $form_data['email'] : '';
|
3217 |
+
$message = isset($form_data['message']) ? $form_data['message'] : '';
|
3218 |
+
|
3219 |
+
$post_info['comment_type'] = 'contact_form_wordpress_inevio_theme';
|
3220 |
+
|
3221 |
+
$cleantalk_executed = true;
|
3222 |
+
$base_call_result = apbct_base_call(
|
3223 |
+
array(
|
3224 |
+
'message' => $message,
|
3225 |
+
'sender_email' => $email,
|
3226 |
+
'sender_nickname' => $name,
|
3227 |
+
'post_info' => $post_info,
|
3228 |
+
)
|
3229 |
+
);
|
3230 |
+
|
3231 |
+
$ct_result = $base_call_result['ct_result'];
|
3232 |
+
|
3233 |
+
if ( $ct_result->allow == 0 ) {
|
3234 |
+
die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
|
3235 |
+
}
|
3236 |
+
|
3237 |
+
return true;
|
3238 |
+
|
3239 |
+
}
|
3240 |
+
|
3241 |
+
/**
|
3242 |
+
* General test for any contact form
|
3243 |
+
*/
|
3244 |
+
function ct_contact_form_validate() {
|
3245 |
+
|
3246 |
+
global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
|
3247 |
+
|
3248 |
+
// Exclusios common function
|
3249 |
+
if ( apbct_exclusions_check(__FUNCTION__) ) {
|
3250 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3251 |
+
return null;
|
3252 |
+
}
|
3253 |
+
|
3254 |
+
if (@sizeof($_POST)==0 ||
|
3255 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
|
3256 |
+
(isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
3257 |
+
(isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
|
3258 |
+
apbct_is_in_referer( 'lostpassword' ) ||
|
3259 |
+
apbct_is_in_referer( 'lost-password' ) || //Skip lost-password form check
|
3260 |
+
(apbct_is_in_uri('/wp-admin/') && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
|
3261 |
+
apbct_is_in_uri('wp-login.php') ||
|
3262 |
+
apbct_is_in_uri('wp-comments-post.php') ||
|
3263 |
+
apbct_is_in_uri('?provider=facebook&') ||
|
3264 |
+
apbct_is_in_uri('reset-password/') || // Ticket #13668. Password reset.
|
3265 |
+
apbct_is_in_referer( '/wp-admin/') ||
|
3266 |
+
apbct_is_in_uri('/login/') ||
|
3267 |
+
apbct_is_in_uri( '/my-account/edit-account/') || // WooCommerce edit account page
|
3268 |
+
apbct_is_in_uri( '/my-account/edit-address/') || // WooCommerce edit account page
|
3269 |
+
(isset($_POST['action']) && $_POST['action'] == 'save_account_details') || // WooCommerce edit account action
|
3270 |
+
apbct_is_in_uri( '/peepsoajax/profilefieldsajax.validate_register') ||
|
3271 |
+
isset($_GET['ptype']) && $_GET['ptype']=='login' ||
|
3272 |
+
isset($_POST['ct_checkjs_register_form']) ||
|
3273 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
|
3274 |
+
$apbct->settings['general_contact_forms_test'] == 0 ||
|
3275 |
+
isset($_POST['bbp_topic_content']) ||
|
3276 |
+
isset($_POST['bbp_reply_content']) ||
|
3277 |
+
isset($_POST['fscf_submitted']) ||
|
3278 |
+
apbct_is_in_uri('/wc-api/') ||
|
3279 |
+
isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
|
3280 |
+
isset($_POST[$ct_checkjs_frm]) && $apbct->settings['contact_forms_test'] == 1 ||// Formidable forms
|
3281 |
+
isset($_POST['comment_post_ID']) || // The comment form
|
3282 |
+
isset($_GET['for']) ||
|
3283 |
+
(isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
|
3284 |
+
(isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
|
3285 |
+
((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
|
3286 |
+
(isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
|
3287 |
+
apbct_is_in_uri( 'wc-api=WC_Gateway_Realex_Redirect') || // Woo Realex payment Gateway plugin
|
3288 |
+
(isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
|
3289 |
+
(isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
|
3290 |
+
isset($_POST['gform_submit']) || //Gravity form
|
3291 |
+
apbct_is_in_uri( 'wc-ajax=get_refreshed_fragments') ||
|
3292 |
+
(isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1) ||
|
3293 |
+
(isset($_POST['contact_tags']) && strpos($_POST['contact_tags'], 'MBR:') !== false) ||
|
3294 |
+
(apbct_is_in_uri( 'bizuno.php') && !empty($_POST['bizPass'])) ||
|
3295 |
+
apbct_is_in_referer( 'my-dashboard/' ) || // ticket_id=7885
|
3296 |
+
isset($_POST['slm_action'], $_POST['license_key'], $_POST['secret_key'], $_POST['registered_domain']) || // ticket_id=9122
|
3297 |
+
(isset($_POST['wpforms']['submit']) && $_POST['wpforms']['submit'] == 'wpforms-submit') || // WPForms
|
3298 |
+
(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form') || // JetPack
|
3299 |
+
(isset($_POST['action']) && $_POST['action'] == 'bbp-update-user') || //BBP update user info page
|
3300 |
+
apbct_is_in_referer( '?wc-api=WC_Gateway_Transferuj' ) || //WC Gateway
|
3301 |
+
(isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
|
3302 |
+
(isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
|
3303 |
+
apbct_is_in_uri('membership-login') || // Skip login form
|
3304 |
+
(isset($_GET['cookie-state-change'])) || //skip GDPR plugin
|
3305 |
+
( apbct_get_server_variable( 'HTTP_USER_AGENT' ) == 'MailChimp' && apbct_is_in_uri( 'mc4wp-sync-api/webhook-listener') ) || // Mailchimp webhook skip
|
3306 |
+
apbct_is_in_uri('researcher-log-in') || // Skip login form
|
3307 |
+
apbct_is_in_uri('admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves') || // Skip admin save callback
|
3308 |
+
apbct_is_in_uri('?profile_tab=postjobs') || // Skip post vacancies
|
3309 |
+
(isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
|
3310 |
+
(isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
|
3311 |
+
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
3312 |
+
(isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
|
3313 |
+
isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
|
3314 |
+
(isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
|
3315 |
+
(isset($_POST['action']) && $_POST['action'] == 'wilcity_login') || // Exception for login form. From Analysis uid=430898
|
3316 |
+
(isset($_POST['qcfsubmit'])) || //Exception for submit quick forms - duplicates with qcfvalidate
|
3317 |
+
apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') || //Skip Tin Canny plugin
|
3318 |
+
( isset( $_POST['na'], $_POST['ts'], $_POST['nhr'] ) && !apbct_is_in_uri( '?na=s' ) ) || // The Newsletter Plugin double requests fix. Ticket #14772
|
3319 |
+
(isset($_POST['spl_action']) && $_POST['spl_action'] == 'register') || //Skip interal action with empty params
|
3320 |
+
(isset($_POST['action']) && $_POST['action'] == 'bwfan_insert_abandoned_cart' && apbct_is_in_uri( 'my-account/edit-address' )) || //Skip edit account
|
3321 |
+
apbct_is_in_uri('login-1') || //Skip login form
|
3322 |
+
apbct_is_in_uri('recuperacao-de-senha-2') || //Skip form reset password
|
3323 |
+
apbct_is_in_uri('membermouse/api/request.php') && isset($_POST['membership_level_id'],$_POST['apikey'],$_POST['apisecret']) || // Membermouse API
|
3324 |
+
( isset( $_POST['AppKey'] ) && ( isset( $_POST['cbAP'] ) && $_POST['cbAP'] == 'Caspio' ) ) // Caspio exclusion (ticket #16444)
|
3325 |
+
) {
|
3326 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3327 |
+
return null;
|
3328 |
+
}
|
3329 |
+
|
3330 |
+
//Skip woocommerce checkout
|
3331 |
+
if (apbct_is_in_uri('wc-ajax=update_order_review') || apbct_is_in_uri('wc-ajax=checkout') || !empty($_POST['woocommerce_checkout_place_order']) || apbct_is_in_uri('wc-ajax=wc_ppec_start_checkout') || apbct_is_in_referer('wc-ajax=update_order_review')) {
|
3332 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3333 |
+
return null;
|
3334 |
+
}
|
3335 |
+
// Do not execute anti-spam test for logged in users.
|
3336 |
+
if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['protect_logged_in'] != 1) {
|
3337 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3338 |
+
return null;
|
3339 |
+
}
|
3340 |
+
|
3341 |
+
$post_info['comment_type'] = 'feedback_general_contact_form';
|
3342 |
+
|
3343 |
+
$ct_temp_msg_data = ct_get_fields_any($_POST);
|
3344 |
+
|
3345 |
+
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
|
3346 |
+
$sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
|
3347 |
+
$subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
|
3348 |
+
$contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
|
3349 |
+
$message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
|
3350 |
+
if ($subject != '') {
|
3351 |
+
$message = array_merge(array('subject' => $subject), $message);
|
3352 |
+
}
|
3353 |
+
|
3354 |
+
// Skip submission if no data found
|
3355 |
+
if ($sender_email === ''|| !$contact_form) {
|
3356 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3357 |
+
return false;
|
3358 |
+
}
|
3359 |
+
$cleantalk_executed=true;
|
3360 |
+
|
3361 |
+
if(isset($_POST['TellAFriend_Link'])){
|
3362 |
+
$tmp = $_POST['TellAFriend_Link'];
|
3363 |
+
unset($_POST['TellAFriend_Link']);
|
3364 |
+
}
|
3365 |
+
|
3366 |
+
$base_call_result = apbct_base_call(
|
3367 |
+
array(
|
3368 |
+
'message' => $message,
|
3369 |
+
'sender_email' => $sender_email,
|
3370 |
+
'sender_nickname' => $sender_nickname,
|
3371 |
+
'post_info' => $post_info,
|
3372 |
+
'sender_info' => array( 'sender_email' => urlencode( $sender_email ) ),
|
3373 |
+
)
|
3374 |
+
);
|
3375 |
+
|
3376 |
+
if(isset($_POST['TellAFriend_Link'])){
|
3377 |
+
$_POST['TellAFriend_Link']=$tmp;
|
3378 |
+
}
|
3379 |
+
|
3380 |
+
$ct_result = $base_call_result['ct_result'];
|
3381 |
+
if ($ct_result->allow == 0) {
|
3382 |
+
|
3383 |
+
// Recognize contact form an set it's name to $contact_form to use later
|
3384 |
+
$contact_form = null;
|
3385 |
+
foreach($_POST as $param => $value){
|
3386 |
+
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
3387 |
+
$contact_form = 'contact_form_divi_theme';
|
3388 |
+
$contact_form_additional = str_replace('et_pb_contactform_submit', '', $param);
|
3389 |
+
}
|
3390 |
+
if(strpos($param, 'avia_generated_form') === 0){
|
3391 |
+
$contact_form = 'contact_form_enfold_theme';
|
3392 |
+
$contact_form_additional = str_replace('avia_generated_form', '', $param);
|
3393 |
+
}
|
3394 |
+
if(!empty($contact_form))
|
3395 |
+
break;
|
3396 |
+
}
|
3397 |
+
|
3398 |
+
$ajax_call = false;
|
3399 |
+
if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
|
3400 |
+
) {
|
3401 |
+
$ajax_call = true;
|
3402 |
+
}
|
3403 |
+
if ($ajax_call) {
|
3404 |
+
echo $ct_result->comment;
|
3405 |
+
} else {
|
3406 |
+
|
3407 |
+
global $ct_comment;
|
3408 |
+
$ct_comment = $ct_result->comment;
|
3409 |
+
if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add'){
|
3410 |
+
$result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
|
3411 |
+
header("Content-Type: application/json");
|
3412 |
+
print json_encode($result);
|
3413 |
+
die();
|
3414 |
+
|
3415 |
+
}else if(isset($_POST['TellAFriend_email'])){
|
3416 |
+
echo $ct_result->comment;
|
3417 |
+
die();
|
3418 |
+
|
3419 |
+
}else if(isset($_POST['gform_submit'])){ // Gravity forms submission
|
3420 |
+
$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
|
3421 |
+
gform_confirmation_message'>%s</div></div></body></html>",
|
3422 |
+
$ct_result->comment
|
3423 |
+
);
|
3424 |
+
echo $response;
|
3425 |
+
die();
|
3426 |
+
|
3427 |
+
}elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal'){
|
3428 |
+
return $ct_result->comment;
|
3429 |
+
|
3430 |
+
}elseif(isset($_POST['vfb-submit']) && defined('VFB_VERSION')){
|
3431 |
+
wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
|
3432 |
+
// Caldera Contact Forms
|
3433 |
+
}elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
|
3434 |
+
print json_encode("<h3 style='color: red;'><red>".$ct_result->comment);
|
3435 |
+
die();
|
3436 |
+
// Mailster
|
3437 |
+
}elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
|
3438 |
+
$return = array(
|
3439 |
+
'success' => false,
|
3440 |
+
'html' => '<p>' . $ct_result->comment . '</p>',
|
3441 |
+
);
|
3442 |
+
print json_encode($return);
|
3443 |
+
die();
|
3444 |
+
// Divi Theme Contact Form. Using $contact_form
|
3445 |
+
}elseif(!empty($contact_form) && $contact_form == 'contact_form_divi_theme'){
|
3446 |
+
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>";
|
3447 |
+
die();
|
3448 |
+
// Enfold Theme Contact Form. Using $contact_form
|
3449 |
+
}elseif(!empty($contact_form) && $contact_form == 'contact_form_enfold_theme'){
|
3450 |
+
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>";
|
3451 |
+
die();
|
3452 |
+
}else{
|
3453 |
+
ct_die(null, null);
|
3454 |
+
}
|
3455 |
+
}
|
3456 |
+
exit;
|
3457 |
+
}
|
3458 |
+
|
3459 |
+
return null;
|
3460 |
+
}
|
3461 |
+
|
3462 |
+
/**
|
3463 |
+
* General test for any post data
|
3464 |
+
*/
|
3465 |
+
function ct_contact_form_validate_postdata() {
|
3466 |
+
|
3467 |
+
global $apbct, $pagenow,$cleantalk_executed;
|
3468 |
+
|
3469 |
+
// Exclusios common function
|
3470 |
+
if ( apbct_exclusions_check(__FUNCTION__) ) {
|
3471 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3472 |
+
return null;
|
3473 |
+
}
|
3474 |
+
|
3475 |
+
if (@sizeof($_POST)==0 ||
|
3476 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
|
3477 |
+
(isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
3478 |
+
(isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
|
3479 |
+
apbct_is_in_uri('/checkout/') ||
|
3480 |
+
/* WooCommerce Service Requests - skip them */
|
3481 |
+
isset($_GET['wc-ajax']) && (
|
3482 |
+
$_GET['wc-ajax']=='checkout' ||
|
3483 |
+
$_GET['wc-ajax']=='get_refreshed_fragments' ||
|
3484 |
+
$_GET['wc-ajax']=='apply_coupon' ||
|
3485 |
+
$_GET['wc-ajax']=='remove_coupon' ||
|
3486 |
+
$_GET['wc-ajax']=='update_shipping_method' ||
|
3487 |
+
$_GET['wc-ajax']=='get_cart_totals' ||
|
3488 |
+
$_GET['wc-ajax']=='update_order_review' ||
|
3489 |
+
$_GET['wc-ajax']=='add_to_cart' ||
|
3490 |
+
$_GET['wc-ajax']=='remove_from_cart' ||
|
3491 |
+
$_GET['wc-ajax']=='get_variation' ||
|
3492 |
+
$_GET['wc-ajax']=='get_customer_location'
|
3493 |
+
) ||
|
3494 |
+
/* END: WooCommerce Service Requests */
|
3495 |
+
apbct_is_in_uri('/wp-admin/') ||
|
3496 |
+
apbct_is_in_uri('wp-login.php') ||
|
3497 |
+
apbct_is_in_uri('wp-comments-post.php') ||
|
3498 |
+
apbct_is_in_referer('/wp-admin/') ||
|
3499 |
+
apbct_is_in_uri('/login/') ||
|
3500 |
+
apbct_is_in_uri('?provider=facebook&') ||
|
3501 |
+
isset($_GET['ptype']) && $_GET['ptype']=='login' ||
|
3502 |
+
isset($_POST['ct_checkjs_register_form']) ||
|
3503 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
|
3504 |
+
$apbct->settings['general_contact_forms_test']==0 ||
|
3505 |
+
isset($_POST['bbp_topic_content']) ||
|
3506 |
+
isset($_POST['bbp_reply_content']) ||
|
3507 |
+
isset($_POST['fscf_submitted']) ||
|
3508 |
+
isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
|
3509 |
+
apbct_is_in_uri('/wc-api/') ||
|
3510 |
+
(isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
|
3511 |
+
(isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
|
3512 |
+
(isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] == 'Two_Factor_Totp') || //TwoFactor authorization
|
3513 |
+
(isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart
|
3514 |
+
apbct_is_in_uri('/wp-json/wpstatistics/v1/hit') || //WPStatistics
|
3515 |
+
(isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
|
3516 |
+
(isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
|
3517 |
+
isset($_POST['gform_submit']) || //Skip gravity checking because of direct integration
|
3518 |
+
(isset($_POST['lrm_action']) && $_POST['lrm_action'] == 'login') || //Skip login form
|
3519 |
+
apbct_is_in_uri( 'xmlrpc.php?for=jetpack' )
|
3520 |
+
) {
|
3521 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3522 |
+
return null;
|
3523 |
+
}
|
3524 |
+
|
3525 |
+
$message = ct_get_fields_any_postdata($_POST);
|
3526 |
+
|
3527 |
+
// ???
|
3528 |
+
if(strlen(json_encode($message))<10) {
|
3529 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3530 |
+
return null;
|
3531 |
+
}
|
3532 |
+
|
3533 |
+
|
3534 |
+
// Skip if request contains params
|
3535 |
+
$skip_params = array(
|
3536 |
+
'ipn_track_id', // PayPal IPN #
|
3537 |
+
'txn_type', // PayPal transaction type
|
3538 |
+
'payment_status', // PayPal payment status
|
3539 |
+
);
|
3540 |
+
foreach($skip_params as $key=>$value){
|
3541 |
+
if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST)) {
|
3542 |
+
do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
|
3543 |
+
return null;
|
3544 |
+
}
|
3545 |
+
}
|
3546 |
+
|
3547 |
+
$base_call_result = apbct_base_call(
|
3548 |
+
array(
|
3549 |
+
'message' => $message,
|
3550 |
+
'post_info' => array('comment_type' => 'feedback_general_postdata'),
|
3551 |
+
)
|
3552 |
+
);
|
3553 |
+
|
3554 |
+
$cleantalk_executed=true;
|
3555 |
+
|
3556 |
+
$ct_result = $base_call_result['ct_result'];
|
3557 |
+
|
3558 |
+
if ($ct_result->allow == 0) {
|
3559 |
+
|
3560 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
3561 |
+
global $ct_comment;
|
3562 |
+
$ct_comment = $ct_result->comment;
|
3563 |
+
if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
|
3564 |
+
{
|
3565 |
+
$result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
|
3566 |
+
header("Content-Type: application/json");
|
3567 |
+
print json_encode($result);
|
3568 |
+
die();
|
3569 |
+
}
|
3570 |
+
else
|
3571 |
+
{
|
3572 |
+
ct_die(null, null);
|
3573 |
+
}
|
3574 |
+
} else {
|
3575 |
+
echo $ct_result->comment;
|
3576 |
+
}
|
3577 |
+
exit;
|
3578 |
+
}
|
3579 |
+
|
3580 |
+
return null;
|
3581 |
+
}
|
3582 |
+
|
3583 |
+
|
3584 |
+
/**
|
3585 |
+
* Inner function - Finds and returns pattern in string
|
3586 |
+
* @return null|bool
|
3587 |
+
*/
|
3588 |
+
function ct_get_data_from_submit($value = null, $field_name = null) {
|
3589 |
+
if (!$value || !$field_name || !is_string($value)) {
|
3590 |
+
return false;
|
3591 |
+
}
|
3592 |
+
if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
|
3593 |
+
return true;
|
3594 |
+
}
|
3595 |
+
}
|
3596 |
+
|
3597 |
+
/**
|
3598 |
+
* Sends error notice to admin
|
3599 |
+
* @return null
|
3600 |
+
*/
|
3601 |
+
function ct_send_error_notice ($comment = '') {
|
3602 |
+
global $ct_admin_notoice_period, $apbct;
|
3603 |
+
|
3604 |
+
$timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
|
3605 |
+
if(time() - $ct_admin_notoice_period > $timelabel_reg){
|
3606 |
+
update_option('cleantalk_timelabel_reg', time());
|
3607 |
+
|
3608 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
3609 |
+
$message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
|
3610 |
+
$message .= sprintf(__('"%s" plugin error on your site "%s":', 'cleantalk'), $apbct->plugin_name, $blogname) . "\r\n\r\n";
|
3611 |
+
$message .= preg_replace('/^(.*?)<a.*?"(.*?)".*?>(.*?)<.a>(.*)$/', '$1. $3: $2?user_token='. $apbct->user_token .' $4', $comment) . "\r\n\r\n";
|
3612 |
+
@wp_mail(ct_get_admin_email(), sprintf(__('[%s] "%s" error!', 'cleantalk'), $apbct->plugin_name, $blogname), $message);
|
3613 |
+
}
|
3614 |
+
|
3615 |
+
return null;
|
3616 |
+
}
|
3617 |
+
|
3618 |
+
function ct_print_form($arr, $k)
|
3619 |
+
{
|
3620 |
+
foreach($arr as $key => $value){
|
3621 |
+
if(!is_array($value)){
|
3622 |
+
if($k == ''){
|
3623 |
+
print '<textarea name="' . $key . '" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
|
3624 |
+
}else{
|
3625 |
+
print '<textarea name="' . $k . '[' . $key . ']" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
|
3626 |
+
}
|
3627 |
+
}else{
|
3628 |
+
if($k == ''){
|
3629 |
+
ct_print_form($value, $key);
|
3630 |
+
}else{
|
3631 |
+
ct_print_form($value, $k . '[' . $key . ']');
|
3632 |
+
}
|
3633 |
+
}
|
3634 |
+
}
|
3635 |
+
}
|
3636 |
+
|
3637 |
+
/**
|
3638 |
+
* Attaches public scripts and styles.
|
3639 |
+
*/
|
3640 |
+
function ct_enqueue_scripts_public($hook){
|
3641 |
+
|
3642 |
+
global $current_user, $apbct;
|
3643 |
+
|
3644 |
+
if (apbct_exclusions_check__url()) {
|
3645 |
+
return;
|
3646 |
+
}
|
3647 |
+
|
3648 |
+
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']){
|
3649 |
+
|
3650 |
+
if( ! $apbct->public_script_loaded ) {
|
3651 |
+
|
3652 |
+
// Differnt JS params
|
3653 |
+
wp_enqueue_script( 'ct_public', APBCT_URL_PATH . '/js/apbct-public.min.js', array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
|
3654 |
+
wp_enqueue_script( 'ct_common_js_funcs', APBCT_URL_PATH . '/js/apbct-common.min.js', array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
|
3655 |
+
|
3656 |
+
wp_localize_script( 'ct_common_js_funcs', 'ctCommon', array(
|
3657 |
+
'_ajax_nonce' => wp_create_nonce( 'ct_secret_stuff' ),
|
3658 |
+
'_ajax_url' => admin_url( 'admin-ajax.php' ),
|
3659 |
+
) );
|
3660 |
+
}
|
3661 |
+
|
3662 |
+
// GDPR script
|
3663 |
+
if($apbct->settings['gdpr_enabled']){
|
3664 |
+
|
3665 |
+
wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.min.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
|
3666 |
+
|
3667 |
+
wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
|
3668 |
+
'gdpr_forms' => array(),
|
3669 |
+
'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'),
|
3670 |
+
));
|
3671 |
+
}
|
3672 |
+
|
3673 |
+
}
|
3674 |
+
|
3675 |
+
if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
|
3676 |
+
if($apbct->settings['use_ajax'] && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl')){
|
3677 |
+
if( ! apbct_is_in_uri('jm-ajax') ){
|
3678 |
+
|
3679 |
+
// Use AJAX for JavaScript check
|
3680 |
+
if($apbct->settings['use_ajax']){
|
3681 |
+
|
3682 |
+
wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
|
3683 |
+
|
3684 |
+
wp_localize_script('ct_nocache', 'ctNocache', array(
|
3685 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
3686 |
+
'info_flag' => $apbct->settings['collect_details'] && $apbct->settings['set_cookies'] ? true : false,
|
3687 |
+
'set_cookies_flag' => $apbct->settings['set_cookies'] ? false : true,
|
3688 |
+
'blog_home' => get_home_url().'/',
|
3689 |
+
));
|
3690 |
+
}
|
3691 |
+
|
3692 |
+
// External forms check
|
3693 |
+
if($apbct->settings['check_external'])
|
3694 |
+
wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3695 |
+
|
3696 |
+
// Internal forms check
|
3697 |
+
if($apbct->settings['check_internal'])
|
3698 |
+
wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3699 |
+
|
3700 |
+
}
|
3701 |
+
}
|
3702 |
+
}
|
3703 |
+
|
3704 |
+
// Show controls for commentaries
|
3705 |
+
if(in_array("administrator", $current_user->roles)){
|
3706 |
+
|
3707 |
+
if($apbct->settings['manage_comments_on_public_page']){
|
3708 |
+
|
3709 |
+
$ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
|
3710 |
+
|
3711 |
+
wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'), array(), APBCT_VERSION, 'all');
|
3712 |
+
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*/);
|
3713 |
+
|
3714 |
+
wp_localize_script('ct_public_admin_js', 'ctPublicAdmin', array(
|
3715 |
+
'ct_ajax_nonce' => $ajax_nonce,
|
3716 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
3717 |
+
'ct_feedback_error' => __('Error occurred while sending feedback.', 'cleantalk'),
|
3718 |
+
'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk'),
|
3719 |
+
'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>" : ''),
|
3720 |
+
));
|
3721 |
+
|
3722 |
+
}
|
3723 |
+
}
|
3724 |
+
|
3725 |
+
// Debug
|
3726 |
+
if($apbct->settings['debug_ajax']){
|
3727 |
+
wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
|
3728 |
+
|
3729 |
+
wp_localize_script('ct_debug_js', 'apbctDebug', array(
|
3730 |
+
'reload' => false,
|
3731 |
+
'reload_time' => 10000,
|
3732 |
+
));
|
3733 |
+
}
|
3734 |
+
}
|
3735 |
+
|
3736 |
+
/**
|
3737 |
+
* Reassign callbackback function for the bootom of comment output.
|
3738 |
+
*/
|
3739 |
+
function ct_wp_list_comments_args($options){
|
3740 |
+
|
3741 |
+
global $current_user, $apbct;
|
3742 |
+
|
3743 |
+
if(in_array("administrator", $current_user->roles)){
|
3744 |
+
if($apbct->settings['manage_comments_on_public_page']) {
|
3745 |
+
$theme = wp_get_theme();
|
3746 |
+
$apbct->active_theme = $theme->get( 'Name' );
|
3747 |
+
$options['end-callback'] = 'ct_comments_output';
|
3748 |
+
}
|
3749 |
+
}
|
3750 |
+
|
3751 |
+
return $options;
|
3752 |
+
}
|
3753 |
+
|
3754 |
+
/**
|
3755 |
+
* Callback function for the bootom comment output.
|
3756 |
+
*/
|
3757 |
+
function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
|
3758 |
+
|
3759 |
+
global $apbct;
|
3760 |
+
|
3761 |
+
$email = $curr_comment->comment_author_email;
|
3762 |
+
$ip = $curr_comment->comment_author_IP;
|
3763 |
+
$id = $curr_comment->comment_ID;
|
3764 |
+
|
3765 |
+
$settings_link = '/wp-admin/'.(is_network_admin() ? "settings.php?page=cleantalk" : "options-general.php?page=cleantalk");
|
3766 |
+
|
3767 |
+
echo "<div class='ct_comment_info'><div class ='ct_comment_titles'>";
|
3768 |
+
echo "<p class='ct_comment_info_title'>".__('Sender info', 'cleantalk')."</p>";
|
3769 |
+
|
3770 |
+
echo "<p class='ct_comment_logo_title'>
|
3771 |
+
".__('by', 'cleantalk')
|
3772 |
+
." <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='".plugins_url()."/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
|
3773 |
+
." <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
|
3774 |
+
."</p></div>";
|
3775 |
+
// Outputs email if exists
|
3776 |
+
if($email)
|
3777 |
+
echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
|
3778 |
+
."$email"
|
3779 |
+
." <img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
|
3780 |
+
."</a>";
|
3781 |
+
else
|
3782 |
+
echo __('No email', 'cleantalk');
|
3783 |
+
echo " | ";
|
3784 |
+
|
3785 |
+
// Outputs IP if exists
|
3786 |
+
if($ip)
|
3787 |
+
echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
|
3788 |
+
."$ip"
|
3789 |
+
." <img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
|
3790 |
+
."</a>";
|
3791 |
+
else
|
3792 |
+
echo __('No IP', 'cleantalk');
|
3793 |
+
echo ' | ';
|
3794 |
+
|
3795 |
+
echo "<span commentid='$id' class='ct_this_is ct_this_is_spam' href='#'>".__('Mark as spam', 'cleantalk')."</span>";
|
3796 |
+
echo "<span commentid='$id' class='ct_this_is ct_this_is_not_spam ct_hidden' href='#'>".__('Unspam', 'cleantalk')."</span>";
|
3797 |
+
echo "<p class='ct_feedback_wrap'>";
|
3798 |
+
echo "<span class='ct_feedback_result ct_feedback_result_spam'>".__('Marked as spam.', 'cleantalk')."</span>";
|
3799 |
+
echo "<span class='ct_feedback_result ct_feedback_result_not_spam'>".__('Marked as not spam.', 'cleantalk')."</span>";
|
3800 |
+
echo " <span class='ct_feedback_msg'><span>";
|
3801 |
+
echo "</p>";
|
3802 |
+
|
3803 |
+
echo "</div>";
|
3804 |
+
|
3805 |
+
// @todo research what such themes and make exception for them
|
3806 |
+
$ending_tag = $wp_list_comments_args['style'];
|
3807 |
+
if( in_array( $apbct->active_theme, array( 'Paperio', 'Twenty Twenty' ) ) ){
|
3808 |
+
$ending_tag = is_null($wp_list_comments_args['style']) ? 'div' : $wp_list_comments_args['style'];
|
3809 |
+
};
|
3810 |
+
|
3811 |
+
// Ending comment output
|
3812 |
+
echo "</{$ending_tag}>";
|
3813 |
+
}
|
3814 |
+
|
3815 |
+
/**
|
3816 |
+
* Callback function for the bootom comment output.
|
3817 |
+
*
|
3818 |
+
* attrs = array()
|
3819 |
+
*/
|
3820 |
+
function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
|
3821 |
+
|
3822 |
+
$out = '';
|
3823 |
+
|
3824 |
+
if(isset($attrs['id']))
|
3825 |
+
$out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
|
3826 |
+
|
3827 |
+
if(isset($attrs['text']))
|
3828 |
+
$out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
|
3829 |
+
|
3830 |
+
$out = '<script>'.$out.'</script>';
|
3831 |
+
return $out;
|
3832 |
+
}
|
3833 |
+
|
3834 |
+
/**
|
3835 |
+
* Filters the 'status' array before register the user
|
3836 |
+
* using only by WICITY theme
|
3837 |
+
*
|
3838 |
+
* @param $success array array( 'status' => 'success' )
|
3839 |
+
* @param $data array ['username'] ['password'] ['email']
|
3840 |
+
* @return array array( 'status' => 'error' ) or array( 'status' => 'success' ) by default
|
3841 |
+
*/
|
3842 |
+
function apbct_wilcity_reg_validation( $success, $data ) {
|
3843 |
+
$check = ct_test_registration( $data['username'], $data['email'], '' );
|
3844 |
+
if( $check['allow'] == 0 ) {
|
3845 |
+
return array( 'status' => 'error' );
|
3846 |
+
}
|
3847 |
+
return $success;
|
3848 |
+
}
|
inc/cleantalk-settings.php
CHANGED
@@ -1,1528 +1,1541 @@
|
|
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 |
-
'search_test' => array(
|
133 |
-
'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
|
134 |
-
'description' => __('Spam protection for Search form.', 'cleantalk')
|
135 |
-
. (!$apbct->white_label || is_main_site()
|
136 |
-
? sprintf(__('Read more about %sspam protection for Search form%s on our blog. “noindex” tag will be placed in meta derictive on search page.', 'cleantalk'),
|
137 |
-
'<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
|
138 |
-
'</a>'
|
139 |
-
)
|
140 |
-
: ''
|
141 |
-
)
|
142 |
-
),
|
143 |
-
'check_external' => array(
|
144 |
-
'title' => __('Protect external forms', 'cleantalk'),
|
145 |
-
'description' => __('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'),
|
146 |
-
'childrens' => array('check_external__capture_buffer'),
|
147 |
-
),
|
148 |
-
'check_external__capture_buffer' => array(
|
149 |
-
'title' => __('Capture buffer', 'cleantalk'),
|
150 |
-
'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'),
|
151 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
152 |
-
'parent' => 'check_external',
|
153 |
-
),
|
154 |
-
'check_internal' => array(
|
155 |
-
'title' => __('Protect internal forms', 'cleantalk'),
|
156 |
-
'description' => __('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'),
|
157 |
-
),
|
158 |
-
),
|
159 |
-
),
|
160 |
-
|
161 |
-
// Comments and Messages
|
162 |
-
'wc' => array(
|
163 |
-
'title' => __('WooCommerce', 'cleantalk'),
|
164 |
-
'fields' => array(
|
165 |
-
'wc_checkout_test' => array(
|
166 |
-
'title' => __('WooCommerce checkout form', 'cleantalk'),
|
167 |
-
'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk'),
|
168 |
-
'childrens' => array('wc_register_from_order')
|
169 |
-
),
|
170 |
-
'wc_register_from_order' => array(
|
171 |
-
'title' => __('Spam test for registration during checkout', 'cleantalk'),
|
172 |
-
'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk'),
|
173 |
-
'parent' => 'wc_checkout_test',
|
174 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
175 |
-
'reverse_trigger' => true
|
176 |
-
),
|
177 |
-
),
|
178 |
-
),
|
179 |
-
|
180 |
-
// Comments and Messages
|
181 |
-
'comments_and_messages' => array(
|
182 |
-
'title' => __('Comments and Messages', 'cleantalk'),
|
183 |
-
'fields' => array(
|
184 |
-
'disable_comments__all' => array(
|
185 |
-
'title' => __( 'Disable all comments', 'cleantalk' ),
|
186 |
-
'description' => __( 'Disabling comments for all types of content.', 'cleantalk' ),
|
187 |
-
'childrens' => array(
|
188 |
-
'disable_comments__posts',
|
189 |
-
'disable_comments__pages',
|
190 |
-
'disable_comments__media',
|
191 |
-
),
|
192 |
-
'options' => array(
|
193 |
-
array( 'val' => 1, 'label' => __( 'On' ), 'childrens_enable' => 0, ),
|
194 |
-
array( 'val' => 0, 'label' => __( 'Off' ), 'childrens_enable' => 1, ),
|
195 |
-
),
|
196 |
-
),
|
197 |
-
'disable_comments__posts' => array(
|
198 |
-
'title' => __( 'Disable comments for all posts', 'cleantalk' ),
|
199 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
200 |
-
'parent' => 'disable_comments__all',
|
201 |
-
'reverse_trigger' => true,
|
202 |
-
),
|
203 |
-
'disable_comments__pages' => array(
|
204 |
-
'title' => __( 'Disable comments for all pages', 'cleantalk' ),
|
205 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
206 |
-
'parent' => 'disable_comments__all',
|
207 |
-
'reverse_trigger' => true,
|
208 |
-
),
|
209 |
-
'disable_comments__media' => array(
|
210 |
-
'title' => __( 'Disable comments for all media', 'cleantalk' ),
|
211 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
212 |
-
'parent' => 'disable_comments__all',
|
213 |
-
'reverse_trigger' => true,
|
214 |
-
),
|
215 |
-
'bp_private_messages' => array(
|
216 |
-
'title' => __('BuddyPress Private Messages', 'cleantalk'),
|
217 |
-
'description' => __('Check buddyPress private messages.', 'cleantalk'),
|
218 |
-
),
|
219 |
-
'remove_old_spam' => array(
|
220 |
-
'title' => __('Automatically delete spam comments', 'cleantalk'),
|
221 |
-
'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
|
222 |
-
),
|
223 |
-
'remove_comments_links' => array(
|
224 |
-
'title' => __('Remove links from approved comments', 'cleantalk'),
|
225 |
-
'description' => __('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'),
|
226 |
-
),
|
227 |
-
'show_check_links' => array(
|
228 |
-
'title' => __('Show links to check Emails, IPs for spam', 'cleantalk'),
|
229 |
-
'description' => __('Shows little icon near IP addresses and Emails allowing you to check it via CleanTalk\'s database.', 'cleantalk'),
|
230 |
-
'display' => !$apbct->white_label,
|
231 |
-
),
|
232 |
-
'manage_comments_on_public_page' => array(
|
233 |
-
'title' => __('Manage comments on public pages', 'cleantalk'),
|
234 |
-
'description' => __('Allows administrators to manage comments on public post\'s pages with small interactive menu.', 'cleantalk'),
|
235 |
-
'display' => !$apbct->white_label,
|
236 |
-
),
|
237 |
-
),
|
238 |
-
),
|
239 |
-
|
240 |
-
// Data Processing
|
241 |
-
'data_processing' => array(
|
242 |
-
'title' => __('Data Processing', 'cleantalk'),
|
243 |
-
'fields' => array(
|
244 |
-
'protect_logged_in' => array(
|
245 |
-
'title' => __("Protect logged in Users", 'cleantalk'),
|
246 |
-
'description' => __('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk'),
|
247 |
-
),
|
248 |
-
'check_comments_number' => array(
|
249 |
-
'title' => __("Don't check trusted user's comments", 'cleantalk'),
|
250 |
-
'description' => sprintf(__("Don't check comments for users with above %d comments.", 'cleantalk'), defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3),
|
251 |
-
),
|
252 |
-
'use_ajax' => array(
|
253 |
-
'title' => __('Use AJAX for JavaScript check', 'cleantalk'),
|
254 |
-
'description' => __('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'),
|
255 |
-
),
|
256 |
-
'use_static_js_key' => array(
|
257 |
-
'title' => __('Use static keys for JS check.', 'cleantalk'),
|
258 |
-
'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'),
|
259 |
-
'options' => array(
|
260 |
-
array('val' => 1, 'label' => __('On'), ),
|
261 |
-
array('val' => 0, 'label' => __('Off'), ),
|
262 |
-
array('val' => -1, 'label' => __('Auto'),),
|
263 |
-
),
|
264 |
-
),
|
265 |
-
'general_postdata_test' => array(
|
266 |
-
'title' => __('Check all post data', 'cleantalk'),
|
267 |
-
'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
|
268 |
-
.(!$apbct->white_label
|
269 |
-
? __(' 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>.'
|
270 |
-
: ''
|
271 |
-
)
|
272 |
-
.'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'),
|
273 |
-
),
|
274 |
-
'set_cookies' => array(
|
275 |
-
'title' => __("Set cookies", 'cleantalk'),
|
276 |
-
'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'),
|
277 |
-
'childrens' => array('set_cookies__sessions'),
|
278 |
-
),
|
279 |
-
'set_cookies__sessions' => array(
|
280 |
-
'title' => __('Use alternative mechanism for cookies', 'cleantalk'),
|
281 |
-
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
282 |
-
'parent' => 'set_cookies',
|
283 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
284 |
-
),
|
285 |
-
'ssl_on' => array(
|
286 |
-
'title' => __("Use SSL", 'cleantalk'),
|
287 |
-
'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
|
288 |
-
),
|
289 |
-
'use_buitin_http_api' => array(
|
290 |
-
'title' => __("Use Wordpress HTTP API", 'cleantalk'),
|
291 |
-
'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
|
292 |
-
),
|
293 |
-
),
|
294 |
-
),
|
295 |
-
|
296 |
-
// Exclusions
|
297 |
-
'exclusions' => array(
|
298 |
-
'title' => __('Exclusions', 'cleantalk'),
|
299 |
-
'fields' => array(
|
300 |
-
'exclusions__urls' => array(
|
301 |
-
'type' => 'text',
|
302 |
-
'title' => __('URL exclusions', 'cleantalk'),
|
303 |
-
'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
|
304 |
-
),
|
305 |
-
'exclusions__urls__use_regexp' => array(
|
306 |
-
'type' => 'checkbox',
|
307 |
-
'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
|
308 |
-
),
|
309 |
-
'exclusions__fields' => array(
|
310 |
-
'type' => 'text',
|
311 |
-
'title' => __('Field name exclusions', 'cleantalk'),
|
312 |
-
'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
|
313 |
-
),
|
314 |
-
'exclusions__fields__use_regexp' => array(
|
315 |
-
'type' => 'checkbox',
|
316 |
-
'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
|
317 |
-
),
|
318 |
-
'exclusions__roles' => array(
|
319 |
-
'type' => 'select',
|
320 |
-
'multiple' => true,
|
321 |
-
'options_callback' => 'apbct_get_all_roles',
|
322 |
-
'options_callback_params' => array(true),
|
323 |
-
'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
|
324 |
-
),
|
325 |
-
),
|
326 |
-
),
|
327 |
-
|
328 |
-
// Admin bar
|
329 |
-
'admin_bar' => array(
|
330 |
-
'title' => __('Admin bar', 'cleantalk'),
|
331 |
-
'default_params' => array(),
|
332 |
-
'description' => '',
|
333 |
-
'html_before' => '',
|
334 |
-
'html_after' => '',
|
335 |
-
'fields' => array(
|
336 |
-
'show_adminbar' => array(
|
337 |
-
'title' => __('Show statistics in admin bar', 'cleantalk'),
|
338 |
-
'description' => __('Show/hide icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'),
|
339 |
-
'childrens' => array('all_time_counter','daily_counter','sfw_counter'),
|
340 |
-
),
|
341 |
-
'all_time_counter' => array(
|
342 |
-
'title' => __('Show All-time counter', 'cleantalk'),
|
343 |
-
'description' => __('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
344 |
-
'parent' => 'show_adminbar',
|
345 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
346 |
-
),
|
347 |
-
'daily_counter' => array(
|
348 |
-
'title' => __('Show 24 hours counter', 'cleantalk'),
|
349 |
-
'description' => __('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'),
|
350 |
-
'parent' => 'show_adminbar',
|
351 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
352 |
-
),
|
353 |
-
'sfw_counter' => array(
|
354 |
-
'title' => __('SpamFireWall counter', 'cleantalk'),
|
355 |
-
'description' => __('Display SpamFireWall requests in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
356 |
-
'parent' => 'show_adminbar',
|
357 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
358 |
-
),
|
359 |
-
),
|
360 |
-
),
|
361 |
-
|
362 |
-
// Misc
|
363 |
-
'misc' => array(
|
364 |
-
'html_after' => '</div><br>',
|
365 |
-
'fields' => array(
|
366 |
-
'collect_details' => array(
|
367 |
-
'type' => 'checkbox',
|
368 |
-
'title' => __('Collect details about browsers', 'cleantalk'),
|
369 |
-
'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'),
|
370 |
-
),
|
371 |
-
'send_connection_reports' => array(
|
372 |
-
'type' => 'checkbox',
|
373 |
-
'title' => __('Send connection reports', 'cleantalk'),
|
374 |
-
'description' => __("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'),
|
375 |
-
),
|
376 |
-
'async_js' => array(
|
377 |
-
'type' => 'checkbox',
|
378 |
-
'title' => __('Async JavaScript loading', 'cleantalk'),
|
379 |
-
'description' => __('Use async loading for scripts. Warning: This could reduce filtration quality.', 'cleantalk'),
|
380 |
-
),
|
381 |
-
'gdpr_enabled' => array(
|
382 |
-
'type' => 'checkbox',
|
383 |
-
'title' => __('Allow to add GDPR notice via shortcode', 'cleantalk'),
|
384 |
-
'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'),
|
385 |
-
'childrens' => array('gdpr_text'),
|
386 |
-
),
|
387 |
-
'gdpr_text' => array(
|
388 |
-
'type' => 'text',
|
389 |
-
'title' => __('GDPR text notice', 'cleantalk'),
|
390 |
-
'description' => __('This text will be added as a description to the GDPR checkbox.', 'cleantalk'),
|
391 |
-
'parent' => 'gdpr_enabled',
|
392 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
393 |
-
),
|
394 |
-
'store_urls' => array(
|
395 |
-
'type' => 'checkbox',
|
396 |
-
'title' => __('Store visited URLs', 'cleantalk'),
|
397 |
-
'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'),
|
398 |
-
'childrens' => array('store_urls__sessions'),
|
399 |
-
),
|
400 |
-
'store_urls__sessions' => array(
|
401 |
-
'type' => 'checkbox',
|
402 |
-
'title' => __('Use cookies less sessions', 'cleantalk'),
|
403 |
-
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
404 |
-
'parent' => 'store_urls',
|
405 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
406 |
-
),
|
407 |
-
'comment_notify' => array(
|
408 |
-
'type' => 'checkbox',
|
409 |
-
'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
|
410 |
-
'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
|
411 |
-
'childrens' => array('comment_notify__roles'),
|
412 |
-
),
|
413 |
-
'comment_notify__roles' => array(
|
414 |
-
'type' => 'select',
|
415 |
-
'multiple' => true,
|
416 |
-
'parent' => 'comment_notify',
|
417 |
-
'options_callback' => 'apbct_get_all_roles',
|
418 |
-
'options_callback_params' => array(true),
|
419 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
420 |
-
),
|
421 |
-
'complete_deactivation' => array(
|
422 |
-
'type' => 'checkbox',
|
423 |
-
'title' => __('Complete deactivation', 'cleantalk'),
|
424 |
-
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
425 |
-
),
|
426 |
-
|
427 |
-
),
|
428 |
-
),
|
429 |
-
);
|
430 |
-
|
431 |
-
return $fields;
|
432 |
-
}
|
433 |
-
|
434 |
-
function apbct_settings__set_fileds__network( $fields ){
|
435 |
-
global $apbct;
|
436 |
-
$additional_fields = array(
|
437 |
-
'main' => array(
|
438 |
-
'fields' => array(
|
439 |
-
'white_label' => array(
|
440 |
-
'type' => 'checkbox',
|
441 |
-
'title' => __('Enable White Label Mode', 'cleantalk'),
|
442 |
-
'description' => sprintf(__("Learn more information %shere%s.", 'cleantalk'), '<a target="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">', '</a>'),
|
443 |
-
'childrens' => array( 'white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key', ),
|
444 |
-
'disabled' => defined('CLEANTALK_ACCESS_KEY'),
|
445 |
-
'network' => true,
|
446 |
-
),
|
447 |
-
'white_label__hoster_key' => array(
|
448 |
-
'title' => __('Hoster API Key', 'cleantalk'),
|
449 |
-
'description' => sprintf(__("You can get it in %sCleantalk's Control Panel%s", 'cleantalk'), '<a target="_blank" href="https://cleantalk.org/my/profile">', '</a>'),
|
450 |
-
'type' => 'text',
|
451 |
-
'parent' => 'white_label',
|
452 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
453 |
-
'network' => true,
|
454 |
-
'required' => true,
|
455 |
-
),
|
456 |
-
'white_label__plugin_name' => array(
|
457 |
-
'title' => __('Plugin name', 'cleantalk'),
|
458 |
-
'description' => sprintf(__("Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s", 'cleantalk'), '<b>', '</b>'),
|
459 |
-
'type' => 'text',
|
460 |
-
'parent' => 'white_label',
|
461 |
-
'class' => 'apbct_settings-field_wrapper--sub',
|
462 |
-
'network' => true,
|
463 |
-
'required' => true,
|
464 |
-
),
|
465 |
-
'allow_custom_key' => array(
|
466 |
-
'type' => 'checkbox',
|
467 |
-
'title' => __('Allow users to use other key', 'cleantalk'),
|
468 |
-
'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
|
469 |
-
. (defined('CLEANTALK_ACCESS_KEY')
|
470 |
-
? ' <span style="color: red">'
|
471 |
-
. __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
|
472 |
-
. '<br>'
|
473 |
-
. __('You are not able to use white label mode while <b>CLEANTALK_ACCESS_KEY</b> is defined.', 'cleantalk')
|
474 |
-
. '</span>'
|
475 |
-
: ''
|
476 |
-
),
|
477 |
-
'display' => APBCT_WPMS && is_main_site(),
|
478 |
-
'disabled' => $apbct->network_settings['white_label'],
|
479 |
-
'network' => true,
|
480 |
-
),
|
481 |
-
'allow_custom_settings' => array(
|
482 |
-
'type' => 'checkbox',
|
483 |
-
'title' => __('Allow users to manage plugin settings', 'cleantalk'),
|
484 |
-
'description' => __('Allow to change settings on child sites.', 'cleantalk'),
|
485 |
-
'display' => APBCT_WPMS && is_main_site(),
|
486 |
-
'network' => true,
|
487 |
-
),
|
488 |
-
)
|
489 |
-
)
|
490 |
-
);
|
491 |
-
|
492 |
-
$fields = array_merge_recursive($fields, $additional_fields);
|
493 |
-
|
494 |
-
return $fields;
|
495 |
-
|
496 |
-
}
|
497 |
-
|
498 |
-
function apbct_settings__add_groups_and_fields( $fields ){
|
499 |
-
|
500 |
-
global $apbct;
|
501 |
-
|
502 |
-
$apbct->settings_fields_in_groups = $fields;
|
503 |
-
|
504 |
-
$field_default_params = array(
|
505 |
-
'callback' => 'apbct_settings__field__draw',
|
506 |
-
'type' => 'radio',
|
507 |
-
'options' => array(
|
508 |
-
array('val' => 1, 'label' => __('On'), 'childrens_enable' => 1, ),
|
509 |
-
array('val' => 0, 'label' => __('Off'), 'childrens_enable' => 0, ),
|
510 |
-
),
|
511 |
-
'def_class' => 'apbct_settings-field_wrapper',
|
512 |
-
'class' => '',
|
513 |
-
'parent' => '',
|
514 |
-
'childrens' => array(),
|
515 |
-
'hide' => array(),
|
516 |
-
// 'title' => 'Default title',
|
517 |
-
// 'description' => 'Default description',
|
518 |
-
'display' => true, // Draw settings or not
|
519 |
-
'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
|
520 |
-
'multiple' => false,
|
521 |
-
'description' => '',
|
522 |
-
'network' => false,
|
523 |
-
'disabled' => false,
|
524 |
-
'required' => false,
|
525 |
-
);
|
526 |
-
|
527 |
-
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
528 |
-
|
529 |
-
add_settings_section('apbct_section__'.$group_name, '', 'apbct_section__'.$group_name, 'cleantalk');
|
530 |
-
|
531 |
-
foreach($group['fields'] as $field_name => $field){
|
532 |
-
|
533 |
-
// Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
|
534 |
-
if(!empty($field['options_callback'])){
|
535 |
-
$options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
|
536 |
-
foreach ($options as &$option){
|
537 |
-
$option = array('val' => $option, 'label' => $option);
|
538 |
-
} unset($option);
|
539 |
-
$field['options'] = $options;
|
540 |
-
}
|
541 |
-
|
542 |
-
$params = !empty($group['default_params'])
|
543 |
-
? array_merge($group['default_params'], $field)
|
544 |
-
: array_merge($field_default_params, $field);
|
545 |
-
|
546 |
-
$params['name'] = $field_name;
|
547 |
-
|
548 |
-
if(!$params['display'])
|
549 |
-
continue;
|
550 |
-
|
551 |
-
add_settings_field(
|
552 |
-
'apbct_field__'.$field_name,
|
553 |
-
'',
|
554 |
-
$params['callback'],
|
555 |
-
'cleantalk',
|
556 |
-
'apbct_section__'.$group_name,
|
557 |
-
$params
|
558 |
-
);
|
559 |
-
|
560 |
-
}
|
561 |
-
}
|
562 |
-
}
|
563 |
-
|
564 |
-
/**
|
565 |
-
* Admin callback function - Displays plugin options page
|
566 |
-
*/
|
567 |
-
function apbct_settings__display() {
|
568 |
-
|
569 |
-
global $apbct;
|
570 |
-
|
571 |
-
// Title
|
572 |
-
echo '<h2 class="apbct_settings-title">'.__($apbct->plugin_name, 'cleantalk').'</h2>';
|
573 |
-
|
574 |
-
// Subtitle for IP license
|
575 |
-
if($apbct->moderate_ip)
|
576 |
-
echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
|
577 |
-
|
578 |
-
echo '<form action="options.php" method="post">';
|
579 |
-
|
580 |
-
apbct_settings__error__output();
|
581 |
-
|
582 |
-
// Top info
|
583 |
-
if(!$apbct->white_label){
|
584 |
-
echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; background: #f1f1f1;">';
|
585 |
-
|
586 |
-
echo __('CleanTalk\'s tech support:', 'cleantalk')
|
587 |
-
.' '
|
588 |
-
.'<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
|
589 |
-
// .' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
|
590 |
-
// .($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').
|
591 |
-
.'<br>';
|
592 |
-
echo __('Plugin Homepage at', 'cleantalk').' <a href="https://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
|
593 |
-
echo '<span id="apbct_gdpr_open_modal" style="text-decoration: underline;">'.__('GDPR compliance', 'cleantalk').'</span><br/>';
|
594 |
-
echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
|
595 |
-
echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br/>';
|
596 |
-
if($apbct->key_is_ok)
|
597 |
-
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 />';
|
598 |
-
apbct_admin__badge__get_premium();
|
599 |
-
echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
|
600 |
-
apbct_settings_show_gdpr_text('print');
|
601 |
-
echo '</div>';
|
602 |
-
echo '</div>';
|
603 |
-
}
|
604 |
-
|
605 |
-
// Output spam count
|
606 |
-
if($apbct->key_is_ok && apbct_api_key__is_correct()){
|
607 |
-
if($apbct->spam_count > 0){
|
608 |
-
echo '<div class="apbct_settings-subtitle" style="top: 0; margin-bottom: 10px; width: 200px;">'
|
609 |
-
.'<br>'
|
610 |
-
.'<span>'
|
611 |
-
.sprintf(
|
612 |
-
__( '%s has blocked <b>%s</b> spam.', 'cleantalk' ),
|
613 |
-
$apbct->plugin_name,
|
614 |
-
number_format($apbct->spam_count, 0, ',', ' ')
|
615 |
-
)
|
616 |
-
.'</span>'
|
617 |
-
.'<br>'
|
618 |
-
.'<br>'
|
619 |
-
.'</div>';
|
620 |
-
}
|
621 |
-
if(!$apbct->white_label){
|
622 |
-
// CP button
|
623 |
-
echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
|
624 |
-
.__('Click here to get anti-spam statistics', 'cleantalk')
|
625 |
-
.'</a>';
|
626 |
-
echo ' ';
|
627 |
-
// Support button
|
628 |
-
echo '<a class="cleantalk_link cleantalk_link-auto" target="__blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>';
|
629 |
-
echo '<br>'
|
630 |
-
.'<br>';
|
631 |
-
}
|
632 |
-
}
|
633 |
-
|
634 |
-
settings_fields('cleantalk_settings');
|
635 |
-
do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
|
636 |
-
|
637 |
-
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
638 |
-
|
639 |
-
echo !empty($group['html_before']) ? $group['html_before'] : '';
|
640 |
-
echo !empty($group['title']) ? '<h3 style="margin-left: 220px;">'.$group['title'].'</h3>' : '';
|
641 |
-
|
642 |
-
do_settings_fields('cleantalk', 'apbct_section__'.$group_name);
|
643 |
-
|
644 |
-
echo !empty($group['html_after']) ? $group['html_after'] : '';
|
645 |
-
|
646 |
-
}
|
647 |
-
|
648 |
-
echo '<br>';
|
649 |
-
echo '<button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'.__('Save Changes').'</button>';
|
650 |
-
|
651 |
-
echo "</form>";
|
652 |
-
|
653 |
-
if(!$apbct->white_label){
|
654 |
-
// Translate banner for non EN locale
|
655 |
-
if(substr(get_locale(), 0, 2) != 'en'){
|
656 |
-
global $ct_translate_banner_template;
|
657 |
-
require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
|
658 |
-
printf($ct_translate_banner_template, substr(get_locale(), 0, 2));
|
659 |
-
}
|
660 |
-
}
|
661 |
-
}
|
662 |
-
|
663 |
-
function apbct_settings__display__network(){
|
664 |
-
// If it's network admin dashboard
|
665 |
-
if(is_network_admin()){
|
666 |
-
$site_url = get_site_option('siteurl');
|
667 |
-
$site_url = preg_match( '/\/$/', $site_url ) ? $site_url : $site_url . '/';
|
668 |
-
$link = $site_url . 'wp-admin/options-general.php?page=cleantalk';
|
669 |
-
printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
|
670 |
-
return;
|
671 |
-
}
|
672 |
-
}
|
673 |
-
|
674 |
-
function apbct_settings__error__output($return = false){
|
675 |
-
|
676 |
-
global $apbct;
|
677 |
-
|
678 |
-
// If have error message output error block.
|
679 |
-
|
680 |
-
$out = '';
|
681 |
-
|
682 |
-
if(!empty($apbct->errors) && !defined('CLEANTALK_ACCESS_KEY')){
|
683 |
-
|
684 |
-
$errors = $apbct->errors;
|
685 |
-
|
686 |
-
$error_texts = array(
|
687 |
-
// Misc
|
688 |
-
'key_invalid' => __('Error occurred while API key validating. Error: ', 'cleantalk'),
|
689 |
-
'key_get' => __('Error occurred while automatically gettings access key. Error: ', 'cleantalk'),
|
690 |
-
'sfw_send_logs' => __('Error occurred while sending sending SpamFireWall logs. Error: ', 'cleantalk'),
|
691 |
-
'sfw_update' => __('Error occurred while updating SpamFireWall local base. Error: ' , 'cleantalk'),
|
692 |
-
'account_check' => __('Error occurred while checking account status. Error: ', 'cleantalk'),
|
693 |
-
'api' => __('Error occurred while excuting API call. Error: ', 'cleantalk'),
|
694 |
-
|
695 |
-
// Validating settings
|
696 |
-
'settings_validate' => 'Validate Settings',
|
697 |
-
'exclusions_urls' => 'URL Exclusions',
|
698 |
-
'exclusions_fields' => 'Field Exclusions',
|
699 |
-
|
700 |
-
// Unknown
|
701 |
-
'unknown' => __('Unknown error. Error: ', 'cleantalk'),
|
702 |
-
);
|
703 |
-
|
704 |
-
$errors_out = array();
|
705 |
-
|
706 |
-
foreach($errors as $type => $error){
|
707 |
-
|
708 |
-
if(!empty($error)){
|
709 |
-
|
710 |
-
if(is_array(current($error))){
|
711 |
-
|
712 |
-
foreach($error as $sub_type => $sub_error){
|
713 |
-
$errors_out[$sub_type] = '';
|
714 |
-
if(isset($sub_error['error_time']))
|
715 |
-
$errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
|
716 |
-
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
717 |
-
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
|
718 |
-
}
|
719 |
-
continue;
|
720 |
-
}
|
721 |
-
|
722 |
-
$errors_out[$type] = '';
|
723 |
-
if(isset($error['error_time']))
|
724 |
-
$errors_out[$type] .= date('Y-m-d H:i:s', $error['error_time']) . ': ';
|
725 |
-
$errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
|
726 |
-
|
727 |
-
}
|
728 |
-
}
|
729 |
-
|
730 |
-
if(!empty($errors_out)){
|
731 |
-
$out .= '<div id="apbctTopWarning" class="error" style="position: relative;">'
|
732 |
-
.'<h3 style="display: inline-block;">'.__('Errors:', 'cleantalk').'</h3>';
|
733 |
-
foreach($errors_out as $value){
|
734 |
-
$out .= '<h4>'.$value.'</h4>';
|
735 |
-
}
|
736 |
-
$out .= !$apbct->white_label
|
737 |
-
? '<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>'
|
738 |
-
: '';
|
739 |
-
$out .= '</div>';
|
740 |
-
}
|
741 |
-
}
|
742 |
-
|
743 |
-
if($return) return $out; else echo $out;
|
744 |
-
}
|
745 |
-
|
746 |
-
function apbct_settings__field__debug(){
|
747 |
-
|
748 |
-
global $apbct;
|
749 |
-
|
750 |
-
if($apbct->debug){
|
751 |
-
|
752 |
-
echo '<hr /><h2>Debug:</h2>';
|
753 |
-
echo '<h4>Constants:</h4>';
|
754 |
-
echo 'CLEANTALK_AJAX_USE_BUFFER '. (defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
755 |
-
echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '. (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
756 |
-
echo 'CLEANTALK_ACCESS_KEY '. (defined('CLEANTALK_ACCESS_KEY') ? (CLEANTALK_ACCESS_KEY ? CLEANTALK_ACCESS_KEY : 'flase') : 'NOT_DEFINED')."<br>";
|
757 |
-
echo 'CLEANTALK_CHECK_COMMENTS_NUMBER '. (defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? (CLEANTALK_CHECK_COMMENTS_NUMBER ? CLEANTALK_CHECK_COMMENTS_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
758 |
-
echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
759 |
-
echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
|
760 |
-
echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
|
761 |
-
|
762 |
-
echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
|
763 |
-
echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
|
764 |
-
|
765 |
-
$output = print_r($apbct->debug, true);
|
766 |
-
$output = str_replace("\n", "<br>", $output);
|
767 |
-
$output = preg_replace("/[^\S]{4}/", " ", $output);
|
768 |
-
echo "$output";
|
769 |
-
|
770 |
-
echo "</div>";
|
771 |
-
|
772 |
-
}
|
773 |
-
}
|
774 |
-
|
775 |
-
function apbct_settings__field__state(){
|
776 |
-
|
777 |
-
global $apbct;
|
778 |
-
|
779 |
-
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
780 |
-
|
781 |
-
$img = $path_to_img."yes.png";
|
782 |
-
$img_no = $path_to_img."no.png";
|
783 |
-
$img_no_gray = $path_to_img."no_gray.png";
|
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 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['
|
816 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['
|
817 |
-
echo '<img class="apbct_status_icon" src="'.($apbct->settings['
|
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 |
-
echo '<
|
897 |
-
echo '<br />';
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
urlencode(
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
echo '<
|
917 |
-
|
918 |
-
|
919 |
-
'
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
'<a href="
|
938 |
-
'<a href="
|
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 |
-
$apbct->stats['last_request']['
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
$apbct->stats['last_sfw_block']['
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
$apbct->stats['sfw']['
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
<td
|
1013 |
-
<td><b>
|
1014 |
-
<td><b>
|
1015 |
-
<td><b>
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
. '<td>'
|
1021 |
-
. '<td>'.$report['
|
1022 |
-
. '<td>'.$report['
|
1023 |
-
. '<td>'.$report['
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
echo
|
1028 |
-
|
1029 |
-
|
1030 |
-
. '
|
1031 |
-
. '
|
1032 |
-
.
|
1033 |
-
. '
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
*
|
1050 |
-
*
|
1051 |
-
*
|
1052 |
-
*
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
$
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
$
|
1077 |
-
|
1078 |
-
:
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
$disabled = $params['parent'] &&
|
1083 |
-
$disabled = $params['
|
1084 |
-
$disabled =
|
1085 |
-
|
1086 |
-
|
1087 |
-
$
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
.
|
1102 |
-
|
1103 |
-
|
1104 |
-
.'
|
1105 |
-
|
1106 |
-
. ($params['
|
1107 |
-
. '
|
1108 |
-
|
1109 |
-
.'
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
.
|
1140 |
-
."
|
1141 |
-
.
|
1142 |
-
.'
|
1143 |
-
.
|
1144 |
-
.
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
.
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
. '
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
.
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
echo
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
.
|
1212 |
-
|
1213 |
-
|
1214 |
-
.($params['
|
1215 |
-
.'
|
1216 |
-
|
1217 |
-
.
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
*
|
1232 |
-
*
|
1233 |
-
* @
|
1234 |
-
* @
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
$settings['apikey'] =
|
1266 |
-
$settings['apikey'] =
|
1267 |
-
$settings['apikey'] = is_main_site()
|
1268 |
-
$settings['apikey'] = is_main_site() ||
|
1269 |
-
$settings['apikey'] =
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
//
|
1279 |
-
|
1280 |
-
$result
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
$result
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
'
|
1297 |
-
'
|
1298 |
-
'
|
1299 |
-
'
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
$
|
1322 |
-
$
|
1323 |
-
$
|
1324 |
-
$
|
1325 |
-
$
|
1326 |
-
$
|
1327 |
-
$
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
$
|
1334 |
-
$
|
1335 |
-
$
|
1336 |
-
$
|
1337 |
-
$
|
1338 |
-
$
|
1339 |
-
$
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
$apbct->
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
// Network
|
1404 |
-
$
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
'
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
$apbct->data['
|
1430 |
-
$apbct->data['
|
1431 |
-
$apbct->data['
|
1432 |
-
|
1433 |
-
|
1434 |
-
$apbct->data['
|
1435 |
-
$apbct->data['
|
1436 |
-
$apbct->data['
|
1437 |
-
$apbct->data['
|
1438 |
-
$apbct->data['
|
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 |
-
They
|
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 |
}
|
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 |
+
'search_test' => array(
|
133 |
+
'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
|
134 |
+
'description' => __('Spam protection for Search form.', 'cleantalk')
|
135 |
+
. (!$apbct->white_label || is_main_site()
|
136 |
+
? sprintf(__('Read more about %sspam protection for Search form%s on our blog. “noindex” tag will be placed in meta derictive on search page.', 'cleantalk'),
|
137 |
+
'<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
|
138 |
+
'</a>'
|
139 |
+
)
|
140 |
+
: ''
|
141 |
+
)
|
142 |
+
),
|
143 |
+
'check_external' => array(
|
144 |
+
'title' => __('Protect external forms', 'cleantalk'),
|
145 |
+
'description' => __('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'),
|
146 |
+
'childrens' => array('check_external__capture_buffer'),
|
147 |
+
),
|
148 |
+
'check_external__capture_buffer' => array(
|
149 |
+
'title' => __('Capture buffer', 'cleantalk'),
|
150 |
+
'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'),
|
151 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
152 |
+
'parent' => 'check_external',
|
153 |
+
),
|
154 |
+
'check_internal' => array(
|
155 |
+
'title' => __('Protect internal forms', 'cleantalk'),
|
156 |
+
'description' => __('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'),
|
157 |
+
),
|
158 |
+
),
|
159 |
+
),
|
160 |
+
|
161 |
+
// Comments and Messages
|
162 |
+
'wc' => array(
|
163 |
+
'title' => __('WooCommerce', 'cleantalk'),
|
164 |
+
'fields' => array(
|
165 |
+
'wc_checkout_test' => array(
|
166 |
+
'title' => __('WooCommerce checkout form', 'cleantalk'),
|
167 |
+
'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk'),
|
168 |
+
'childrens' => array('wc_register_from_order')
|
169 |
+
),
|
170 |
+
'wc_register_from_order' => array(
|
171 |
+
'title' => __('Spam test for registration during checkout', 'cleantalk'),
|
172 |
+
'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk'),
|
173 |
+
'parent' => 'wc_checkout_test',
|
174 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
175 |
+
'reverse_trigger' => true
|
176 |
+
),
|
177 |
+
),
|
178 |
+
),
|
179 |
+
|
180 |
+
// Comments and Messages
|
181 |
+
'comments_and_messages' => array(
|
182 |
+
'title' => __('Comments and Messages', 'cleantalk'),
|
183 |
+
'fields' => array(
|
184 |
+
'disable_comments__all' => array(
|
185 |
+
'title' => __( 'Disable all comments', 'cleantalk' ),
|
186 |
+
'description' => __( 'Disabling comments for all types of content.', 'cleantalk' ),
|
187 |
+
'childrens' => array(
|
188 |
+
'disable_comments__posts',
|
189 |
+
'disable_comments__pages',
|
190 |
+
'disable_comments__media',
|
191 |
+
),
|
192 |
+
'options' => array(
|
193 |
+
array( 'val' => 1, 'label' => __( 'On' ), 'childrens_enable' => 0, ),
|
194 |
+
array( 'val' => 0, 'label' => __( 'Off' ), 'childrens_enable' => 1, ),
|
195 |
+
),
|
196 |
+
),
|
197 |
+
'disable_comments__posts' => array(
|
198 |
+
'title' => __( 'Disable comments for all posts', 'cleantalk' ),
|
199 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
200 |
+
'parent' => 'disable_comments__all',
|
201 |
+
'reverse_trigger' => true,
|
202 |
+
),
|
203 |
+
'disable_comments__pages' => array(
|
204 |
+
'title' => __( 'Disable comments for all pages', 'cleantalk' ),
|
205 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
206 |
+
'parent' => 'disable_comments__all',
|
207 |
+
'reverse_trigger' => true,
|
208 |
+
),
|
209 |
+
'disable_comments__media' => array(
|
210 |
+
'title' => __( 'Disable comments for all media', 'cleantalk' ),
|
211 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
212 |
+
'parent' => 'disable_comments__all',
|
213 |
+
'reverse_trigger' => true,
|
214 |
+
),
|
215 |
+
'bp_private_messages' => array(
|
216 |
+
'title' => __('BuddyPress Private Messages', 'cleantalk'),
|
217 |
+
'description' => __('Check buddyPress private messages.', 'cleantalk'),
|
218 |
+
),
|
219 |
+
'remove_old_spam' => array(
|
220 |
+
'title' => __('Automatically delete spam comments', 'cleantalk'),
|
221 |
+
'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
|
222 |
+
),
|
223 |
+
'remove_comments_links' => array(
|
224 |
+
'title' => __('Remove links from approved comments', 'cleantalk'),
|
225 |
+
'description' => __('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'),
|
226 |
+
),
|
227 |
+
'show_check_links' => array(
|
228 |
+
'title' => __('Show links to check Emails, IPs for spam', 'cleantalk'),
|
229 |
+
'description' => __('Shows little icon near IP addresses and Emails allowing you to check it via CleanTalk\'s database.', 'cleantalk'),
|
230 |
+
'display' => !$apbct->white_label,
|
231 |
+
),
|
232 |
+
'manage_comments_on_public_page' => array(
|
233 |
+
'title' => __('Manage comments on public pages', 'cleantalk'),
|
234 |
+
'description' => __('Allows administrators to manage comments on public post\'s pages with small interactive menu.', 'cleantalk'),
|
235 |
+
'display' => !$apbct->white_label,
|
236 |
+
),
|
237 |
+
),
|
238 |
+
),
|
239 |
+
|
240 |
+
// Data Processing
|
241 |
+
'data_processing' => array(
|
242 |
+
'title' => __('Data Processing', 'cleantalk'),
|
243 |
+
'fields' => array(
|
244 |
+
'protect_logged_in' => array(
|
245 |
+
'title' => __("Protect logged in Users", 'cleantalk'),
|
246 |
+
'description' => __('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk'),
|
247 |
+
),
|
248 |
+
'check_comments_number' => array(
|
249 |
+
'title' => __("Don't check trusted user's comments", 'cleantalk'),
|
250 |
+
'description' => sprintf(__("Don't check comments for users with above %d comments.", 'cleantalk'), defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3),
|
251 |
+
),
|
252 |
+
'use_ajax' => array(
|
253 |
+
'title' => __('Use AJAX for JavaScript check', 'cleantalk'),
|
254 |
+
'description' => __('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'),
|
255 |
+
),
|
256 |
+
'use_static_js_key' => array(
|
257 |
+
'title' => __('Use static keys for JS check.', 'cleantalk'),
|
258 |
+
'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'),
|
259 |
+
'options' => array(
|
260 |
+
array('val' => 1, 'label' => __('On'), ),
|
261 |
+
array('val' => 0, 'label' => __('Off'), ),
|
262 |
+
array('val' => -1, 'label' => __('Auto'),),
|
263 |
+
),
|
264 |
+
),
|
265 |
+
'general_postdata_test' => array(
|
266 |
+
'title' => __('Check all post data', 'cleantalk'),
|
267 |
+
'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
|
268 |
+
.(!$apbct->white_label
|
269 |
+
? __(' 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>.'
|
270 |
+
: ''
|
271 |
+
)
|
272 |
+
.'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'),
|
273 |
+
),
|
274 |
+
'set_cookies' => array(
|
275 |
+
'title' => __("Set cookies", 'cleantalk'),
|
276 |
+
'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'),
|
277 |
+
'childrens' => array('set_cookies__sessions'),
|
278 |
+
),
|
279 |
+
'set_cookies__sessions' => array(
|
280 |
+
'title' => __('Use alternative mechanism for cookies', 'cleantalk'),
|
281 |
+
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
282 |
+
'parent' => 'set_cookies',
|
283 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
284 |
+
),
|
285 |
+
'ssl_on' => array(
|
286 |
+
'title' => __("Use SSL", 'cleantalk'),
|
287 |
+
'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
|
288 |
+
),
|
289 |
+
'use_buitin_http_api' => array(
|
290 |
+
'title' => __("Use Wordpress HTTP API", 'cleantalk'),
|
291 |
+
'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
|
292 |
+
),
|
293 |
+
),
|
294 |
+
),
|
295 |
+
|
296 |
+
// Exclusions
|
297 |
+
'exclusions' => array(
|
298 |
+
'title' => __('Exclusions', 'cleantalk'),
|
299 |
+
'fields' => array(
|
300 |
+
'exclusions__urls' => array(
|
301 |
+
'type' => 'text',
|
302 |
+
'title' => __('URL exclusions', 'cleantalk'),
|
303 |
+
'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
|
304 |
+
),
|
305 |
+
'exclusions__urls__use_regexp' => array(
|
306 |
+
'type' => 'checkbox',
|
307 |
+
'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
|
308 |
+
),
|
309 |
+
'exclusions__fields' => array(
|
310 |
+
'type' => 'text',
|
311 |
+
'title' => __('Field name exclusions', 'cleantalk'),
|
312 |
+
'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
|
313 |
+
),
|
314 |
+
'exclusions__fields__use_regexp' => array(
|
315 |
+
'type' => 'checkbox',
|
316 |
+
'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
|
317 |
+
),
|
318 |
+
'exclusions__roles' => array(
|
319 |
+
'type' => 'select',
|
320 |
+
'multiple' => true,
|
321 |
+
'options_callback' => 'apbct_get_all_roles',
|
322 |
+
'options_callback_params' => array(true),
|
323 |
+
'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
|
324 |
+
),
|
325 |
+
),
|
326 |
+
),
|
327 |
+
|
328 |
+
// Admin bar
|
329 |
+
'admin_bar' => array(
|
330 |
+
'title' => __('Admin bar', 'cleantalk'),
|
331 |
+
'default_params' => array(),
|
332 |
+
'description' => '',
|
333 |
+
'html_before' => '',
|
334 |
+
'html_after' => '',
|
335 |
+
'fields' => array(
|
336 |
+
'show_adminbar' => array(
|
337 |
+
'title' => __('Show statistics in admin bar', 'cleantalk'),
|
338 |
+
'description' => __('Show/hide icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'),
|
339 |
+
'childrens' => array('all_time_counter','daily_counter','sfw_counter'),
|
340 |
+
),
|
341 |
+
'all_time_counter' => array(
|
342 |
+
'title' => __('Show All-time counter', 'cleantalk'),
|
343 |
+
'description' => __('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
344 |
+
'parent' => 'show_adminbar',
|
345 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
346 |
+
),
|
347 |
+
'daily_counter' => array(
|
348 |
+
'title' => __('Show 24 hours counter', 'cleantalk'),
|
349 |
+
'description' => __('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'),
|
350 |
+
'parent' => 'show_adminbar',
|
351 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
352 |
+
),
|
353 |
+
'sfw_counter' => array(
|
354 |
+
'title' => __('SpamFireWall counter', 'cleantalk'),
|
355 |
+
'description' => __('Display SpamFireWall requests in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
|
356 |
+
'parent' => 'show_adminbar',
|
357 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
358 |
+
),
|
359 |
+
),
|
360 |
+
),
|
361 |
+
|
362 |
+
// Misc
|
363 |
+
'misc' => array(
|
364 |
+
'html_after' => '</div><br>',
|
365 |
+
'fields' => array(
|
366 |
+
'collect_details' => array(
|
367 |
+
'type' => 'checkbox',
|
368 |
+
'title' => __('Collect details about browsers', 'cleantalk'),
|
369 |
+
'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'),
|
370 |
+
),
|
371 |
+
'send_connection_reports' => array(
|
372 |
+
'type' => 'checkbox',
|
373 |
+
'title' => __('Send connection reports', 'cleantalk'),
|
374 |
+
'description' => __("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'),
|
375 |
+
),
|
376 |
+
'async_js' => array(
|
377 |
+
'type' => 'checkbox',
|
378 |
+
'title' => __('Async JavaScript loading', 'cleantalk'),
|
379 |
+
'description' => __('Use async loading for scripts. Warning: This could reduce filtration quality.', 'cleantalk'),
|
380 |
+
),
|
381 |
+
'gdpr_enabled' => array(
|
382 |
+
'type' => 'checkbox',
|
383 |
+
'title' => __('Allow to add GDPR notice via shortcode', 'cleantalk'),
|
384 |
+
'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'),
|
385 |
+
'childrens' => array('gdpr_text'),
|
386 |
+
),
|
387 |
+
'gdpr_text' => array(
|
388 |
+
'type' => 'text',
|
389 |
+
'title' => __('GDPR text notice', 'cleantalk'),
|
390 |
+
'description' => __('This text will be added as a description to the GDPR checkbox.', 'cleantalk'),
|
391 |
+
'parent' => 'gdpr_enabled',
|
392 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
393 |
+
),
|
394 |
+
'store_urls' => array(
|
395 |
+
'type' => 'checkbox',
|
396 |
+
'title' => __('Store visited URLs', 'cleantalk'),
|
397 |
+
'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'),
|
398 |
+
'childrens' => array('store_urls__sessions'),
|
399 |
+
),
|
400 |
+
'store_urls__sessions' => array(
|
401 |
+
'type' => 'checkbox',
|
402 |
+
'title' => __('Use cookies less sessions', 'cleantalk'),
|
403 |
+
'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
|
404 |
+
'parent' => 'store_urls',
|
405 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
406 |
+
),
|
407 |
+
'comment_notify' => array(
|
408 |
+
'type' => 'checkbox',
|
409 |
+
'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
|
410 |
+
'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
|
411 |
+
'childrens' => array('comment_notify__roles'),
|
412 |
+
),
|
413 |
+
'comment_notify__roles' => array(
|
414 |
+
'type' => 'select',
|
415 |
+
'multiple' => true,
|
416 |
+
'parent' => 'comment_notify',
|
417 |
+
'options_callback' => 'apbct_get_all_roles',
|
418 |
+
'options_callback_params' => array(true),
|
419 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
420 |
+
),
|
421 |
+
'complete_deactivation' => array(
|
422 |
+
'type' => 'checkbox',
|
423 |
+
'title' => __('Complete deactivation', 'cleantalk'),
|
424 |
+
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
425 |
+
),
|
426 |
+
|
427 |
+
),
|
428 |
+
),
|
429 |
+
);
|
430 |
+
|
431 |
+
return $fields;
|
432 |
+
}
|
433 |
+
|
434 |
+
function apbct_settings__set_fileds__network( $fields ){
|
435 |
+
global $apbct;
|
436 |
+
$additional_fields = array(
|
437 |
+
'main' => array(
|
438 |
+
'fields' => array(
|
439 |
+
'white_label' => array(
|
440 |
+
'type' => 'checkbox',
|
441 |
+
'title' => __('Enable White Label Mode', 'cleantalk'),
|
442 |
+
'description' => sprintf(__("Learn more information %shere%s.", 'cleantalk'), '<a target="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">', '</a>'),
|
443 |
+
'childrens' => array( 'white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key', ),
|
444 |
+
'disabled' => defined('CLEANTALK_ACCESS_KEY'),
|
445 |
+
'network' => true,
|
446 |
+
),
|
447 |
+
'white_label__hoster_key' => array(
|
448 |
+
'title' => __('Hoster API Key', 'cleantalk'),
|
449 |
+
'description' => sprintf(__("You can get it in %sCleantalk's Control Panel%s", 'cleantalk'), '<a target="_blank" href="https://cleantalk.org/my/profile">', '</a>'),
|
450 |
+
'type' => 'text',
|
451 |
+
'parent' => 'white_label',
|
452 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
453 |
+
'network' => true,
|
454 |
+
'required' => true,
|
455 |
+
),
|
456 |
+
'white_label__plugin_name' => array(
|
457 |
+
'title' => __('Plugin name', 'cleantalk'),
|
458 |
+
'description' => sprintf(__("Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s", 'cleantalk'), '<b>', '</b>'),
|
459 |
+
'type' => 'text',
|
460 |
+
'parent' => 'white_label',
|
461 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
462 |
+
'network' => true,
|
463 |
+
'required' => true,
|
464 |
+
),
|
465 |
+
'allow_custom_key' => array(
|
466 |
+
'type' => 'checkbox',
|
467 |
+
'title' => __('Allow users to use other key', 'cleantalk'),
|
468 |
+
'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
|
469 |
+
. (defined('CLEANTALK_ACCESS_KEY')
|
470 |
+
? ' <span style="color: red">'
|
471 |
+
. __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
|
472 |
+
. '<br>'
|
473 |
+
. __('You are not able to use white label mode while <b>CLEANTALK_ACCESS_KEY</b> is defined.', 'cleantalk')
|
474 |
+
. '</span>'
|
475 |
+
: ''
|
476 |
+
),
|
477 |
+
'display' => APBCT_WPMS && is_main_site(),
|
478 |
+
'disabled' => $apbct->network_settings['white_label'],
|
479 |
+
'network' => true,
|
480 |
+
),
|
481 |
+
'allow_custom_settings' => array(
|
482 |
+
'type' => 'checkbox',
|
483 |
+
'title' => __('Allow users to manage plugin settings', 'cleantalk'),
|
484 |
+
'description' => __('Allow to change settings on child sites.', 'cleantalk'),
|
485 |
+
'display' => APBCT_WPMS && is_main_site(),
|
486 |
+
'network' => true,
|
487 |
+
),
|
488 |
+
)
|
489 |
+
)
|
490 |
+
);
|
491 |
+
|
492 |
+
$fields = array_merge_recursive($fields, $additional_fields);
|
493 |
+
|
494 |
+
return $fields;
|
495 |
+
|
496 |
+
}
|
497 |
+
|
498 |
+
function apbct_settings__add_groups_and_fields( $fields ){
|
499 |
+
|
500 |
+
global $apbct;
|
501 |
+
|
502 |
+
$apbct->settings_fields_in_groups = $fields;
|
503 |
+
|
504 |
+
$field_default_params = array(
|
505 |
+
'callback' => 'apbct_settings__field__draw',
|
506 |
+
'type' => 'radio',
|
507 |
+
'options' => array(
|
508 |
+
array('val' => 1, 'label' => __('On'), 'childrens_enable' => 1, ),
|
509 |
+
array('val' => 0, 'label' => __('Off'), 'childrens_enable' => 0, ),
|
510 |
+
),
|
511 |
+
'def_class' => 'apbct_settings-field_wrapper',
|
512 |
+
'class' => '',
|
513 |
+
'parent' => '',
|
514 |
+
'childrens' => array(),
|
515 |
+
'hide' => array(),
|
516 |
+
// 'title' => 'Default title',
|
517 |
+
// 'description' => 'Default description',
|
518 |
+
'display' => true, // Draw settings or not
|
519 |
+
'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
|
520 |
+
'multiple' => false,
|
521 |
+
'description' => '',
|
522 |
+
'network' => false,
|
523 |
+
'disabled' => false,
|
524 |
+
'required' => false,
|
525 |
+
);
|
526 |
+
|
527 |
+
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
528 |
+
|
529 |
+
add_settings_section('apbct_section__'.$group_name, '', 'apbct_section__'.$group_name, 'cleantalk');
|
530 |
+
|
531 |
+
foreach($group['fields'] as $field_name => $field){
|
532 |
+
|
533 |
+
// Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
|
534 |
+
if(!empty($field['options_callback'])){
|
535 |
+
$options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
|
536 |
+
foreach ($options as &$option){
|
537 |
+
$option = array('val' => $option, 'label' => $option);
|
538 |
+
} unset($option);
|
539 |
+
$field['options'] = $options;
|
540 |
+
}
|
541 |
+
|
542 |
+
$params = !empty($group['default_params'])
|
543 |
+
? array_merge($group['default_params'], $field)
|
544 |
+
: array_merge($field_default_params, $field);
|
545 |
+
|
546 |
+
$params['name'] = $field_name;
|
547 |
+
|
548 |
+
if(!$params['display'])
|
549 |
+
continue;
|
550 |
+
|
551 |
+
add_settings_field(
|
552 |
+
'apbct_field__'.$field_name,
|
553 |
+
'',
|
554 |
+
$params['callback'],
|
555 |
+
'cleantalk',
|
556 |
+
'apbct_section__'.$group_name,
|
557 |
+
$params
|
558 |
+
);
|
559 |
+
|
560 |
+
}
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Admin callback function - Displays plugin options page
|
566 |
+
*/
|
567 |
+
function apbct_settings__display() {
|
568 |
+
|
569 |
+
global $apbct;
|
570 |
+
|
571 |
+
// Title
|
572 |
+
echo '<h2 class="apbct_settings-title">'.__($apbct->plugin_name, 'cleantalk').'</h2>';
|
573 |
+
|
574 |
+
// Subtitle for IP license
|
575 |
+
if($apbct->moderate_ip)
|
576 |
+
echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
|
577 |
+
|
578 |
+
echo '<form action="options.php" method="post">';
|
579 |
+
|
580 |
+
apbct_settings__error__output();
|
581 |
+
|
582 |
+
// Top info
|
583 |
+
if(!$apbct->white_label){
|
584 |
+
echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; background: #f1f1f1;">';
|
585 |
+
|
586 |
+
echo __('CleanTalk\'s tech support:', 'cleantalk')
|
587 |
+
.' '
|
588 |
+
.'<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
|
589 |
+
// .' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
|
590 |
+
// .($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').
|
591 |
+
.'<br>';
|
592 |
+
echo __('Plugin Homepage at', 'cleantalk').' <a href="https://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
|
593 |
+
echo '<span id="apbct_gdpr_open_modal" style="text-decoration: underline;">'.__('GDPR compliance', 'cleantalk').'</span><br/>';
|
594 |
+
echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
|
595 |
+
echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br/>';
|
596 |
+
if($apbct->key_is_ok)
|
597 |
+
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 />';
|
598 |
+
apbct_admin__badge__get_premium();
|
599 |
+
echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
|
600 |
+
apbct_settings_show_gdpr_text('print');
|
601 |
+
echo '</div>';
|
602 |
+
echo '</div>';
|
603 |
+
}
|
604 |
+
|
605 |
+
// Output spam count
|
606 |
+
if($apbct->key_is_ok && apbct_api_key__is_correct()){
|
607 |
+
if($apbct->spam_count > 0){
|
608 |
+
echo '<div class="apbct_settings-subtitle" style="top: 0; margin-bottom: 10px; width: 200px;">'
|
609 |
+
.'<br>'
|
610 |
+
.'<span>'
|
611 |
+
.sprintf(
|
612 |
+
__( '%s has blocked <b>%s</b> spam.', 'cleantalk' ),
|
613 |
+
$apbct->plugin_name,
|
614 |
+
number_format($apbct->spam_count, 0, ',', ' ')
|
615 |
+
)
|
616 |
+
.'</span>'
|
617 |
+
.'<br>'
|
618 |
+
.'<br>'
|
619 |
+
.'</div>';
|
620 |
+
}
|
621 |
+
if(!$apbct->white_label){
|
622 |
+
// CP button
|
623 |
+
echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
|
624 |
+
.__('Click here to get anti-spam statistics', 'cleantalk')
|
625 |
+
.'</a>';
|
626 |
+
echo ' ';
|
627 |
+
// Support button
|
628 |
+
echo '<a class="cleantalk_link cleantalk_link-auto" target="__blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>';
|
629 |
+
echo '<br>'
|
630 |
+
.'<br>';
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
settings_fields('cleantalk_settings');
|
635 |
+
do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
|
636 |
+
|
637 |
+
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
638 |
+
|
639 |
+
echo !empty($group['html_before']) ? $group['html_before'] : '';
|
640 |
+
echo !empty($group['title']) ? '<h3 style="margin-left: 220px;">'.$group['title'].'</h3>' : '';
|
641 |
+
|
642 |
+
do_settings_fields('cleantalk', 'apbct_section__'.$group_name);
|
643 |
+
|
644 |
+
echo !empty($group['html_after']) ? $group['html_after'] : '';
|
645 |
+
|
646 |
+
}
|
647 |
+
|
648 |
+
echo '<br>';
|
649 |
+
echo '<button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'.__('Save Changes').'</button>';
|
650 |
+
|
651 |
+
echo "</form>";
|
652 |
+
|
653 |
+
if(!$apbct->white_label){
|
654 |
+
// Translate banner for non EN locale
|
655 |
+
if(substr(get_locale(), 0, 2) != 'en'){
|
656 |
+
global $ct_translate_banner_template;
|
657 |
+
require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
|
658 |
+
printf($ct_translate_banner_template, substr(get_locale(), 0, 2));
|
659 |
+
}
|
660 |
+
}
|
661 |
+
}
|
662 |
+
|
663 |
+
function apbct_settings__display__network(){
|
664 |
+
// If it's network admin dashboard
|
665 |
+
if(is_network_admin()){
|
666 |
+
$site_url = get_site_option('siteurl');
|
667 |
+
$site_url = preg_match( '/\/$/', $site_url ) ? $site_url : $site_url . '/';
|
668 |
+
$link = $site_url . 'wp-admin/options-general.php?page=cleantalk';
|
669 |
+
printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
|
670 |
+
return;
|
671 |
+
}
|
672 |
+
}
|
673 |
+
|
674 |
+
function apbct_settings__error__output($return = false){
|
675 |
+
|
676 |
+
global $apbct;
|
677 |
+
|
678 |
+
// If have error message output error block.
|
679 |
+
|
680 |
+
$out = '';
|
681 |
+
|
682 |
+
if(!empty($apbct->errors) && !defined('CLEANTALK_ACCESS_KEY')){
|
683 |
+
|
684 |
+
$errors = $apbct->errors;
|
685 |
+
|
686 |
+
$error_texts = array(
|
687 |
+
// Misc
|
688 |
+
'key_invalid' => __('Error occurred while API key validating. Error: ', 'cleantalk'),
|
689 |
+
'key_get' => __('Error occurred while automatically gettings access key. Error: ', 'cleantalk'),
|
690 |
+
'sfw_send_logs' => __('Error occurred while sending sending SpamFireWall logs. Error: ', 'cleantalk'),
|
691 |
+
'sfw_update' => __('Error occurred while updating SpamFireWall local base. Error: ' , 'cleantalk'),
|
692 |
+
'account_check' => __('Error occurred while checking account status. Error: ', 'cleantalk'),
|
693 |
+
'api' => __('Error occurred while excuting API call. Error: ', 'cleantalk'),
|
694 |
+
|
695 |
+
// Validating settings
|
696 |
+
'settings_validate' => 'Validate Settings',
|
697 |
+
'exclusions_urls' => 'URL Exclusions',
|
698 |
+
'exclusions_fields' => 'Field Exclusions',
|
699 |
+
|
700 |
+
// Unknown
|
701 |
+
'unknown' => __('Unknown error. Error: ', 'cleantalk'),
|
702 |
+
);
|
703 |
+
|
704 |
+
$errors_out = array();
|
705 |
+
|
706 |
+
foreach($errors as $type => $error){
|
707 |
+
|
708 |
+
if(!empty($error)){
|
709 |
+
|
710 |
+
if(is_array(current($error))){
|
711 |
+
|
712 |
+
foreach($error as $sub_type => $sub_error){
|
713 |
+
$errors_out[$sub_type] = '';
|
714 |
+
if(isset($sub_error['error_time']))
|
715 |
+
$errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
|
716 |
+
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
717 |
+
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
|
718 |
+
}
|
719 |
+
continue;
|
720 |
+
}
|
721 |
+
|
722 |
+
$errors_out[$type] = '';
|
723 |
+
if(isset($error['error_time']))
|
724 |
+
$errors_out[$type] .= date('Y-m-d H:i:s', $error['error_time']) . ': ';
|
725 |
+
$errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
|
726 |
+
|
727 |
+
}
|
728 |
+
}
|
729 |
+
|
730 |
+
if(!empty($errors_out)){
|
731 |
+
$out .= '<div id="apbctTopWarning" class="error" style="position: relative;">'
|
732 |
+
.'<h3 style="display: inline-block;">'.__('Errors:', 'cleantalk').'</h3>';
|
733 |
+
foreach($errors_out as $value){
|
734 |
+
$out .= '<h4>'.$value.'</h4>';
|
735 |
+
}
|
736 |
+
$out .= !$apbct->white_label
|
737 |
+
? '<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>'
|
738 |
+
: '';
|
739 |
+
$out .= '</div>';
|
740 |
+
}
|
741 |
+
}
|
742 |
+
|
743 |
+
if($return) return $out; else echo $out;
|
744 |
+
}
|
745 |
+
|
746 |
+
function apbct_settings__field__debug(){
|
747 |
+
|
748 |
+
global $apbct;
|
749 |
+
|
750 |
+
if($apbct->debug){
|
751 |
+
|
752 |
+
echo '<hr /><h2>Debug:</h2>';
|
753 |
+
echo '<h4>Constants:</h4>';
|
754 |
+
echo 'CLEANTALK_AJAX_USE_BUFFER '. (defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
755 |
+
echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '. (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
756 |
+
echo 'CLEANTALK_ACCESS_KEY '. (defined('CLEANTALK_ACCESS_KEY') ? (CLEANTALK_ACCESS_KEY ? CLEANTALK_ACCESS_KEY : 'flase') : 'NOT_DEFINED')."<br>";
|
757 |
+
echo 'CLEANTALK_CHECK_COMMENTS_NUMBER '. (defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? (CLEANTALK_CHECK_COMMENTS_NUMBER ? CLEANTALK_CHECK_COMMENTS_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
758 |
+
echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
|
759 |
+
echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
|
760 |
+
echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
|
761 |
+
|
762 |
+
echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
|
763 |
+
echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
|
764 |
+
|
765 |
+
$output = print_r($apbct->debug, true);
|
766 |
+
$output = str_replace("\n", "<br>", $output);
|
767 |
+
$output = preg_replace("/[^\S]{4}/", " ", $output);
|
768 |
+
echo "$output";
|
769 |
+
|
770 |
+
echo "</div>";
|
771 |
+
|
772 |
+
}
|
773 |
+
}
|
774 |
+
|
775 |
+
function apbct_settings__field__state(){
|
776 |
+
|
777 |
+
global $apbct;
|
778 |
+
|
779 |
+
$path_to_img = plugin_dir_url(__FILE__) . "images/";
|
780 |
+
|
781 |
+
$img = $path_to_img."yes.png";
|
782 |
+
$img_no = $path_to_img."no.png";
|
783 |
+
$img_no_gray = $path_to_img."no_gray.png";
|
784 |
+
$preloader = $path_to_img."preloader.gif";
|
785 |
+
$color="black";
|
786 |
+
|
787 |
+
if( ! $apbct->key_is_ok ){
|
788 |
+
$img=$path_to_img."no.png";
|
789 |
+
$img_no=$path_to_img."no.png";
|
790 |
+
$color="black";
|
791 |
+
}
|
792 |
+
|
793 |
+
if(!apbct_api_key__is_correct($apbct->api_key)){
|
794 |
+
$img = $path_to_img."yes_gray.png";
|
795 |
+
$img_no = $path_to_img."no_gray.png";
|
796 |
+
$color="gray";
|
797 |
+
}
|
798 |
+
|
799 |
+
if($apbct->moderate_ip){
|
800 |
+
$img = $path_to_img."yes.png";
|
801 |
+
$img_no = $path_to_img."no.png";
|
802 |
+
$color="black";
|
803 |
+
}
|
804 |
+
|
805 |
+
if( $apbct->moderate == 0 ){
|
806 |
+
$img = $path_to_img."no.png";
|
807 |
+
$img_no = $path_to_img."no.png";
|
808 |
+
$color="black";
|
809 |
+
}
|
810 |
+
|
811 |
+
print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
|
812 |
+
|
813 |
+
print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
|
814 |
+
|
815 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['registrations_test'] == 1 ? $img : $img_no).'"/>'.__('Registration forms', 'cleantalk');
|
816 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test'] == 1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
|
817 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test'] == 1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
|
818 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test'] == 1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
|
819 |
+
if(!$apbct->white_label || is_main_site())
|
820 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
|
821 |
+
.'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
|
822 |
+
echo '<img class="apbct_status_icon" id = "sfw_status_icon" style = "width:16px;height:16px;" src="'.($apbct->settings['spam_firewall'] == 1 ? ( $apbct->stats['sfw']['update_in_process'] == true ? $preloader : $img) : $img_no).'"/>'.__('SpamFireWall', 'cleantalk');
|
823 |
+
// Autoupdate status
|
824 |
+
if($apbct->notice_auto_update && (!$apbct->white_label || is_main_site())){
|
825 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
|
826 |
+
.' <sup><a href="https://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
|
827 |
+
}
|
828 |
+
|
829 |
+
// WooCommerce
|
830 |
+
if(class_exists('WooCommerce'))
|
831 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
|
832 |
+
if($apbct->moderate_ip)
|
833 |
+
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
|
834 |
+
|
835 |
+
print "</div>";
|
836 |
+
}
|
837 |
+
|
838 |
+
/**
|
839 |
+
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
840 |
+
*/
|
841 |
+
function apbct_settings__field__apikey(){
|
842 |
+
|
843 |
+
global $apbct;
|
844 |
+
|
845 |
+
echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
|
846 |
+
|
847 |
+
// Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
|
848 |
+
if(APBCT_WPMS && !is_main_site() && (!$apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY'))){
|
849 |
+
_e('<h3>Key is provided by Super Admin.</h3>', 'cleantalk');
|
850 |
+
return;
|
851 |
+
}
|
852 |
+
|
853 |
+
echo '<label class="apbct_settings__label" for="cleantalk_apkey">' . __('Access key', 'cleantalk') . '</label>';
|
854 |
+
|
855 |
+
echo '<input
|
856 |
+
id="apbct_setting_apikey"
|
857 |
+
class="apbct_setting_text apbct_setting---apikey"
|
858 |
+
type="text"
|
859 |
+
name="cleantalk_settings[apikey]"
|
860 |
+
value="'
|
861 |
+
. ($apbct->key_is_ok
|
862 |
+
? str_repeat('*', strlen($apbct->api_key))
|
863 |
+
: $apbct->api_key
|
864 |
+
)
|
865 |
+
. '"
|
866 |
+
key="' . $apbct->api_key . '"
|
867 |
+
size="20"
|
868 |
+
placeholder="' . __('Enter the key', 'cleantalk') . '"'
|
869 |
+
. ' />';
|
870 |
+
|
871 |
+
// Show account name associated with key
|
872 |
+
if(!empty($apbct->data['account_name_ob'])){
|
873 |
+
echo '<div class="apbct_display--none">'
|
874 |
+
. sprintf( __('Account at cleantalk.org is %s.', 'cleantalk'),
|
875 |
+
'<b>'.$apbct->data['account_name_ob'].'</b>'
|
876 |
+
)
|
877 |
+
. '</div>';
|
878 |
+
};
|
879 |
+
|
880 |
+
// Show key button
|
881 |
+
if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok)){
|
882 |
+
echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
|
883 |
+
. __('Show the access key', 'cleantalk')
|
884 |
+
. '</a>';
|
885 |
+
|
886 |
+
// "Auto Get Key" buttons. License agreement
|
887 |
+
}else{
|
888 |
+
|
889 |
+
echo '<br /><br />';
|
890 |
+
|
891 |
+
// Auto get key
|
892 |
+
if(!$apbct->ip_license){
|
893 |
+
echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" name="submit" type="submit" value="get_key_auto">'
|
894 |
+
.__('Get Access Key Automatically', 'cleantalk')
|
895 |
+
.'</button>';
|
896 |
+
echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
|
897 |
+
echo '<br />';
|
898 |
+
echo '<br />';
|
899 |
+
}
|
900 |
+
|
901 |
+
// Warnings and GDPR
|
902 |
+
printf( __('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
|
903 |
+
ct_get_admin_email(),
|
904 |
+
'<a class="apbct_color--gray" target="__blank" href="'
|
905 |
+
. sprintf( 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
|
906 |
+
urlencode(ct_get_admin_email()),
|
907 |
+
urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))
|
908 |
+
)
|
909 |
+
. '">',
|
910 |
+
'</a>'
|
911 |
+
);
|
912 |
+
|
913 |
+
// License agreement
|
914 |
+
if(!$apbct->ip_license){
|
915 |
+
echo '<div>';
|
916 |
+
echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
|
917 |
+
echo '<label for="spbc_license_agreed">';
|
918 |
+
printf( __('I accept %sLicense Agreement%s.', 'cleantalk'),
|
919 |
+
'<a class = "apbct_color--gray" href="https://cleantalk.org/publicoffer" target="_blank">',
|
920 |
+
'</a>'
|
921 |
+
);
|
922 |
+
echo "</label>";
|
923 |
+
echo '</div>';
|
924 |
+
}
|
925 |
+
}
|
926 |
+
|
927 |
+
echo '</div>';
|
928 |
+
}
|
929 |
+
|
930 |
+
function apbct_settings__field__action_buttons(){
|
931 |
+
|
932 |
+
global $apbct;
|
933 |
+
|
934 |
+
$links = apply_filters(
|
935 |
+
'apbct_settings_action_buttons',
|
936 |
+
array(
|
937 |
+
'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>',
|
938 |
+
'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>',
|
939 |
+
'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_statistics\')">' . __('Statistics & Reports', 'cleantalk') . '</a>',
|
940 |
+
)
|
941 |
+
);
|
942 |
+
|
943 |
+
echo '<div class="apbct_settings-field_wrapper">';
|
944 |
+
|
945 |
+
if( apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok ){
|
946 |
+
echo '<div>';
|
947 |
+
foreach( $links as $link ) {
|
948 |
+
echo $link . ' ';
|
949 |
+
}
|
950 |
+
echo '</div>';
|
951 |
+
}
|
952 |
+
|
953 |
+
echo '</div>';
|
954 |
+
}
|
955 |
+
|
956 |
+
function apbct_settings__field__statistics() {
|
957 |
+
|
958 |
+
global $apbct, $wpdb;
|
959 |
+
|
960 |
+
echo '<div id="apbct_statistics" class="apbct_settings-field_wrapper" style="display: none;">';
|
961 |
+
|
962 |
+
// Last request
|
963 |
+
printf(
|
964 |
+
__('Last spam check request to %s server was at %s.', 'cleantalk'),
|
965 |
+
$apbct->stats['last_request']['server'] ? $apbct->stats['last_request']['server'] : __('unknown', 'cleantalk'),
|
966 |
+
$apbct->stats['last_request']['time'] ? date('M d Y H:i:s', $apbct->stats['last_request']['time']) : __('unknown', 'cleantalk')
|
967 |
+
);
|
968 |
+
echo '<br>';
|
969 |
+
|
970 |
+
// Avarage time request
|
971 |
+
printf(
|
972 |
+
__('Average request time for past 7 days: %s seconds.', 'cleantalk'),
|
973 |
+
$apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time']
|
974 |
+
? round($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time'], 3)
|
975 |
+
: __('unknown', 'cleantalk')
|
976 |
+
);
|
977 |
+
echo '<br>';
|
978 |
+
|
979 |
+
// SFW last die
|
980 |
+
printf(
|
981 |
+
__('Last time SpamFireWall was triggered for %s IP at %s', 'cleantalk'),
|
982 |
+
$apbct->stats['last_sfw_block']['ip'] ? $apbct->stats['last_sfw_block']['ip'] : __('unknown', 'cleantalk'),
|
983 |
+
$apbct->stats['last_sfw_block']['time'] ? date('M d Y H:i:s', $apbct->stats['last_sfw_block']['time']) : __('unknown', 'cleantalk')
|
984 |
+
);
|
985 |
+
echo '<br>';
|
986 |
+
|
987 |
+
// SFW last update
|
988 |
+
$sfw_netwoks_amount = $wpdb->get_results("SELECT count(*) AS cnt FROM `".$wpdb->prefix."cleantalk_sfw`", ARRAY_A);
|
989 |
+
printf(
|
990 |
+
__('SpamFireWall was updated %s. Now contains %s entries.', 'cleantalk'),
|
991 |
+
$apbct->stats['sfw']['last_update_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_update_time']) : __('unknown', 'cleantalk'),
|
992 |
+
isset($sfw_netwoks_amount[0]['cnt']) ? $sfw_netwoks_amount[0]['cnt'] : __('unknown', 'cleantalk')
|
993 |
+
);
|
994 |
+
echo '<br>';
|
995 |
+
|
996 |
+
// SFW last sent logs
|
997 |
+
printf(
|
998 |
+
__('SpamFireWall sent %s events at %s.', 'cleantalk'),
|
999 |
+
$apbct->stats['sfw']['last_send_amount'] ? $apbct->stats['sfw']['last_send_amount'] : __('unknown', 'cleantalk'),
|
1000 |
+
$apbct->stats['sfw']['last_send_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_send_time']) : __('unknown', 'cleantalk')
|
1001 |
+
);
|
1002 |
+
echo '<br>';
|
1003 |
+
|
1004 |
+
// Connection reports
|
1005 |
+
if ($apbct->connection_reports){
|
1006 |
+
|
1007 |
+
if ($apbct->connection_reports['negative'] == 0){
|
1008 |
+
_e('There are no failed connections to server.', 'cleantalk');
|
1009 |
+
}else{
|
1010 |
+
echo "<table id='negative_reports_table''>
|
1011 |
+
<tr>
|
1012 |
+
<td>#</td>
|
1013 |
+
<td><b>Date</b></td>
|
1014 |
+
<td><b>Page URL</b></td>
|
1015 |
+
<td><b>Report</b></td>
|
1016 |
+
<td><b>Server IP</b></td>
|
1017 |
+
</tr>";
|
1018 |
+
foreach($apbct->connection_reports['negative_report'] as $key => $report){
|
1019 |
+
echo '<tr>'
|
1020 |
+
. '<td>'.($key+1).'.</td>'
|
1021 |
+
. '<td>'.$report['date'].'</td>'
|
1022 |
+
. '<td>'.$report['page_url'].'</td>'
|
1023 |
+
. '<td>'.$report['lib_report'].'</td>'
|
1024 |
+
. '<td>'.$report['work_url'].'</td>'
|
1025 |
+
. '</tr>';
|
1026 |
+
}
|
1027 |
+
echo "</table>";
|
1028 |
+
echo '<br/>';
|
1029 |
+
echo '<button'
|
1030 |
+
. ' name="submit"'
|
1031 |
+
. ' class="cleantalk_link cleantalk_link-manual"'
|
1032 |
+
. ' value="ct_send_connection_report"'
|
1033 |
+
. (!$apbct->settings['send_connection_reports'] ? ' disabled="disabled"' : '')
|
1034 |
+
. '>'
|
1035 |
+
.__('Send report', 'cleantalk')
|
1036 |
+
.'</button>';
|
1037 |
+
if (!$apbct->settings['send_connection_reports']){
|
1038 |
+
echo '<br><br>';
|
1039 |
+
_e('Please, enable "Send connection reports" setting to be able to send reports', 'cleantalk');
|
1040 |
+
}
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
echo '</div>';
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
/**
|
1049 |
+
* Get all current Wordpress roles, could except 'subscriber' role
|
1050 |
+
*
|
1051 |
+
* @param bool $except_subscriber
|
1052 |
+
*
|
1053 |
+
* @return array
|
1054 |
+
*/
|
1055 |
+
function apbct_get_all_roles($except_subscriber = false) {
|
1056 |
+
|
1057 |
+
global $wp_roles;
|
1058 |
+
|
1059 |
+
$wp_roles = new WP_Roles();
|
1060 |
+
$roles = $wp_roles->get_names();
|
1061 |
+
|
1062 |
+
if($except_subscriber) {
|
1063 |
+
$key = array_search( 'Subscriber', $roles );
|
1064 |
+
if ( $key !== false ) {
|
1065 |
+
unset( $roles[ $key ] );
|
1066 |
+
}
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
return $roles;
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
function apbct_settings__field__draw($params = array()){
|
1073 |
+
|
1074 |
+
global $apbct;
|
1075 |
+
|
1076 |
+
$value = $params['network'] ? $apbct->network_settings[$params['name']] : $apbct->settings[$params['name']];
|
1077 |
+
$value_parent = $params['parent']
|
1078 |
+
? ($params['network'] ? $apbct->network_settings[$params['parent']] : $apbct->settings[$params['parent']])
|
1079 |
+
: false;
|
1080 |
+
|
1081 |
+
// Is element is disabled
|
1082 |
+
$disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : ''; // Strait
|
1083 |
+
$disabled = $params['parent'] && $params['reverse_trigger'] && !$value_parent ? ' disabled="disabled"' : $disabled; // Reverse logic
|
1084 |
+
$disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled; // Direct disable from params
|
1085 |
+
$disabled = ! is_main_site() && $apbct->network_settings && ! $apbct->network_settings['allow_custom_settings'] ? ' disabled="disabled"' : $disabled; // Disabled by super admin on sub-sites
|
1086 |
+
|
1087 |
+
$childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---",$params['childrens']) : '';
|
1088 |
+
$hide = $params['hide'] ? implode(",",$params['hide']) : '';
|
1089 |
+
|
1090 |
+
echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
|
1091 |
+
|
1092 |
+
switch($params['type']){
|
1093 |
+
|
1094 |
+
// Checkbox type
|
1095 |
+
case 'checkbox':
|
1096 |
+
echo '<input
|
1097 |
+
type="checkbox"
|
1098 |
+
name="cleantalk_settings['.$params['name'].']"
|
1099 |
+
id="apbct_setting_'.$params['name'].'"
|
1100 |
+
value="1" '
|
1101 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1102 |
+
.($value == '1' ? ' checked' : '')
|
1103 |
+
.$disabled
|
1104 |
+
.($params['required'] ? ' required="required"' : '')
|
1105 |
+
.' onchange="'
|
1106 |
+
. ($params['childrens'] ? ' apbctSettingsDependencies(\''. $childrens .'\');' : '')
|
1107 |
+
. ($params['hide'] ? ' apbct_show_hide_elem(\''. $hide . '\');' : '')
|
1108 |
+
. '"'
|
1109 |
+
.' />'
|
1110 |
+
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1111 |
+
.$params['title']
|
1112 |
+
.'</label>';
|
1113 |
+
echo isset($params['long_description'])
|
1114 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1115 |
+
: '';
|
1116 |
+
echo '<div class="apbct_settings-field_description">'
|
1117 |
+
.$params['description']
|
1118 |
+
.'</div>';
|
1119 |
+
break;
|
1120 |
+
|
1121 |
+
// Radio type
|
1122 |
+
case 'radio':
|
1123 |
+
|
1124 |
+
// Title
|
1125 |
+
echo isset($params['title'])
|
1126 |
+
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1127 |
+
: '';
|
1128 |
+
|
1129 |
+
// Popup description
|
1130 |
+
echo isset($params['long_description'])
|
1131 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1132 |
+
: '';
|
1133 |
+
|
1134 |
+
echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
|
1135 |
+
|
1136 |
+
echo '<div class="apbct_switchers" style="direction: ltr">';
|
1137 |
+
foreach($params['options'] as $option){
|
1138 |
+
echo '<input'
|
1139 |
+
.' type="radio"'
|
1140 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1141 |
+
." id='apbct_setting_{$params['name']}__{$option['label']}'"
|
1142 |
+
.' name="cleantalk_settings['.$params['name'].']"'
|
1143 |
+
.' value="'.$option['val'].'"'
|
1144 |
+
. $disabled
|
1145 |
+
.($params['childrens']
|
1146 |
+
? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\', ' . $option['childrens_enable'] . ')"'
|
1147 |
+
: ''
|
1148 |
+
)
|
1149 |
+
.($value == $option['val'] ? ' checked' : '')
|
1150 |
+
.($params['required'] ? ' required="required"' : '')
|
1151 |
+
.' />';
|
1152 |
+
echo '<label for="apbct_setting_'.$params['name'].'__'.$option['label'].'"> ' . $option['label'] . '</label>';
|
1153 |
+
echo ' ';
|
1154 |
+
}
|
1155 |
+
echo '</div>';
|
1156 |
+
|
1157 |
+
echo isset($params['description'])
|
1158 |
+
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1159 |
+
: '';
|
1160 |
+
|
1161 |
+
echo '</div>';
|
1162 |
+
break;
|
1163 |
+
|
1164 |
+
// Dropdown list type
|
1165 |
+
case 'select':
|
1166 |
+
echo isset($params['title'])
|
1167 |
+
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1168 |
+
: '';
|
1169 |
+
echo isset($params['long_description'])
|
1170 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1171 |
+
: '';
|
1172 |
+
echo '<select'
|
1173 |
+
. ' id="apbct_setting_'.$params['name'].'"'
|
1174 |
+
. " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1175 |
+
. ' name="cleantalk_settings['.$params['name'].']'.($params['multiple'] ? '[]"' : '"')
|
1176 |
+
. ($params['multiple'] ? ' size="'. count($params['options']). '""' : '')
|
1177 |
+
. ($params['multiple'] ? ' multiple="multiple"' : '')
|
1178 |
+
. $disabled
|
1179 |
+
. ($params['required'] ? ' required="required"' : '')
|
1180 |
+
. ' >';
|
1181 |
+
|
1182 |
+
foreach($params['options'] as $option){
|
1183 |
+
echo '<option'
|
1184 |
+
. ' value="' . $option['val'] . '"'
|
1185 |
+
. ($params['multiple']
|
1186 |
+
? (in_array($option['val'], $value) ? ' selected="selected"' : '')
|
1187 |
+
: ($value == $option['val'] ? 'selected="selected"' : '')
|
1188 |
+
)
|
1189 |
+
.'>'
|
1190 |
+
. $option['label']
|
1191 |
+
. '</option>';
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
echo '</select>';
|
1195 |
+
echo isset($params['long_description'])
|
1196 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1197 |
+
: '';
|
1198 |
+
echo isset($params['description'])
|
1199 |
+
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1200 |
+
: '';
|
1201 |
+
|
1202 |
+
break;
|
1203 |
+
|
1204 |
+
// Text type
|
1205 |
+
case 'text':
|
1206 |
+
|
1207 |
+
echo '<input
|
1208 |
+
type="text"
|
1209 |
+
id="apbct_setting_'.$params['name'].'"
|
1210 |
+
name="cleantalk_settings['.$params['name'].']"'
|
1211 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1212 |
+
.' value="'. $value .'" '
|
1213 |
+
.$disabled
|
1214 |
+
.($params['required'] ? ' required="required"' : '')
|
1215 |
+
.($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
|
1216 |
+
.' />'
|
1217 |
+
. ' '
|
1218 |
+
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1219 |
+
.$params['title']
|
1220 |
+
.'</label>';
|
1221 |
+
echo '<div class="apbct_settings-field_description">'
|
1222 |
+
.$params['description']
|
1223 |
+
.'</div>';
|
1224 |
+
break;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
echo '</div>';
|
1228 |
+
}
|
1229 |
+
|
1230 |
+
/**
|
1231 |
+
* Admin callback function - Plugin parameters validator
|
1232 |
+
*
|
1233 |
+
* @global CleantalkState $apbct
|
1234 |
+
* @param array $settings Array with passed settings
|
1235 |
+
* @return array Array with processed settings
|
1236 |
+
*/
|
1237 |
+
function apbct_settings__validate($settings) {
|
1238 |
+
|
1239 |
+
global $apbct;
|
1240 |
+
|
1241 |
+
// If user is not allowed to manage settings. Get settings from the storage
|
1242 |
+
if( ! is_main_site() && ( ! $apbct->network_settings['allow_custom_settings'] ) ){
|
1243 |
+
foreach ($apbct->settings as $key => $setting){
|
1244 |
+
$settings[ $key ] = $setting;
|
1245 |
+
}
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
// Set missing settings.
|
1249 |
+
foreach($apbct->def_settings as $setting => $value){
|
1250 |
+
if(!isset($settings[$setting])){
|
1251 |
+
$settings[$setting] = null;
|
1252 |
+
settype($settings[$setting], gettype($value));
|
1253 |
+
}
|
1254 |
+
} unset($setting, $value);
|
1255 |
+
|
1256 |
+
// Set missing settings.
|
1257 |
+
foreach($apbct->def_network_settings as $setting => $value){
|
1258 |
+
if(!isset($settings[$setting])){
|
1259 |
+
$settings[$setting] = null;
|
1260 |
+
settype($settings[$setting], gettype($value));
|
1261 |
+
}
|
1262 |
+
} unset($setting, $value);
|
1263 |
+
|
1264 |
+
// Validating API key
|
1265 |
+
$settings['apikey'] = !empty($settings['apikey']) ? trim($settings['apikey']) : '';
|
1266 |
+
$settings['apikey'] = defined( 'CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $settings['apikey'];
|
1267 |
+
$settings['apikey'] = ! is_main_site() && $apbct->white_label ? $apbct->settings['apikey'] : $settings['apikey'];
|
1268 |
+
$settings['apikey'] = is_main_site() || $apbct->allow_custom_key || $apbct->white_label ? $settings['apikey'] : $apbct->network_settings['apikey'];
|
1269 |
+
$settings['apikey'] = is_main_site() || !$settings['white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
|
1270 |
+
$settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
|
1271 |
+
|
1272 |
+
// Sanitize setting values
|
1273 |
+
foreach ($settings as &$setting ){
|
1274 |
+
if( is_scalar( $setting ) )
|
1275 |
+
$setting = preg_replace( '/[<"\'>]/', '', trim( $setting ) ); // Make HTML code inactive
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
// Validate Exclusions
|
1279 |
+
// URLs
|
1280 |
+
$result = apbct_settings__sanitize__exclusions($settings['exclusions__urls'], $settings['exclusions__urls__use_regexp']);
|
1281 |
+
$result === false
|
1282 |
+
? $apbct->error_add( 'exclusions_urls', 'is not valid: "' . $settings['exclusions__urls'] . '"', 'settings_validate' )
|
1283 |
+
: $apbct->error_delete( 'exclusions_urls', true, 'settings_validate' );
|
1284 |
+
$settings['exclusions__urls'] = $result ? $result: '';
|
1285 |
+
|
1286 |
+
// Fields
|
1287 |
+
$result = apbct_settings__sanitize__exclusions($settings['exclusions__fields'], $settings['exclusions__fields__use_regexp']);
|
1288 |
+
$result === false
|
1289 |
+
? $apbct->error_add( 'exclusions_fields', 'is not valid: "' . $settings['exclusions__fields'] . '"', 'settings_validate' )
|
1290 |
+
: $apbct->error_delete( 'exclusions_fields', true, 'settings_validate' );
|
1291 |
+
$settings['exclusions__fields'] = $result ? $result: '';
|
1292 |
+
|
1293 |
+
// WPMS Logic.
|
1294 |
+
if(APBCT_WPMS && is_main_site()){
|
1295 |
+
$network_settings = array(
|
1296 |
+
'allow_custom_key' => $settings['allow_custom_key'],
|
1297 |
+
'allow_custom_settings' => $settings['allow_custom_settings'],
|
1298 |
+
'white_label' => $settings['white_label'],
|
1299 |
+
'white_label__hoster_key' => $settings['white_label__hoster_key'],
|
1300 |
+
'white_label__plugin_name' => $settings['white_label__plugin_name'],
|
1301 |
+
);
|
1302 |
+
unset( $settings['allow_custom_key'], $settings['white_label'], $settings['white_label__hoster_key'], $settings['white_label__plugin_name'] );
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
// Drop debug data
|
1306 |
+
if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
|
1307 |
+
$apbct->debug = false;
|
1308 |
+
delete_option('cleantalk_debug');
|
1309 |
+
return $settings;
|
1310 |
+
}
|
1311 |
+
|
1312 |
+
// Send connection reports
|
1313 |
+
if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
|
1314 |
+
ct_mail_send_connection_report();
|
1315 |
+
return $settings;
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
// Auto getting key
|
1319 |
+
if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
|
1320 |
+
|
1321 |
+
$website = parse_url(get_option('siteurl'), PHP_URL_HOST).parse_url(get_option('siteurl'), PHP_URL_PATH);
|
1322 |
+
$platform = 'wordpress';
|
1323 |
+
$user_ip = CleantalkHelper::ip__get(array('real'), false);
|
1324 |
+
$timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
|
1325 |
+
$language = apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
|
1326 |
+
$wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
|
1327 |
+
$white_label = $apbct->network_settings['white_label'] ? 1 : 0;
|
1328 |
+
$hoster_api_key = $apbct->network_settings['white_label__hoster_key'] ? $apbct->network_settings['white_label__hoster_key'] : '';
|
1329 |
+
|
1330 |
+
$result = CleantalkAPI::method__get_api_key(
|
1331 |
+
! is_main_site() && $apbct->white_label ? 'anti-spam-hosting' : 'antispam',
|
1332 |
+
ct_get_admin_email(),
|
1333 |
+
$website,
|
1334 |
+
$platform,
|
1335 |
+
$timezone,
|
1336 |
+
$language,
|
1337 |
+
$user_ip,
|
1338 |
+
$wpms,
|
1339 |
+
$white_label,
|
1340 |
+
$hoster_api_key
|
1341 |
+
);
|
1342 |
+
|
1343 |
+
if(empty($result['error'])){
|
1344 |
+
|
1345 |
+
if(isset($result['user_token'])){
|
1346 |
+
$apbct->data['user_token'] = $result['user_token'];
|
1347 |
+
}
|
1348 |
+
|
1349 |
+
if(!empty($result['auth_key'])){
|
1350 |
+
$settings['apikey'] = $result['auth_key'];
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
}else{
|
1354 |
+
$apbct->error_add(
|
1355 |
+
'key_get',
|
1356 |
+
$result['error']
|
1357 |
+
. ($apbct->white_label
|
1358 |
+
? ' <button name="submit" type="submit" class="cleantalk_link cleantalk_link-manual" value="get_key_auto">'
|
1359 |
+
: ''
|
1360 |
+
)
|
1361 |
+
);
|
1362 |
+
}
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
// Feedback with app_agent
|
1366 |
+
ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
|
1367 |
+
|
1368 |
+
// Key is good by default
|
1369 |
+
$apbct->data['key_is_ok'] = true;
|
1370 |
+
|
1371 |
+
// Check account status and validate key. Even if it's not correct because of IP license.
|
1372 |
+
$result = ct_account_status_check($settings['apikey']);
|
1373 |
+
|
1374 |
+
// Is key valid?
|
1375 |
+
if($result){
|
1376 |
+
|
1377 |
+
// Deleting errors about invalid key
|
1378 |
+
$apbct->error_delete('key_invalid key_get', 'save');
|
1379 |
+
|
1380 |
+
// SFW actions
|
1381 |
+
if($apbct->settings['spam_firewall'] == 1){
|
1382 |
+
$result = ct_sfw_update($settings['apikey']);
|
1383 |
+
if( ! empty( $result['error'] ) )
|
1384 |
+
$apbct->error_add('sfw_update', $result['error']);
|
1385 |
+
$result = ct_sfw_send_logs($settings['apikey']);
|
1386 |
+
if( ! empty( $result['error'] ) )
|
1387 |
+
$apbct->error_add('sfw_send_logs', $result['error']);
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
// Updating brief data for dashboard widget
|
1391 |
+
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1392 |
+
|
1393 |
+
// Key is not valid
|
1394 |
+
}else{
|
1395 |
+
$apbct->data['key_is_ok'] = false;
|
1396 |
+
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
// WPMS Logic.
|
1400 |
+
if(APBCT_WPMS){
|
1401 |
+
if(is_main_site()){
|
1402 |
+
|
1403 |
+
// Network settings
|
1404 |
+
$network_settings['apikey'] = $settings['apikey'];
|
1405 |
+
$apbct->network_settings = $network_settings;
|
1406 |
+
$apbct->saveNetworkSettings();
|
1407 |
+
|
1408 |
+
// Network data
|
1409 |
+
$apbct->network_data = array(
|
1410 |
+
'key_is_ok' => $apbct->data['key_is_ok'],
|
1411 |
+
'moderate' => $apbct->data['moderate'],
|
1412 |
+
'valid' => $apbct->data['valid'],
|
1413 |
+
'auto_update' => $apbct->data['auto_update'],
|
1414 |
+
'user_token' => $apbct->data['user_token'],
|
1415 |
+
'service_id' => $apbct->data['service_id'],
|
1416 |
+
);
|
1417 |
+
$apbct->saveNetworkData();
|
1418 |
+
}
|
1419 |
+
if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
|
1420 |
+
$settings['apikey'] = '';
|
1421 |
+
}
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1425 |
+
|
1426 |
+
// Notices
|
1427 |
+
$apbct->data['notice_show'] = 1;
|
1428 |
+
$apbct->data['notice_renew'] = 0;
|
1429 |
+
$apbct->data['notice_trial'] = 0;
|
1430 |
+
$apbct->data['notice_review'] = 0;
|
1431 |
+
$apbct->data['notice_auto_update'] = 0;
|
1432 |
+
|
1433 |
+
// Other
|
1434 |
+
$apbct->data['service_id'] = 0;
|
1435 |
+
$apbct->data['valid'] = 0;
|
1436 |
+
$apbct->data['moderate'] = 0;
|
1437 |
+
$apbct->data['ip_license'] = 0;
|
1438 |
+
$apbct->data['moderate_ip'] = 0;
|
1439 |
+
$apbct->data['spam_count'] = 0;
|
1440 |
+
$apbct->data['auto_update'] = 0;
|
1441 |
+
$apbct->data['user_token'] = '';
|
1442 |
+
$apbct->data['license_trial'] = 0;
|
1443 |
+
$apbct->data['account_name_ob'] = '';
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
$apbct->saveData();
|
1447 |
+
|
1448 |
+
return $settings;
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
/**
|
1452 |
+
* Sanitize and validate exclusions.
|
1453 |
+
* Explode given string by commas and trim each string.
|
1454 |
+
* Skip element if it's empty.
|
1455 |
+
*
|
1456 |
+
* Return false if exclusion is bad
|
1457 |
+
* Return sanitized string if all is ok
|
1458 |
+
*
|
1459 |
+
* @param string $exclusions
|
1460 |
+
* @param bool $regexp
|
1461 |
+
*
|
1462 |
+
* @return bool|string
|
1463 |
+
*/
|
1464 |
+
function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
|
1465 |
+
$result = array();
|
1466 |
+
if( ! empty( $exclusions ) ){
|
1467 |
+
$exclusions = explode( ',', $exclusions );
|
1468 |
+
foreach ( $exclusions as $exclusion ){
|
1469 |
+
$sanitized_exclusion = trim( $exclusion );
|
1470 |
+
if ( ! empty( $sanitized_exclusion ) ) {
|
1471 |
+
if( $regexp && ! apbct_is_regexp( $exclusion ) )
|
1472 |
+
return false;
|
1473 |
+
$result[] = $sanitized_exclusion;
|
1474 |
+
}
|
1475 |
+
}
|
1476 |
+
}
|
1477 |
+
return implode( ',', $result );
|
1478 |
+
}
|
1479 |
+
|
1480 |
+
function apbct_settings_show_gdpr_text($print = false){
|
1481 |
+
|
1482 |
+
$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.
|
1483 |
+
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.
|
1484 |
+
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).
|
1485 |
+
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).
|
1486 |
+
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.
|
1487 |
+
They have to be appointed:')
|
1488 |
+
.'<ul style="padding: 0px 25px; list-style: disc;">'
|
1489 |
+
.'<li>for all public authorities, except for courts acting in their judicial capacity</li>'
|
1490 |
+
.'<li>if the core activities of the controller or the processor are:</li>'
|
1491 |
+
.'<ul style="padding: 0px 25px; list-style: disc;">'
|
1492 |
+
.'<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>'
|
1493 |
+
.'<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>'
|
1494 |
+
.'</ul>'
|
1495 |
+
.'</li>'
|
1496 |
+
.'</ul>';
|
1497 |
+
|
1498 |
+
if($print) echo $out; else return $out;
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
function apbct_settings__get__long_description(){
|
1502 |
+
|
1503 |
+
global $apbct;
|
1504 |
+
|
1505 |
+
check_ajax_referer('ct_secret_nonce' );
|
1506 |
+
|
1507 |
+
$setting_id = $_POST['setting_id'] ? $_POST['setting_id'] : '';
|
1508 |
+
|
1509 |
+
$descriptions = array(
|
1510 |
+
'white_label' => array(
|
1511 |
+
'title' => __( 'XSS check', 'cleantalk' ),
|
1512 |
+
'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' ),
|
1513 |
+
),
|
1514 |
+
'white_label__hoster_key' => array(
|
1515 |
+
'title' => __( 'SQL-injection check', 'cleantalk' ),
|
1516 |
+
'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' ),
|
1517 |
+
),
|
1518 |
+
'white_label__plugin_name' => array(
|
1519 |
+
'title' => __( 'Check uploaded files', 'cleantalk' ),
|
1520 |
+
'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' ),
|
1521 |
+
),
|
1522 |
+
);
|
1523 |
+
|
1524 |
+
die(json_encode($descriptions[$setting_id]));
|
1525 |
+
}
|
1526 |
+
|
1527 |
+
function apbct_settings__check_renew_banner() {
|
1528 |
+
global $apbct;
|
1529 |
+
|
1530 |
+
check_ajax_referer('ct_secret_nonce' );
|
1531 |
+
|
1532 |
+
die(json_encode(array('close_renew_banner' => ($apbct->data['notice_trial'] == 0 && $apbct->data['notice_renew'] == 0) ? true : false)));
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
function apbct_settings__check_sfw_update_process() {
|
1536 |
+
global $apbct;
|
1537 |
+
|
1538 |
+
check_ajax_referer('ct_secret_nonce' );
|
1539 |
+
|
1540 |
+
die(json_encode(array('sfw_updated' => ($apbct->settings['spam_firewall'] == 1 && $apbct->stats['sfw']['update_in_process'] == false) ? true : false)));
|
1541 |
}
|
inc/cleantalk-updater.php
CHANGED
@@ -1,518 +1,518 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function apbct_run_update_actions($current_version, $new_version){
|
4 |
-
|
5 |
-
$current_version = apbct_version_standartization($current_version);
|
6 |
-
$new_version = apbct_version_standartization($new_version);
|
7 |
-
|
8 |
-
$current_version_str = implode('.', $current_version);
|
9 |
-
$new_version_str = implode('.', $new_version);
|
10 |
-
|
11 |
-
for($ver_major = $current_version[0]; $ver_major <= $new_version[0]; $ver_major++){
|
12 |
-
for($ver_minor = 0; $ver_minor <= 200; $ver_minor++){
|
13 |
-
for($ver_fix = 0; $ver_fix <= 10; $ver_fix++){
|
14 |
-
|
15 |
-
if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $current_version_str, '<='))
|
16 |
-
continue;
|
17 |
-
|
18 |
-
if(function_exists("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}")){
|
19 |
-
$result = call_user_func("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}");
|
20 |
-
if(!empty($result['error']))
|
21 |
-
break;
|
22 |
-
}
|
23 |
-
|
24 |
-
if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $new_version_str, '>='))
|
25 |
-
break(2);
|
26 |
-
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
return true;
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
function apbct_version_standartization($version){
|
36 |
-
|
37 |
-
$version = explode('.', $version);
|
38 |
-
$version = !empty($version) ? $version : array();
|
39 |
-
|
40 |
-
$version[0] = !empty($version[0]) ? (int)$version[0] : 0;
|
41 |
-
$version[1] = !empty($version[1]) ? (int)$version[1] : 0;
|
42 |
-
$version[2] = !empty($version[2]) ? (int)$version[2] : 0;
|
43 |
-
|
44 |
-
return $version;
|
45 |
-
}
|
46 |
-
|
47 |
-
function apbct_update_to_5_50_0(){
|
48 |
-
global $wpdb;
|
49 |
-
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
|
50 |
-
`network` int(11) unsigned NOT NULL,
|
51 |
-
`mask` int(11) unsigned NOT NULL,
|
52 |
-
INDEX ( `network` , `mask` )
|
53 |
-
);');
|
54 |
-
|
55 |
-
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_LOG .'` (
|
56 |
-
`ip` VARCHAR(15) NOT NULL ,
|
57 |
-
`all` INT NOT NULL ,
|
58 |
-
`blocked` INT NOT NULL ,
|
59 |
-
`timestamp` INT NOT NULL ,
|
60 |
-
PRIMARY KEY (`ip`));');
|
61 |
-
}
|
62 |
-
|
63 |
-
function apbct_update_to_5_56_0(){
|
64 |
-
if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
|
65 |
-
wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
|
66 |
-
}
|
67 |
-
function apbct_update_to_5_70_0(){
|
68 |
-
|
69 |
-
global $wpdb;
|
70 |
-
|
71 |
-
if(!in_array('all_entries', $wpdb->get_col('DESC '. APBCT_TBL_FIREWALL_LOG, 0))){
|
72 |
-
$wpdb->query('ALTER TABLE `'. APBCT_TBL_FIREWALL_LOG .'`
|
73 |
-
CHANGE `all` `all_entries` INT(11) NOT NULL,
|
74 |
-
CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
|
75 |
-
CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;'
|
76 |
-
);
|
77 |
-
}
|
78 |
-
|
79 |
-
// Deleting usless data
|
80 |
-
delete_option('cleantalk_sends_reports_till');
|
81 |
-
delete_option('cleantalk_activation_timestamp');
|
82 |
-
|
83 |
-
// Disabling WP_Cron tasks
|
84 |
-
wp_clear_scheduled_hook('cleantalk_send_daily_report_hook');
|
85 |
-
wp_clear_scheduled_hook('ct_hourly_event_hook');
|
86 |
-
wp_clear_scheduled_hook('ct_send_sfw_log');
|
87 |
-
wp_clear_scheduled_hook('cleantalk_update_sfw_hook');
|
88 |
-
wp_clear_scheduled_hook('cleantalk_get_brief_data_hook');
|
89 |
-
|
90 |
-
// Adding Self cron system tasks
|
91 |
-
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // New
|
92 |
-
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500);
|
93 |
-
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500);
|
94 |
-
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);
|
95 |
-
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // New
|
96 |
-
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500);
|
97 |
-
}
|
98 |
-
function apbct_update_to_5_74_0(){
|
99 |
-
CleantalkCron::removeTask('send_daily_request');
|
100 |
-
}
|
101 |
-
|
102 |
-
function apbct_update_to_5_97_0(){
|
103 |
-
|
104 |
-
global $apbct;
|
105 |
-
|
106 |
-
if(count($apbct->data['connection_reports']['negative_report']) >= 20)
|
107 |
-
$apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
|
108 |
-
|
109 |
-
$apbct->saveData();
|
110 |
-
}
|
111 |
-
|
112 |
-
function apbct_update_to_5_109_0(){
|
113 |
-
|
114 |
-
global $apbct, $wpdb;
|
115 |
-
|
116 |
-
if(apbct_is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
|
117 |
-
|
118 |
-
$sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
|
119 |
-
`network` int(11) unsigned NOT NULL,
|
120 |
-
`mask` int(11) unsigned NOT NULL,
|
121 |
-
INDEX ( `network` , `mask` )
|
122 |
-
);';
|
123 |
-
|
124 |
-
$sfw_log_query = 'CREATE TABLE IF NOT EXISTS `%s` (
|
125 |
-
`ip` VARCHAR(15) NOT NULL,
|
126 |
-
`all_entries` INT NOT NULL,
|
127 |
-
`blocked_entries` INT NOT NULL,
|
128 |
-
`entries_timestamp` INT NOT NULL,
|
129 |
-
PRIMARY KEY (`ip`));';
|
130 |
-
|
131 |
-
$initial_blog = get_current_blog_id();
|
132 |
-
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
133 |
-
foreach ($blogs as $blog) {
|
134 |
-
switch_to_blog($blog);
|
135 |
-
$wpdb->query(sprintf($sfw_data_query, $wpdb->prefix . 'cleantalk_sfw')); // Table for SpamFireWall data
|
136 |
-
$wpdb->query(sprintf($sfw_log_query, $wpdb->prefix . 'cleantalk_sfw_logs')); // Table for SpamFireWall logs
|
137 |
-
// Cron tasks
|
138 |
-
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
139 |
-
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
140 |
-
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
141 |
-
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
|
142 |
-
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
143 |
-
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
144 |
-
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
145 |
-
}
|
146 |
-
switch_to_blog($initial_blog);
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
function apbct_update_to_5_110_0(){
|
151 |
-
global $apbct;
|
152 |
-
unset($apbct->data['last_remote_call']);
|
153 |
-
$apbct->saveData;
|
154 |
-
$apbct->save('remote_calls');
|
155 |
-
}
|
156 |
-
|
157 |
-
function apbct_update_to_5_115_1(){
|
158 |
-
ct_sfw_update();
|
159 |
-
}
|
160 |
-
|
161 |
-
function apbct_update_to_5_116_0(){
|
162 |
-
|
163 |
-
global $apbct, $wpdb;
|
164 |
-
|
165 |
-
$apbct->settings['store_urls'] = 0;
|
166 |
-
$apbct->settings['store_urls__sessions'] = 0;
|
167 |
-
$apbct->saveSettings();
|
168 |
-
|
169 |
-
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
|
170 |
-
`id` VARCHAR(64) NOT NULL,
|
171 |
-
`name` TEXT NOT NULL,
|
172 |
-
`value` TEXT NULL,
|
173 |
-
`last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
174 |
-
PRIMARY KEY (`id`, `name`(10)));'
|
175 |
-
);
|
176 |
-
}
|
177 |
-
|
178 |
-
function apbct_update_to_5_116_1(){
|
179 |
-
|
180 |
-
global $wpdb;
|
181 |
-
|
182 |
-
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
|
183 |
-
`id` VARCHAR(64) NOT NULL,
|
184 |
-
`name` TEXT NOT NULL,
|
185 |
-
`value` TEXT NULL,
|
186 |
-
`last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
187 |
-
PRIMARY KEY (`id`, `name`(10)));'
|
188 |
-
);
|
189 |
-
}
|
190 |
-
|
191 |
-
function apbct_update_to_5_116_2(){
|
192 |
-
|
193 |
-
global $wpdb;
|
194 |
-
|
195 |
-
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
|
196 |
-
`id` VARCHAR(64) NOT NULL,
|
197 |
-
`name` TEXT NOT NULL,
|
198 |
-
`value` TEXT NULL DEFAULT NULL,
|
199 |
-
`last_update` DATETIME NULL DEFAULT NULL,
|
200 |
-
PRIMARY KEY (`id`, `name`(10)));'
|
201 |
-
);
|
202 |
-
}
|
203 |
-
|
204 |
-
function apbct_update_to_5_118_0(){
|
205 |
-
global $wpdb;
|
206 |
-
$wpdb->query(
|
207 |
-
'DELETE
|
208 |
-
FROM `'. APBCT_TBL_SESSIONS .'`
|
209 |
-
WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND;'
|
210 |
-
);
|
211 |
-
delete_option('cleantalk_server');
|
212 |
-
}
|
213 |
-
|
214 |
-
function apbct_update_to_5_118_2(){
|
215 |
-
global $apbct;
|
216 |
-
$apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
|
217 |
-
$apbct->data['connection_reports']['since'] = date('d M');
|
218 |
-
$apbct->saveData();
|
219 |
-
}
|
220 |
-
|
221 |
-
function apbct_update_to_5_119_0(){
|
222 |
-
|
223 |
-
global $wpdb;
|
224 |
-
|
225 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
226 |
-
|
227 |
-
// SFW data
|
228 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
229 |
-
`network` int(11) unsigned NOT NULL,
|
230 |
-
`mask` int(11) unsigned NOT NULL,
|
231 |
-
INDEX ( `network` , `mask` )
|
232 |
-
);';
|
233 |
-
|
234 |
-
// SFW log
|
235 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
236 |
-
`ip` VARCHAR(15) NOT NULL,
|
237 |
-
`all_entries` INT NOT NULL,
|
238 |
-
`blocked_entries` INT NOT NULL,
|
239 |
-
`entries_timestamp` INT NOT NULL,
|
240 |
-
PRIMARY KEY (`ip`));';
|
241 |
-
|
242 |
-
// Sessions
|
243 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
244 |
-
`id` VARCHAR(64) NOT NULL,
|
245 |
-
`name` VARCHAR(64) NOT NULL,
|
246 |
-
`value` TEXT NULL DEFAULT NULL,
|
247 |
-
`last_update` DATETIME NULL DEFAULT NULL,
|
248 |
-
PRIMARY KEY (`id`(64), `name`(64)));';
|
249 |
-
|
250 |
-
apbct_activation__create_tables($sqls);
|
251 |
-
|
252 |
-
// WPMS
|
253 |
-
if(is_multisite()){
|
254 |
-
global $wpdb;
|
255 |
-
$initial_blog = get_current_blog_id();
|
256 |
-
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
257 |
-
foreach ($blogs as $blog) {
|
258 |
-
switch_to_blog($blog);
|
259 |
-
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
260 |
-
apbct_activation__create_tables($sqls);
|
261 |
-
}
|
262 |
-
switch_to_blog($initial_blog);
|
263 |
-
}
|
264 |
-
|
265 |
-
// Drop work url
|
266 |
-
update_option(
|
267 |
-
'cleantalk_server',
|
268 |
-
array(
|
269 |
-
'ct_work_url' => null,
|
270 |
-
'ct_server_ttl' => 0,
|
271 |
-
'ct_server_changed' => 0,
|
272 |
-
)
|
273 |
-
);
|
274 |
-
}
|
275 |
-
|
276 |
-
function apbct_update_to_5_124_0(){
|
277 |
-
global $apbct;
|
278 |
-
// Deleting error in database because format were changed
|
279 |
-
$apbct->errors = array();
|
280 |
-
$apbct->saveErrors();
|
281 |
-
}
|
282 |
-
|
283 |
-
function apbct_update_to_5_126_0(){
|
284 |
-
global $apbct;
|
285 |
-
// Enable storing URLs
|
286 |
-
$apbct->settings['store_urls'] = 1;
|
287 |
-
$apbct->settings['store_urls__sessions'] = 1;
|
288 |
-
$apbct->saveSettings();
|
289 |
-
}
|
290 |
-
|
291 |
-
function apbct_update_to_5_127_0(){
|
292 |
-
|
293 |
-
global $apbct;
|
294 |
-
|
295 |
-
// Move exclusions from variable to settins
|
296 |
-
global $cleantalk_url_exclusions, $cleantalk_key_exclusions;
|
297 |
-
// URLs
|
298 |
-
if(!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)){
|
299 |
-
$apbct->settings['exclusions__urls'] = implode(',', $cleantalk_url_exclusions);
|
300 |
-
if(APBCT_WPMS){
|
301 |
-
$initial_blog = get_current_blog_id();
|
302 |
-
switch_to_blog( 1 );
|
303 |
-
}
|
304 |
-
$apbct->saveSettings();
|
305 |
-
if(APBCT_WPMS){
|
306 |
-
switch_to_blog($initial_blog);
|
307 |
-
}
|
308 |
-
}
|
309 |
-
// Fields
|
310 |
-
if(!empty($cleantalk_key_exclusions) && is_array($cleantalk_key_exclusions)){
|
311 |
-
$apbct->settings['exclusions__fields'] = implode(',', $cleantalk_key_exclusions);
|
312 |
-
if(APBCT_WPMS){
|
313 |
-
$initial_blog = get_current_blog_id();
|
314 |
-
switch_to_blog( 1 );
|
315 |
-
}
|
316 |
-
$apbct->saveSettings();
|
317 |
-
if(APBCT_WPMS){
|
318 |
-
switch_to_blog($initial_blog);
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
// Deleting legacy
|
323 |
-
if(isset($apbct->data['testing_failed'])){
|
324 |
-
unset($apbct->data['testing_failed']);
|
325 |
-
$apbct->saveData();
|
326 |
-
}
|
327 |
-
|
328 |
-
if(APBCT_WPMS){
|
329 |
-
|
330 |
-
// Whitelabel
|
331 |
-
// Reset "api_key_is_recieved" flag
|
332 |
-
global $wpdb;
|
333 |
-
$initial_blog = get_current_blog_id();
|
334 |
-
$blogs = array_keys( $wpdb->get_results( 'SELECT blog_id FROM ' . $wpdb->blogs, OBJECT_K ) );
|
335 |
-
foreach ( $blogs as $blog ){
|
336 |
-
switch_to_blog( $blog );
|
337 |
-
|
338 |
-
$settings = get_option( 'cleantalk_settings' );
|
339 |
-
if( isset( $settings['use_static_js_key'] ) ){
|
340 |
-
$settings['use_static_js_key'] = $settings['use_static_js_key'] === 0
|
341 |
-
? - 1
|
342 |
-
: $settings['use_static_js_key'];
|
343 |
-
update_option( 'cleantalk_settings', $settings );
|
344 |
-
|
345 |
-
$data = get_option( 'cleantalk_data' );
|
346 |
-
if( isset( $data['white_label_data']['is_key_recieved'] ) ){
|
347 |
-
unset( $data['white_label_data']['is_key_recieved'] );
|
348 |
-
update_option( 'cleantalk_data', $data );
|
349 |
-
}
|
350 |
-
}
|
351 |
-
switch_to_blog( $initial_blog );
|
352 |
-
|
353 |
-
if( defined( 'APBCT_WHITELABEL' ) ){
|
354 |
-
$apbct->network_settings = array(
|
355 |
-
'white_label' => defined( 'APBCT_WHITELABEL' ) && APBCT_WHITELABEL == true ? 1 : 0,
|
356 |
-
'white_label__hoster_key' => defined( 'APBCT_HOSTER_API_KEY' ) ? APBCT_HOSTER_API_KEY : '',
|
357 |
-
'white_label__plugin_name' => defined( 'APBCT_WHITELABEL_NAME' ) ? APBCT_WHITELABEL_NAME : APBCT_NAME,
|
358 |
-
);
|
359 |
-
}elseif( defined( 'CLEANTALK_ACCESS_KEY' ) ){
|
360 |
-
$apbct->network_settings = array(
|
361 |
-
'allow_custom_key' => 0,
|
362 |
-
'apikey' => CLEANTALK_ACCESS_KEY,
|
363 |
-
);
|
364 |
-
}
|
365 |
-
$apbct->saveNetworkSettings();
|
366 |
-
}
|
367 |
-
}else{
|
368 |
-
// Switch use_static_js_key to Auto if it was disabled
|
369 |
-
$apbct->settings['use_static_js_key'] = $apbct->settings['use_static_js_key'] === 0
|
370 |
-
? -1
|
371 |
-
: $apbct->settings['use_static_js_key'];
|
372 |
-
$apbct->saveSettings();
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
function apbct_update_to_5_127_1(){
|
377 |
-
if(APBCT_WPMS && is_main_site()){
|
378 |
-
global $apbct;
|
379 |
-
$network_settings = get_site_option( 'cleantalk_network_settings' );
|
380 |
-
if( $network_settings !== false && empty( $network_settings['allow_custom_key'] ) && empty( $network_settings['white_label'] ) ){
|
381 |
-
$network_settings['allow_custom_key'] = 1;
|
382 |
-
update_site_option( 'cleantalk_network_settings', $network_settings );
|
383 |
-
}
|
384 |
-
if( $network_settings !== false && $network_settings['white_label'] == 1 && $apbct->data['moderate'] == 0 ){
|
385 |
-
ct_account_status_check( $network_settings['apikey'] ? $network_settings['apikey'] : $apbct->settings['apikey'], false);
|
386 |
-
}
|
387 |
-
}
|
388 |
-
}
|
389 |
-
|
390 |
-
function apbct_update_to_5_128_0(){
|
391 |
-
global $apbct;
|
392 |
-
$apbct->remote_calls = array();
|
393 |
-
$apbct->save('remote_calls');
|
394 |
-
}
|
395 |
-
|
396 |
-
function apbct_update_to_5_133_0() {
|
397 |
-
|
398 |
-
global $wpdb;
|
399 |
-
|
400 |
-
// Scan comment/user log
|
401 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
402 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
403 |
-
`scan_type` varchar(11) NOT NULL,
|
404 |
-
`start_time` datetime NOT NULL,
|
405 |
-
`finish_time` datetime NOT NULL,
|
406 |
-
`count_to_scan` int(11) DEFAULT NULL,
|
407 |
-
`found_spam` int(11) DEFAULT NULL,
|
408 |
-
`found_bad` int(11) DEFAULT NULL,
|
409 |
-
PRIMARY KEY (`id`));';
|
410 |
-
|
411 |
-
apbct_activation__create_tables($sqls);
|
412 |
-
|
413 |
-
}
|
414 |
-
|
415 |
-
function apbct_update_to_5_138_0() {
|
416 |
-
|
417 |
-
global $wpdb;
|
418 |
-
|
419 |
-
// SQL queries for each blog
|
420 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
421 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
422 |
-
`scan_type` varchar(11) NOT NULL,
|
423 |
-
`start_time` datetime NOT NULL,
|
424 |
-
`finish_time` datetime NOT NULL,
|
425 |
-
`count_to_scan` int(11) DEFAULT NULL,
|
426 |
-
`found_spam` int(11) DEFAULT NULL,
|
427 |
-
`found_bad` int(11) DEFAULT NULL,
|
428 |
-
PRIMARY KEY (`id`));';
|
429 |
-
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
430 |
-
`network` int(11) unsigned NOT NULL,
|
431 |
-
`mask` int(11) unsigned NOT NULL,
|
432 |
-
INDEX ( `network` , `mask` )
|
433 |
-
);';
|
434 |
-
$sqls[] = 'ALTER TABLE `%scleantalk_sfw` ADD COLUMN status TINYINT(1) NOT NULL DEFAULT 0 AFTER mask;';
|
435 |
-
|
436 |
-
// Actions for WPMS
|
437 |
-
if( APBCT_WPMS ){
|
438 |
-
|
439 |
-
// Getting all blog ids
|
440 |
-
$initial_blog = get_current_blog_id();
|
441 |
-
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
442 |
-
|
443 |
-
// Getting main blog setting
|
444 |
-
switch_to_blog( 1 );
|
445 |
-
$main_blog_settings = get_option( 'cleantalk_settings' );
|
446 |
-
switch_to_blog( $initial_blog );
|
447 |
-
|
448 |
-
// Getting network settings
|
449 |
-
$net_settings = get_site_option('cleantalk_network_settings');
|
450 |
-
|
451 |
-
foreach ($blogs as $blog) {
|
452 |
-
|
453 |
-
// Update time limit to prevent exec time error
|
454 |
-
set_time_limit(20);
|
455 |
-
|
456 |
-
switch_to_blog($blog);
|
457 |
-
|
458 |
-
// Update SQL structure
|
459 |
-
apbct_activation__create_tables($sqls);
|
460 |
-
|
461 |
-
// Getting key
|
462 |
-
$settings = $net_settings['allow_custom_key']
|
463 |
-
? get_option('cleantalk_settings')
|
464 |
-
: $main_blog_settings;
|
465 |
-
|
466 |
-
// Update plugin status
|
467 |
-
if( ! empty( $settings['apikey'] ) ){
|
468 |
-
|
469 |
-
$data = get_option( 'cleantalk_data', array() );
|
470 |
-
|
471 |
-
$result = CleantalkAPI::method__notice_paid_till(
|
472 |
-
$settings['api_key'],
|
473 |
-
preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1),
|
474 |
-
! is_main_site() && $net_settings['white_label'] ? 'anti-spam-hosting' : 'antispam'
|
475 |
-
);
|
476 |
-
|
477 |
-
if( empty( $result['error'] ) || ! empty( $result['valid'] ) ){
|
478 |
-
|
479 |
-
// Notices
|
480 |
-
$data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
|
481 |
-
$data['notice_renew'] = isset($result['renew']) ? (int)$result['renew'] : 0;
|
482 |
-
$data['notice_trial'] = isset($result['trial']) ? (int)$result['trial'] : 0;
|
483 |
-
$data['notice_review'] = isset($result['show_review']) ? (int)$result['show_review'] : 0;
|
484 |
-
$data['notice_auto_update'] = isset($result['show_auto_update_notice']) ? (int)$result['show_auto_update_notice'] : 0;
|
485 |
-
|
486 |
-
// Other
|
487 |
-
$data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
|
488 |
-
$data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
|
489 |
-
$data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
|
490 |
-
$data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
|
491 |
-
$data['moderate_ip'] = isset($result['moderate_ip'], $result['ip_license']) ? (int)$result['moderate_ip'] : 0;
|
492 |
-
$data['spam_count'] = isset($result['spam_count']) ? (int)$result['spam_count'] : 0;
|
493 |
-
$data['auto_update'] = isset($result['auto_update_app']) ? (int)$result['auto_update_app'] : 0;
|
494 |
-
$data['user_token'] = isset($result['user_token']) ? (string)$result['user_token'] : '';
|
495 |
-
$data['license_trial'] = isset($result['license_trial']) ? (int)$result['license_trial'] : 0;
|
496 |
-
$data['account_name_ob'] = isset($result['account_name_ob']) ? (string)$result['account_name_ob'] : '';
|
497 |
-
|
498 |
-
}
|
499 |
-
|
500 |
-
$data['key_is_ok'] = ! empty( $result['valid'] )
|
501 |
-
? true
|
502 |
-
: false;
|
503 |
-
|
504 |
-
update_option( 'cleantalk_data', $data );
|
505 |
-
|
506 |
-
}
|
507 |
-
|
508 |
-
}
|
509 |
-
|
510 |
-
// Restoring initial blog
|
511 |
-
switch_to_blog($initial_blog);
|
512 |
-
|
513 |
-
// Actions for stand alone blog
|
514 |
-
}else{
|
515 |
-
apbct_activation__create_tables($sqls);
|
516 |
-
}
|
517 |
-
|
518 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function apbct_run_update_actions($current_version, $new_version){
|
4 |
+
|
5 |
+
$current_version = apbct_version_standartization($current_version);
|
6 |
+
$new_version = apbct_version_standartization($new_version);
|
7 |
+
|
8 |
+
$current_version_str = implode('.', $current_version);
|
9 |
+
$new_version_str = implode('.', $new_version);
|
10 |
+
|
11 |
+
for($ver_major = $current_version[0]; $ver_major <= $new_version[0]; $ver_major++){
|
12 |
+
for($ver_minor = 0; $ver_minor <= 200; $ver_minor++){
|
13 |
+
for($ver_fix = 0; $ver_fix <= 10; $ver_fix++){
|
14 |
+
|
15 |
+
if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $current_version_str, '<='))
|
16 |
+
continue;
|
17 |
+
|
18 |
+
if(function_exists("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}")){
|
19 |
+
$result = call_user_func("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}");
|
20 |
+
if(!empty($result['error']))
|
21 |
+
break;
|
22 |
+
}
|
23 |
+
|
24 |
+
if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $new_version_str, '>='))
|
25 |
+
break(2);
|
26 |
+
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return true;
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
function apbct_version_standartization($version){
|
36 |
+
|
37 |
+
$version = explode('.', $version);
|
38 |
+
$version = !empty($version) ? $version : array();
|
39 |
+
|
40 |
+
$version[0] = !empty($version[0]) ? (int)$version[0] : 0;
|
41 |
+
$version[1] = !empty($version[1]) ? (int)$version[1] : 0;
|
42 |
+
$version[2] = !empty($version[2]) ? (int)$version[2] : 0;
|
43 |
+
|
44 |
+
return $version;
|
45 |
+
}
|
46 |
+
|
47 |
+
function apbct_update_to_5_50_0(){
|
48 |
+
global $wpdb;
|
49 |
+
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
|
50 |
+
`network` int(11) unsigned NOT NULL,
|
51 |
+
`mask` int(11) unsigned NOT NULL,
|
52 |
+
INDEX ( `network` , `mask` )
|
53 |
+
);');
|
54 |
+
|
55 |
+
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_LOG .'` (
|
56 |
+
`ip` VARCHAR(15) NOT NULL ,
|
57 |
+
`all` INT NOT NULL ,
|
58 |
+
`blocked` INT NOT NULL ,
|
59 |
+
`timestamp` INT NOT NULL ,
|
60 |
+
PRIMARY KEY (`ip`));');
|
61 |
+
}
|
62 |
+
|
63 |
+
function apbct_update_to_5_56_0(){
|
64 |
+
if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
|
65 |
+
wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
|
66 |
+
}
|
67 |
+
function apbct_update_to_5_70_0(){
|
68 |
+
|
69 |
+
global $wpdb;
|
70 |
+
|
71 |
+
if(!in_array('all_entries', $wpdb->get_col('DESC '. APBCT_TBL_FIREWALL_LOG, 0))){
|
72 |
+
$wpdb->query('ALTER TABLE `'. APBCT_TBL_FIREWALL_LOG .'`
|
73 |
+
CHANGE `all` `all_entries` INT(11) NOT NULL,
|
74 |
+
CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
|
75 |
+
CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;'
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
// Deleting usless data
|
80 |
+
delete_option('cleantalk_sends_reports_till');
|
81 |
+
delete_option('cleantalk_activation_timestamp');
|
82 |
+
|
83 |
+
// Disabling WP_Cron tasks
|
84 |
+
wp_clear_scheduled_hook('cleantalk_send_daily_report_hook');
|
85 |
+
wp_clear_scheduled_hook('ct_hourly_event_hook');
|
86 |
+
wp_clear_scheduled_hook('ct_send_sfw_log');
|
87 |
+
wp_clear_scheduled_hook('cleantalk_update_sfw_hook');
|
88 |
+
wp_clear_scheduled_hook('cleantalk_get_brief_data_hook');
|
89 |
+
|
90 |
+
// Adding Self cron system tasks
|
91 |
+
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // New
|
92 |
+
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500);
|
93 |
+
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500);
|
94 |
+
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);
|
95 |
+
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // New
|
96 |
+
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500);
|
97 |
+
}
|
98 |
+
function apbct_update_to_5_74_0(){
|
99 |
+
CleantalkCron::removeTask('send_daily_request');
|
100 |
+
}
|
101 |
+
|
102 |
+
function apbct_update_to_5_97_0(){
|
103 |
+
|
104 |
+
global $apbct;
|
105 |
+
|
106 |
+
if(count($apbct->data['connection_reports']['negative_report']) >= 20)
|
107 |
+
$apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
|
108 |
+
|
109 |
+
$apbct->saveData();
|
110 |
+
}
|
111 |
+
|
112 |
+
function apbct_update_to_5_109_0(){
|
113 |
+
|
114 |
+
global $apbct, $wpdb;
|
115 |
+
|
116 |
+
if(apbct_is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
|
117 |
+
|
118 |
+
$sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
|
119 |
+
`network` int(11) unsigned NOT NULL,
|
120 |
+
`mask` int(11) unsigned NOT NULL,
|
121 |
+
INDEX ( `network` , `mask` )
|
122 |
+
);';
|
123 |
+
|
124 |
+
$sfw_log_query = 'CREATE TABLE IF NOT EXISTS `%s` (
|
125 |
+
`ip` VARCHAR(15) NOT NULL,
|
126 |
+
`all_entries` INT NOT NULL,
|
127 |
+
`blocked_entries` INT NOT NULL,
|
128 |
+
`entries_timestamp` INT NOT NULL,
|
129 |
+
PRIMARY KEY (`ip`));';
|
130 |
+
|
131 |
+
$initial_blog = get_current_blog_id();
|
132 |
+
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
133 |
+
foreach ($blogs as $blog) {
|
134 |
+
switch_to_blog($blog);
|
135 |
+
$wpdb->query(sprintf($sfw_data_query, $wpdb->prefix . 'cleantalk_sfw')); // Table for SpamFireWall data
|
136 |
+
$wpdb->query(sprintf($sfw_log_query, $wpdb->prefix . 'cleantalk_sfw_logs')); // Table for SpamFireWall logs
|
137 |
+
// Cron tasks
|
138 |
+
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
139 |
+
CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
140 |
+
CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
|
141 |
+
CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
|
142 |
+
CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
|
143 |
+
CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
|
144 |
+
CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
|
145 |
+
}
|
146 |
+
switch_to_blog($initial_blog);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
function apbct_update_to_5_110_0(){
|
151 |
+
global $apbct;
|
152 |
+
unset($apbct->data['last_remote_call']);
|
153 |
+
$apbct->saveData;
|
154 |
+
$apbct->save('remote_calls');
|
155 |
+
}
|
156 |
+
|
157 |
+
function apbct_update_to_5_115_1(){
|
158 |
+
ct_sfw_update();
|
159 |
+
}
|
160 |
+
|
161 |
+
function apbct_update_to_5_116_0(){
|
162 |
+
|
163 |
+
global $apbct, $wpdb;
|
164 |
+
|
165 |
+
$apbct->settings['store_urls'] = 0;
|
166 |
+
$apbct->settings['store_urls__sessions'] = 0;
|
167 |
+
$apbct->saveSettings();
|
168 |
+
|
169 |
+
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
|
170 |
+
`id` VARCHAR(64) NOT NULL,
|
171 |
+
`name` TEXT NOT NULL,
|
172 |
+
`value` TEXT NULL,
|
173 |
+
`last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
174 |
+
PRIMARY KEY (`id`, `name`(10)));'
|
175 |
+
);
|
176 |
+
}
|
177 |
+
|
178 |
+
function apbct_update_to_5_116_1(){
|
179 |
+
|
180 |
+
global $wpdb;
|
181 |
+
|
182 |
+
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
|
183 |
+
`id` VARCHAR(64) NOT NULL,
|
184 |
+
`name` TEXT NOT NULL,
|
185 |
+
`value` TEXT NULL,
|
186 |
+
`last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
187 |
+
PRIMARY KEY (`id`, `name`(10)));'
|
188 |
+
);
|
189 |
+
}
|
190 |
+
|
191 |
+
function apbct_update_to_5_116_2(){
|
192 |
+
|
193 |
+
global $wpdb;
|
194 |
+
|
195 |
+
$wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
|
196 |
+
`id` VARCHAR(64) NOT NULL,
|
197 |
+
`name` TEXT NOT NULL,
|
198 |
+
`value` TEXT NULL DEFAULT NULL,
|
199 |
+
`last_update` DATETIME NULL DEFAULT NULL,
|
200 |
+
PRIMARY KEY (`id`, `name`(10)));'
|
201 |
+
);
|
202 |
+
}
|
203 |
+
|
204 |
+
function apbct_update_to_5_118_0(){
|
205 |
+
global $wpdb;
|
206 |
+
$wpdb->query(
|
207 |
+
'DELETE
|
208 |
+
FROM `'. APBCT_TBL_SESSIONS .'`
|
209 |
+
WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND;'
|
210 |
+
);
|
211 |
+
delete_option('cleantalk_server');
|
212 |
+
}
|
213 |
+
|
214 |
+
function apbct_update_to_5_118_2(){
|
215 |
+
global $apbct;
|
216 |
+
$apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
|
217 |
+
$apbct->data['connection_reports']['since'] = date('d M');
|
218 |
+
$apbct->saveData();
|
219 |
+
}
|
220 |
+
|
221 |
+
function apbct_update_to_5_119_0(){
|
222 |
+
|
223 |
+
global $wpdb;
|
224 |
+
|
225 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
226 |
+
|
227 |
+
// SFW data
|
228 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
229 |
+
`network` int(11) unsigned NOT NULL,
|
230 |
+
`mask` int(11) unsigned NOT NULL,
|
231 |
+
INDEX ( `network` , `mask` )
|
232 |
+
);';
|
233 |
+
|
234 |
+
// SFW log
|
235 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
236 |
+
`ip` VARCHAR(15) NOT NULL,
|
237 |
+
`all_entries` INT NOT NULL,
|
238 |
+
`blocked_entries` INT NOT NULL,
|
239 |
+
`entries_timestamp` INT NOT NULL,
|
240 |
+
PRIMARY KEY (`ip`));';
|
241 |
+
|
242 |
+
// Sessions
|
243 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
244 |
+
`id` VARCHAR(64) NOT NULL,
|
245 |
+
`name` VARCHAR(64) NOT NULL,
|
246 |
+
`value` TEXT NULL DEFAULT NULL,
|
247 |
+
`last_update` DATETIME NULL DEFAULT NULL,
|
248 |
+
PRIMARY KEY (`id`(64), `name`(64)));';
|
249 |
+
|
250 |
+
apbct_activation__create_tables($sqls);
|
251 |
+
|
252 |
+
// WPMS
|
253 |
+
if(is_multisite()){
|
254 |
+
global $wpdb;
|
255 |
+
$initial_blog = get_current_blog_id();
|
256 |
+
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
257 |
+
foreach ($blogs as $blog) {
|
258 |
+
switch_to_blog($blog);
|
259 |
+
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
|
260 |
+
apbct_activation__create_tables($sqls);
|
261 |
+
}
|
262 |
+
switch_to_blog($initial_blog);
|
263 |
+
}
|
264 |
+
|
265 |
+
// Drop work url
|
266 |
+
update_option(
|
267 |
+
'cleantalk_server',
|
268 |
+
array(
|
269 |
+
'ct_work_url' => null,
|
270 |
+
'ct_server_ttl' => 0,
|
271 |
+
'ct_server_changed' => 0,
|
272 |
+
)
|
273 |
+
);
|
274 |
+
}
|
275 |
+
|
276 |
+
function apbct_update_to_5_124_0(){
|
277 |
+
global $apbct;
|
278 |
+
// Deleting error in database because format were changed
|
279 |
+
$apbct->errors = array();
|
280 |
+
$apbct->saveErrors();
|
281 |
+
}
|
282 |
+
|
283 |
+
function apbct_update_to_5_126_0(){
|
284 |
+
global $apbct;
|
285 |
+
// Enable storing URLs
|
286 |
+
$apbct->settings['store_urls'] = 1;
|
287 |
+
$apbct->settings['store_urls__sessions'] = 1;
|
288 |
+
$apbct->saveSettings();
|
289 |
+
}
|
290 |
+
|
291 |
+
function apbct_update_to_5_127_0(){
|
292 |
+
|
293 |
+
global $apbct;
|
294 |
+
|
295 |
+
// Move exclusions from variable to settins
|
296 |
+
global $cleantalk_url_exclusions, $cleantalk_key_exclusions;
|
297 |
+
// URLs
|
298 |
+
if(!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)){
|
299 |
+
$apbct->settings['exclusions__urls'] = implode(',', $cleantalk_url_exclusions);
|
300 |
+
if(APBCT_WPMS){
|
301 |
+
$initial_blog = get_current_blog_id();
|
302 |
+
switch_to_blog( 1 );
|
303 |
+
}
|
304 |
+
$apbct->saveSettings();
|
305 |
+
if(APBCT_WPMS){
|
306 |
+
switch_to_blog($initial_blog);
|
307 |
+
}
|
308 |
+
}
|
309 |
+
// Fields
|
310 |
+
if(!empty($cleantalk_key_exclusions) && is_array($cleantalk_key_exclusions)){
|
311 |
+
$apbct->settings['exclusions__fields'] = implode(',', $cleantalk_key_exclusions);
|
312 |
+
if(APBCT_WPMS){
|
313 |
+
$initial_blog = get_current_blog_id();
|
314 |
+
switch_to_blog( 1 );
|
315 |
+
}
|
316 |
+
$apbct->saveSettings();
|
317 |
+
if(APBCT_WPMS){
|
318 |
+
switch_to_blog($initial_blog);
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
// Deleting legacy
|
323 |
+
if(isset($apbct->data['testing_failed'])){
|
324 |
+
unset($apbct->data['testing_failed']);
|
325 |
+
$apbct->saveData();
|
326 |
+
}
|
327 |
+
|
328 |
+
if(APBCT_WPMS){
|
329 |
+
|
330 |
+
// Whitelabel
|
331 |
+
// Reset "api_key_is_recieved" flag
|
332 |
+
global $wpdb;
|
333 |
+
$initial_blog = get_current_blog_id();
|
334 |
+
$blogs = array_keys( $wpdb->get_results( 'SELECT blog_id FROM ' . $wpdb->blogs, OBJECT_K ) );
|
335 |
+
foreach ( $blogs as $blog ){
|
336 |
+
switch_to_blog( $blog );
|
337 |
+
|
338 |
+
$settings = get_option( 'cleantalk_settings' );
|
339 |
+
if( isset( $settings['use_static_js_key'] ) ){
|
340 |
+
$settings['use_static_js_key'] = $settings['use_static_js_key'] === 0
|
341 |
+
? - 1
|
342 |
+
: $settings['use_static_js_key'];
|
343 |
+
update_option( 'cleantalk_settings', $settings );
|
344 |
+
|
345 |
+
$data = get_option( 'cleantalk_data' );
|
346 |
+
if( isset( $data['white_label_data']['is_key_recieved'] ) ){
|
347 |
+
unset( $data['white_label_data']['is_key_recieved'] );
|
348 |
+
update_option( 'cleantalk_data', $data );
|
349 |
+
}
|
350 |
+
}
|
351 |
+
switch_to_blog( $initial_blog );
|
352 |
+
|
353 |
+
if( defined( 'APBCT_WHITELABEL' ) ){
|
354 |
+
$apbct->network_settings = array(
|
355 |
+
'white_label' => defined( 'APBCT_WHITELABEL' ) && APBCT_WHITELABEL == true ? 1 : 0,
|
356 |
+
'white_label__hoster_key' => defined( 'APBCT_HOSTER_API_KEY' ) ? APBCT_HOSTER_API_KEY : '',
|
357 |
+
'white_label__plugin_name' => defined( 'APBCT_WHITELABEL_NAME' ) ? APBCT_WHITELABEL_NAME : APBCT_NAME,
|
358 |
+
);
|
359 |
+
}elseif( defined( 'CLEANTALK_ACCESS_KEY' ) ){
|
360 |
+
$apbct->network_settings = array(
|
361 |
+
'allow_custom_key' => 0,
|
362 |
+
'apikey' => CLEANTALK_ACCESS_KEY,
|
363 |
+
);
|
364 |
+
}
|
365 |
+
$apbct->saveNetworkSettings();
|
366 |
+
}
|
367 |
+
}else{
|
368 |
+
// Switch use_static_js_key to Auto if it was disabled
|
369 |
+
$apbct->settings['use_static_js_key'] = $apbct->settings['use_static_js_key'] === 0
|
370 |
+
? -1
|
371 |
+
: $apbct->settings['use_static_js_key'];
|
372 |
+
$apbct->saveSettings();
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
function apbct_update_to_5_127_1(){
|
377 |
+
if(APBCT_WPMS && is_main_site()){
|
378 |
+
global $apbct;
|
379 |
+
$network_settings = get_site_option( 'cleantalk_network_settings' );
|
380 |
+
if( $network_settings !== false && empty( $network_settings['allow_custom_key'] ) && empty( $network_settings['white_label'] ) ){
|
381 |
+
$network_settings['allow_custom_key'] = 1;
|
382 |
+
update_site_option( 'cleantalk_network_settings', $network_settings );
|
383 |
+
}
|
384 |
+
if( $network_settings !== false && $network_settings['white_label'] == 1 && $apbct->data['moderate'] == 0 ){
|
385 |
+
ct_account_status_check( $network_settings['apikey'] ? $network_settings['apikey'] : $apbct->settings['apikey'], false);
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
function apbct_update_to_5_128_0(){
|
391 |
+
global $apbct;
|
392 |
+
$apbct->remote_calls = array();
|
393 |
+
$apbct->save('remote_calls');
|
394 |
+
}
|
395 |
+
|
396 |
+
function apbct_update_to_5_133_0() {
|
397 |
+
|
398 |
+
global $wpdb;
|
399 |
+
|
400 |
+
// Scan comment/user log
|
401 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
402 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
403 |
+
`scan_type` varchar(11) NOT NULL,
|
404 |
+
`start_time` datetime NOT NULL,
|
405 |
+
`finish_time` datetime NOT NULL,
|
406 |
+
`count_to_scan` int(11) DEFAULT NULL,
|
407 |
+
`found_spam` int(11) DEFAULT NULL,
|
408 |
+
`found_bad` int(11) DEFAULT NULL,
|
409 |
+
PRIMARY KEY (`id`));';
|
410 |
+
|
411 |
+
apbct_activation__create_tables($sqls);
|
412 |
+
|
413 |
+
}
|
414 |
+
|
415 |
+
function apbct_update_to_5_138_0() {
|
416 |
+
|
417 |
+
global $wpdb;
|
418 |
+
|
419 |
+
// SQL queries for each blog
|
420 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
|
421 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
422 |
+
`scan_type` varchar(11) NOT NULL,
|
423 |
+
`start_time` datetime NOT NULL,
|
424 |
+
`finish_time` datetime NOT NULL,
|
425 |
+
`count_to_scan` int(11) DEFAULT NULL,
|
426 |
+
`found_spam` int(11) DEFAULT NULL,
|
427 |
+
`found_bad` int(11) DEFAULT NULL,
|
428 |
+
PRIMARY KEY (`id`));';
|
429 |
+
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
|
430 |
+
`network` int(11) unsigned NOT NULL,
|
431 |
+
`mask` int(11) unsigned NOT NULL,
|
432 |
+
INDEX ( `network` , `mask` )
|
433 |
+
);';
|
434 |
+
$sqls[] = 'ALTER TABLE `%scleantalk_sfw` ADD COLUMN status TINYINT(1) NOT NULL DEFAULT 0 AFTER mask;';
|
435 |
+
|
436 |
+
// Actions for WPMS
|
437 |
+
if( APBCT_WPMS ){
|
438 |
+
|
439 |
+
// Getting all blog ids
|
440 |
+
$initial_blog = get_current_blog_id();
|
441 |
+
$blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
|
442 |
+
|
443 |
+
// Getting main blog setting
|
444 |
+
switch_to_blog( 1 );
|
445 |
+
$main_blog_settings = get_option( 'cleantalk_settings' );
|
446 |
+
switch_to_blog( $initial_blog );
|
447 |
+
|
448 |
+
// Getting network settings
|
449 |
+
$net_settings = get_site_option('cleantalk_network_settings');
|
450 |
+
|
451 |
+
foreach ($blogs as $blog) {
|
452 |
+
|
453 |
+
// Update time limit to prevent exec time error
|
454 |
+
set_time_limit(20);
|
455 |
+
|
456 |
+
switch_to_blog($blog);
|
457 |
+
|
458 |
+
// Update SQL structure
|
459 |
+
apbct_activation__create_tables($sqls);
|
460 |
+
|
461 |
+
// Getting key
|
462 |
+
$settings = $net_settings['allow_custom_key']
|
463 |
+
? get_option('cleantalk_settings')
|
464 |
+
: $main_blog_settings;
|
465 |
+
|
466 |
+
// Update plugin status
|
467 |
+
if( ! empty( $settings['apikey'] ) ){
|
468 |
+
|
469 |
+
$data = get_option( 'cleantalk_data', array() );
|
470 |
+
|
471 |
+
$result = CleantalkAPI::method__notice_paid_till(
|
472 |
+
$settings['api_key'],
|
473 |
+
preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1),
|
474 |
+
! is_main_site() && $net_settings['white_label'] ? 'anti-spam-hosting' : 'antispam'
|
475 |
+
);
|
476 |
+
|
477 |
+
if( empty( $result['error'] ) || ! empty( $result['valid'] ) ){
|
478 |
+
|
479 |
+
// Notices
|
480 |
+
$data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
|
481 |
+
$data['notice_renew'] = isset($result['renew']) ? (int)$result['renew'] : 0;
|
482 |
+
$data['notice_trial'] = isset($result['trial']) ? (int)$result['trial'] : 0;
|
483 |
+
$data['notice_review'] = isset($result['show_review']) ? (int)$result['show_review'] : 0;
|
484 |
+
$data['notice_auto_update'] = isset($result['show_auto_update_notice']) ? (int)$result['show_auto_update_notice'] : 0;
|
485 |
+
|
486 |
+
// Other
|
487 |
+
$data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
|
488 |
+
$data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
|
489 |
+
$data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
|
490 |
+
$data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
|
491 |
+
$data['moderate_ip'] = isset($result['moderate_ip'], $result['ip_license']) ? (int)$result['moderate_ip'] : 0;
|
492 |
+
$data['spam_count'] = isset($result['spam_count']) ? (int)$result['spam_count'] : 0;
|
493 |
+
$data['auto_update'] = isset($result['auto_update_app']) ? (int)$result['auto_update_app'] : 0;
|
494 |
+
$data['user_token'] = isset($result['user_token']) ? (string)$result['user_token'] : '';
|
495 |
+
$data['license_trial'] = isset($result['license_trial']) ? (int)$result['license_trial'] : 0;
|
496 |
+
$data['account_name_ob'] = isset($result['account_name_ob']) ? (string)$result['account_name_ob'] : '';
|
497 |
+
|
498 |
+
}
|
499 |
+
|
500 |
+
$data['key_is_ok'] = ! empty( $result['valid'] )
|
501 |
+
? true
|
502 |
+
: false;
|
503 |
+
|
504 |
+
update_option( 'cleantalk_data', $data );
|
505 |
+
|
506 |
+
}
|
507 |
+
|
508 |
+
}
|
509 |
+
|
510 |
+
// Restoring initial blog
|
511 |
+
switch_to_blog($initial_blog);
|
512 |
+
|
513 |
+
// Actions for stand alone blog
|
514 |
+
}else{
|
515 |
+
apbct_activation__create_tables($sqls);
|
516 |
+
}
|
517 |
+
|
518 |
}
|
inc/find-spam/ClassCleantalkFindSpamUsersChecker.php
CHANGED
@@ -1,633 +1,632 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
class ClassCleantalkFindSpamUsersChecker extends ClassCleantalkFindSpamChecker
|
5 |
-
{
|
6 |
-
|
7 |
-
public function __construct() {
|
8 |
-
|
9 |
-
parent::__construct();
|
10 |
-
|
11 |
-
$this->page_title = esc_html__( 'Check users for spam', 'cleantalk' );
|
12 |
-
$this->page_script_name = 'users.php';
|
13 |
-
$this->page_slug = 'users';
|
14 |
-
|
15 |
-
// Preparing data
|
16 |
-
$current_user = wp_get_current_user();
|
17 |
-
if( ! empty( $_COOKIE['ct_paused_users_check'] ) )
|
18 |
-
$prev_check = json_decode( stripslashes( $_COOKIE['ct_paused_users_check'] ), true );
|
19 |
-
|
20 |
-
wp_enqueue_script( 'ct_users_checkspam', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-checkspam.min.js'), array( 'jquery', 'jqueryui' ), APBCT_VERSION );
|
21 |
-
wp_localize_script( 'ct_users_checkspam', 'ctUsersCheck', array(
|
22 |
-
'ct_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
|
23 |
-
'ct_prev_accurate' => !empty($prev_check['accurate']) ? true : false,
|
24 |
-
'ct_prev_from' => !empty($prev_check['from']) ? $prev_check['from'] : false,
|
25 |
-
'ct_prev_till' => !empty($prev_check['till']) ? $prev_check['till'] : false,
|
26 |
-
'ct_timeout' => __('Failed from timeout. Going to check users again.', 'cleantalk'),
|
27 |
-
'ct_timeout_delete' => __('Failed from timeout. Going to run a new attempt to delete spam users.', 'cleantalk'),
|
28 |
-
'ct_confirm_deletion_all' => __('Delete all spam users?', 'cleantalk'),
|
29 |
-
'ct_iusers' => __('users.', 'cleantalk'),
|
30 |
-
'ct_csv_filename' => "user_check_by_".$current_user->user_login,
|
31 |
-
'ct_status_string' => __("Checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'),
|
32 |
-
'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk')."</p>"
|
33 |
-
));
|
34 |
-
|
35 |
-
wp_enqueue_style( 'cleantalk_admin_css_settings_page', plugins_url().'/cleantalk-spam-protect/css/cleantalk-spam-check.min.css', array(), APBCT_VERSION, 'all' );
|
36 |
-
|
37 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTable.php');
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
public function getCurrentScanPage() {
|
42 |
-
|
43 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTableScan.php');
|
44 |
-
$this->list_table = new ABPCTUsersListTableScan();
|
45 |
-
|
46 |
-
$this->getCurrentScanPanel( $this );
|
47 |
-
echo '<form action="" method="POST">';
|
48 |
-
$this->list_table->display();
|
49 |
-
echo '</form>';
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
public function getTotalSpamPage(){
|
54 |
-
|
55 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTableSpam.php');
|
56 |
-
$this->list_table = new ABPCTUsersListTableSpam();
|
57 |
-
|
58 |
-
echo '<form action="" method="POST">';
|
59 |
-
$this->list_table->display();
|
60 |
-
echo '</form>';
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
public function getSpamLogsPage(){
|
65 |
-
|
66 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTableLogs.php');
|
67 |
-
$this->list_table = new ABPCTUsersListTableLogs();
|
68 |
-
|
69 |
-
echo '<form action="" method="POST">';
|
70 |
-
$this->list_table->display();
|
71 |
-
echo '</form>';
|
72 |
-
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Get date last checked user or date first registered user
|
77 |
-
*
|
78 |
-
* @return string date "M j Y"
|
79 |
-
*/
|
80 |
-
public static function lastCheckDate() {
|
81 |
-
|
82 |
-
// Checked users
|
83 |
-
$params = array(
|
84 |
-
'fields' => 'ID',
|
85 |
-
'meta_key' => 'ct_checked',
|
86 |
-
'count_total' => true,
|
87 |
-
'orderby' => 'ct_checked'
|
88 |
-
);
|
89 |
-
$tmp = new WP_User_Query( $params );
|
90 |
-
$cnt_checked = $tmp->get_total();
|
91 |
-
|
92 |
-
if( $cnt_checked > 0 ) {
|
93 |
-
|
94 |
-
// If we have checked users return last user reg date
|
95 |
-
$users = $tmp->get_results();
|
96 |
-
return self::getUserRegister( end( $users ) );
|
97 |
-
|
98 |
-
} else {
|
99 |
-
|
100 |
-
// If we have not any checked users return first user registered date
|
101 |
-
$params = array(
|
102 |
-
'fields' => 'ID',
|
103 |
-
'number' => 1,
|
104 |
-
'orderby' => 'user_registered'
|
105 |
-
);
|
106 |
-
$tmp = new WP_User_Query( $params );
|
107 |
-
|
108 |
-
return self::getUserRegister( current( $tmp->get_results() ) );
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Get date user registered
|
116 |
-
*
|
117 |
-
* @param $user_id
|
118 |
-
* @return string Date format"M j Y"
|
119 |
-
*/
|
120 |
-
private static function getUserRegister( $user_id ) {
|
121 |
-
|
122 |
-
$user_data = get_userdata( $user_id );
|
123 |
-
$registered = $user_data->user_registered;
|
124 |
-
|
125 |
-
return date( "M j Y", strtotime( $registered ) );
|
126 |
-
|
127 |
-
}
|
128 |
-
|
129 |
-
static function ct_ajax_check_users(){
|
130 |
-
|
131 |
-
check_ajax_referer('ct_secret_nonce', 'security');
|
132 |
-
|
133 |
-
global $apbct, $wpdb;
|
134 |
-
|
135 |
-
$amount = !empty($_POST['amount']) && intval($_POST['amount'])
|
136 |
-
? intval($_POST['amount'])
|
137 |
-
: 100;
|
138 |
-
|
139 |
-
$skip_roles = array(
|
140 |
-
'administrator'
|
141 |
-
);
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
$
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
'
|
169 |
-
'
|
170 |
-
'
|
171 |
-
'
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
$
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
$
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
$
|
209 |
-
update_user_meta( $u[$i]->ID,'
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
$u[$i]->
|
219 |
-
$u[$i]->
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
$
|
242 |
-
update_user_meta( $u[$i]->ID, '
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$
|
248 |
-
$user_roles
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
$
|
256 |
-
|
257 |
-
|
258 |
-
$
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
$
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
$check_result['
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
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 |
-
|
317 |
-
|
318 |
-
|
319 |
-
AND meta_value
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
INNER JOIN {$wpdb->usermeta} AS
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
INNER JOIN {$wpdb->usermeta} AS
|
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 |
-
INNER JOIN {$wpdb->usermeta} AS
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
INNER JOIN {$wpdb->usermeta} AS
|
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 |
-
$text .= $u[$i]->
|
476 |
-
$text .= $
|
477 |
-
$text .=
|
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 |
-
|
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 |
-
$columns
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
*
|
602 |
-
*
|
603 |
-
* @param $
|
604 |
-
* @param $
|
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 |
-
return $value;
|
630 |
-
|
631 |
-
}
|
632 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class ClassCleantalkFindSpamUsersChecker extends ClassCleantalkFindSpamChecker
|
5 |
+
{
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
|
9 |
+
parent::__construct();
|
10 |
+
|
11 |
+
$this->page_title = esc_html__( 'Check users for spam', 'cleantalk' );
|
12 |
+
$this->page_script_name = 'users.php';
|
13 |
+
$this->page_slug = 'users';
|
14 |
+
|
15 |
+
// Preparing data
|
16 |
+
$current_user = wp_get_current_user();
|
17 |
+
if( ! empty( $_COOKIE['ct_paused_users_check'] ) )
|
18 |
+
$prev_check = json_decode( stripslashes( $_COOKIE['ct_paused_users_check'] ), true );
|
19 |
+
|
20 |
+
wp_enqueue_script( 'ct_users_checkspam', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-checkspam.min.js'), array( 'jquery', 'jqueryui' ), APBCT_VERSION );
|
21 |
+
wp_localize_script( 'ct_users_checkspam', 'ctUsersCheck', array(
|
22 |
+
'ct_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
|
23 |
+
'ct_prev_accurate' => !empty($prev_check['accurate']) ? true : false,
|
24 |
+
'ct_prev_from' => !empty($prev_check['from']) ? $prev_check['from'] : false,
|
25 |
+
'ct_prev_till' => !empty($prev_check['till']) ? $prev_check['till'] : false,
|
26 |
+
'ct_timeout' => __('Failed from timeout. Going to check users again.', 'cleantalk'),
|
27 |
+
'ct_timeout_delete' => __('Failed from timeout. Going to run a new attempt to delete spam users.', 'cleantalk'),
|
28 |
+
'ct_confirm_deletion_all' => __('Delete all spam users?', 'cleantalk'),
|
29 |
+
'ct_iusers' => __('users.', 'cleantalk'),
|
30 |
+
'ct_csv_filename' => "user_check_by_".$current_user->user_login,
|
31 |
+
'ct_status_string' => __("Checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'),
|
32 |
+
'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk')."</p>"
|
33 |
+
));
|
34 |
+
|
35 |
+
wp_enqueue_style( 'cleantalk_admin_css_settings_page', plugins_url().'/cleantalk-spam-protect/css/cleantalk-spam-check.min.css', array(), APBCT_VERSION, 'all' );
|
36 |
+
|
37 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTable.php');
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getCurrentScanPage() {
|
42 |
+
|
43 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTableScan.php');
|
44 |
+
$this->list_table = new ABPCTUsersListTableScan();
|
45 |
+
|
46 |
+
$this->getCurrentScanPanel( $this );
|
47 |
+
echo '<form action="" method="POST">';
|
48 |
+
$this->list_table->display();
|
49 |
+
echo '</form>';
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getTotalSpamPage(){
|
54 |
+
|
55 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTableSpam.php');
|
56 |
+
$this->list_table = new ABPCTUsersListTableSpam();
|
57 |
+
|
58 |
+
echo '<form action="" method="POST">';
|
59 |
+
$this->list_table->display();
|
60 |
+
echo '</form>';
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getSpamLogsPage(){
|
65 |
+
|
66 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkUsersListTableLogs.php');
|
67 |
+
$this->list_table = new ABPCTUsersListTableLogs();
|
68 |
+
|
69 |
+
echo '<form action="" method="POST">';
|
70 |
+
$this->list_table->display();
|
71 |
+
echo '</form>';
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get date last checked user or date first registered user
|
77 |
+
*
|
78 |
+
* @return string date "M j Y"
|
79 |
+
*/
|
80 |
+
public static function lastCheckDate() {
|
81 |
+
|
82 |
+
// Checked users
|
83 |
+
$params = array(
|
84 |
+
'fields' => 'ID',
|
85 |
+
'meta_key' => 'ct_checked',
|
86 |
+
'count_total' => true,
|
87 |
+
'orderby' => 'ct_checked'
|
88 |
+
);
|
89 |
+
$tmp = new WP_User_Query( $params );
|
90 |
+
$cnt_checked = $tmp->get_total();
|
91 |
+
|
92 |
+
if( $cnt_checked > 0 ) {
|
93 |
+
|
94 |
+
// If we have checked users return last user reg date
|
95 |
+
$users = $tmp->get_results();
|
96 |
+
return self::getUserRegister( end( $users ) );
|
97 |
+
|
98 |
+
} else {
|
99 |
+
|
100 |
+
// If we have not any checked users return first user registered date
|
101 |
+
$params = array(
|
102 |
+
'fields' => 'ID',
|
103 |
+
'number' => 1,
|
104 |
+
'orderby' => 'user_registered'
|
105 |
+
);
|
106 |
+
$tmp = new WP_User_Query( $params );
|
107 |
+
|
108 |
+
return self::getUserRegister( current( $tmp->get_results() ) );
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Get date user registered
|
116 |
+
*
|
117 |
+
* @param $user_id
|
118 |
+
* @return string Date format"M j Y"
|
119 |
+
*/
|
120 |
+
private static function getUserRegister( $user_id ) {
|
121 |
+
|
122 |
+
$user_data = get_userdata( $user_id );
|
123 |
+
$registered = $user_data->user_registered;
|
124 |
+
|
125 |
+
return date( "M j Y", strtotime( $registered ) );
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
static function ct_ajax_check_users(){
|
130 |
+
|
131 |
+
check_ajax_referer('ct_secret_nonce', 'security');
|
132 |
+
|
133 |
+
global $apbct, $wpdb;
|
134 |
+
|
135 |
+
$amount = !empty($_POST['amount']) && intval($_POST['amount'])
|
136 |
+
? intval($_POST['amount'])
|
137 |
+
: 100;
|
138 |
+
|
139 |
+
$skip_roles = array(
|
140 |
+
'administrator'
|
141 |
+
);
|
142 |
+
|
143 |
+
$from_till = '';
|
144 |
+
|
145 |
+
if(isset($_POST['from'], $_POST['till'])){
|
146 |
+
|
147 |
+
$from_date = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
|
148 |
+
$till_date = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
|
149 |
+
|
150 |
+
$from_till = " AND $wpdb->users.user_registered >= '$from_date' AND $wpdb->users.user_registered <= '$till_date'";
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
$u = $wpdb->get_results("
|
155 |
+
SELECT {$wpdb->users}.ID, {$wpdb->users}.user_email, {$wpdb->users}.user_registered
|
156 |
+
FROM {$wpdb->users}
|
157 |
+
WHERE
|
158 |
+
NOT EXISTS(SELECT * FROM {$wpdb->usermeta} as meta WHERE {$wpdb->users}.ID = meta.user_id AND meta.meta_key = 'ct_bad') AND
|
159 |
+
NOT EXISTS(SELECT * FROM {$wpdb->usermeta} as meta WHERE {$wpdb->users}.ID = meta.user_id AND meta.meta_key = 'ct_checked') AND
|
160 |
+
NOT EXISTS(SELECT * FROM {$wpdb->usermeta} as meta WHERE {$wpdb->users}.ID = meta.user_id AND meta.meta_key = 'ct_checked_now')
|
161 |
+
$from_till
|
162 |
+
ORDER BY {$wpdb->users}.user_registered ASC
|
163 |
+
LIMIT $amount;"
|
164 |
+
);
|
165 |
+
|
166 |
+
$check_result = array(
|
167 |
+
'end' => 0,
|
168 |
+
'checked' => 0,
|
169 |
+
'spam' => 0,
|
170 |
+
'bad' => 0,
|
171 |
+
'error' => 0
|
172 |
+
);
|
173 |
+
|
174 |
+
if( count($u) > 0 ){
|
175 |
+
|
176 |
+
if( ! empty( $_POST['accurate_check'] ) ){
|
177 |
+
// Leaving users only with first comment's date. Unsetting others.
|
178 |
+
foreach( $u as $user_index => $user ){
|
179 |
+
|
180 |
+
if( ! isset( $curr_date ) )
|
181 |
+
$curr_date = ( substr( $user->user_registered, 0, 10 ) ? substr( $user->user_registered, 0, 10 ) : '' );
|
182 |
+
|
183 |
+
if( substr( $user->user_registered, 0, 10 ) != $curr_date )
|
184 |
+
unset( $u[$user_index] );
|
185 |
+
|
186 |
+
}
|
187 |
+
unset( $user_index, $user );
|
188 |
+
}
|
189 |
+
|
190 |
+
// Checking comments IP/Email. Gathering $data for check.
|
191 |
+
$data = array();
|
192 |
+
|
193 |
+
for( $i=0; $i < count($u); $i++ ){
|
194 |
+
|
195 |
+
$user_meta = get_user_meta( $u[$i]->ID, 'session_tokens', true );
|
196 |
+
if( is_array( $user_meta ) )
|
197 |
+
$user_meta = array_values( $user_meta );
|
198 |
+
|
199 |
+
$curr_ip = !empty( $user_meta[0]['ip' ]) ? trim( $user_meta[0]['ip'] ) : '';
|
200 |
+
$curr_email = !empty( $u[$i]->user_email ) ? trim( $u[$i]->user_email ) : '';
|
201 |
+
|
202 |
+
// Check for identity
|
203 |
+
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
204 |
+
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
205 |
+
|
206 |
+
if( empty( $curr_ip ) && empty( $curr_email ) ){
|
207 |
+
$check_result['bad']++;
|
208 |
+
update_user_meta( $u[$i]->ID,'ct_bad','1',true );
|
209 |
+
update_user_meta( $u[$i]->ID, 'ct_checked', date("Y-m-d H:m:s"), true) ;
|
210 |
+
unset( $u[$i] );
|
211 |
+
}else{
|
212 |
+
if( !empty( $curr_ip ) )
|
213 |
+
$data[] = $curr_ip;
|
214 |
+
if( !empty( $curr_email ) )
|
215 |
+
$data[] = $curr_email;
|
216 |
+
// Patch for empty IP/Email
|
217 |
+
$u[$i]->data = new \stdClass();
|
218 |
+
$u[$i]->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
|
219 |
+
$u[$i]->user_email = empty($curr_email) ? 'none' : $curr_email;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
// Recombining after checking and unsettting
|
224 |
+
$u = array_values( $u );
|
225 |
+
|
226 |
+
// Drop if data empty and there's no users to check
|
227 |
+
if( count( $data ) == 0 ){
|
228 |
+
if( $_POST['unchecked'] === 0 )
|
229 |
+
$check_result['end'] = 1;
|
230 |
+
print json_encode( $check_result );
|
231 |
+
die();
|
232 |
+
}
|
233 |
+
|
234 |
+
$result = CleantalkAPI::method__spam_check_cms( $apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null );
|
235 |
+
|
236 |
+
if( empty( $result['error'] ) ){
|
237 |
+
|
238 |
+
for( $i=0; $i < sizeof( $u ); $i++ ) {
|
239 |
+
|
240 |
+
$check_result['checked']++;
|
241 |
+
update_user_meta( $u[$i]->ID, 'ct_checked', date("Y-m-d H:m:s"), true) ;
|
242 |
+
update_user_meta( $u[$i]->ID, 'ct_checked_now', date("Y-m-d H:m:s"), true) ;
|
243 |
+
|
244 |
+
// Do not display forbidden roles.
|
245 |
+
foreach ( $skip_roles as $role ) {
|
246 |
+
$user_meta = get_userdata($u[$i]->ID);
|
247 |
+
$user_roles = $user_meta->roles;
|
248 |
+
if ( in_array( $role, $user_roles ) ){
|
249 |
+
delete_user_meta( $u[$i]->ID, 'ct_marked_as_spam' );
|
250 |
+
continue 2;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
$mark_spam_ip = false;
|
255 |
+
$mark_spam_email = false;
|
256 |
+
|
257 |
+
$uip = $u[$i]->user_ip;
|
258 |
+
$uim = $u[$i]->user_email;
|
259 |
+
|
260 |
+
if( isset( $result[$uip] ) && $result[$uip]['appears'] == 1 )
|
261 |
+
$mark_spam_ip = true;
|
262 |
+
|
263 |
+
if( isset($result[$uim]) && $result[$uim]['appears'] == 1 )
|
264 |
+
$mark_spam_email = true;
|
265 |
+
|
266 |
+
if ( $mark_spam_ip || $mark_spam_email ){
|
267 |
+
$check_result['spam']++;
|
268 |
+
update_user_meta( $u[$i]->ID, 'ct_marked_as_spam', '1', true );
|
269 |
+
}
|
270 |
+
|
271 |
+
}
|
272 |
+
|
273 |
+
echo json_encode( $check_result );
|
274 |
+
|
275 |
+
} else {
|
276 |
+
|
277 |
+
$check_result['error'] = 1;
|
278 |
+
$check_result['error_message'] = $result['error'];
|
279 |
+
|
280 |
+
echo json_encode( $check_result );
|
281 |
+
|
282 |
+
}
|
283 |
+
} else {
|
284 |
+
|
285 |
+
$check_result['end'] = 1;
|
286 |
+
|
287 |
+
$log_data = static::get_log_data();
|
288 |
+
static::writeSpamLog( 'users', date("Y-m-d H:i:s"), $log_data['checked'], $log_data['spam'], $log_data['bad'] );
|
289 |
+
|
290 |
+
echo json_encode( $check_result );
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
die;
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Run query for deleting 'ct_checked_now' meta. Need for the new scan.
|
300 |
+
*
|
301 |
+
* @return void
|
302 |
+
*/
|
303 |
+
public static function ct_ajax_clear_users()
|
304 |
+
{
|
305 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
306 |
+
|
307 |
+
global $wpdb;
|
308 |
+
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_checked_now')");
|
309 |
+
|
310 |
+
if ( isset($_POST['from']) && isset($_POST['till']) ) {
|
311 |
+
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'] ) ) {
|
312 |
+
|
313 |
+
$from = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
|
314 |
+
$till = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
|
315 |
+
|
316 |
+
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE
|
317 |
+
meta_key IN ('ct_checked','ct_marked_as_spam','ct_bad')
|
318 |
+
AND meta_value >= '{$from}'
|
319 |
+
AND meta_value <= '{$till}';");
|
320 |
+
|
321 |
+
die();
|
322 |
+
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
die();
|
327 |
+
}
|
328 |
+
|
329 |
+
public static function ct_ajax_info($direct_call = false) {
|
330 |
+
|
331 |
+
if (!$direct_call)
|
332 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
333 |
+
|
334 |
+
global $wpdb;
|
335 |
+
|
336 |
+
// Checked users
|
337 |
+
$cnt_checked = $wpdb->get_results("
|
338 |
+
SELECT COUNT(*) AS cnt
|
339 |
+
FROM {$wpdb->usermeta}
|
340 |
+
WHERE meta_key='ct_checked_now'"
|
341 |
+
)[0]->cnt;
|
342 |
+
|
343 |
+
// Spam users
|
344 |
+
$cnt_spam = $wpdb->get_results("
|
345 |
+
SELECT COUNT({$wpdb->users}.ID) AS cnt
|
346 |
+
FROM {$wpdb->users}
|
347 |
+
INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
|
348 |
+
INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
|
349 |
+
WHERE
|
350 |
+
meta1.meta_key = 'ct_marked_as_spam' AND
|
351 |
+
meta2.meta_key = 'ct_checked_now';"
|
352 |
+
)[0]->cnt;
|
353 |
+
|
354 |
+
// Bad users (without IP and Email)
|
355 |
+
$cnt_bad = $wpdb->get_results("
|
356 |
+
SELECT COUNT({$wpdb->users}.ID) AS cnt
|
357 |
+
FROM {$wpdb->users}
|
358 |
+
INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
|
359 |
+
INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
|
360 |
+
WHERE
|
361 |
+
meta1.meta_key = 'ct_bad' AND
|
362 |
+
meta2.meta_key = 'ct_checked_now';"
|
363 |
+
)[0]->cnt;
|
364 |
+
|
365 |
+
$return = array(
|
366 |
+
'message' => '',
|
367 |
+
'spam' => $cnt_spam,
|
368 |
+
'checked' => $cnt_checked,
|
369 |
+
'bad' => $cnt_bad,
|
370 |
+
);
|
371 |
+
|
372 |
+
if( ! $direct_call ) {
|
373 |
+
$return['message'] .= sprintf (
|
374 |
+
esc_html__('Checked %s, found %s spam users and %s bad users (without IP or email)', 'cleantalk'),
|
375 |
+
$cnt_checked,
|
376 |
+
$cnt_spam,
|
377 |
+
$cnt_bad
|
378 |
+
);
|
379 |
+
} else {
|
380 |
+
if( isset( $return['checked'] ) && 0 == $return['checked'] ) {
|
381 |
+
$return['message'] = esc_html__( 'Never checked yet or no new spam.', 'cleantalk' );
|
382 |
+
} else {
|
383 |
+
$return['message'] .= sprintf (
|
384 |
+
__("Last check %s: checked %s users, found %s spam users and %s bad users (without IP or email).", 'cleantalk'),
|
385 |
+
self::lastCheckDate(),
|
386 |
+
$cnt_checked,
|
387 |
+
$cnt_spam,
|
388 |
+
$cnt_bad
|
389 |
+
);
|
390 |
+
}
|
391 |
+
}
|
392 |
+
|
393 |
+
$backup_notice = ' ';
|
394 |
+
if ($cnt_spam > 0) {
|
395 |
+
$backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
|
396 |
+
}
|
397 |
+
$return['message'] .= "<p>$backup_notice</p>";
|
398 |
+
|
399 |
+
if($direct_call){
|
400 |
+
return $return['message'];
|
401 |
+
}else{
|
402 |
+
echo json_encode($return);
|
403 |
+
die();
|
404 |
+
}
|
405 |
+
}
|
406 |
+
|
407 |
+
private static function get_log_data() {
|
408 |
+
|
409 |
+
global $wpdb;
|
410 |
+
|
411 |
+
// Checked users
|
412 |
+
$cnt_checked = $wpdb->get_results("
|
413 |
+
SELECT COUNT(*) AS cnt
|
414 |
+
FROM {$wpdb->usermeta}
|
415 |
+
WHERE meta_key='ct_checked_now'"
|
416 |
+
)[0]->cnt;
|
417 |
+
|
418 |
+
// Spam users
|
419 |
+
$cnt_spam = $wpdb->get_results("
|
420 |
+
SELECT COUNT({$wpdb->users}.ID) AS cnt
|
421 |
+
FROM {$wpdb->users}
|
422 |
+
INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
|
423 |
+
INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
|
424 |
+
WHERE
|
425 |
+
meta1.meta_key = 'ct_marked_as_spam' AND
|
426 |
+
meta2.meta_key = 'ct_checked_now';"
|
427 |
+
)[0]->cnt;
|
428 |
+
|
429 |
+
// Bad users (without IP and Email)
|
430 |
+
$cnt_bad = $wpdb->get_results("
|
431 |
+
SELECT COUNT({$wpdb->users}.ID) AS cnt
|
432 |
+
FROM {$wpdb->users}
|
433 |
+
INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
|
434 |
+
INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
|
435 |
+
WHERE
|
436 |
+
meta1.meta_key = 'ct_bad' AND
|
437 |
+
meta2.meta_key = 'ct_checked_now';"
|
438 |
+
)[0]->cnt;
|
439 |
+
|
440 |
+
return array(
|
441 |
+
'spam' => $cnt_spam,
|
442 |
+
'checked' => $cnt_checked,
|
443 |
+
'bad' => $cnt_bad,
|
444 |
+
);
|
445 |
+
|
446 |
+
}
|
447 |
+
|
448 |
+
/**
|
449 |
+
* Admin action 'wp_ajax_ajax_ct_get_csv_file' - prints CSV file to AJAX
|
450 |
+
*/
|
451 |
+
public static function ct_get_csv_file() {
|
452 |
+
|
453 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
454 |
+
|
455 |
+
$text = 'login,email,ip' . PHP_EOL;
|
456 |
+
|
457 |
+
$params = array(
|
458 |
+
'meta_query' => array(
|
459 |
+
array(
|
460 |
+
'key' => 'ct_marked_as_spam',
|
461 |
+
'compare' => '1'
|
462 |
+
),
|
463 |
+
),
|
464 |
+
'orderby' => 'registered',
|
465 |
+
'order' => 'ASC',
|
466 |
+
);
|
467 |
+
|
468 |
+
$u = get_users( $params );
|
469 |
+
|
470 |
+
for( $i=0; $i < count($u); $i++ ){
|
471 |
+
$user_meta = get_user_meta( $u[$i]->ID, 'session_tokens', true );
|
472 |
+
if( is_array( $user_meta ) )
|
473 |
+
$user_meta = array_values( $user_meta );
|
474 |
+
$text .= $u[$i]->user_login.',';
|
475 |
+
$text .= $u[$i]->data->user_email.',';
|
476 |
+
$text .= ! empty( $user_meta[0]['ip']) ? trim( $user_meta[0]['ip'] ) : '';
|
477 |
+
$text .= PHP_EOL;
|
478 |
+
}
|
479 |
+
|
480 |
+
$filename = ! empty( $_POST['filename'] ) ? $_POST['filename'] : false;
|
481 |
+
|
482 |
+
if( $filename !== false ) {
|
483 |
+
header('Content-Type: text/csv');
|
484 |
+
echo $text;
|
485 |
+
} else {
|
486 |
+
echo 'Export error.'; // file not exists or empty $_POST['filename']
|
487 |
+
}
|
488 |
+
die();
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
public static function ct_ajax_insert_users()
|
493 |
+
{
|
494 |
+
|
495 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
496 |
+
|
497 |
+
//* DELETION
|
498 |
+
if(!empty($_POST['delete'])){
|
499 |
+
$users = get_users(array('search' => 'user_*', 'search_columns' => array('login', 'nicename')));
|
500 |
+
$deleted = 0;
|
501 |
+
$amount_to_delete = 1000;
|
502 |
+
foreach($users as $user){
|
503 |
+
if($deleted >= $amount_to_delete)
|
504 |
+
break;
|
505 |
+
if(wp_delete_user($user->ID))
|
506 |
+
$deleted++;
|
507 |
+
}
|
508 |
+
print "$deleted";
|
509 |
+
die();
|
510 |
+
}
|
511 |
+
//*/
|
512 |
+
|
513 |
+
//* INSERTION
|
514 |
+
global $wpdb;
|
515 |
+
$to_insert = 500;
|
516 |
+
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
517 |
+
|
518 |
+
if($result){
|
519 |
+
$ip = array();
|
520 |
+
foreach($result as $value){
|
521 |
+
$ips[] = long2ip($value['network']);
|
522 |
+
}
|
523 |
+
unset($value);
|
524 |
+
|
525 |
+
$inserted = 0;
|
526 |
+
for($i=0; $i<$to_insert; $i++){
|
527 |
+
$rnd=mt_rand(1,10000000);
|
528 |
+
|
529 |
+
$user_name = "user_$rnd";
|
530 |
+
$email="stop_email_$rnd@example.com";
|
531 |
+
|
532 |
+
$user_id = wp_create_user(
|
533 |
+
$user_name,
|
534 |
+
rand(),
|
535 |
+
$email
|
536 |
+
);
|
537 |
+
|
538 |
+
$curr_user = get_user_by('email', $email);
|
539 |
+
|
540 |
+
update_user_meta($curr_user->ID, 'session_tokens', array($rnd => array('ip' => $ips[$i])));
|
541 |
+
|
542 |
+
if (is_int($user_id))
|
543 |
+
$inserted++;
|
544 |
+
|
545 |
+
}
|
546 |
+
}else{
|
547 |
+
$inserted = '0';
|
548 |
+
}
|
549 |
+
//*/
|
550 |
+
|
551 |
+
print "$inserted";
|
552 |
+
die();
|
553 |
+
}
|
554 |
+
|
555 |
+
public static function ct_ajax_delete_all_users($count_all = 0)
|
556 |
+
{
|
557 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
558 |
+
|
559 |
+
global $wpdb;
|
560 |
+
|
561 |
+
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", OBJECT );
|
562 |
+
|
563 |
+
if(!empty($r)){
|
564 |
+
|
565 |
+
$count_all = $r ? $r[0]->cnt : 0;
|
566 |
+
|
567 |
+
$args = array(
|
568 |
+
'meta_key' => 'ct_marked_as_spam',
|
569 |
+
'meta_value' => '1',
|
570 |
+
'fields' => array('ID'),
|
571 |
+
'number' => 50
|
572 |
+
);
|
573 |
+
$users = get_users($args);
|
574 |
+
|
575 |
+
if ($users){
|
576 |
+
foreach($users as $user){
|
577 |
+
wp_delete_user($user->ID);
|
578 |
+
usleep(5000);
|
579 |
+
}
|
580 |
+
}
|
581 |
+
}
|
582 |
+
|
583 |
+
die($count_all);
|
584 |
+
}
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Add hidden column into the users table
|
588 |
+
*
|
589 |
+
* @param $columns
|
590 |
+
* @return mixed
|
591 |
+
*/
|
592 |
+
public static function ct_manage_users_columns( $columns ) {
|
593 |
+
|
594 |
+
$columns['apbct_status hidden'] = '';
|
595 |
+
return $columns;
|
596 |
+
|
597 |
+
}
|
598 |
+
|
599 |
+
/**
|
600 |
+
* Generates <span> with information about user scan using user's meta.
|
601 |
+
*
|
602 |
+
* @param $value
|
603 |
+
* @param $column_name
|
604 |
+
* @param $user_id
|
605 |
+
* @return string
|
606 |
+
*/
|
607 |
+
public static function ct_manage_users_custom_column( $value, $column_name, $user_id ) {
|
608 |
+
|
609 |
+
if( 'apbct_status hidden' == $column_name ) {
|
610 |
+
|
611 |
+
$is_checked = get_user_meta( $user_id, 'ct_checked', true);
|
612 |
+
if( ! empty( $is_checked ) ) {
|
613 |
+
$is_checked = date( 'M d Y', strtotime( $is_checked ) );
|
614 |
+
$is_spam = get_user_meta( $user_id, 'ct_marked_as_spam', true );
|
615 |
+
if( ! empty( $is_spam ) ) {
|
616 |
+
$text = sprintf( esc_html__( 'SPAM. Checked %s.', 'cleantalk' ), $is_checked );
|
617 |
+
$value = '<span id="apbct_checked_spam">' . $text . '</span>';
|
618 |
+
} else {
|
619 |
+
$text = sprintf( esc_html__( 'Not spam. Checked %s.', 'cleantalk' ), $is_checked );
|
620 |
+
$value = '<span id="apbct_checked_not_spam">' . $text . '</span>';
|
621 |
+
}
|
622 |
+
} else {
|
623 |
+
$value = '<span id="apbct_not_checked">' . esc_html__( 'Not checked yet. Anti-Spam by CleanTalk.', 'cleantalk' ) . '</span>';
|
624 |
+
}
|
625 |
+
|
626 |
+
}
|
627 |
+
|
628 |
+
return $value;
|
|
|
|
|
|
|
|