Version Description
September 30 2019 = * Fix: Delete redirect notice on external forms * Fix: Storing spam for 15 days. * Fix: correct DiVi display message. * Integration: Ultimate Members. * Mod: Setting "Use static JS key" switched to "Auto" if it was "No". Default is "Auto". * Mod: Moving White Label option to main site settings. * New: Use static JS key if cache plugin detected. * New: Settings for URLs, fields, roles exclusions. * New: Regular Expressions support in URLs, fields exclusions. * New: Send validation errors on standard registration form. * Updater: Move exclusions from global variable to settings. * Deprecated: IP exclusions.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.127 |
Comparing to | |
See all releases |
Code changes from version 5.126 to 5.127
- cleantalk.php +68 -34
- css/cleantalk-admin-settings-page.min.css +1 -1
- css/cleantalk-admin.min.css +1 -1
- css/cleantalk-icons.min.css +1 -0
- css/fonts/icons/icons.eot +0 -0
- css/fonts/icons/icons.svg +240 -0
- css/fonts/icons/icons.ttf +0 -0
- css/fonts/icons/icons.woff +0 -0
- css/fonts/icons/icons.woff2 +0 -0
- inc/cleantalk-admin.php +15 -12
- inc/cleantalk-ajax.php +22 -17
- inc/cleantalk-common.php +105 -108
- inc/cleantalk-public.php +119 -38
- inc/cleantalk-settings.php +555 -248
- inc/cleantalk-updater.php +373 -298
- inc/cleantalk-users.php +686 -686
- js/apbct-common.min.js +2 -0
- js/apbct-common.min.js.map +1 -0
- js/apbct-fingerprint.min.js.map +1 -1
- js/apbct-public--alt.min.js.map +1 -1
- js/apbct-public.min.js +1 -1
- js/apbct-public.min.js.map +1 -1
- js/cleantalk-admin-settings-page.min.js +1 -1
- js/cleantalk-admin-settings-page.min.js.map +1 -1
- js/cleantalk-admin.min.js +1 -1
- js/cleantalk-admin.min.js.map +1 -1
- js/cleantalk-comments-checkspam.min.js.map +1 -1
- js/cleantalk-comments-editscreen.min.js.map +1 -1
- js/cleantalk-dashboard-widget.min.js.map +1 -1
- js/cleantalk-debug-ajax.min.js.map +1 -1
- js/cleantalk-public-admin.min.js.map +1 -1
- js/cleantalk-users-checkspam.min.js.map +1 -1
- js/cleantalk-users-editscreen.min.js.map +1 -1
- js/cleantalk_external.min.js +1 -1
- js/cleantalk_external.min.js.map +1 -1
- js/cleantalk_internal.min.js.map +1 -1
- js/cleantalk_nocache.min.js.map +1 -1
- lib/Cleantalk/Antispam/API.php +773 -773
- lib/Cleantalk/Antispam/DB.php +110 -110
- lib/Cleantalk/Antispam/Helper.php +7 -3
- lib/Cleantalk/Antispam/SFW.php +332 -332
- lib/Cleantalk/Arr.php +253 -0
- lib/CleantalkAPI.php +66 -66
- lib/CleantalkDB.php +149 -149
- lib/CleantalkHelper.php +48 -48
- lib/CleantalkSFW.php +141 -136
- lib/CleantalkState.php +74 -39
- readme.txt +29 -8
cleantalk.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Anti-Spam by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
Text Domain: cleantalk
|
@@ -54,7 +54,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
54 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
|
55 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
|
56 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
|
57 |
-
include_once(CLEANTALK_PLUGIN_DIR .
|
|
|
58 |
|
59 |
// Child classes
|
60 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkAPI.php'); // API for Wordpress
|
@@ -73,21 +74,23 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
73 |
|
74 |
// Global ArrayObject with settings and other global varables
|
75 |
global $apbct;
|
76 |
-
$apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors', 'remote_calls', 'stats')
|
77 |
|
78 |
-
$apbct->white_label = defined('APBCT_WHITELABEL') && APBCT_WHITELABEL == true ? true : false;
|
79 |
-
|
80 |
-
// Customize CleantalkState
|
81 |
-
// Account status
|
82 |
$apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
|
83 |
-
$apbct->plugin_name = defined('APBCT_WHITELABEL_NAME') ? APBCT_WHITELABEL_NAME : APBCT_NAME; // For test purposes
|
84 |
|
85 |
$apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
|
86 |
$apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
|
87 |
$apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
|
88 |
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
$apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
93 |
$apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
@@ -96,7 +99,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
96 |
|
97 |
if(!$apbct->white_label){
|
98 |
require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
99 |
-
$apbct->settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $apbct->settings['apikey'];
|
100 |
}
|
101 |
|
102 |
// Passing JS key to frontend
|
@@ -105,6 +107,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
105 |
|
106 |
// Database prefix
|
107 |
global $wpdb;
|
|
|
108 |
$apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
|
109 |
// Database constants
|
110 |
define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
|
@@ -253,8 +256,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
253 |
add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
|
254 |
|
255 |
add_action('admin_init', 'apbct_admin__init', 1);
|
256 |
-
add_action('admin_menu', '
|
257 |
-
add_action('network_admin_menu', '
|
258 |
add_action('admin_notices', 'apbct_admin__notice_message');
|
259 |
add_action('network_admin_notices', 'apbct_admin__notice_message');
|
260 |
|
@@ -296,8 +299,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
296 |
add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
|
297 |
|
298 |
// Formidable
|
299 |
-
add_filter( 'frm_entries_before_create', '
|
300 |
-
add_action( 'frm_entries_footer_scripts', '
|
301 |
|
302 |
// Some of plugins to register a users use AJAX context.
|
303 |
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
@@ -579,7 +582,7 @@ function apbct_sfw__check()
|
|
579 |
}else{
|
580 |
reset($sfw->passed_ips);
|
581 |
if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
|
582 |
-
setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false
|
583 |
}
|
584 |
}
|
585 |
unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
|
@@ -597,7 +600,7 @@ function apbct_activation( $network = false ) {
|
|
597 |
`network` int(11) unsigned NOT NULL,
|
598 |
`mask` int(11) unsigned NOT NULL,
|
599 |
INDEX ( `network` , `mask` )
|
600 |
-
)
|
601 |
|
602 |
// SFW log
|
603 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
@@ -605,8 +608,7 @@ function apbct_activation( $network = false ) {
|
|
605 |
`all_entries` INT NOT NULL,
|
606 |
`blocked_entries` INT NOT NULL,
|
607 |
`entries_timestamp` INT NOT NULL,
|
608 |
-
PRIMARY KEY (`ip`))
|
609 |
-
ENGINE = MYISAM;';
|
610 |
|
611 |
// Sessions
|
612 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
@@ -614,8 +616,7 @@ function apbct_activation( $network = false ) {
|
|
614 |
`name` VARCHAR(40) NOT NULL,
|
615 |
`value` TEXT NULL DEFAULT NULL,
|
616 |
`last_update` DATETIME NULL DEFAULT NULL,
|
617 |
-
PRIMARY KEY (`name`(40), `id`(64)))
|
618 |
-
ENGINE = MYISAM;';
|
619 |
|
620 |
if($network && !defined('CLEANTALK_ACCESS_KEY')){
|
621 |
$initial_blog = get_current_blog_id();
|
@@ -681,7 +682,7 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
|
|
681 |
`network` int(11) unsigned NOT NULL,
|
682 |
`mask` int(11) unsigned NOT NULL,
|
683 |
INDEX ( `network` , `mask` )
|
684 |
-
)
|
685 |
|
686 |
// SFW log
|
687 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
@@ -689,8 +690,7 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
|
|
689 |
`all_entries` INT NOT NULL,
|
690 |
`blocked_entries` INT NOT NULL,
|
691 |
`entries_timestamp` INT NOT NULL,
|
692 |
-
PRIMARY KEY (`ip`))
|
693 |
-
ENGINE = MYISAM;';
|
694 |
|
695 |
// Sessions
|
696 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
@@ -698,8 +698,7 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
|
|
698 |
`name` TEXT NOT NULL,
|
699 |
`value` TEXT NULL DEFAULT NULL,
|
700 |
`last_update` DATETIME NULL DEFAULT NULL,
|
701 |
-
PRIMARY KEY (`id`(64), `name`(64)))
|
702 |
-
ENGINE = MYISAM;';
|
703 |
|
704 |
// Cron tasks
|
705 |
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
@@ -733,9 +732,11 @@ function apbct_deactivation( $network ) {
|
|
733 |
apbct_deactivation__delete_blog_tables();
|
734 |
delete_option('cleantalk_cron'); // Deleting cron entries
|
735 |
|
736 |
-
if($apbct->settings['complete_deactivation'])
|
737 |
apbct_deactivation__delete_all_options();
|
738 |
-
|
|
|
|
|
739 |
}
|
740 |
switch_to_blog($initial_blog);
|
741 |
|
@@ -774,6 +775,14 @@ function apbct_deactivation__delete_all_options(){
|
|
774 |
delete_option('cleantalk_timelabel_reg');
|
775 |
}
|
776 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
777 |
function apbct_deactivation__delete_common_tables() {
|
778 |
global $wpdb;
|
779 |
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
@@ -1772,18 +1781,43 @@ function apbct_update_actions(){
|
|
1772 |
require_once(CLEANTALK_PLUGIN_DIR.'inc/cleantalk-updater.php');
|
1773 |
|
1774 |
$result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
|
|
|
1775 |
//If update is successfull
|
1776 |
-
if($result === true)
|
1777 |
-
|
1778 |
-
|
1779 |
-
}
|
1780 |
ct_send_feedback('0:' . APBCT_AGENT ); // Send feedback to let cloud know about updated version.
|
1781 |
|
1782 |
// Side blogs
|
1783 |
}else{
|
1784 |
-
|
1785 |
-
$apbct->saveData();
|
1786 |
}
|
1787 |
}
|
1788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1789 |
}
|
3 |
Plugin Name: Anti-Spam by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
|
6 |
+
Version: 5.127
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
Text Domain: cleantalk
|
54 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
|
55 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
|
56 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
|
57 |
+
include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/SFW.php'); // SpamFireWall
|
58 |
+
include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Arr.php'); // Array functions
|
59 |
|
60 |
// Child classes
|
61 |
require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkAPI.php'); // API for Wordpress
|
74 |
|
75 |
// Global ArrayObject with settings and other global varables
|
76 |
global $apbct;
|
77 |
+
$apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors', 'remote_calls', 'stats'));
|
78 |
|
|
|
|
|
|
|
|
|
79 |
$apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
|
|
|
80 |
|
81 |
$apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
|
82 |
$apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
|
83 |
$apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
|
84 |
|
85 |
+
// Customize CleantalkState
|
86 |
+
// Account status
|
87 |
+
|
88 |
+
$apbct->white_label = $apbct->network_settings['white_label'];
|
89 |
+
$apbct->allow_custom_key = $apbct->network_settings['allow_custom_key'];
|
90 |
+
$apbct->plugin_name = $apbct->network_settings['white_label__plugin_name'] ? $apbct->network_settings['white_label__plugin_name'] : APBCT_NAME;
|
91 |
+
$apbct->api_key = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
|
92 |
+
$apbct->key_is_ok = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['key_is_ok'] : $apbct->network_data['key_is_ok'];
|
93 |
+
$apbct->moderate = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['moderate'] : $apbct->network_data['moderate'];
|
94 |
|
95 |
$apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
96 |
$apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
|
99 |
|
100 |
if(!$apbct->white_label){
|
101 |
require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
|
|
102 |
}
|
103 |
|
104 |
// Passing JS key to frontend
|
107 |
|
108 |
// Database prefix
|
109 |
global $wpdb;
|
110 |
+
$apbct->db_prefix = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
|
111 |
$apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
|
112 |
// Database constants
|
113 |
define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
|
256 |
add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
|
257 |
|
258 |
add_action('admin_init', 'apbct_admin__init', 1);
|
259 |
+
add_action('admin_menu', 'apbct_settings_add_page');
|
260 |
+
add_action('network_admin_menu', 'apbct_settings_add_page');
|
261 |
add_action('admin_notices', 'apbct_admin__notice_message');
|
262 |
add_action('network_admin_notices', 'apbct_admin__notice_message');
|
263 |
|
299 |
add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
|
300 |
|
301 |
// Formidable
|
302 |
+
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
303 |
+
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
304 |
|
305 |
// Some of plugins to register a users use AJAX context.
|
306 |
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
582 |
}else{
|
583 |
reset($sfw->passed_ips);
|
584 |
if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
|
585 |
+
setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false);
|
586 |
}
|
587 |
}
|
588 |
unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
|
600 |
`network` int(11) unsigned NOT NULL,
|
601 |
`mask` int(11) unsigned NOT NULL,
|
602 |
INDEX ( `network` , `mask` )
|
603 |
+
);';
|
604 |
|
605 |
// SFW log
|
606 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
608 |
`all_entries` INT NOT NULL,
|
609 |
`blocked_entries` INT NOT NULL,
|
610 |
`entries_timestamp` INT NOT NULL,
|
611 |
+
PRIMARY KEY (`ip`));';
|
|
|
612 |
|
613 |
// Sessions
|
614 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
616 |
`name` VARCHAR(40) NOT NULL,
|
617 |
`value` TEXT NULL DEFAULT NULL,
|
618 |
`last_update` DATETIME NULL DEFAULT NULL,
|
619 |
+
PRIMARY KEY (`name`(40), `id`(64)));';
|
|
|
620 |
|
621 |
if($network && !defined('CLEANTALK_ACCESS_KEY')){
|
622 |
$initial_blog = get_current_blog_id();
|
682 |
`network` int(11) unsigned NOT NULL,
|
683 |
`mask` int(11) unsigned NOT NULL,
|
684 |
INDEX ( `network` , `mask` )
|
685 |
+
);';
|
686 |
|
687 |
// SFW log
|
688 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
|
690 |
`all_entries` INT NOT NULL,
|
691 |
`blocked_entries` INT NOT NULL,
|
692 |
`entries_timestamp` INT NOT NULL,
|
693 |
+
PRIMARY KEY (`ip`));';
|
|
|
694 |
|
695 |
// Sessions
|
696 |
$sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
|
698 |
`name` TEXT NOT NULL,
|
699 |
`value` TEXT NULL DEFAULT NULL,
|
700 |
`last_update` DATETIME NULL DEFAULT NULL,
|
701 |
+
PRIMARY KEY (`id`(64), `name`(64)));';
|
|
|
702 |
|
703 |
// Cron tasks
|
704 |
CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
|
732 |
apbct_deactivation__delete_blog_tables();
|
733 |
delete_option('cleantalk_cron'); // Deleting cron entries
|
734 |
|
735 |
+
if($apbct->settings['complete_deactivation']){
|
736 |
apbct_deactivation__delete_all_options();
|
737 |
+
apbct_deactivation__delete_all_options__in_network();
|
738 |
+
}
|
739 |
+
|
740 |
}
|
741 |
switch_to_blog($initial_blog);
|
742 |
|
775 |
delete_option('cleantalk_timelabel_reg');
|
776 |
}
|
777 |
|
778 |
+
/**
|
779 |
+
* Delete all cleantalk_* entries from _sitemeta table
|
780 |
+
*/
|
781 |
+
function apbct_deactivation__delete_all_options__in_network(){
|
782 |
+
delete_site_option('cleantalk_network_settings');
|
783 |
+
delete_site_option('cleantalk_network_data');
|
784 |
+
}
|
785 |
+
|
786 |
function apbct_deactivation__delete_common_tables() {
|
787 |
global $wpdb;
|
788 |
$wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
|
1781 |
require_once(CLEANTALK_PLUGIN_DIR.'inc/cleantalk-updater.php');
|
1782 |
|
1783 |
$result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
|
1784 |
+
|
1785 |
//If update is successfull
|
1786 |
+
if($result === true)
|
1787 |
+
apbct_update__set_version__from_plugin('from_plugin');
|
1788 |
+
|
|
|
1789 |
ct_send_feedback('0:' . APBCT_AGENT ); // Send feedback to let cloud know about updated version.
|
1790 |
|
1791 |
// Side blogs
|
1792 |
}else{
|
1793 |
+
apbct_update__set_version__from_plugin('from_plugin');
|
|
|
1794 |
}
|
1795 |
}
|
1796 |
|
1797 |
+
}
|
1798 |
+
|
1799 |
+
/**
|
1800 |
+
* Set version of plugin in database
|
1801 |
+
*
|
1802 |
+
* @param string $ver
|
1803 |
+
*
|
1804 |
+
* @return bool
|
1805 |
+
* @global CleantalkState $apbct
|
1806 |
+
*
|
1807 |
+
*/
|
1808 |
+
function apbct_update__set_version__from_plugin($ver){
|
1809 |
+
global $apbct;
|
1810 |
+
switch (true){
|
1811 |
+
case $ver === 'from_plugin':
|
1812 |
+
$apbct->data['plugin_version'] = APBCT_VERSION;
|
1813 |
+
break;
|
1814 |
+
case preg_match('/^\d+\.\d+(\.\d+)?(-[a-zA-Z0-9-_]+)?$/', $ver) === 1;
|
1815 |
+
$apbct->data['plugin_version'] = $ver;
|
1816 |
+
break;
|
1817 |
+
default:
|
1818 |
+
return false;
|
1819 |
+
break;
|
1820 |
+
}
|
1821 |
+
$apbct->saveData();
|
1822 |
+
return true;
|
1823 |
}
|
css/cleantalk-admin-settings-page.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content{display:inline-block}.apbct_settings-field_content--radio{width:70%}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px}.
|
1 |
+
#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content{display:inline-block}.apbct_settings-field_content--radio{width:70%}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;display:inline-block;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;display:inline-block;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{display:inline-block;position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;display:inline-block;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{display:inline-block;width:370px;margin-right:3em;padding:.8em .8em 15px;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;display:inline-block;font-size:25px;line-height:20px;color:rgba(120,200,230,1);margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}
|
css/cleantalk-admin.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.
|
1 |
+
:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#apbct_gdpr_open_modal:hover{cursor:pointer}
|
css/cleantalk-icons.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
@font-face{font-family:fontello;src:url(./fonts/icons/icons.eot);src:url(./fonts/icons/icons.eot) format('embedded-opentype'),url(./fonts/icons/icons.woff2) format('woff2'),url(./fonts/icons/icons.woff) format('woff'),url(./fonts/icons/icons.ttf) format('truetype'),url(./fonts/icons/icons.svg) format('svg');font-weight:400;font-style:normal}[class*=" icon-"]:before,[class^=icon-]:before{font-family:fontello;font-style:normal;font-weight:400;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-download:before{content:'\e800'}.icon-glass:before{content:'\e801'}.icon-emo-happy:before{content:'\e802'}.icon-search:before{content:'\e803'}.icon-emo-unhappy:before{content:'\e804'}.icon-mail:before{content:'\e805'}.icon-info-circled:before{content:'\e806'}.icon-help-circled:before{content:'\e807'}.icon-heart:before{content:'\e808'}.icon-heart-empty:before{content:'\e809'}.icon-star:before{content:'\e80a'}.icon-star-empty:before{content:'\e80b'}.icon-user:before{content:'\e80c'}.icon-users:before{content:'\e80d'}.icon-th-large:before{content:'\e80e'}.icon-th:before{content:'\e80f'}.icon-th-list:before{content:'\e810'}.icon-to-end:before{content:'\e811'}.icon-to-start:before{content:'\e812'}.icon-fast-fw:before{content:'\e813'}.icon-fast-bw:before{content:'\e814'}.icon-off:before{content:'\e815'}.icon-chart-bar:before{content:'\e816'}.icon-home:before{content:'\e817'}.icon-link-1:before{content:'\e818'}.icon-lock-open:before{content:'\e819'}.icon-eye:before{content:'\e81a'}.icon-eye-off:before{content:'\e81b'}.icon-download-1:before{content:'\e81c'}.icon-chat:before{content:'\e81d'}.icon-comment:before{content:'\e81e'}.icon-doc:before{content:'\e81f'}.icon-lock:before{content:'\e820'}.icon-emo-wink2:before{content:'\e821'}.icon-plus:before{content:'\e822'}.icon-upload:before{content:'\e823'}.icon-picture:before{content:'\e824'}.icon-ok:before{content:'\e825'}.icon-cancel:before{content:'\e826'}.icon-pencil:before{content:'\e827'}.icon-edit:before{content:'\e828'}.icon-forward:before{content:'\e829'}.icon-export:before{content:'\e82a'}.icon-trash-empty:before{content:'\e82b'}.icon-down-dir:before{content:'\e82c'}.icon-up-dir:before{content:'\e82d'}.icon-left-dir:before{content:'\e82e'}.icon-right-dir:before{content:'\e82f'}.icon-spin1:before{content:'\e830'}.icon-spin2:before{content:'\e831'}.icon-mobile:before{content:'\e832'}.icon-bell:before{content:'\e833'}.icon-ccw:before{content:'\e834'}.icon-wrench:before{content:'\e835'}.icon-stop-1:before{content:'\e837'}.icon-spin5:before{content:'\e838'}.icon-pause-1:before{content:'\e839'}.icon-play-1:before{content:'\e83a'}.icon-link-ext:before{content:'\f08e'}.icon-menu:before{content:'\f0c9'}.icon-sort:before{content:'\f0dc'}.icon-mail-alt:before{content:'\f0e0'}.icon-lightbulb:before{content:'\f0eb'}.icon-exchange:before{content:'\f0ec'}.icon-upload-cloud:before{content:'\f0ee'}.icon-bell-alt:before{content:'\f0f3'}.icon-doc-text:before{content:'\f0f6'}.icon-angle-double-left:before{content:'\f100'}.icon-angle-double-right:before{content:'\f101'}.icon-angle-double-up:before{content:'\f102'}.icon-angle-double-down:before{content:'\f103'}.icon-desktop:before{content:'\f108'}.icon-laptop:before{content:'\f109'}.icon-tablet:before{content:'\f10a'}.icon-circle-empty:before{content:'\f10c'}.icon-circle:before{content:'\f111'}.icon-unlink:before{content:'\f127'}.icon-help:before{content:'\f128'}.icon-info:before{content:'\f129'}.icon-attention-alt:before{content:'\f12a'}.icon-ellipsis:before{content:'\f141'}.icon-ellipsis-vert:before{content:'\f142'}.icon-euro:before{content:'\f153'}.icon-pound:before{content:'\f154'}.icon-dollar:before{content:'\f155'}.icon-rupee:before{content:'\f156'}.icon-yen:before{content:'\f157'}.icon-rouble:before{content:'\f158'}.icon-won:before{content:'\f159'}.icon-bitcoin:before{content:'\f15a'}.icon-sort-alt-up:before{content:'\f160'}.icon-sort-alt-down:before{content:'\f161'}.icon-bug:before{content:'\f188'}.icon-try:before{content:'\f195'}.icon-wordpress:before{content:'\f19a'}.icon-cubes:before{content:'\f1b3'}.icon-database:before{content:'\f1c0'}.icon-circle-thin:before{content:'\f1db'}.icon-sliders:before{content:'\f1de'}.icon-share:before{content:'\f1e0'}.icon-plug:before{content:'\f1e6'}.icon-trash:before{content:'\f1f8'}.icon-chart-line:before{content:'\f201'}.icon-shekel:before{content:'\f20b'}.icon-user-secret:before{content:'\f21b'}.icon-user-plus:before{content:'\f234'}.icon-user-times:before{content:'\f235'}.icon-viacoin:before{content:'\f237'}.icon-safari:before{content:'\f267'}.icon-chrome:before{content:'\f268'}.icon-firefox:before{content:'\f269'}.icon-opera:before{content:'\f26a'}.icon-internet-explorer:before{content:'\f26b'}.icon-television:before{content:'\f26c'}.icon-percent:before{content:'\f295'}
|
css/fonts/icons/icons.eot
ADDED
Binary file
|
css/fonts/icons/icons.svg
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="fontello" horiz-adv-x="1000" >
|
7 |
+
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
8 |
+
<missing-glyph horiz-adv-x="1000" />
|
9 |
+
<glyph glyph-name="download" unicode="" d="M714 590q15-15 15-37t-15-36l-245-244-245 244q-15 15-15 36t15 37 36 15q23 0 38-15l118-120 0 349q0 21 16 37t37 16 37-16 15-37l0-349 119 120q14 14 38 14 22 0 36-14z m222-448l2-261q0-21-16-36t-37-16l-832 0q-22 0-37 16t-16 36q0 261 1 261 0 11 2 16l105 312q12 37 48 37l12 0q8-18 18-28l78-76-70 0-86-261 722 0-86 261-70 0 77 76q10 10 19 28l11 0q37 0 49-37l105-312q1-5 1-16z" horiz-adv-x="938" />
|
10 |
+
|
11 |
+
<glyph glyph-name="glass" unicode="" d="M948 746q0-19-24-43l-353-353v-429h179q15 0 25-10t11-25-11-25-25-11h-500q-14 0-25 11t-11 25 11 25 25 10h179v429l-353 353q-24 24-24 43 0 13 10 21t21 9 24 3h786q13 0 24-3t21-9 10-21z" horiz-adv-x="1000" />
|
12 |
+
|
13 |
+
<glyph glyph-name="emo-happy" unicode="" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m208-599c-13 0-27-5-37-16-4-4-8-8-12-12-111-109-253-164-396-165-142-2-285 50-396 155l-3 3-12 12c-21 21-54 20-75-1-20-21-20-55 1-76 3-4 8-8 14-14l3-3c132-124 301-186 469-184 169 1 337 67 468 195 5 5 9 10 14 14 20 22 20 56-1 77-10 10-23 15-37 15z" horiz-adv-x="999" />
|
14 |
+
|
15 |
+
<glyph glyph-name="search" unicode="" d="M643 386q0 103-73 176t-177 74-177-74-73-176 73-177 177-73 177 73 73 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 153-31 125-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
|
16 |
+
|
17 |
+
<glyph glyph-name="emo-unhappy" unicode="" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-244-599c-165 0-331-62-461-184l-3-3c-6-5-11-10-14-14-21-21-21-55-1-76 21-21 54-21 75-1l12 12 3 3c111 105 254 157 396 155 143-1 285-56 396-165 4-4 8-8 12-12 20-21 54-21 74-1 21 21 21 55 1 77-5 5-9 10-14 14-131 129-299 194-468 195-3 0-6 0-8 0z" horiz-adv-x="999" />
|
18 |
+
|
19 |
+
<glyph glyph-name="mail" unicode="" d="M929 11v428q-18-20-39-36-149-115-238-189-28-24-46-37t-48-28-57-13h-2q-26 0-57 13t-48 28-46 37q-88 74-238 189-21 16-39 36v-428q0-7 6-13t12-5h822q7 0 12 5t6 13z m0 586v14t-1 7-1 7-3 5-5 4-8 2h-822q-7 0-12-6t-6-12q0-94 83-159 107-84 223-176 4-3 20-17t25-21 25-17 28-16 24-5h2q11 0 24 5t28 16 25 17 25 21 20 17q116 92 224 176 30 24 56 65t26 73z m71 21v-607q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v607q0 37 26 63t63 26h822q37 0 63-26t26-63z" horiz-adv-x="1000" />
|
20 |
+
|
21 |
+
<glyph glyph-name="info-circled" unicode="" d="M571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
|
22 |
+
|
23 |
+
<glyph glyph-name="help-circled" unicode="" d="M500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-13 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-15-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
|
24 |
+
|
25 |
+
<glyph glyph-name="heart" unicode="" d="M500-79q-14 0-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192q0-123-128-251l-347-335q-10-10-25-10z" horiz-adv-x="1000" />
|
26 |
+
|
27 |
+
<glyph glyph-name="heart-empty" unicode="" d="M929 517q0 46-12 80t-31 55-46 33-52 18-55 4-62-14-62-36-48-40-34-34q-10-13-27-13t-27 13q-14 15-34 34t-48 40-62 36-62 14-55-4-52-18-46-33-31-55-12-80q0-93 105-198l324-312 324 312q105 105 105 198z m71 0q0-123-128-251l-347-335q-10-10-25-10t-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192z" horiz-adv-x="1000" />
|
28 |
+
|
29 |
+
<glyph glyph-name="star" unicode="" d="M929 489q0-12-15-27l-202-197 48-279q0-4 0-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
|
30 |
+
|
31 |
+
<glyph glyph-name="star-empty" unicode="" d="M635 290l170 166-235 34-106 213-105-213-236-34 171-166-41-235 211 111 211-111z m294 199q0-12-15-27l-202-197 48-279q0-4 0-12 0-28-23-28-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
|
32 |
+
|
33 |
+
<glyph glyph-name="user" unicode="" d="M714 69q0-60-35-104t-84-44h-476q-49 0-84 44t-35 104q0 48 5 90t17 85 33 73 52 50 76 19q73-72 174-72t175 72q42 0 75-19t52-50 33-73 18-85 4-90z m-143 495q0-88-62-151t-152-63-151 63-63 151 63 152 151 63 152-63 62-152z" horiz-adv-x="714.3" />
|
34 |
+
|
35 |
+
<glyph glyph-name="users" unicode="" d="M331 350q-90-3-148-71h-75q-45 0-77 22t-31 66q0 197 69 197 4 0 25-11t54-24 66-12q38 0 75 13-3-21-3-37 0-78 45-143z m598-356q0-66-41-105t-108-39h-488q-68 0-108 39t-41 105q0 30 2 58t8 61 14 61 24 54 35 45 48 30 62 11q6 0 24-12t41-26 59-27 76-12 75 12 60 27 41 26 24 12q34 0 62-11t47-30 35-45 24-54 15-61 8-61 2-58z m-572 713q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m393-214q0-89-63-152t-151-62-152 62-63 152 63 151 152 63 151-63 63-151z m321-126q0-43-31-66t-77-22h-75q-57 68-147 71 45 65 45 143 0 16-3 37 37-13 74-13 33 0 67 12t54 24 24 11q69 0 69-197z m-71 340q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z" horiz-adv-x="1071.4" />
|
36 |
+
|
37 |
+
<glyph glyph-name="th-large" unicode="" d="M429 279v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z m500-428v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z" horiz-adv-x="928.6" />
|
38 |
+
|
39 |
+
<glyph glyph-name="th" unicode="" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-22 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-22 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-178q-22 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z" horiz-adv-x="1000" />
|
40 |
+
|
41 |
+
<glyph glyph-name="th-list" unicode="" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m714-285v-108q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v108q0 22 16 38t38 15h535q23 0 38-15t16-38z m-714 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m714-286v-107q0-22-16-38t-38-15h-535q-23 0-38 15t-16 38v107q0 23 16 38t38 16h535q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-535q-23 0-38 16t-16 38v107q0 22 16 38t38 16h535q23 0 38-16t16-38z" horiz-adv-x="1000" />
|
42 |
+
|
43 |
+
<glyph glyph-name="to-end" unicode="" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v378q0 14 10 25t25 11h72q14 0 25-11t10-25v-786q0-14-10-25t-25-11h-72q-14 0-25 11t-10 25v379q-3-6-8-11z" horiz-adv-x="571.4" />
|
44 |
+
|
45 |
+
<glyph glyph-name="to-start" unicode="" d="M546 771q11 11 18 8t7-18v-822q0-14-7-18t-18 8l-396 396q-5 5-7 11v-379q0-14-11-25t-25-11h-71q-15 0-25 11t-11 25v786q0 14 11 25t25 11h71q15 0 25-11t11-25v-378q2 5 7 10z" horiz-adv-x="571.4" />
|
46 |
+
|
47 |
+
<glyph glyph-name="fast-fw" unicode="" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v396q0 14 7 18t18-8l396-396q11-10 11-25t-11-25l-396-396q-11-11-18-8t-7 18v397q-3-6-8-11z" horiz-adv-x="928.6" />
|
48 |
+
|
49 |
+
<glyph glyph-name="fast-bw" unicode="" d="M904 771q10 11 17 8t8-18v-822q0-14-8-18t-17 8l-397 396q-5 5-7 11v-397q0-14-7-18t-18 8l-396 396q-11 11-11 25t11 25l396 396q11 11 18 8t7-18v-396q2 5 7 10z" horiz-adv-x="928.6" />
|
50 |
+
|
51 |
+
<glyph glyph-name="off" unicode="" d="M857 350q0-87-34-166t-91-137-137-92-166-34-167 34-136 92-92 137-34 166q0 102 45 191t126 151q24 18 54 14t46-28q18-23 14-53t-28-47q-54-41-84-101t-30-127q0-58 23-111t61-91 91-61 111-23 110 23 92 61 61 91 22 111q0 68-30 127t-84 101q-23 18-28 47t14 53q17 24 47 28t53-14q81-61 126-151t45-191z m-357 429v-358q0-29-21-50t-50-21-51 21-21 50v358q0 29 21 50t51 21 50-21 21-50z" horiz-adv-x="857.1" />
|
52 |
+
|
53 |
+
<glyph glyph-name="chart-bar" unicode="" d="M357 350v-286h-143v286h143z m214 286v-572h-142v572h142z m572-643v-72h-1143v858h71v-786h1072z m-357 500v-429h-143v429h143z m214 214v-643h-143v643h143z" horiz-adv-x="1142.9" />
|
54 |
+
|
55 |
+
<glyph glyph-name="home" unicode="" d="M786 296v-267q0-15-11-25t-25-11h-214v214h-143v-214h-214q-15 0-25 11t-11 25v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-3-7 1-12 6l-35 41q-4 6-3 13t6 12l401 334q18 15 42 15t43-15l136-113v108q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q6-4 6-12t-4-13z" horiz-adv-x="928.6" />
|
56 |
+
|
57 |
+
<glyph glyph-name="link-1" unicode="" d="M813 171q0 23-16 38l-116 116q-16 16-38 16-24 0-40-18 1-1 10-10t12-12 9-11 7-14 2-15q0-23-16-38t-38-16q-8 0-15 2t-14 7-11 9-12 12-10 10q-19-17-19-40 0-23 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-393 394q0 22-15 38l-115 115q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l116-116q15-15 38-15 23 0 40 17-2 2-11 11t-12 12-8 10-7 14-2 16q0 22 15 38t38 15q9 0 16-2t14-7 11-8 12-12 10-11q18 17 18 41z m500-394q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-115 115q-46 47-46 114 0 68 49 116l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 82q47 46 114 46 67 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.6" />
|
58 |
+
|
59 |
+
<glyph glyph-name="lock-open" unicode="" d="M929 529v-143q0-15-11-25t-25-11h-36q-14 0-25 11t-11 25v143q0 59-41 101t-101 41-101-41-42-101v-108h53q23 0 38-15t16-38v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h375v108q0 103 73 176t177 74 176-74 74-176z" horiz-adv-x="928.6" />
|
60 |
+
|
61 |
+
<glyph glyph-name="eye" unicode="" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
|
62 |
+
|
63 |
+
<glyph glyph-name="eye-off" unicode="" d="M310 105l43 79q-48 35-76 88t-27 114q0 67 34 125-128-65-213-197 94-144 239-209z m217 424q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m202 106q0-4 0-5-59-105-176-316t-176-316l-28-50q-5-9-15-9-7 0-75 39-9 6-9 16 0 7 25 49-80 36-147 96t-117 137q-11 17-11 38t11 39q86 131 212 207t277 76q50 0 100-10l31 54q5 9 15 9 3 0 10-3t18-9 18-10 18-10 10-7q9-5 9-15z m21-249q0-78-44-142t-117-91l157 280q4-25 4-47z m250-72q0-19-11-38-22-36-61-81-84-96-194-149t-234-53l41 74q119 10 219 76t169 171q-65 100-158 164l35 63q53-36 102-85t81-103q11-19 11-39z" horiz-adv-x="1000" />
|
64 |
+
|
65 |
+
<glyph glyph-name="download-1" unicode="" d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z" horiz-adv-x="928.6" />
|
66 |
+
|
67 |
+
<glyph glyph-name="chat" unicode="" d="M786 421q0-77-53-143t-143-104-197-38q-48 0-98 9-70-49-155-72-21-5-48-9h-2q-6 0-12 5t-6 12q-1 1-1 3t1 4 1 3l1 3t2 3 2 3 3 3 2 2q3 3 13 14t15 16 12 17 14 21 11 25q-69 40-108 98t-40 125q0 78 53 144t143 104 197 38 197-38 143-104 53-144z m214-142q0-67-40-126t-108-98q5-14 11-25t14-21 13-16 14-17 13-14q0 0 2-2t3-3 2-3 2-3l1-3t1-3 1-4-1-3q-2-8-7-13t-12-4q-28 4-48 9-86 23-156 72-50-9-98-9-151 0-263 74 32-3 49-3 90 0 172 25t148 72q69 52 107 119t37 141q0 43-13 85 72-39 114-99t42-128z" horiz-adv-x="1000" />
|
68 |
+
|
69 |
+
<glyph glyph-name="comment" unicode="" d="M1000 350q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12-10-1-17 5t-10 16v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 73 40 139t106 114 160 76 194 28q136 0 251-48t182-130 67-179z" horiz-adv-x="1000" />
|
70 |
+
|
71 |
+
<glyph glyph-name="doc" unicode="" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z" horiz-adv-x="857.1" />
|
72 |
+
|
73 |
+
<glyph glyph-name="lock" unicode="" d="M179 421h285v108q0 59-42 101t-101 41-101-41-41-101v-108z m464-53v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h17v108q0 102 74 176t176 74 177-74 73-176v-108h18q23 0 38-15t16-38z" horiz-adv-x="642.9" />
|
74 |
+
|
75 |
+
<glyph glyph-name="emo-wink2" unicode="" d="M664 800c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-343-98l-267 0c-30 0-54-24-54-54 0-30 24-54 54-54l267 0c30 0 54 24 54 54 0 30-24 54-54 54z m-262-361c-6 0-13-1-19-3-27-10-41-41-31-68 46-127 136-228 249-289 22-12 45-22 69-31 58-21 120-33 184-33 57 0 113 9 166 27 10 3 20 7 30 11 11 4 22 8 31 12l0 1 0 0 0 0c26 12 38 44 25 71-13 26-44 37-70 25l0 0c-9-4-17-8-24-11-8-3-17-6-25-8-43-14-88-22-133-22-51 0-101 10-148 27-19 7-37 15-55 25-90 48-163 130-200 231-8 21-28 35-49 35z" horiz-adv-x="774" />
|
76 |
+
|
77 |
+
<glyph glyph-name="plus" unicode="" d="M786 439v-107q0-22-16-38t-38-15h-232v-233q0-22-16-37t-38-16h-107q-22 0-38 16t-15 37v233h-232q-23 0-38 15t-16 38v107q0 23 16 38t38 16h232v232q0 22 15 38t38 16h107q23 0 38-16t16-38v-232h232q23 0 38-16t16-38z" horiz-adv-x="785.7" />
|
78 |
+
|
79 |
+
<glyph glyph-name="upload" unicode="" d="M936 128l2-260q0-21-16-37t-37-15l-832 0q-22 0-37 15t-16 37q0 260 1 260 0 12 2 17l105 312q12 36 48 36l209 0 0-103-171 0-86-262 722 0-86 262-171 0 0 103 208 0q37 0 49-36l105-312q1-5 1-17z m-258 423q-24 0-38 14l-119 120 0-348q0-21-15-37t-37-15-37 15-16 37l0 348-118-120q-14-14-38-14-22 0-36 14-15 15-15 36t15 37l245 247 245-247q15-15 15-37t-15-36q-14-14-36-14z" horiz-adv-x="938" />
|
80 |
+
|
81 |
+
<glyph glyph-name="picture" unicode="" d="M357 529q0-45-31-76t-76-32-76 32-31 76 31 76 76 31 76-31 31-76z m572-215v-250h-786v107l178 179 90-89 285 285z m53 393h-893q-7 0-12-5t-6-13v-678q0-7 6-13t12-5h893q7 0 13 5t5 13v678q0 8-5 13t-13 5z m89-18v-678q0-37-26-63t-63-27h-893q-36 0-63 27t-26 63v678q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1071.4" />
|
82 |
+
|
83 |
+
<glyph glyph-name="ok" unicode="" d="M933 534q0-22-16-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q16-15 16-38z" horiz-adv-x="1000" />
|
84 |
+
|
85 |
+
<glyph glyph-name="cancel" unicode="" d="M724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
|
86 |
+
|
87 |
+
<glyph glyph-name="pencil" unicode="" d="M203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
|
88 |
+
|
89 |
+
<glyph glyph-name="edit" unicode="" d="M496 189l64 65-85 85-64-65v-31h53v-54h32z m245 402q-9 9-18 0l-196-196q-9-9 0-18t18 0l196 196q9 9 0 18z m45-331v-106q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h464q35 0 65-14 9-4 10-13 2-10-5-16l-27-28q-8-8-18-4-13 3-25 3h-464q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v70q0 7 5 12l36 36q8 8 20 4t11-16z m-54 411l161-160-375-375h-161v160z m248-73l-51-52-161 161 51 52q16 15 38 15t38-15l85-85q16-16 16-38t-16-38z" horiz-adv-x="1000" />
|
90 |
+
|
91 |
+
<glyph glyph-name="forward" unicode="" d="M1000 493q0-15-11-25l-285-286q-11-11-25-11t-25 11-11 25v143h-125q-55 0-98-3t-86-12-74-24-59-39-45-56-27-77-10-101q0-31 3-69 0-4 2-13t1-15q0-8-5-14t-13-6q-9 0-15 10-4 5-8 12t-7 17-6 13q-71 159-71 252 0 111 30 186 90 225 488 225h125v143q0 14 11 25t25 10 25-10l285-286q11-11 11-25z" horiz-adv-x="1000" />
|
92 |
+
|
93 |
+
<glyph glyph-name="export" unicode="" d="M750 60l0 56 100 82 0-188q0-20-15-35t-35-15l-750 0q-20 0-35 15t-15 35l0 550q0 22 14 36t36 14l288 0q-32-24-59-49t-39-39l-10-12-130 0 0-450 650 0z m-82 348q-166 0-242-41t-160-181q0 8 1 22t9 56 22 79 44 83 70 79 107 56 149 23l0 156 332-250-332-260 0 178z" horiz-adv-x="1000" />
|
94 |
+
|
95 |
+
<glyph glyph-name="trash-empty" unicode="" d="M286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
|
96 |
+
|
97 |
+
<glyph glyph-name="down-dir" unicode="" d="M571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
|
98 |
+
|
99 |
+
<glyph glyph-name="up-dir" unicode="" d="M571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
|
100 |
+
|
101 |
+
<glyph glyph-name="left-dir" unicode="" d="M357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
|
102 |
+
|
103 |
+
<glyph glyph-name="right-dir" unicode="" d="M321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
|
104 |
+
|
105 |
+
<glyph glyph-name="spin1" unicode="" d="M496 850c-176 0-331-90-421-226-18-27-33-55-46-85-12-29-21-60-28-92 0 0 0-1 0-1l0 0 0 0c0-1 0-2 0-2 0-7 5-12 11-12l101 0c5 0 10 4 11 9 29 113 109 206 214 253 20 10 41 17 63 23 31 7 62 11 95 11l0 0 0 0 0 0c25 0 50-2 74-7 5-1 10-2 14-3 6-1 10-3 14-4l0 0c5-1 11 1 13 6l51 87c0 0 1 1 1 2 2 6-1 13-7 15-22 7-43 13-65 17-5 1-9 1-13 2-27 5-54 7-82 7l0 0 0 0z m327-114c-5 0-9-2-11-6l-50-87c-3-4-2-10 2-14 29-29 54-63 73-101 4-7 7-14 11-22 19-46 30-97 30-151l0 0 0 0c0-77-22-149-62-209-7-11-15-23-24-33-9-11-18-21-28-31l0 0 0 0 0 0c-4-4-5-10-2-14l50-87c0-1 1-2 2-3 4-5 11-5 16-1 58 52 104 117 134 190 6 15 11 29 15 44 14 46 21 94 21 144 0 108-34 209-92 291-11 16-23 31-37 46-13 14-26 28-41 41l0 0c-1 1-1 1-2 1-2 1-4 2-5 2z m-811-468l0 0c-1 0-2 0-3 0-6-1-10-8-9-14 34-166 149-302 302-366 30-12 61-21 93-28 32-6 66-10 100-10l0 0 0 0c40 0 79 5 117 14 7 1 14 3 22 5 6 2 13 5 20 7 1 0 2 1 3 1 6 3 8 10 4 16l-50 87c-3 5-8 7-13 6-14-4-28-7-42-9-3-1-6-1-8-2-18-2-35-3-53-3l0 0 0 0c-128 0-242 63-311 160-1 0-1 0-1 0-13 19-25 40-35 61-10 21-18 43-24 65-1 6-6 10-11 10l-101 0z" horiz-adv-x="1000" />
|
106 |
+
|
107 |
+
<glyph glyph-name="spin2" unicode="" d="M46 144l0 0c0 0-1 0-1 0-8 18-15 37-21 55-6 19-11 38-15 58-19 99-8 203 35 298 3 6 10 8 15 5 1 0 2 0 2-1l0 0 80-59c5-3 6-9 4-14-5-12-9-25-12-37-4-13-7-26-9-40-11-67-3-137 23-201 2-5 0-10-4-13l0 0-80-56c-5-4-12-2-16 3-1 0-1 1-1 2l0 0z m120 574l0 0c0 1 0 1 0 1 15 13 30 25 46 37 16 11 33 22 51 31 89 50 192 72 297 60 6-1 10-6 10-13 0-1-1-1-1-2l0 0-31-94c-2-5-8-8-13-7-13 0-27 0-40 0-14-1-27-2-40-4-68-11-133-40-186-84-4-3-10-3-14 0l0 0-79 58c-5 3-6 11-2 16 0 0 1 1 2 1l0 0z m588 65l0 0c0 0 1 0 1 0 17-10 34-21 50-32 16-12 31-25 46-38 74-69 127-160 148-262 2-6-2-12-9-13-1 0-1 0-2 0l0 0-100 1c-5 0-10 4-11 9-3 13-8 26-12 38-5 12-10 25-17 36-31 61-78 113-137 150-5 3-6 8-5 13l0 0 31 92c2 6 9 9 15 7 1 0 2-1 2-1l0 0z m244-535l0 0c0 0 0 0 0 0-4-20-9-39-15-57-7-19-14-37-22-55-44-92-114-170-205-221-6-3-13-1-16 4 0 1-1 2-1 2l0 0-30 94c-2 6 1 12 6 14 11 7 22 15 32 23 11 9 21 18 30 27 49 48 84 109 101 176 2 5 6 8 11 8l0 0 98-1c6 0 11-5 11-11 0-1 0-2 0-3l0 0z m-438-395l0 0c0 0 0 0 0 0-20-2-40-3-60-3-20 0-40 1-59 4-102 12-198 54-276 125-5 4-5 11 0 16 0 0 1 1 1 1l0 0 81 58c5 3 12 2 16-2 10-8 20-16 32-23 11-7 22-14 34-20 62-31 131-45 200-41 6 0 10-3 12-8l0 0 29-92c2-6-1-12-7-14-1-1-2-1-3-1l0 0z" horiz-adv-x="1000" />
|
108 |
+
|
109 |
+
<glyph glyph-name="mobile" unicode="" d="M480 840q42 0 71-29t29-71l0-780q0-40-29-70t-71-30l-380 0q-40 0-70 30t-30 70l0 780q0 42 30 71t70 29l380 0z m-190-940q30 0 50 15t20 35q0 22-20 36t-50 14q-28 0-49-15t-21-35 21-35 49-15z m210 150l0 660-420 0 0-660 420 0z" horiz-adv-x="580" />
|
110 |
+
|
111 |
+
<glyph glyph-name="bell" unicode="" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m-372 160h726q-149 168-149 465 0 28-13 58t-39 58-67 45-95 17-95-17-67-45-39-58-13-58q0-297-149-465z m827 0q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
|
112 |
+
|
113 |
+
<glyph glyph-name="ccw" unicode="" d="M857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z" horiz-adv-x="857.1" />
|
114 |
+
|
115 |
+
<glyph glyph-name="wrench" unicode="" d="M214 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m354 243q0-22-13-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t5-14z" horiz-adv-x="928.6" />
|
116 |
+
|
117 |
+
<glyph glyph-name="stop-1" unicode="" d="M857 743v-786q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v786q0 14 11 25t25 11h785q15 0 26-11t10-25z" horiz-adv-x="857.1" />
|
118 |
+
|
119 |
+
<glyph glyph-name="spin5" unicode="" d="M462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-34c0-1 0-1 0-1 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 11 4 16l-35 61c-2 4-6 6-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-91 0 0c6-4 13-2 16 4l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-1 16 4l35 61c3 5 1 12-4 15l-158 92 0 0c-2 1-4 1-6 1z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-10-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 6-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-2c-4 0-8-2-10-6l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 35c0 0 0 0 0 0-2 1-4 1-6 2z m149-58c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
|
120 |
+
|
121 |
+
<glyph glyph-name="pause-1" unicode="" d="M857 743v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z m-500 0v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z" horiz-adv-x="857.1" />
|
122 |
+
|
123 |
+
<glyph glyph-name="play-1" unicode="" d="M772 333l-741-412q-13-7-22-2t-9 20v822q0 14 9 20t22-2l741-412q13-7 13-17t-13-17z" horiz-adv-x="785.7" />
|
124 |
+
|
125 |
+
<glyph glyph-name="link-ext" unicode="" d="M786 332v-178q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h393q7 0 12-5t5-13v-36q0-8-5-13t-12-5h-393q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v178q0 8 5 13t13 5h36q8 0 13-5t5-13z m214 482v-285q0-15-11-25t-25-11-25 11l-98 98-364-364q-5-6-13-6t-12 6l-64 64q-6 5-6 12t6 13l364 364-98 98q-11 11-11 25t11 25 25 11h285q15 0 25-11t11-25z" horiz-adv-x="1000" />
|
126 |
+
|
127 |
+
<glyph glyph-name="menu" unicode="" d="M857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
|
128 |
+
|
129 |
+
<glyph glyph-name="sort" unicode="" d="M571 243q0-15-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 10-11 25t11 25 25 11h500q14 0 25-11t10-25z m0 214q0-14-10-25t-25-11h-500q-15 0-25 11t-11 25 11 25l250 250q10 11 25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="571.4" />
|
130 |
+
|
131 |
+
<glyph glyph-name="mail-alt" unicode="" d="M1000 454v-443q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v443q25-27 56-49 202-137 278-192 32-24 51-37t53-27 61-13h2q28 0 61 13t53 27 51 37q95 68 278 192 32 22 56 49z m0 164q0-44-27-84t-68-69q-210-146-262-181-5-4-23-17t-30-22-29-18-32-15-28-5h-2q-12 0-27 5t-32 15-30 18-30 22-23 17q-51 35-147 101t-114 80q-35 23-65 64t-31 77q0 43 23 72t66 29h822q36 0 63-26t26-63z" horiz-adv-x="1000" />
|
132 |
+
|
133 |
+
<glyph glyph-name="lightbulb" unicode="" d="M411 529q0-8-6-13t-12-5-13 5-5 13q0 25-30 39t-59 14q-7 0-13 5t-5 13 5 13 13 5q28 0 55-9t49-30 21-50z m89 0q0 40-19 74t-50 57-69 35-76 12-76-12-69-35-50-57-20-74q0-57 38-101 6-6 17-18t17-19q72-85 79-166h127q8 81 79 166 6 6 17 19t17 18q38 44 38 101z m71 0q0-87-57-150-25-27-42-48t-33-54-19-60q26-15 26-46 0-20-13-35 13-15 13-36 0-29-25-45 8-13 8-26 0-26-18-40t-43-14q-11-25-34-39t-48-15-49 15-33 39q-26 0-44 14t-17 40q0 13 7 26-25 16-25 45 0 21 14 36-14 15-14 35 0 31 26 46-2 28-19 60t-33 54-41 48q-58 63-58 150 0 55 25 103t65 79 92 49 104 19 104-19 91-49 66-79 24-103z" horiz-adv-x="571.4" />
|
134 |
+
|
135 |
+
<glyph glyph-name="exchange" unicode="" d="M1000 189v-107q0-7-5-12t-13-6h-768v-107q0-7-5-12t-13-6q-6 0-13 6l-178 178q-5 6-5 13 0 8 5 13l179 178q5 5 12 5 8 0 13-5t5-13v-107h768q7 0 13-5t5-13z m0 304q0-8-5-13l-179-178q-5-6-12-6-8 0-13 6t-5 12v107h-768q-7 0-13 6t-5 12v107q0 8 5 13t13 5h768v107q0 8 5 13t13 5q6 0 13-5l178-178q5-5 5-13z" horiz-adv-x="1000" />
|
136 |
+
|
137 |
+
<glyph glyph-name="upload-cloud" unicode="" d="M714 368q0 8-5 13l-196 196q-5 5-13 5t-13-5l-196-196q-5-6-5-13 0-8 5-13t13-5h125v-196q0-8 5-13t12-5h108q7 0 12 5t5 13v196h125q8 0 13 5t5 13z m357-161q0-89-62-151t-152-63h-607q-103 0-177 73t-73 177q0 72 39 134t105 92q-1 17-1 24 0 118 84 202t202 84q87 0 159-49t105-129q40 35 93 35 59 0 101-42t42-101q0-43-23-77 72-17 119-76t46-133z" horiz-adv-x="1071.4" />
|
138 |
+
|
139 |
+
<glyph glyph-name="bell-alt" unicode="" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m455 160q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
|
140 |
+
|
141 |
+
<glyph glyph-name="doc-text" unicode="" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z m-572 483q0 7 5 12t13 5h393q8 0 13-5t5-12v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36z m411-125q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z m0-143q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z" horiz-adv-x="857.1" />
|
142 |
+
|
143 |
+
<glyph glyph-name="angle-double-left" unicode="" d="M350 82q0-7-6-13l-28-28q-5-5-12-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q5 6 13 6t12-6l28-28q6-5 6-13t-6-12l-219-220 219-219q6-6 6-13z m214 0q0-7-5-13l-28-28q-6-5-13-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q6 6 13 6t13-6l28-28q5-5 5-13t-5-12l-220-220 220-219q5-6 5-13z" horiz-adv-x="571.4" />
|
144 |
+
|
145 |
+
<glyph glyph-name="angle-double-right" unicode="" d="M332 314q0-7-5-12l-261-261q-5-5-12-5t-13 5l-28 28q-6 6-6 13t6 13l219 219-219 220q-6 5-6 12t6 13l28 28q5 6 13 6t12-6l261-260q5-5 5-13z m214 0q0-7-5-12l-260-261q-6-5-13-5t-13 5l-28 28q-5 6-5 13t5 13l219 219-219 220q-5 5-5 12t5 13l28 28q6 6 13 6t13-6l260-260q5-5 5-13z" horiz-adv-x="571.4" />
|
146 |
+
|
147 |
+
<glyph glyph-name="angle-double-up" unicode="" d="M600 118q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 219-219-219q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 5 12 5t13-5l260-260q6-6 6-13z m0 214q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 220-219-220q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 6 12 6t13-6l260-260q6-6 6-13z" horiz-adv-x="642.9" />
|
148 |
+
|
149 |
+
<glyph glyph-name="angle-double-down" unicode="" d="M600 368q0-7-6-13l-260-260q-5-6-13-6t-12 6l-260 260q-6 6-6 13t6 13l28 28q5 5 12 5t13-5l219-220 220 220q5 5 13 5t12-5l28-28q6-6 6-13z m0 214q0-7-6-13l-260-260q-5-5-13-5t-12 5l-260 260q-6 6-6 13t6 13l28 28q5 6 12 6t13-6l219-219 220 219q5 6 13 6t12-6l28-28q6-6 6-13z" horiz-adv-x="642.9" />
|
150 |
+
|
151 |
+
<glyph glyph-name="desktop" unicode="" d="M1000 296v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465q0-7 6-12t12-5h893q7 0 13 5t5 12z m71 465v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63v607q0 37 26 63t63 26h893q37 0 63-26t26-63z" horiz-adv-x="1071.4" />
|
152 |
+
|
153 |
+
<glyph glyph-name="laptop" unicode="" d="M232 136q-37 0-63 26t-26 63v393q0 37 26 63t63 26h607q37 0 63-26t27-63v-393q0-37-27-63t-63-26h-607z m-18 482v-393q0-7 6-13t12-5h607q8 0 13 5t5 13v393q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12z m768-518h89v-54q0-22-26-37t-63-16h-893q-36 0-63 16t-26 37v54h982z m-402-54q9 0 9 9t-9 9h-89q-9 0-9-9t9-9h89z" horiz-adv-x="1071.4" />
|
154 |
+
|
155 |
+
<glyph glyph-name="tablet" unicode="" d="M357 64q0 15-10 25t-26 11-25-11-10-25 10-25 25-10 26 10 10 25z m214 90v535q0 8-5 13t-12 5h-465q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h465q7 0 12 5t5 13z m72 535v-607q0-37-26-63t-63-26h-465q-36 0-63 26t-26 63v607q0 37 26 63t63 27h465q36 0 63-27t26-63z" horiz-adv-x="642.9" />
|
156 |
+
|
157 |
+
<glyph glyph-name="circle-empty" unicode="" d="M429 654q-83 0-153-41t-110-111-41-152 41-152 110-111 153-41 152 41 110 111 41 152-41 152-110 111-152 41z m428-304q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
|
158 |
+
|
159 |
+
<glyph glyph-name="circle" unicode="" d="M857 350q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
|
160 |
+
|
161 |
+
<glyph glyph-name="unlink" unicode="" d="M245 141l-143-143q-6-5-13-5t-12 5q-6 6-6 13t6 13l142 142q6 5 13 5t13-5q5-5 5-12t-5-13z m94-23v-179q0-8-5-13t-13-5-12 5-5 13v179q0 8 5 13t12 5 13-5 5-13z m-125 125q0-8-5-13t-13-5h-178q-8 0-13 5t-5 13 5 13 13 5h178q8 0 13-5t5-13z m706-72q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-186 187q-12 12-24 31l134 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 23-16 38l-153 154 10 133q20-11 31-23l188-188q47-48 47-114z m-345 404l-133-10-152 153q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l153-153-10-134q-20 12-32 24l-187 187q-47 48-47 114 0 67 47 113l82 82q47 46 114 46 67 0 114-47l186-187q12-12 23-32z m354-46q0-8-5-13t-13-5h-179q-8 0-13 5t-5 13 5 12 13 5h179q8 0 13-5t5-12z m-304 303v-178q0-8-5-13t-13-5-13 5-5 13v178q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-12 5q-5 6-5 13t5 13l143 143q5 5 12 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.6" />
|
162 |
+
|
163 |
+
<glyph glyph-name="help" unicode="" d="M393 149v-134q0-9-7-15t-15-7h-134q-9 0-16 7t-7 15v134q0 9 7 16t16 6h134q9 0 15-6t7-16z m176 335q0-30-8-56t-20-43-31-33-32-25-34-19q-23-13-38-37t-15-37q0-10-7-18t-16-9h-134q-8 0-14 11t-6 20v26q0 46 37 87t79 60q33 16 47 32t14 42q0 24-26 41t-60 18q-36 0-60-16-20-14-60-64-7-9-17-9-7 0-14 4l-91 70q-8 6-9 14t3 16q89 148 259 148 45 0 90-17t81-46 59-72 23-88z" horiz-adv-x="571.4" />
|
164 |
+
|
165 |
+
<glyph glyph-name="info" unicode="" d="M357 100v-71q0-15-10-25t-26-11h-285q-15 0-25 11t-11 25v71q0 15 11 25t25 11h35v214h-35q-15 0-25 11t-11 25v71q0 15 11 25t25 11h214q15 0 25-11t11-25v-321h35q15 0 26-11t10-25z m-71 643v-107q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v107q0 14 11 25t25 11h143q15 0 25-11t11-25z" horiz-adv-x="357.1" />
|
166 |
+
|
167 |
+
<glyph glyph-name="attention-alt" unicode="" d="M286 154v-125q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v125q0 14 11 25t25 10h143q15 0 25-10t11-25z m17 589l-16-429q-1-14-12-25t-25-10h-143q-14 0-25 10t-12 25l-15 429q-1 14 10 25t24 11h179q14 0 25-11t10-25z" horiz-adv-x="357.1" />
|
168 |
+
|
169 |
+
<glyph glyph-name="ellipsis" unicode="" d="M214 439v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-15 38v107q0 23 15 38t38 16h107q23 0 38-16t16-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-16 38v107q0 23 16 38t38 16h107q23 0 38-16t16-38z" horiz-adv-x="785.7" />
|
170 |
+
|
171 |
+
<glyph glyph-name="ellipsis-vert" unicode="" d="M214 154v-108q0-22-15-37t-38-16h-107q-23 0-38 16t-16 37v108q0 22 16 38t38 15h107q22 0 38-15t15-38z m0 285v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m0 286v-107q0-22-15-38t-38-16h-107q-23 0-38 16t-16 38v107q0 22 16 38t38 16h107q22 0 38-16t15-38z" horiz-adv-x="214.3" />
|
172 |
+
|
173 |
+
<glyph glyph-name="euro" unicode="" d="M545 121l19-89q2-7-1-13t-10-8l-3 0q-2-1-6-2t-9-3-12-3-14-3-16-2-19-3-21-2-21 0q-131 0-228 73t-133 196h-53q-7 0-13 5t-5 13v63q0 7 5 12t13 6h37q-1 31 0 58h-37q-8 0-13 5t-5 13v64q0 8 5 13t13 5h55q37 117 135 188t224 72q57 0 108-13 6-2 11-9 4-6 2-13l-24-89q-2-7-8-11t-13-1l-2 1q-3 0-7 1l-10 2t-12 2-15 2-16 1-16 1q-71 0-126-36t-84-98h261q9 0 14-7 6-7 4-15l-13-63q-3-15-18-15h-273q-1-20 0-58h257q8 0 13-7 5-7 4-15l-14-63q-1-6-6-10t-11-4h-216q27-65 84-104t127-38q10 0 20 1t19 2 16 2 14 3 10 3l7 1 3 2q7 2 14-2 7-3 9-11z" horiz-adv-x="571.4" />
|
174 |
+
|
175 |
+
<glyph glyph-name="pound" unicode="" d="M569 216v-205q0-8-5-13t-13-5h-533q-8 0-13 5t-5 13v83q0 8 5 13t13 5h54v214h-53q-8 0-13 5t-5 13v73q0 8 5 13t13 5h53v124q0 96 69 158t175 62q104 0 187-70 5-5 6-12t-4-12l-57-71q-5-6-13-7-7-1-13 4-2 3-14 11t-39 18-51 10q-48 0-77-27t-29-68v-120h170q8 0 13-5t5-13v-73q0-7-5-13t-13-5h-170v-211h231v101q0 7 5 12t13 5h90q8 0 13-5t5-12z" horiz-adv-x="571.4" />
|
176 |
+
|
177 |
+
<glyph glyph-name="dollar" unicode="" d="M546 189q0-86-56-147t-144-77v-97q0-8-5-13t-13-5h-75q-7 0-13 5t-5 13v97q-37 5-71 18t-57 25-41 26-26 21-10 10q-9 12-1 23l58 76q3 5 12 6 9 1 14-5l1-1q63-55 135-70 21-4 42-4 45 0 79 24t35 68q0 16-9 30t-18 23-33 21-37 18-45 18q-21 9-34 14t-34 15-35 17-32 20-29 24-25 27-20 32-11 37-5 44q0 77 55 135t142 75v100q0 7 5 13t13 5h75q8 0 13-5t5-13v-98q32-3 62-13t48-19 36-20 21-17 9-7q9-11 3-22l-46-81q-4-9-12-9-8-2-15 4-2 2-9 7t-21 14-33 18-42 15-47 6q-53 0-87-24t-33-62q0-14 4-27t17-23 22-18 31-18 34-15 39-15q30-11 45-17t43-20 42-24 34-28 30-35 18-43 7-52z" horiz-adv-x="571.4" />
|
178 |
+
|
179 |
+
<glyph glyph-name="rupee" unicode="" d="M501 588v-57q0-8-5-13t-13-5h-93q-13-80-72-131t-154-61q93-99 256-299 8-9 2-19-5-10-16-10h-109q-9 0-14 7-171 204-278 318-5 5-5 13v70q0 8 5 13t13 5h62q74 0 119 24t57 70h-238q-8 0-13 5t-5 13v57q0 8 5 13t13 5h230q-31 63-149 63h-81q-7 0-13 5t-5 13v74q0 8 5 13t13 5h464q8 0 13-5t5-13v-57q0-8-5-13t-13-5h-130q26-34 36-80h95q8 0 13-5t5-13z" horiz-adv-x="501.1" />
|
180 |
+
|
181 |
+
<glyph glyph-name="yen" unicode="" d="M337-7h-96q-8 0-13 5t-5 13v184h-161q-7 0-13 5t-5 13v57q0 8 5 13t13 5h161v48h-161q-7 0-13 5t-5 12v58q0 8 5 13t13 5h119l-179 323q-4 9 0 18 6 9 16 9h108q11 0 16-10l120-238q11-21 32-69 5 13 17 38t15 34l107 234q4 11 16 11h106q10 0 15-9 5-8 1-18l-175-323h120q7 0 13-5t5-13v-58q0-7-5-12t-13-5h-162v-48h162q7 0 13-5t5-13v-57q0-8-5-13t-13-5h-162v-184q0-7-5-13t-12-5z" horiz-adv-x="573.1" />
|
182 |
+
|
183 |
+
<glyph glyph-name="rouble" unicode="" d="M582 535q0 56-36 90t-96 35h-178v-250h178q60 0 96 34t36 91z m132 0q0-108-70-176t-182-68h-190v-66h282q7 0 12-5t5-13v-71q0-8-5-13t-12-5h-282v-107q0-8-5-13t-13-5h-93q-8 0-13 5t-5 13v107h-125q-8 0-13 5t-5 13v71q0 8 5 13t13 5h125v66h-125q-8 0-13 5t-5 13v83q0 7 5 12t13 6h125v351q0 8 5 13t13 5h301q111 0 182-68t70-176z" horiz-adv-x="714.3" />
|
184 |
+
|
185 |
+
<glyph glyph-name="won" unicode="" d="M287 183l45 167h-89l42-167q1-1 1-2t0-2q0 1 1 2t0 2z m65 238l19 72h-163l18-72h126z m107 0h77l-19 72h-39z m250-238l44 167h-91l46-167q0 0 0-2t1-2q0 1 0 2t0 2z m62 238l19 72h-166l19-72h128z m229-17v-36q0-8-5-13t-13-5h-119l-91-344q-4-13-17-13h-89q-14 0-18 13l-92 344h-117l-93-344q-4-13-17-13h-89q-6 0-11 4t-6 9l-89 344h-116q-8 0-13 5t-5 13v36q0 7 5 12t13 5h98l-19 72h-79q-8 0-13 5t-5 13v35q0 8 5 13t13 5h61l-50 192q-3 9 3 16 5 7 14 7h77q14 0 17-14l50-201h201l54 201q4 14 17 14h70q14 0 18-14l54-201h204l52 201q3 14 17 14h77q9 0 14-7 6-7 3-16l-51-192h62q8 0 13-5t5-13v-35q0-8-5-13t-13-5h-81l-19-72h100q8 0 13-5t5-12z" horiz-adv-x="1000" />
|
186 |
+
|
187 |
+
<glyph glyph-name="bitcoin" unicode="" d="M651 493q10-102-73-144 65-16 98-58t25-119q-4-40-18-70t-36-49-54-33-68-19-81-9v-142h-86v140q-45 0-68 1v-141h-86v142q-10 0-30 1t-31 0h-112l18 102h62q27 0 32 28v225h9q-4 0-9 0v161q-7 37-50 37h-62v92l119-1q35 0 54 1v141h86v-138q45 1 68 1v137h86v-141q44-4 78-13t63-25 46-43 20-64z m-120-304q0 20-8 35t-21 26-32 17-36 11-42 5-38 1-36 0-27-1v-189q5 0 21 0t27 0 29 1 33 2 32 5 31 8 26 11 22 17 14 22 5 29z m-39 265q0 19-7 33t-17 23-27 16-31 9-34 5-32 1-31 0-22-1v-171q3 0 20 0t26 0 27 1 31 3 29 6 27 10 21 15 15 22 5 28z" horiz-adv-x="714.3" />
|
188 |
+
|
189 |
+
<glyph glyph-name="sort-alt-up" unicode="" d="M411 46q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m589-71v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m-107 285v-107q0-7-5-12t-13-6h-250q-8 0-13 6t-5 12v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z" horiz-adv-x="1000" />
|
190 |
+
|
191 |
+
<glyph glyph-name="sort-alt-down" unicode="" d="M679-25v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z m-268 71q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m375 215v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m107 285v-107q0-7-5-12t-13-6h-357q-8 0-13 6t-5 12v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m107 286v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z" horiz-adv-x="1000" />
|
192 |
+
|
193 |
+
<glyph glyph-name="bug" unicode="" d="M911 314q0-14-11-25t-25-10h-125q0-96-37-162l116-117q10-11 10-25t-10-25q-10-11-25-11t-25 11l-111 110q-3-3-8-7t-24-16-36-21-46-16-54-7v500h-71v-500q-29 0-57 7t-49 19-36 22-25 18l-8 8-102-116q-11-12-27-12-13 0-24 9-11 10-11 25t8 26l113 127q-32 63-32 153h-125q-15 0-25 10t-11 25 11 25 25 11h125v164l-97 97q-11 10-11 25t11 25 25 10 25-10l97-97h471l96 97q11 10 25 10t26-10 10-25-10-25l-97-97v-164h125q15 0 25-11t11-25z m-268 322h-357q0 74 52 126t126 52 127-52 52-126z" horiz-adv-x="928.6" />
|
194 |
+
|
195 |
+
<glyph glyph-name="try" unicode="" d="M643 386q0-107-53-197t-143-143-197-53h-89q-8 0-13 5t-5 13v341l-120-37q-2-1-5-1-6 0-11 4-7 5-7 14v72q0 12 13 17l130 40v51l-120-36q-2-1-5-1-6 0-11 3-7 6-7 15v71q0 13 13 18l130 39v140q0 8 5 13t13 5h89q8 0 13-5t5-13v-101l209 64q9 3 16-2t7-15v-71q0-13-13-18l-219-67v-52l209 65q9 3 16-3t7-15v-71q0-13-13-17l-219-68v-272q105 8 177 85t73 183q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="642.9" />
|
196 |
+
|
197 |
+
<glyph glyph-name="wordpress" unicode="" d="M71 350q0 91 37 175l205-561q-109 53-176 157t-66 229z m719 22q0-11-2-22t-5-27-7-25-9-33-10-32l-43-143-155 461q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-42 1-113 6-6 0-11-3t-6-9-1-10 5-9 11-5l44-4 67-183-94-281-156 464q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-4 0-13 0t-14 1q58 89 153 141t205 52q82 0 157-29t133-84h-6q-31 0-51-22t-21-53q0-7 1-14t2-12 5-13 5-11 7-13 7-12 8-13 8-13q35-60 35-118z m-283-59l133-361q0-4 2-7-70-24-142-24-62 0-121 18z m369 243q53-97 53-206 0-117-58-215t-156-156l132 379q33 94 33 154 0 23-4 44z m-376 294q102 0 194-40t160-106 106-160 40-194-40-194-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40z m0-977q97 0 185 38t152 102 102 152 38 185-38 185-102 152-152 102-185 38-185-38-152-102-102-152-38-185 38-185 102-152 152-102 185-38z" horiz-adv-x="1000" />
|
198 |
+
|
199 |
+
<glyph glyph-name="cubes" unicode="" d="M357-61l214 107v176l-214-92v-191z m-36 254l226 96-226 97-225-97z m608-254l214 107v176l-214-92v-191z m-36 254l225 96-225 97-226-97z m-250 163l214 92v149l-214-92v-149z m-36 212l246 105-246 106-246-106z m607-289v-233q0-20-10-37t-29-26l-250-125q-14-8-32-8t-32 8l-250 125q-2 1-4 2-1-1-4-2l-250-125q-14-8-32-8t-31 8l-250 125q-19 9-29 26t-11 37v233q0 21 12 39t32 26l242 104v223q0 22 12 40t31 26l250 107q13 6 28 6t28-6l250-107q20-9 32-26t12-40v-223l242-104q20-8 32-26t11-39z" horiz-adv-x="1285.7" />
|
200 |
+
|
201 |
+
<glyph glyph-name="database" unicode="" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
|
202 |
+
|
203 |
+
<glyph glyph-name="circle-thin" unicode="" d="M429 707q-73 0-139-28t-114-76-76-114-29-139 29-139 76-113 114-77 139-28 138 28 114 77 76 113 29 139-29 139-76 114-114 76-138 28z m428-357q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
|
204 |
+
|
205 |
+
<glyph glyph-name="sliders" unicode="" d="M196 64v-71h-196v71h196z m197 72q14 0 25-11t11-25v-143q0-14-11-25t-25-11h-143q-14 0-25 11t-11 25v143q0 15 11 25t25 11h143z m89 214v-71h-482v71h482z m-357 286v-72h-125v72h125z m732-572v-71h-411v71h411z m-536 643q15 0 26-10t10-26v-142q0-15-10-25t-26-11h-142q-15 0-25 11t-11 25v142q0 15 11 26t25 10h142z m358-286q14 0 25-10t10-25v-143q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v143q0 14 11 25t25 10h143z m178-71v-71h-125v71h125z m0 286v-72h-482v72h482z" horiz-adv-x="857.1" />
|
206 |
+
|
207 |
+
<glyph glyph-name="share" unicode="" d="M679 279q74 0 126-53t52-126-52-126-126-53-127 53-52 126q0 7 1 19l-201 100q-51-48-121-48-75 0-127 53t-52 126 52 126 127 53q70 0 121-48l201 100q-1 12-1 19 0 74 52 126t127 53 126-53 52-126-52-126-126-53q-71 0-122 48l-201-100q1-12 1-19t-1-19l201-100q51 48 122 48z" horiz-adv-x="857.1" />
|
208 |
+
|
209 |
+
<glyph glyph-name="plug" unicode="" d="M979 597q21-21 21-50t-21-51l-223-223 83-84-89-89q-91-91-217-104t-230 56l-202-202h-101v101l202 202q-69 103-56 230t104 217l89 89 84-83 223 223q21 21 51 21t50-21 21-50-21-51l-223-223 131-131 223 223q22 21 51 21t50-21z" horiz-adv-x="1000" />
|
210 |
+
|
211 |
+
<glyph glyph-name="trash" unicode="" d="M286 82v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m143 0v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m142 0v393q0 8-5 13t-12 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q7 0 12 5t5 13z m-303 554h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
|
212 |
+
|
213 |
+
<glyph glyph-name="chart-line" unicode="" d="M1143-7v-72h-1143v858h71v-786h1072z m-72 696v-242q0-12-10-17t-20 4l-68 68-353-353q-6-6-13-6t-13 6l-130 130-232-233-107 108 327 326q5 6 12 6t13-6l130-130 259 259-67 68q-9 8-5 19t17 11h243q7 0 12-5t5-13z" horiz-adv-x="1142.9" />
|
214 |
+
|
215 |
+
<glyph glyph-name="shekel" unicode="" d="M554 502v-277q0-8-5-13t-13-5h-90q-7 0-12 5t-5 13v277q0 62-45 107t-107 45h-152v-643q0-8-5-13t-13-5h-89q-8 0-13 5t-5 13v750q0 8 5 13t13 5h259q75 0 139-37t101-101 37-139z m214 259v-491q0-76-37-139t-101-101-139-37h-259q-8 0-13 5t-5 13v535q0 8 5 13t13 5h89q8 0 13-5t5-13v-428h152q63 0 107 45t45 107v491q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="857.1" />
|
216 |
+
|
217 |
+
<glyph glyph-name="user-secret" unicode="" d="M321-7l54 250-54 71-71 36z m143 0l72 357-72-36-53-71z m90 564q-1 2-3 3-5 4-53 4-39 0-93-10-4-1-12-1t-12 1q-54 10-93 10-48 0-54-4-1-1-2-3 1-11 2-16 2-1 5-3t4-6q1-2 4-11t4-12 4-9 5-10 5-8 7-7 7-6 10-4 12-2 13-1q20 0 33 7t18 16 8 20 7 16 10 7h6q6 0 10-7t6-16 9-20 18-16 33-7q7 0 13 1t12 2 9 4 8 6 7 7 5 8 5 10 4 9 4 12 4 11q1 4 4 6t4 3q2 5 3 16z m232-491q0-68-41-106t-108-39h-488q-67 0-108 39t-41 106q0 34 3 66t10 70 21 69 36 58 52 41l-51 123h120q-12 36-12 71 0 7 1 18-109 23-109 54 0 32 118 55 9 35 28 75t40 63q18 21 42 21 17 0 47-17t47-18 47 18 47 17q24 0 42-21 20-23 39-63t29-75q117-23 117-55 0-31-108-54 4-45-11-89h119l-45-126q35-18 60-54t36-80 16-84 5-83z" horiz-adv-x="857.1" />
|
218 |
+
|
219 |
+
<glyph glyph-name="user-plus" unicode="" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m536-71h196q7 0 13-6t5-12v-107q0-8-5-13t-13-5h-196v-197q0-7-6-12t-12-6h-107q-8 0-13 6t-5 12v197h-197q-7 0-12 5t-6 13v107q0 7 6 12t12 6h197v196q0 7 5 13t13 5h107q7 0 12-5t6-13v-196z m-411-125q0-29 21-51t50-21h143v-133q-38-28-95-28h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 44-34 86-51t92-17 92 17 86 51q11 10 22 10 73 0 121-54h-125q-29 0-50-21t-21-50v-107z" horiz-adv-x="1142.9" />
|
220 |
+
|
221 |
+
<glyph glyph-name="user-times" unicode="" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m601-179l139-138q5-5 5-13 0-8-5-13l-76-76q-5-5-12-5-8 0-13 5l-139 139-139-139q-5-5-13-5-7 0-12 5l-76 76q-5 5-5 13 0 8 5 13l139 138-139 139q-5 5-5 13 0 8 5 13l76 75q5 5 12 5 8 0 13-5l139-139 139 139q5 5 13 5 7 0 12-5l76-75q5-5 5-13 0-8-5-13z m-278 0l-101-101q-21-20-21-50 0-30 21-51l46-46q-11-2-24-2h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 86-68 178-68t178 68q11 10 22 10 15 0 31-4-15-15-22-27t-8-32q0-30 21-51z" horiz-adv-x="1142.9" />
|
222 |
+
|
223 |
+
<glyph glyph-name="viacoin" unicode="" d="M857 850l-107-250h107v-107h-153l-30-72h183v-107h-229l-199-464-200 464h-229v107h184l-31 72h-153v107h107l-107 250h143l180-429h211l180 429h143z m-428-679l60 143h-121z" horiz-adv-x="857.1" />
|
224 |
+
|
225 |
+
<glyph glyph-name="safari" unicode="" d="M530 352q0-15-10-25t-23-11q-14 0-25 9t-10 23q0 15 9 25t23 11 25-9 11-23z m8-33l195 325q-5-5-37-35t-70-65-77-71-65-62-28-29l-195-323q4 4 38 34t70 65 76 71 65 62 28 28z m361 31q0-112-58-207-2 1-9 6t-15 9-9 5q-8 0-8-8 0-5 33-24-41-63-103-107t-135-61l-8 37q-1 6-9 6-3 0-4-3t-1-6l9-38q-41-8-82-8-111 0-208 59 1 1 8 11t12 19 5 10q0 8-7 8-4 0-10-8t-12-20-8-13q-63 42-107 105t-61 137l38 8q6 2 6 8 0 3-3 5t-6 1l-38-9q-8 41-8 78 0 115 61 212 1-1 10-7t17-11 10-4q7 0 7 6 0 4-7 9t-18 12l-11 7q43 62 105 105t136 60l9-37q1-6 8-6 3 0 5 3t1 6l-9 37q40 7 75 7 114 0 212-61-22-31-22-36 0-7 6-7 7 0 27 35 62-41 105-103t60-135l-31-7q-6-1-6-8 0-3 3-5t5-1l32 7q8-40 8-78z m47 0q0 91-35 174t-95 142-142 95-174 35-173-35-143-95-95-142-35-174 35-173 95-143 143-95 173-35 174 35 142 95 95 143 35 173z m54 0q0-102-40-194t-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40 194-40 160-106 106-160 40-194z" horiz-adv-x="1000" />
|
226 |
+
|
227 |
+
<glyph glyph-name="chrome" unicode="" d="M498 850q134 1 252-67 130-75 196-208l-414 22q-89 5-164-41t-103-128l-154 236q72 89 174 137t213 49z m-416-226l188-370q40-80 117-121t164-25l-129-252q-118 19-214 88t-152 176-56 230q0 149 82 274z m885-94q32-84 33-174t-27-170-86-152-137-117q-128-74-278-66l226 347q49 73 46 162t-59 155z m-467-11q70 0 119-50t50-119-50-119-119-49-119 49-49 119 49 119 119 50z" horiz-adv-x="1000" />
|
228 |
+
|
229 |
+
<glyph glyph-name="firefox" unicode="" d="M504-150q-158 0-282 84t-183 222q-33 74-38 168t15 186 62 174 100 135l-7-156q7 7 38 8t39-8q24 45 90 77t131 32q-30-25-67-82t-33-92q14-4 35-7t36-4 37-3 29-1q8-3 5-26t-17-42q-3-4-9-10t-32-20-56-19l8-105-77 37q-10-24-5-45t21-38 36-23 45-3q29 5 55 19t47 25 41 10q34-2 50-19t10-36q0-1-1-3t-5-7-10-9-17-5-26-1q-34-53-81-76t-117-16q41-34 91-46t94-3 86 29 71 48 45 58q24 51 22 108t-21 105-44 70q49-21 77-45t43-62q8 95-32 191t-117 159q148-43 230-156t84-289q1-71-23-143t-68-132-106-110-138-75-161-28z" horiz-adv-x="1000" />
|
230 |
+
|
231 |
+
<glyph glyph-name="opera" unicode="" d="M833 723q-92 61-200 61-87 0-164-41t-134-111q-41-52-66-122t-27-148v-24q2-78 27-148t66-122q57-71 134-111t164-41q108 0 200 61-67-60-153-94t-180-33q-16 0-24 1-98 4-186 45t-152 108-101 157-37 189q0 102 40 194t106 160 160 106 194 40h2q93-1 179-34t152-93z m167-373q0-107-43-202t-119-166q-58-35-124-35-76 0-142 47 86 31 141 130t56 226q0 127-55 225t-141 131q66 46 141 46 67 0 126-36 76-70 118-164t42-202z" horiz-adv-x="1000" />
|
232 |
+
|
233 |
+
<glyph glyph-name="internet-explorer" unicode="" d="M1000 327q0-31-4-58h-642q0-81 61-136t144-55q55 0 103 26t76 73h236q-31-89-95-157t-149-106-179-37q-105 0-199 47-127-65-220-65-132 0-132 147 0 64 25 153 10 34 61 128 111 201 265 338-103-44-238-197 35 153 158 250t280 98q17 0 25 0 142 65 242 65 35 0 64-7t53-23 37-42 14-65q0-64-42-159 56-102 56-218z m-39 357q0 47-30 74t-76 27q-60 0-142-39 68-26 124-73t96-109q28 75 28 120z m-890-690q0-48 28-74t75-26q64 0 148 46-68 41-119 103t-77 136q-55-114-55-185z m282 398h406q-3 79-63 132t-140 53q-81 0-140-53t-63-132z" horiz-adv-x="1000" />
|
234 |
+
|
235 |
+
<glyph glyph-name="television" unicode="" d="M1000 154v535q0 8-5 13t-13 5h-893q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h893q7 0 13 5t5 13z m71 535v-535q0-37-26-63t-63-27h-411v-71h197q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 8 5 13t13 5h196v71h-411q-36 0-63 27t-26 63v535q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1142.9" />
|
236 |
+
|
237 |
+
<glyph glyph-name="percent" unicode="" d="M714 136q0 29-21 50t-50 21-50-21-22-50 22-50 50-22 50 22 21 50z m-428 428q0 29-21 51t-51 21-50-21-21-51 21-50 50-21 51 21 21 50z m571-428q0-89-63-152t-151-63-152 63-62 152 62 151 152 63 151-63 63-151z m-53 607q0-11-8-21l-589-786q-11-15-28-15h-90q-14 0-25 11t-10 25q0 11 7 21l589 786q11 15 29 15h89q14 0 25-11t11-25z m-375-179q0-88-63-151t-152-63-151 63-63 151 63 152 151 63 152-63 63-152z" horiz-adv-x="857.1" />
|
238 |
+
</font>
|
239 |
+
</defs>
|
240 |
+
</svg>
|
css/fonts/icons/icons.ttf
ADDED
Binary file
|
css/fonts/icons/icons.woff
ADDED
Binary file
|
css/fonts/icons/icons.woff2
ADDED
Binary file
|
inc/cleantalk-admin.php
CHANGED
@@ -140,23 +140,24 @@ function apbct_admin__init(){
|
|
140 |
}
|
141 |
|
142 |
// Getting key like hoster. Only once!
|
143 |
-
if($apbct->white_label && empty($apbct->
|
144 |
|
145 |
$_POST['submit'] = 'get_key_auto';
|
146 |
-
|
147 |
$settings = apbct_settings__validate(array());
|
148 |
-
|
149 |
unset($_POST['submit']);
|
150 |
-
$apbct->data['white_label_data']['is_key_recieved'] = true;
|
151 |
-
$apbct->saveData();
|
152 |
|
153 |
if(!empty($settings['apikey'])){
|
154 |
$apbct->settings['apikey'] = $settings['apikey'];
|
155 |
$apbct->api_key = $settings['apikey'];
|
156 |
-
$apbct->saveSettings();
|
157 |
}
|
158 |
|
159 |
}
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
/**
|
@@ -224,16 +225,19 @@ function apbct_admin__enqueue_scripts($hook){
|
|
224 |
wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.min.css'), array(), APBCT_VERSION, 'all');
|
225 |
|
226 |
wp_localize_script( 'jquery', 'ctAdminCommon', array(
|
|
|
|
|
227 |
'plugin_name' => $apbct->plugin_name,
|
228 |
-
'logo' => '<img src="' . $apbct->logo
|
229 |
-
'logo_small' => '<img src="' . $apbct->logo__small
|
230 |
'logo_small_colored' => '<img src="' . $apbct->logo__small__colored . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
231 |
-
|
232 |
-
|
233 |
// DASHBOARD page JavaScript and CSS
|
234 |
if($hook == 'index.php' && apbct_is_user_role_in(array('administrator'))){
|
235 |
|
236 |
wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.min.css'), array(), APBCT_VERSION, 'all');
|
|
|
237 |
|
238 |
wp_enqueue_script('ct_gstatic_charts_loader', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget--google-charts.min.js'), array(), APBCT_VERSION);
|
239 |
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);
|
@@ -264,10 +268,9 @@ function apbct_admin__enqueue_scripts($hook){
|
|
264 |
|
265 |
wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.min.js'), array(), APBCT_VERSION);
|
266 |
wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.min.css'), array(), APBCT_VERSION, 'all');
|
|
|
267 |
|
268 |
-
$ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
|
269 |
wp_localize_script( 'jquery', 'ctSettingsPage', array(
|
270 |
-
'ct_ajax_nonce' => $ajax_nonce,
|
271 |
'ct_subtitle' => $apbct->ip_license ? __('Hosting AntiSpam', 'cleantalk') : '',
|
272 |
'ip_license' => $apbct->ip_license ? true : false,
|
273 |
));
|
140 |
}
|
141 |
|
142 |
// Getting key like hoster. Only once!
|
143 |
+
if(!is_main_site() && $apbct->white_label && empty($apbct->api_key)){
|
144 |
|
145 |
$_POST['submit'] = 'get_key_auto';
|
|
|
146 |
$settings = apbct_settings__validate(array());
|
|
|
147 |
unset($_POST['submit']);
|
|
|
|
|
148 |
|
149 |
if(!empty($settings['apikey'])){
|
150 |
$apbct->settings['apikey'] = $settings['apikey'];
|
151 |
$apbct->api_key = $settings['apikey'];
|
152 |
+
$apbct->saveSettings();
|
153 |
}
|
154 |
|
155 |
}
|
156 |
+
|
157 |
+
// AJAX actions
|
158 |
+
|
159 |
+
// Settings
|
160 |
+
add_action('wp_ajax_apbct_settings__get__long_description', 'apbct_settings__get__long_description'); // Long description
|
161 |
}
|
162 |
|
163 |
/**
|
225 |
wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.min.css'), array(), APBCT_VERSION, 'all');
|
226 |
|
227 |
wp_localize_script( 'jquery', 'ctAdminCommon', array(
|
228 |
+
'_ajax_nonce' => wp_create_nonce( 'ct_secret_nonce' ),
|
229 |
+
'_ajax_url' => admin_url( 'admin-ajax.php' ),
|
230 |
'plugin_name' => $apbct->plugin_name,
|
231 |
+
'logo' => '<img src="' . $apbct->logo . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
232 |
+
'logo_small' => '<img src="' . $apbct->logo__small . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
233 |
'logo_small_colored' => '<img src="' . $apbct->logo__small__colored . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
|
234 |
+
) );
|
235 |
+
|
236 |
// DASHBOARD page JavaScript and CSS
|
237 |
if($hook == 'index.php' && apbct_is_user_role_in(array('administrator'))){
|
238 |
|
239 |
wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.min.css'), array(), APBCT_VERSION, 'all');
|
240 |
+
wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
|
241 |
|
242 |
wp_enqueue_script('ct_gstatic_charts_loader', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget--google-charts.min.js'), array(), APBCT_VERSION);
|
243 |
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);
|
268 |
|
269 |
wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.min.js'), array(), APBCT_VERSION);
|
270 |
wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.min.css'), array(), APBCT_VERSION, 'all');
|
271 |
+
wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
|
272 |
|
|
|
273 |
wp_localize_script( 'jquery', 'ctSettingsPage', array(
|
|
|
274 |
'ct_subtitle' => $apbct->ip_license ? __('Hosting AntiSpam', 'cleantalk') : '',
|
275 |
'ip_license' => $apbct->ip_license ? true : false,
|
276 |
));
|
inc/cleantalk-ajax.php
CHANGED
@@ -145,8 +145,6 @@ $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via
|
|
145 |
|
146 |
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
147 |
|
148 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
149 |
-
|
150 |
$email = is_null( $email ) ? $email : $_POST['email'];
|
151 |
$email = sanitize_email($email);
|
152 |
$is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
|
@@ -199,8 +197,6 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
|
199 |
|
200 |
function ct_user_register_ajaxlogin($user_id)
|
201 |
{
|
202 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
203 |
-
|
204 |
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
205 |
{
|
206 |
|
@@ -251,9 +247,7 @@ function ct_mc4wp_ajax_hook( array $errors )
|
|
251 |
}
|
252 |
|
253 |
function ct_ajax_hook($message_obj = false, $additional = false)
|
254 |
-
{
|
255 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
256 |
-
|
257 |
global $apbct, $current_user;
|
258 |
|
259 |
$message_obj = (array)$message_obj;
|
@@ -294,7 +288,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
294 |
!apbct_is_user_enable($apbct->user) || // User is admin, editor, author
|
295 |
// (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
|
296 |
($apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
|
297 |
-
|
298 |
(isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
|
299 |
(isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
|
300 |
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
@@ -373,7 +367,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
373 |
}
|
374 |
}
|
375 |
}
|
376 |
-
|
377 |
$ct_temp_msg_data = isset($ct_post_temp)
|
378 |
? ct_get_fields_any($ct_post_temp)
|
379 |
: ct_get_fields_any($_POST);
|
@@ -414,7 +408,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
414 |
foreach($_POST as $param => $value){
|
415 |
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
416 |
$contact_form = 'contact_form_divi_theme';
|
417 |
-
$contact_form_additional = str_replace(
|
418 |
}
|
419 |
if(strpos($param, 'avia_generated_form') === 0){
|
420 |
$contact_form = 'contact_form_enfold_theme';
|
@@ -595,11 +589,11 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
595 |
{
|
596 |
$result = Array(
|
597 |
'error' => 'unexpected-error',
|
598 |
-
);
|
599 |
print json_encode($result);
|
600 |
die();
|
601 |
-
}
|
602 |
-
//Convertplug. Strpos because action value dynamically changes and depends on mailing service
|
603 |
elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
|
604 |
$result = Array(
|
605 |
'action' => "message",
|
@@ -635,10 +629,10 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
635 |
//cFormsII
|
636 |
elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
|
637 |
{
|
638 |
-
header('Content-Type: application/json');
|
639 |
$result = Array(
|
640 |
-
'no' => "",
|
641 |
-
'result' => "failure",
|
642 |
'html' =>$ct_result->comment,
|
643 |
'hide' => false,
|
644 |
'redirection' => null
|
@@ -700,7 +694,18 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
700 |
//Optin wheel
|
701 |
elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
|
702 |
wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
|
703 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
else
|
705 |
{
|
706 |
die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
|
145 |
|
146 |
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
|
147 |
|
|
|
|
|
148 |
$email = is_null( $email ) ? $email : $_POST['email'];
|
149 |
$email = sanitize_email($email);
|
150 |
$is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
|
197 |
|
198 |
function ct_user_register_ajaxlogin($user_id)
|
199 |
{
|
|
|
|
|
200 |
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
201 |
{
|
202 |
|
247 |
}
|
248 |
|
249 |
function ct_ajax_hook($message_obj = false, $additional = false)
|
250 |
+
{
|
|
|
|
|
251 |
global $apbct, $current_user;
|
252 |
|
253 |
$message_obj = (array)$message_obj;
|
288 |
!apbct_is_user_enable($apbct->user) || // User is admin, editor, author
|
289 |
// (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
|
290 |
($apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
|
291 |
+
apbct_exclusions_check__url() || // url exclusions
|
292 |
(isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
|
293 |
(isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
|
294 |
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
367 |
}
|
368 |
}
|
369 |
}
|
370 |
+
|
371 |
$ct_temp_msg_data = isset($ct_post_temp)
|
372 |
? ct_get_fields_any($ct_post_temp)
|
373 |
: ct_get_fields_any($_POST);
|
408 |
foreach($_POST as $param => $value){
|
409 |
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
410 |
$contact_form = 'contact_form_divi_theme';
|
411 |
+
$contact_form_additional = str_replace($param, '', $param);
|
412 |
}
|
413 |
if(strpos($param, 'avia_generated_form') === 0){
|
414 |
$contact_form = 'contact_form_enfold_theme';
|
589 |
{
|
590 |
$result = Array(
|
591 |
'error' => 'unexpected-error',
|
592 |
+
);
|
593 |
print json_encode($result);
|
594 |
die();
|
595 |
+
}
|
596 |
+
//Convertplug. Strpos because action value dynamically changes and depends on mailing service
|
597 |
elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
|
598 |
$result = Array(
|
599 |
'action' => "message",
|
629 |
//cFormsII
|
630 |
elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
|
631 |
{
|
632 |
+
header('Content-Type: application/json');
|
633 |
$result = Array(
|
634 |
+
'no' => "",
|
635 |
+
'result' => "failure",
|
636 |
'html' =>$ct_result->comment,
|
637 |
'hide' => false,
|
638 |
'redirection' => null
|
694 |
//Optin wheel
|
695 |
elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
|
696 |
wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
|
697 |
+
}
|
698 |
+
// Forminator
|
699 |
+
elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
|
700 |
+
wp_send_json_error(
|
701 |
+
array(
|
702 |
+
'message' => $ct_result->comment,
|
703 |
+
'success' => false,
|
704 |
+
'errors' => array(),
|
705 |
+
'behav' => 'behaviour-thankyou',
|
706 |
+
)
|
707 |
+
);
|
708 |
+
}
|
709 |
else
|
710 |
{
|
711 |
die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
|
inc/cleantalk-common.php
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
4 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
5 |
|
@@ -84,9 +88,12 @@ function apbct_base_call($params = array(), $reg_flag = false){
|
|
84 |
? CleantalkHelper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
|
85 |
: apbct_get_sender_info();
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
90 |
|
91 |
$default_params = array(
|
92 |
|
@@ -186,14 +193,15 @@ function apbct_base_call($params = array(), $reg_flag = false){
|
|
186 |
|
187 |
}
|
188 |
|
189 |
-
function
|
190 |
|
191 |
global $apbct, $cleantalk_executed;
|
192 |
|
193 |
// Common exclusions
|
194 |
if(
|
195 |
-
|
196 |
-
|
|
|
197 |
$cleantalk_executed
|
198 |
)
|
199 |
return true;
|
@@ -203,13 +211,13 @@ function apbct_base__check_exlusions($func = null){
|
|
203 |
case 'ct_contact_form_validate_postdata':
|
204 |
if(
|
205 |
(defined( 'DOING_AJAX' ) && DOING_AJAX) ||
|
206 |
-
|
207 |
)
|
208 |
return true;
|
209 |
break;
|
210 |
case 'ct_contact_form_validate':
|
211 |
if(
|
212 |
-
|
213 |
)
|
214 |
return true;
|
215 |
break;
|
@@ -221,6 +229,60 @@ function apbct_base__check_exlusions($func = null){
|
|
221 |
return false;
|
222 |
}
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
/**
|
225 |
* Inner function - Default data array for senders
|
226 |
* @return array
|
@@ -367,7 +429,10 @@ function ct_get_checkjs_value(){
|
|
367 |
global $apbct;
|
368 |
|
369 |
// Use static JS keys
|
370 |
-
|
|
|
|
|
|
|
371 |
$key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
|
372 |
|
373 |
// Using dynamic JS keys
|
@@ -382,7 +447,7 @@ function ct_get_checkjs_value(){
|
|
382 |
foreach ($keys as $k => $t) {
|
383 |
|
384 |
// Removing key if it's to old
|
385 |
-
if (time() - $t > $apbct->data['js_keys_store_days'] * 86400) {
|
386 |
unset($keys[$k]);
|
387 |
continue;
|
388 |
}
|
@@ -409,6 +474,22 @@ function ct_get_checkjs_value(){
|
|
409 |
return $key;
|
410 |
}
|
411 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
/**
|
413 |
* Inner function - Current site admin e-mail
|
414 |
* @return string Admin e-mail
|
@@ -549,7 +630,7 @@ function ct_delete_spam_comments() {
|
|
549 |
foreach ($last_comments as $c) {
|
550 |
$comment_date_gmt = strtotime($c->comment_date_gmt);
|
551 |
if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
|
552 |
-
if (time() - $comment_date_gmt > 86400 * $apbct->
|
553 |
// Force deletion old spam comments
|
554 |
wp_delete_comment($c->comment_ID, true);
|
555 |
}
|
@@ -642,10 +723,8 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
|
|
642 |
'edd_action', // Easy Digital Downloads
|
643 |
);
|
644 |
|
645 |
-
|
646 |
-
|
647 |
-
$contact = false;
|
648 |
-
} unset($value);
|
649 |
|
650 |
if(count($arr)){
|
651 |
|
@@ -672,7 +751,7 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
|
|
672 |
}
|
673 |
}
|
674 |
|
675 |
-
if(!is_array($value) && !is_object($value)
|
676 |
|
677 |
if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
|
678 |
$contact = false;
|
@@ -706,9 +785,9 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
|
|
706 |
// Names
|
707 |
}elseif (preg_match("/name/i", $key)){
|
708 |
|
709 |
-
preg_match("/((name.?)?(your|first|for)(.?name)?)
|
710 |
-
preg_match("/((name.?)?(last|family|second|sur)(.?name)?)
|
711 |
-
preg_match("
|
712 |
|
713 |
if(count($match_forename) > 1)
|
714 |
$nickname['first'] = $value;
|
@@ -717,8 +796,8 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
|
|
717 |
elseif(count($match_nickname) > 1)
|
718 |
$nickname['nick'] = $value;
|
719 |
else
|
720 |
-
$
|
721 |
-
|
722 |
// Subject
|
723 |
}elseif ($subject === null && preg_match("/subject/i", $key)){
|
724 |
$subject = $value;
|
@@ -728,7 +807,7 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
|
|
728 |
$message[$prev_name.$key] = $value;
|
729 |
}
|
730 |
|
731 |
-
}elseif(!is_object($value)
|
732 |
|
733 |
$prev_name_original = $prev_name;
|
734 |
$prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
|
@@ -809,99 +888,17 @@ function ct_get_fields_any_postdata($arr, $message=array()){
|
|
809 |
return $message;
|
810 |
}
|
811 |
|
812 |
-
/*
|
813 |
-
* Check if Array has keys with restricted names
|
814 |
-
*/
|
815 |
-
function apbct_does_array_has_key__recursive( $arr ) {
|
816 |
-
foreach ( $arr as $key => $value ) {
|
817 |
-
if ( is_array( $value ) )
|
818 |
-
apbct_does_array_has_key__recursive( $value );
|
819 |
-
else{
|
820 |
-
$exclusions = Array( 'members_search_submit' );
|
821 |
-
foreach ( $exclusions as $exclusion ) {
|
822 |
-
if ( stripos( $key, $exclusion ) !== false ) {
|
823 |
-
return true;
|
824 |
-
}
|
825 |
-
}
|
826 |
-
}
|
827 |
-
}
|
828 |
-
return false;
|
829 |
-
}
|
830 |
-
|
831 |
/**
|
832 |
-
* Checks if
|
833 |
*
|
834 |
-
* @
|
835 |
-
*/
|
836 |
-
function apbct_check_url_exclusions(){
|
837 |
-
|
838 |
-
global $cleantalk_url_exclusions;
|
839 |
-
|
840 |
-
if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)){
|
841 |
-
|
842 |
-
// Fix for AJAX forms
|
843 |
-
$haystack = $_SERVER['REQUEST_URI'] == '/wp-admin/admin-ajax.php' && !empty($_SERVER['HTTP_REFERER'])
|
844 |
-
? $_SERVER['HTTP_REFERER']
|
845 |
-
: $_SERVER['REQUEST_URI'];
|
846 |
-
|
847 |
-
foreach($cleantalk_url_exclusions as $exclusion){
|
848 |
-
if(stripos($haystack, $exclusion) !== false){
|
849 |
-
return true;
|
850 |
-
}
|
851 |
-
}
|
852 |
-
}
|
853 |
-
|
854 |
-
return false;
|
855 |
-
}
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Checks if sender_ip is in exclusion list
|
859 |
*
|
860 |
* @return bool
|
861 |
*/
|
862 |
-
function
|
863 |
-
|
864 |
-
global $cleantalk_ip_exclusions;
|
865 |
-
|
866 |
-
if(CleantalkHelper::ip__is_cleantalks($_SERVER['REMOTE_ADDR']))
|
867 |
-
return true;
|
868 |
-
|
869 |
-
if (!empty($cleantalk_ip_exclusions) && is_array($cleantalk_ip_exclusions)){
|
870 |
-
foreach($cleantalk_ip_exclusions as $exclusion){
|
871 |
-
if(stripos($_SERVER['REMOTE_ADDR'], $exclusion) !== false){
|
872 |
-
return true;
|
873 |
-
}
|
874 |
-
}
|
875 |
-
}
|
876 |
-
|
877 |
-
return false;
|
878 |
-
}
|
879 |
-
|
880 |
-
function ct_filter_array(&$data)
|
881 |
-
{
|
882 |
-
global $cleantalk_key_exclusions;
|
883 |
-
|
884 |
-
if(isset($cleantalk_key_exclusions) && sizeof($cleantalk_key_exclusions) > 0 && is_array($data)){
|
885 |
-
|
886 |
-
foreach($data as $key => $value){
|
887 |
-
|
888 |
-
if(!is_array($value)){
|
889 |
-
if(in_array($key,$cleantalk_key_exclusions)){
|
890 |
-
unset($data[$key]);
|
891 |
-
}
|
892 |
-
}else{
|
893 |
-
$data[$key] = ct_filter_array($value);
|
894 |
-
}
|
895 |
-
}
|
896 |
-
|
897 |
-
return $data;
|
898 |
-
|
899 |
-
}else{
|
900 |
-
return $data;
|
901 |
-
}
|
902 |
}
|
903 |
|
904 |
-
|
905 |
function cleantalk_debug($key,$value)
|
906 |
{
|
907 |
if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
|
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 |
|
88 |
? CleantalkHelper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
|
89 |
: apbct_get_sender_info();
|
90 |
|
91 |
+
// Fileds exclusions
|
92 |
+
if( ! empty( $params['message'] ) ){
|
93 |
+
apbct_array( $params['message'] )
|
94 |
+
->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
|
95 |
+
->delete();
|
96 |
+
}
|
97 |
|
98 |
$default_params = array(
|
99 |
|
193 |
|
194 |
}
|
195 |
|
196 |
+
function apbct_exclusions_check($func = null){
|
197 |
|
198 |
global $apbct, $cleantalk_executed;
|
199 |
|
200 |
// Common exclusions
|
201 |
if(
|
202 |
+
apbct_exclusions_check__ip() ||
|
203 |
+
apbct_exclusions_check__url() ||
|
204 |
+
apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
|
205 |
$cleantalk_executed
|
206 |
)
|
207 |
return true;
|
211 |
case 'ct_contact_form_validate_postdata':
|
212 |
if(
|
213 |
(defined( 'DOING_AJAX' ) && DOING_AJAX) ||
|
214 |
+
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
215 |
)
|
216 |
return true;
|
217 |
break;
|
218 |
case 'ct_contact_form_validate':
|
219 |
if(
|
220 |
+
apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
|
221 |
)
|
222 |
return true;
|
223 |
break;
|
229 |
return false;
|
230 |
}
|
231 |
|
232 |
+
/**
|
233 |
+
* Checks if reuqest URI is in exclusion list
|
234 |
+
*
|
235 |
+
* @return bool
|
236 |
+
*/
|
237 |
+
function apbct_exclusions_check__url() {
|
238 |
+
|
239 |
+
global $apbct;
|
240 |
+
|
241 |
+
if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
|
242 |
+
|
243 |
+
$exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
|
244 |
+
|
245 |
+
// Fix for AJAX forms
|
246 |
+
$haystack = $_SERVER['REQUEST_URI'] == '/wp-admin/admin-ajax.php' && ! empty( $_SERVER['HTTP_REFERER'] )
|
247 |
+
? $_SERVER['HTTP_REFERER']
|
248 |
+
: $_SERVER['REQUEST_URI'];
|
249 |
+
|
250 |
+
foreach ( $exclusions as $exclusion ) {
|
251 |
+
if (
|
252 |
+
($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
|
253 |
+
stripos( $haystack, $exclusion ) !== false
|
254 |
+
){
|
255 |
+
return true;
|
256 |
+
}
|
257 |
+
}
|
258 |
+
return false;
|
259 |
+
}
|
260 |
+
}
|
261 |
+
/**
|
262 |
+
* @deprecated 5.128 Using IP white-lists instead
|
263 |
+
* @deprecated since 18.09.2019
|
264 |
+
* Checks if sender_ip is in exclusion list
|
265 |
+
*
|
266 |
+
* @return bool
|
267 |
+
*/
|
268 |
+
function apbct_exclusions_check__ip(){
|
269 |
+
|
270 |
+
global $cleantalk_ip_exclusions;
|
271 |
+
|
272 |
+
if(CleantalkHelper::ip__is_cleantalks($_SERVER['REMOTE_ADDR']))
|
273 |
+
return true;
|
274 |
+
|
275 |
+
if (!empty($cleantalk_ip_exclusions) && is_array($cleantalk_ip_exclusions)){
|
276 |
+
foreach($cleantalk_ip_exclusions as $exclusion){
|
277 |
+
if(stripos($_SERVER['REMOTE_ADDR'], $exclusion) !== false){
|
278 |
+
return true;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
return false;
|
284 |
+
}
|
285 |
+
|
286 |
/**
|
287 |
* Inner function - Default data array for senders
|
288 |
* @return array
|
429 |
global $apbct;
|
430 |
|
431 |
// Use static JS keys
|
432 |
+
if(
|
433 |
+
$apbct->settings['use_static_js_key'] === 1 ||
|
434 |
+
($apbct->settings['use_static_js_key'] === -1 && apbct_is_cache_plugins_persist())
|
435 |
+
){
|
436 |
$key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
|
437 |
|
438 |
// Using dynamic JS keys
|
447 |
foreach ($keys as $k => $t) {
|
448 |
|
449 |
// Removing key if it's to old
|
450 |
+
if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
|
451 |
unset($keys[$k]);
|
452 |
continue;
|
453 |
}
|
474 |
return $key;
|
475 |
}
|
476 |
|
477 |
+
function apbct_is_cache_plugins_persist(){
|
478 |
+
return
|
479 |
+
defined('WP_ROCKET_VERSION') || // WPRocket
|
480 |
+
defined('LSCWP_DIR') || // LiteSpeed Cache
|
481 |
+
defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
|
482 |
+
defined('W3TC') || // W3 Total Cache
|
483 |
+
defined('WPO_VERSION') || // WP-Optimize – Clean, Compress, Cache
|
484 |
+
defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
|
485 |
+
defined('WPCACHEHOME') || // WP Super Cache
|
486 |
+
defined('WPHB_VERSION') || // Hummingbird – Speed up, Cache, Optimize Your CSS and JS
|
487 |
+
defined('CE_FILE') || // Cache Enabler – WordPress Cache
|
488 |
+
class_exists('RedisObjectCache') || // Redis Object Cache
|
489 |
+
defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
|
490 |
+
class_exists('WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
|
491 |
+
}
|
492 |
+
|
493 |
/**
|
494 |
* Inner function - Current site admin e-mail
|
495 |
* @return string Admin e-mail
|
630 |
foreach ($last_comments as $c) {
|
631 |
$comment_date_gmt = strtotime($c->comment_date_gmt);
|
632 |
if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
|
633 |
+
if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
|
634 |
// Force deletion old spam comments
|
635 |
wp_delete_comment($c->comment_ID, true);
|
636 |
}
|
723 |
'edd_action', // Easy Digital Downloads
|
724 |
);
|
725 |
|
726 |
+
if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
|
727 |
+
$contact = false;
|
|
|
|
|
728 |
|
729 |
if(count($arr)){
|
730 |
|
751 |
}
|
752 |
}
|
753 |
|
754 |
+
if(!is_array($value) && !is_object($value)){
|
755 |
|
756 |
if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
|
757 |
$contact = false;
|
785 |
// Names
|
786 |
}elseif (preg_match("/name/i", $key)){
|
787 |
|
788 |
+
preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
|
789 |
+
preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
|
790 |
+
preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
|
791 |
|
792 |
if(count($match_forename) > 1)
|
793 |
$nickname['first'] = $value;
|
796 |
elseif(count($match_nickname) > 1)
|
797 |
$nickname['nick'] = $value;
|
798 |
else
|
799 |
+
$nickname['name'] = $value;
|
800 |
+
|
801 |
// Subject
|
802 |
}elseif ($subject === null && preg_match("/subject/i", $key)){
|
803 |
$subject = $value;
|
807 |
$message[$prev_name.$key] = $value;
|
808 |
}
|
809 |
|
810 |
+
}elseif(!is_object($value)){
|
811 |
|
812 |
$prev_name_original = $prev_name;
|
813 |
$prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
|
888 |
return $message;
|
889 |
}
|
890 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
891 |
/**
|
892 |
+
* Checks if given string is valid regular expression
|
893 |
*
|
894 |
+
* @param string $regexp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
*
|
896 |
* @return bool
|
897 |
*/
|
898 |
+
function apbct_is_regexp($regexp){
|
899 |
+
return @preg_match('/' . $regexp . '/', null) !== false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
900 |
}
|
901 |
|
|
|
902 |
function cleantalk_debug($key,$value)
|
903 |
{
|
904 |
if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
|
inc/cleantalk-public.php
CHANGED
@@ -55,7 +55,7 @@ function apbct_init() {
|
|
55 |
if(!apbct_is_ajax()){
|
56 |
print "<html><body><form method='$method' action='$action'>";
|
57 |
ct_print_form($_POST, '');
|
58 |
-
print "</form
|
59 |
print "<script>
|
60 |
if(document.forms[0].submit !== 'undefined'){
|
61 |
var objects = document.getElementsByName('submit');
|
@@ -158,8 +158,8 @@ function apbct_init() {
|
|
158 |
}
|
159 |
|
160 |
// Formidable
|
161 |
-
add_filter( 'frm_entries_before_create', '
|
162 |
-
add_action( 'frm_entries_footer_scripts', '
|
163 |
|
164 |
// BuddyPress
|
165 |
if(class_exists('BuddyPress')){
|
@@ -231,7 +231,7 @@ function apbct_init() {
|
|
231 |
//Pirate forms
|
232 |
if(defined('PIRATE_FORMS_VERSION')){
|
233 |
if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
|
234 |
-
|
235 |
}
|
236 |
|
237 |
// WPForms
|
@@ -244,7 +244,12 @@ function apbct_init() {
|
|
244 |
|
245 |
// QForms integration
|
246 |
add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
|
247 |
-
|
|
|
|
|
|
|
|
|
|
|
248 |
|
249 |
//
|
250 |
// Load JS code to website footer
|
@@ -691,7 +696,7 @@ function apbct_forms__search__testSpam( $search ){
|
|
691 |
* Public function - Tests for Pirate contact froms
|
692 |
* return NULL
|
693 |
*/
|
694 |
-
function
|
695 |
|
696 |
global $apbct;
|
697 |
|
@@ -846,7 +851,8 @@ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false
|
|
846 |
* Public function - Insert JS code for spam tests
|
847 |
* return null;
|
848 |
*/
|
849 |
-
function
|
|
|
850 |
global $apbct, $ct_checkjs_frm;
|
851 |
|
852 |
if ( !$apbct->settings['contact_forms_test'])
|
@@ -882,7 +888,7 @@ function ct_frm_entries_footer_scripts($fields, $form) {
|
|
882 |
*
|
883 |
* @return array with errors if spam has found
|
884 |
*/
|
885 |
-
function
|
886 |
|
887 |
global $apbct;
|
888 |
|
@@ -1387,7 +1393,10 @@ function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
|
|
1387 |
$js_key = $data[$field_name];
|
1388 |
|
1389 |
// Check static key
|
1390 |
-
if(
|
|
|
|
|
|
|
1391 |
$ct_challenge = ct_get_checkjs_value();
|
1392 |
$out = preg_match("/$ct_challenge/", $js_key) ? 1 : 0;
|
1393 |
|
@@ -1680,7 +1689,12 @@ function ct_test_registration($nickname, $email, $ip){
|
|
1680 |
|
1681 |
/**
|
1682 |
* Test users registration
|
1683 |
-
*
|
|
|
|
|
|
|
|
|
|
|
1684 |
*/
|
1685 |
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1686 |
|
@@ -1694,11 +1708,9 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1694 |
if ($apbct->settings['registrations_test'] == 0) {
|
1695 |
return $errors;
|
1696 |
}
|
1697 |
-
|
1698 |
-
//
|
1699 |
// The function already executed
|
1700 |
-
// It happens when used ct_register_post();
|
1701 |
-
//
|
1702 |
if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
|
1703 |
return $errors;
|
1704 |
}
|
@@ -1734,20 +1746,29 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1734 |
return $errors;
|
1735 |
}
|
1736 |
|
1737 |
-
$checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
|
1738 |
-
$sender_info['post_checkjs_passed'] = $checkjs;
|
1739 |
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1745 |
$base_call_result = apbct_base_call(
|
1746 |
array(
|
1747 |
-
'sender_email'
|
1748 |
'sender_nickname' => $sanitized_user_login,
|
1749 |
-
'sender_info'
|
1750 |
-
'js_on'
|
1751 |
),
|
1752 |
true
|
1753 |
);
|
@@ -1832,6 +1853,54 @@ function apbct_registration__Wordpress__changeMailNotification($wp_new_user_noti
|
|
1832 |
|
1833 |
}
|
1834 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1835 |
/**
|
1836 |
* Checks registration error and set it if it was dropped
|
1837 |
* @return errors
|
@@ -2041,8 +2110,8 @@ function apbct_form__contactForm7__testSpam($param) {
|
|
2041 |
$param == false && WPCF7_VERSION < '3.0.0' ||
|
2042 |
$param === true && WPCF7_VERSION >= '3.0.0' ||
|
2043 |
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
|
2044 |
-
|
2045 |
-
|
2046 |
isset($apbct->cf7_checked)
|
2047 |
){
|
2048 |
return $param;
|
@@ -2160,7 +2229,7 @@ function apbct_form__ninjaForms__testSpam() {
|
|
2160 |
if(
|
2161 |
$apbct->settings['contact_forms_test'] == 0
|
2162 |
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
2163 |
-
||
|
2164 |
){
|
2165 |
return;
|
2166 |
}
|
@@ -2282,18 +2351,26 @@ function apbct_form__WPForms__addField($form_data, $some, $title, $description,
|
|
2282 |
|
2283 |
/**
|
2284 |
* Gather fields data from submission and store it
|
2285 |
-
*
|
2286 |
-
* @
|
2287 |
-
* @param
|
2288 |
-
*
|
2289 |
* @return array
|
|
|
2290 |
*/
|
2291 |
-
function apbct_from__WPForms__gatherData($entry, $
|
2292 |
|
2293 |
global $apbct;
|
2294 |
|
2295 |
-
$
|
2296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2297 |
return $entry;
|
2298 |
}
|
2299 |
|
@@ -2725,7 +2802,7 @@ function ct_contact_form_validate() {
|
|
2725 |
global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
|
2726 |
|
2727 |
// Exclusios common function
|
2728 |
-
if (
|
2729 |
return null;
|
2730 |
|
2731 |
if (@sizeof($_POST)==0 ||
|
@@ -2783,7 +2860,11 @@ function ct_contact_form_validate() {
|
|
2783 |
(strpos($_SERVER['REQUEST_URI'],'?profile_tab=postjobs')!==false ) || // Skip post vacancies
|
2784 |
(isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
|
2785 |
(isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
|
2786 |
-
isset($_POST['quform_submit']) //QForms multi-paged form skip
|
|
|
|
|
|
|
|
|
2787 |
) {
|
2788 |
return null;
|
2789 |
}
|
@@ -2855,7 +2936,7 @@ function ct_contact_form_validate() {
|
|
2855 |
foreach($_POST as $param => $value){
|
2856 |
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
2857 |
$contact_form = 'contact_form_divi_theme';
|
2858 |
-
$contact_form_additional = str_replace(
|
2859 |
}
|
2860 |
if(strpos($param, 'avia_generated_form') === 0){
|
2861 |
$contact_form = 'contact_form_enfold_theme';
|
@@ -2947,7 +3028,7 @@ function ct_contact_form_validate_postdata() {
|
|
2947 |
global $apbct, $pagenow,$cleantalk_executed;
|
2948 |
|
2949 |
// Exclusios common function
|
2950 |
-
if (
|
2951 |
return null;
|
2952 |
|
2953 |
if (@sizeof($_POST)==0 ||
|
55 |
if(!apbct_is_ajax()){
|
56 |
print "<html><body><form method='$method' action='$action'>";
|
57 |
ct_print_form($_POST, '');
|
58 |
+
print "</form></body></html>";
|
59 |
print "<script>
|
60 |
if(document.forms[0].submit !== 'undefined'){
|
61 |
var objects = document.getElementsByName('submit');
|
158 |
}
|
159 |
|
160 |
// Formidable
|
161 |
+
add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
|
162 |
+
add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
|
163 |
|
164 |
// BuddyPress
|
165 |
if(class_exists('BuddyPress')){
|
231 |
//Pirate forms
|
232 |
if(defined('PIRATE_FORMS_VERSION')){
|
233 |
if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
|
234 |
+
apbct_form__piratesForm__testSpam();
|
235 |
}
|
236 |
|
237 |
// WPForms
|
244 |
|
245 |
// QForms integration
|
246 |
add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
|
247 |
+
|
248 |
+
// Ultimate Members
|
249 |
+
if (class_exists('UM')) {
|
250 |
+
add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
|
251 |
+
add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
|
252 |
+
}
|
253 |
|
254 |
//
|
255 |
// Load JS code to website footer
|
696 |
* Public function - Tests for Pirate contact froms
|
697 |
* return NULL
|
698 |
*/
|
699 |
+
function apbct_form__piratesForm__testSpam(){
|
700 |
|
701 |
global $apbct;
|
702 |
|
851 |
* Public function - Insert JS code for spam tests
|
852 |
* return null;
|
853 |
*/
|
854 |
+
function apbct_rorm__formidable__footerScripts($fields, $form) {
|
855 |
+
|
856 |
global $apbct, $ct_checkjs_frm;
|
857 |
|
858 |
if ( !$apbct->settings['contact_forms_test'])
|
888 |
*
|
889 |
* @return array with errors if spam has found
|
890 |
*/
|
891 |
+
function apbct_rorm__formidable__testSpam ( $errors, $form ) {
|
892 |
|
893 |
global $apbct;
|
894 |
|
1393 |
$js_key = $data[$field_name];
|
1394 |
|
1395 |
// Check static key
|
1396 |
+
if(
|
1397 |
+
$apbct->settings['use_static_js_key'] === 1 ||
|
1398 |
+
($apbct->settings['use_static_js_key'] === -1 && apbct_is_cache_plugins_persist())
|
1399 |
+
){
|
1400 |
$ct_challenge = ct_get_checkjs_value();
|
1401 |
$out = preg_match("/$ct_challenge/", $js_key) ? 1 : 0;
|
1402 |
|
1689 |
|
1690 |
/**
|
1691 |
* Test users registration
|
1692 |
+
*
|
1693 |
+
* @param $errors
|
1694 |
+
* @param null $sanitized_user_login
|
1695 |
+
* @param null $user_email
|
1696 |
+
*
|
1697 |
+
* @return void with errors
|
1698 |
*/
|
1699 |
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1700 |
|
1708 |
if ($apbct->settings['registrations_test'] == 0) {
|
1709 |
return $errors;
|
1710 |
}
|
1711 |
+
|
|
|
1712 |
// The function already executed
|
1713 |
+
// It happens when used ct_register_post();
|
|
|
1714 |
if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
|
1715 |
return $errors;
|
1716 |
}
|
1746 |
return $errors;
|
1747 |
}
|
1748 |
|
|
|
|
|
1749 |
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
1750 |
+
$checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
|
1751 |
+
$checkjs_cookie = apbct_js_test($ct_checkjs_register_form, $_COOKIE);
|
1752 |
+
$checkjs = $checkjs_post || $checkjs_cookie;
|
1753 |
+
|
1754 |
+
|
1755 |
+
$sender_info = array(
|
1756 |
+
'post_checkjs_passed' => $checkjs_post,
|
1757 |
+
'cookie_checkjs_passed' => $checkjs_cookie,
|
1758 |
+
'form_validation' => ! empty( $errors )
|
1759 |
+
? json_encode( array(
|
1760 |
+
'validation_notice' => $errors->get_error_message(),
|
1761 |
+
'page_url' => filter_input( INPUT_SERVER, 'HTTP_HOST' ) . filter_input( INPUT_SERVER, 'REQUEST_URI' ),
|
1762 |
+
) )
|
1763 |
+
: null,
|
1764 |
+
);
|
1765 |
+
|
1766 |
$base_call_result = apbct_base_call(
|
1767 |
array(
|
1768 |
+
'sender_email' => $user_email,
|
1769 |
'sender_nickname' => $sanitized_user_login,
|
1770 |
+
'sender_info' => $sender_info,
|
1771 |
+
'js_on' => $checkjs,
|
1772 |
),
|
1773 |
true
|
1774 |
);
|
1853 |
|
1854 |
}
|
1855 |
|
1856 |
+
/**
|
1857 |
+
* Checks Ultimate Members registration for spam
|
1858 |
+
*
|
1859 |
+
* @param $args forms arguments with names and values
|
1860 |
+
*
|
1861 |
+
* @return mixed
|
1862 |
+
*
|
1863 |
+
*/
|
1864 |
+
function apbct_registration__UltimateMembers__check( $args ){
|
1865 |
+
|
1866 |
+
global $apbct, $cleantalk_executed;
|
1867 |
+
|
1868 |
+
if ($apbct->settings['registrations_test'] == 0)
|
1869 |
+
return $args;
|
1870 |
+
|
1871 |
+
$checkjs = apbct_js_test('ct_checkjs_register_form', $args);
|
1872 |
+
$sender_info['post_checkjs_passed'] = $checkjs;
|
1873 |
+
|
1874 |
+
// This hack can be helpfull when plugin uses with untested themes&signups plugins.
|
1875 |
+
if ($checkjs == 0) {
|
1876 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
|
1877 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
1878 |
+
}
|
1879 |
+
|
1880 |
+
$base_call_result = apbct_base_call(
|
1881 |
+
array(
|
1882 |
+
'sender_email' => $args['user_email'],
|
1883 |
+
'sender_nickname' => $args['user_login'],
|
1884 |
+
'sender_info' => $sender_info,
|
1885 |
+
'js_on' => $checkjs,
|
1886 |
+
),
|
1887 |
+
true
|
1888 |
+
);
|
1889 |
+
$ct_result = $base_call_result['ct_result'];
|
1890 |
+
|
1891 |
+
$cleantalk_executed = true;
|
1892 |
+
|
1893 |
+
if ($ct_result->inactive != 0) {
|
1894 |
+
ct_send_error_notice($ct_result->comment);
|
1895 |
+
return $args;
|
1896 |
+
}
|
1897 |
+
|
1898 |
+
if ($ct_result->allow == 0)
|
1899 |
+
UM()->form()->add_error('user_password', $ct_result->comment );
|
1900 |
+
|
1901 |
+
return $args;
|
1902 |
+
}
|
1903 |
+
|
1904 |
/**
|
1905 |
* Checks registration error and set it if it was dropped
|
1906 |
* @return errors
|
2110 |
$param == false && WPCF7_VERSION < '3.0.0' ||
|
2111 |
$param === true && WPCF7_VERSION >= '3.0.0' ||
|
2112 |
$apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
|
2113 |
+
apbct_exclusions_check__url() ||
|
2114 |
+
apbct_exclusions_check__ip() ||
|
2115 |
isset($apbct->cf7_checked)
|
2116 |
){
|
2117 |
return $param;
|
2229 |
if(
|
2230 |
$apbct->settings['contact_forms_test'] == 0
|
2231 |
|| ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
|
2232 |
+
|| apbct_exclusions_check__url()
|
2233 |
){
|
2234 |
return;
|
2235 |
}
|
2351 |
|
2352 |
/**
|
2353 |
* Gather fields data from submission and store it
|
2354 |
+
*
|
2355 |
+
* @param array $entry
|
2356 |
+
* @param $form
|
2357 |
+
*
|
2358 |
* @return array
|
2359 |
+
* @global SpbcState $apbct
|
2360 |
*/
|
2361 |
+
function apbct_from__WPForms__gatherData($entry, $form){
|
2362 |
|
2363 |
global $apbct;
|
2364 |
|
2365 |
+
$data = array();
|
2366 |
+
foreach($entry['fields'] as $key => $val){
|
2367 |
+
$true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
|
2368 |
+
$true_key = $true_key ? $true_key : $key;
|
2369 |
+
$data[$true_key] = $val;
|
2370 |
+
} unset($key, $val);
|
2371 |
+
|
2372 |
+
$apbct->form_data = $data;
|
2373 |
+
|
2374 |
return $entry;
|
2375 |
}
|
2376 |
|
2802 |
global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
|
2803 |
|
2804 |
// Exclusios common function
|
2805 |
+
if ( apbct_exclusions_check(__FUNCTION__) )
|
2806 |
return null;
|
2807 |
|
2808 |
if (@sizeof($_POST)==0 ||
|
2860 |
(strpos($_SERVER['REQUEST_URI'],'?profile_tab=postjobs')!==false ) || // Skip post vacancies
|
2861 |
(isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
|
2862 |
(isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
|
2863 |
+
isset($_POST['quform_submit']) || //QForms multi-paged form skip
|
2864 |
+
(isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
|
2865 |
+
isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
|
2866 |
+
(isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
|
2867 |
+
(isset($_POST['action']) && $_POST['action'] == 'wilcity_login') // Exception for login form. From Analysis uid=430898
|
2868 |
) {
|
2869 |
return null;
|
2870 |
}
|
2936 |
foreach($_POST as $param => $value){
|
2937 |
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
2938 |
$contact_form = 'contact_form_divi_theme';
|
2939 |
+
$contact_form_additional = str_replace($param, '', $param);
|
2940 |
}
|
2941 |
if(strpos($param, 'avia_generated_form') === 0){
|
2942 |
$contact_form = 'contact_form_enfold_theme';
|
3028 |
global $apbct, $pagenow,$cleantalk_executed;
|
3029 |
|
3030 |
// Exclusios common function
|
3031 |
+
if ( apbct_exclusions_check(__FUNCTION__) )
|
3032 |
return null;
|
3033 |
|
3034 |
if (@sizeof($_POST)==0 ||
|
inc/cleantalk-settings.php
CHANGED
@@ -3,54 +3,42 @@
|
|
3 |
/**
|
4 |
* Admin action 'admin_menu' - Add the admin options page
|
5 |
*/
|
6 |
-
function
|
7 |
-
|
8 |
-
global $apbct, $pagenow
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
add_menu_page($apbct->plugin_name, $apbct->plugin_name, 'activate_plugins', 'apbct_menu', '',
|
14 |
-
// 'dashicons-cf-logo1'
|
15 |
-
APBCT_URL_PATH . '/inc/images/logo_small.png' // Menu icon
|
16 |
-
, '65.64');
|
17 |
-
// Submenus
|
18 |
-
// add_submenu_page('apbct_menu', __('Summary', 'cleantalk'), __('Summary', 'cleantalk'), 'activate_plugins', 'apbct_menu', 'function');
|
19 |
-
// add_submenu_page('apbct_menu', __('Anti-Spam log', 'cleantalk'), __('Anti-Spam log', 'cleantalk'), 'activate_plugins', 'apbct_menu__log', 'function');
|
20 |
-
add_submenu_page('apbct_menu', __('Settings', 'cleantalk'), __('Settings', 'cleantalk'), 'activate_plugins', 'apbct_menu', 'apbct_settings_page');
|
21 |
-
}else{
|
22 |
-
*/
|
23 |
// Adding settings page
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
|
30 |
if(!in_array($pagenow, array('options.php', 'options-general.php', 'settings.php', 'admin.php')))
|
31 |
return;
|
32 |
|
33 |
register_setting('cleantalk_settings', 'cleantalk_settings', 'apbct_settings__validate');
|
34 |
-
|
35 |
-
// add_settings_section('cleantalk_section_settings_main', '', 'apbct_section__settings_main', 'cleantalk');
|
36 |
-
|
37 |
-
$field_default_params = array(
|
38 |
-
'callback' => 'apbct_settings__field__draw',
|
39 |
-
'type' => 'radio',
|
40 |
-
'def_class' => 'apbct_settings-field_wrapper',
|
41 |
-
'class' => '',
|
42 |
-
'parent' => '',
|
43 |
-
'childrens' => '',
|
44 |
-
'title' => 'Default title',
|
45 |
-
'description' => 'Default description',
|
46 |
-
'display' => true, // Draw settings or not
|
47 |
-
'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
|
48 |
-
);
|
49 |
|
50 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
'main' => array(
|
53 |
-
'title' => '',
|
54 |
'default_params' => array(),
|
55 |
'description' => '',
|
56 |
'html_before' => '',
|
@@ -59,17 +47,18 @@ function apbct_settings__add_page() {
|
|
59 |
'action_buttons' => array(
|
60 |
'callback' => 'apbct_settings__field__action_buttons',
|
61 |
),
|
62 |
-
'api_key' => array(
|
63 |
-
'callback' => 'apbct_settings__field__api_key',
|
64 |
-
),
|
65 |
'connection_reports' => array(
|
66 |
'callback' => 'apbct_settings__field__statistics',
|
67 |
),
|
|
|
|
|
|
|
|
|
68 |
),
|
69 |
),
|
70 |
|
71 |
'state' => array(
|
72 |
-
'title' => '',
|
73 |
'default_params' => array(),
|
74 |
'description' => '',
|
75 |
'html_before' => '<hr style="width: 100%;">',
|
@@ -82,7 +71,7 @@ function apbct_settings__add_page() {
|
|
82 |
),
|
83 |
|
84 |
'debug' => array(
|
85 |
-
'title' => '',
|
86 |
'default_params' => array(),
|
87 |
'description' => '',
|
88 |
'html_before' => '',
|
@@ -96,7 +85,7 @@ function apbct_settings__add_page() {
|
|
96 |
|
97 |
// Different
|
98 |
'different' => array(
|
99 |
-
'title' => '',
|
100 |
'default_params' => array(),
|
101 |
'description' => '',
|
102 |
'html_before' => '<hr>',
|
@@ -117,9 +106,9 @@ function apbct_settings__add_page() {
|
|
117 |
'description' => '',
|
118 |
'html_before' => '<hr><br>'
|
119 |
.'<span id="ct_adv_showhide">'
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
.'</span>'
|
124 |
.'<div id="apbct_settings__davanced_settings" style="display: none;">',
|
125 |
'html_after' => '',
|
@@ -154,11 +143,14 @@ function apbct_settings__add_page() {
|
|
154 |
),
|
155 |
'search_test' => array(
|
156 |
'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
|
157 |
-
'description' =>
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
162 |
),
|
163 |
'check_external' => array(
|
164 |
'title' => __('Protect external forms', 'cleantalk'),
|
@@ -192,7 +184,7 @@ function apbct_settings__add_page() {
|
|
192 |
),
|
193 |
'remove_old_spam' => array(
|
194 |
'title' => __('Automatically delete spam comments', 'cleantalk'),
|
195 |
-
'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->
|
196 |
),
|
197 |
'remove_comments_links' => array(
|
198 |
'title' => __('Remove links from approved comments', 'cleantalk'),
|
@@ -220,12 +212,17 @@ function apbct_settings__add_page() {
|
|
220 |
),
|
221 |
'use_static_js_key' => array(
|
222 |
'title' => __('Use static keys for JS check.', 'cleantalk'),
|
223 |
-
'description' => __('Could help if you have cache for AJAX requests and you are dealing with false positives. Slightly decreases protection quality.', 'cleantalk'),
|
|
|
|
|
|
|
|
|
|
|
224 |
),
|
225 |
'general_postdata_test' => array(
|
226 |
'title' => __('Check all post data', 'cleantalk'),
|
227 |
'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
|
228 |
-
.(!$apbct->white_label
|
229 |
? __(' 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>.'
|
230 |
: ''
|
231 |
)
|
@@ -248,7 +245,39 @@ function apbct_settings__add_page() {
|
|
248 |
),
|
249 |
'use_buitin_http_api' => array(
|
250 |
'title' => __("Use Wordpress HTTP API", 'cleantalk'),
|
251 |
-
'description' => __('Alternative way to connect the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
),
|
253 |
),
|
254 |
),
|
@@ -286,7 +315,7 @@ function apbct_settings__add_page() {
|
|
286 |
),
|
287 |
),
|
288 |
),
|
289 |
-
|
290 |
// Misc
|
291 |
'misc' => array(
|
292 |
'html_after' => '</div><br>',
|
@@ -339,18 +368,109 @@ function apbct_settings__add_page() {
|
|
339 |
'childrens' => array('comment_notify__roles'),
|
340 |
),
|
341 |
'comment_notify__roles' => array(
|
342 |
-
'
|
|
|
|
|
|
|
|
|
|
|
343 |
),
|
344 |
'complete_deactivation' => array(
|
345 |
'type' => 'checkbox',
|
346 |
'title' => __('Complete deactivation', 'cleantalk'),
|
347 |
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
348 |
),
|
349 |
-
|
350 |
),
|
351 |
),
|
352 |
);
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
356 |
|
@@ -358,7 +478,16 @@ function apbct_settings__add_page() {
|
|
358 |
|
359 |
foreach($group['fields'] as $field_name => $field){
|
360 |
|
361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
? array_merge($group['default_params'], $field)
|
363 |
: array_merge($field_default_params, $field);
|
364 |
|
@@ -377,18 +506,13 @@ function apbct_settings__add_page() {
|
|
377 |
);
|
378 |
|
379 |
}
|
380 |
-
|
381 |
}
|
382 |
-
|
383 |
-
// GDPR
|
384 |
-
// add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'apbct_secton_antispam');
|
385 |
-
// add_settings_field('cleantalk_connection_reports', __('Send connection reports', 'cleantalk'), 'ct_send_connection_reports', 'cleantalk', 'apbct_secton_antispam');
|
386 |
}
|
387 |
|
388 |
/**
|
389 |
* Admin callback function - Displays plugin options page
|
390 |
*/
|
391 |
-
function
|
392 |
|
393 |
global $apbct;
|
394 |
|
@@ -400,8 +524,7 @@ function apbct_settings_page() {
|
|
400 |
echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
|
401 |
|
402 |
echo '<form action="options.php" method="post">';
|
403 |
-
|
404 |
-
if(!is_network_admin())
|
405 |
apbct_settings__error__output();
|
406 |
|
407 |
// Top info
|
@@ -422,26 +545,11 @@ function apbct_settings_page() {
|
|
422 |
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 />';
|
423 |
apbct_admin__badge__get_premium();
|
424 |
echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
|
425 |
-
|
426 |
echo '</div>';
|
427 |
echo '</div>';
|
428 |
}
|
429 |
|
430 |
-
// If it's network admin dashboard
|
431 |
-
if(is_network_admin()){
|
432 |
-
if(defined('CLEANTALK_ACCESS_KEY')){
|
433 |
-
print '<br />'
|
434 |
-
.sprintf(__('Your CleanTalk access key is: <b>%s</b>.', 'cleantalk'), CLEANTALK_ACCESS_KEY)
|
435 |
-
.'<br />'
|
436 |
-
.'You can change it in your wp-config.php file.'
|
437 |
-
.'<br />';
|
438 |
-
}else{
|
439 |
-
print '<br />'
|
440 |
-
.__('To set up global CleanTalk access key for all websites, define constant in your wp-config.php file before defining database constants: <br/><pre>define("CLEANTALK_ACCESS_KEY", "place your key here");</pre>', 'cleantalk');
|
441 |
-
}
|
442 |
-
return;
|
443 |
-
}
|
444 |
-
|
445 |
// Output spam count
|
446 |
if($apbct->key_is_ok && apbct_api_key__is_correct()){
|
447 |
if($apbct->spam_count > 0){
|
@@ -500,6 +608,15 @@ function apbct_settings_page() {
|
|
500 |
}
|
501 |
}
|
502 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
function apbct_settings__error__output($return = false){
|
504 |
|
505 |
global $apbct;
|
@@ -520,6 +637,12 @@ function apbct_settings__error__output($return = false){
|
|
520 |
'sfw_update' => __('Error occured while updating SpamFireWall local base. Error: ' , 'security-malware-firewall'),
|
521 |
'account_check' => __('Error occured while checking account status. Error: ', 'security-malware-firewall'),
|
522 |
'api' => __('Error occured while excuting API call. Error: ', 'security-malware-firewall'),
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
// Unknown
|
524 |
'unknown' => __('Unknown error. Error: ', 'security-malware-firewall'),
|
525 |
);
|
@@ -536,8 +659,8 @@ function apbct_settings__error__output($return = false){
|
|
536 |
$errors_out[$sub_type] = '';
|
537 |
if(isset($sub_error['error_time']))
|
538 |
$errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
|
539 |
-
$errors_out[$sub_type] .= ucfirst($type).': ';
|
540 |
-
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . $sub_error['error'];
|
541 |
}
|
542 |
continue;
|
543 |
}
|
@@ -624,7 +747,7 @@ function apbct_settings__field__state(){
|
|
624 |
$color="black";
|
625 |
}
|
626 |
|
627 |
-
if($apbct->
|
628 |
$img = $path_to_img."no.png";
|
629 |
$img_no = $path_to_img."no.png";
|
630 |
$color="black";
|
@@ -638,11 +761,12 @@ function apbct_settings__field__state(){
|
|
638 |
echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
|
639 |
echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
|
640 |
echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
|
641 |
-
|
642 |
-
|
|
|
643 |
|
644 |
// Autoupdate status
|
645 |
-
if($apbct->notice_auto_update){
|
646 |
echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
|
647 |
.' <sup><a href="http://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
|
648 |
}
|
@@ -659,97 +783,93 @@ function apbct_settings__field__state(){
|
|
659 |
/**
|
660 |
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
661 |
*/
|
662 |
-
function
|
663 |
|
664 |
global $apbct;
|
665 |
|
666 |
-
echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper
|
667 |
-
|
668 |
-
// White label
|
669 |
-
if($apbct->white_label){
|
670 |
|
671 |
-
//
|
672 |
-
|
673 |
-
|
674 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
|
676 |
-
//
|
677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
|
679 |
-
|
680 |
-
|
681 |
-
.'</label>'
|
682 |
-
.'<input
|
683 |
-
type="text"
|
684 |
-
name="cleantalk_settings[apikey]"
|
685 |
-
value="'.$apbct->api_key.'"
|
686 |
-
class="apbct_font-size--14pt"
|
687 |
-
size="20"
|
688 |
-
placeholder="' . __('Enter the key', 'cleantalk') . '" />';
|
689 |
|
690 |
-
|
691 |
-
if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok) && isset($apbct->data['account_name_ob']) && $apbct->data['account_name_ob'] != ''){
|
692 |
-
echo '<br>'
|
693 |
-
.sprintf(
|
694 |
-
__('Account at cleantalk.org is %s.', 'cleantalk'),
|
695 |
-
'<b>'.$apbct->data['account_name_ob'].'</b>'
|
696 |
-
);
|
697 |
-
}
|
698 |
|
699 |
-
//
|
700 |
-
if(
|
701 |
-
echo '<
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
// .sprintf(__('Admin e-mail (%s) will be used to get access key if you want to use another email, click on Get Access Key Manually.', 'cleantalk'),
|
708 |
-
// ct_get_admin_email()
|
709 |
-
// )
|
710 |
-
// . '"'
|
711 |
-
. '>'
|
712 |
-
.__('Get Access Key Automatically', 'cleantalk')
|
713 |
-
.'</button>';
|
714 |
-
// .' '.__('or', 'cleantalk').' ';
|
715 |
-
echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
|
716 |
-
echo '<br />';
|
717 |
-
echo '<br />';
|
718 |
-
}
|
719 |
-
|
720 |
-
// Manual get key
|
721 |
-
// echo '<a class="apbct_color--gray" target="__blank" href="https://cleantalk.org/register?platform=wordpress&email='.urlencode(ct_get_admin_email()).'&website='.urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST)).'">'.__('Get access key manually', 'cleantalk').'</a>';
|
722 |
-
|
723 |
-
// Warnings and GDPR
|
724 |
-
printf(__('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
|
725 |
-
ct_get_admin_email(),
|
726 |
-
'<a href="https://cleantalk.org/register?platform=wordpress&website='. urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST)) .'">',
|
727 |
-
'</a>'
|
728 |
-
);
|
729 |
-
|
730 |
-
if(!$apbct->ip_license){
|
731 |
-
echo '<div>';
|
732 |
-
echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'get_key_auto\');"/>';
|
733 |
-
echo '<label for="spbc_license_agreed">';
|
734 |
-
printf(
|
735 |
-
__('I accept %sLicense Agreement%s.', 'security-malware-firewall'),
|
736 |
-
'<a href="https://cleantalk.org/publicoffer" target="_blank" style="color:#66b;">', '</a>'
|
737 |
-
);
|
738 |
-
echo "</label>";
|
739 |
-
echo '</div>';
|
740 |
-
}
|
741 |
}
|
742 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
}
|
744 |
|
745 |
echo '</div>';
|
746 |
-
|
747 |
-
if($apbct->ip_license){
|
748 |
-
// $cleantalk_support_links = "<br /><div>";
|
749 |
-
// $cleantalk_support_links .= "<a href='#' class='ct_support_link'>" . __("Show the access key", 'cleantalk') . "</a>";
|
750 |
-
// $cleantalk_support_links .= "</div>";
|
751 |
-
// echo "<script type=\"text/javascript\">var cleantalk_good_key=true; var cleantalk_support_links = \"$cleantalk_support_links\";</script>";
|
752 |
-
}
|
753 |
}
|
754 |
|
755 |
function apbct_settings__field__action_buttons(){
|
@@ -760,17 +880,13 @@ function apbct_settings__field__action_buttons(){
|
|
760 |
|
761 |
if(apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok){
|
762 |
echo '<div>'
|
763 |
-
.(!$apbct->white_label
|
764 |
-
?'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'#cleantalk_apikey_wrapper\')">' . __('Show the access key', 'cleantalk') . '</a>' . ' ' . ' '
|
765 |
-
: ''
|
766 |
-
)
|
767 |
.'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>'
|
768 |
.' '
|
769 |
.' '
|
770 |
.'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>'
|
771 |
.' '
|
772 |
.' '
|
773 |
-
.'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'
|
774 |
.'</div>';
|
775 |
|
776 |
}
|
@@ -870,50 +986,71 @@ function apbct_settings__field__statistics() {
|
|
870 |
echo '</div>';
|
871 |
}
|
872 |
|
873 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
874 |
|
875 |
-
global $
|
876 |
|
877 |
$wp_roles = new WP_Roles();
|
878 |
$roles = $wp_roles->get_names();
|
879 |
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
if($role == 'Subscriber') continue;
|
889 |
-
echo '<option'
|
890 |
-
.(in_array($role, $apbct->settings['comment_notify__roles']) ? ' selected="selected"' : '')
|
891 |
-
. '>'.$role.'</option>';
|
892 |
-
}
|
893 |
-
|
894 |
-
echo '</select>';
|
895 |
-
|
896 |
-
echo '</div>';
|
897 |
}
|
898 |
|
899 |
function apbct_settings__field__draw($params = array()){
|
900 |
|
901 |
global $apbct;
|
902 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
903 |
echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
|
904 |
|
905 |
switch($params['type']){
|
906 |
|
907 |
// Checkbox type
|
908 |
case 'checkbox':
|
909 |
-
echo '<input
|
910 |
-
|
911 |
-
|
912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
.' />'
|
914 |
-
|
915 |
-
|
916 |
-
|
|
|
|
|
|
|
917 |
echo '<div class="apbct_settings-field_description">'
|
918 |
.$params['description']
|
919 |
.'</div>';
|
@@ -921,15 +1058,22 @@ function apbct_settings__field__draw($params = array()){
|
|
921 |
|
922 |
// Radio type
|
923 |
case 'radio':
|
924 |
-
|
925 |
-
|
926 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
927 |
|
928 |
echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
|
929 |
|
930 |
$disabled = '';
|
931 |
|
932 |
-
// Disable child option if parent
|
933 |
if($params['reverse_trigger']){
|
934 |
if($params['parent'] && $apbct->settings[$params['parent']]){
|
935 |
$disabled = ' disabled="disabled"';
|
@@ -941,36 +1085,85 @@ function apbct_settings__field__draw($params = array()){
|
|
941 |
$disabled = ' disabled="disabled"';
|
942 |
}
|
943 |
}
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
|
|
|
|
|
|
|
|
|
|
962 |
|
963 |
echo '</div>';
|
964 |
break;
|
965 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
966 |
// Text type
|
967 |
case 'text':
|
968 |
|
969 |
-
echo '<input
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
.
|
|
|
|
|
|
|
|
|
974 |
.' />'
|
975 |
. ' '
|
976 |
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
@@ -1003,11 +1196,47 @@ function apbct_settings__validate($settings) {
|
|
1003 |
settype($settings[$setting], gettype($value));
|
1004 |
}
|
1005 |
} unset($setting, $value);
|
1006 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1007 |
// Validating API key
|
1008 |
-
$settings['apikey'] =
|
1009 |
-
$settings['apikey'] = defined('CLEANTALK_ACCESS_KEY')
|
1010 |
-
$settings['apikey'] = $apbct->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1011 |
|
1012 |
// Drop debug data
|
1013 |
if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
|
@@ -1031,8 +1260,8 @@ function apbct_settings__validate($settings) {
|
|
1031 |
$timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
|
1032 |
$language = filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE');
|
1033 |
$wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
|
1034 |
-
$white_label = $apbct->white_label
|
1035 |
-
$hoster_api_key = $apbct->
|
1036 |
|
1037 |
$result = CleantalkAPI::method__get_api_key(
|
1038 |
'antispam',
|
@@ -1058,11 +1287,14 @@ function apbct_settings__validate($settings) {
|
|
1058 |
}
|
1059 |
|
1060 |
}else{
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
$apbct->
|
1065 |
-
|
|
|
|
|
|
|
1066 |
}
|
1067 |
}
|
1068 |
|
@@ -1077,29 +1309,49 @@ function apbct_settings__validate($settings) {
|
|
1077 |
|
1078 |
// Is key valid?
|
1079 |
if($result){
|
1080 |
-
|
1081 |
// Deleting errors about invalid key
|
1082 |
$apbct->error_delete('key_invalid key_get', 'save');
|
1083 |
-
|
1084 |
// SFW actions
|
1085 |
if($apbct->settings['spam_firewall'] == 1){
|
1086 |
ct_sfw_update($settings['apikey']);
|
1087 |
ct_sfw_send_logs($settings['apikey']);
|
1088 |
}
|
1089 |
-
|
1090 |
// Updating brief data for dashboard widget
|
1091 |
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1092 |
-
|
1093 |
// Key is not valid
|
1094 |
}else{
|
1095 |
$apbct->data['key_is_ok'] = false;
|
1096 |
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
1097 |
}
|
1098 |
|
1099 |
-
//
|
1100 |
-
if(
|
1101 |
-
|
1102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
|
1104 |
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1105 |
|
@@ -1128,7 +1380,36 @@ function apbct_settings__validate($settings) {
|
|
1128 |
return $settings;
|
1129 |
}
|
1130 |
|
1131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1132 |
|
1133 |
$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.
|
1134 |
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.
|
@@ -1147,4 +1428,30 @@ function apbct_gdpr__show_text($print = false){
|
|
1147 |
.'</ul>';
|
1148 |
|
1149 |
if($print) echo $out; else return $out;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1150 |
}
|
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' => '',
|
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%;">',
|
71 |
),
|
72 |
|
73 |
'debug' => array(
|
74 |
+
'title' => '',
|
75 |
'default_params' => array(),
|
76 |
'description' => '',
|
77 |
'html_before' => '',
|
85 |
|
86 |
// Different
|
87 |
'different' => array(
|
88 |
+
'title' => '',
|
89 |
'default_params' => array(),
|
90 |
'description' => '',
|
91 |
'html_before' => '<hr>',
|
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' => '',
|
143 |
),
|
144 |
'search_test' => array(
|
145 |
'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
|
146 |
+
'description' => __('Spam protection for Search form.', 'cleantalk')
|
147 |
+
. (!$apbct->white_label || is_main_site()
|
148 |
+
? sprintf(__('Read more about %sspam protection for Search form%s on our blog.', 'cleantalk'),
|
149 |
+
'<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
|
150 |
+
'</a>'
|
151 |
+
)
|
152 |
+
: ''
|
153 |
+
)
|
154 |
),
|
155 |
'check_external' => array(
|
156 |
'title' => __('Protect external forms', 'cleantalk'),
|
184 |
),
|
185 |
'remove_old_spam' => array(
|
186 |
'title' => __('Automatically delete spam comments', 'cleantalk'),
|
187 |
+
'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
|
188 |
),
|
189 |
'remove_comments_links' => array(
|
190 |
'title' => __('Remove links from approved comments', 'cleantalk'),
|
212 |
),
|
213 |
'use_static_js_key' => array(
|
214 |
'title' => __('Use static keys for JS check.', 'cleantalk'),
|
215 |
+
'description' => __('Could help if you have cache for AJAX requests and you are dealing with false positives. Slightly decreases protection quality. Auto - Static key will be used if caching plugin is spotted.', 'cleantalk'),
|
216 |
+
'options' => array(
|
217 |
+
array('val' => 1, 'label' => __('On'), ),
|
218 |
+
array('val' => 0, 'label' => __('Off'), ),
|
219 |
+
array('val' => -1, 'label' => __('Auto'),),
|
220 |
+
),
|
221 |
),
|
222 |
'general_postdata_test' => array(
|
223 |
'title' => __('Check all post data', 'cleantalk'),
|
224 |
'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
|
225 |
+
.(!$apbct->white_label
|
226 |
? __(' Or you don`t have records about missed spam here:', 'cleantalk') . ' ' . '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">' . __('CleanTalk dashboard', 'cleantalk') . '</a>.'
|
227 |
: ''
|
228 |
)
|
245 |
),
|
246 |
'use_buitin_http_api' => array(
|
247 |
'title' => __("Use Wordpress HTTP API", 'cleantalk'),
|
248 |
+
'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
|
249 |
+
),
|
250 |
+
),
|
251 |
+
),
|
252 |
+
|
253 |
+
// Exclusions
|
254 |
+
'exclusions' => array(
|
255 |
+
'title' => __('Exclusions', 'cleantalk'),
|
256 |
+
'fields' => array(
|
257 |
+
'exclusions__urls' => array(
|
258 |
+
'type' => 'text',
|
259 |
+
'title' => __('URL exclusions', 'cleantalk'),
|
260 |
+
'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
|
261 |
+
),
|
262 |
+
'exclusions__urls__use_regexp' => array(
|
263 |
+
'type' => 'checkbox',
|
264 |
+
'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
|
265 |
+
),
|
266 |
+
'exclusions__fields' => array(
|
267 |
+
'type' => 'text',
|
268 |
+
'title' => __('Field name exclusions', 'cleantalk'),
|
269 |
+
'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
|
270 |
+
),
|
271 |
+
'exclusions__fields__use_regexp' => array(
|
272 |
+
'type' => 'checkbox',
|
273 |
+
'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
|
274 |
+
),
|
275 |
+
'exclusions__roles' => array(
|
276 |
+
'type' => 'select',
|
277 |
+
'multiple' => true,
|
278 |
+
'options_callback' => 'apbct_get_all_roles',
|
279 |
+
'options_callback_params' => array(true),
|
280 |
+
'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
|
281 |
),
|
282 |
),
|
283 |
),
|
315 |
),
|
316 |
),
|
317 |
),
|
318 |
+
|
319 |
// Misc
|
320 |
'misc' => array(
|
321 |
'html_after' => '</div><br>',
|
368 |
'childrens' => array('comment_notify__roles'),
|
369 |
),
|
370 |
'comment_notify__roles' => array(
|
371 |
+
'type' => 'select',
|
372 |
+
'multiple' => true,
|
373 |
+
'parent' => 'comment_notify',
|
374 |
+
'options_callback' => 'apbct_get_all_roles',
|
375 |
+
'options_callback_params' => array(true),
|
376 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
377 |
),
|
378 |
'complete_deactivation' => array(
|
379 |
'type' => 'checkbox',
|
380 |
'title' => __('Complete deactivation', 'cleantalk'),
|
381 |
'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
|
382 |
),
|
383 |
+
|
384 |
),
|
385 |
),
|
386 |
);
|
387 |
+
|
388 |
+
return $fields;
|
389 |
+
}
|
390 |
+
|
391 |
+
function apbct_settings__set_fileds__network( $fields ){
|
392 |
+
global $apbct;
|
393 |
+
$additional_fields = array(
|
394 |
+
'main' => array(
|
395 |
+
'fields' => array(
|
396 |
+
'white_label' => array(
|
397 |
+
'type' => 'checkbox',
|
398 |
+
'title' => __('Enable White Label Mode', 'cleantalk'),
|
399 |
+
'description' => sprintf(__("Some description here", 'cleantalk'), '<a href="options-discussion.php">', '</a>'),
|
400 |
+
'childrens' => array('white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key'),
|
401 |
+
'network' => true,
|
402 |
+
'long_description' => true,
|
403 |
+
),
|
404 |
+
'white_label__hoster_key' => array(
|
405 |
+
'title' => __('Hoster API Key', 'cleantalk'),
|
406 |
+
'description' => sprintf(__("Some description here", 'cleantalk'), '<a href="options-discussion.php">', '</a>'),
|
407 |
+
'type' => 'text',
|
408 |
+
'parent' => 'white_label',
|
409 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
410 |
+
'network' => true,
|
411 |
+
'required' => true,
|
412 |
+
),
|
413 |
+
'white_label__plugin_name' => array(
|
414 |
+
'title' => __('Plugin name', 'cleantalk'),
|
415 |
+
'description' => sprintf(__("Some description here", 'cleantalk'), '<a href="options-discussion.php">', '</a>'),
|
416 |
+
'type' => 'text',
|
417 |
+
'parent' => 'white_label',
|
418 |
+
'class' => 'apbct_settings-field_wrapper--sub',
|
419 |
+
'network' => true,
|
420 |
+
'required' => true,
|
421 |
+
),
|
422 |
+
'allow_custom_key' => array(
|
423 |
+
'type' => 'checkbox',
|
424 |
+
'title' => __('Allow users to use other key', 'cleantalk'),
|
425 |
+
'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
|
426 |
+
. (defined('CLEANTALK_ACCESS_KEY')
|
427 |
+
? ' <span style="color: red">'
|
428 |
+
. __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
|
429 |
+
. '</span>'
|
430 |
+
: ''
|
431 |
+
),
|
432 |
+
'display' => APBCT_WPMS && is_main_site(),
|
433 |
+
'disabled' => $apbct->network_settings['white_label'],
|
434 |
+
'network' => true,
|
435 |
+
),
|
436 |
+
)
|
437 |
+
)
|
438 |
+
);
|
439 |
+
|
440 |
+
$fields = array_merge_recursive($fields, $additional_fields);
|
441 |
+
|
442 |
+
return $fields;
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
function apbct_settings__add_groups_and_fields( $fields ){
|
447 |
+
|
448 |
+
global $apbct;
|
449 |
+
|
450 |
+
$apbct->settings_fields_in_groups = $fields;
|
451 |
+
|
452 |
+
$field_default_params = array(
|
453 |
+
'callback' => 'apbct_settings__field__draw',
|
454 |
+
'type' => 'radio',
|
455 |
+
'options' => array(
|
456 |
+
array('val' => 1, 'label' => __('On'),),
|
457 |
+
array('val' => 0, 'label' => __('Off'),),
|
458 |
+
),
|
459 |
+
'def_class' => 'apbct_settings-field_wrapper',
|
460 |
+
'class' => '',
|
461 |
+
'parent' => '',
|
462 |
+
'childrens' => array(),
|
463 |
+
'hide' => array(),
|
464 |
+
// 'title' => 'Default title',
|
465 |
+
// 'description' => 'Default description',
|
466 |
+
'display' => true, // Draw settings or not
|
467 |
+
'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
|
468 |
+
'multiple' => false,
|
469 |
+
'description' => '',
|
470 |
+
'network' => false,
|
471 |
+
'disabled' => false,
|
472 |
+
'required' => false,
|
473 |
+
);
|
474 |
|
475 |
foreach($apbct->settings_fields_in_groups as $group_name => $group){
|
476 |
|
478 |
|
479 |
foreach($group['fields'] as $field_name => $field){
|
480 |
|
481 |
+
// Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
|
482 |
+
if(!empty($field['options_callback'])){
|
483 |
+
$options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
|
484 |
+
foreach ($options as &$option){
|
485 |
+
$option = array('val' => $option, 'label' => $option);
|
486 |
+
} unset($option);
|
487 |
+
$field['options'] = $options;
|
488 |
+
}
|
489 |
+
|
490 |
+
$params = !empty($group['default_params'])
|
491 |
? array_merge($group['default_params'], $field)
|
492 |
: array_merge($field_default_params, $field);
|
493 |
|
506 |
);
|
507 |
|
508 |
}
|
|
|
509 |
}
|
|
|
|
|
|
|
|
|
510 |
}
|
511 |
|
512 |
/**
|
513 |
* Admin callback function - Displays plugin options page
|
514 |
*/
|
515 |
+
function apbct_settings__display() {
|
516 |
|
517 |
global $apbct;
|
518 |
|
524 |
echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
|
525 |
|
526 |
echo '<form action="options.php" method="post">';
|
527 |
+
|
|
|
528 |
apbct_settings__error__output();
|
529 |
|
530 |
// Top info
|
545 |
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 />';
|
546 |
apbct_admin__badge__get_premium();
|
547 |
echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
|
548 |
+
apbct_settings_show_gdpr_text('print');
|
549 |
echo '</div>';
|
550 |
echo '</div>';
|
551 |
}
|
552 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
// Output spam count
|
554 |
if($apbct->key_is_ok && apbct_api_key__is_correct()){
|
555 |
if($apbct->spam_count > 0){
|
608 |
}
|
609 |
}
|
610 |
|
611 |
+
function apbct_settings__display__network(){
|
612 |
+
// If it's network admin dashboard
|
613 |
+
if(is_network_admin()){
|
614 |
+
$link = get_site_option('siteurl').'wp-admin/options-general.php?page=cleantalk';
|
615 |
+
printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
|
616 |
+
return;
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
function apbct_settings__error__output($return = false){
|
621 |
|
622 |
global $apbct;
|
637 |
'sfw_update' => __('Error occured while updating SpamFireWall local base. Error: ' , 'security-malware-firewall'),
|
638 |
'account_check' => __('Error occured while checking account status. Error: ', 'security-malware-firewall'),
|
639 |
'api' => __('Error occured while excuting API call. Error: ', 'security-malware-firewall'),
|
640 |
+
|
641 |
+
// Validating settings
|
642 |
+
'settings_validate' => 'Validate Settings',
|
643 |
+
'exclusions_urls' => 'URL Exclusions',
|
644 |
+
'exclusions_fields' => 'Field Exclusions',
|
645 |
+
|
646 |
// Unknown
|
647 |
'unknown' => __('Unknown error. Error: ', 'security-malware-firewall'),
|
648 |
);
|
659 |
$errors_out[$sub_type] = '';
|
660 |
if(isset($sub_error['error_time']))
|
661 |
$errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
|
662 |
+
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
663 |
+
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
|
664 |
}
|
665 |
continue;
|
666 |
}
|
747 |
$color="black";
|
748 |
}
|
749 |
|
750 |
+
if($apbct->moderate == 0){
|
751 |
$img = $path_to_img."no.png";
|
752 |
$img_no = $path_to_img."no.png";
|
753 |
$color="black";
|
761 |
echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
|
762 |
echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
|
763 |
echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
|
764 |
+
if(!$apbct->white_label || is_main_site())
|
765 |
+
echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
|
766 |
+
.'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
|
767 |
|
768 |
// Autoupdate status
|
769 |
+
if($apbct->notice_auto_update && (!$apbct->white_label || is_main_site())){
|
770 |
echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
|
771 |
.' <sup><a href="http://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
|
772 |
}
|
783 |
/**
|
784 |
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
785 |
*/
|
786 |
+
function apbct_settings__field__apikey(){
|
787 |
|
788 |
global $apbct;
|
789 |
|
790 |
+
echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
|
|
|
|
|
|
|
791 |
|
792 |
+
// Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
|
793 |
+
if(APBCT_WPMS && !is_main_site() && (!$apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY'))){
|
794 |
+
_e('<h3>Key is provided by Super Admin.</h3>', 'cleantalk');
|
795 |
+
return;
|
796 |
+
}
|
797 |
+
|
798 |
+
echo '<label class="apbct_settings__label" for="cleantalk_apkey">' . __('Access key', 'cleantalk') . '</label>';
|
799 |
+
|
800 |
+
echo '<input
|
801 |
+
id="apbct_setting_apikey"
|
802 |
+
class="apbct_setting_text apbct_setting---apikey"
|
803 |
+
type="text"
|
804 |
+
name="cleantalk_settings[apikey]"
|
805 |
+
value="'
|
806 |
+
. ($apbct->key_is_ok
|
807 |
+
? str_repeat('*', strlen($apbct->api_key))
|
808 |
+
: $apbct->api_key
|
809 |
+
)
|
810 |
+
. '"
|
811 |
+
key="' . $apbct->api_key . '"
|
812 |
+
size="20"
|
813 |
+
placeholder="' . __('Enter the key', 'cleantalk') . '"'
|
814 |
+
. ' />';
|
815 |
|
816 |
+
// Show account name associated with key
|
817 |
+
if(!empty($apbct->data['account_name_ob'])){
|
818 |
+
echo '<div class="apbct_display--none">'
|
819 |
+
. sprintf( __('Account at cleantalk.org is %s.', 'cleantalk'),
|
820 |
+
'<b>'.$apbct->data['account_name_ob'].'</b>'
|
821 |
+
)
|
822 |
+
. '</div>';
|
823 |
+
};
|
824 |
+
|
825 |
+
// Show key button
|
826 |
+
if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok)){
|
827 |
+
echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
|
828 |
+
. __('Show the access key', 'cleantalk')
|
829 |
+
. '</a>';
|
830 |
|
831 |
+
// "Auto Get Key" buttons. License agreement
|
832 |
+
}else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
833 |
|
834 |
+
echo '<br /><br />';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
835 |
|
836 |
+
// Auto get key
|
837 |
+
if(!$apbct->ip_license){
|
838 |
+
echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" name="submit" type="submit" value="get_key_auto">'
|
839 |
+
.__('Get Access Key Automatically', 'cleantalk')
|
840 |
+
.'</button>';
|
841 |
+
echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
|
842 |
+
echo '<br />';
|
843 |
+
echo '<br />';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
}
|
845 |
|
846 |
+
// Warnings and GDPR
|
847 |
+
printf( __('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
|
848 |
+
ct_get_admin_email(),
|
849 |
+
'<a target="__blank" href="'
|
850 |
+
. sprintf( 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
|
851 |
+
urlencode(ct_get_admin_email()),
|
852 |
+
urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))
|
853 |
+
)
|
854 |
+
. '">',
|
855 |
+
'</a>'
|
856 |
+
);
|
857 |
+
|
858 |
+
// License agreement
|
859 |
+
if(!$apbct->ip_license){
|
860 |
+
echo '<div>';
|
861 |
+
echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
|
862 |
+
echo '<label for="spbc_license_agreed">';
|
863 |
+
printf( __('I accept %sLicense Agreement%s.', 'security-malware-firewall'),
|
864 |
+
'<a href="https://cleantalk.org/publicoffer" target="_blank" style="color:#66b;">',
|
865 |
+
'</a>'
|
866 |
+
);
|
867 |
+
echo "</label>";
|
868 |
+
echo '</div>';
|
869 |
+
}
|
870 |
}
|
871 |
|
872 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
873 |
}
|
874 |
|
875 |
function apbct_settings__field__action_buttons(){
|
880 |
|
881 |
if(apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok){
|
882 |
echo '<div>'
|
|
|
|
|
|
|
|
|
883 |
.'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>'
|
884 |
.' '
|
885 |
.' '
|
886 |
.'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>'
|
887 |
.' '
|
888 |
.' '
|
889 |
+
.'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_statistics\')">' . __('Statistics & Reports', 'cleantalk') . '</a>'
|
890 |
.'</div>';
|
891 |
|
892 |
}
|
986 |
echo '</div>';
|
987 |
}
|
988 |
|
989 |
+
/**
|
990 |
+
* Get all current Wordpress roles, could except 'subscriber' role
|
991 |
+
*
|
992 |
+
* @param bool $except_subscriber
|
993 |
+
*
|
994 |
+
* @return array
|
995 |
+
*/
|
996 |
+
function apbct_get_all_roles($except_subscriber = false) {
|
997 |
|
998 |
+
global $wp_roles;
|
999 |
|
1000 |
$wp_roles = new WP_Roles();
|
1001 |
$roles = $wp_roles->get_names();
|
1002 |
|
1003 |
+
if($except_subscriber) {
|
1004 |
+
$key = array_search( 'Subscriber', $roles );
|
1005 |
+
if ( $key !== false ) {
|
1006 |
+
unset( $roles[ $key ] );
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
return $roles;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1011 |
}
|
1012 |
|
1013 |
function apbct_settings__field__draw($params = array()){
|
1014 |
|
1015 |
global $apbct;
|
1016 |
|
1017 |
+
$value = $params['network'] ? $apbct->network_settings[$params['name']] : $apbct->settings[$params['name']];
|
1018 |
+
$value_parent = $params['parent']
|
1019 |
+
? ($params['network'] ? $apbct->network_settings[$params['parent']] : $apbct->settings[$params['parent']])
|
1020 |
+
: false;
|
1021 |
+
|
1022 |
+
$disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : '';
|
1023 |
+
$disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled;
|
1024 |
+
|
1025 |
+
$childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---",$params['childrens']) : '';
|
1026 |
+
$hide = $params['hide'] ? implode(",",$params['hide']) : '';
|
1027 |
+
|
1028 |
echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
|
1029 |
|
1030 |
switch($params['type']){
|
1031 |
|
1032 |
// Checkbox type
|
1033 |
case 'checkbox':
|
1034 |
+
echo '<input
|
1035 |
+
type="checkbox"
|
1036 |
+
name="cleantalk_settings['.$params['name'].']"
|
1037 |
+
id="apbct_setting_'.$params['name'].'"
|
1038 |
+
value="1" '
|
1039 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1040 |
+
.($value == '1' ? ' checked' : '')
|
1041 |
+
.$disabled
|
1042 |
+
.($params['required'] ? ' required="required"' : '')
|
1043 |
+
.' onchange="'
|
1044 |
+
. ($params['childrens'] ? ' apbctSettingsDependencies(\''. $childrens .'\');' : '')
|
1045 |
+
. ($params['hide'] ? ' apbct_show_hide_elem(\''. $hide . '\');' : '')
|
1046 |
+
. '"'
|
1047 |
.' />'
|
1048 |
+
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1049 |
+
.$params['title']
|
1050 |
+
.'</label>';
|
1051 |
+
echo isset($params['long_description'])
|
1052 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1053 |
+
: '';
|
1054 |
echo '<div class="apbct_settings-field_description">'
|
1055 |
.$params['description']
|
1056 |
.'</div>';
|
1058 |
|
1059 |
// Radio type
|
1060 |
case 'radio':
|
1061 |
+
|
1062 |
+
// Title
|
1063 |
+
echo isset($params['title'])
|
1064 |
+
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1065 |
+
: '';
|
1066 |
+
|
1067 |
+
// Popup description
|
1068 |
+
echo isset($params['long_description'])
|
1069 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1070 |
+
: '';
|
1071 |
|
1072 |
echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
|
1073 |
|
1074 |
$disabled = '';
|
1075 |
|
1076 |
+
// Disable child option if parent is ON
|
1077 |
if($params['reverse_trigger']){
|
1078 |
if($params['parent'] && $apbct->settings[$params['parent']]){
|
1079 |
$disabled = ' disabled="disabled"';
|
1085 |
$disabled = ' disabled="disabled"';
|
1086 |
}
|
1087 |
}
|
1088 |
+
|
1089 |
+
foreach($params['options'] as $option){
|
1090 |
+
echo '<input'
|
1091 |
+
.' type="radio"'
|
1092 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1093 |
+
." id='apbct_setting_{$params['name']}__{$option['label']}'"
|
1094 |
+
.' name="cleantalk_settings['.$params['name'].']"'
|
1095 |
+
.' value="'.$option['val'].'"'
|
1096 |
+
.($params['parent'] ? $disabled : '')
|
1097 |
+
.($params['childrens']
|
1098 |
+
? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"'
|
1099 |
+
: ''
|
1100 |
+
)
|
1101 |
+
.($value == $option['val'] ? ' checked' : '')
|
1102 |
+
.($params['required'] ? ' required="required"' : '')
|
1103 |
+
.' />';
|
1104 |
+
echo '<label for="apbct_setting_'.$params['name'].'__'.$option['label'].'"> ' . $option['label'] . '</label>';
|
1105 |
+
echo ' ';
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
echo isset($params['description'])
|
1109 |
+
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1110 |
+
: '';
|
1111 |
|
1112 |
echo '</div>';
|
1113 |
break;
|
1114 |
|
1115 |
+
// Dropdown list type
|
1116 |
+
case 'select':
|
1117 |
+
echo isset($params['title'])
|
1118 |
+
? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
|
1119 |
+
: '';
|
1120 |
+
echo isset($params['long_description'])
|
1121 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1122 |
+
: '';
|
1123 |
+
echo '<select'
|
1124 |
+
. ' id="apbct_setting_'.$params['name'].'"'
|
1125 |
+
. " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1126 |
+
. ' name="cleantalk_settings['.$params['name'].']'.($params['multiple'] ? '[]"' : '"')
|
1127 |
+
. ($params['multiple'] ? ' size="'. count($params['options']). '""' : '')
|
1128 |
+
. ($params['multiple'] ? ' multiple="multiple"' : '')
|
1129 |
+
. $disabled
|
1130 |
+
. ($params['required'] ? ' required="required"' : '')
|
1131 |
+
. ' >';
|
1132 |
+
|
1133 |
+
foreach($params['options'] as $option){
|
1134 |
+
echo '<option'
|
1135 |
+
. ' value="' . $option['val'] . '"'
|
1136 |
+
. ($params['multiple']
|
1137 |
+
? (in_array($option['val'], $value) ? ' selected="selected"' : '')
|
1138 |
+
: ($value == $option['val'] ? 'selected="selected"' : '')
|
1139 |
+
)
|
1140 |
+
.'>'
|
1141 |
+
. $option['label']
|
1142 |
+
. '</option>';
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
echo '</select>';
|
1146 |
+
echo isset($params['long_description'])
|
1147 |
+
? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
|
1148 |
+
: '';
|
1149 |
+
echo isset($params['description'])
|
1150 |
+
? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
|
1151 |
+
: '';
|
1152 |
+
|
1153 |
+
break;
|
1154 |
+
|
1155 |
// Text type
|
1156 |
case 'text':
|
1157 |
|
1158 |
+
echo '<input
|
1159 |
+
type="text"
|
1160 |
+
id="apbct_setting_'.$params['name'].'"
|
1161 |
+
name="cleantalk_settings['.$params['name'].']"'
|
1162 |
+
." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
|
1163 |
+
.' value="'. $value .'" '
|
1164 |
+
.$disabled
|
1165 |
+
.($params['required'] ? ' required="required"' : '')
|
1166 |
+
.($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
|
1167 |
.' />'
|
1168 |
. ' '
|
1169 |
.'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
|
1196 |
settype($settings[$setting], gettype($value));
|
1197 |
}
|
1198 |
} unset($setting, $value);
|
1199 |
+
|
1200 |
+
// Set missing settings.
|
1201 |
+
foreach($apbct->def_network_settings as $setting => $value){
|
1202 |
+
if(!isset($settings[$setting])){
|
1203 |
+
$settings[$setting] = null;
|
1204 |
+
settype($settings[$setting], gettype($value));
|
1205 |
+
}
|
1206 |
+
} unset($setting, $value);
|
1207 |
+
|
1208 |
// Validating API key
|
1209 |
+
$settings['apikey'] = !empty($settings['apikey']) ? trim($settings['apikey']) : '';
|
1210 |
+
$settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $settings['apikey'];
|
1211 |
+
$settings['apikey'] = is_main_site() || $apbct->allow_custom_key ? $settings['apikey'] : $apbct->network_settings['apikey'];
|
1212 |
+
$settings['apikey'] = is_main_site() || !$settings['white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
|
1213 |
+
$settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
|
1214 |
+
|
1215 |
+
// Validate Exclusions
|
1216 |
+
// URLs
|
1217 |
+
$result = apbct_settings__sanitize__exclusions($settings['exclusions__urls'], $settings['exclusions__urls__use_regexp']);
|
1218 |
+
$result === false
|
1219 |
+
? $apbct->error_add( 'exclusions_urls', 'is not valid: "' . $settings['exclusions__urls'] . '"', 'settings_validate' )
|
1220 |
+
: $apbct->error_delete( 'exclusions_urls', true, 'settings_validate' );
|
1221 |
+
$settings['exclusions__urls'] = $result ? $settings['exclusions__urls'] : '';
|
1222 |
+
|
1223 |
+
// Fields
|
1224 |
+
$result = apbct_settings__sanitize__exclusions($settings['exclusions__fields'], $settings['exclusions__fields__use_regexp']);
|
1225 |
+
$result === false
|
1226 |
+
? $apbct->error_add( 'exclusions_fields', 'is not valid: "' . $settings['exclusions__fields'] . '"', 'settings_validate' )
|
1227 |
+
: $apbct->error_delete( 'exclusions_fields', true, 'settings_validate' );
|
1228 |
+
$settings['exclusions__fields'] = $result ? $settings['exclusions__fields'] : '';
|
1229 |
+
|
1230 |
+
// WPMS Logic.
|
1231 |
+
if(APBCT_WPMS && is_main_site()){
|
1232 |
+
$network_settings = array(
|
1233 |
+
'allow_custom_key' => $settings['allow_custom_key'],
|
1234 |
+
'white_label' => $settings['white_label'],
|
1235 |
+
'white_label__hoster_key' => $settings['white_label__hoster_key'],
|
1236 |
+
'white_label__plugin_name' => $settings['white_label__plugin_name'],
|
1237 |
+
);
|
1238 |
+
unset( $settings['allow_custom_key'], $settings['white_label'], $settings['white_label__hoster_key'], $settings['white_label__plugin_name'] );
|
1239 |
+
}
|
1240 |
|
1241 |
// Drop debug data
|
1242 |
if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
|
1260 |
$timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
|
1261 |
$language = filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE');
|
1262 |
$wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
|
1263 |
+
$white_label = $apbct->network_settings['white_label'] ? 1 : 0;
|
1264 |
+
$hoster_api_key = $apbct->network_settings['white_label__hoster_key'] ? $apbct->network_settings['white_label__hoster_key'] : '';
|
1265 |
|
1266 |
$result = CleantalkAPI::method__get_api_key(
|
1267 |
'antispam',
|
1287 |
}
|
1288 |
|
1289 |
}else{
|
1290 |
+
$apbct->error_add(
|
1291 |
+
'key_get',
|
1292 |
+
$result
|
1293 |
+
. ($apbct->white_label
|
1294 |
+
? ' <button name="submit" type="submit" class="cleantalk_link cleantalk_link-manual" value="get_key_auto">'
|
1295 |
+
: ''
|
1296 |
+
)
|
1297 |
+
);
|
1298 |
}
|
1299 |
}
|
1300 |
|
1309 |
|
1310 |
// Is key valid?
|
1311 |
if($result){
|
1312 |
+
|
1313 |
// Deleting errors about invalid key
|
1314 |
$apbct->error_delete('key_invalid key_get', 'save');
|
1315 |
+
|
1316 |
// SFW actions
|
1317 |
if($apbct->settings['spam_firewall'] == 1){
|
1318 |
ct_sfw_update($settings['apikey']);
|
1319 |
ct_sfw_send_logs($settings['apikey']);
|
1320 |
}
|
1321 |
+
|
1322 |
// Updating brief data for dashboard widget
|
1323 |
$apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
|
1324 |
+
|
1325 |
// Key is not valid
|
1326 |
}else{
|
1327 |
$apbct->data['key_is_ok'] = false;
|
1328 |
$apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
|
1329 |
}
|
1330 |
|
1331 |
+
// WPMS Logic.
|
1332 |
+
if(APBCT_WPMS){
|
1333 |
+
if(is_main_site()){
|
1334 |
+
|
1335 |
+
// Network settings
|
1336 |
+
$network_settings['apikey'] = $settings['apikey'];
|
1337 |
+
$apbct->network_settings = $network_settings;
|
1338 |
+
$apbct->saveNetworkSettings();
|
1339 |
+
|
1340 |
+
// Network data
|
1341 |
+
$apbct->network_data = array(
|
1342 |
+
'key_is_ok' => $apbct->data['key_is_ok'],
|
1343 |
+
'moderate' => $apbct->data['moderate'],
|
1344 |
+
'valid' => $apbct->data['valid'],
|
1345 |
+
'auto_update' => $apbct->data['auto_update'],
|
1346 |
+
'user_token' => $apbct->data['user_token'],
|
1347 |
+
'service_id' => $apbct->data['service_id'],
|
1348 |
+
);
|
1349 |
+
$apbct->saveNetworkData();
|
1350 |
+
}
|
1351 |
+
if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
|
1352 |
+
$settings['apikey'] = '';
|
1353 |
+
}
|
1354 |
+
}
|
1355 |
|
1356 |
if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
|
1357 |
|
1380 |
return $settings;
|
1381 |
}
|
1382 |
|
1383 |
+
/**
|
1384 |
+
* Sanitize and validate exclusions.
|
1385 |
+
* Explode given string by commas and trim each string.
|
1386 |
+
* Skip element if it's empty.
|
1387 |
+
*
|
1388 |
+
* Return false if exclusion is bad
|
1389 |
+
* Return sanitized string if all is ok
|
1390 |
+
*
|
1391 |
+
* @param string $exclusions
|
1392 |
+
* @param bool $regexp
|
1393 |
+
*
|
1394 |
+
* @return bool|string
|
1395 |
+
*/
|
1396 |
+
function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
|
1397 |
+
$result = array();
|
1398 |
+
if( ! empty( $exclusions ) ){
|
1399 |
+
$exclusions = explode( ',', $exclusions );
|
1400 |
+
foreach ( $exclusions as $exclusion ){
|
1401 |
+
$sanitized_exclusion = trim( $exclusion );
|
1402 |
+
if ( ! empty( $sanitized_exclusion ) ) {
|
1403 |
+
if( $regexp && ! apbct_is_regexp( $exclusion ) )
|
1404 |
+
return false;
|
1405 |
+
$result[] = $sanitized_exclusion;
|
1406 |
+
}
|
1407 |
+
}
|
1408 |
+
}
|
1409 |
+
return implode( ',', $result );
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
function apbct_settings_show_gdpr_text($print = false){
|
1413 |
|
1414 |
$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.
|
1415 |
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.
|
1428 |
.'</ul>';
|
1429 |
|
1430 |
if($print) echo $out; else return $out;
|
1431 |
+
}
|
1432 |
+
|
1433 |
+
function apbct_settings__get__long_description(){
|
1434 |
+
|
1435 |
+
global $apbct;
|
1436 |
+
|
1437 |
+
check_ajax_referer('ct_secret_nonce' );
|
1438 |
+
|
1439 |
+
$setting_id = $_POST['setting_id'] ? $_POST['setting_id'] : '';
|
1440 |
+
|
1441 |
+
$descriptions = array(
|
1442 |
+
'white_label' => array(
|
1443 |
+
'title' => __( 'XSS check', 'cleantalk' ),
|
1444 |
+
'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' ),
|
1445 |
+
),
|
1446 |
+
'white_label__hoster_key' => array(
|
1447 |
+
'title' => __( 'SQL-injection check', 'cleantalk' ),
|
1448 |
+
'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' ),
|
1449 |
+
),
|
1450 |
+
'white_label__plugin_name' => array(
|
1451 |
+
'title' => __( 'Check uploaded files', 'cleantalk' ),
|
1452 |
+
'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' ),
|
1453 |
+
),
|
1454 |
+
);
|
1455 |
+
|
1456 |
+
die(json_encode($descriptions[$setting_id]));
|
1457 |
}
|
inc/cleantalk-updater.php
CHANGED
@@ -1,299 +1,374 @@
|
|
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 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
CHANGE `
|
75 |
-
CHANGE `
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
delete_option('
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
wp_clear_scheduled_hook('
|
86 |
-
wp_clear_scheduled_hook('
|
87 |
-
wp_clear_scheduled_hook('
|
88 |
-
wp_clear_scheduled_hook('
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
CleantalkCron::addTask('
|
93 |
-
CleantalkCron::addTask('
|
94 |
-
CleantalkCron::addTask('
|
95 |
-
CleantalkCron::addTask('
|
96 |
-
CleantalkCron::addTask('
|
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 |
-
`mask`
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
`
|
127 |
-
`
|
128 |
-
`
|
129 |
-
`
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
$
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
//
|
140 |
-
CleantalkCron::addTask('
|
141 |
-
CleantalkCron::addTask('
|
142 |
-
CleantalkCron::addTask('
|
143 |
-
CleantalkCron::addTask('
|
144 |
-
CleantalkCron::addTask('
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$apbct->
|
168 |
-
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
`
|
173 |
-
`
|
174 |
-
`
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
`
|
187 |
-
`name`
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
`id`
|
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 |
-
`
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
$initial_blog
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
);
|
281 |
-
}
|
282 |
-
|
283 |
-
function
|
284 |
-
global $apbct;
|
285 |
-
//
|
286 |
-
$apbct->
|
287 |
-
$apbct->
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
global $apbct;
|
294 |
-
|
295 |
-
|
296 |
-
$
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
}
|
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 |
}
|
inc/cleantalk-users.php
CHANGED
@@ -1,687 +1,687 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
add_action('admin_menu', 'ct_add_users_menu');
|
4 |
-
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
5 |
-
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
6 |
-
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
7 |
-
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
8 |
-
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
9 |
-
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
10 |
-
add_action( 'wp_ajax_ajax_ct_approve_user', 'ct_usercheck_approve_user' );
|
11 |
-
add_action( 'wp_ajax_ajax_ct_get_csv_file', 'ct_usercheck_get_csv_file' );
|
12 |
-
|
13 |
-
function ct_add_users_menu(){
|
14 |
-
if(current_user_can('activate_plugins'))
|
15 |
-
add_users_page( __("Check for spam", 'cleantalk'), __("Find spam users", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
16 |
-
}
|
17 |
-
|
18 |
-
function ct_show_users_page(){
|
19 |
-
|
20 |
-
global $wpdb, $apbct;
|
21 |
-
|
22 |
-
?>
|
23 |
-
<div class="wrap">
|
24 |
-
<h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
|
25 |
-
<a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
|
26 |
-
<br />
|
27 |
-
<?php
|
28 |
-
|
29 |
-
// If access key is unset in
|
30 |
-
if(!apbct_api_key__is_correct()){
|
31 |
-
if($apbct->moderate_ip == 1){
|
32 |
-
echo '<h3>'
|
33 |
-
.sprintf(
|
34 |
-
__('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
|
35 |
-
'<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
|
36 |
-
'</a>'
|
37 |
-
)
|
38 |
-
.'</h3>';
|
39 |
-
return;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
// Getting total spam users
|
45 |
-
$r = $wpdb->get_results("
|
46 |
-
SELECT
|
47 |
-
DISTINCT COUNT($wpdb->users.ID) AS cnt
|
48 |
-
FROM $wpdb->users
|
49 |
-
INNER JOIN $wpdb->usermeta
|
50 |
-
ON $wpdb->users.ID = $wpdb->usermeta.user_id
|
51 |
-
WHERE $wpdb->usermeta.meta_key='ct_marked_as_spam';"
|
52 |
-
, ARRAY_A);
|
53 |
-
$cnt_spam1=$r[0]['cnt'];
|
54 |
-
|
55 |
-
?>
|
56 |
-
|
57 |
-
<!-- AJAX error message -->
|
58 |
-
<div id="ct_error_message" style="display:none">
|
59 |
-
<h3>
|
60 |
-
<?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
|
61 |
-
</h3>
|
62 |
-
<h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
|
63 |
-
</div>
|
64 |
-
|
65 |
-
<!-- Deleting message -->
|
66 |
-
<div id="ct_deleting_message" style="display:none">
|
67 |
-
<?php _e("Please wait for a while. CleanTalk is deleting spam users. Users left: ", 'cleantalk'); ?> <span id="cleantalk_users_left">
|
68 |
-
<?php echo $cnt_spam1;?>
|
69 |
-
</span>
|
70 |
-
</div>
|
71 |
-
|
72 |
-
<!-- Main info -->
|
73 |
-
<h3 id="ct_checking_status"><?php echo ct_ajax_info_users(true); ?></h3>
|
74 |
-
|
75 |
-
<!-- Check options -->
|
76 |
-
<div class="ct_to_hide" id="ct_check_params_wrapper">
|
77 |
-
<button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
|
78 |
-
<?php if(!empty($_COOKIE['ct_paused_users_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
|
79 |
-
<p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
|
80 |
-
<br />
|
81 |
-
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
82 |
-
<input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
|
83 |
-
</div>
|
84 |
-
<p class="ct_check_params_desc"><?php _e("Allows to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
|
85 |
-
<br />
|
86 |
-
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
87 |
-
<input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
|
88 |
-
</div>
|
89 |
-
<div class="ct_check_params_desc">
|
90 |
-
<input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
|
91 |
-
<input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
|
92 |
-
</div>
|
93 |
-
<br>
|
94 |
-
<?php apbct_admin__badge__get_premium(); ?>
|
95 |
-
</div>
|
96 |
-
|
97 |
-
<!-- Cooling notice -->
|
98 |
-
<h3 id="ct_cooling_notice"></h3>
|
99 |
-
|
100 |
-
<!-- Preloader and working message -->
|
101 |
-
<div id="ct_preloader">
|
102 |
-
<img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
|
103 |
-
</div>
|
104 |
-
<div id="ct_working_message">
|
105 |
-
<?php _e("Please wait for a while. CleanTalk is checking all users via blacklist database at cleantalk.org. You will have option to delete found spam users after plugin finish.", 'cleantalk'); ?>
|
106 |
-
</div>
|
107 |
-
|
108 |
-
<!-- Pause button -->
|
109 |
-
<button class="button" id="ct_pause">Pause check</button>
|
110 |
-
|
111 |
-
<?php
|
112 |
-
|
113 |
-
// Pagination
|
114 |
-
$page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
|
115 |
-
$on_page = 20;
|
116 |
-
|
117 |
-
$args_spam = array(
|
118 |
-
'meta_query' => array(
|
119 |
-
Array(
|
120 |
-
'key' => 'ct_marked_as_spam',
|
121 |
-
'value' => '1',
|
122 |
-
'compare' => 'NUMERIC'
|
123 |
-
)
|
124 |
-
),
|
125 |
-
'number'=>$on_page,
|
126 |
-
'offset'=>($page-1)*$on_page
|
127 |
-
);
|
128 |
-
|
129 |
-
$c_spam=get_users($args_spam);
|
130 |
-
if($cnt_spam1 > 0){
|
131 |
-
|
132 |
-
$pages = ceil(intval($cnt_spam1)/$on_page);
|
133 |
-
if($pages && $pages != 1){
|
134 |
-
echo "<div class='ct_to_hide pagination'>"
|
135 |
-
."<b>Pages:</b>"
|
136 |
-
."<ul class='pagination'>";
|
137 |
-
for($i = 1; $i <= $pages; $i++){
|
138 |
-
echo "<li class='pagination'>"
|
139 |
-
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
140 |
-
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
141 |
-
."</a>"
|
142 |
-
."</li>";
|
143 |
-
}
|
144 |
-
echo "</ul>";
|
145 |
-
echo "</div>";
|
146 |
-
}
|
147 |
-
?>
|
148 |
-
<table class="ct_to_hide widefat fixed comments" id="ct_check_users_table">
|
149 |
-
<thead>
|
150 |
-
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
151 |
-
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
152 |
-
<input id="cb-select-all-1" type="checkbox"/>
|
153 |
-
</th>
|
154 |
-
<th scope="col" id="author" class="manage-column column-slug"><?php _e('Username');?></th>
|
155 |
-
<th scope="col" id="comment" class="manage-column column-comment"><?php _e('Name');?></th>
|
156 |
-
<th scope="col" id="response" class="manage-column column-comment"><?php _e('E-mail');?></th>
|
157 |
-
<th scope="col" id="signed_up" class="manage-column column-comment"><?php _e('Signed up');?></th>
|
158 |
-
<th scope="col" id="role" class="manage-column column-response sortable desc"><?php _e('Role');?></th>
|
159 |
-
<th scope="col" id="posts" class="manage-column column-response sortable desc"><?php _e('Posts');?></th>
|
160 |
-
</thead>
|
161 |
-
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
162 |
-
<?php
|
163 |
-
for($i=0;$i<sizeof($c_spam);$i++){
|
164 |
-
$id = $c_spam[$i]->ID;
|
165 |
-
$login = $c_spam[$i]->data->user_login;
|
166 |
-
$email = $c_spam[$i]->data->user_email;
|
167 |
-
$signed = substr($c_spam[$i]->data->user_registered, 0, -3);
|
168 |
-
|
169 |
-
echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_user' data-id='$id'>"
|
170 |
-
."<th scope='row' class='check-column'>"
|
171 |
-
."<label class='screen-reader-text' for='cb-select-$id'>Select user</label>"
|
172 |
-
."<input id='cb-select-$id' type='checkbox' name='del_comments[]' />"
|
173 |
-
."</th>"
|
174 |
-
."<td class='author column-author' nowrap>"
|
175 |
-
."<strong>"
|
176 |
-
.get_avatar( $c_spam[$i]->data->ID , 32)
|
177 |
-
.$login
|
178 |
-
."</strong>"
|
179 |
-
."<br/>"
|
180 |
-
."<br/>";
|
181 |
-
|
182 |
-
// Outputs email if exists
|
183 |
-
if(!empty($email)){
|
184 |
-
echo "<a href='mailto:$email'>$email</a>"
|
185 |
-
.(!$apbct->white_label
|
186 |
-
? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
|
187 |
-
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
188 |
-
."</a>"
|
189 |
-
: '');
|
190 |
-
}else{
|
191 |
-
echo "No email";
|
192 |
-
}
|
193 |
-
echo "<br/>";
|
194 |
-
|
195 |
-
// Outputs IP if exists
|
196 |
-
$user_meta = get_user_meta($id, 'session_tokens', true);
|
197 |
-
if(!empty($user_meta) && is_array($user_meta)){
|
198 |
-
$user_meta=array_values($user_meta);
|
199 |
-
if(!empty($user_meta[0]['ip'])){
|
200 |
-
$ip = $user_meta[0]['ip'];
|
201 |
-
echo "<a href='user-edit.php?user_id=$id'>$ip</a>"
|
202 |
-
.(!$apbct->white_label
|
203 |
-
?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
|
204 |
-
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
205 |
-
."</a>"
|
206 |
-
: '');
|
207 |
-
}else
|
208 |
-
echo "No IP adress";
|
209 |
-
}else
|
210 |
-
echo "No IP adress";
|
211 |
-
echo "</td>";
|
212 |
-
?>
|
213 |
-
<td class="comment column-comment">
|
214 |
-
<div class="submitted-on">
|
215 |
-
<?php print $c_spam[$i]->data->display_name; ?>
|
216 |
-
<div style="height:16px; display: none;" id="cleantalk_button_set_<?php print $id; ?>">
|
217 |
-
<a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
|
218 |
-
|
|
219 |
-
<a href="#" class="cleantalk_delete_user_button" id="cleantalk_delete_user_<?php print $id; ?>" data-id="<?php print $id; ?>" style="color:#a00;display:none;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
|
220 |
-
</div>
|
221 |
-
</div>
|
222 |
-
</td>
|
223 |
-
<td class="comment column-comment">
|
224 |
-
<?php print $email; ?>
|
225 |
-
</td>
|
226 |
-
<td class="comment column-comment">
|
227 |
-
<?php print $signed; ?>
|
228 |
-
</td>
|
229 |
-
<td class="comment column-comment">
|
230 |
-
<?php
|
231 |
-
$info=get_userdata( $id );
|
232 |
-
print implode(', ', $info->roles);
|
233 |
-
?>
|
234 |
-
</td>
|
235 |
-
<td class="comment column-comment">
|
236 |
-
<?php
|
237 |
-
print count_user_posts($id);
|
238 |
-
?>
|
239 |
-
</td>
|
240 |
-
</tr>
|
241 |
-
<?php
|
242 |
-
}
|
243 |
-
?>
|
244 |
-
</tbody>
|
245 |
-
</table>
|
246 |
-
<?php
|
247 |
-
// Pagination
|
248 |
-
if($pages && $pages != 1){
|
249 |
-
echo "<div class='ct_to_hide pagination'>"
|
250 |
-
."<b>Pages:</b>"
|
251 |
-
."<ul class='pagination'>";
|
252 |
-
for($i = 1; $i <= $pages; $i++){
|
253 |
-
echo "<li class='pagination'>"
|
254 |
-
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
255 |
-
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
256 |
-
."</a>"
|
257 |
-
."</li>";
|
258 |
-
}
|
259 |
-
echo "</ul>";
|
260 |
-
echo "</div>";
|
261 |
-
}
|
262 |
-
?>
|
263 |
-
<div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
|
264 |
-
<button class="button" id="ct_delete_all_users"><?php _e('Delete all users from list', 'cleantalk'); ?></button>
|
265 |
-
<button class="button" id="ct_delete_checked_users"><?php _e('Delete selected', 'cleantalk'); ?></button>
|
266 |
-
<button class="button" id="ct_get_csv_file"><?php _e('Download results in CSV', 'cleantalk'); ?></button>
|
267 |
-
</div>
|
268 |
-
<?php
|
269 |
-
}
|
270 |
-
echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class=" ct_to_hide button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). ' (100)</button> ' : '';
|
271 |
-
echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="ct_to_hide button" id="ct_delete_users">'. __('Delete accounts', 'cleantalk'). ' (110)</button><br />' : '';
|
272 |
-
|
273 |
-
if($cnt_spam1 > 0){
|
274 |
-
echo "<div id='ct_search_info'>"
|
275 |
-
."<br />"
|
276 |
-
.__("There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.", 'cleantalk')
|
277 |
-
."</div>";
|
278 |
-
}
|
279 |
-
?>
|
280 |
-
<div>
|
281 |
-
<button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
|
282 |
-
</div>
|
283 |
-
<div id='ct_csv_wrapper' style="display: none;"></div>
|
284 |
-
</div>
|
285 |
-
<?php
|
286 |
-
}
|
287 |
-
|
288 |
-
function ct_ajax_check_users(){
|
289 |
-
|
290 |
-
check_ajax_referer('ct_secret_nonce', 'security');
|
291 |
-
|
292 |
-
global $apbct;
|
293 |
-
|
294 |
-
$skip_roles = array(
|
295 |
-
'administrator'
|
296 |
-
);
|
297 |
-
|
298 |
-
$params = array(
|
299 |
-
// 'fields' => array(
|
300 |
-
// 'ID',
|
301 |
-
// 'user_login',
|
302 |
-
// 'user_email',
|
303 |
-
// 'user_registered',
|
304 |
-
// ),
|
305 |
-
'meta_query' => array(
|
306 |
-
'relation' => 'AND',
|
307 |
-
array(
|
308 |
-
'key' => 'ct_checked',
|
309 |
-
'compare' => 'NOT EXISTS'
|
310 |
-
),
|
311 |
-
array(
|
312 |
-
'key' => 'ct_bad',
|
313 |
-
'compare' => 'NOT EXISTS'
|
314 |
-
),
|
315 |
-
),
|
316 |
-
'orderby' => 'registered',
|
317 |
-
'order' => 'ASC',
|
318 |
-
'number' => 100
|
319 |
-
);
|
320 |
-
|
321 |
-
if(isset($_POST['from'], $_POST['till'])){
|
322 |
-
|
323 |
-
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
324 |
-
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
325 |
-
|
326 |
-
$params['date_query'] = array(
|
327 |
-
'column' => 'user_registered',
|
328 |
-
'after' => $from_date,
|
329 |
-
'before' => $till_date,
|
330 |
-
'inclusive' => true,
|
331 |
-
);
|
332 |
-
}
|
333 |
-
|
334 |
-
$u = get_users( $params );
|
335 |
-
|
336 |
-
$check_result = array(
|
337 |
-
'end' => 0,
|
338 |
-
'checked' => 0,
|
339 |
-
'spam' => 0,
|
340 |
-
'bad' => 0,
|
341 |
-
'error' => 0
|
342 |
-
);
|
343 |
-
|
344 |
-
if(count($u) > 0){
|
345 |
-
|
346 |
-
if(!empty($_POST['accurate_check'])){
|
347 |
-
// Leaving users only with first comment's date. Unsetting others.
|
348 |
-
foreach($u as $user_index => $user){
|
349 |
-
|
350 |
-
if(!isset($curr_date))
|
351 |
-
$curr_date = (substr($user->data->user_registered, 0, 10) ? substr($user->data->user_registered, 0, 10) : '');
|
352 |
-
|
353 |
-
if(substr($user->data->user_registered, 0, 10) != $curr_date)
|
354 |
-
unset($u[$user_index]);
|
355 |
-
|
356 |
-
}
|
357 |
-
unset($user_index, $user);
|
358 |
-
}
|
359 |
-
|
360 |
-
// Checking comments IP/Email. Gathering $data for check.
|
361 |
-
$data=Array();
|
362 |
-
for($i=0; $i < count($u); $i++){
|
363 |
-
|
364 |
-
$user_meta = get_user_meta($u[$i]->ID, 'session_tokens', true);
|
365 |
-
if(is_array($user_meta))
|
366 |
-
$user_meta = array_values($user_meta);
|
367 |
-
|
368 |
-
$curr_ip = !empty($user_meta[0]['ip']) ? trim($user_meta[0]['ip']) : '';
|
369 |
-
$curr_email = !empty($u[$i]->data->user_email) ? trim($u[$i]->data->user_email) : '';
|
370 |
-
|
371 |
-
// Check for identity
|
372 |
-
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
373 |
-
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
374 |
-
|
375 |
-
if(empty($curr_ip) && empty($curr_email)){
|
376 |
-
$check_result['bad']++;
|
377 |
-
update_user_meta($u[$i]->ID,'ct_bad','1',true);
|
378 |
-
unset($u[$i]);
|
379 |
-
}else{
|
380 |
-
if(!empty($curr_ip))
|
381 |
-
$data[] = $curr_ip;
|
382 |
-
if(!empty($curr_email))
|
383 |
-
$data[] = $curr_email;
|
384 |
-
// Patch for empty IP/Email
|
385 |
-
$u[$i]->data->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
|
386 |
-
$u[$i]->data->user_email = empty($curr_email) ? 'none' : $curr_email;
|
387 |
-
}
|
388 |
-
}
|
389 |
-
|
390 |
-
// Recombining after checking and unsettting
|
391 |
-
$u = array_values($u);
|
392 |
-
|
393 |
-
// Drop if data empty and there's no users to check
|
394 |
-
if(count($data) == 0){
|
395 |
-
if($_POST['unchecked'] === 0)
|
396 |
-
$check_result['end'] = 1;
|
397 |
-
print json_encode($check_result);
|
398 |
-
die();
|
399 |
-
}
|
400 |
-
|
401 |
-
$result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
|
402 |
-
|
403 |
-
if(empty($result['error'])){
|
404 |
-
|
405 |
-
// Opening CSV file
|
406 |
-
$current_user = wp_get_current_user();
|
407 |
-
if(!is_dir(APBCT_DIR_PATH .'/check-results/'))
|
408 |
-
mkdir(APBCT_DIR_PATH .'/check-results');
|
409 |
-
$filename = APBCT_DIR_PATH ."/check-results/user_check_by_{$current_user->user_nicename}.csv";
|
410 |
-
$text = '';
|
411 |
-
|
412 |
-
if(isset($_POST['new_check']) && $_POST['new_check'] == 'true'){
|
413 |
-
$file_desc = fopen($filename, 'w');
|
414 |
-
$text .= 'login,email,ip'.PHP_EOL;
|
415 |
-
}else
|
416 |
-
$file_desc = fopen($filename, 'a+');
|
417 |
-
// End of Opening CSV
|
418 |
-
|
419 |
-
for($i=0;$i<sizeof($u);$i++){
|
420 |
-
|
421 |
-
$check_result['checked']++;
|
422 |
-
update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
|
423 |
-
|
424 |
-
// Do not display forbidden roles.
|
425 |
-
foreach ($skip_roles as $role) {
|
426 |
-
if (in_array($role, $u[$i]->roles)){
|
427 |
-
delete_user_meta($u[$i]->ID, 'ct_marked_as_spam');
|
428 |
-
continue 2;
|
429 |
-
}
|
430 |
-
}
|
431 |
-
|
432 |
-
$mark_spam_ip = false;
|
433 |
-
$mark_spam_email = false;
|
434 |
-
|
435 |
-
$uip = $u[$i]->data->user_ip;
|
436 |
-
$uim = $u[$i]->data->user_email;
|
437 |
-
|
438 |
-
if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
|
439 |
-
$mark_spam_ip = true;
|
440 |
-
|
441 |
-
if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
|
442 |
-
$mark_spam_email = true;
|
443 |
-
|
444 |
-
if ($mark_spam_ip || $mark_spam_email){
|
445 |
-
$check_result['spam']++;
|
446 |
-
update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
|
447 |
-
$text .= $u[$i]->user_login.',';
|
448 |
-
$text .= ($mark_spam_email ? $uim : '').',';
|
449 |
-
$text .= ($mark_spam_ip ? $uip : '').PHP_EOL;
|
450 |
-
}
|
451 |
-
|
452 |
-
}
|
453 |
-
if($file_desc){
|
454 |
-
fwrite($file_desc, $text);
|
455 |
-
fclose($file_desc);
|
456 |
-
}
|
457 |
-
print json_encode($check_result);
|
458 |
-
}else{
|
459 |
-
$check_result['error'] = 1;
|
460 |
-
$check_result['error_message'] = $result['error'];
|
461 |
-
echo json_encode($check_result);
|
462 |
-
}
|
463 |
-
}else{
|
464 |
-
$check_result['end'] = 1;
|
465 |
-
print json_encode($check_result);
|
466 |
-
}
|
467 |
-
die;
|
468 |
-
}
|
469 |
-
|
470 |
-
function ct_ajax_info_users($direct_call = false)
|
471 |
-
{
|
472 |
-
if (!$direct_call)
|
473 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
474 |
-
|
475 |
-
// Checking dates value
|
476 |
-
if(isset($_POST['from'], $_POST['till'])){
|
477 |
-
|
478 |
-
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
479 |
-
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
480 |
-
}
|
481 |
-
|
482 |
-
// Total users
|
483 |
-
$params = array(
|
484 |
-
'fields' => 'ID',
|
485 |
-
'count'=>true,
|
486 |
-
);
|
487 |
-
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
488 |
-
$tmp = new WP_User_Query($params);
|
489 |
-
$cnt = $tmp->get_total();
|
490 |
-
|
491 |
-
// Checked users
|
492 |
-
$params = array(
|
493 |
-
'fields' => 'ID',
|
494 |
-
'meta_key' => 'ct_checked',
|
495 |
-
'count_total' => true,
|
496 |
-
);
|
497 |
-
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
498 |
-
$tmp = new WP_User_Query($params);
|
499 |
-
$cnt_checked = $tmp->get_total();
|
500 |
-
|
501 |
-
// Spam users
|
502 |
-
$params = array(
|
503 |
-
'fields' => 'ID',
|
504 |
-
'meta_key' => 'ct_marked_as_spam',
|
505 |
-
'count_total' => true,
|
506 |
-
);
|
507 |
-
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
508 |
-
$tmp = new WP_User_Query($params);
|
509 |
-
$cnt_spam = $tmp->get_total();
|
510 |
-
|
511 |
-
// Bad users (without IP and Email)
|
512 |
-
$params = array(
|
513 |
-
'fields' => 'ID',
|
514 |
-
'meta_key' => 'ct_bad',
|
515 |
-
'count_total' => true,
|
516 |
-
);
|
517 |
-
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
518 |
-
$tmp = new WP_User_Query($params);
|
519 |
-
$cnt_bad = $tmp->get_total();
|
520 |
-
|
521 |
-
$return = array(
|
522 |
-
'message' => '',
|
523 |
-
'total' => $cnt,
|
524 |
-
'spam' => $cnt_spam,
|
525 |
-
'checked' => $cnt_checked,
|
526 |
-
'bad' => $cnt_bad,
|
527 |
-
);
|
528 |
-
|
529 |
-
$return['message'] .= sprintf (__("Total users %s, checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam, $cnt_bad);
|
530 |
-
|
531 |
-
$backup_notice = ' ';
|
532 |
-
if ($cnt_spam > 0) {
|
533 |
-
$backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
|
534 |
-
}
|
535 |
-
$return['message'] .= "<p>$backup_notice</p>";
|
536 |
-
|
537 |
-
if($direct_call){
|
538 |
-
return $return['message'];
|
539 |
-
}else{
|
540 |
-
echo json_encode($return);
|
541 |
-
die();
|
542 |
-
}
|
543 |
-
|
544 |
-
return null;
|
545 |
-
}
|
546 |
-
|
547 |
-
function ct_ajax_insert_users()
|
548 |
-
{
|
549 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
550 |
-
|
551 |
-
//* DELETION
|
552 |
-
if(!empty($_POST['delete'])){
|
553 |
-
$users = get_users(array('search' => '*user_*', 'search_columns' => array('login', 'nicename')));
|
554 |
-
$deleted = 0;
|
555 |
-
$amount_to_delete = 15;
|
556 |
-
foreach($users as $user){
|
557 |
-
if($deleted >= $amount_to_delete)
|
558 |
-
break;
|
559 |
-
if(wp_delete_user($user->ID))
|
560 |
-
$deleted++;
|
561 |
-
}
|
562 |
-
print "$deleted";
|
563 |
-
die();
|
564 |
-
}
|
565 |
-
//*/
|
566 |
-
|
567 |
-
//* INSERTION
|
568 |
-
global $wpdb;
|
569 |
-
$to_insert = 100;
|
570 |
-
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
571 |
-
|
572 |
-
if($result){
|
573 |
-
$ip = array();
|
574 |
-
foreach($result as $value){
|
575 |
-
$ips[] = long2ip($value['network']);
|
576 |
-
}
|
577 |
-
unset($value);
|
578 |
-
|
579 |
-
$inserted = 0;
|
580 |
-
for($i=0; $i<$to_insert; $i++){
|
581 |
-
$rnd=mt_rand(1,10000000);
|
582 |
-
|
583 |
-
$user_name = "user_$rnd";
|
584 |
-
$email="stop_email_$rnd@example.com";
|
585 |
-
|
586 |
-
$user_id = wp_create_user(
|
587 |
-
$user_name,
|
588 |
-
rand(),
|
589 |
-
$email
|
590 |
-
);
|
591 |
-
|
592 |
-
$curr_user = get_user_by('email', $email);
|
593 |
-
|
594 |
-
update_user_meta($curr_user->ID, 'session_tokens', array($rnd => array('ip' => $ips[$i])));
|
595 |
-
|
596 |
-
if (is_int($user_id))
|
597 |
-
$inserted++;
|
598 |
-
|
599 |
-
}
|
600 |
-
}else{
|
601 |
-
$inserted = '0';
|
602 |
-
}
|
603 |
-
//*/
|
604 |
-
|
605 |
-
print "$inserted";
|
606 |
-
die();
|
607 |
-
}
|
608 |
-
|
609 |
-
function ct_ajax_delete_checked_users()
|
610 |
-
{
|
611 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
612 |
-
foreach($_POST['ids'] as $key=>$value)
|
613 |
-
{
|
614 |
-
wp_delete_user($value);
|
615 |
-
}
|
616 |
-
die();
|
617 |
-
}
|
618 |
-
|
619 |
-
function ct_ajax_delete_all_users($count_all = 0)
|
620 |
-
{
|
621 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
622 |
-
|
623 |
-
global $wpdb;
|
624 |
-
|
625 |
-
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", OBJECT );
|
626 |
-
|
627 |
-
if(!empty($r)){
|
628 |
-
|
629 |
-
$count_all = $r ? $r[0]->cnt : 0;
|
630 |
-
|
631 |
-
$args = array(
|
632 |
-
'meta_key' => 'ct_marked_as_spam',
|
633 |
-
'meta_value' => '1',
|
634 |
-
'fields' => array('ID'),
|
635 |
-
'number' => 50
|
636 |
-
);
|
637 |
-
$users = get_users($args);
|
638 |
-
|
639 |
-
if ($users){
|
640 |
-
foreach($users as $user){
|
641 |
-
wp_delete_user($user->ID);
|
642 |
-
usleep(5000);
|
643 |
-
}
|
644 |
-
}
|
645 |
-
}
|
646 |
-
|
647 |
-
die($count_all);
|
648 |
-
}
|
649 |
-
|
650 |
-
function ct_ajax_clear_users()
|
651 |
-
{
|
652 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
653 |
-
global $wpdb;
|
654 |
-
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
|
655 |
-
die();
|
656 |
-
}
|
657 |
-
|
658 |
-
/**
|
659 |
-
* Admin action 'user_unapproved_to_approved' - Approve user, delete from the deleting list
|
660 |
-
*/
|
661 |
-
function ct_usercheck_approve_user() {
|
662 |
-
|
663 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
664 |
-
|
665 |
-
delete_metadata('user', $_POST['id'], 'ct_marked_as_spam');
|
666 |
-
|
667 |
-
die();
|
668 |
-
}
|
669 |
-
|
670 |
-
/**
|
671 |
-
* Admin action 'wp_ajax_ajax_ct_get_csv_file' - prints CSV file to AJAX
|
672 |
-
*/
|
673 |
-
function ct_usercheck_get_csv_file() {
|
674 |
-
|
675 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
676 |
-
|
677 |
-
$filename = !empty($_POST['filename']) ? $_POST['filename'] : false;
|
678 |
-
|
679 |
-
if($filename !== false && file_exists(WP_PLUGIN_DIR."/cleantalk-spam-protect/check-results/{$filename}.csv"))
|
680 |
-
$output = 1;
|
681 |
-
else
|
682 |
-
$output = 0;
|
683 |
-
|
684 |
-
echo $output;
|
685 |
-
|
686 |
-
die();
|
687 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action('admin_menu', 'ct_add_users_menu');
|
4 |
+
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
5 |
+
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
6 |
+
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
7 |
+
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
8 |
+
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
9 |
+
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
10 |
+
add_action( 'wp_ajax_ajax_ct_approve_user', 'ct_usercheck_approve_user' );
|
11 |
+
add_action( 'wp_ajax_ajax_ct_get_csv_file', 'ct_usercheck_get_csv_file' );
|
12 |
+
|
13 |
+
function ct_add_users_menu(){
|
14 |
+
if(current_user_can('activate_plugins'))
|
15 |
+
add_users_page( __("Check for spam", 'cleantalk'), __("Find spam users", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
16 |
+
}
|
17 |
+
|
18 |
+
function ct_show_users_page(){
|
19 |
+
|
20 |
+
global $wpdb, $apbct;
|
21 |
+
|
22 |
+
?>
|
23 |
+
<div class="wrap">
|
24 |
+
<h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
|
25 |
+
<a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
|
26 |
+
<br />
|
27 |
+
<?php
|
28 |
+
|
29 |
+
// If access key is unset in
|
30 |
+
if(!apbct_api_key__is_correct()){
|
31 |
+
if($apbct->moderate_ip == 1){
|
32 |
+
echo '<h3>'
|
33 |
+
.sprintf(
|
34 |
+
__('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
|
35 |
+
'<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
|
36 |
+
'</a>'
|
37 |
+
)
|
38 |
+
.'</h3>';
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
// Getting total spam users
|
45 |
+
$r = $wpdb->get_results("
|
46 |
+
SELECT
|
47 |
+
DISTINCT COUNT($wpdb->users.ID) AS cnt
|
48 |
+
FROM $wpdb->users
|
49 |
+
INNER JOIN $wpdb->usermeta
|
50 |
+
ON $wpdb->users.ID = $wpdb->usermeta.user_id
|
51 |
+
WHERE $wpdb->usermeta.meta_key='ct_marked_as_spam';"
|
52 |
+
, ARRAY_A);
|
53 |
+
$cnt_spam1=$r[0]['cnt'];
|
54 |
+
|
55 |
+
?>
|
56 |
+
|
57 |
+
<!-- AJAX error message -->
|
58 |
+
<div id="ct_error_message" style="display:none">
|
59 |
+
<h3>
|
60 |
+
<?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
|
61 |
+
</h3>
|
62 |
+
<h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<!-- Deleting message -->
|
66 |
+
<div id="ct_deleting_message" style="display:none">
|
67 |
+
<?php _e("Please wait for a while. CleanTalk is deleting spam users. Users left: ", 'cleantalk'); ?> <span id="cleantalk_users_left">
|
68 |
+
<?php echo $cnt_spam1;?>
|
69 |
+
</span>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<!-- Main info -->
|
73 |
+
<h3 id="ct_checking_status"><?php echo ct_ajax_info_users(true); ?></h3>
|
74 |
+
|
75 |
+
<!-- Check options -->
|
76 |
+
<div class="ct_to_hide" id="ct_check_params_wrapper">
|
77 |
+
<button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
|
78 |
+
<?php if(!empty($_COOKIE['ct_paused_users_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
|
79 |
+
<p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
|
80 |
+
<br />
|
81 |
+
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
82 |
+
<input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
|
83 |
+
</div>
|
84 |
+
<p class="ct_check_params_desc"><?php _e("Allows to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
|
85 |
+
<br />
|
86 |
+
<div class="ct_check_params_elem ct_check_params_elem_sub">
|
87 |
+
<input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
|
88 |
+
</div>
|
89 |
+
<div class="ct_check_params_desc">
|
90 |
+
<input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
|
91 |
+
<input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
|
92 |
+
</div>
|
93 |
+
<br>
|
94 |
+
<?php apbct_admin__badge__get_premium(); ?>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<!-- Cooling notice -->
|
98 |
+
<h3 id="ct_cooling_notice"></h3>
|
99 |
+
|
100 |
+
<!-- Preloader and working message -->
|
101 |
+
<div id="ct_preloader">
|
102 |
+
<img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
|
103 |
+
</div>
|
104 |
+
<div id="ct_working_message">
|
105 |
+
<?php _e("Please wait for a while. CleanTalk is checking all users via blacklist database at cleantalk.org. You will have option to delete found spam users after plugin finish.", 'cleantalk'); ?>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<!-- Pause button -->
|
109 |
+
<button class="button" id="ct_pause">Pause check</button>
|
110 |
+
|
111 |
+
<?php
|
112 |
+
|
113 |
+
// Pagination
|
114 |
+
$page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
|
115 |
+
$on_page = 20;
|
116 |
+
|
117 |
+
$args_spam = array(
|
118 |
+
'meta_query' => array(
|
119 |
+
Array(
|
120 |
+
'key' => 'ct_marked_as_spam',
|
121 |
+
'value' => '1',
|
122 |
+
'compare' => 'NUMERIC'
|
123 |
+
)
|
124 |
+
),
|
125 |
+
'number'=>$on_page,
|
126 |
+
'offset'=>($page-1)*$on_page
|
127 |
+
);
|
128 |
+
|
129 |
+
$c_spam=get_users($args_spam);
|
130 |
+
if($cnt_spam1 > 0){
|
131 |
+
|
132 |
+
$pages = ceil(intval($cnt_spam1)/$on_page);
|
133 |
+
if($pages && $pages != 1){
|
134 |
+
echo "<div class='ct_to_hide pagination'>"
|
135 |
+
."<b>Pages:</b>"
|
136 |
+
."<ul class='pagination'>";
|
137 |
+
for($i = 1; $i <= $pages; $i++){
|
138 |
+
echo "<li class='pagination'>"
|
139 |
+
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
140 |
+
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
141 |
+
."</a>"
|
142 |
+
."</li>";
|
143 |
+
}
|
144 |
+
echo "</ul>";
|
145 |
+
echo "</div>";
|
146 |
+
}
|
147 |
+
?>
|
148 |
+
<table class="ct_to_hide widefat fixed comments" id="ct_check_users_table">
|
149 |
+
<thead>
|
150 |
+
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
151 |
+
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
152 |
+
<input id="cb-select-all-1" type="checkbox"/>
|
153 |
+
</th>
|
154 |
+
<th scope="col" id="author" class="manage-column column-slug"><?php _e('Username');?></th>
|
155 |
+
<th scope="col" id="comment" class="manage-column column-comment"><?php _e('Name');?></th>
|
156 |
+
<th scope="col" id="response" class="manage-column column-comment"><?php _e('E-mail');?></th>
|
157 |
+
<th scope="col" id="signed_up" class="manage-column column-comment"><?php _e('Signed up');?></th>
|
158 |
+
<th scope="col" id="role" class="manage-column column-response sortable desc"><?php _e('Role');?></th>
|
159 |
+
<th scope="col" id="posts" class="manage-column column-response sortable desc"><?php _e('Posts');?></th>
|
160 |
+
</thead>
|
161 |
+
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
162 |
+
<?php
|
163 |
+
for($i=0;$i<sizeof($c_spam);$i++){
|
164 |
+
$id = $c_spam[$i]->ID;
|
165 |
+
$login = $c_spam[$i]->data->user_login;
|
166 |
+
$email = $c_spam[$i]->data->user_email;
|
167 |
+
$signed = substr($c_spam[$i]->data->user_registered, 0, -3);
|
168 |
+
|
169 |
+
echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_user' data-id='$id'>"
|
170 |
+
."<th scope='row' class='check-column'>"
|
171 |
+
."<label class='screen-reader-text' for='cb-select-$id'>Select user</label>"
|
172 |
+
."<input id='cb-select-$id' type='checkbox' name='del_comments[]' />"
|
173 |
+
."</th>"
|
174 |
+
."<td class='author column-author' nowrap>"
|
175 |
+
."<strong>"
|
176 |
+
.get_avatar( $c_spam[$i]->data->ID , 32)
|
177 |
+
.$login
|
178 |
+
."</strong>"
|
179 |
+
."<br/>"
|
180 |
+
."<br/>";
|
181 |
+
|
182 |
+
// Outputs email if exists
|
183 |
+
if(!empty($email)){
|
184 |
+
echo "<a href='mailto:$email'>$email</a>"
|
185 |
+
.(!$apbct->white_label
|
186 |
+
? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
|
187 |
+
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
188 |
+
."</a>"
|
189 |
+
: '');
|
190 |
+
}else{
|
191 |
+
echo "No email";
|
192 |
+
}
|
193 |
+
echo "<br/>";
|
194 |
+
|
195 |
+
// Outputs IP if exists
|
196 |
+
$user_meta = get_user_meta($id, 'session_tokens', true);
|
197 |
+
if(!empty($user_meta) && is_array($user_meta)){
|
198 |
+
$user_meta=array_values($user_meta);
|
199 |
+
if(!empty($user_meta[0]['ip'])){
|
200 |
+
$ip = $user_meta[0]['ip'];
|
201 |
+
echo "<a href='user-edit.php?user_id=$id'>$ip</a>"
|
202 |
+
.(!$apbct->white_label
|
203 |
+
?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
|
204 |
+
." <img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
|
205 |
+
."</a>"
|
206 |
+
: '');
|
207 |
+
}else
|
208 |
+
echo "No IP adress";
|
209 |
+
}else
|
210 |
+
echo "No IP adress";
|
211 |
+
echo "</td>";
|
212 |
+
?>
|
213 |
+
<td class="comment column-comment">
|
214 |
+
<div class="submitted-on">
|
215 |
+
<?php print $c_spam[$i]->data->display_name; ?>
|
216 |
+
<div style="height:16px; display: none;" id="cleantalk_button_set_<?php print $id; ?>">
|
217 |
+
<a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
|
218 |
+
|
|
219 |
+
<a href="#" class="cleantalk_delete_user_button" id="cleantalk_delete_user_<?php print $id; ?>" data-id="<?php print $id; ?>" style="color:#a00;display:none;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
|
220 |
+
</div>
|
221 |
+
</div>
|
222 |
+
</td>
|
223 |
+
<td class="comment column-comment">
|
224 |
+
<?php print $email; ?>
|
225 |
+
</td>
|
226 |
+
<td class="comment column-comment">
|
227 |
+
<?php print $signed; ?>
|
228 |
+
</td>
|
229 |
+
<td class="comment column-comment">
|
230 |
+
<?php
|
231 |
+
$info=get_userdata( $id );
|
232 |
+
print implode(', ', $info->roles);
|
233 |
+
?>
|
234 |
+
</td>
|
235 |
+
<td class="comment column-comment">
|
236 |
+
<?php
|
237 |
+
print count_user_posts($id);
|
238 |
+
?>
|
239 |
+
</td>
|
240 |
+
</tr>
|
241 |
+
<?php
|
242 |
+
}
|
243 |
+
?>
|
244 |
+
</tbody>
|
245 |
+
</table>
|
246 |
+
<?php
|
247 |
+
// Pagination
|
248 |
+
if($pages && $pages != 1){
|
249 |
+
echo "<div class='ct_to_hide pagination'>"
|
250 |
+
."<b>Pages:</b>"
|
251 |
+
."<ul class='pagination'>";
|
252 |
+
for($i = 1; $i <= $pages; $i++){
|
253 |
+
echo "<li class='pagination'>"
|
254 |
+
."<a href='users.php?page=ct_check_users&spam_page=$i&ct_worked=1'>"
|
255 |
+
.($i == $page ? "<span class='current_page'>$i</span>" : $i)
|
256 |
+
."</a>"
|
257 |
+
."</li>";
|
258 |
+
}
|
259 |
+
echo "</ul>";
|
260 |
+
echo "</div>";
|
261 |
+
}
|
262 |
+
?>
|
263 |
+
<div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
|
264 |
+
<button class="button" id="ct_delete_all_users"><?php _e('Delete all users from list', 'cleantalk'); ?></button>
|
265 |
+
<button class="button" id="ct_delete_checked_users"><?php _e('Delete selected', 'cleantalk'); ?></button>
|
266 |
+
<button class="button" id="ct_get_csv_file"><?php _e('Download results in CSV', 'cleantalk'); ?></button>
|
267 |
+
</div>
|
268 |
+
<?php
|
269 |
+
}
|
270 |
+
echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<br /><button class=" ct_to_hide button" id="ct_insert_users">'. __('Insert accounts', 'cleantalk'). ' (100)</button> ' : '';
|
271 |
+
echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="ct_to_hide button" id="ct_delete_users">'. __('Delete accounts', 'cleantalk'). ' (110)</button><br />' : '';
|
272 |
+
|
273 |
+
if($cnt_spam1 > 0){
|
274 |
+
echo "<div id='ct_search_info'>"
|
275 |
+
."<br />"
|
276 |
+
.__("There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.", 'cleantalk')
|
277 |
+
."</div>";
|
278 |
+
}
|
279 |
+
?>
|
280 |
+
<div>
|
281 |
+
<button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
|
282 |
+
</div>
|
283 |
+
<div id='ct_csv_wrapper' style="display: none;"></div>
|
284 |
+
</div>
|
285 |
+
<?php
|
286 |
+
}
|
287 |
+
|
288 |
+
function ct_ajax_check_users(){
|
289 |
+
|
290 |
+
check_ajax_referer('ct_secret_nonce', 'security');
|
291 |
+
|
292 |
+
global $apbct;
|
293 |
+
|
294 |
+
$skip_roles = array(
|
295 |
+
'administrator'
|
296 |
+
);
|
297 |
+
|
298 |
+
$params = array(
|
299 |
+
// 'fields' => array(
|
300 |
+
// 'ID',
|
301 |
+
// 'user_login',
|
302 |
+
// 'user_email',
|
303 |
+
// 'user_registered',
|
304 |
+
// ),
|
305 |
+
'meta_query' => array(
|
306 |
+
'relation' => 'AND',
|
307 |
+
array(
|
308 |
+
'key' => 'ct_checked',
|
309 |
+
'compare' => 'NOT EXISTS'
|
310 |
+
),
|
311 |
+
array(
|
312 |
+
'key' => 'ct_bad',
|
313 |
+
'compare' => 'NOT EXISTS'
|
314 |
+
),
|
315 |
+
),
|
316 |
+
'orderby' => 'registered',
|
317 |
+
'order' => 'ASC',
|
318 |
+
'number' => 100
|
319 |
+
);
|
320 |
+
|
321 |
+
if(isset($_POST['from'], $_POST['till'])){
|
322 |
+
|
323 |
+
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
324 |
+
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
325 |
+
|
326 |
+
$params['date_query'] = array(
|
327 |
+
'column' => 'user_registered',
|
328 |
+
'after' => $from_date,
|
329 |
+
'before' => $till_date,
|
330 |
+
'inclusive' => true,
|
331 |
+
);
|
332 |
+
}
|
333 |
+
|
334 |
+
$u = get_users( $params );
|
335 |
+
|
336 |
+
$check_result = array(
|
337 |
+
'end' => 0,
|
338 |
+
'checked' => 0,
|
339 |
+
'spam' => 0,
|
340 |
+
'bad' => 0,
|
341 |
+
'error' => 0
|
342 |
+
);
|
343 |
+
|
344 |
+
if(count($u) > 0){
|
345 |
+
|
346 |
+
if(!empty($_POST['accurate_check'])){
|
347 |
+
// Leaving users only with first comment's date. Unsetting others.
|
348 |
+
foreach($u as $user_index => $user){
|
349 |
+
|
350 |
+
if(!isset($curr_date))
|
351 |
+
$curr_date = (substr($user->data->user_registered, 0, 10) ? substr($user->data->user_registered, 0, 10) : '');
|
352 |
+
|
353 |
+
if(substr($user->data->user_registered, 0, 10) != $curr_date)
|
354 |
+
unset($u[$user_index]);
|
355 |
+
|
356 |
+
}
|
357 |
+
unset($user_index, $user);
|
358 |
+
}
|
359 |
+
|
360 |
+
// Checking comments IP/Email. Gathering $data for check.
|
361 |
+
$data=Array();
|
362 |
+
for($i=0; $i < count($u); $i++){
|
363 |
+
|
364 |
+
$user_meta = get_user_meta($u[$i]->ID, 'session_tokens', true);
|
365 |
+
if(is_array($user_meta))
|
366 |
+
$user_meta = array_values($user_meta);
|
367 |
+
|
368 |
+
$curr_ip = !empty($user_meta[0]['ip']) ? trim($user_meta[0]['ip']) : '';
|
369 |
+
$curr_email = !empty($u[$i]->data->user_email) ? trim($u[$i]->data->user_email) : '';
|
370 |
+
|
371 |
+
// Check for identity
|
372 |
+
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
373 |
+
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
374 |
+
|
375 |
+
if(empty($curr_ip) && empty($curr_email)){
|
376 |
+
$check_result['bad']++;
|
377 |
+
update_user_meta($u[$i]->ID,'ct_bad','1',true);
|
378 |
+
unset($u[$i]);
|
379 |
+
}else{
|
380 |
+
if(!empty($curr_ip))
|
381 |
+
$data[] = $curr_ip;
|
382 |
+
if(!empty($curr_email))
|
383 |
+
$data[] = $curr_email;
|
384 |
+
// Patch for empty IP/Email
|
385 |
+
$u[$i]->data->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
|
386 |
+
$u[$i]->data->user_email = empty($curr_email) ? 'none' : $curr_email;
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
// Recombining after checking and unsettting
|
391 |
+
$u = array_values($u);
|
392 |
+
|
393 |
+
// Drop if data empty and there's no users to check
|
394 |
+
if(count($data) == 0){
|
395 |
+
if($_POST['unchecked'] === 0)
|
396 |
+
$check_result['end'] = 1;
|
397 |
+
print json_encode($check_result);
|
398 |
+
die();
|
399 |
+
}
|
400 |
+
|
401 |
+
$result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
|
402 |
+
|
403 |
+
if(empty($result['error'])){
|
404 |
+
|
405 |
+
// Opening CSV file
|
406 |
+
$current_user = wp_get_current_user();
|
407 |
+
if(!is_dir(APBCT_DIR_PATH .'/check-results/'))
|
408 |
+
mkdir(APBCT_DIR_PATH .'/check-results');
|
409 |
+
$filename = APBCT_DIR_PATH ."/check-results/user_check_by_{$current_user->user_nicename}.csv";
|
410 |
+
$text = '';
|
411 |
+
|
412 |
+
if(isset($_POST['new_check']) && $_POST['new_check'] == 'true'){
|
413 |
+
$file_desc = fopen($filename, 'w');
|
414 |
+
$text .= 'login,email,ip'.PHP_EOL;
|
415 |
+
}else
|
416 |
+
$file_desc = fopen($filename, 'a+');
|
417 |
+
// End of Opening CSV
|
418 |
+
|
419 |
+
for($i=0;$i<sizeof($u);$i++){
|
420 |
+
|
421 |
+
$check_result['checked']++;
|
422 |
+
update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
|
423 |
+
|
424 |
+
// Do not display forbidden roles.
|
425 |
+
foreach ($skip_roles as $role) {
|
426 |
+
if (in_array($role, $u[$i]->roles)){
|
427 |
+
delete_user_meta($u[$i]->ID, 'ct_marked_as_spam');
|
428 |
+
continue 2;
|
429 |
+
}
|
430 |
+
}
|
431 |
+
|
432 |
+
$mark_spam_ip = false;
|
433 |
+
$mark_spam_email = false;
|
434 |
+
|
435 |
+
$uip = $u[$i]->data->user_ip;
|
436 |
+
$uim = $u[$i]->data->user_email;
|
437 |
+
|
438 |
+
if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
|
439 |
+
$mark_spam_ip = true;
|
440 |
+
|
441 |
+
if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
|
442 |
+
$mark_spam_email = true;
|
443 |
+
|
444 |
+
if ($mark_spam_ip || $mark_spam_email){
|
445 |
+
$check_result['spam']++;
|
446 |
+
update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
|
447 |
+
$text .= $u[$i]->user_login.',';
|
448 |
+
$text .= ($mark_spam_email ? $uim : '').',';
|
449 |
+
$text .= ($mark_spam_ip ? $uip : '').PHP_EOL;
|
450 |
+
}
|
451 |
+
|
452 |
+
}
|
453 |
+
if($file_desc){
|
454 |
+
fwrite($file_desc, $text);
|
455 |
+
fclose($file_desc);
|
456 |
+
}
|
457 |
+
print json_encode($check_result);
|
458 |
+
}else{
|
459 |
+
$check_result['error'] = 1;
|
460 |
+
$check_result['error_message'] = $result['error'];
|
461 |
+
echo json_encode($check_result);
|
462 |
+
}
|
463 |
+
}else{
|
464 |
+
$check_result['end'] = 1;
|
465 |
+
print json_encode($check_result);
|
466 |
+
}
|
467 |
+
die;
|
468 |
+
}
|
469 |
+
|
470 |
+
function ct_ajax_info_users($direct_call = false)
|
471 |
+
{
|
472 |
+
if (!$direct_call)
|
473 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
474 |
+
|
475 |
+
// Checking dates value
|
476 |
+
if(isset($_POST['from'], $_POST['till'])){
|
477 |
+
|
478 |
+
$from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
|
479 |
+
$till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
|
480 |
+
}
|
481 |
+
|
482 |
+
// Total users
|
483 |
+
$params = array(
|
484 |
+
'fields' => 'ID',
|
485 |
+
'count'=>true,
|
486 |
+
);
|
487 |
+
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
488 |
+
$tmp = new WP_User_Query($params);
|
489 |
+
$cnt = $tmp->get_total();
|
490 |
+
|
491 |
+
// Checked users
|
492 |
+
$params = array(
|
493 |
+
'fields' => 'ID',
|
494 |
+
'meta_key' => 'ct_checked',
|
495 |
+
'count_total' => true,
|
496 |
+
);
|
497 |
+
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
498 |
+
$tmp = new WP_User_Query($params);
|
499 |
+
$cnt_checked = $tmp->get_total();
|
500 |
+
|
501 |
+
// Spam users
|
502 |
+
$params = array(
|
503 |
+
'fields' => 'ID',
|
504 |
+
'meta_key' => 'ct_marked_as_spam',
|
505 |
+
'count_total' => true,
|
506 |
+
);
|
507 |
+
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
508 |
+
$tmp = new WP_User_Query($params);
|
509 |
+
$cnt_spam = $tmp->get_total();
|
510 |
+
|
511 |
+
// Bad users (without IP and Email)
|
512 |
+
$params = array(
|
513 |
+
'fields' => 'ID',
|
514 |
+
'meta_key' => 'ct_bad',
|
515 |
+
'count_total' => true,
|
516 |
+
);
|
517 |
+
if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
|
518 |
+
$tmp = new WP_User_Query($params);
|
519 |
+
$cnt_bad = $tmp->get_total();
|
520 |
+
|
521 |
+
$return = array(
|
522 |
+
'message' => '',
|
523 |
+
'total' => $cnt,
|
524 |
+
'spam' => $cnt_spam,
|
525 |
+
'checked' => $cnt_checked,
|
526 |
+
'bad' => $cnt_bad,
|
527 |
+
);
|
528 |
+
|
529 |
+
$return['message'] .= sprintf (__("Total users %s, checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam, $cnt_bad);
|
530 |
+
|
531 |
+
$backup_notice = ' ';
|
532 |
+
if ($cnt_spam > 0) {
|
533 |
+
$backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
|
534 |
+
}
|
535 |
+
$return['message'] .= "<p>$backup_notice</p>";
|
536 |
+
|
537 |
+
if($direct_call){
|
538 |
+
return $return['message'];
|
539 |
+
}else{
|
540 |
+
echo json_encode($return);
|
541 |
+
die();
|
542 |
+
}
|
543 |
+
|
544 |
+
return null;
|
545 |
+
}
|
546 |
+
|
547 |
+
function ct_ajax_insert_users()
|
548 |
+
{
|
549 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
550 |
+
|
551 |
+
//* DELETION
|
552 |
+
if(!empty($_POST['delete'])){
|
553 |
+
$users = get_users(array('search' => '*user_*', 'search_columns' => array('login', 'nicename')));
|
554 |
+
$deleted = 0;
|
555 |
+
$amount_to_delete = 15;
|
556 |
+
foreach($users as $user){
|
557 |
+
if($deleted >= $amount_to_delete)
|
558 |
+
break;
|
559 |
+
if(wp_delete_user($user->ID))
|
560 |
+
$deleted++;
|
561 |
+
}
|
562 |
+
print "$deleted";
|
563 |
+
die();
|
564 |
+
}
|
565 |
+
//*/
|
566 |
+
|
567 |
+
//* INSERTION
|
568 |
+
global $wpdb;
|
569 |
+
$to_insert = 100;
|
570 |
+
$result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
|
571 |
+
|
572 |
+
if($result){
|
573 |
+
$ip = array();
|
574 |
+
foreach($result as $value){
|
575 |
+
$ips[] = long2ip($value['network']);
|
576 |
+
}
|
577 |
+
unset($value);
|
578 |
+
|
579 |
+
$inserted = 0;
|
580 |
+
for($i=0; $i<$to_insert; $i++){
|
581 |
+
$rnd=mt_rand(1,10000000);
|
582 |
+
|
583 |
+
$user_name = "user_$rnd";
|
584 |
+
$email="stop_email_$rnd@example.com";
|
585 |
+
|
586 |
+
$user_id = wp_create_user(
|
587 |
+
$user_name,
|
588 |
+
rand(),
|
589 |
+
$email
|
590 |
+
);
|
591 |
+
|
592 |
+
$curr_user = get_user_by('email', $email);
|
593 |
+
|
594 |
+
update_user_meta($curr_user->ID, 'session_tokens', array($rnd => array('ip' => $ips[$i])));
|
595 |
+
|
596 |
+
if (is_int($user_id))
|
597 |
+
$inserted++;
|
598 |
+
|
599 |
+
}
|
600 |
+
}else{
|
601 |
+
$inserted = '0';
|
602 |
+
}
|
603 |
+
//*/
|
604 |
+
|
605 |
+
print "$inserted";
|
606 |
+
die();
|
607 |
+
}
|
608 |
+
|
609 |
+
function ct_ajax_delete_checked_users()
|
610 |
+
{
|
611 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
612 |
+
foreach($_POST['ids'] as $key=>$value)
|
613 |
+
{
|
614 |
+
wp_delete_user($value);
|
615 |
+
}
|
616 |
+
die();
|
617 |
+
}
|
618 |
+
|
619 |
+
function ct_ajax_delete_all_users($count_all = 0)
|
620 |
+
{
|
621 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
622 |
+
|
623 |
+
global $wpdb;
|
624 |
+
|
625 |
+
$r = $wpdb->get_results("select count(*) as cnt from $wpdb->usermeta where meta_key='ct_marked_as_spam';", OBJECT );
|
626 |
+
|
627 |
+
if(!empty($r)){
|
628 |
+
|
629 |
+
$count_all = $r ? $r[0]->cnt : 0;
|
630 |
+
|
631 |
+
$args = array(
|
632 |
+
'meta_key' => 'ct_marked_as_spam',
|
633 |
+
'meta_value' => '1',
|
634 |
+
'fields' => array('ID'),
|
635 |
+
'number' => 50
|
636 |
+
);
|
637 |
+
$users = get_users($args);
|
638 |
+
|
639 |
+
if ($users){
|
640 |
+
foreach($users as $user){
|
641 |
+
wp_delete_user($user->ID);
|
642 |
+
usleep(5000);
|
643 |
+
}
|
644 |
+
}
|
645 |
+
}
|
646 |
+
|
647 |
+
die($count_all);
|
648 |
+
}
|
649 |
+
|
650 |
+
function ct_ajax_clear_users()
|
651 |
+
{
|
652 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
653 |
+
global $wpdb;
|
654 |
+
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
|
655 |
+
die();
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Admin action 'user_unapproved_to_approved' - Approve user, delete from the deleting list
|
660 |
+
*/
|
661 |
+
function ct_usercheck_approve_user() {
|
662 |
+
|
663 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
664 |
+
|
665 |
+
delete_metadata('user', $_POST['id'], 'ct_marked_as_spam');
|
666 |
+
|
667 |
+
die();
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Admin action 'wp_ajax_ajax_ct_get_csv_file' - prints CSV file to AJAX
|
672 |
+
*/
|
673 |
+
function ct_usercheck_get_csv_file() {
|
674 |
+
|
675 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
676 |
+
|
677 |
+
$filename = !empty($_POST['filename']) ? $_POST['filename'] : false;
|
678 |
+
|
679 |
+
if($filename !== false && file_exists(WP_PLUGIN_DIR."/cleantalk-spam-protect/check-results/{$filename}.csv"))
|
680 |
+
$output = 1;
|
681 |
+
else
|
682 |
+
$output = 0;
|
683 |
+
|
684 |
+
echo $output;
|
685 |
+
|
686 |
+
die();
|
687 |
}
|
js/apbct-common.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
function apbct_sendAJAX(l,o,n){var r=o.callback||null,t=o.notJson||null,e=o.timeout||15e3,s=(n=n||null,o.button||null),u=o.spinner||null,a=o.progressbar||null;s&&(s.setAttribute("disabled","disabled"),s.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),l._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:l,success:function(e){s&&(s.removeAttribute("disabled"),s.style.cursor="pointer"),u&&jQuery(u).css("display","none"),t||(e=JSON.parse(e)),e.error?(setTimeout(function(){a&&a.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):r&&r(e,l,o,n)},error:function(e,l,o){s&&(s.removeAttribute("disabled"),s.style.cursor="pointer"),u&&jQuery(u).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(l),console.log(o),o&&alert(o)},timeout:e})}
|
2 |
+
//# sourceMappingURL=apbct-common.min.js.map
|
js/apbct-common.min.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["apbct-common.js"],"names":["apbct_sendAJAX","data","params","obj","callback","notJson","timeout","button","spinner","progressbar","setAttribute","style","cursor","jQuery","css","_ajax_nonce","ctPublic","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","jqXHR","textStatus","errorThrown","console","log"],"mappings":"AAAA,SAASA,eAAeC,EAAMC,EAAQC,GAGrC,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAcH,EAAOG,SAAe,KACpCC,EAAcJ,EAAOI,SAAe,KAEpCC,GADAJ,EAAcA,GAAsB,KACtBD,EAAOK,QAAe,MACpCC,EAAcN,EAAOM,SAAe,KACpCC,EAAcP,EAAOO,aAAe,KAGrCF,IAAUA,EAAOG,aAAa,WAAY,YAAaH,EAAOI,MAAMC,OAAS,eAC7EJ,GAASK,OAAOL,GAASM,IAAI,UAAW,UAG3Cb,EAAKc,YAAcC,SAASD,YAE5BF,OAAOI,KAAK,CACXC,KAAM,OACNC,IAAKH,SAASI,UACdnB,KAAMA,EACNoB,QAAS,SAASC,GACdf,IAAUA,EAAOgB,gBAAgB,YAAahB,EAAOI,MAAMC,OAAS,WACpEJ,GAAUK,OAAOL,GAASM,IAAI,UAAW,QACxCT,IAASiB,EAASE,KAAKC,MAAMH,IAC9BA,EAAOI,OACTC,WAAW,WAAelB,GAAaA,EAAYmB,QAAQ,SAAY,KACvEC,MAAM,mBAAqBP,EAAOI,OAAS,YAExCtB,GACFA,EAASkB,EAAQrB,EAAMC,EAAQC,IAGlCuB,MAAO,SAASI,EAAOC,EAAYC,GAC/BzB,IAAUA,EAAOgB,gBAAgB,YAAahB,EAAOI,MAAMC,OAAS,WACpEJ,GAASK,OAAOL,GAASM,IAAI,UAAW,QAC3CmB,QAAQC,IAAI,oBACZD,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,GACTA,GACFH,MAAMG,IAER1B,QAASA","file":"apbct-common.min.js","sourcesContent":["function apbct_sendAJAX(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\tvar button = params.button || null;\r\n\tvar spinner = params.spinner || null;\r\n\tvar progressbar = params.progressbar || null;\r\n\r\n\t// Button and spinner\r\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\r\n\tif(spinner) jQuery(spinner).css('display', 'inline');\r\n\r\n\t// Adding security code\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\r\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t\tif(errorThrown)\r\n\t\t\t\talert(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout,\r\n\t});\r\n}"]}
|
js/apbct-fingerprint.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["apbct-fingerprint.js"],"names":["console","log","name","context","definition","module","exports","define","amd","this","Fingerprint","options","nativeForEach","nativeMap","Array","prototype","forEach","map","each","obj","iterator","length","i","l","call","key","hasOwnProperty","results","value","index","list","hasher","screen_resolution","screen_orientation","canvas","ie_activex","get","keys","push","navigator","userAgent","language","screen","colorDepth","resolution","getScreenResolution","join","Date","getTimezoneOffset","hasSessionStorage","hasLocalStorage","hasIndexDb","document","body","window","cpuClass","platform","doNotTrack","getPluginsString","isCanvasSupported","getCanvasFingerprint","murmurhash3_32_gc","seed","remainder","bytes","h1","h1b","c1","c2","k1","charCodeAt","localStorage","e","sessionStorage","indexedDB","elem","createElement","getContext","isIE","appName","test","getIEPluginsString","getRegularPluginsString","plugins","p","mimeTypes","mt","type","suffixes","description","ActiveXObject","height","width","ctx","txt","textBaseline","font","fillStyle","fillRect","fillText","toDataURL"],"mappings":"AAiBAA,QAAQC,IAAI,SACX,SAAWC,EAAMC,EAASC,GACH,oBAAXC,QAA0BA,OAAOC,QAAWD,OAAOC,QAAUF,IAC7C,mBAAXG,QAAyBA,OAAOC,IAAOD,OAAOH,GACvDD,EAAY,YAAIC,IAHxB,CAIE,EAAeK,KAAM,WACtB,aAEkB,SAAdC,EAAwBC,GAC1B,IAAIC,EAAeC,EACnBD,EAAgBE,MAAMC,UAAUC,QAChCH,EAAYC,MAAMC,UAAUE,IAE5BR,KAAKS,KAAO,SAAUC,EAAKC,EAAUjB,GACnC,GAAY,OAARgB,EAGJ,GAAIP,GAAiBO,EAAIH,UAAYJ,EACnCO,EAAIH,QAAQI,EAAUjB,QACjB,GAAIgB,EAAIE,UAAYF,EAAIE,QAC7B,IAAK,IAAIC,EAAI,EAAGC,EAAIJ,EAAIE,OAAQC,EAAIC,EAAGD,IACrC,GAAIF,EAASI,KAAKrB,EAASgB,EAAIG,GAAIA,EAAGH,KAAS,GAAI,YAGrD,IAAK,IAAIM,KAAON,EACd,GAAIA,EAAIO,eAAeD,IACj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OAAOkD,MAAS,CAAClD,OAAOiD,OAAQjD,OAAOkD,OAAS,CAAClD,OAAOkD,MAAOlD,OAAOiD,QAEvF,CAACjD,OAAOiD,OAAQjD,OAAOkD,QAKzChC,qBAAsB,WACpB,IAAI1B,EAASkB,SAASwB,cAAc,UAChCiB,EAAM3D,EAAO2C,WAAW,MAExBiB,EAAM,yBAUV,OATAD,EAAIE,aAAe,MACnBF,EAAIG,KAAO,eACXH,EAAIE,aAAe,aACnBF,EAAII,UAAY,OAChBJ,EAAIK,SAAS,IAAI,EAAE,GAAG,IACtBL,EAAII,UAAY,OAChBJ,EAAIM,SAASL,EAAK,EAAG,IACrBD,EAAII,UAAY,yBAChBJ,EAAIM,SAASL,EAAK,EAAG,IACd5D,EAAOkE,cAKX1F","file":"apbct-fingerprint.min.js","sourcesContent":["/*\n* fingerprintJS 0.5.5 - Fast browser fingerprint library\n* https://github.com/Valve/fingerprintjs\n* Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com)\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nconsole.log('some1');\n;(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }\n else if (typeof define === 'function' && define.amd) { define(definition); }\n else { context[name] = definition(); }\n})('Fingerprint', this, function () {\n 'use strict';\n\n var Fingerprint = function (options) {\n var nativeForEach, nativeMap;\n nativeForEach = Array.prototype.forEach;\n nativeMap = Array.prototype.map;\n\n this.each = function (obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (iterator.call(context, obj[i], i, obj) === {}) return;\n }\n } else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (iterator.call(context, obj[key], key, obj) === {}) return;\n }\n }\n }\n };\n\n this.map = function(obj, iterator, context) {\n var results = [];\n // Not using strict equality so that this acts as a\n // shortcut to checking for `null` and `undefined`.\n if (obj == null) return results;\n if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n this.each(obj, function(value, index, list) {\n results[results.length] = iterator.call(context, value, index, list);\n });\n return results;\n };\n\n if (typeof options == 'object'){\n this.hasher = options.hasher;\n this.screen_resolution = options.screen_resolution;\n this.screen_orientation = options.screen_orientation;\n this.canvas = options.canvas;\n this.ie_activex = options.ie_activex;\n } else if(typeof options == 'function'){\n this.hasher = options;\n }\n };\n\n Fingerprint.prototype = {\n get: function(){\n var keys = [];\n keys.push(navigator.userAgent);\n keys.push(navigator.language);\n keys.push(screen.colorDepth);\n if (this.screen_resolution) {\n var resolution = this.getScreenResolution();\n if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs\n keys.push(resolution.join('x'));\n }\n }\n keys.push(new Date().getTimezoneOffset());\n keys.push(this.hasSessionStorage());\n keys.push(this.hasLocalStorage());\n keys.push(this.hasIndexDb());\n //body might not be defined at this point or removed programmatically\n if(document.body){\n keys.push(typeof(document.body.addBehavior));\n } else {\n keys.push(typeof undefined);\n }\n keys.push(typeof(window.openDatabase));\n keys.push(navigator.cpuClass);\n keys.push(navigator.platform);\n keys.push(navigator.doNotTrack);\n keys.push(this.getPluginsString());\n if(this.canvas && this.isCanvasSupported()){\n keys.push(this.getCanvasFingerprint());\n }\n if(this.hasher){\n return this.hasher(keys.join('###'), 31);\n } else {\n return this.murmurhash3_32_gc(keys.join('###'), 31);\n }\n },\n\n /**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\n murmurhash3_32_gc: function(key, seed) {\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key.charCodeAt(i) & 0xff)) |\n ((key.charCodeAt(++i) & 0xff) << 8) |\n ((key.charCodeAt(++i) & 0xff) << 16) |\n ((key.charCodeAt(++i) & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n },\n\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n hasLocalStorage: function () {\n try{\n return !!window.localStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasSessionStorage: function () {\n try{\n return !!window.sessionStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasIndexDb: function () {\n try{\n return !!window.indexedDB;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n isCanvasSupported: function () {\n var elem = document.createElement('canvas');\n return !!(elem.getContext && elem.getContext('2d'));\n },\n\n isIE: function () {\n if(navigator.appName === 'Microsoft Internet Explorer') {\n return true;\n } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11\n return true;\n }\n return false;\n },\n\n getPluginsString: function () {\n if(this.isIE() && this.ie_activex){\n return this.getIEPluginsString();\n } else {\n return this.getRegularPluginsString();\n }\n },\n\n getRegularPluginsString: function () {\n return this.map(navigator.plugins, function (p) {\n var mimeTypes = this.map(p, function(mt){\n return [mt.type, mt.suffixes].join('~');\n }).join(',');\n return [p.name, p.description, mimeTypes].join('::');\n }, this).join(';');\n },\n\n getIEPluginsString: function () {\n if(window.ActiveXObject){\n var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin\n 'AcroPDF.PDF', // Adobe PDF reader 7+\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\n 'QuickTime.QuickTime', // QuickTime\n // 5 versions of real players\n 'rmocx.RealPlayer G2 Control',\n 'rmocx.RealPlayer G2 Control.1',\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\n 'RealPlayer',\n 'SWCtl.SWCtl', // ShockWave player\n 'WMPlayer.OCX', // Windows media player\n 'AgControl.AgControl', // Silverlight\n 'Skype.Detection'];\n\n // starting to detect plugins in IE\n return this.map(names, function(name){\n try{\n new ActiveXObject(name);\n return name;\n } catch(e){\n return null;\n }\n }).join(';');\n } else {\n return \"\"; // behavior prior version 0.5.0, not breaking backwards compat.\n }\n },\n\n getScreenResolution: function () {\n var resolution;\n if(this.screen_orientation){\n resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height];\n }else{\n resolution = [screen.height, screen.width];\n }\n return resolution;\n },\n\n getCanvasFingerprint: function () {\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n // https://www.browserleaks.com/canvas#how-does-it-work\n var txt = 'http://valve.github.io';\n ctx.textBaseline = \"top\";\n ctx.font = \"14px 'Arial'\";\n ctx.textBaseline = \"alphabetic\";\n ctx.fillStyle = \"#f60\";\n ctx.fillRect(125,1,62,20);\n ctx.fillStyle = \"#069\";\n ctx.fillText(txt, 2, 15);\n ctx.fillStyle = \"rgba(102, 204, 0, 0.7)\";\n ctx.fillText(txt, 4, 17);\n return canvas.toDataURL();\n }\n };\n\n\n return Fingerprint;\n\n});"]}
|
1 |
+
{"version":3,"sources":["apbct-fingerprint.js"],"names":["console","log","name","context","definition","module","exports","define","amd","this","Fingerprint","options","nativeForEach","nativeMap","Array","prototype","forEach","map","each","obj","iterator","length","i","l","call","key","hasOwnProperty","results","value","index","list","hasher","screen_resolution","screen_orientation","canvas","ie_activex","get","keys","push","navigator","userAgent","language","screen","colorDepth","resolution","getScreenResolution","join","Date","getTimezoneOffset","hasSessionStorage","hasLocalStorage","hasIndexDb","document","body","window","cpuClass","platform","doNotTrack","getPluginsString","isCanvasSupported","getCanvasFingerprint","murmurhash3_32_gc","seed","remainder","bytes","h1","h1b","c1","c2","k1","charCodeAt","localStorage","e","sessionStorage","indexedDB","elem","createElement","getContext","isIE","appName","test","getIEPluginsString","getRegularPluginsString","plugins","p","mimeTypes","mt","type","suffixes","description","ActiveXObject","height","width","ctx","txt","textBaseline","font","fillStyle","fillRect","fillText","toDataURL"],"mappings":"AAiBAA,QAAQC,IAAI,SACX,SAAWC,EAAMC,EAASC,GACH,oBAAXC,QAA0BA,OAAOC,QAAWD,OAAOC,QAAUF,IAC7C,mBAAXG,QAAyBA,OAAOC,IAAOD,OAAOH,GACvDD,EAAY,YAAIC,IAHxB,CAIE,EAAeK,KAAM,WACtB,aAEkB,SAAdC,EAAwBC,GAC1B,IAAIC,EAAeC,EACnBD,EAAgBE,MAAMC,UAAUC,QAChCH,EAAYC,MAAMC,UAAUE,IAE5BR,KAAKS,KAAO,SAAUC,EAAKC,EAAUjB,GACnC,GAAY,OAARgB,EAGJ,GAAIP,GAAiBO,EAAIH,UAAYJ,EACnCO,EAAIH,QAAQI,EAAUjB,QACjB,GAAIgB,EAAIE,UAAYF,EAAIE,QAC7B,IAAK,IAAIC,EAAI,EAAGC,EAAIJ,EAAIE,OAAQC,EAAIC,EAAGD,IACrC,GAAIF,EAASI,KAAKrB,EAASgB,EAAIG,GAAIA,EAAGH,KAAS,GAAI,YAGrD,IAAK,IAAIM,KAAON,EACd,GAAI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ACQS,OAAOiD,OAASjD,OAAOkD,MAAS,CAAClD,OAAOiD,OAAQjD,OAAOkD,OAAS,CAAClD,OAAOkD,MAAOlD,OAAOiD,QAEvF,CAACjD,OAAOiD,OAAQjD,OAAOkD,QAKzChC,qBAAsB,WACpB,IAAI1B,EAASkB,SAASwB,cAAc,UAChCiB,EAAM3D,EAAO2C,WAAW,MAExBiB,EAAM,yBAUV,OATAD,EAAIE,aAAe,MACnBF,EAAIG,KAAO,eACXH,EAAIE,aAAe,aACnBF,EAAII,UAAY,OAChBJ,EAAIK,SAAS,IAAI,EAAE,GAAG,IACtBL,EAAII,UAAY,OAChBJ,EAAIM,SAASL,EAAK,EAAG,IACrBD,EAAII,UAAY,yBAChBJ,EAAIM,SAASL,EAAK,EAAG,IACd5D,EAAOkE,cAKX1F","file":"apbct-fingerprint.min.js","sourcesContent":["/*\r\n* fingerprintJS 0.5.5 - Fast browser fingerprint library\r\n* https://github.com/Valve/fingerprintjs\r\n* Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com)\r\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\r\n*\r\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\r\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n*/\r\nconsole.log('some1');\r\n;(function (name, context, definition) {\r\n if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }\r\n else if (typeof define === 'function' && define.amd) { define(definition); }\r\n else { context[name] = definition(); }\r\n})('Fingerprint', this, function () {\r\n 'use strict';\r\n\r\n var Fingerprint = function (options) {\r\n var nativeForEach, nativeMap;\r\n nativeForEach = Array.prototype.forEach;\r\n nativeMap = Array.prototype.map;\r\n\r\n this.each = function (obj, iterator, context) {\r\n if (obj === null) {\r\n return;\r\n }\r\n if (nativeForEach && obj.forEach === nativeForEach) {\r\n obj.forEach(iterator, context);\r\n } else if (obj.length === +obj.length) {\r\n for (var i = 0, l = obj.length; i < l; i++) {\r\n if (iterator.call(context, obj[i], i, obj) === {}) return;\r\n }\r\n } else {\r\n for (var key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n if (iterator.call(context, obj[key], key, obj) === {}) return;\r\n }\r\n }\r\n }\r\n };\r\n\r\n this.map = function(obj, iterator, context) {\r\n var results = [];\r\n // Not using strict equality so that this acts as a\r\n // shortcut to checking for `null` and `undefined`.\r\n if (obj == null) return results;\r\n if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\r\n this.each(obj, function(value, index, list) {\r\n results[results.length] = iterator.call(context, value, index, list);\r\n });\r\n return results;\r\n };\r\n\r\n if (typeof options == 'object'){\r\n this.hasher = options.hasher;\r\n this.screen_resolution = options.screen_resolution;\r\n this.screen_orientation = options.screen_orientation;\r\n this.canvas = options.canvas;\r\n this.ie_activex = options.ie_activex;\r\n } else if(typeof options == 'function'){\r\n this.hasher = options;\r\n }\r\n };\r\n\r\n Fingerprint.prototype = {\r\n get: function(){\r\n var keys = [];\r\n keys.push(navigator.userAgent);\r\n keys.push(navigator.language);\r\n keys.push(screen.colorDepth);\r\n if (this.screen_resolution) {\r\n var resolution = this.getScreenResolution();\r\n if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs\r\n keys.push(resolution.join('x'));\r\n }\r\n }\r\n keys.push(new Date().getTimezoneOffset());\r\n keys.push(this.hasSessionStorage());\r\n keys.push(this.hasLocalStorage());\r\n keys.push(this.hasIndexDb());\r\n //body might not be defined at this point or removed programmatically\r\n if(document.body){\r\n keys.push(typeof(document.body.addBehavior));\r\n } else {\r\n keys.push(typeof undefined);\r\n }\r\n keys.push(typeof(window.openDatabase));\r\n keys.push(navigator.cpuClass);\r\n keys.push(navigator.platform);\r\n keys.push(navigator.doNotTrack);\r\n keys.push(this.getPluginsString());\r\n if(this.canvas && this.isCanvasSupported()){\r\n keys.push(this.getCanvasFingerprint());\r\n }\r\n if(this.hasher){\r\n return this.hasher(keys.join('###'), 31);\r\n } else {\r\n return this.murmurhash3_32_gc(keys.join('###'), 31);\r\n }\r\n },\r\n\r\n /**\r\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\r\n *\r\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\r\n * @see http://github.com/garycourt/murmurhash-js\r\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\r\n * @see http://sites.google.com/site/murmurhash/\r\n *\r\n * @param {string} key ASCII only\r\n * @param {number} seed Positive integer only\r\n * @return {number} 32-bit positive integer hash\r\n */\r\n\r\n murmurhash3_32_gc: function(key, seed) {\r\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\r\n\r\n remainder = key.length & 3; // key.length % 4\r\n bytes = key.length - remainder;\r\n h1 = seed;\r\n c1 = 0xcc9e2d51;\r\n c2 = 0x1b873593;\r\n i = 0;\r\n\r\n while (i < bytes) {\r\n k1 =\r\n ((key.charCodeAt(i) & 0xff)) |\r\n ((key.charCodeAt(++i) & 0xff) << 8) |\r\n ((key.charCodeAt(++i) & 0xff) << 16) |\r\n ((key.charCodeAt(++i) & 0xff) << 24);\r\n ++i;\r\n\r\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\r\n k1 = (k1 << 15) | (k1 >>> 17);\r\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\r\n\r\n h1 ^= k1;\r\n h1 = (h1 << 13) | (h1 >>> 19);\r\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\r\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\r\n }\r\n\r\n k1 = 0;\r\n\r\n switch (remainder) {\r\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\r\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\r\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\r\n\r\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\r\n k1 = (k1 << 15) | (k1 >>> 17);\r\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\r\n h1 ^= k1;\r\n }\r\n\r\n h1 ^= key.length;\r\n\r\n h1 ^= h1 >>> 16;\r\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\r\n h1 ^= h1 >>> 13;\r\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\r\n h1 ^= h1 >>> 16;\r\n\r\n return h1 >>> 0;\r\n },\r\n\r\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\r\n hasLocalStorage: function () {\r\n try{\r\n return !!window.localStorage;\r\n } catch(e) {\r\n return true; // SecurityError when referencing it means it exists\r\n }\r\n },\r\n\r\n hasSessionStorage: function () {\r\n try{\r\n return !!window.sessionStorage;\r\n } catch(e) {\r\n return true; // SecurityError when referencing it means it exists\r\n }\r\n },\r\n\r\n hasIndexDb: function () {\r\n try{\r\n return !!window.indexedDB;\r\n } catch(e) {\r\n return true; // SecurityError when referencing it means it exists\r\n }\r\n },\r\n\r\n isCanvasSupported: function () {\r\n var elem = document.createElement('canvas');\r\n return !!(elem.getContext && elem.getContext('2d'));\r\n },\r\n\r\n isIE: function () {\r\n if(navigator.appName === 'Microsoft Internet Explorer') {\r\n return true;\r\n } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11\r\n return true;\r\n }\r\n return false;\r\n },\r\n\r\n getPluginsString: function () {\r\n if(this.isIE() && this.ie_activex){\r\n return this.getIEPluginsString();\r\n } else {\r\n return this.getRegularPluginsString();\r\n }\r\n },\r\n\r\n getRegularPluginsString: function () {\r\n return this.map(navigator.plugins, function (p) {\r\n var mimeTypes = this.map(p, function(mt){\r\n return [mt.type, mt.suffixes].join('~');\r\n }).join(',');\r\n return [p.name, p.description, mimeTypes].join('::');\r\n }, this).join(';');\r\n },\r\n\r\n getIEPluginsString: function () {\r\n if(window.ActiveXObject){\r\n var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin\r\n 'AcroPDF.PDF', // Adobe PDF reader 7+\r\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\r\n 'QuickTime.QuickTime', // QuickTime\r\n // 5 versions of real players\r\n 'rmocx.RealPlayer G2 Control',\r\n 'rmocx.RealPlayer G2 Control.1',\r\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\r\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\r\n 'RealPlayer',\r\n 'SWCtl.SWCtl', // ShockWave player\r\n 'WMPlayer.OCX', // Windows media player\r\n 'AgControl.AgControl', // Silverlight\r\n 'Skype.Detection'];\r\n\r\n // starting to detect plugins in IE\r\n return this.map(names, function(name){\r\n try{\r\n new ActiveXObject(name);\r\n return name;\r\n } catch(e){\r\n return null;\r\n }\r\n }).join(';');\r\n } else {\r\n return \"\"; // behavior prior version 0.5.0, not breaking backwards compat.\r\n }\r\n },\r\n\r\n getScreenResolution: function () {\r\n var resolution;\r\n if(this.screen_orientation){\r\n resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height];\r\n }else{\r\n resolution = [screen.height, screen.width];\r\n }\r\n return resolution;\r\n },\r\n\r\n getCanvasFingerprint: function () {\r\n var canvas = document.createElement('canvas');\r\n var ctx = canvas.getContext('2d');\r\n // https://www.browserleaks.com/canvas#how-does-it-work\r\n var txt = 'http://valve.github.io';\r\n ctx.textBaseline = \"top\";\r\n ctx.font = \"14px 'Arial'\";\r\n ctx.textBaseline = \"alphabetic\";\r\n ctx.fillStyle = \"#f60\";\r\n ctx.fillRect(125,1,62,20);\r\n ctx.fillStyle = \"#069\";\r\n ctx.fillText(txt, 2, 15);\r\n ctx.fillStyle = \"rgba(102, 204, 0, 0.7)\";\r\n ctx.fillText(txt, 4, 17);\r\n return canvas.toDataURL();\r\n }\r\n };\r\n\r\n\r\n return Fingerprint;\r\n\r\n});"]}
|
js/apbct-public--alt.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["apbct-public--alt.js"],"names":["apbct_fingerprint","Fingerprint","canvas","ie_activex","hasher","apbct_md5","get","apbct_cookie__get","names","prefixes","cookie","split","document","forEach","item","i","arr","curr","trim","name","all","prefix","indexOf","apbct_cookie__delete","date","Date","toUTCString","jQuery","ready","ajax","type","url","apbctPublicAlt","ajax_url","data","apbct_action","apbct_secret","nonce","session_id","async","success","msg","console","log","JSON","parse","result","cookies","error","err","window","onunload"],"mappings":"AACA,IAAIA,kBAAoB,IAAIC,YAAY,CAACC,QAAQ,EAAMC,YAAY,EAAMC,OAAQC,YAAYC,MAG7F,SAASC,kBAAkBC,EAAOC,GACjC,IAAIC,EAAS,GAuBb,MArBm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AMG,KAAKC,MAAMJ,IAEVK,OAEN,IAAIpC,UADJgC,QAAQC,IAAIF,GACEA,EAAIM,QACjBL,QAAQC,IAAIjC,QAEZE,SAASF,OAASA,OAAS,IAAM+B,EAAIM,QAAQrC,QAAU,iBAGxDgC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,6BAGdK,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM,MAIfC,OAAOC,SAAW,WAGhBJ,QAAUxC,oBAEXmC,QAAQC,IAAI,SAEXhB,OAAOE,KAAK,CACZC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,kBACZkC,KAAMa,SAEPR,OAAO,EACPC,QAAS,SAASC,IACjBA,EAAMG,KAAKC,MAAMJ,IACVK,QACNJ,QAAQC,IAAI,WACZD,QAAQC,IAAIF,GAEZlB,uBACAmB,QAAQC,IAAI,oBAEZD,QAAQC,IAAI,4BACZD,QAAQC,IAAIF,KAGdO,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM","file":"apbct-public--alt.min.js","sourcesContent":["// Fingerprint\nvar apbct_fingerprint = new Fingerprint({canvas: true, ie_activex: true, hasher: apbct_md5}).get();\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\n/* Function: Deletes cookie with prefix */\nfunction apbct_cookie__delete(names, prefixes){\n\tvar date = new Date(0);\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\t\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString();\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString();\n\t\t\t});\n\t\t}\n\t});\n}\n\njQuery(document).ready(function(){\n\t\n\t jQuery.ajax({\n\t\t type: \"POST\",\n\t\t url: apbctPublicAlt.ajax_url,\n\t\t data: {\n\t\t\t apbct_action: 'get_sessions',\n\t\t\t apbct_secret: apbctPublicAlt.nonce,\n\t\t\t session_id: apbct_fingerprint,\n\t\t },\n\t\t async: true,\n\t\t success: function(msg){\n\t\t\t console.log('success');\n\t\t\t msg = JSON.parse(msg);\n\t\t\t\n\t\t\t if(msg.result){\n\t\t\t\t console.log(msg);\n\t\t\t\t for(cookie in msg.cookies){\n\t\t\t\t\t console.log(cookie);\n//\t\t\t\t\t console.log(msg.cookies[cookie]);\n\t\t\t\t\t document.cookie = cookie + \"=\" + msg.cookies[cookie] + \"; path=/;\";\n\t\t\t\t };\n\t\t\t }else{\n\t\t\t\t console.log(msg);\n\t\t\t\t console.log('APBCT SESSIONS GET ERROR');\n\t\t\t }\n\t\t },\n\t\t error: function(err){\n\t\t\t console.log('err');\n\t\t\t console.log(err);\n\t\t }\n\t });\n\t\n\twindow.onunload = function(){\n\t\t\n\t\t// Getting ct_ and apbct_ cookies\n\t\t cookies = apbct_cookie__get();\n\t\t\n\t\tconsole.log('leave');\n\t\t\n\t\t jQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: apbctPublicAlt.ajax_url,\n\t\t\tdata: {\n\t\t\t\tapbct_action: 'set_sessions',\n\t\t\t\tapbct_secret: apbctPublicAlt.nonce,\n\t\t\t\tsession_id: apbct_fingerprint,\n\t\t\t\tdata: cookies,\n\t\t\t},\n\t\t\tasync: false,\n\t\t\tsuccess: function(msg){\n\t\t\t\tmsg = JSON.parse(msg);\n\t\t\t\tif(msg.result){\n\t\t\t\t\tconsole.log('success');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t\t// Deleting ct_ and apbct_ cookies on success\n\t\t\t\t\tapbct_cookie__delete();\n\t\t\t\t\tconsole.log('cookie DELETED');\n\t\t\t\t}else{\n\t\t\t\t\tconsole.log('APBCT SESSIONS GET ERROR');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(err){\n\t\t\t\tconsole.log('err');\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}); \n\t}\n});"]}
|
1 |
+
{"version":3,"sources":["apbct-public--alt.js"],"names":["apbct_fingerprint","Fingerprint","canvas","ie_activex","hasher","apbct_md5","get","apbct_cookie__get","names","prefixes","cookie","split","document","forEach","item","i","arr","curr","trim","name","all","prefix","indexOf","apbct_cookie__delete","date","Date","toUTCString","jQuery","ready","ajax","type","url","apbctPublicAlt","ajax_url","data","apbct_action","apbct_secret","nonce","session_id","async","success","msg","console","log","JSON","parse","result","cookies","error","err","window","onunload"],"mappings":"AACA,IAAIA,kBAAoB,IAAIC,Y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aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,mBAEbuC,OAAO,EACPC,QAAS,SAASC,GAIjB,GAHAC,QAAQC,IAAI,YACZF,EAAMG,KAAKC,MAAMJ,IAEVK,OAEN,IAAIpC,UADJgC,QAAQC,IAAIF,GACEA,EAAIM,QACjBL,QAAQC,IAAIjC,QAEZE,SAASF,OAASA,OAAS,IAAM+B,EAAIM,QAAQrC,QAAU,iBAGxDgC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,6BAGdK,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM,MAIfC,OAAOC,SAAW,WAGhBJ,QAAUxC,oBAEXmC,QAAQC,IAAI,SAEXhB,OAAOE,KAAK,CACZC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,kBACZkC,KAAMa,SAEPR,OAAO,EACPC,QAAS,SAASC,IACjBA,EAAMG,KAAKC,MAAMJ,IACVK,QACNJ,QAAQC,IAAI,WACZD,QAAQC,IAAIF,GAEZlB,uBACAmB,QAAQC,IAAI,oBAEZD,QAAQC,IAAI,4BACZD,QAAQC,IAAIF,KAGdO,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM","file":"apbct-public--alt.min.js","sourcesContent":["// Fingerprint\r\nvar apbct_fingerprint = new Fingerprint({canvas: true, ie_activex: true, hasher: apbct_md5}).get();\r\n\r\n/* Function: Reuturns cookie with prefix */\r\nfunction apbct_cookie__get(names, prefixes){\r\n\tvar cookie = {};\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes == 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\treturn cookie;\r\n}\r\n\r\n/* Function: Deletes cookie with prefix */\r\nfunction apbct_cookie__delete(names, prefixes){\r\n\tvar date = new Date(0);\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes == 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\t\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString();\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString();\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t jQuery.ajax({\r\n\t\t type: \"POST\",\r\n\t\t url: apbctPublicAlt.ajax_url,\r\n\t\t data: {\r\n\t\t\t apbct_action: 'get_sessions',\r\n\t\t\t apbct_secret: apbctPublicAlt.nonce,\r\n\t\t\t session_id: apbct_fingerprint,\r\n\t\t },\r\n\t\t async: true,\r\n\t\t success: function(msg){\r\n\t\t\t console.log('success');\r\n\t\t\t msg = JSON.parse(msg);\r\n\t\t\t\r\n\t\t\t if(msg.result){\r\n\t\t\t\t console.log(msg);\r\n\t\t\t\t for(cookie in msg.cookies){\r\n\t\t\t\t\t console.log(cookie);\r\n//\t\t\t\t\t console.log(msg.cookies[cookie]);\r\n\t\t\t\t\t document.cookie = cookie + \"=\" + msg.cookies[cookie] + \"; path=/;\";\r\n\t\t\t\t };\r\n\t\t\t }else{\r\n\t\t\t\t console.log(msg);\r\n\t\t\t\t console.log('APBCT SESSIONS GET ERROR');\r\n\t\t\t }\r\n\t\t },\r\n\t\t error: function(err){\r\n\t\t\t console.log('err');\r\n\t\t\t console.log(err);\r\n\t\t }\r\n\t });\r\n\t\r\n\twindow.onunload = function(){\r\n\t\t\r\n\t\t// Getting ct_ and apbct_ cookies\r\n\t\t cookies = apbct_cookie__get();\r\n\t\t\r\n\t\tconsole.log('leave');\r\n\t\t\r\n\t\t jQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: apbctPublicAlt.ajax_url,\r\n\t\t\tdata: {\r\n\t\t\t\tapbct_action: 'set_sessions',\r\n\t\t\t\tapbct_secret: apbctPublicAlt.nonce,\r\n\t\t\t\tsession_id: apbct_fingerprint,\r\n\t\t\t\tdata: cookies,\r\n\t\t\t},\r\n\t\t\tasync: false,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tmsg = JSON.parse(msg);\r\n\t\t\t\tif(msg.result){\r\n\t\t\t\t\tconsole.log('success');\r\n\t\t\t\t\tconsole.log(msg);\r\n\t\t\t\t\t// Deleting ct_ and apbct_ cookies on success\r\n\t\t\t\t\tapbct_cookie__delete();\r\n\t\t\t\t\tconsole.log('cookie DELETED');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tconsole.log('APBCT SESSIONS GET ERROR');\r\n\t\t\t\t\tconsole.log(msg);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(err){\r\n\t\t\t\tconsole.log('err');\r\n\t\t\t\tconsole.log(err);\r\n\t\t\t}\r\n\t\t}); \r\n\t}\r\n});"]}
|
js/apbct-public.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function apbct_js_keys__set_input_value(e,t,n,o){if(null!==document.getElementById(n.input_name)){var i=document.getElementById(n.input_name).value;document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key)}}function apbct_sendAJAXRequest(o,t,n){var i=t.callback||null,a=t.notJson||null,e=t.timeout||15e3;n=n||null;o._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:o,success:function(e){a||(e=JSON.parse(e)),e.error||i&&i(e,o,t,n)},error:function(e,t,n){console.log("APBCT_AJAX_ERROR"),console.log(o),console.log(e),console.log(t),console.log(n)},timeout:e})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/"}function c(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function r(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}a("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),a("ct_fkp_timestamp","0"),a("ct_pointer_data","0"),a("ct_timezone","0"),setTimeout(function(){a("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var u=function(e){a("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),r(window,"mousedown",u),r(window,"keydown",u)},l=setInterval(function(){n=!0},150),m=setInterval(function(){a("ct_pointer_data",JSON.stringify(o))},1200),s=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(r(window,"mousemove",s),clearInterval(l),clearInterval(m)))};c(window,"mousemove",s),c(window,"mousedown",u),c(window,"keydown",u);var d,p,v,f,_,g,
|
2 |
//# sourceMappingURL=apbct-public.min.js.map
|
1 |
+
function apbct_js_keys__set_input_value(e,t,n,o){if(null!==document.getElementById(n.input_name)){var i=document.getElementById(n.input_name).value;document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key)}}function apbct_sendAJAXRequest(o,t,n){var i=t.callback||null,a=t.notJson||null,e=t.timeout||15e3;n=n||null;o._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:o,success:function(e){a||(e=JSON.parse(e)),e.error||i&&i(e,o,t,n)},error:function(e,t,n){console.log("APBCT_AJAX_ERROR"),console.log(o),console.log(e),console.log(t),console.log(n)},timeout:e})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/"}function c(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function r(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}a("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),a("ct_fkp_timestamp","0"),a("ct_pointer_data","0"),a("ct_timezone","0"),setTimeout(function(){a("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var u=function(e){a("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),r(window,"mousedown",u),r(window,"keydown",u)},l=setInterval(function(){n=!0},150),m=setInterval(function(){a("ct_pointer_data",JSON.stringify(o))},1200),s=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(r(window,"mousemove",s),clearInterval(l),clearInterval(m)))};c(window,"mousemove",s),c(window,"mousedown",u),c(window,"keydown",u);var d,p,v,f,_,g,b=!0,w={orientation:{alpha:{},beta:{},gamma:{}},motion:{x:{},y:{},z:{}}};var y=setInterval(function(){var e=+new Date;w.orientation.alpha[e]=d,w.orientation.beta[e]=p,w.orientation.gamma[e]=v,w.motion.x[e]=f,w.motion.y[e]=_,w.motion.z[e]=g,a("abpct_hyro_acc_collect",JSON.stringify(w))},1e3);setTimeout(function(){clearInterval(y)},1e4),window.DeviceOrientationEvent&&c(window,"deviceorientation",function(e){var t,n,o,i=0,a=0,c=0;if(b)return i=e.alpha,a=e.beta,c=e.gamma,void(b=!1);t=e.alpha-i,n=e.beta-a,o=e.gamma-c,d=parseInt(t,10),p=parseInt(n,10),v=parseInt(o,10)}),window.DeviceMotionEvent&&c(window,"devicemotion",function(e){f=parseInt(e.accelerationIncludingGravity.x,10),_=parseInt(e.accelerationIncludingGravity.y,10),g=parseInt(e.accelerationIncludingGravity.z,10)}),c(window,"DOMContentLoaded",function(){a("apbct_visible_fields",0),a("apbct_visible_fields_count",0),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t=document.forms[e];t.onsubmit_prev=t.onsubmit,t.onsubmit=function(e){var t=[];for(var n in this.elements)isNaN(+n)||(t[n]=this.elements[n]);var o=(t=t.filter(function(o){return"none"!==getComputedStyle(o).display&&"hidden"!==getComputedStyle(o).visibility&&"0"!==getComputedStyle(o).opacity&&"hidden"!==o.getAttribute("type")&&"submit"!==o.getAttribute("type")&&""!==o.value&&null!==o.getAttribute("name")&&("radio"===o.getAttribute("type")&&t.forEach(function(e,t,n){o.getAttribute("name")!==e.getAttribute("name")||!1}),!0)})).length,i="";t.forEach(function(e,t,n){i+=" "+e.getAttribute("name")}),a("apbct_visible_fields",i=i.trim()),a("apbct_visible_fields_count",o),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)}}},1e3)})}(),jQuery(document).ajaxComplete(function(e,t,n){var o;t.responseText&&-1!==t.responseText.indexOf('"apbct')&&void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&alert(o.comment)});
|
2 |
//# sourceMappingURL=apbct-public.min.js.map
|
js/apbct-public.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["apbct-public.js"],"names":["apbct_js_keys__set_input_value","result","data","params","obj","document","getElementById","input_name","ct_input_value","value","replace","js_key","apbct_sendAJAXRequest","callback","notJson","timeout","_ajax_nonce","ctPublic","jQuery","ajax","type","url","_ajax_url","success","JSON","parse","error","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctSetCookieSec","c_name","cookie","encodeURIComponent","apbct_attach_event_handler","elem","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","Math","floor","setTimeout","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","stringify","ctFunctionMouseMove","push","round","clientY","clientX","clearInterval","globalAlpha","globalBeta","globalGamma","globalAccX","globalAccY","globalAccZ","isFirstTimeHyro","output","orientation","alpha","beta","gamma","motion","x","y","z","collect","timestamp","DeviceOrientationEvent","alphaOffset","betaOffset","gammaOffset","parseInt","DeviceMotionEvent","accelerationIncludingGravity","i","forms","length","form","onsubmit_prev","onsubmit","elements","key","this","isNaN","visible_fields_count","filter","getComputedStyle","display","visibility","opacity","getAttribute","forEach","el","j","els","visible_fields","trim","target","Function","call","ajaxComplete","xhr","settings","response","responseText","indexOf","apbct","blocked","alert","comment"],"mappings":"AA2PA,SAASA,+BAA+BC,EAAQC,EAAMC,EAAQC,GAC7D,GAAmD,OAA/CC,SAASC,eAAeH,EAAOI,YAAsB,CACxD,IAAIC,EAAiBH,SAASC,eAAeH,EAAOI,YAAYE,MAChEJ,SAASC,eAAeH,EAAOI,YAAYE,MAAQJ,SAASC,eAAeH,EAAOI,YAAYE,MAAMC,QAAQF,EAAgBP,EAAOU,SAIrI,SAASC,sBAAsBV,EAAMC,EAAQC,GAG5C,IAAIS,EAAcV,EAAOU,UAAe,KACpCC,EAAcX,EAAOW,SAAe,KACpCC,EAAcZ,EAAOY,SAAe,KACpCX,EAAcA,GAAsB,KAExCF,EAAKc,YAAcC,SAASD,YAE5BE,OAAOC,KAAK,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AAKxE,EAAMsE,OAAQtE,IAC5C,QAIJ,OAhOL,GA+OA3B,OAAOb,UAAUiH,aAAa,SAASzE,EAAO0E,EAAKC,GAEjD,IAEKC,EAHHF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAaC,QAAQ,gBAElB,KADzBF,EAAWjG,KAAKC,MAAM8F,EAAIG,eACXE,QACdH,EAAWA,EAASG,OACZC,SACXC,MAAML,EAASM","file":"apbct-public.min.js","sourcesContent":["(function() {\r\n\r\n\tvar ct_date = new Date(),\r\n\t\tctTimeMs = new Date().getTime(),\r\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\t\tctMouseData = [],\r\n\t\tctMouseDataCounter = 0;\r\n\r\n\tfunction ctSetCookieSec(c_name, value) {\r\n\t\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/\";\r\n\t}\r\n\r\n\tfunction apbct_attach_event_handler(elem, event, callback){\r\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\t\telse elem.attachEvent(event, callback);\r\n\t}\r\n\r\n\tfunction apbct_remove_event_handler(elem, event, callback){\r\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\t\telse elem.detachEvent(event, callback);\r\n\t}\r\n\r\n\tctSetCookieSec(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\n\tctSetCookieSec(\"ct_fkp_timestamp\", \"0\");\r\n\tctSetCookieSec(\"ct_pointer_data\", \"0\");\r\n\tctSetCookieSec(\"ct_timezone\", \"0\");\r\n\r\n\tsetTimeout(function(){\r\n\t\tctSetCookieSec(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n\t},1000);\r\n\r\n\t//Writing first key press timestamp\r\n\tvar ctFunctionFirstKey = function output(event){\r\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\t\tctSetCookieSec(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\t\tctKeyStopStopListening();\r\n\t};\r\n\r\n\t//Reading interval\r\n\tvar ctMouseReadInterval = setInterval(function(){\r\n\t\tctMouseEventTimerFlag = true;\r\n\t}, 150);\r\n\r\n\t//Writting interval\r\n\tvar ctMouseWriteDataInterval = setInterval(function(){\r\n\t\tctSetCookieSec(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n\t}, 1200);\r\n\r\n\t//Logging mouse position each 150 ms\r\n\tvar ctFunctionMouseMove = function output(event){\r\n\t\tif(ctMouseEventTimerFlag === true){\r\n\r\n\t\t\tctMouseData.push([\r\n\t\t\t\tMath.round(event.clientY),\r\n\t\t\t\tMath.round(event.clientX),\r\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t\t]);\r\n\r\n\t\t\tctMouseDataCounter++;\r\n\t\t\tctMouseEventTimerFlag = false;\r\n\t\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\t\tctMouseStopData();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//Stop mouse observing function\r\n\tfunction ctMouseStopData(){\r\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\t\tclearInterval(ctMouseReadInterval);\r\n\t\tclearInterval(ctMouseWriteDataInterval);\r\n\t}\r\n\r\n\t//Stop key listening function\r\n\tfunction ctKeyStopStopListening(){\r\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\t}\r\n\r\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n\t// Hyroscope && Accelerometer data\r\n\r\n var isFirstTimeHyro = true;\r\n\r\n var output = {\r\n 'orientation' : {\r\n 'alpha' : {},\r\n 'beta' : {},\r\n 'gamma' : {}\r\n },\r\n 'motion' : {\r\n 'x' : {},\r\n 'y' : {},\r\n 'z' : {}\r\n }\r\n };\r\n\r\n var globalAlpha, globalBeta, globalGamma, globalAccX, globalAccY, globalAccZ;\r\n\r\n function handleOrientation(event) {\r\n\r\n var alphaOffset = 0;\r\n var betaOffset = 0;\r\n var gammaOffset = 0;\r\n var alpha = 0;\r\n var beta = 0;\r\n var gamma = 0;\r\n if(isFirstTimeHyro){\r\n alphaOffset = event.alpha;\r\n betaOffset = event.beta;\r\n gammaOffset = event.gamma;\r\n isFirstTimeHyro = false;\r\n return;\r\n }\r\n\r\n alpha = event.alpha - alphaOffset;\r\n beta = event.beta - betaOffset;\r\n gamma = event.gamma - gammaOffset;\r\n globalAlpha = parseInt( alpha, 10 );\r\n globalBeta = parseInt( beta, 10 );\r\n globalGamma = parseInt( gamma, 10 );\r\n\r\n }\r\n\r\n function handleMotion(event) {\r\n\r\n globalAccX = parseInt( event.accelerationIncludingGravity.x, 10 );\r\n globalAccY = parseInt( event.accelerationIncludingGravity.y, 10 );\r\n globalAccZ = parseInt( event.accelerationIncludingGravity.z, 10 );\r\n\r\n }\r\n\r\n var collect = setInterval( function(){\r\n var timestamp = ( + new Date() );\r\n output.orientation.alpha[timestamp] = globalAlpha;\r\n output.orientation.beta[timestamp] = globalBeta;\r\n output.orientation.gamma[timestamp] = globalGamma;\r\n output.motion.x[timestamp] = globalAccX;\r\n output.motion.y[timestamp] = globalAccY;\r\n output.motion.z[timestamp] = globalAccZ;\r\n ctSetCookieSec(\"abpct_hyro_acc_collect\", JSON.stringify(output))\r\n }, 1000 );\r\n setTimeout( function(){\r\n clearInterval( collect );\r\n }, 10000 );\r\n\r\n if (window.DeviceOrientationEvent) {\r\n apbct_attach_event_handler(window, \"deviceorientation\", handleOrientation);\r\n }\r\n if (window.DeviceMotionEvent) {\r\n apbct_attach_event_handler(window, \"devicemotion\", handleMotion);\r\n }\r\n\r\n\t// Ready function\r\n\tfunction apbct_ready(){\r\n\t\tctSetCookieSec(\"apbct_visible_fields\", 0);\r\n\t\tctSetCookieSec(\"apbct_visible_fields_count\", 0);\r\n\t\tsetTimeout(function(){\r\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\t\tform.onsubmit = function(event){\r\n\r\n\t\t\t\t\t// Get only fields\r\n\t\t\t\t\tvar elements = [];\r\n\t\t\t\t\tfor(var key in this.elements){\r\n\t\t\t\t\t\tif(!isNaN(+key))\r\n\t\t\t\t\t\t\telements[key] = this.elements[key];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Filter fields\r\n\t\t\t\t\telements = elements.filter(function(elem){\r\n\r\n\t\t\t\t\t\tvar pass = true;\r\n\r\n\t\t\t\t\t\t// Filter fields\r\n\t\t\t\t\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t\t\t\t\telem.value === \"\" // empty value\r\n\t\t\t\t\t\t){\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Filter elements with same names for type == radio\r\n\t\t\t\t\t\tif(elem.getAttribute(\"type\") === \"radio\"){\r\n\t\t\t\t\t\t\telements.forEach(function(el, j, els){\r\n\t\t\t\t\t\t\t\tif(elem.getAttribute('name') === el.getAttribute('name')){\r\n\t\t\t\t\t\t\t\t\tpass = false;\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// Visible fields count\r\n\t\t\t\t\tvar visible_fields_count = elements.length;\r\n\r\n\t\t\t\t\t// Visible fields\r\n\t\t\t\t\tvar visible_fields = '';\r\n\t\t\t\t\telements.forEach(function(elem, i, elements){\r\n\t\t\t\t\t\tvisible_fields += \" \" + elem.getAttribute(\"name\");\r\n\t\t\t\t\t});\r\n\t\t\t\t\tvisible_fields = visible_fields.trim();\r\n\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields\", visible_fields);\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields_count\", visible_fields_count);\r\n\r\n\t\t\t\t\t// Call previous submit action\r\n\t\t\t\t\tif(event.target.onsubmit_prev instanceof Function){\r\n\t\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n\t//(function(open) {\r\n\t// XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\r\n\t// this.addEventListener(\"readystatechange\", function() {\r\n\t// }, false);\r\n\t// open.call(this, method, url, async, user, pass);\r\n\t// };\r\n\t//})(XMLHttpRequest.prototype.open);\r\n\r\n}());\r\n\r\n// Capturing responses and output block message for unknown AJAX forms\r\njQuery(document).ajaxComplete(function(event, xhr, settings) {\r\n\tif(xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1){\r\n\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\tif(typeof response.apbct !== 'undefined'){\r\n\t\t\tvar response = response.apbct;\r\n\t\t\tif(response.blocked){\r\n\t\t\t\talert(response.comment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\n\r\nfunction apbct_sendAJAXRequest(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(data);\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout\r\n\t});\r\n}"]}
|
1 |
+
{"version":3,"sources":["apbct-public.js"],"names":["apbct_js_keys__set_input_value","result","data","params","obj","document","getElementById","input_name","ct_input_value","value","replace","js_key","apbct_sendAJAXRequest","callback","notJson","timeout","_ajax_nonce","ctPublic","jQuery","ajax","type","url","_ajax_url","success","JSON","parse","error","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctSetCookieSec","c_name","cookie","encodeURIComponent","apbct_attach_event_handler","elem","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","Math","floor","setTimeout","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","stringify","ctFunctionMouseMove","push","round","clientY","clientX","clearInterval","globalAlpha","globalBeta","globalGamma","globalAccX","globalAccY","globalAccZ","isFirstTimeHyro","output","orientation","alpha","beta","gamma","motion","x","y","z","collect","timestamp","DeviceOrientationEvent","alphaOffset","betaOffset","gammaOffset","parseInt","DeviceMotionEvent","accelerationIncludingGravity","i","forms","length","form","onsubmit_prev","onsubmit","elements","key","this","isNaN","visible_fields_count","filter","getComputedStyle","display","visibility","opacity","getAttribute","forEach","el","j","els","visible_fields","trim","target","Function","call","ajaxComplete","xhr","settings","response","responseText","indexOf","apbct","blocked","alert","comment"],"mappings":"AA4PA,SAASA,+BAA+BC,EAAQC,EAAMC,EAAQC,GAC7D,GAAmD,OAA/CC,SAASC,eAAeH,EAAOI,YAAsB,CACxD,IAAIC,EAAiBH,SAASC,eAAeH,EAAOI,YAAYE,MAChEJ,SAASC,eAAeH,EAAOI,YAAYE,MAAQJ,SAASC,eAAeH,EAAOI,YAAYE,MAAMC,QAAQF,EAAgBP,EAAOU,SAIrI,SAASC,sBAAsBV,EAAMC,EAAQC,GAG5C,IAAIS,EAAcV,EAAOU,UAAe,KACpCC,EAAcX,EAAOW,SAAe,KACpCC,EAAcZ,EAAOY,SAAe,KACpCX,EAAcA,GAAsB,KAExCF,EAAKc,YAAcC,SAASD,YAE5BE,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKJ,SAASK,UACdpB,KAAMA,EACNqB,QAAS,SAAStB,GACba,IAASb,EAASuB,KAAKC,MAAMxB,IAC9BA,EAAOyB,OAGNb,GACFA,EAASZ,EAAQC,EAAMC,EAAQC,IAGlCsB,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAI,oBACZD,QAAQC,IAAI7B,GACZ4B,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbd,QAASA,KAjSV,WAEA,IAAIiB,EAAU,IAAIC,KACjBC,GAAW,IAAID,MAAOE,UACtBC,GAAwB,EACxBC,EAAc,GACdC,EAA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AAIG,EAAO1F,SAASwF,MAAMD,GAE1BG,EAAKC,cAAgBD,EAAKE,SAC1BF,EAAKE,SAAW,SAASpD,GAGxB,IAAIqD,EAAW,GACf,IAAI,IAAIC,KAAOC,KAAKF,SACfG,OAAOF,KACVD,EAASC,GAAOC,KAAKF,SAASC,IAkChC,IAAIG,GA9BJJ,EAAWA,EAASK,OAAO,SAAS3D,GAKnC,MAA0C,SAAtC4D,iBAAiB5D,GAAM6D,SACY,WAAtCD,iBAAiB5D,GAAM8D,YACe,MAAtCF,iBAAiB5D,GAAM+D,SACe,WAAtC/D,EAAKgE,aAAa,SACoB,WAAtChE,EAAKgE,aAAa,SACoB,KAAtChE,EAAKnC,OACiC,OAAtCmC,EAAKgE,aAAa,UAMc,UAA9BhE,EAAKgE,aAAa,SACpBV,EAASW,QAAQ,SAASC,EAAIC,EAAGC,GAC7BpE,EAAKgE,aAAa,UAAYE,EAAGF,aAAa,UACzC,KAMH,MAI4Bd,OAGhCmB,EAAiB,GACrBf,EAASW,QAAQ,SAASjE,EAAMgD,EAAGM,GAClCe,GAAkB,IAAMrE,EAAKgE,aAAa,UAI3CrE,EAAe,uBAFf0E,EAAiBA,EAAeC,QAGhC3E,EAAe,6BAA8B+D,GAG1CzD,EAAMsE,OAAOnB,yBAAyBoB,UACxC9D,WAAW,WACVT,EAAMsE,OAAOnB,cAAcqB,KAAKxE,EAAMsE,OAAQtE,IAC5C,QAIJ,OAjOL,GAgPA3B,OAAOb,UAAUiH,aAAa,SAASzE,EAAO0E,EAAKC,GAEjD,IAEKC,EAHHF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAaC,QAAQ,gBAElB,KADzBF,EAAWjG,KAAKC,MAAM8F,EAAIG,eACXE,QACdH,EAAWA,EAASG,OACZC,SACXC,MAAML,EAASM","file":"apbct-public.min.js","sourcesContent":["(function() {\r\n\r\n\tvar ct_date = new Date(),\r\n\t\tctTimeMs = new Date().getTime(),\r\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\t\tctMouseData = [],\r\n\t\tctMouseDataCounter = 0;\r\n\r\n\tfunction ctSetCookieSec(c_name, value) {\r\n\t\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/\";\r\n\t}\r\n\r\n\tfunction apbct_attach_event_handler(elem, event, callback){\r\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\t\telse elem.attachEvent(event, callback);\r\n\t}\r\n\r\n\tfunction apbct_remove_event_handler(elem, event, callback){\r\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\t\telse elem.detachEvent(event, callback);\r\n\t}\r\n\r\n\tctSetCookieSec(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\n\tctSetCookieSec(\"ct_fkp_timestamp\", \"0\");\r\n\tctSetCookieSec(\"ct_pointer_data\", \"0\");\r\n\tctSetCookieSec(\"ct_timezone\", \"0\");\r\n\r\n\tsetTimeout(function(){\r\n\t\tctSetCookieSec(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n\t},1000);\r\n\r\n\t//Writing first key press timestamp\r\n\tvar ctFunctionFirstKey = function output(event){\r\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\t\tctSetCookieSec(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\t\tctKeyStopStopListening();\r\n\t};\r\n\r\n\t//Reading interval\r\n\tvar ctMouseReadInterval = setInterval(function(){\r\n\t\tctMouseEventTimerFlag = true;\r\n\t}, 150);\r\n\r\n\t//Writting interval\r\n\tvar ctMouseWriteDataInterval = setInterval(function(){\r\n\t\tctSetCookieSec(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n\t}, 1200);\r\n\r\n\t//Logging mouse position each 150 ms\r\n\tvar ctFunctionMouseMove = function output(event){\r\n\t\tif(ctMouseEventTimerFlag === true){\r\n\r\n\t\t\tctMouseData.push([\r\n\t\t\t\tMath.round(event.clientY),\r\n\t\t\t\tMath.round(event.clientX),\r\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t\t]);\r\n\r\n\t\t\tctMouseDataCounter++;\r\n\t\t\tctMouseEventTimerFlag = false;\r\n\t\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\t\tctMouseStopData();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//Stop mouse observing function\r\n\tfunction ctMouseStopData(){\r\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\t\tclearInterval(ctMouseReadInterval);\r\n\t\tclearInterval(ctMouseWriteDataInterval);\r\n\t}\r\n\r\n\t//Stop key listening function\r\n\tfunction ctKeyStopStopListening(){\r\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\t}\r\n\r\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n\t// Hyroscope && Accelerometer data\r\n\r\n var isFirstTimeHyro = true;\r\n\r\n var output = {\r\n 'orientation' : {\r\n 'alpha' : {},\r\n 'beta' : {},\r\n 'gamma' : {}\r\n },\r\n 'motion' : {\r\n 'x' : {},\r\n 'y' : {},\r\n 'z' : {}\r\n }\r\n };\r\n\r\n var globalAlpha, globalBeta, globalGamma, globalAccX, globalAccY, globalAccZ;\r\n\r\n function handleOrientation(event) {\r\n\r\n var alphaOffset = 0;\r\n var betaOffset = 0;\r\n var gammaOffset = 0;\r\n var alpha = 0;\r\n var beta = 0;\r\n var gamma = 0;\r\n if(isFirstTimeHyro){\r\n alphaOffset = event.alpha;\r\n betaOffset = event.beta;\r\n gammaOffset = event.gamma;\r\n isFirstTimeHyro = false;\r\n return;\r\n }\r\n\r\n alpha = event.alpha - alphaOffset;\r\n beta = event.beta - betaOffset;\r\n gamma = event.gamma - gammaOffset;\r\n globalAlpha = parseInt( alpha, 10 );\r\n globalBeta = parseInt( beta, 10 );\r\n globalGamma = parseInt( gamma, 10 );\r\n\r\n }\r\n\r\n function handleMotion(event) {\r\n\r\n globalAccX = parseInt( event.accelerationIncludingGravity.x, 10 );\r\n globalAccY = parseInt( event.accelerationIncludingGravity.y, 10 );\r\n globalAccZ = parseInt( event.accelerationIncludingGravity.z, 10 );\r\n\r\n }\r\n\r\n var collect = setInterval( function(){\r\n var timestamp = ( + new Date() );\r\n output.orientation.alpha[timestamp] = globalAlpha;\r\n output.orientation.beta[timestamp] = globalBeta;\r\n output.orientation.gamma[timestamp] = globalGamma;\r\n output.motion.x[timestamp] = globalAccX;\r\n output.motion.y[timestamp] = globalAccY;\r\n output.motion.z[timestamp] = globalAccZ;\r\n ctSetCookieSec(\"abpct_hyro_acc_collect\", JSON.stringify(output))\r\n }, 1000 );\r\n setTimeout( function(){\r\n clearInterval( collect );\r\n }, 10000 );\r\n\r\n if (window.DeviceOrientationEvent) {\r\n apbct_attach_event_handler(window, \"deviceorientation\", handleOrientation);\r\n }\r\n if (window.DeviceMotionEvent) {\r\n apbct_attach_event_handler(window, \"devicemotion\", handleMotion);\r\n }\r\n\r\n\t// Ready function\r\n\tfunction apbct_ready(){\r\n\t\tctSetCookieSec(\"apbct_visible_fields\", 0);\r\n\t\tctSetCookieSec(\"apbct_visible_fields_count\", 0);\r\n\t\tsetTimeout(function(){\r\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\t\tform.onsubmit = function(event){\r\n\r\n\t\t\t\t\t// Get only fields\r\n\t\t\t\t\tvar elements = [];\r\n\t\t\t\t\tfor(var key in this.elements){\r\n\t\t\t\t\t\tif(!isNaN(+key))\r\n\t\t\t\t\t\t\telements[key] = this.elements[key];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Filter fields\r\n\t\t\t\t\telements = elements.filter(function(elem){\r\n\r\n\t\t\t\t\t\tvar pass = true;\r\n\r\n\t\t\t\t\t\t// Filter fields\r\n\t\t\t\t\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t\t\t\t\telem.value === \"\" || // empty value\r\n\t\t\t\t\t\t\telem.getAttribute('name') === null\r\n\t\t\t\t\t\t){\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Filter elements with same names for type == radio\r\n\t\t\t\t\t\tif(elem.getAttribute(\"type\") === \"radio\"){\r\n\t\t\t\t\t\t\telements.forEach(function(el, j, els){\r\n\t\t\t\t\t\t\t\tif(elem.getAttribute('name') === el.getAttribute('name')){\r\n\t\t\t\t\t\t\t\t\tpass = false;\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// Visible fields count\r\n\t\t\t\t\tvar visible_fields_count = elements.length;\r\n\r\n\t\t\t\t\t// Visible fields\r\n\t\t\t\t\tvar visible_fields = '';\r\n\t\t\t\t\telements.forEach(function(elem, i, elements){\r\n\t\t\t\t\t\tvisible_fields += \" \" + elem.getAttribute(\"name\");\r\n\t\t\t\t\t});\r\n\t\t\t\t\tvisible_fields = visible_fields.trim();\r\n\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields\", visible_fields);\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields_count\", visible_fields_count);\r\n\r\n\t\t\t\t\t// Call previous submit action\r\n\t\t\t\t\tif(event.target.onsubmit_prev instanceof Function){\r\n\t\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n\t//(function(open) {\r\n\t// XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\r\n\t// this.addEventListener(\"readystatechange\", function() {\r\n\t// }, false);\r\n\t// open.call(this, method, url, async, user, pass);\r\n\t// };\r\n\t//})(XMLHttpRequest.prototype.open);\r\n\r\n}());\r\n\r\n// Capturing responses and output block message for unknown AJAX forms\r\njQuery(document).ajaxComplete(function(event, xhr, settings) {\r\n\tif(xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1){\r\n\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\tif(typeof response.apbct !== 'undefined'){\r\n\t\t\tvar response = response.apbct;\r\n\t\t\tif(response.blocked){\r\n\t\t\t\talert(response.comment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\n\r\nfunction apbct_sendAJAXRequest(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(data);\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout\r\n\t});\r\n}"]}
|
js/cleantalk-admin-settings-page.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function
|
2 |
//# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
|
1 |
+
function apbct_get_elems(e){for(var t,n=0,c=(e=e.split(",")).length;n<c;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){apbct_toggleAtrribute(jQuery(t),"disabled")})}function apbct_toggleAtrribute(e,t,n){n=n||t,void 0===e.attr(t)?e.attr(t,n):e.removeAttr(t)}function apbct_settings__showDescription(e,t){var i=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",i))};i(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,c){c.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",i)}},n)}jQuery(document).ready(function(){jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))})});
|
2 |
//# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
|
js/cleantalk-admin-settings-page.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-admin-settings-page.js"],"names":["
|
1 |
+
{"version":3,"sources":["cleantalk-admin-settings-page.js"],"names":["apbct_get_elems","elems","tmp","i","len","split","length","jQuery","apbct_show_hide_elem","each","elem","label","next","prev","is","hide","show","apbctSettingsDependencies","apbct_toggleAtrribute","attribute","value","attr","removeAttr","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","document","off","after","obj","append","css","top","position","left","apbct_sendAJAX","action","spinner","children","callback","result","data","params","empty","title","desc","on","ready","val","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","self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GACtCU,EAAIC,OAAO,2CACTA,OAAO,8CACPC,IAAI,CACJC,IAAK1B,EAAM2B,WAAWD,IAAM,EAC5BE,KAAM5B,EAAM2B,WAAWC,KAAO,KAIhCC,eACC,CAACC,OAAQ,kCAAmCjB,WAAYA,GACxD,CACCkB,QAASR,EAAIS,SAAS,OACtBC,SAAU,SAASC,EAAQC,EAAMC,EAAQb,GAExCA,EAAIc,QACFb,OAAO,8CACPA,OAAO,uDACPA,OAAO,sCAAsCU,EAAOI,MAAM,SAC1Dd,OAAO,MAAMU,EAAOK,KAAK,QAE3B3C,OAAOwB,UAAUoB,GAAG,QAAS1B,KAG/BS,GA9HF3B,OAAOwB,UAAUqB,MAAM,WAGnB7C,OAAO,qBAAqB4C,GAAG,QAAS,WACpC5C,OAAO,2BAA2B8C,IAAI9C,OAAO,2BAA2Bc,KAAK,QAC7Ed,OAAO,+BAA+BS,OACtCT,OAAO+C,MAAMC,QAAQ,OAG5B,IAAIC,EAAI,IAAIC,KACZlD,OAAO,sBAAsB8C,IAAIG,EAAEE,oBAAoB,IAAK,GAG5DnD,OAAO,0BAA0B4C,GAAG,QAAS,WAC5C5C,OAAO,gBAAgBoD,OAAO,CAC7BC,OAAM,EACN5C,MAAM,EACNsB,SAAU,CAAEuB,GAAI,SAAUC,GAAI,SAAUC,GAAIC,QAC5CC,OAAS1D,OAAO,WAAW0D,QAAU,IAAM,GAC3CC,OAAQ,OACRjB,MAAO,kBACPkB,WAAW,EACXC,WAAW,EACXC,UAAW,YAIb9D,OAAOwB,UAAUoB,GAAG,QAAS,0CAA2C,WACvEmB,KAAO/D,OAAO+C,MACd/B,gCAAgC+C,KAAMA,KAAKjD,KAAK","file":"cleantalk-admin-settings-page.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\r\n // Show/Hide access key\r\n jQuery('#apbct_showApiKey').on('click', function(){\r\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\r\n jQuery('.apbct_setting---apikey+div').show();\r\n jQuery(this).fadeOut(300);\r\n });\r\n\r\n\tvar d = new Date();\r\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\r\n\t\r\n\t// GDPR modal window\r\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\r\n\t\tjQuery('#gdpr_dialog').dialog({\r\n\t\t\tmodal:true, \r\n\t\t\tshow: true,\r\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\r\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\r\n\t\t\theight: 'auto',\r\n\t\t\ttitle: 'GDPR compliance',\r\n\t\t\tdraggable: false,\r\n\t\t\tresizable: false,\r\n\t\t\tcloseText: \"Close\",\r\n\t\t});\r\n\t});\r\n\r\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\r\n\t\tself = jQuery(this);\r\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\r\n\t});\r\n\r\n});\r\n\r\nfunction apbct_get_elems(elems){\r\n elems = elems.split(',');\r\n for( var i=0, len = elems.length, tmp; i < len; i++){\r\n tmp = jQuery('#'+elems[i]);\r\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\r\n }\r\n return elems;\r\n\r\n}\r\n\r\nfunction apbct_show_hide_elem(elems){\r\n\telems = apbct_get_elems(elems);\r\n for( var i=0, len = elems.length; i < len; i++){\r\n elems[i].each(function (i, elem) {\r\n elem = jQuery(elem);\r\n var label = elem.next('label') || elem.prev('label') || null;\r\n if (elem.is(\":visible\")) {\r\n elem.hide();\r\n if (label) label.hide();\r\n } else {\r\n elem.show();\r\n if (label) label.show();\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Settings dependences\r\n *\r\n * @param elems CSS selector\r\n */\r\nfunction apbctSettingsDependencies(elems){\r\n elems = apbct_get_elems(elems);\r\n for( var i=0, len = elems.length; i < len; i++){\r\n elems[i].each(function (i, elem) {\r\n apbct_toggleAtrribute(jQuery(elem), 'disabled');\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Toggle attribute 'disabled' for elements\r\n *\r\n * @param elem\r\n * @param attribute\r\n * @param value\r\n */\r\nfunction apbct_toggleAtrribute(elem, attribute, value){\r\n value = value || attribute;\r\n if(typeof elem.attr(attribute) === 'undefined')\r\n elem.attr(attribute, value);\r\n else\r\n elem.removeAttr(attribute);\r\n}\r\n\r\nfunction apbct_settings__showDescription(label, setting_id){\r\n\r\n\tvar remove_desc_func = function(e){\r\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\r\n\t\t\tjQuery('.apbct_long_desc').remove();\r\n\t\t\tjQuery(document).off('click', remove_desc_func);\r\n\t\t}\r\n\t};\r\n\r\n\tremove_desc_func();\r\n\r\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\r\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\r\n\tobj.append(\"<i class='icon-spin1 animate-spin'></i>\")\r\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t.css({\r\n\t\t\ttop: label.position().top - 5,\r\n\t\t\tleft: label.position().left + 25\r\n\t\t});\r\n\r\n\r\n\tapbct_sendAJAX(\r\n\t\t{action: 'apbct_settings__get_description', setting_id: setting_id},\r\n\t\t{\r\n\t\t\tspinner: obj.children('img'),\r\n\t\t\tcallback: function(result, data, params, obj){\r\n\r\n\t\t\t\tobj.empty()\r\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel icon-cancel'></i>\")\r\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\r\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\r\n\r\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\r\n\t\t\t}\r\n\t\t},\r\n\t\tobj\r\n\t);\r\n}"]}
|
js/cleantalk-admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6);document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap")});
|
2 |
//# sourceMappingURL=cleantalk-admin.min.js.map
|
1 |
+
function apbct_sendAJAX(n,o,t){var r=o.callback||null,l=o.notJson||null,e=o.timeout||15e3,a=(t=t||null,o.button||null),s=o.spinner||null,u=o.progressbar||null;a&&(a.setAttribute("disabled","disabled"),a.style.cursor="not-allowed"),s&&jQuery(s).css("display","inline"),n._ajax_nonce=ctAdminCommon._ajax_nonce,jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,success:function(e){a&&(a.removeAttribute("disabled"),a.style.cursor="pointer"),s&&jQuery(s).css("display","none"),l||(e=JSON.parse(e)),e.error?(setTimeout(function(){u&&u.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):r&&r(e,n,o,t)},error:function(e,n,o){a&&(a.removeAttribute("disabled"),a.style.cursor="pointer"),s&&jQuery(s).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o),o&&alert(o)},timeout:e})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6);document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap")});
|
2 |
//# sourceMappingURL=cleantalk-admin.min.js.map
|
js/cleantalk-admin.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-admin.js"],"names":["jQuery","document","ready","on","ct_date","Date","getTime","cookie","toUTCString"
|
1 |
+
{"version":3,"sources":["cleantalk-admin.js"],"names":["apbct_sendAJAX","data","params","obj","callback","notJson","timeout","button","spinner","progressbar","setAttribute","style","cursor","jQuery","css","_ajax_nonce","ctAdminCommon","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","cookie","toUTCString"],"mappings":"AAYA,SAASA,eAAeC,EAAMC,EAAQC,GAGrC,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAcH,EAAOG,SAAe,KACpCC,EAAcJ,EAAOI,SAAe,KAEpCC,GADAJ,EAAcA,GAAsB,KACtBD,EAAOK,QAAe,MACpCC,EAAcN,EAAOM,SAAe,KACpCC,EAAcP,EAAOO,aAAe,KAGrCF,IAAUA,EAAOG,aAAa,WAAY,YAAaH,EAAOI,MAAMC,OAAS,eAC7EJ,GAASK,OAAOL,GAASM,IAAI,UAAW,UAG3Cb,EAAKc,YAAcC,cAAcD,YAEjCF,OAAOI,KAAK,CACXC,KAAM,OACNC,IAAKH,cAAcI,UACnBnB,KAAMA,EACNoB,QAAS,SAASC,GACdf,IAAUA,EAAOgB,gBAAgB,YAAahB,EAAOI,MAAMC,OAAS,WACpEJ,GAAUK,OAAOL,GAASM,IAAI,UAAW,QACxCT,IAASiB,EAASE,KAAKC,MAAMH,IAC9BA,EAAOI,OACTC,WAAW,WAAelB,GAAaA,EAAYmB,QAAQ,SAAY,KACvEC,MAAM,mBAAqBP,EAAOI,OAAS,YAExCtB,GACFA,EAASkB,EAAQrB,EAAMC,EAAQC,IAGlCuB,MAAO,SAASI,EAAOC,EAAYC,GAC/BzB,IAAUA,EAAOgB,gBAAgB,YAAahB,EAAOI,MAAMC,OAAS,WACpEJ,GAASK,OAAOL,GAASM,IAAI,UAAW,QAC3CmB,QAAQC,IAAI,oBACZD,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,GACTA,GACFH,MAAMG,IAER1B,QAASA,IAxDXO,OAAOsB,UAAUC,MAAM,WAGtBvB,OAAO,wBAAwBwB,GAAG,QAAS,SAAU,WACpD,IAAIC,EAAU,IAAIC,MAAK,IAAIA,MAAOC,UAAY,QAC9CL,SAASM,OAAS,iDAAmDH,EAAQI,gBAG9E7B,OAAO,mDAAmDC,IAAI,cAAc","file":"cleantalk-admin.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\t\r\n\t// Auto update banner close handler\r\n\tjQuery('.apbct_update_notice').on('click', 'button', function(){\r\n\t\tvar ct_date = new Date(new Date().getTime() + 1000 * 86400 * 30 );\r\n\t\tdocument.cookie = \"apbct_update_banner_closed=1; path=/; expires=\" + ct_date.toUTCString();\r\n\t});\r\n\t\r\n\tjQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space','nowrap');\r\n\t\r\n});\r\n\r\nfunction apbct_sendAJAX(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\tvar button = params.button || null;\r\n\tvar spinner = params.spinner || null;\r\n\tvar progressbar = params.progressbar || null;\r\n\r\n\t// Button and spinner\r\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\r\n\tif(spinner) jQuery(spinner).css('display', 'inline');\r\n\r\n\t// Adding security code\r\n\tdata._ajax_nonce = ctAdminCommon._ajax_nonce;\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctAdminCommon._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\r\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t\tif(errorThrown)\r\n\t\t\t\talert(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout,\r\n\t});\r\n}"]}
|
js/cleantalk-comments-checkspam.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-comments-checkspam.js"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","parseJSON","parseInt","error","confirm","error_message","new_href","location","href","end","document","cookie","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_insert_comments","delete_comments","alert","ct_comments_deleted","ct_comments_added_after","ct_comments_added","ct_delete_all","ct_delete_checked","ids","Array","cnt","each","prop","attr","ct_toggle_depended","obj","secondary","depended","removeProp","ready","state","val","on","dates","datepicker","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","is","click","ct_check","accurate","from","till","JSON","stringify","ct_confirm_deletion_all","animate","scrollTop","ct_confirm_deletion_checked","remove","mouseover","mouseout","ct_id","fadeOut","comment_id","comment_status","start","Date","toUTCString"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAAY,CAC9B,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,gBAAgBD,iBACnCE,aAAeD,gBAAgBC,aAC/BC,aAAeF,gBAAgBE,aAE5BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,gBAAgBM,cACnCC,kBAAoB,EACpBC,oBAAsB,EACtBC,iBAAmB,EACnBC,gBAAkB,EAClBC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,KAGnBC,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,GAAIE,KAItBpB,kBAAiB,EAInB,SAASuB,oBAER,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYhB,eAGbW,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACjBC,eACAC,sBAOH,SAASC,yBACRpC,sBAAuB,EACvBmC,mBACAD,eAGD,SAASC,mBAER,GAA2B,GAAxBnC,qBAAH,C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AMwF,KAAK,WACvBzD,OAAO,yBAAyBD,IAAIyC,SAErCxC,OAAO,sBAAsBmG,SAAS,WACrCpG,GAAKC,OAAO/B,MAAMwF,KAAK,WACvBzD,OAAO,yBAAyBD,IAAI8B,SAIrC7B,OAAO,sCAAsCsF,MAAM,WAClD,IAAIc,EAAQpG,OAAO/B,MAAMwF,KAAK,WAG1BtD,EAAO,CACVC,OAAU,0BACVC,SAAYhB,cACZU,GAAMqG,GAEPpG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACjBX,OAAO,YAAYoG,GAAOC,QAAQ,OAAQ,WACzCrG,OAAO,YAAYoG,GAAOH,cAMzB9F,EAAO,CACVC,OAAU,sBACVC,SAAYhB,cACZiH,WAAcF,EACdG,eAAkB,WAEnBvG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,KAWlBS,MAAO,SAASiB,EAAOC,EAAYC,KAGnCE,QAAS,QAGkB,MAA1B1D,gBAAgByH,QAClB7E,SAASC,OAAS,sCAAwC,IAAI6E,KAAK,GAAGC,cAAgB,WACtF1G,OAAO,yBAAyBsF","file":"cleantalk-comments-checkspam.min.js","sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\n\tct_comments_total = 0,\n\tct_comments_checked = 0,\n\tct_comments_spam = 0,\n\tct_comments_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to==0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_comments(){\n\t\n\tvar data = {\n\t\t'action': 'ajax_clear_comments',\n\t\t'security': ct_ajax_nonce\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}\n\t});\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_comments();\n\tct_show_info();\n}\n\nfunction ct_send_comments(){\n\t\n\tif(ct_cooling_down_flag == true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\t\n\tvar data = {\n\t\t'action': 'ajax_check_comments',\n\t\t'security': ct_ajax_nonce,\n\t\t'new_check': ct_new_check,\n\t\t'unchecked': ct_unchecked\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_comments();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_comments_check=0; path=/';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_comments_checked = +ct_comments_checked + +msg.checked;\n\t\t\t\t\tct_comments_spam = +ct_comments_spam + +msg.spam;\n\t\t\t\t\tct_comments_bad = +ct_comments_bad + +msg.bad;\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_total, ct_comments_checked, ct_comments_spam, ct_comments_bad);\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\t// If DB woks not properly\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/';\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_safe_check=1; path=/';\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\t}\n\t\t\t\t\tct_send_comments();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_send_comments(), 3000); \n },\n timeout: 25000\n\t});\n}\nfunction ct_show_info(){\n\t\n\tif(ct_working){\n\t\t\n\t\tif(ct_cooling_down_flag == true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\n\t\t\tjQuery('#ct_cooling_notice').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\t\n\t\t\n\t\tsetTimeout(ct_show_info, 3000);\n\t\t\n\t\tif(!ct_comments_total){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_comments',\n\t\t\t\t'security': ct_ajax_nonce\n\t\t\t};\n\t\t\t\n\t\t\tif(ct_date_from && ct_date_till){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_comments_total = msg.total;\n\t\t\t\t\tct_comments_spam = msg.spam;\n\t\t\t\t\tct_comments_checked = msg.checked;\n\t\t\t\t\tct_comments_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\nfunction ct_insert_comments(delete_comments){\n\n delete_comments = delete_comments || null;\n\n\tvar data = {\n\t\t'action': 'ajax_insert_comments',\n\t\t'security': ct_ajax_nonce\n\t};\n\t\n\tif(delete_comments)\n\t\tdata['delete'] = true;\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tif(delete_comments)\n\t\t\t\talert(ctCommentsCheck.ct_comments_deleted + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);\n\t\t\telse\n\t\t\t\talert(ctCommentsCheck.ct_comments_added + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);\n\t\t}\n\t});\n}\nfunction ct_delete_all(){\n\t\n\tvar data = {\n\t\t'action': 'ajax_delete_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tif(msg>0){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_delete_all();\n\t\t\t}else{\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\t\t\t\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_delete_all(), 3000); \n\t\t},\n\t\ttimeout: 25000\n\t});\n}\nfunction ct_delete_checked(){\n\t\n\tids=Array();\n\tvar cnt=0;\n\tjQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){\n\t\tif(jQuery(this).prop('checked')){\n\t\t\tids[cnt]=jQuery(this).attr('id').substring(10);\n\t\t\tcnt++;\n\t\t}\n\t});\n\tvar data = {\n\t\t'action': 'ajax_delete_checked',\n\t\t'security': ct_ajax_nonce,\n\t\t'ids':ids\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_delete_checked(), 3000); \n\t\t},\n\t\ttimeout: 15000\n\t});\n}\n\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\njQuery(document).ready(function(){\n\t\n\t// Setting dependences\n\t// jQuery('#ct_accurate_check') .data({'depended': '#ct_allow_date_range', 'state': false});\n\tjQuery('#ct_allow_date_range').data({'depended': '.ct_date', 'state': false});\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range, #ct_accurate_check\").on('change', function(){\n\t\tct_toggle_depended(jQuery(this));\n\t});\n\t\t\t\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'yy-mm-dd',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t}\n\t\t}\n\t);\n\t\n\tfunction ct_start_check(continue_check){\n\n continue_check = continue_check || null;\n\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\t\t\t\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val(),\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\t\t\t\t\t\t\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\n\t\t\t\talert('Please, specify a date range.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\t\tct_accurate_check = true;\n\t\t}\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_working_message').show();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_pause').show();\n\n\t\tct_working=true;\n\t\t\n\t\tif(continue_check){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}else\n\t\t\tct_clear_comments();\n\t\t\n\t}\n\t\n\t// Check comments\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_comments_check=0; path=/';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_comments_check=' + JSON.stringify(ct_check) + '; path=/';\n\t});\n\t\n\tjQuery(\"#ct_insert_comments\").click(function(){\n\t\tct_insert_comments();\n\t});\n\t\n\tjQuery(\"#ct_delete_comments\").click(function(){\n\t\tct_insert_comments(true);\n\t});\n\t\n\t// Delete all spam comments\n\tjQuery(\"#ct_delete_all\").click(function(){\n\t\t\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_deletion_all))\n\t\t\treturn false;\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_checking_status').hide();\n\t\tjQuery('#ct_search_info').hide();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_deleting_message').show();\n\t\tjQuery('#ct_stop_deletion').show();\n\t\tjQuery(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n\t\tct_delete_all();\n\t});\n\tjQuery(\"#ct_delete_checked\").click(function(){\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_deletion_checked))\n\t\t\treturn false;\n\t\tct_delete_checked();\n\t});\n\t\n\tjQuery(\"#ct_stop_deletion\").click(function(){\n\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t});\n\t\n\tjQuery(\".cleantalk_delete_button\").click(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tids=Array();\n\t\tids[0]=id;\n\t\tvar data = {\n\t\t\t'action': 'ajax_delete_checked',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'ids':ids\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tct_close_animate=false;\n\t\t\t\tjQuery(\"#comment-\"+id).hide();\n\t\t\t\tjQuery(\"#comment-\"+id).remove();\n\t\t\t\tct_close_animate=true;\n\t\t\t}\n\t\t});\n\t});\n\t\n\tjQuery(\".cleantalk_delete_button\").click(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tanimate_comment(0.3, id);\n\t});\n\t\n\t//Show/hide action on mouse over/out\n\tjQuery(\".cleantalk_comment\").mouseover(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tjQuery(\"#cleantalk_button_set_\"+id).show();\n\t});\n\tjQuery(\".cleantalk_comment\").mouseout(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tjQuery(\"#cleantalk_button_set_\"+id).hide();\n\t});\n\t\n\t//Approve button\t\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tvar ct_id = jQuery(this).attr(\"data-id\");\n\t\t\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_comment',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\t\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_comment',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'comment_id': ct_id,\n\t\t\t'comment_status': 'approve'\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t});\n\tif(ctCommentsCheck.start === '1'){\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/';\n\t\tjQuery('#ct_check_spam_button').click();\t\n\t}\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk-comments-checkspam.js"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","parseJSON","parseInt","error","confirm","error_message","new_href","location","href","end","document","cookie","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_insert_comments","delete_comments","alert","ct_comments_deleted","ct_comments_added_after","ct_comments_added","ct_delete_all","ct_delete_checked","ids","Array","cnt","each","prop","attr","ct_toggle_depended","obj","secondary","depended","removeProp","ready","state","val","on","dates","datepicker","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","is","click","ct_check","accurate","from","till","JSON","stringify","ct_confirm_deletion_all","animate","scrollTop","ct_confirm_deletion_checked","remove","mouseover","mouseout","ct_id","fadeOut","comment_id","comment_status","start","Date","toUTCString"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAAY,CAC9B,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,gBAAgBD,iBACnCE,aAAeD,gBAAgBC,aAC/BC,aAAeF,gBAAgBE,aAE5BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,gBAAgBM,cACnCC,kBAAoB,EACpBC,oBAAsB,EACtBC,iBAAmB,EACnBC,gBAAkB,EAClBC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,KAGnBC,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,GAAIE,KAItBpB,kBAAiB,EAInB,SAASuB,oBAER,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAY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AAYD,IAAIkG,SACvBtH,kBAAiB,OAKpBqB,OAAO,4BAA4BsF,MAAM,WACxCvF,GAAKC,OAAO/B,MAAMwF,KAAK,WACvB5D,gBAAgB,GAAKE,MAItBC,OAAO,sBAAsBkG,UAAU,WACtCnG,GAAKC,OAAO/B,MAAMwF,KAAK,WACvBzD,OAAO,yBAAyBD,IAAIyC,SAErCxC,OAAO,sBAAsBmG,SAAS,WACrCpG,GAAKC,OAAO/B,MAAMwF,KAAK,WACvBzD,OAAO,yBAAyBD,IAAI8B,SAIrC7B,OAAO,sCAAsCsF,MAAM,WAClD,IAAIc,EAAQpG,OAAO/B,MAAMwF,KAAK,WAG1BtD,EAAO,CACVC,OAAU,0BACVC,SAAYhB,cACZU,GAAMqG,GAEPpG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACjBX,OAAO,YAAYoG,GAAOC,QAAQ,OAAQ,WACzCrG,OAAO,YAAYoG,GAAOH,cAMzB9F,EAAO,CACVC,OAAU,sBACVC,SAAYhB,cACZiH,WAAcF,EACdG,eAAkB,WAEnBvG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,KAWlBS,MAAO,SAASiB,EAAOC,EAAYC,KAGnCE,QAAS,QAGkB,MAA1B1D,gBAAgByH,QAClB7E,SAASC,OAAS,sCAAwC,IAAI6E,KAAK,GAAGC,cAAgB,WACtF1G,OAAO,yBAAyBsF","file":"cleantalk-comments-checkspam.min.js","sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\r\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\r\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\r\n\tct_comments_total = 0,\r\n\tct_comments_checked = 0,\r\n\tct_comments_spam = 0,\r\n\tct_comments_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to==0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_comments(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_clear_comments',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_info();\r\n\t\t\tct_send_comments();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_comments();\r\n\tct_show_info();\r\n}\r\n\r\nfunction ct_send_comments(){\r\n\t\r\n\tif(ct_cooling_down_flag == true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_check_comments',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'new_check': ct_new_check,\r\n\t\t'unchecked': ct_unchecked\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_comments();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_comments_check=0; path=/';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_comments_checked = +ct_comments_checked + +msg.checked;\r\n\t\t\t\t\tct_comments_spam = +ct_comments_spam + +msg.spam;\r\n\t\t\t\t\tct_comments_bad = +ct_comments_bad + +msg.bad;\r\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\r\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_total, ct_comments_checked, ct_comments_spam, ct_comments_bad);\r\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\t// If DB woks not properly\r\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\r\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/';\r\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_safe_check=1; path=/';\r\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tct_send_comments();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_send_comments(), 3000); \r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_info(){\r\n\t\r\n\tif(ct_working){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag == true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\r\n\t\t\tjQuery('#ct_cooling_notice').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\t\r\n\t\t\r\n\t\tsetTimeout(ct_show_info, 3000);\r\n\t\t\r\n\t\tif(!ct_comments_total){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_comments',\r\n\t\t\t\t'security': ct_ajax_nonce\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(ct_date_from && ct_date_till){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_comments_total = msg.total;\r\n\t\t\t\t\tct_comments_spam = msg.spam;\r\n\t\t\t\t\tct_comments_checked = msg.checked;\r\n\t\t\t\t\tct_comments_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\nfunction ct_insert_comments(delete_comments){\r\n\r\n delete_comments = delete_comments || null;\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_insert_comments',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tif(delete_comments)\r\n\t\tdata['delete'] = true;\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(delete_comments)\r\n\t\t\t\talert(ctCommentsCheck.ct_comments_deleted + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);\r\n\t\t\telse\r\n\t\t\t\talert(ctCommentsCheck.ct_comments_added + ' ' + msg + ' ' + ctCommentsCheck.ct_comments_added_after);\r\n\t\t}\r\n\t});\r\n}\r\nfunction ct_delete_all(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(msg>0){\r\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\r\n\t\t\t\tct_delete_all();\r\n\t\t\t}else{\r\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\r\n\t\t\t}\r\n\t\t},\t\t\t\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_delete_all(), 3000); \r\n\t\t},\r\n\t\ttimeout: 25000\r\n\t});\r\n}\r\nfunction ct_delete_checked(){\r\n\t\r\n\tids=Array();\r\n\tvar cnt=0;\r\n\tjQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){\r\n\t\tif(jQuery(this).prop('checked')){\r\n\t\t\tids[cnt]=jQuery(this).attr('id').substring(10);\r\n\t\t\tcnt++;\r\n\t\t}\r\n\t});\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_checked',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'ids':ids\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_delete_checked(), 3000); \r\n\t\t},\r\n\t\ttimeout: 15000\r\n\t});\r\n}\r\n\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Setting dependences\r\n\t// jQuery('#ct_accurate_check') .data({'depended': '#ct_allow_date_range', 'state': false});\r\n\tjQuery('#ct_allow_date_range').data({'depended': '.ct_date', 'state': false});\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range, #ct_accurate_check\").on('change', function(){\r\n\t\tct_toggle_depended(jQuery(this));\r\n\t});\r\n\t\t\t\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'yy-mm-dd',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\r\n\tfunction ct_start_check(continue_check){\r\n\r\n continue_check = continue_check || null;\r\n\r\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\t\t\t\r\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val(),\r\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\t\t\t\t\t\t\r\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\r\n\t\t\t\talert('Please, specify a date range.');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\t\tct_accurate_check = true;\r\n\t\t}\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_working_message').show();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_pause').show();\r\n\r\n\t\tct_working=true;\r\n\t\t\r\n\t\tif(continue_check){\r\n\t\t\tct_show_info();\r\n\t\t\tct_send_comments();\r\n\t\t}else\r\n\t\t\tct_clear_comments();\r\n\t\t\r\n\t}\r\n\t\r\n\t// Check comments\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_comments_check=0; path=/';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_comments_check=' + JSON.stringify(ct_check) + '; path=/';\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_insert_comments\").click(function(){\r\n\t\tct_insert_comments();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_delete_comments\").click(function(){\r\n\t\tct_insert_comments(true);\r\n\t});\r\n\t\r\n\t// Delete all spam comments\r\n\tjQuery(\"#ct_delete_all\").click(function(){\r\n\t\t\r\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_deletion_all))\r\n\t\t\treturn false;\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_checking_status').hide();\r\n\t\tjQuery('#ct_search_info').hide();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_deleting_message').show();\r\n\t\tjQuery('#ct_stop_deletion').show();\r\n\t\tjQuery(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\r\n\t\tct_delete_all();\r\n\t});\r\n\tjQuery(\"#ct_delete_checked\").click(function(){\r\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_deletion_checked))\r\n\t\t\treturn false;\r\n\t\tct_delete_checked();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_stop_deletion\").click(function(){\r\n\t\tlocation.href='edit-comments.php?page=ct_check_spam';\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tids=Array();\r\n\t\tids[0]=id;\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_delete_checked',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'ids':ids\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_close_animate=false;\r\n\t\t\t\tjQuery(\"#comment-\"+id).hide();\r\n\t\t\t\tjQuery(\"#comment-\"+id).remove();\r\n\t\t\t\tct_close_animate=true;\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tanimate_comment(0.3, id);\r\n\t});\r\n\t\r\n\t//Show/hide action on mouse over/out\r\n\tjQuery(\".cleantalk_comment\").mouseover(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_button_set_\"+id).show();\r\n\t});\r\n\tjQuery(\".cleantalk_comment\").mouseout(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_button_set_\"+id).hide();\r\n\t});\r\n\t\r\n\t//Approve button\t\r\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\r\n\t\tvar ct_id = jQuery(this).attr(\"data-id\");\r\n\t\t\r\n\t\t// Approving\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_approve_comment',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'id': ct_id\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\r\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t});\r\n\t\t\r\n\t\t// Positive feedback\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_comment',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'comment_id': ct_id,\r\n\t\t\t'comment_status': 'approve'\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\t// Success\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t});\r\n\tif(ctCommentsCheck.start === '1'){\r\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/';\r\n\t\tjQuery('#ct_check_spam_button').click();\t\r\n\t}\r\n});"]}
|
js/cleantalk-comments-editscreen.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-comments-editscreen.js"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg_whitelisted","ct_feedback_msg","is","ct_feedback_msg_blacklisted","document","ready","after","ctAdminCommon","logo_small_colored","spambutton_text","parseInt","ct_show_check_links","each","ct_curr_str","this","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCA2EnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,4BAA4B,IAAIzB,iBAAiB0B,gBAAgB,UAEtG,QAArB/B,IACCS,OAAO,MAAMuB,GAAG,SAASjC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiB4B,4BAA4B,IAAI5B,iBAAiB0B,kBAE/EtB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,OACAG,IAAI,aAAc,yBAClBF,OAAO,yBAAyBC,SAAS,MACxCD,OAAO,iCAAiCtB,iBAAiB4B,4BAA4B,IAAI5B,iBAAiB0B,gBAAgB,YAxHhItB,OAAOyB,UAAUC,MAAM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,EAAO,GACiB,UAAW,KAIpDtC,OAAO,kBAAkBqC,GAAG,QAAS,WACpC,IAAIC,EAAStC,OAAOmC,MAAMI,KAAK,QAC/BD,EAASA,EAAOE,MAAM,8BACtBlD,EAAgBgD,EAAO,GACvBM,gBAAkBvD,yBAAyBC,EAAe,UAAW","file":"cleantalk-comments-editscreen.min.js","sourcesContent":["function ct_is_email(str){\n\treturn str.search(/.*@.*\\..*/);\n}\nfunction ct_is_ip(str){\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\n}\n\njQuery(document).ready(function(){\n\t\n\t/* Shows \"Find spam users\" button */\n\tjQuery('#post-query-submit').after('<a href=\"edit-comments.php?page=ct_check_spam\" class=\"button\" style=\"margin:1px 0 0 0; display: inline-block;\">'+ctAdminCommon.logo_small_colored+' '+ctCommentsScreen.spambutton_text+'</a> ');\n\n\t/* Shows link to blacklists near every email and IP address */\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\n\t\t\tvar ct_curr_str = jQuery(this).html();\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\n\t\t\t\tjQuery(this).after(' <a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\n\t\t\t}\n\t\t});\n\t\t\n\t/* Feedback for comments */\n\tvar ct_comment_id;\n\t\n\t// For approved\n\tjQuery('span.approve').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\n\t\n\t// For unapprove\n\tjQuery('span.unapprove').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\n\t});\n\t\n\t// For spammed\n\tjQuery('span.spam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\n\t\t\n\t\tsetTimeout(function(){\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\n\t\t\t\tvar result = jQuery(this).attr('href');\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\n\t\t\t\tct_comment_id = result[1];\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\n\t\t\t});\n\t\t}, 202);\n\t\t\n\t});\n\t\n\t// For unspammed\n\tjQuery('span.unspam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\n\t});\n\t\n\t// For untrashed\n\tjQuery('span.untrash a').on('click', function(){\n\t\tvar result = jQuery(this).attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\t\n});\n\n// Send feedback to backend\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\n\t\n\tvar data = {\n\t\t'action': 'ct_feedback_comment',\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\n\t\t'comment_id': ct_comment_id,\n\t\t'comment_status': ct_comment_status\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n timeout: 5000\n\t});\n}\n\n// Outputs CT message about feedback\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\n\tif(ct_result == 1){\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg_whitelisted+\" \"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\t\t\t\t\t\t\n\t\t}\n\t\tif(ct_comment_status == 'spam'){\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg_blacklisted+\" \"+ctCommentsScreen.ct_feedback_msg);\n\t\t\t}else{\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg_blacklisted+\" \"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\t\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tif(ct_result == 0){\n\t\t// Error occurred\n\t}if(ct_result == 'no_hash'){\n\t\t// No hash for this comment\n\t}\n}\n"]}
|
1 |
+
{"version":3,"sources":["cleantalk-comments-editscreen.js"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg_whitelisted","ct_feedback_msg","is","ct_feedback_msg_blacklisted","document","ready","after","ctAdminCommon","logo_small_colored","spambutton_text","parseInt","ct_show_check_links","each","ct_curr_str","this","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCA2EnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,4BAA4B,IAAIzB,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,8BACtBlD,EAAgBgD,EAAO,GAEvBjD,yBADAoD,gBAAkBnD,EACsB,OAAQ,GAEhDoD,WAAW,WACV1C,OAAO,WAAWV,EAAc,kBAAkBqD,MAAM,WACvD,IAAIL,EAAStC,OAAOmC,MAAMI,KAAK,QAC/BD,EAASA,EAAOE,MAAM,+BAEtBnD,yBADAC,EAAgBgD,EAAO,GACiB,UAAW,MAElD,OAKJtC,OAAO,eAAeqC,GAAG,QAAS,WACjC,IAAIC,EAAStC,OAAOmC,MAAMhB,SAAS,KAAKoB,KAAK,QAC7CD,EAASA,EAAOE,MAAM,8BAEtBnD,yBADAC,EAAgBgD,EAAO,GACiB,UAAW,KAIpDtC,OAAO,kBAAkBqC,GAAG,QAAS,WACpC,IAAIC,EAAStC,OAAOmC,MAAMI,KAAK,QAC/BD,EAASA,EAAOE,MAAM,8BACtBlD,EAAgBgD,EAAO,GACvBM,gBAAkBvD,yBAAyBC,EAAe,UAAW","file":"cleantalk-comments-editscreen.min.js","sourcesContent":["function ct_is_email(str){\r\n\treturn str.search(/.*@.*\\..*/);\r\n}\r\nfunction ct_is_ip(str){\r\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t/* Shows \"Find spam users\" button */\r\n\tjQuery('#post-query-submit').after('<a href=\"edit-comments.php?page=ct_check_spam\" class=\"button\" style=\"margin:1px 0 0 0; display: inline-block;\">'+ctAdminCommon.logo_small_colored+' '+ctCommentsScreen.spambutton_text+'</a> ');\r\n\r\n\t/* Shows link to blacklists near every email and IP address */\r\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\r\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\r\n\t\t\tvar ct_curr_str = jQuery(this).html();\r\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\r\n\t\t\t\tjQuery(this).after(' <a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t/* Feedback for comments */\r\n\tvar ct_comment_id;\r\n\t\r\n\t// For approved\r\n\tjQuery('span.approve').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\r\n\t\r\n\t// For unapprove\r\n\tjQuery('span.unapprove').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\r\n\t});\r\n\t\r\n\t// For spammed\r\n\tjQuery('span.spam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\r\n\t\t\r\n\t\tsetTimeout(function(){\r\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\r\n\t\t\t\tvar result = jQuery(this).attr('href');\r\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\r\n\t\t\t\tct_comment_id = result[1];\r\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\r\n\t\t\t});\r\n\t\t}, 202);\r\n\t\t\r\n\t});\r\n\t\r\n\t// For unspammed\r\n\tjQuery('span.unspam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\r\n\t});\r\n\t\r\n\t// For untrashed\r\n\tjQuery('span.untrash a').on('click', function(){\r\n\t\tvar result = jQuery(this).attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\t\r\n});\r\n\r\n// Send feedback to backend\r\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ct_feedback_comment',\r\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\r\n\t\t'comment_id': ct_comment_id,\r\n\t\t'comment_status': ct_comment_status\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n timeout: 5000\r\n\t});\r\n}\r\n\r\n// Outputs CT message about feedback\r\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\r\n\tif(ct_result == 1){\r\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\r\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg_whitelisted+\" \"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\t\t\t\t\t\t\r\n\t\t}\r\n\t\tif(ct_comment_status == 'spam'){\r\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\r\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\r\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg_blacklisted+\" \"+ctCommentsScreen.ct_feedback_msg);\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg_blacklisted+\" \"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\t\t\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(ct_result == 0){\r\n\t\t// Error occurred\r\n\t}if(ct_result == 'no_hash'){\r\n\t\t// No hash for this comment\r\n\t}\r\n}\r\n"]}
|
js/cleantalk-dashboard-widget.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-dashboard-widget.js"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","ct_chart","getElementById","locale","navigator","language","userLanguage","google","charts","load","packages","setOnLoadCallback","data","visualization","DataTable","addColumn","date","date_formatter","Intl","DateTimeFormat","month","day","sort","a","b","Date","forEach","d","parse","format","ctParseData","apbctDashboardWidget","addRows","options","width","first","height","colors","legend","bar","groupWidth","chartArea","left","vAxis","gridlines","count","ColumnChart","draw"],"mappings":"A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,cAAciC,YAAY7C,GAC3C8C,KAAKnC,EAAMqB","file":"cleantalk-dashboard-widget.min.js","sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set \"refresh\" link handler\n\tjQuery(\".ct_widget_refresh_link\").on('click', function(){\n\t\tjQuery('.ct_preloader').show();\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\t\t\n\t\tsetTimeout(function(){jQuery(\"#ct_refresh_form\").submit();}, 2500);\n\t});\n\t\n\tif(location.hash == '#ct_widget')\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\n\t\n\t// Fixing default wrapper style\n\tjQuery(\"#ct_widget_wrapper\").parent().css('padding', 0);\n\t\n\t// Chart \n\tvar ct_chart = document.getElementById('ct_widget_chart'),\n\t\tlocale = navigator.language || navigator.userLanguage;\n\t\t\n\tfunction ctParseData(date){\n\t\tvar date_formatter = new Intl.DateTimeFormat(locale, {\n\t\t\tmonth: \"short\",\n\t\t\tday: \"numeric\"\n\t\t});\t\n\t\tdate.sort(function(a,b){\n\t\t\treturn new Date(a[0]) - new Date(b[0]) \n\t\t});\t\t\t\n\t\tdate.forEach(function(d){\t\n\t\t\td[0] = Date.parse(d[0]);\n\t\t\td[0] = date_formatter.format(d[0]);\n\t\t});\t\t\n\t}\n\t\t\n\tgoogle.charts.load('current', {packages:['corechart', 'bar']});\n\tgoogle.charts.setOnLoadCallback(drawStuff);\n\n\tfunction drawStuff() {\n\t\tvar data = new google.visualization.DataTable();\n\t\tdata.addColumn('string', 'Spam Blocked');\n\t\tdata.addColumn('number', 'Frequency');\n\t\t\n\t\tctParseData(apbctDashboardWidget.data);\n\t\tdata.addRows(apbctDashboardWidget.data);\n\t\n\t\tvar options = {\n\t\t\twidth: jQuery(\".ct_widget_block\").first().width(),\n\t\t\theight: 300,\n\t\t\tcolors: ['steelblue'],\n\t\t\tlegend: 'none',\n\t\t\tbar: {groupWidth: '95%'},\n\t\t\tchartArea:{left:30,top:20,width:'93%',height:'80%'},\n\t\t\tvAxis: { gridlines: { count: 5 } }\n\t\t};\n\n\t\tif(ct_chart){\n\t\t\tvar chart = new google.visualization.ColumnChart(ct_chart);\n\t\t\tchart.draw(data, options);\n\t\t}\n\t};\t\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk-dashboard-widget.js"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","ct_chart","getElementById","locale","navigator","language","userLanguage","google","charts","load","packages","setOnLoadCallback","data","visualization","DataTable","addColumn","date","date_formatter","Intl","DateTimeFormat","month","day","sort","a","b","Date","forEach","d","parse","format","ctParseData","apbctDashboardWidget","addRows","options","width","first","height","colors","legend","bar","groupWidth","chartArea","left","vAxis","gridlines","count","ColumnChart","draw"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,2BAA2BG,GAAG,QAAS,WAC7CH,OAAO,iBAAiBI,OACxBC,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAC7FJ,WAAW,WAAWL,OAAO,oBAAoBU,UAAY,QAG1C,cAAjBC,SAASC,MACXP,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAG9FT,OAAO,sBAAsBa,SAASC,IAAI,UAAW,GAGrD,IAAIC,EAAWd,SAASe,eAAe,mBACtCC,EAASC,UAAUC,UAAYD,UAAUE,aAgB1CC,OAAOC,OAAOC,KAAK,UAAW,CAACC,SAAS,CAAC,YAAa,SACtDH,OAAOC,OAAOG,kBAEd,WACC,IAAIC,EAAO,IAAIL,OAAOM,cAAcC,UACpCF,EAAKG,UAAU,SAAU,gBACzBH,EAAKG,UAAU,SAAU,aApB1B,SAAqBC,GACpB,IAAIC,EAAiB,IAAIC,KAAKC,eAAehB,EAAQ,CACpDiB,MAAO,QACPC,IAAK,YAENL,EAAKM,KAAK,SAASC,EAAEC,GACpB,OAAO,IAAIC,KAAKF,EAAE,IAAM,IAAIE,KAAKD,EAAE,MAEpCR,EAAKU,QAAQ,SAASC,GACrBA,EAAE,GAAKF,KAAKG,MAAMD,EAAE,IACpBA,EAAE,GAAKV,EAAeY,OAAOF,EAAE,MAYhCG,CAAYC,qBAAqBnB,MACjCA,EAAKoB,QAAQD,qBAAqBnB,MAElC,IAAIqB,EAAU,CACbC,MAAOhD,OAAO,oBAAoBiD,QAAQD,QAC1CE,OAAQ,IACRC,OAAQ,CAAC,aACTC,OAAQ,OACRC,IAAK,CAACC,WAAY,OAClBC,UAAU,CAACC,KAAK,GAAG/C,IAAI,GAAGuC,MAAM,MAAME,OAAO,OAC7CO,MAAO,CAAEC,UAAW,CAAEC,MAAO,KAG9B,GAAG5C,EAAS,CACC,IAAIM,OAAOM,cAAciC,YAAY7C,GAC3C8C,KAAKnC,EAAMqB","file":"cleantalk-dashboard-widget.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\t\r\n\t// Set \"refresh\" link handler\r\n\tjQuery(\".ct_widget_refresh_link\").on('click', function(){\r\n\t\tjQuery('.ct_preloader').show();\r\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\t\t\r\n\t\tsetTimeout(function(){jQuery(\"#ct_refresh_form\").submit();}, 2500);\r\n\t});\r\n\t\r\n\tif(location.hash == '#ct_widget')\r\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\r\n\t\r\n\t// Fixing default wrapper style\r\n\tjQuery(\"#ct_widget_wrapper\").parent().css('padding', 0);\r\n\t\r\n\t// Chart \r\n\tvar ct_chart = document.getElementById('ct_widget_chart'),\r\n\t\tlocale = navigator.language || navigator.userLanguage;\r\n\t\t\r\n\tfunction ctParseData(date){\r\n\t\tvar date_formatter = new Intl.DateTimeFormat(locale, {\r\n\t\t\tmonth: \"short\",\r\n\t\t\tday: \"numeric\"\r\n\t\t});\t\r\n\t\tdate.sort(function(a,b){\r\n\t\t\treturn new Date(a[0]) - new Date(b[0]) \r\n\t\t});\t\t\t\r\n\t\tdate.forEach(function(d){\t\r\n\t\t\td[0] = Date.parse(d[0]);\r\n\t\t\td[0] = date_formatter.format(d[0]);\r\n\t\t});\t\t\r\n\t}\r\n\t\t\r\n\tgoogle.charts.load('current', {packages:['corechart', 'bar']});\r\n\tgoogle.charts.setOnLoadCallback(drawStuff);\r\n\r\n\tfunction drawStuff() {\r\n\t\tvar data = new google.visualization.DataTable();\r\n\t\tdata.addColumn('string', 'Spam Blocked');\r\n\t\tdata.addColumn('number', 'Frequency');\r\n\t\t\r\n\t\tctParseData(apbctDashboardWidget.data);\r\n\t\tdata.addRows(apbctDashboardWidget.data);\r\n\t\r\n\t\tvar options = {\r\n\t\t\twidth: jQuery(\".ct_widget_block\").first().width(),\r\n\t\t\theight: 300,\r\n\t\t\tcolors: ['steelblue'],\r\n\t\t\tlegend: 'none',\r\n\t\t\tbar: {groupWidth: '95%'},\r\n\t\t\tchartArea:{left:30,top:20,width:'93%',height:'80%'},\r\n\t\t\tvAxis: { gridlines: { count: 5 } }\r\n\t\t};\r\n\r\n\t\tif(ct_chart){\r\n\t\t\tvar chart = new google.visualization.ColumnChart(ct_chart);\r\n\t\t\tchart.draw(data, options);\r\n\t\t}\r\n\t};\t\r\n});"]}
|
js/cleantalk-debug-ajax.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-debug-ajax.js"],"names":["jQuery","document","ready","console","log","ajaxComplete","event","xhr","settings","data"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAEtBC,QAAQC,IAAI,YAGZJ,OAAOC,UAAUI,aAAa,SAASC,EAAOC,EAAKC,EAAUC,GAC5DN,QAAQC,IAAI,YACZD,QAAQC,IAAI,YACZD,QAAQC,IAAIE,GACZH,QAAQC,IAAI,eACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAI,uBACZD,QAAQC,IAAII,GACZL,QAAQC,IAAI,WACZD,QAAQC,IAAIK","file":"cleantalk-debug-ajax.min.js","sourcesContent":["jQuery(document).ready(function(){\n\n\tconsole.log('CT debug');\n\n\t// Debug. Console all AJAX requests.\n\tjQuery(document).ajaxComplete(function(event, xhr, settings, data) {\n\t\tconsole.log(\"Success!\")\n\t\tconsole.log('Event:\\n');\n\t\tconsole.log(event);\n\t\tconsole.log('Response:\\n');\n\t\tconsole.log(xhr);\n\t\tconsole.log('Request settings:\\n');\n\t\tconsole.log(settings);\n\t\tconsole.log('Data:\\n');\n\t\tconsole.log(data);\n\t});\n\t\t\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk-debug-ajax.js"],"names":["jQuery","document","ready","console","log","ajaxComplete","event","xhr","settings","data"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAEtBC,QAAQC,IAAI,YAGZJ,OAAOC,UAAUI,aAAa,SAASC,EAAOC,EAAKC,EAAUC,GAC5DN,QAAQC,IAAI,YACZD,QAAQC,IAAI,YACZD,QAAQC,IAAIE,GACZH,QAAQC,IAAI,eACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAI,uBACZD,QAAQC,IAAII,GACZL,QAAQC,IAAI,WACZD,QAAQC,IAAIK","file":"cleantalk-debug-ajax.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\r\n\tconsole.log('CT debug');\r\n\r\n\t// Debug. Console all AJAX requests.\r\n\tjQuery(document).ajaxComplete(function(event, xhr, settings, data) {\r\n\t\tconsole.log(\"Success!\")\r\n\t\tconsole.log('Event:\\n');\r\n\t\tconsole.log(event);\r\n\t\tconsole.log('Response:\\n');\r\n\t\tconsole.log(xhr);\r\n\t\tconsole.log('Request settings:\\n');\r\n\t\tconsole.log(settings);\r\n\t\tconsole.log('Data:\\n');\r\n\t\tconsole.log(data);\r\n\t});\r\n\t\t\r\n});"]}
|
js/cleantalk-public-admin.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-public-admin.js"],"names":["jQuery","document","ready","parents","each","e","this","css","length","ct_post_float","prev","last","ct_posts","indx","elem","curr_elem","parent","prepend","on","ct_comment_status","ct_current_button","ct_feedback_wrap","siblings","ct_feedback_msg","hasClass","data","action","security","ctPublicAdmin","ct_ajax_nonce","comment_id","attr","comment_status","change_status","ajax","type","url","ajaxurl","success","msg","hide","show","addClass","html","ct_feedback_error","ct_feedback_no_hash","ct_timeout_id","clearInterval","setTimeout","fadeOut","error","jqXHR","textStatus","errorThrown","console","log","timeout"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGvBF,OAAO,oBAAoBG,UAAUC,KAAK,WACxC,GAAwD,GAAnDC,EAAIL,OAAOM,MAAMC,IAAI,qBAAqBC,QAAmB,oBAALH,EAE5D,OADAL,OAAO,oBAAoBO,IAAI,aAAcF,IACtC,IAKT,IAAII,EAAgBT,OAAO,oBAAoBU,OAAOC,OAAOJ,IAAI,SACjEP,OAAO,oBAAoBO,IAAI,QAASE,GAExC,IAAIG,EAAWZ,OAAO,oBAEtBA,OAAOY,GAAUR,KAAK,SAASS,EAAMC,GACpCC,UAAYf,OAAOc,GACnBC,UAAUC,SAASC,QAAQF,aAI5Bf,OAAO,eAAekB,GAAG,QAAS,WAEjC,IAGCC,EAHGC,EAAoBpB,OAAOM,MAC9Be,EAAmBrB,OAAOM,MAAMgB,SAAS,qBACzCC,EAAkBvB,OAAO,oBAIzBmB,EADEC,EAAkBI,SAAS,mBACT,OAEA,UAErB,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,cAAcC,cAC1BC,WAAcV,EAAkBW,KAAK,aACrCC,eAAkBb,EAClBc,cAAiB,GAGlBjC,OAAOkC,KAAK,CACXC,KAAM,OACNC,IAAKR,cAAcS,QACnBZ,KAAMA,EACNa,QAAS,SAASC,GACjBnB,EAAkBoB,OAClBpB,EAAkBE,SAAS,mBAAmBmB,OAE9CzC,OAAO,uBAAuBwC,OACN,WAArBrB,EACFnB,OAAO,gCAAgCyC,OAEvCzC,OAAO,4BAA4ByC,OAE1B,GAAPF,GACFhB,EAAgBmB,SAAS,uBACzBnB,EAAgBoB,KAAKf,cAAcL,kBACpB,GAAPgB,GAERhB,EAAgBmB,SAAS,qBACzBnB,EAAgBoB,KAAKf,cAAcgB,oBACpB,WAAPL,IAERhB,EAAgBmB,SAAS,uBACzBnB,EAAgBoB,KAAKf,cAAciB,sBAGpCxB,EAAiBoB,OACjBpB,EAAiBd,IAAI,UAAW,gBAEhC,IAAIuC,EAAgBzB,EAAiBI,KAAK,eAC1CsB,cAAcD,GACdA,EAAgBE,WAAW,WAC1B3B,EAAiB4B,QAAQ,MACvB,KACH5B,EAAiBI,KAAK,cAAeqB,IAEtCI,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbG,QAAS","file":"cleantalk-public-admin.min.js","sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set background-color similar to parents\njQuery('.ct_comment_info').parents().each(function() {\n if ((e = jQuery(this).css('background-color')).length > 0 && e != 'rgba(0, 0, 0, 0)'){ \n \tjQuery('.ct_comment_info').css('background', e);\n \treturn false;\n }\n});\n\t\n\t// Set same float style with article\n\tvar ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');\n\tjQuery('.ct_comment_info').css('float', ct_post_float);\n\t\n\tvar ct_posts = jQuery('.ct_comment_info');\n\t\n\tjQuery(ct_posts).each(function(indx, elem){\n\t\tcurr_elem = jQuery(elem);\n\t\tcurr_elem.parent().prepend(curr_elem);\n\t});\n\t\n\t// Handler for buttons\n\tjQuery('.ct_this_is').on('click', function(){\n\t\t\n\t\tvar ct_current_button = jQuery(this),\n\t\t\tct_feedback_wrap = jQuery(this).siblings('.ct_feedback_wrap'),\n\t\t\tct_feedback_msg = jQuery('.ct_feedback_msg'),\n\t\t\tct_comment_status;\n\t\t\t\n\t\tif(ct_current_button.hasClass('ct_this_is_spam'))\n\t\t\tct_comment_status = 'spam';\n\t\telse\n\t\t\tct_comment_status = 'approve';\n\t\t\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_comment',\n\t\t\t'security': ctPublicAdmin.ct_ajax_nonce,\n\t\t\t'comment_id': ct_current_button.attr('commentid'),\n\t\t\t'comment_status': ct_comment_status,\n\t\t\t'change_status': 1\n\t\t};\n\t\t\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ctPublicAdmin.ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tct_current_button.hide();\n\t\t\t\tct_current_button.siblings('span.ct_this_is').show();\n\t\t\t\t\n\t\t\t\tjQuery('.ct_feedback_result').hide();\n\t\t\t\tif(ct_comment_status == 'approve')\n\t\t\t\t\tjQuery('.ct_feedback_result_not_spam').show();\n\t\t\t\telse\n\t\t\t\t\tjQuery('.ct_feedback_result_spam').show();\n\t\t\t\t\n\t\t\t\tif(msg == 1){\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_success');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_msg);\n\t\t\t\t}else if(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_error');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_error);\n\t\t\t\t}else if(msg == 'no_hash'){\n\t\t\t\t\t// No hash for this comment\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_no_hash');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_no_hash);\n\t\t\t\t}\n\t\t\t\t// Hidding feedback message for every message type\n\t\t\t\tct_feedback_wrap.show();\n\t\t\t\tct_feedback_wrap.css('display', 'inline-block');\n\t\t\t\t\n\t\t\t\tvar ct_timeout_id = ct_feedback_wrap.data('interval_id');\n\t\t\t\tclearInterval(ct_timeout_id);\n\t\t\t\tct_timeout_id = setTimeout(function(){\n\t\t\t\t\tct_feedback_wrap.fadeOut(1000);\n\t\t\t\t}, 5000);\n\t\t\t\tct_feedback_wrap.data('interval_id', ct_timeout_id);\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log(errorThrown);\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t});\n\t\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk-public-admin.js"],"names":["jQuery","document","ready","parents","each","e","this","css","length","ct_post_float","prev","last","ct_posts","indx","elem","curr_elem","parent","prepend","on","ct_comment_status","ct_current_button","ct_feedback_wrap","siblings","ct_feedback_msg","hasClass","data","action","security","ctPublicAdmin","ct_ajax_nonce","comment_id","attr","comment_status","change_status","ajax","type","url","ajaxurl","success","msg","hide","show","addClass","html","ct_feedback_error","ct_feedback_no_hash","ct_timeout_id","clearInterval","setTimeout","fadeOut","error","jqXHR","textStatus","errorThrown","console","log","timeout"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGvBF,OAAO,oBAAoBG,UAAUC,KAAK,WACxC,GAAwD,GAAnDC,EAAIL,OAAOM,MAAMC,IAAI,qBAAqBC,QAAmB,oBAALH,EAE5D,OADAL,OAAO,oBAAoBO,IAAI,aAAcF,IACtC,IAKT,IAAII,EAAgBT,OAAO,oBAAoBU,OAAOC,OAAOJ,IAAI,SACjEP,OAAO,oBAAoBO,IAAI,QAASE,GAExC,IAAIG,EAAWZ,OAAO,oBAEtBA,OAAOY,GAAUR,KAAK,SAASS,EAAMC,GACpCC,UAAYf,OAAOc,GACnBC,UAAUC,SAASC,QAAQF,aAI5Bf,OAAO,eAAekB,GAAG,QAAS,WAEjC,IAGCC,EAHGC,EAAoBpB,OAAOM,MAC9Be,EAAmBrB,OAAOM,MAAMgB,SAAS,qBACzCC,EAAkBvB,OAAO,oBAIzBmB,EADEC,EAAkBI,SAAS,mBACT,OAEA,UAErB,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,cAAcC,cAC1BC,WAAcV,EAAkBW,KAAK,aACrCC,eAAkBb,EAClBc,cAAiB,GAGlBjC,OAAOkC,KAAK,CACXC,KAAM,OACNC,IAAKR,cAAcS,QACnBZ,KAAMA,EACNa,QAAS,SAASC,GACjBnB,EAAkBoB,OAClBpB,EAAkBE,SAAS,mBAAmBmB,OAE9CzC,OAAO,uBAAuBwC,OACN,WAArBrB,EACFnB,OAAO,gCAAgCyC,OAEvCzC,OAAO,4BAA4ByC,OAE1B,GAAPF,GACFhB,EAAgBmB,SAAS,uBACzBnB,EAAgBoB,KAAKf,cAAcL,kBACpB,GAAPgB,GAERhB,EAAgBmB,SAAS,qBACzBnB,EAAgBoB,KAAKf,cAAcgB,oBACpB,WAAPL,IAERhB,EAAgBmB,SAAS,uBACzBnB,EAAgBoB,KAAKf,cAAciB,sBAGpCxB,EAAiBoB,OACjBpB,EAAiBd,IAAI,UAAW,gBAEhC,IAAIuC,EAAgBzB,EAAiBI,KAAK,eAC1CsB,cAAcD,GACdA,EAAgBE,WAAW,WAC1B3B,EAAiB4B,QAAQ,MACvB,KACH5B,EAAiBI,KAAK,cAAeqB,IAEtCI,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbG,QAAS","file":"cleantalk-public-admin.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\t\r\n\t// Set background-color similar to parents\r\njQuery('.ct_comment_info').parents().each(function() {\r\n if ((e = jQuery(this).css('background-color')).length > 0 && e != 'rgba(0, 0, 0, 0)'){ \r\n \tjQuery('.ct_comment_info').css('background', e);\r\n \treturn false;\r\n }\r\n});\r\n\t\r\n\t// Set same float style with article\r\n\tvar ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');\r\n\tjQuery('.ct_comment_info').css('float', ct_post_float);\r\n\t\r\n\tvar ct_posts = jQuery('.ct_comment_info');\r\n\t\r\n\tjQuery(ct_posts).each(function(indx, elem){\r\n\t\tcurr_elem = jQuery(elem);\r\n\t\tcurr_elem.parent().prepend(curr_elem);\r\n\t});\r\n\t\r\n\t// Handler for buttons\r\n\tjQuery('.ct_this_is').on('click', function(){\r\n\t\t\r\n\t\tvar ct_current_button = jQuery(this),\r\n\t\t\tct_feedback_wrap = jQuery(this).siblings('.ct_feedback_wrap'),\r\n\t\t\tct_feedback_msg = jQuery('.ct_feedback_msg'),\r\n\t\t\tct_comment_status;\r\n\t\t\t\r\n\t\tif(ct_current_button.hasClass('ct_this_is_spam'))\r\n\t\t\tct_comment_status = 'spam';\r\n\t\telse\r\n\t\t\tct_comment_status = 'approve';\r\n\t\t\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_comment',\r\n\t\t\t'security': ctPublicAdmin.ct_ajax_nonce,\r\n\t\t\t'comment_id': ct_current_button.attr('commentid'),\r\n\t\t\t'comment_status': ct_comment_status,\r\n\t\t\t'change_status': 1\r\n\t\t};\r\n\t\t\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ctPublicAdmin.ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_current_button.hide();\r\n\t\t\t\tct_current_button.siblings('span.ct_this_is').show();\r\n\t\t\t\t\r\n\t\t\t\tjQuery('.ct_feedback_result').hide();\r\n\t\t\t\tif(ct_comment_status == 'approve')\r\n\t\t\t\t\tjQuery('.ct_feedback_result_not_spam').show();\r\n\t\t\t\telse\r\n\t\t\t\t\tjQuery('.ct_feedback_result_spam').show();\r\n\t\t\t\t\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_success');\r\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_msg);\r\n\t\t\t\t}else if(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_error');\r\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_error);\r\n\t\t\t\t}else if(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash for this comment\r\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_no_hash');\r\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_no_hash);\r\n\t\t\t\t}\r\n\t\t\t\t// Hidding feedback message for every message type\r\n\t\t\t\tct_feedback_wrap.show();\r\n\t\t\t\tct_feedback_wrap.css('display', 'inline-block');\r\n\t\t\t\t\r\n\t\t\t\tvar ct_timeout_id = ct_feedback_wrap.data('interval_id');\r\n\t\t\t\tclearInterval(ct_timeout_id);\r\n\t\t\t\tct_timeout_id = setTimeout(function(){\r\n\t\t\t\t\tct_feedback_wrap.fadeOut(1000);\r\n\t\t\t\t}, 5000);\r\n\t\t\t\tct_feedback_wrap.data('interval_id', ct_timeout_id);\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\tconsole.log(jqXHR);\r\n\t\t\t\tconsole.log(textStatus);\r\n\t\t\t\tconsole.log(errorThrown);\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t});\r\n\t\r\n});"]}
|
js/cleantalk-users-checkspam.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-users-checkspam.js"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","new_check","unchecked","parseJSON","parseInt","error","confirm","error_message","new_href","location","href","end","document","cookie","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_insert_users","delete_accounts","alert","ct_deleted","ct_iusers","ct_inserted","ct_delete_all_users","ct_delete_checked_users","ids","Array","cnt","each","prop","attr","ct_toggle_depended","obj","secondary","depended","removeProp","ready","state","val","on","dates","datepicker","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","is","click","ct_check","accurate","from","till","JSON","stringify","ct_confirm_deletion_all","animate","scrollTop","ct_confirm_deletion_checked","remove","mouseover","mouseout","ct_id","fadeOut","user_id","status","filename","ct_csv_filename","ct_bad_csv","protocol","hostname"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAAY,CAC9B,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,aAAaD,iBAChCE,aAAmBD,aAAaC,aAChCC,aAAmBF,aAAaE,aAE7BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,aAAaM,cAChCC,eAAiB,EACjBC,iBAAmB,EACnBC,cAAgB,EAChBC,aAAe,EACfC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,KAGnBC,OAAO,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8D,QAAS,SAIXzC,OAAO,iCAAiCsF,MAAM,WAC7CvF,GAAKC,OAAO/B,MAAMwF,KAAK,WACvB5D,gBAAgB,GAAKE,MAItBC,OAAO,mBAAmBkG,UAAU,WACnCnG,GAAKC,OAAO/B,MAAMwF,KAAK,WACvBzD,OAAO,0BAA0BD,IAAIyC,SAEtCxC,OAAO,mBAAmBmG,SAAS,WAClCpG,GAAKC,OAAO/B,MAAMwF,KAAK,WACvBzD,OAAO,0BAA0BD,IAAI8B,SAItC7B,OAAO,sCAAsCsF,MAAM,WAClDc,MAAQpG,OAAO/B,MAAMwF,KAAK,WAG1B,IAAItD,EAAO,CACVC,OAAU,uBACVC,SAAYhB,cACZU,GAAMqG,OAEPpG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACjBX,OAAO,YAAYoG,OAAOC,QAAQ,OAAQ,WACzCrG,OAAO,YAAYoG,OAAOH,cAMzB9F,EAAO,CACVC,OAAU,mBACVC,SAAYhB,cACZiH,QAAWF,MACXG,OAAU,WAEXvG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,KAWlBS,MAAO,SAASiB,EAAOC,EAAYC,KAGnCE,QAAS,QAMXzC,OAAO,oBAAoBsF,MAAM,WAChC,IAAInF,EAAO,CACVC,OAAU,uBACVC,SAAYhB,cACZmH,SAAYzH,aAAa0H,iBAE1BzG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACC,GAAfQ,SAASR,GACXmC,MAAM/D,aAAa2H,YAEnB1G,OAAO,mBAAmBoC,KAAK,gBAAgBZ,SAASmF,SAAS,KAAKnF,SAASoF,SAAS,4DAA4D7H,aAAa0H,gBAAgB","file":"cleantalk-users-checkspam.min.js","sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\n\tct_prev_till = ctUsersCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\n\tct_users_total = 0,\n\tct_users_checked = 0,\n\tct_users_spam = 0,\n\tct_users_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to==0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_users(){\n\t\n\tvar data = {\n\t\t'action': 'ajax_clear_users',\n\t\t'security': ct_ajax_nonce\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}\n\t});\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_users();\n\tct_show_users_info();\n}\n\nfunction ct_send_users(){\n\t\n\tif(ct_cooling_down_flag == true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\t\n\tvar data = {\n\t\t'action': 'ajax_check_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'new_check': ct_new_check,\n\t\t'unchecked': ct_unchecked\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_users();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_users_checked += msg.checked;\n\t\t\t\t\tct_users_spam += msg.spam;\n\t\t\t\t\tct_users_bad += msg.bad;\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_total, ct_users_checked, ct_users_spam, ct_users_bad);\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\t\n\tif(ct_working){\n\t\t\n\t\tif(ct_cooling_down_flag == true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\n\t\t\tjQuery('#ct_cooling_notice').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tsetTimeout(ct_show_users_info, 3000);\n\t\t\n\t\tif(!ct_users_total){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce\n\t\t\t};\n\t\t\t\n\t\t\tif(ct_date_from && ct_date_till){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_total = msg.total;\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\nfunction ct_insert_users(delete_accounts){\n\n delete_accounts = delete_accounts || null;\n\n\tvar data = {\n\t\t'action': 'ajax_insert_users',\n\t\t'security': ct_ajax_nonce\n\t};\n\t\n\tif(delete_accounts)\n\t\tdata['delete'] = true;\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tif(delete_accounts)\n\t\t\t\talert(ctUsersCheck.ct_deleted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\n\t\t\telse\n\t\t\t\talert(ctUsersCheck.ct_inserted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\n\t\t}\n\t});\n}\nfunction ct_delete_all_users(){\n\t\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tif(msg>0){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users();\n\t\t\t}else{\n\t\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_delete_checked_users(){\n\t\n\tids=Array();\n\tvar cnt=0;\n\tjQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){\n\t\tif(jQuery(this).prop('checked')){\n\t\t\tids[cnt]=jQuery(this).attr('id').substring(10);\n\t\t\tcnt++;\n\t\t}\n\t});\n\tvar data = {\n\t\t'action': 'ajax_delete_checked_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'ids':ids\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_checked_users(), 3000);\n\t\t},\n\t\ttimeout: 15000\n\t});\n}\n\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\njQuery(document).ready(function(){\n\t\n\t// Setting dependences\n\t// jQuery('#ct_accurate_check') .data({'depended': '#ct_allow_date_range', 'state': false});\n\tjQuery('#ct_allow_date_range').data({'depended': '.ct_date', 'state': false});\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range, #ct_accurate_check\").on('change', function(){\n\t\tct_toggle_depended(jQuery(this));\n\t});\n\t\t\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'yy-mm-dd',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t}\n\t\t}\n\t);\n\t\t\n\tfunction ct_start_check(continue_check){\n\n\t continue_check = continue_check || null;\n\t\t\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\t\t\t\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val(),\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\t\t\t\t\t\t\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\n\t\t\t\talert('Please, specify a date range.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\t\tct_accurate_check = true;\n\t\t}\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_working_message').show();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_pause').show();\n\t\t\n\t\tct_working=true;\n\t\t\n\t\tif(continue_check){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}else\n\t\t\tct_clear_users();\n\t\t\n\t}\n\t\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\t\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/';\n\t});\n\t\n\tjQuery(\"#ct_insert_users\").click(function(){\n\t\tct_insert_users();\n\t});\n\t\n\tjQuery(\"#ct_delete_users\").click(function(){\n\t\tct_insert_users(true);\n\t});\n\t\n\t// Delete all spam users\n\tjQuery(\"#ct_delete_all_users\").click(function(){\n\t\t\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_all))\n\t\t\treturn false;\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_checking_status').hide();\n\t\tjQuery('#ct_search_info').hide();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_deleting_message').show();\n\t\tjQuery('#ct_stop_deletion').show();\n\t\tjQuery(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n\t\tct_delete_all_users();\n\t});\n\tjQuery(\"#ct_delete_checked_users\").click(function(){\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_checked))\n\t\t\treturn false;\n\t\tct_delete_checked_users();\n\t});\n\t\n\tjQuery(\"#ct_stop_deletion\").click(function(){\n\t\tlocation.href='users.php?page=ct_check_users';\n\t});\n\t\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tids=Array();\n\t\tids[0]=id;\n\t\tvar data = {\n\t\t\t'action': 'ajax_delete_checked_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'ids':ids\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tct_close_animate=false;\n\t\t\t\tjQuery(\"#comment-\"+id).hide();\n\t\t\t\tjQuery(\"#comment-\"+id).remove();\n\t\t\t\tct_close_animate=true;\n\t\t\t},\n\t\t\ttimeout: 15000\n\t\t});\n\t});\n\t\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tanimate_comment(0.3, id);\n\t});\n\t\t\n\t//Show/hide action on mouse over/out\n\tjQuery(\".cleantalk_user\").mouseover(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).show();\n\t});\n\tjQuery(\".cleantalk_user\").mouseout(function(){\n\t\tid = jQuery(this).attr(\"data-id\");\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).hide();\n\t});\n\t\t\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\t\t\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\t\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve'\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t\t\n\t});\n\t\n\t// Request to Download CSV file.\n\tjQuery(\"#ct_get_csv_file\").click(function(){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(parseInt(msg)==0)\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\telse\n\t\t\t\t\tjQuery(\"#ct_csv_wrapper\").html(\"<iframe src='\"+location.protocol+\"//\"+location.hostname+\"/wp-content/plugins/cleantalk-spam-protect/check-results/\"+ctUsersCheck.ct_csv_filename+\".csv'></iframe>\");\n\t\t\t},\n\t\t});\n\t});\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk-users-checkspam.js"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","new_check","unchecked","parseJSON","parseInt","error","confirm","error_message","new_href","location","href","end","document","cookie","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_insert_users","delete_accounts","alert","ct_deleted","ct_iusers","ct_inserted","ct_delete_all_users","ct_delete_checked_users","ids","Array","cnt","each","prop","attr","ct_toggle_depended","obj","secondary","depended","removeProp","ready","state","val","on","dates","datepicker","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","is","click","ct_check","accurate","from","till","JSON","stringify","ct_confirm_deletion_all","animate","scrollTop","ct_confirm_deletion_checked","remove","mouseover","mouseout","ct_id","fadeOut","user_id","status","filename","ct_csv_filename","ct_bad_csv","protocol","hostname"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAAY,CAC9B,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,aAAaD,iBACh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a0H,iBAE1BzG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACC,GAAfQ,SAASR,GACXmC,MAAM/D,aAAa2H,YAEnB1G,OAAO,mBAAmBoC,KAAK,gBAAgBZ,SAASmF,SAAS,KAAKnF,SAASoF,SAAS,4DAA4D7H,aAAa0H,gBAAgB","file":"cleantalk-users-checkspam.min.js","sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\r\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\r\n\tct_prev_till = ctUsersCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\r\n\tct_users_total = 0,\r\n\tct_users_checked = 0,\r\n\tct_users_spam = 0,\r\n\tct_users_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to==0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_users(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_clear_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_users();\r\n\tct_show_users_info();\r\n}\r\n\r\nfunction ct_send_users(){\r\n\t\r\n\tif(ct_cooling_down_flag == true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_check_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'new_check': ct_new_check,\r\n\t\t'unchecked': ct_unchecked\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_users_checked += msg.checked;\r\n\t\t\t\t\tct_users_spam += msg.spam;\r\n\t\t\t\t\tct_users_bad += msg.bad;\r\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\r\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_total, ct_users_checked, ct_users_spam, ct_users_bad);\r\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\r\n\t\t\tsetTimeout(ct_send_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_users_info(){\r\n\t\r\n\tif(ct_working){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag == true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\r\n\t\t\tjQuery('#ct_cooling_notice').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tsetTimeout(ct_show_users_info, 3000);\r\n\t\t\r\n\t\tif(!ct_users_total){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_users',\r\n\t\t\t\t'security': ct_ajax_nonce\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(ct_date_from && ct_date_till){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_users_total = msg.total;\r\n\t\t\t\t\tct_users_spam = msg.spam;\r\n\t\t\t\t\tct_users_checked = msg.checked;\r\n\t\t\t\t\tct_users_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\r\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\nfunction ct_insert_users(delete_accounts){\r\n\r\n delete_accounts = delete_accounts || null;\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_insert_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tif(delete_accounts)\r\n\t\tdata['delete'] = true;\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(delete_accounts)\r\n\t\t\t\talert(ctUsersCheck.ct_deleted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\r\n\t\t\telse\r\n\t\t\t\talert(ctUsersCheck.ct_inserted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\r\n\t\t}\r\n\t});\r\n}\r\nfunction ct_delete_all_users(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(msg>0){\r\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\r\n\t\t\t\tct_delete_all_users();\r\n\t\t\t}else{\r\n\t\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_all_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_delete_checked_users(){\r\n\t\r\n\tids=Array();\r\n\tvar cnt=0;\r\n\tjQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){\r\n\t\tif(jQuery(this).prop('checked')){\r\n\t\t\tids[cnt]=jQuery(this).attr('id').substring(10);\r\n\t\t\tcnt++;\r\n\t\t}\r\n\t});\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_checked_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'ids':ids\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_checked_users(), 3000);\r\n\t\t},\r\n\t\ttimeout: 15000\r\n\t});\r\n}\r\n\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Setting dependences\r\n\t// jQuery('#ct_accurate_check') .data({'depended': '#ct_allow_date_range', 'state': false});\r\n\tjQuery('#ct_allow_date_range').data({'depended': '.ct_date', 'state': false});\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range, #ct_accurate_check\").on('change', function(){\r\n\t\tct_toggle_depended(jQuery(this));\r\n\t});\r\n\t\t\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'yy-mm-dd',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\t\r\n\tfunction ct_start_check(continue_check){\r\n\r\n\t continue_check = continue_check || null;\r\n\t\t\r\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\t\t\t\r\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val(),\r\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\t\t\t\t\t\t\r\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\r\n\t\t\t\talert('Please, specify a date range.');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\t\tct_accurate_check = true;\r\n\t\t}\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_working_message').show();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_pause').show();\r\n\t\t\r\n\t\tct_working=true;\r\n\t\t\r\n\t\tif(continue_check){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}else\r\n\t\t\tct_clear_users();\r\n\t\t\r\n\t}\r\n\t\r\n\t// Check users\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\t\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/';\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_insert_users\").click(function(){\r\n\t\tct_insert_users();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_delete_users\").click(function(){\r\n\t\tct_insert_users(true);\r\n\t});\r\n\t\r\n\t// Delete all spam users\r\n\tjQuery(\"#ct_delete_all_users\").click(function(){\r\n\t\t\r\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_all))\r\n\t\t\treturn false;\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_checking_status').hide();\r\n\t\tjQuery('#ct_search_info').hide();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_deleting_message').show();\r\n\t\tjQuery('#ct_stop_deletion').show();\r\n\t\tjQuery(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\r\n\t\tct_delete_all_users();\r\n\t});\r\n\tjQuery(\"#ct_delete_checked_users\").click(function(){\r\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_checked))\r\n\t\t\treturn false;\r\n\t\tct_delete_checked_users();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_stop_deletion\").click(function(){\r\n\t\tlocation.href='users.php?page=ct_check_users';\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tids=Array();\r\n\t\tids[0]=id;\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_delete_checked_users',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'ids':ids\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_close_animate=false;\r\n\t\t\t\tjQuery(\"#comment-\"+id).hide();\r\n\t\t\t\tjQuery(\"#comment-\"+id).remove();\r\n\t\t\t\tct_close_animate=true;\r\n\t\t\t},\r\n\t\t\ttimeout: 15000\r\n\t\t});\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tanimate_comment(0.3, id);\r\n\t});\r\n\t\t\r\n\t//Show/hide action on mouse over/out\r\n\tjQuery(\".cleantalk_user\").mouseover(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).show();\r\n\t});\r\n\tjQuery(\".cleantalk_user\").mouseout(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).hide();\r\n\t});\r\n\t\t\r\n\t//Approve button\r\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\r\n\t\tct_id = jQuery(this).attr(\"data-id\");\r\n\t\t\r\n\t\t// Approving\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_approve_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'id': ct_id\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\r\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t});\r\n\t\t\r\n\t\t// Positive feedback\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'user_id': ct_id,\r\n\t\t\t'status': 'approve'\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\t// Success\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t\t\r\n\t});\r\n\t\r\n\t// Request to Download CSV file.\r\n\tjQuery(\"#ct_get_csv_file\").click(function(){\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_get_csv_file',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'filename': ctUsersCheck.ct_csv_filename\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(parseInt(msg)==0)\r\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\r\n\t\t\t\telse\r\n\t\t\t\t\tjQuery(\"#ct_csv_wrapper\").html(\"<iframe src='\"+location.protocol+\"//\"+location.hostname+\"/wp-content/plugins/cleantalk-spam-protect/check-results/\"+ctUsersCheck.ct_csv_filename+\".csv'></iframe>\");\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n});"]}
|
js/cleantalk-users-editscreen.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk-users-editscreen.js"],"names":["ct_is_email","str","search","ct_is_ip","jQuery","document","ready","after","ctAdminCommon","logo_small_colored","ctUsersScreen","spambutton_text","parseInt","ct_show_check_links","each","ct_curr_str","this","html","ct_img_src_new_tab"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAGnBE,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,aAAaG,MAAM,4GAA4GC,cAAcC,mBAAmB,SAASC,cAAcC,gBAAgB,cAG3MC,SAASF,cAAcG,sBACzBT,OAAO,mBAAmBU,KAAK,WAC9B,IAAIC,EAAcX,OAAOY,MAAMC,QACC,GAA7BjB,YAAYe,IACdX,OAAOY,MAAMT,MAAM,mDAAmDQ,EAAY,6DAA6DA,EAAY,uCAAuCL,cAAcQ,mBAAmB","file":"cleantalk-users-editscreen.min.js","sourcesContent":["function ct_is_email(str){\n\treturn str.search(/.*@.*\\..*/);\n}\nfunction ct_is_ip(str){\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\n}\n\njQuery(document).ready(function(){\n\t\n\t/* Shows \"Find spam users\" Buttons */\n\tjQuery('#changeit').after(' <a href=\"users.php?page=ct_check_users\" class=\"button\" style=\"margin:1px 0 0 0; display: inline-block;\">'+ctAdminCommon.logo_small_colored+' '+ctUsersScreen.spambutton_text+'</a> ');\n\t\n\t/* Shows link to blacklists near every email and IP address */\n\tif(parseInt(ctUsersScreen.ct_show_check_links))\n\t\tjQuery('.column-email a').each(function(){\n\t\t\tvar ct_curr_str = jQuery(this).html();\n\t\t\tif(ct_is_email(ct_curr_str) != -1){\n\t\t\t\tjQuery(this).after(' <a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctUsersScreen.ct_img_src_new_tab+'\"></a>');\n\t\t\t}\n\t\t});\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk-users-editscreen.js"],"names":["ct_is_email","str","search","ct_is_ip","jQuery","document","ready","after","ctAdminCommon","logo_small_colored","ctUsersScreen","spambutton_text","parseInt","ct_show_check_links","each","ct_curr_str","this","html","ct_img_src_new_tab"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAGnBE,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,aAAaG,MAAM,4GAA4GC,cAAcC,mBAAmB,SAASC,cAAcC,gBAAgB,cAG3MC,SAASF,cAAcG,sBACzBT,OAAO,mBAAmBU,KAAK,WAC9B,IAAIC,EAAcX,OAAOY,MAAMC,QACC,GAA7BjB,YAAYe,IACdX,OAAOY,MAAMT,MAAM,mDAAmDQ,EAAY,6DAA6DA,EAAY,uCAAuCL,cAAcQ,mBAAmB","file":"cleantalk-users-editscreen.min.js","sourcesContent":["function ct_is_email(str){\r\n\treturn str.search(/.*@.*\\..*/);\r\n}\r\nfunction ct_is_ip(str){\r\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t/* Shows \"Find spam users\" Buttons */\r\n\tjQuery('#changeit').after(' <a href=\"users.php?page=ct_check_users\" class=\"button\" style=\"margin:1px 0 0 0; display: inline-block;\">'+ctAdminCommon.logo_small_colored+' '+ctUsersScreen.spambutton_text+'</a> ');\r\n\t\r\n\t/* Shows link to blacklists near every email and IP address */\r\n\tif(parseInt(ctUsersScreen.ct_show_check_links))\r\n\t\tjQuery('.column-email a').each(function(){\r\n\t\t\tvar ct_curr_str = jQuery(this).html();\r\n\t\t\tif(ct_is_email(ct_curr_str) != -1){\r\n\t\t\t\tjQuery(this).after(' <a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctUsersScreen.ct_img_src_new_tab+'\"></a>');\r\n\t\t\t}\r\n\t\t});\r\n});"]}
|
js/cleantalk_external.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function ct_protect_external(){for(
|
2 |
//# sourceMappingURL=cleantalk_external.min.js.map
|
1 |
+
function ct_protect_external(){for(var e=0;e<document.forms.length;e++)if("string"==typeof document.forms[e].action){var t=document.forms[e].action;if(-1!==t.indexOf("http://")||-1!==t.indexOf("https://")){var o=t.split("//");if((o=o[1].split("/"))[0].toLowerCase()!==location.hostname.toLowerCase()){var n=document.createElement("input");n.name="cleantalk_hidden_action",n.value=t,n.type="hidden",document.forms[e].appendChild(n);var a=document.createElement("input");a.name="cleantalk_hidden_method",a.value=document.forms[e].method,a.type="hidden",document.forms[e].method="POST",document.forms[e].appendChild(a),document.forms[e].action=ctNocache.blog_home}}}}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
|
2 |
//# sourceMappingURL=cleantalk_external.min.js.map
|
js/cleantalk_external.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk_external.js"],"names":["ct_protect_external","i","document","forms","length","action","indexOf","tmp","split","
|
1 |
+
{"version":3,"sources":["cleantalk_external.js"],"names":["ct_protect_external","i","document","forms","length","action","indexOf","tmp","split","toLowerCase","location","hostname","ct_action","createElement","name","value","type","appendChild","ct_method","method","ctNocache","blog_home","window","onload","setTimeout"],"mappings":"AAAA,SAASA,sBAER,IAAI,IAAIC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAEzC,GAAuC,iBAA7BC,SAASC,MAAMF,GAAS,OAAc,CAE/C,IAAII,EAASH,SAASC,MAAMF,GAAGI,OAE/B,IAAkC,IAA/BA,EAAOC,QAAQ,aAAqD,IAAhCD,EAAOC,QAAQ,YAAmB,CAExE,IAAIC,EAAMF,EAAOG,MAAM,MAIvB,IAHAD,EAAMA,EAAI,GAAGC,MAAM,MACJ,GAAGC,gBAENC,SAASC,SAASF,cAAc,CAE5B,IAAIG,EAAYV,SAASW,cAAc,SACvCD,EAAUE,KAAO,0BAChCF,EAAUG,MAAQV,EAClBO,EAAUI,KAAO,SACjBd,SAASC,MAAMF,GAAGgB,YAAYL,GAEf,IAAIM,EAAYhB,SAASW,cAAc,SACvCK,EAAUJ,KAAO,0BAChCI,EAAUH,MAAQb,SAASC,MAAMF,GAAGkB,OACpCD,EAAUF,KAAO,SAEjBd,SAASC,MAAMF,GAAGkB,OAAS,OAC3BjB,SAASC,MAAMF,GAAGgB,YAAYC,GAE9BhB,SAASC,MAAMF,GAAGI,OAASe,UAAUC,aAO1CC,OAAOC,OAAS,WACZC,WAAW,WACPxB,uBACD","file":"cleantalk_external.min.js","sourcesContent":["function ct_protect_external(){\r\n\t\t\t\r\n\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\r\n\t\tif(typeof(document.forms[i].action) == 'string'){\r\n\t\t\t\r\n\t\t\tvar action = document.forms[i].action;\r\n\r\n\t\t\tif(action.indexOf('http://') !== -1 || action.indexOf('https://') !== -1){\r\n\t\t\t\t\r\n\t\t\t\tvar tmp = action.split('//');\r\n\t\t\t\ttmp = tmp[1].split('/');\r\n\t\t\t\tvar host = tmp[0].toLowerCase();\r\n\r\n\t\t\t\tif(host !== location.hostname.toLowerCase()){\r\n\r\n var ct_action = document.createElement(\"input\");\r\n ct_action.name = 'cleantalk_hidden_action';\r\n\t\t\t\t\tct_action.value = action;\r\n\t\t\t\t\tct_action.type = 'hidden';\r\n\t\t\t\t\tdocument.forms[i].appendChild(ct_action);\r\n\r\n var ct_method = document.createElement(\"input\");\r\n ct_method.name = 'cleantalk_hidden_method';\r\n\t\t\t\t\tct_method.value = document.forms[i].method;\r\n\t\t\t\t\tct_method.type = 'hidden';\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tdocument.forms[i].method = 'POST';\r\n\t\t\t\t\tdocument.forms[i].appendChild(ct_method);\r\n\t\t\t\t\t\r\n\t\t\t\t\tdocument.forms[i].action = ctNocache.blog_home;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nwindow.onload = function () {\r\n setTimeout(function () {\r\n ct_protect_external()\r\n }, 1500);\r\n};"]}
|
js/cleantalk_internal.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk_internal.js"],"names":["ct_check_internal","currForm","ct_data","elems","elements","key","type","undefined","value","name","jQuery","ajax","url","ctNocache","blog_home","datatype","data","success","alert","submit","error","document","ready","ct_currAction","ct_currForm","i","forms","length","action","indexOf","search","ctPrevHandler","click","off","on"],"mappings":"AAAA,SAASA,kBAAkBC,GAGvB,IAAIC,EAAU,GACVC,EAAQF,EAASG,SAErB,IAAK,IAAIC,KAAOF,EACU,UAAnBA,EAAME,GAAKC,MAAwCC,MAApBJ,EAAME,GAAKG,OAA0C,IAApBL,EAAME,GAAKG,QAE9EN,EAAQC,EAAME,GAAKI,MAAQR,EAASG,SAASC,GAAKG,OAEtDN,EAAgB,OAAI,oBAGpBQ,OAAOC,KAAK,CACRL,KAAM,OACNM,IAAKC,UAAUC,UACfC,SAAW,OACXC,KAAMd,EACNe,QAAS,SAASD,GACd,GAAW,QAARA,EAIC,OADAE,MAAMF,IACC,EAHPf,EAASkB,UAMjBC,MAAO,WACHnB,EAASkB,YAKrBT,OAAOW,UAAUC,MAAO,WACpB,IAAIC,EAAgB,GAChBC,EAAc,GACrB,IAAIC,EAAE,EAAEA,EAAEJ,SAASK,MAAMC,OAAOF,IACM,iBAA3BJ,SAASK,MAAMD,GAAS,UAGK,IADtCF,GADSC,EAAcH,SAASK,MAAMD,IACVG,QACXC,QAAQ,aAAoD,GAApCN,EAAcM,QAAQ,cACW,GAA1DN,EAAcO,OAAO,kCAA2F,GAAhDP,EAAcM,QAAQhB,UAAUC,aAC/FiB,cAAgBP,EAAYQ,MAC5BtB,OAAOc,GAAaS,IAAI,MACxBvB,OAAOc,GAAaS,MACpBvB,OAAOc,GAAaU,GAAG,SAAU,WAE7B,OADAlC,kBAAkBwB,IACX","file":"cleantalk_internal.min.js","sourcesContent":["function ct_check_internal(currForm){\n \n//Gathering data\n var ct_data = {},\n elems = currForm.elements;\n\n for (var key in elems) {\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\n continue;\n ct_data[elems[key].name] = currForm.elements[key].value;\n }\n ct_data['action'] = 'ct_check_internal';\n\n//AJAX Request\n jQuery.ajax({\n type: 'POST',\n url: ctNocache.blog_home,\n datatype : 'text',\n data: ct_data,\n success: function(data){\n if(data == 'true'){\n currForm.submit();\n }else{\n alert(data);\n return false;\n }\n },\n error: function(){\n currForm.submit();\n }\n }); \n}\n \njQuery(document).ready( function(){\n var ct_currAction = '',\n ct_currForm = '';\n\tfor(i=0;i<document.forms.length;i++){\n\t\tif(typeof(document.forms[i].action)=='string'){\n ct_currForm = document.forms[i];\n\t\t\tct_currAction = ct_currForm.action;\n\t\t\tif(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){\n if(ct_currAction.search(/\\/wp-content\\/themes.*\\.php$/) != (-1) && ct_currAction.indexOf(ctNocache.blog_home) != (-1)){\n ctPrevHandler = ct_currForm.click;\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(){\n ct_check_internal(ct_currForm);\n return false;\n });\n }\n }\n\t\t}\n\t}\n});"]}
|
1 |
+
{"version":3,"sources":["cleantalk_internal.js"],"names":["ct_check_internal","currForm","ct_data","elems","elements","key","type","undefined","value","name","jQuery","ajax","url","ctNocache","blog_home","datatype","data","success","alert","submit","error","document","ready","ct_currAction","ct_currForm","i","forms","length","action","indexOf","search","ctPrevHandler","click","off","on"],"mappings":"AAAA,SAASA,kBAAkBC,GAGvB,IAAIC,EAAU,GACVC,EAAQF,EAASG,SAErB,IAAK,IAAIC,KAAOF,EACU,UAAnBA,EAAME,GAAKC,MAAwCC,MAApBJ,EAAME,GAAKG,OAA0C,IAApBL,EAAME,GAAKG,QAE9EN,EAAQC,EAAME,GAAKI,MAAQR,EAASG,SAASC,GAAKG,OAEtDN,EAAgB,OAAI,oBAGpBQ,OAAOC,KAAK,CACRL,KAAM,OACNM,IAAKC,UAAUC,UACfC,SAAW,OACXC,KAAMd,EACNe,QAAS,SAASD,GACd,GAAW,QAARA,EAIC,OADAE,MAAMF,IACC,EAHPf,EAASkB,UAMjBC,MAAO,WACHnB,EAASkB,YAKrBT,OAAOW,UAAUC,MAAO,WACpB,IAAIC,EAAgB,GAChBC,EAAc,GACrB,IAAIC,EAAE,EAAEA,EAAEJ,SAASK,MAAMC,OAAOF,IACM,iBAA3BJ,SAASK,MAAMD,GAAS,UAGK,IADtCF,GADSC,EAAcH,SAASK,MAAMD,IACVG,QACXC,QAAQ,aAAoD,GAApCN,EAAcM,QAAQ,cACW,GAA1DN,EAAcO,OAAO,kCAA2F,GAAhDP,EAAcM,QAAQhB,UAAUC,aAC/FiB,cAAgBP,EAAYQ,MAC5BtB,OAAOc,GAAaS,IAAI,MACxBvB,OAAOc,GAAaS,MACpBvB,OAAOc,GAAaU,GAAG,SAAU,WAE7B,OADAlC,kBAAkBwB,IACX","file":"cleantalk_internal.min.js","sourcesContent":["function ct_check_internal(currForm){\r\n \r\n//Gathering data\r\n var ct_data = {},\r\n elems = currForm.elements;\r\n\r\n for (var key in elems) {\r\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\r\n continue;\r\n ct_data[elems[key].name] = currForm.elements[key].value;\r\n }\r\n ct_data['action'] = 'ct_check_internal';\r\n\r\n//AJAX Request\r\n jQuery.ajax({\r\n type: 'POST',\r\n url: ctNocache.blog_home,\r\n datatype : 'text',\r\n data: ct_data,\r\n success: function(data){\r\n if(data == 'true'){\r\n currForm.submit();\r\n }else{\r\n alert(data);\r\n return false;\r\n }\r\n },\r\n error: function(){\r\n currForm.submit();\r\n }\r\n }); \r\n}\r\n \r\njQuery(document).ready( function(){\r\n var ct_currAction = '',\r\n ct_currForm = '';\r\n\tfor(i=0;i<document.forms.length;i++){\r\n\t\tif(typeof(document.forms[i].action)=='string'){\r\n ct_currForm = document.forms[i];\r\n\t\t\tct_currAction = ct_currForm.action;\r\n\t\t\tif(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){\r\n if(ct_currAction.search(/\\/wp-content\\/themes.*\\.php$/) != (-1) && ct_currAction.indexOf(ctNocache.blog_home) != (-1)){\r\n ctPrevHandler = ct_currForm.click;\r\n jQuery(ct_currForm).off('**');\r\n jQuery(ct_currForm).off();\r\n jQuery(ct_currForm).on('submit', function(){\r\n ct_check_internal(ct_currForm);\r\n return false;\r\n });\r\n }\r\n }\r\n\t\t}\r\n\t}\r\n});"]}
|
js/cleantalk_nocache.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["cleantalk_nocache.js"],"names":["sendRequest","url","callback","postData","req","createXMLHTTPObject","method","location","protocol","replace","open","setRequestHeader","onreadystatechange","readyState","status","send","ctNocache","set_cookies_flag","ajaxurl","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xmlhttp","i","length","e","ct_getCookie","name","matches","document","cookie","match","RegExp","decodeURIComponent","undefined","ct_setCookie","value","date","Date","setDate","getDate","setTimeout","toUTCString","ct_callback","ct_cookie","responseText","trim","forms","f","j","elements","indexOf","now","getTime","ct_nocache_executed","checkjs_cookie","Math","random","info_flag","cleantalk_user_info","cleantalk_screen_info","prop","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","plugins","plugin","version","timezone_offset","getTimezoneOffset","datetime","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","is_flash","isVisitedMain","href","hostname","ct_visited_main","is_main","escape","JSON","stringify"],"mappings":"AAQA,SAASA,YAAYC,EAAIC,EAASC,GAC9B,IAAIC,EAAMC,sBACV,GAAKD,EAAL,CACA,IAAIE,EAAS,EAAa,OAAS,MAI/BL,EADa,WADFM,SAASC,SAEdP,EAAIQ,QAAQ,QAAS,UAErBR,EAAIQ,QAAQ,SAAU,SAGhCL,EAAIM,KAAKJ,EAAOL,GAAI,GAChBE,GACAC,EAAIO,iBAAiB,eAAe,qCACxCP,EAAIQ,mBAAqB,WACC,GAAlBR,EAAIS,aACU,KAAdT,EAAIU,QAA+B,KAAdV,EAAIU,QAI7BZ,EAASE,KAES,GAAlBA,EAAIS,YACRT,EAAIW,KAAKZ,IA7BY,oBAAda,YACPA,UAAUC,kBAAmB,EAC7BD,UAAUE,QAAU,4BA8BxB,IAAIC,iBAAmB,CACnB,WAAa,OAAO,IAAIC,gBACxB,WAAa,OAAO,IAAIC,cAAc,mBACtC,WAAa,OAAO,IAAIA,cAAc,mBACtC,WAAa,OAAO,IAAIA,cAAc,uBAG1C,SAAShB,sBAEL,IADA,IAAIiB,GAAU,EACLC,EAAE,EAAEA,EAAEJ,iBAAiBK,OAAOD,IAAK,CACxC,IACID,EAAUH,iBAAiBI,KAE/B,MAAOE,GACH,SAEJ,MAEJ,OAAOH,EAGX,SAASI,aAAaC,GACpB,IAAIC,EAAUC,SAASC,OAAOC,MAAM,IAAIC,OACtC,WAAaL,EAAKlB,QAAQ,+BAAgC,QAA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k_nocache.min.js","sourcesContent":["/*\n Assign default values for backend variables.\n*/\nif (typeof ctNocache === 'undefined') {\n ctNocache.set_cookies_flag = true;\n ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';\n}\n\nfunction sendRequest(url,callback,postData) {\n var req = createXMLHTTPObject();\n if (!req) return;\n var method = (postData) ? \"POST\" : \"GET\";\n \n var protocol = location.protocol;\n if (protocol === 'https:') {\n url = url.replace('http:', 'https:');\n } else {\n url = url.replace('https:', 'http:');\n }\n \n req.open(method,url,true);\n if (postData)\n req.setRequestHeader('Content-type','application/x-www-form-urlencoded');\n req.onreadystatechange = function () {\n if (req.readyState != 4) return;\n if (req.status != 200 && req.status != 304) {\n// alert('HTTP error ' + req.status);\n return;\n }\n callback(req);\n };\n if (req.readyState == 4) return;\n req.send(postData);\n}\n\nvar XMLHttpFactories = [\n function () {return new XMLHttpRequest()},\n function () {return new ActiveXObject(\"Msxml2.XMLHTTP\")},\n function () {return new ActiveXObject(\"Msxml3.XMLHTTP\")},\n function () {return new ActiveXObject(\"Microsoft.XMLHTTP\")}\n];\n\nfunction createXMLHTTPObject() {\n var xmlhttp = false;\n for (var i=0;i<XMLHttpFactories.length;i++) {\n try {\n xmlhttp = XMLHttpFactories[i]();\n }\n catch (e) {\n continue;\n }\n break;\n }\n return xmlhttp;\n}\n\nfunction ct_getCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\nfunction ct_setCookie(name, value)\n{\n if (ctNocache.set_cookies_flag) {\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /\";\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT\";\n \n var date = new Date;\n date.setDate(date.getDate() + 1);\n setTimeout(function() { document.cookie = name+\"=\" + value + \"; expires=\" + date.toUTCString() + \"; path = /;\"}, 500);\n }\n\n return null;\n}\n\nfunction ct_callback(req)\n{\n\tct_cookie = req.responseText.trim();\n\t//alert('Key value: ' + ct_cookie);\n\t\n\tct_setCookie('ct_checkjs', ct_cookie);\n\t\n\tfor(i=0;i<document.forms.length;i++)\n\t{\n\t\tf=document.forms[i];\n\t\tfor(j=0;j<f.elements.length;j++)\n\t\t{\n\t\t\te=f.elements[j];\n\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t{\n\t\t\t\te.value=ct_cookie;\n\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t}\n\t\t}\n\t}\n\n\t//alert('Set cookie: \\n' + document.cookie);\n}\n\nif (!Date.now) {\n\tDate.now = function() { return new Date().getTime(); }\n}\n\nif(ct_nocache_executed==undefined)\n{\n\tvar ct_nocache_executed=true;\n\t\n\tvar checkjs_cookie=ct_getCookie('ct_checkjs');\n\t\n\tif(checkjs_cookie!=undefined)\n\t{\n\t\tfor(i=0;i<document.forms.length;i++)\n\t\t{\n\t\t\tf=document.forms[i];\n\t\t\tfor(j=0;j<f.elements.length;j++)\n\t\t\t{\n\t\t\t\te=f.elements[j];\n\t\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t\t{\n\t\t\t\t\te.value=checkjs_cookie;\n\t\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\n\t\n\tif(checkjs_cookie==undefined) //86400 is 24 hours\n\t{\n\t\tsendRequest(ctNocache.ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');\n\t}\n\t\n\tif(typeof ctNocache.info_flag !== 'undefined' && ctNocache.info_flag)\n\t{\n\t\n\t\tvar cleantalk_user_info={};\n\t\t\n\t\tvar cleantalk_screen_info={};\n\t\tfor(var prop in screen)\n\t\t{\n\t\t\tif (navigator[prop] instanceof Object || screen[prop]==='')\n\t\t\t\tcontinue;\n\t\t\tcleantalk_screen_info[prop]=screen[prop];\n\t\t}\n\t\t\n\t\tcleantalk_user_info.screen=cleantalk_screen_info;\n\t\t\n\t\tvar cleantalk_plugins=Array();\n\t\tvar prev;\n\t\tvar cnt=0;\n\t\tfor(var i=0;i<navigator.plugins.length;i++)\n\t\t{\n\t\t\tvar plugin = navigator.plugins[i];\n\t\t\tvar plugin = plugin.name+\" \"+(plugin.version || '')\n\t\t\tif (prev == plugin ) continue;\n\t\t\tcleantalk_plugins[cnt]=plugin;\n\t\t\tcnt++;\n\t\t\tprev = plugin;\n\t\t}\n\t\tcleantalk_user_info.plugins=cleantalk_plugins;\n\t\t\n\t\tcleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;\n\t\tcleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);\n\t\t\n\t\tcleantalk_user_info.browser_x=document.documentElement.clientWidth;\n\t\tcleantalk_user_info.browser_y=document.documentElement.clientHeight;\n\t\t\n\t\tvar ua = navigator.userAgent.toLowerCase();\n\t\tvar flashInstalled = 0;\n\t\tif (typeof(navigator.plugins)!=\"undefined\"&&typeof(navigator.plugins[\"Shockwave Flash\"])==\"object\")\n\t\t{\n\t\t\tflashInstalled = 1;\n\t\t}\n\t\telse if (typeof window.ActiveXObject != \"undefined\")\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\"))\n\t\t\t\t{\n\t\t\t\t\tflashInstalled = 1;\n\t\t\t\t}\n\t\t\t} catch(e) {};\n\t\t};\n\t\t\n\t\tcleantalk_user_info.is_flash=flashInstalled;\n\t\t\n\t\tisVisitedMain=-1;\n\t\tif(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t\tsetTimeout(function() { document.cookie = \"ct_visited_main = 1; path = /;\"}, 1500);\n\t\t}\n\t\t\n\t\t\n\t\tct_visited_main = ct_getCookie('ct_visited_main');\n\t\tif(ct_visited_main==undefined && isVisitedMain==-1)\n\t\t{\n\t\t\tisVisitedMain=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t}\n\t\t\n\t\tcleantalk_user_info.is_main=isVisitedMain;\n\t\t\n\t\tsetTimeout(function() { document.cookie = \"ct_user_info = \"+escape(JSON.stringify(cleantalk_user_info))+\"; path = /;\"}, 1500);\n\t}\n}"]}
|
1 |
+
{"version":3,"sources":["cleantalk_nocache.js"],"names":["sendRequest","url","callback","postData","req","createXMLHTTPObject","method","location","protocol","replace","open","setRequestHeader","onreadystatechange","readyState","status","send","ctNocache","set_cookies_flag","ajaxurl","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xmlhttp","i","length","e","ct_getCookie","name","matches","document","cookie","match","RegExp","decodeURIComponent","undefined","ct_setCookie","value","date","Date","setDate","getDate","setTimeout","toUTCString","ct_callback","ct_cookie","responseText","trim","forms","f","j","elements","indexOf","now","getTime","ct_nocache_executed","checkjs_cookie","Math","random","info_flag","cleantalk_user_info","cleantalk_screen_info","prop","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","plugins","plugin","version","timezone_offset","getTimezoneOffset","datetime","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","is_flash","isVisitedMain","href","hostname","ct_visited_main","is_main","escape","JSON","stringify"],"mappings":"AAQA,SAASA,YAAYC,EAAIC,EAASC,GAC9B,IAAIC,EAAMC,sBACV,GAAKD,EAAL,CACA,IAAIE,EAAS,EAAa,OAAS,MAI/BL,EADa,WADFM,SAASC,SAEdP,EAAIQ,QAAQ,QAAS,UAErBR,EAAIQ,QAAQ,SAAU,SAGhCL,EAAIM,KAAKJ,EAAOL,GAAI,GAChBE,GACAC,EAAIO,iBAAiB,eAAe,qCACxCP,EAAIQ,mBAAqB,WACC,GAAlBR,EAAIS,aACU,KAAdT,EAAIU,QAA+B,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,IAApBrB,UAAiB,SAA8D,iBAAvCA,UAAUM,QAAQ,mBAEpEe,eAAiB,OAEb,QAAmC,IAAxBC,OAAOhE,cAEtB,IAEK,IAAIA,cAAc,mCAErB+D,eAAiB,GAEjB,MAAM3D,IAGTkC,oBAAoB2B,SAASF,eAE7BG,eAAe,EACZhF,SAASiF,MAAM,UAAUjF,SAASkF,SAAS,KAAOlF,SAASiF,MAAM,WAAWjF,SAASkF,SAAS,MAEhGF,cAAc,EACd9C,WAAW,WAAaZ,SAASC,OAAS,kCAAmC,OAI9E4D,gBAAkBhE,aAAa,mBACXQ,MAAjBwD,kBAA8C,GAAhBH,cAEhCA,cAAc,EAIdA,cAAc,EAGf5B,oBAAoBgC,QAAQJ,cAE5B9C,WAAW,WAAaZ,SAASC,OAAS,kBAAkB8D,OAAOC,KAAKC,UAAUnC,sBAAsB,eAAgB","file":"cleantalk_nocache.min.js","sourcesContent":["/*\r\n Assign default values for backend variables.\r\n*/\r\nif (typeof ctNocache === 'undefined') {\r\n ctNocache.set_cookies_flag = true;\r\n ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';\r\n}\r\n\r\nfunction sendRequest(url,callback,postData) {\r\n var req = createXMLHTTPObject();\r\n if (!req) return;\r\n var method = (postData) ? \"POST\" : \"GET\";\r\n \r\n var protocol = location.protocol;\r\n if (protocol === 'https:') {\r\n url = url.replace('http:', 'https:');\r\n } else {\r\n url = url.replace('https:', 'http:');\r\n }\r\n \r\n req.open(method,url,true);\r\n if (postData)\r\n req.setRequestHeader('Content-type','application/x-www-form-urlencoded');\r\n req.onreadystatechange = function () {\r\n if (req.readyState != 4) return;\r\n if (req.status != 200 && req.status != 304) {\r\n// alert('HTTP error ' + req.status);\r\n return;\r\n }\r\n callback(req);\r\n };\r\n if (req.readyState == 4) return;\r\n req.send(postData);\r\n}\r\n\r\nvar XMLHttpFactories = [\r\n function () {return new XMLHttpRequest()},\r\n function () {return new ActiveXObject(\"Msxml2.XMLHTTP\")},\r\n function () {return new ActiveXObject(\"Msxml3.XMLHTTP\")},\r\n function () {return new ActiveXObject(\"Microsoft.XMLHTTP\")}\r\n];\r\n\r\nfunction createXMLHTTPObject() {\r\n var xmlhttp = false;\r\n for (var i=0;i<XMLHttpFactories.length;i++) {\r\n try {\r\n xmlhttp = XMLHttpFactories[i]();\r\n }\r\n catch (e) {\r\n continue;\r\n }\r\n break;\r\n }\r\n return xmlhttp;\r\n}\r\n\r\nfunction ct_getCookie(name) {\r\n var matches = document.cookie.match(new RegExp(\r\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\r\n ));\r\n return matches ? decodeURIComponent(matches[1]) : undefined;\r\n}\r\n\r\nfunction ct_setCookie(name, value)\r\n{\r\n if (ctNocache.set_cookies_flag) {\r\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /\";\r\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT\";\r\n \r\n var date = new Date;\r\n date.setDate(date.getDate() + 1);\r\n setTimeout(function() { document.cookie = name+\"=\" + value + \"; expires=\" + date.toUTCString() + \"; path = /;\"}, 500);\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction ct_callback(req)\r\n{\r\n\tct_cookie = req.responseText.trim();\r\n\t//alert('Key value: ' + ct_cookie);\r\n\t\r\n\tct_setCookie('ct_checkjs', ct_cookie);\r\n\t\r\n\tfor(i=0;i<document.forms.length;i++)\r\n\t{\r\n\t\tf=document.forms[i];\r\n\t\tfor(j=0;j<f.elements.length;j++)\r\n\t\t{\r\n\t\t\te=f.elements[j];\r\n\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\r\n\t\t\t{\r\n\t\t\t\te.value=ct_cookie;\r\n\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//alert('Set cookie: \\n' + document.cookie);\r\n}\r\n\r\nif (!Date.now) {\r\n\tDate.now = function() { return new Date().getTime(); }\r\n}\r\n\r\nif(ct_nocache_executed==undefined)\r\n{\r\n\tvar ct_nocache_executed=true;\r\n\t\r\n\tvar checkjs_cookie=ct_getCookie('ct_checkjs');\r\n\t\r\n\tif(checkjs_cookie!=undefined)\r\n\t{\r\n\t\tfor(i=0;i<document.forms.length;i++)\r\n\t\t{\r\n\t\t\tf=document.forms[i];\r\n\t\t\tfor(j=0;j<f.elements.length;j++)\r\n\t\t\t{\r\n\t\t\t\te=f.elements[j];\r\n\t\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\r\n\t\t\t\t{\r\n\t\t\t\t\te.value=checkjs_cookie;\r\n\t\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\t\r\n\t\r\n\tif(checkjs_cookie==undefined) //86400 is 24 hours\r\n\t{\r\n\t\tsendRequest(ctNocache.ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');\r\n\t}\r\n\t\r\n\tif(typeof ctNocache.info_flag !== 'undefined' && ctNocache.info_flag)\r\n\t{\r\n\t\r\n\t\tvar cleantalk_user_info={};\r\n\t\t\r\n\t\tvar cleantalk_screen_info={};\r\n\t\tfor(var prop in screen)\r\n\t\t{\r\n\t\t\tif (navigator[prop] instanceof Object || screen[prop]==='')\r\n\t\t\t\tcontinue;\r\n\t\t\tcleantalk_screen_info[prop]=screen[prop];\r\n\t\t}\r\n\t\t\r\n\t\tcleantalk_user_info.screen=cleantalk_screen_info;\r\n\t\t\r\n\t\tvar cleantalk_plugins=Array();\r\n\t\tvar prev;\r\n\t\tvar cnt=0;\r\n\t\tfor(var i=0;i<navigator.plugins.length;i++)\r\n\t\t{\r\n\t\t\tvar plugin = navigator.plugins[i];\r\n\t\t\tvar plugin = plugin.name+\" \"+(plugin.version || '')\r\n\t\t\tif (prev == plugin ) continue;\r\n\t\t\tcleantalk_plugins[cnt]=plugin;\r\n\t\t\tcnt++;\r\n\t\t\tprev = plugin;\r\n\t\t}\r\n\t\tcleantalk_user_info.plugins=cleantalk_plugins;\r\n\t\t\r\n\t\tcleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;\r\n\t\tcleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);\r\n\t\t\r\n\t\tcleantalk_user_info.browser_x=document.documentElement.clientWidth;\r\n\t\tcleantalk_user_info.browser_y=document.documentElement.clientHeight;\r\n\t\t\r\n\t\tvar ua = navigator.userAgent.toLowerCase();\r\n\t\tvar flashInstalled = 0;\r\n\t\tif (typeof(navigator.plugins)!=\"undefined\"&&typeof(navigator.plugins[\"Shockwave Flash\"])==\"object\")\r\n\t\t{\r\n\t\t\tflashInstalled = 1;\r\n\t\t}\r\n\t\telse if (typeof window.ActiveXObject != \"undefined\")\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tif (new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tflashInstalled = 1;\r\n\t\t\t\t}\r\n\t\t\t} catch(e) {};\r\n\t\t};\r\n\t\t\r\n\t\tcleantalk_user_info.is_flash=flashInstalled;\r\n\t\t\r\n\t\tisVisitedMain=-1;\r\n\t\tif(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')\r\n\t\t{\r\n\t\t\tisVisitedMain=1;\r\n\t\t\tsetTimeout(function() { document.cookie = \"ct_visited_main = 1; path = /;\"}, 1500);\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tct_visited_main = ct_getCookie('ct_visited_main');\r\n\t\tif(ct_visited_main==undefined && isVisitedMain==-1)\r\n\t\t{\r\n\t\t\tisVisitedMain=0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tisVisitedMain=1;\r\n\t\t}\r\n\t\t\r\n\t\tcleantalk_user_info.is_main=isVisitedMain;\r\n\t\t\r\n\t\tsetTimeout(function() { document.cookie = \"ct_user_info = \"+escape(JSON.stringify(cleantalk_user_info))+\"; path = /;\"}, 1500);\r\n\t}\r\n}"]}
|
lib/Cleantalk/Antispam/API.php
CHANGED
@@ -1,774 +1,774 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Cleantalk\Antispam;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* CleanTalk API class.
|
7 |
-
* Mostly contains wrappers for API methods. Check and send mehods.
|
8 |
-
* Compatible with any CMS.
|
9 |
-
*
|
10 |
-
* @version 3.2
|
11 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
12 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
13 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
14 |
-
* @see https://github.com/CleanTalk/php-antispam
|
15 |
-
*/
|
16 |
-
class API
|
17 |
-
{
|
18 |
-
/* Default params */
|
19 |
-
const URL = 'https://api.cleantalk.org';
|
20 |
-
const AGENT = 'ct-api-3.2';
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Wrapper for 2s_blacklists_db API method.
|
24 |
-
* Gets data for SpamFireWall.
|
25 |
-
*
|
26 |
-
* @param string $api_key
|
27 |
-
* @param null|string $out Data output type (JSON or file URL)
|
28 |
-
* @param boolean $do_check
|
29 |
-
*
|
30 |
-
* @return mixed|string|array('error' => STRING)
|
31 |
-
*/
|
32 |
-
static public function method__get_2s_blacklists_db($api_key, $out = null, $do_check = true)
|
33 |
-
{
|
34 |
-
$request = array(
|
35 |
-
'method_name' => '2s_blacklists_db',
|
36 |
-
'auth_key' => $api_key,
|
37 |
-
'out' => $out,
|
38 |
-
);
|
39 |
-
|
40 |
-
$result = static::send_request($request);
|
41 |
-
$result = $do_check ? static::check_response($result, '2s_blacklists_db') : $result;
|
42 |
-
|
43 |
-
return $result;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Wrapper for get_api_key API method.
|
48 |
-
* Gets access key automatically.
|
49 |
-
*
|
50 |
-
* @param string $product_name Type of product
|
51 |
-
* @param string $email Website admin email
|
52 |
-
* @param string $website Website host
|
53 |
-
* @param string $platform Website platform
|
54 |
-
* @param string|null $timezone
|
55 |
-
* @param string|null $language
|
56 |
-
* @param string|null $user_ip
|
57 |
-
* @param bool $wpms
|
58 |
-
* @param bool $white_label
|
59 |
-
* @param string $hoster_api_key
|
60 |
-
* @param bool $do_check
|
61 |
-
*
|
62 |
-
* @return array|bool|mixed
|
63 |
-
*/
|
64 |
-
static public function method__get_api_key($product_name, $email, $website, $platform, $timezone = null, $language = null, $user_ip = null, $wpms = false, $white_label = false, $hoster_api_key = '', $do_check = true)
|
65 |
-
{
|
66 |
-
$request = array(
|
67 |
-
'method_name' => 'get_api_key',
|
68 |
-
'product_name' => $product_name,
|
69 |
-
'email' => $email,
|
70 |
-
'website' => $website,
|
71 |
-
'platform' => $platform,
|
72 |
-
'timezone' => $timezone,
|
73 |
-
'http_accept_language' => $language,
|
74 |
-
'user_ip' => $user_ip,
|
75 |
-
'wpms_setup' => $wpms,
|
76 |
-
'hoster_whitelabel' => $white_label,
|
77 |
-
'hoster_api_key' => $hoster_api_key,
|
78 |
-
);
|
79 |
-
|
80 |
-
$result = static::send_request($request);
|
81 |
-
$result = $do_check ? static::check_response($result, 'get_api_key') : $result;
|
82 |
-
|
83 |
-
return $result;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Wrapper for get_antispam_report API method.
|
88 |
-
* Gets spam report.
|
89 |
-
*
|
90 |
-
* @param string $host website host
|
91 |
-
* @param integer $period report days
|
92 |
-
* @param boolean $do_check
|
93 |
-
*
|
94 |
-
* @return array|bool|mixed
|
95 |
-
*/
|
96 |
-
static public function method__get_antispam_report($host, $period = 1, $do_check = true)
|
97 |
-
{
|
98 |
-
$request = Array(
|
99 |
-
'method_name' => 'get_antispam_report',
|
100 |
-
'hostname' => $host,
|
101 |
-
'period' => $period
|
102 |
-
);
|
103 |
-
|
104 |
-
$result = static::send_request($request);
|
105 |
-
$result = $do_check ? static::check_response($result, 'get_antispam_report') : $result;
|
106 |
-
|
107 |
-
return $result;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Wrapper for get_antispam_report_breif API method.
|
112 |
-
* Ggets spam statistics.
|
113 |
-
*
|
114 |
-
* @param string $api_key
|
115 |
-
* @param bool $do_check
|
116 |
-
*
|
117 |
-
* @return array|bool|mixed
|
118 |
-
*/
|
119 |
-
static public function method__get_antispam_report_breif($api_key, $do_check = true)
|
120 |
-
{
|
121 |
-
$request = array(
|
122 |
-
'method_name' => 'get_antispam_report_breif',
|
123 |
-
'auth_key' => $api_key,
|
124 |
-
);
|
125 |
-
|
126 |
-
$result = static::send_request($request);
|
127 |
-
$result = $do_check ? static::check_response($result, 'get_antispam_report_breif') : $result;
|
128 |
-
|
129 |
-
return $result;
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Wrapper for notice_paid_till API method.
|
134 |
-
* Gets information about renew notice.
|
135 |
-
*
|
136 |
-
* @param string $api_key API key
|
137 |
-
* @param string $path_to_cms Website URL
|
138 |
-
* @param bool $do_check
|
139 |
-
*
|
140 |
-
* @return array|bool|mixed
|
141 |
-
*/
|
142 |
-
static public function method__notice_paid_till($api_key, $path_to_cms, $do_check = true)
|
143 |
-
{
|
144 |
-
$request = array(
|
145 |
-
'method_name' => 'notice_paid_till',
|
146 |
-
'path_to_cms' => $path_to_cms,
|
147 |
-
'auth_key' => $api_key
|
148 |
-
);
|
149 |
-
|
150 |
-
$result = static::send_request($request);
|
151 |
-
$result = $do_check ? static::check_response($result, 'notice_paid_till') : $result;
|
152 |
-
|
153 |
-
return $result;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Wrapper for ip_info API method.
|
158 |
-
* Gets IP country.
|
159 |
-
*
|
160 |
-
* @param string $data
|
161 |
-
* @param bool $do_check
|
162 |
-
*
|
163 |
-
* @return array|bool|mixed
|
164 |
-
*/
|
165 |
-
static public function method__ip_info($data, $do_check = true)
|
166 |
-
{
|
167 |
-
$request = array(
|
168 |
-
'method_name' => 'ip_info',
|
169 |
-
'data' => $data
|
170 |
-
);
|
171 |
-
|
172 |
-
$result = static::send_request($request);
|
173 |
-
$result = $do_check ? static::check_response($result, 'ip_info') : $result;
|
174 |
-
return $result;
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Wrapper for spam_check_cms API method.
|
179 |
-
* Checks IP|email via CleanTalk's database.
|
180 |
-
*
|
181 |
-
* @param string $api_key
|
182 |
-
* @param array $data
|
183 |
-
* @param null|string $date
|
184 |
-
* @param bool $do_check
|
185 |
-
*
|
186 |
-
* @return array|bool|mixed
|
187 |
-
*/
|
188 |
-
static public function method__spam_check_cms($api_key, $data, $date = null, $do_check = true)
|
189 |
-
{
|
190 |
-
$request = Array(
|
191 |
-
'method_name' => 'spam_check_cms',
|
192 |
-
'auth_key' => $api_key,
|
193 |
-
'data' => is_array($data) ? implode(',', $data) : $data,
|
194 |
-
);
|
195 |
-
|
196 |
-
if($date) $request['date'] = $date;
|
197 |
-
|
198 |
-
$result = static::send_request($request, self::URL, 10);
|
199 |
-
$result = $do_check ? static::check_response($result, 'spam_check_cms') : $result;
|
200 |
-
|
201 |
-
return $result;
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Wrapper for spam_check API method.
|
206 |
-
* Checks IP|email via CleanTalk's database.
|
207 |
-
*
|
208 |
-
* @param string $api_key
|
209 |
-
* @param array $data
|
210 |
-
* @param null|string $date
|
211 |
-
* @param bool $do_check
|
212 |
-
*
|
213 |
-
* @return array|bool|mixed
|
214 |
-
*/
|
215 |
-
static public function method__spam_check($api_key, $data, $date = null, $do_check = true)
|
216 |
-
{
|
217 |
-
$request = Array(
|
218 |
-
'method_name' => 'spam_check',
|
219 |
-
'auth_key' => $api_key,
|
220 |
-
'data' => is_array($data) ? implode(',', $data) : $data,
|
221 |
-
);
|
222 |
-
|
223 |
-
if($date) $request['date'] = $date;
|
224 |
-
|
225 |
-
$result = static::send_request($request, self::URL, 10);
|
226 |
-
$result = $do_check ? static::check_response($result, 'spam_check') : $result;
|
227 |
-
|
228 |
-
return $result;
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Wrapper for sfw_logs API method.
|
233 |
-
* Sends SpamFireWall logs to the cloud.
|
234 |
-
*
|
235 |
-
* @param string $api_key
|
236 |
-
* @param array $data
|
237 |
-
* @param bool $do_check
|
238 |
-
*
|
239 |
-
* @return array|bool|mixed
|
240 |
-
*/
|
241 |
-
static public function method__sfw_logs($api_key, $data, $do_check = true)
|
242 |
-
{
|
243 |
-
|
244 |
-
$request = array(
|
245 |
-
'auth_key' => $api_key,
|
246 |
-
'method_name' => 'sfw_logs',
|
247 |
-
'data' => json_encode($data),
|
248 |
-
'rows' => count($data),
|
249 |
-
'timestamp' => time()
|
250 |
-
);
|
251 |
-
|
252 |
-
$result = static::send_request($request);
|
253 |
-
$result = $do_check ? static::check_response($result, 'sfw_logs') : $result;
|
254 |
-
|
255 |
-
return $result;
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Wrapper for security_logs API method.
|
260 |
-
* Sends security logs to the cloud.
|
261 |
-
*
|
262 |
-
* @param string $api_key
|
263 |
-
* @param array $data
|
264 |
-
* @param bool $do_check
|
265 |
-
*
|
266 |
-
* @return array|bool|mixed
|
267 |
-
*/
|
268 |
-
static public function method__security_logs($api_key, $data, $do_check = true)
|
269 |
-
{
|
270 |
-
$request = array(
|
271 |
-
'auth_key' => $api_key,
|
272 |
-
'method_name' => 'security_logs',
|
273 |
-
'timestamp' => current_time('timestamp'),
|
274 |
-
'data' => json_encode($data),
|
275 |
-
'rows' => count($data),
|
276 |
-
);
|
277 |
-
|
278 |
-
$result = static::send_request($request);
|
279 |
-
$result = $do_check ? static::check_response($result, 'security_logs') : $result;
|
280 |
-
|
281 |
-
return $result;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Wrapper for security_logs API method.
|
286 |
-
* Sends Securitty Firewall logs to the cloud.
|
287 |
-
*
|
288 |
-
* @param string $api_key
|
289 |
-
* @param array $data
|
290 |
-
* @param bool $do_check
|
291 |
-
*
|
292 |
-
* @return array|bool|mixed
|
293 |
-
*/
|
294 |
-
static public function method__security_logs__sendFWData($api_key, $data, $do_check = true)
|
295 |
-
{
|
296 |
-
|
297 |
-
$request = array(
|
298 |
-
'auth_key' => $api_key,
|
299 |
-
'method_name' => 'security_logs',
|
300 |
-
'timestamp' => current_time('timestamp'),
|
301 |
-
'data_fw' => json_encode($data),
|
302 |
-
'rows_fw' => count($data),
|
303 |
-
);
|
304 |
-
|
305 |
-
$result = static::send_request($request);
|
306 |
-
$result = $do_check ? static::check_response($result, 'security_logs') : $result;
|
307 |
-
|
308 |
-
return $result;
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Wrapper for security_logs API method.
|
313 |
-
* Sends empty data to the cloud to syncronize version.
|
314 |
-
*
|
315 |
-
* @param string $api_key
|
316 |
-
* @param bool $do_check
|
317 |
-
*
|
318 |
-
* @return array|bool|mixed
|
319 |
-
*/
|
320 |
-
static public function method__security_logs__feedback($api_key, $do_check = true)
|
321 |
-
{
|
322 |
-
$request = array(
|
323 |
-
'auth_key' => $api_key,
|
324 |
-
'method_name' => 'security_logs',
|
325 |
-
'data' => '0',
|
326 |
-
);
|
327 |
-
|
328 |
-
$result = static::send_request($request);
|
329 |
-
$result = $do_check ? static::check_response($result, 'security_logs') : $result;
|
330 |
-
|
331 |
-
return $result;
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Wrapper for security_firewall_data API method.
|
336 |
-
* Gets Securitty Firewall data to write to the local database.
|
337 |
-
*
|
338 |
-
* @param string $api_key
|
339 |
-
* @param bool $do_check
|
340 |
-
*
|
341 |
-
* @return array|bool|mixed
|
342 |
-
*/
|
343 |
-
static public function method__security_firewall_data($api_key, $do_check = true)
|
344 |
-
{
|
345 |
-
|
346 |
-
$request = array(
|
347 |
-
'auth_key' => $api_key,
|
348 |
-
'method_name' => 'security_firewall_data',
|
349 |
-
);
|
350 |
-
|
351 |
-
$result = static::send_request($request);
|
352 |
-
$result = $do_check ? static::check_response($result, 'security_firewall_data') : $result;
|
353 |
-
|
354 |
-
return $result;
|
355 |
-
}
|
356 |
-
|
357 |
-
/**
|
358 |
-
* Wrapper for security_firewall_data_file API method.
|
359 |
-
* Gets URI with security firewall data in .csv.gz file to write to the local database.
|
360 |
-
*
|
361 |
-
* @param string $api_key
|
362 |
-
* @param bool $do_check
|
363 |
-
*
|
364 |
-
* @return array|bool|mixed
|
365 |
-
*/
|
366 |
-
static public function method__security_firewall_data_file($api_key, $do_check = true)
|
367 |
-
{
|
368 |
-
|
369 |
-
$request = array(
|
370 |
-
'auth_key' => $api_key,
|
371 |
-
'method_name' => 'security_firewall_data_file',
|
372 |
-
);
|
373 |
-
|
374 |
-
$result = static::send_request($request);
|
375 |
-
$result = $do_check ? static::check_response($result, 'security_firewall_data_file') : $result;
|
376 |
-
|
377 |
-
return $result;
|
378 |
-
}
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Wrapper for security_linksscan_logs API method.
|
382 |
-
* Send data to the cloud about scanned links.
|
383 |
-
*
|
384 |
-
* @param string $api_key
|
385 |
-
* @param string $scan_time Datetime of scan
|
386 |
-
* @param bool $scan_result
|
387 |
-
* @param int $links_total
|
388 |
-
* @param array $links_list
|
389 |
-
* @param bool $do_check
|
390 |
-
*
|
391 |
-
* @return array|bool|mixed
|
392 |
-
*/
|
393 |
-
static public function method__security_linksscan_logs($api_key, $scan_time, $scan_result, $links_total, $links_list, $do_check = true)
|
394 |
-
{
|
395 |
-
$request = array(
|
396 |
-
'auth_key' => $api_key,
|
397 |
-
'method_name' => 'security_linksscan_logs',
|
398 |
-
'started' => $scan_time,
|
399 |
-
'result' => $scan_result,
|
400 |
-
'total_links_found' => $links_total,
|
401 |
-
'links_list' => $links_list,
|
402 |
-
);
|
403 |
-
|
404 |
-
$result = static::send_request($request);
|
405 |
-
$result = $do_check ? static::check_response($result, 'security_linksscan_logs') : $result;
|
406 |
-
|
407 |
-
return $result;
|
408 |
-
}
|
409 |
-
|
410 |
-
/**
|
411 |
-
* Wrapper for security_mscan_logs API method.
|
412 |
-
* Sends result of file scan to the cloud.
|
413 |
-
*
|
414 |
-
* @param string $api_key
|
415 |
-
* @param int $service_id
|
416 |
-
* @param string $scan_time Datetime of scan
|
417 |
-
* @param bool $scan_result
|
418 |
-
* @param int $scanned_total
|
419 |
-
* @param array $modified List of modified files with details
|
420 |
-
* @param array $unknown List of modified files with details
|
421 |
-
* @param bool $do_check
|
422 |
-
*
|
423 |
-
* @return array|bool|mixed
|
424 |
-
*/
|
425 |
-
static public function method__security_mscan_logs($api_key, $service_id, $scan_time, $scan_result, $scanned_total, $modified, $unknown, $do_check = true)
|
426 |
-
{
|
427 |
-
$request = array(
|
428 |
-
'method_name' => 'security_mscan_logs',
|
429 |
-
'auth_key' => $api_key,
|
430 |
-
'service_id' => $service_id,
|
431 |
-
'started' => $scan_time,
|
432 |
-
'result' => $scan_result,
|
433 |
-
'total_core_files' => $scanned_total,
|
434 |
-
);
|
435 |
-
|
436 |
-
if(!empty($modified)){
|
437 |
-
$request['failed_files'] = json_encode($modified);
|
438 |
-
$request['failed_files_rows'] = count($modified);
|
439 |
-
}
|
440 |
-
if(!empty($unknown)){
|
441 |
-
$request['unknown_files'] = json_encode($unknown);
|
442 |
-
$request['unknown_files_rows'] = count($unknown);
|
443 |
-
}
|
444 |
-
|
445 |
-
$result = static::send_request($request);
|
446 |
-
$result = $do_check ? static::check_response($result, 'security_mscan_logs') : $result;
|
447 |
-
|
448 |
-
return $result;
|
449 |
-
}
|
450 |
-
|
451 |
-
/**
|
452 |
-
* Wrapper for security_mscan_files API method.
|
453 |
-
* Sends file to the cloud for analysis.
|
454 |
-
*
|
455 |
-
* @param string $api_key
|
456 |
-
* @param string $file_path Path to the file
|
457 |
-
* @param array $file File itself
|
458 |
-
* @param string $file_md5 MD5 hash of file
|
459 |
-
* @param array $weak_spots List of weak spots found in file
|
460 |
-
* @param bool $do_check
|
461 |
-
*
|
462 |
-
* @return array|bool|mixed
|
463 |
-
*/
|
464 |
-
static public function method__security_mscan_files($api_key, $file_path, $file, $file_md5, $weak_spots, $do_check = true)
|
465 |
-
{
|
466 |
-
$request = array(
|
467 |
-
'method_name' => 'security_mscan_files',
|
468 |
-
'auth_key' => $api_key,
|
469 |
-
'path_to_sfile' => $file_path,
|
470 |
-
'attached_sfile' => $file,
|
471 |
-
'md5sum_sfile' => $file_md5,
|
472 |
-
'dangerous_code' => $weak_spots,
|
473 |
-
);
|
474 |
-
|
475 |
-
$result = static::send_request($request);
|
476 |
-
$result = $do_check ? static::check_response($result, 'security_mscan_files') : $result;
|
477 |
-
|
478 |
-
return $result;
|
479 |
-
}
|
480 |
-
|
481 |
-
/**
|
482 |
-
* Wrapper for get_antispam_report API method.
|
483 |
-
* Function gets spam domains report.
|
484 |
-
*
|
485 |
-
* @param string $api_key
|
486 |
-
* @param array|string|mixed $data
|
487 |
-
* @param string $date
|
488 |
-
* @param bool $do_check
|
489 |
-
*
|
490 |
-
* @return array|bool|mixed
|
491 |
-
*/
|
492 |
-
static public function method__backlinks_check_cms($api_key, $data, $date = null, $do_check = true)
|
493 |
-
{
|
494 |
-
$request = array(
|
495 |
-
'method_name' => 'backlinks_check_cms',
|
496 |
-
'auth_key' => $api_key,
|
497 |
-
'data' => is_array($data) ? implode(',', $data) : $data,
|
498 |
-
);
|
499 |
-
|
500 |
-
if($date) $request['date'] = $date;
|
501 |
-
|
502 |
-
$result = static::send_request($request);
|
503 |
-
$result = $do_check ? static::check_response($result, 'backlinks_check_cms') : $result;
|
504 |
-
|
505 |
-
return $result;
|
506 |
-
}
|
507 |
-
|
508 |
-
/**
|
509 |
-
* Wrapper for get_antispam_report API method.
|
510 |
-
* Function gets spam domains report
|
511 |
-
*
|
512 |
-
* @param string $api_key
|
513 |
-
* @param array $logs
|
514 |
-
* @param bool $do_check
|
515 |
-
*
|
516 |
-
* @return array|bool|mixed
|
517 |
-
*/
|
518 |
-
static public function method__security_backend_logs($api_key, $logs, $do_check = true)
|
519 |
-
{
|
520 |
-
$request = array(
|
521 |
-
'method_name' => 'security_backend_logs',
|
522 |
-
'auth_key' => $api_key,
|
523 |
-
'logs' => json_encode($logs),
|
524 |
-
'total_logs' => count($logs),
|
525 |
-
);
|
526 |
-
|
527 |
-
$result = static::send_request($request);
|
528 |
-
$result = $do_check ? static::check_response($result, 'security_backend_logs') : $result;
|
529 |
-
|
530 |
-
return $result;
|
531 |
-
}
|
532 |
-
|
533 |
-
/**
|
534 |
-
* Wrapper for get_antispam_report API method.
|
535 |
-
* Sends data about auto repairs
|
536 |
-
*
|
537 |
-
* @param string $api_key
|
538 |
-
* @param bool $repair_result
|
539 |
-
* @param string $repair_comment
|
540 |
-
* @param $repaired_processed_files
|
541 |
-
* @param $repaired_total_files_proccessed
|
542 |
-
* @param $backup_id
|
543 |
-
* @param bool $do_check
|
544 |
-
*
|
545 |
-
* @return array|bool|mixed
|
546 |
-
*/
|
547 |
-
static public function method__security_mscan_repairs($api_key, $repair_result, $repair_comment, $repaired_processed_files, $repaired_total_files_proccessed, $backup_id, $do_check = true)
|
548 |
-
{
|
549 |
-
$request = array(
|
550 |
-
'method_name' => 'security_mscan_repairs',
|
551 |
-
'auth_key' => $api_key,
|
552 |
-
'repair_result' => $repair_result,
|
553 |
-
'repair_comment' => $repair_comment,
|
554 |
-
'repair_processed_files' => json_encode($repaired_processed_files),
|
555 |
-
'repair_total_files_processed' => $repaired_total_files_proccessed,
|
556 |
-
'backup_id' => $backup_id,
|
557 |
-
'mscan_log_id' => 1,
|
558 |
-
);
|
559 |
-
|
560 |
-
$result = static::send_request($request);
|
561 |
-
$result = $do_check ? static::check_response($result, 'security_mscan_repairs') : $result;
|
562 |
-
|
563 |
-
return $result;
|
564 |
-
}
|
565 |
-
|
566 |
-
/**
|
567 |
-
* Wrapper for get_antispam_report API method.
|
568 |
-
* Force server to update checksums for specific plugin\theme
|
569 |
-
*
|
570 |
-
* @param string $api_key
|
571 |
-
* @param string $plugins_and_themes_to_refresh
|
572 |
-
* @param bool $do_check
|
573 |
-
*
|
574 |
-
* @return array|bool|mixed
|
575 |
-
*/
|
576 |
-
static public function method__request_checksums($api_key, $plugins_and_themes_to_refresh, $do_check = true)
|
577 |
-
{
|
578 |
-
$request = array(
|
579 |
-
'method_name' => 'request_checksums',
|
580 |
-
'auth_key' => $api_key,
|
581 |
-
'data' => $plugins_and_themes_to_refresh
|
582 |
-
);
|
583 |
-
|
584 |
-
$result = static::send_request($request);
|
585 |
-
$result = $do_check ? static::check_response($result, 'request_checksums') : $result;
|
586 |
-
|
587 |
-
return $result;
|
588 |
-
}
|
589 |
-
|
590 |
-
/**
|
591 |
-
* Function sends raw request to API server
|
592 |
-
*
|
593 |
-
* @param array $data to send
|
594 |
-
* @param string $url of API server
|
595 |
-
* @param integer $timeout timeout in seconds
|
596 |
-
* @param boolean $ssl use ssl on not
|
597 |
-
*
|
598 |
-
* @return array|bool
|
599 |
-
*/
|
600 |
-
static public function send_request($data, $url = self::URL, $timeout = 5, $ssl = false, $ssl_path = '')
|
601 |
-
{
|
602 |
-
// Possibility to switch agent vaersion
|
603 |
-
$data['agent'] = !empty($data['agent'])
|
604 |
-
? $data['agent']
|
605 |
-
: (defined('CLEANTALK_AGENT') ? CLEANTALK_AGENT : self::AGENT);
|
606 |
-
|
607 |
-
// Make URL string
|
608 |
-
$data_string = http_build_query($data);
|
609 |
-
$data_string = str_replace("&", "&", $data_string);
|
610 |
-
|
611 |
-
// For debug purposes
|
612 |
-
if(defined('CLEANTALK_DEBUG') && CLEANTALK_DEBUG){
|
613 |
-
global $apbct_debug;
|
614 |
-
$apbct_debug['sent_data'] = $data;
|
615 |
-
$apbct_debug['request_string'] = $data_string;
|
616 |
-
}
|
617 |
-
|
618 |
-
// Possibility to switch API url
|
619 |
-
$url = defined('CLEANTALK_API_URL') ? CLEANTALK_API_URL : $url;
|
620 |
-
|
621 |
-
if(function_exists('curl_init')){
|
622 |
-
|
623 |
-
$ch = curl_init();
|
624 |
-
|
625 |
-
// Set diff options
|
626 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
627 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
628 |
-
curl_setopt($ch, CURLOPT_POST, true);
|
629 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
630 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
631 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
632 |
-
|
633 |
-
$ssl_path = $ssl_path
|
634 |
-
? $ssl_path
|
635 |
-
: (defined('CLEANTALK_CASERT_PATH') ? CLEANTALK_CASERT_PATH : '');
|
636 |
-
|
637 |
-
// Switch on/off SSL
|
638 |
-
if($ssl && $ssl_path){
|
639 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
640 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
641 |
-
curl_setopt($ch, CURLOPT_CAINFO, $ssl_path);
|
642 |
-
}else{
|
643 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
644 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
645 |
-
}
|
646 |
-
|
647 |
-
// Make a request
|
648 |
-
$result = curl_exec($ch);
|
649 |
-
$errors = curl_error($ch);
|
650 |
-
curl_close($ch);
|
651 |
-
|
652 |
-
// Retry with SSL enabled if failed
|
653 |
-
if($result === false){
|
654 |
-
if($ssl === false){
|
655 |
-
return self::send_request($data, $url, $timeout, true, $ssl_path);
|
656 |
-
}
|
657 |
-
}
|
658 |
-
|
659 |
-
}else{
|
660 |
-
$errors = 'CURL_NOT_INSTALLED';
|
661 |
-
}
|
662 |
-
|
663 |
-
// Trying to use file_get_contents() to make a API call
|
664 |
-
if(!empty($errors)){
|
665 |
-
if(ini_get('allow_url_fopen')){
|
666 |
-
$opts = array(
|
667 |
-
'http' => array(
|
668 |
-
'method' => "POST",
|
669 |
-
'timeout' => $timeout,
|
670 |
-
'content' => $data_string,
|
671 |
-
),
|
672 |
-
);
|
673 |
-
$context = stream_context_create($opts);
|
674 |
-
$result = @file_get_contents($url, 0, $context);
|
675 |
-
|
676 |
-
$errors = $result === false
|
677 |
-
? $errors . '_FAILED_TO_USE_FILE_GET_CONTENTS'
|
678 |
-
: false;
|
679 |
-
|
680 |
-
}else{
|
681 |
-
$errors .= '_AND_ALLOW_URL_FOPEN_IS_DISABLED';
|
682 |
-
}
|
683 |
-
}
|
684 |
-
|
685 |
-
return empty($result) || !empty($errors)
|
686 |
-
? array('error' => $errors)
|
687 |
-
: $result;
|
688 |
-
}
|
689 |
-
|
690 |
-
/**
|
691 |
-
* Function checks server response
|
692 |
-
*
|
693 |
-
* @param string $result
|
694 |
-
* @param string $method_name
|
695 |
-
*
|
696 |
-
* @return mixed (array || array('error' => true))
|
697 |
-
*/
|
698 |
-
static public function check_response($result, $method_name = null)
|
699 |
-
{
|
700 |
-
// Errors handling
|
701 |
-
// Bad connection
|
702 |
-
if(is_array($result) && isset($result['error'])){
|
703 |
-
return array(
|
704 |
-
'error' => 'CONNECTION_ERROR: ' . (isset($result['error']) ? ' ' . $result['error'] : ''),
|
705 |
-
);
|
706 |
-
}
|
707 |
-
|
708 |
-
// JSON decode errors
|
709 |
-
$result = json_decode($result, true);
|
710 |
-
if(empty($result)){
|
711 |
-
return array(
|
712 |
-
'error' => 'JSON_DECODE_ERROR',
|
713 |
-
);
|
714 |
-
}
|
715 |
-
|
716 |
-
// Server errors
|
717 |
-
if($result &&
|
718 |
-
(isset($result['error_no']) || isset($result['error_message'])) &&
|
719 |
-
(isset($result['error_no']) && $result['error_no'] != 12)
|
720 |
-
){
|
721 |
-
return array(
|
722 |
-
'error' => "SERVER_ERROR NO: {$result['error_no']} MSG: {$result['error_message']}",
|
723 |
-
'error_no' => $result['error_no'],
|
724 |
-
'error_message' => $result['error_message'],
|
725 |
-
);
|
726 |
-
}
|
727 |
-
|
728 |
-
// Pathces for different methods
|
729 |
-
switch($method_name){
|
730 |
-
|
731 |
-
// notice_paid_till
|
732 |
-
case 'notice_paid_till':
|
733 |
-
|
734 |
-
$result = isset($result['data']) ? $result['data'] : $result;
|
735 |
-
|
736 |
-
if((isset($result['error_no']) && $result['error_no'] == 12) ||
|
737 |
-
(
|
738 |
-
!(isset($result['service_id']) && is_int($result['service_id'])) &&
|
739 |
-
empty($result['moderate_ip'])
|
740 |
-
)
|
741 |
-
)
|
742 |
-
$result['valid'] = 0;
|
743 |
-
else
|
744 |
-
$result['valid'] = 1;
|
745 |
-
|
746 |
-
return $result;
|
747 |
-
|
748 |
-
break;
|
749 |
-
|
750 |
-
// get_antispam_report_breif
|
751 |
-
case 'get_antispam_report_breif':
|
752 |
-
|
753 |
-
$out = isset($result['data']) && is_array($result['data'])
|
754 |
-
? $result['data']
|
755 |
-
: array('error' => 'NO_DATA');
|
756 |
-
|
757 |
-
for($tmp = array(), $i = 0; $i < 7; $i++){
|
758 |
-
$tmp[date('Y-m-d', time() - 86400 * 7 + 86400 * $i)] = 0;
|
759 |
-
}
|
760 |
-
$out['spam_stat'] = (array)array_merge($tmp, isset($out['spam_stat']) ? $out['spam_stat'] : array());
|
761 |
-
$out['top5_spam_ip'] = isset($out['top5_spam_ip']) ? $out['top5_spam_ip'] : array();
|
762 |
-
|
763 |
-
return $out;
|
764 |
-
|
765 |
-
break;
|
766 |
-
|
767 |
-
default:
|
768 |
-
return isset($result['data']) && is_array($result['data'])
|
769 |
-
? $result['data']
|
770 |
-
: array('error' => 'NO_DATA');
|
771 |
-
break;
|
772 |
-
}
|
773 |
-
}
|
774 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Cleantalk\Antispam;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* CleanTalk API class.
|
7 |
+
* Mostly contains wrappers for API methods. Check and send mehods.
|
8 |
+
* Compatible with any CMS.
|
9 |
+
*
|
10 |
+
* @version 3.2
|
11 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
12 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
13 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
14 |
+
* @see https://github.com/CleanTalk/php-antispam
|
15 |
+
*/
|
16 |
+
class API
|
17 |
+
{
|
18 |
+
/* Default params */
|
19 |
+
const URL = 'https://api.cleantalk.org';
|
20 |
+
const AGENT = 'ct-api-3.2';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Wrapper for 2s_blacklists_db API method.
|
24 |
+
* Gets data for SpamFireWall.
|
25 |
+
*
|
26 |
+
* @param string $api_key
|
27 |
+
* @param null|string $out Data output type (JSON or file URL)
|
28 |
+
* @param boolean $do_check
|
29 |
+
*
|
30 |
+
* @return mixed|string|array('error' => STRING)
|
31 |
+
*/
|
32 |
+
static public function method__get_2s_blacklists_db($api_key, $out = null, $do_check = true)
|
33 |
+
{
|
34 |
+
$request = array(
|
35 |
+
'method_name' => '2s_blacklists_db',
|
36 |
+
'auth_key' => $api_key,
|
37 |
+
'out' => $out,
|
38 |
+
);
|
39 |
+
|
40 |
+
$result = static::send_request($request);
|
41 |
+
$result = $do_check ? static::check_response($result, '2s_blacklists_db') : $result;
|
42 |
+
|
43 |
+
return $result;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Wrapper for get_api_key API method.
|
48 |
+
* Gets access key automatically.
|
49 |
+
*
|
50 |
+
* @param string $product_name Type of product
|
51 |
+
* @param string $email Website admin email
|
52 |
+
* @param string $website Website host
|
53 |
+
* @param string $platform Website platform
|
54 |
+
* @param string|null $timezone
|
55 |
+
* @param string|null $language
|
56 |
+
* @param string|null $user_ip
|
57 |
+
* @param bool $wpms
|
58 |
+
* @param bool $white_label
|
59 |
+
* @param string $hoster_api_key
|
60 |
+
* @param bool $do_check
|
61 |
+
*
|
62 |
+
* @return array|bool|mixed
|
63 |
+
*/
|
64 |
+
static public function method__get_api_key($product_name, $email, $website, $platform, $timezone = null, $language = null, $user_ip = null, $wpms = false, $white_label = false, $hoster_api_key = '', $do_check = true)
|
65 |
+
{
|
66 |
+
$request = array(
|
67 |
+
'method_name' => 'get_api_key',
|
68 |
+
'product_name' => $product_name,
|
69 |
+
'email' => $email,
|
70 |
+
'website' => $website,
|
71 |
+
'platform' => $platform,
|
72 |
+
'timezone' => $timezone,
|
73 |
+
'http_accept_language' => $language,
|
74 |
+
'user_ip' => $user_ip,
|
75 |
+
'wpms_setup' => $wpms,
|
76 |
+
'hoster_whitelabel' => $white_label,
|
77 |
+
'hoster_api_key' => $hoster_api_key,
|
78 |
+
);
|
79 |
+
|
80 |
+
$result = static::send_request($request);
|
81 |
+
$result = $do_check ? static::check_response($result, 'get_api_key') : $result;
|
82 |
+
|
83 |
+
return $result;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Wrapper for get_antispam_report API method.
|
88 |
+
* Gets spam report.
|
89 |
+
*
|
90 |
+
* @param string $host website host
|
91 |
+
* @param integer $period report days
|
92 |
+
* @param boolean $do_check
|
93 |
+
*
|
94 |
+
* @return array|bool|mixed
|
95 |
+
*/
|
96 |
+
static public function method__get_antispam_report($host, $period = 1, $do_check = true)
|
97 |
+
{
|
98 |
+
$request = Array(
|
99 |
+
'method_name' => 'get_antispam_report',
|
100 |
+
'hostname' => $host,
|
101 |
+
'period' => $period
|
102 |
+
);
|
103 |
+
|
104 |
+
$result = static::send_request($request);
|
105 |
+
$result = $do_check ? static::check_response($result, 'get_antispam_report') : $result;
|
106 |
+
|
107 |
+
return $result;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Wrapper for get_antispam_report_breif API method.
|
112 |
+
* Ggets spam statistics.
|
113 |
+
*
|
114 |
+
* @param string $api_key
|
115 |
+
* @param bool $do_check
|
116 |
+
*
|
117 |
+
* @return array|bool|mixed
|
118 |
+
*/
|
119 |
+
static public function method__get_antispam_report_breif($api_key, $do_check = true)
|
120 |
+
{
|
121 |
+
$request = array(
|
122 |
+
'method_name' => 'get_antispam_report_breif',
|
123 |
+
'auth_key' => $api_key,
|
124 |
+
);
|
125 |
+
|
126 |
+
$result = static::send_request($request);
|
127 |
+
$result = $do_check ? static::check_response($result, 'get_antispam_report_breif') : $result;
|
128 |
+
|
129 |
+
return $result;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Wrapper for notice_paid_till API method.
|
134 |
+
* Gets information about renew notice.
|
135 |
+
*
|
136 |
+
* @param string $api_key API key
|
137 |
+
* @param string $path_to_cms Website URL
|
138 |
+
* @param bool $do_check
|
139 |
+
*
|
140 |
+
* @return array|bool|mixed
|
141 |
+
*/
|
142 |
+
static public function method__notice_paid_till($api_key, $path_to_cms, $do_check = true)
|
143 |
+
{
|
144 |
+
$request = array(
|
145 |
+
'method_name' => 'notice_paid_till',
|
146 |
+
'path_to_cms' => $path_to_cms,
|
147 |
+
'auth_key' => $api_key
|
148 |
+
);
|
149 |
+
|
150 |
+
$result = static::send_request($request);
|
151 |
+
$result = $do_check ? static::check_response($result, 'notice_paid_till') : $result;
|
152 |
+
|
153 |
+
return $result;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Wrapper for ip_info API method.
|
158 |
+
* Gets IP country.
|
159 |
+
*
|
160 |
+
* @param string $data
|
161 |
+
* @param bool $do_check
|
162 |
+
*
|
163 |
+
* @return array|bool|mixed
|
164 |
+
*/
|
165 |
+
static public function method__ip_info($data, $do_check = true)
|
166 |
+
{
|
167 |
+
$request = array(
|
168 |
+
'method_name' => 'ip_info',
|
169 |
+
'data' => $data
|
170 |
+
);
|
171 |
+
|
172 |
+
$result = static::send_request($request);
|
173 |
+
$result = $do_check ? static::check_response($result, 'ip_info') : $result;
|
174 |
+
return $result;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Wrapper for spam_check_cms API method.
|
179 |
+
* Checks IP|email via CleanTalk's database.
|
180 |
+
*
|
181 |
+
* @param string $api_key
|
182 |
+
* @param array $data
|
183 |
+
* @param null|string $date
|
184 |
+
* @param bool $do_check
|
185 |
+
*
|
186 |
+
* @return array|bool|mixed
|
187 |
+
*/
|
188 |
+
static public function method__spam_check_cms($api_key, $data, $date = null, $do_check = true)
|
189 |
+
{
|
190 |
+
$request = Array(
|
191 |
+
'method_name' => 'spam_check_cms',
|
192 |
+
'auth_key' => $api_key,
|
193 |
+
'data' => is_array($data) ? implode(',', $data) : $data,
|
194 |
+
);
|
195 |
+
|
196 |
+
if($date) $request['date'] = $date;
|
197 |
+
|
198 |
+
$result = static::send_request($request, self::URL, 10);
|
199 |
+
$result = $do_check ? static::check_response($result, 'spam_check_cms') : $result;
|
200 |
+
|
201 |
+
return $result;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Wrapper for spam_check API method.
|
206 |
+
* Checks IP|email via CleanTalk's database.
|
207 |
+
*
|
208 |
+
* @param string $api_key
|
209 |
+
* @param array $data
|
210 |
+
* @param null|string $date
|
211 |
+
* @param bool $do_check
|
212 |
+
*
|
213 |
+
* @return array|bool|mixed
|
214 |
+
*/
|
215 |
+
static public function method__spam_check($api_key, $data, $date = null, $do_check = true)
|
216 |
+
{
|
217 |
+
$request = Array(
|
218 |
+
'method_name' => 'spam_check',
|
219 |
+
'auth_key' => $api_key,
|
220 |
+
'data' => is_array($data) ? implode(',', $data) : $data,
|
221 |
+
);
|
222 |
+
|
223 |
+
if($date) $request['date'] = $date;
|
224 |
+
|
225 |
+
$result = static::send_request($request, self::URL, 10);
|
226 |
+
$result = $do_check ? static::check_response($result, 'spam_check') : $result;
|
227 |
+
|
228 |
+
return $result;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Wrapper for sfw_logs API method.
|
233 |
+
* Sends SpamFireWall logs to the cloud.
|
234 |
+
*
|
235 |
+
* @param string $api_key
|
236 |
+
* @param array $data
|
237 |
+
* @param bool $do_check
|
238 |
+
*
|
239 |
+
* @return array|bool|mixed
|
240 |
+
*/
|
241 |
+
static public function method__sfw_logs($api_key, $data, $do_check = true)
|
242 |
+
{
|
243 |
+
|
244 |
+
$request = array(
|
245 |
+
'auth_key' => $api_key,
|
246 |
+
'method_name' => 'sfw_logs',
|
247 |
+
'data' => json_encode($data),
|
248 |
+
'rows' => count($data),
|
249 |
+
'timestamp' => time()
|
250 |
+
);
|
251 |
+
|
252 |
+
$result = static::send_request($request);
|
253 |
+
$result = $do_check ? static::check_response($result, 'sfw_logs') : $result;
|
254 |
+
|
255 |
+
return $result;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Wrapper for security_logs API method.
|
260 |
+
* Sends security logs to the cloud.
|
261 |
+
*
|
262 |
+
* @param string $api_key
|
263 |
+
* @param array $data
|
264 |
+
* @param bool $do_check
|
265 |
+
*
|
266 |
+
* @return array|bool|mixed
|
267 |
+
*/
|
268 |
+
static public function method__security_logs($api_key, $data, $do_check = true)
|
269 |
+
{
|
270 |
+
$request = array(
|
271 |
+
'auth_key' => $api_key,
|
272 |
+
'method_name' => 'security_logs',
|
273 |
+
'timestamp' => current_time('timestamp'),
|
274 |
+
'data' => json_encode($data),
|
275 |
+
'rows' => count($data),
|
276 |
+
);
|
277 |
+
|
278 |
+
$result = static::send_request($request);
|
279 |
+
$result = $do_check ? static::check_response($result, 'security_logs') : $result;
|
280 |
+
|
281 |
+
return $result;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Wrapper for security_logs API method.
|
286 |
+
* Sends Securitty Firewall logs to the cloud.
|
287 |
+
*
|
288 |
+
* @param string $api_key
|
289 |
+
* @param array $data
|
290 |
+
* @param bool $do_check
|
291 |
+
*
|
292 |
+
* @return array|bool|mixed
|
293 |
+
*/
|
294 |
+
static public function method__security_logs__sendFWData($api_key, $data, $do_check = true)
|
295 |
+
{
|
296 |
+
|
297 |
+
$request = array(
|
298 |
+
'auth_key' => $api_key,
|
299 |
+
'method_name' => 'security_logs',
|
300 |
+
'timestamp' => current_time('timestamp'),
|
301 |
+
'data_fw' => json_encode($data),
|
302 |
+
'rows_fw' => count($data),
|
303 |
+
);
|
304 |
+
|
305 |
+
$result = static::send_request($request);
|
306 |
+
$result = $do_check ? static::check_response($result, 'security_logs') : $result;
|
307 |
+
|
308 |
+
return $result;
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Wrapper for security_logs API method.
|
313 |
+
* Sends empty data to the cloud to syncronize version.
|
314 |
+
*
|
315 |
+
* @param string $api_key
|
316 |
+
* @param bool $do_check
|
317 |
+
*
|
318 |
+
* @return array|bool|mixed
|
319 |
+
*/
|
320 |
+
static public function method__security_logs__feedback($api_key, $do_check = true)
|
321 |
+
{
|
322 |
+
$request = array(
|
323 |
+
'auth_key' => $api_key,
|
324 |
+
'method_name' => 'security_logs',
|
325 |
+
'data' => '0',
|
326 |
+
);
|
327 |
+
|
328 |
+
$result = static::send_request($request);
|
329 |
+
$result = $do_check ? static::check_response($result, 'security_logs') : $result;
|
330 |
+
|
331 |
+
return $result;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Wrapper for security_firewall_data API method.
|
336 |
+
* Gets Securitty Firewall data to write to the local database.
|
337 |
+
*
|
338 |
+
* @param string $api_key
|
339 |
+
* @param bool $do_check
|
340 |
+
*
|
341 |
+
* @return array|bool|mixed
|
342 |
+
*/
|
343 |
+
static public function method__security_firewall_data($api_key, $do_check = true)
|
344 |
+
{
|
345 |
+
|
346 |
+
$request = array(
|
347 |
+
'auth_key' => $api_key,
|
348 |
+
'method_name' => 'security_firewall_data',
|
349 |
+
);
|
350 |
+
|
351 |
+
$result = static::send_request($request);
|
352 |
+
$result = $do_check ? static::check_response($result, 'security_firewall_data') : $result;
|
353 |
+
|
354 |
+
return $result;
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
* Wrapper for security_firewall_data_file API method.
|
359 |
+
* Gets URI with security firewall data in .csv.gz file to write to the local database.
|
360 |
+
*
|
361 |
+
* @param string $api_key
|
362 |
+
* @param bool $do_check
|
363 |
+
*
|
364 |
+
* @return array|bool|mixed
|
365 |
+
*/
|
366 |
+
static public function method__security_firewall_data_file($api_key, $do_check = true)
|
367 |
+
{
|
368 |
+
|
369 |
+
$request = array(
|
370 |
+
'auth_key' => $api_key,
|
371 |
+
'method_name' => 'security_firewall_data_file',
|
372 |
+
);
|
373 |
+
|
374 |
+
$result = static::send_request($request);
|
375 |
+
$result = $do_check ? static::check_response($result, 'security_firewall_data_file') : $result;
|
376 |
+
|
377 |
+
return $result;
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Wrapper for security_linksscan_logs API method.
|
382 |
+
* Send data to the cloud about scanned links.
|
383 |
+
*
|
384 |
+
* @param string $api_key
|
385 |
+
* @param string $scan_time Datetime of scan
|
386 |
+
* @param bool $scan_result
|
387 |
+
* @param int $links_total
|
388 |
+
* @param array $links_list
|
389 |
+
* @param bool $do_check
|
390 |
+
*
|
391 |
+
* @return array|bool|mixed
|
392 |
+
*/
|
393 |
+
static public function method__security_linksscan_logs($api_key, $scan_time, $scan_result, $links_total, $links_list, $do_check = true)
|
394 |
+
{
|
395 |
+
$request = array(
|
396 |
+
'auth_key' => $api_key,
|
397 |
+
'method_name' => 'security_linksscan_logs',
|
398 |
+
'started' => $scan_time,
|
399 |
+
'result' => $scan_result,
|
400 |
+
'total_links_found' => $links_total,
|
401 |
+
'links_list' => $links_list,
|
402 |
+
);
|
403 |
+
|
404 |
+
$result = static::send_request($request);
|
405 |
+
$result = $do_check ? static::check_response($result, 'security_linksscan_logs') : $result;
|
406 |
+
|
407 |
+
return $result;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Wrapper for security_mscan_logs API method.
|
412 |
+
* Sends result of file scan to the cloud.
|
413 |
+
*
|
414 |
+
* @param string $api_key
|
415 |
+
* @param int $service_id
|
416 |
+
* @param string $scan_time Datetime of scan
|
417 |
+
* @param bool $scan_result
|
418 |
+
* @param int $scanned_total
|
419 |
+
* @param array $modified List of modified files with details
|
420 |
+
* @param array $unknown List of modified files with details
|
421 |
+
* @param bool $do_check
|
422 |
+
*
|
423 |
+
* @return array|bool|mixed
|
424 |
+
*/
|
425 |
+
static public function method__security_mscan_logs($api_key, $service_id, $scan_time, $scan_result, $scanned_total, $modified, $unknown, $do_check = true)
|
426 |
+
{
|
427 |
+
$request = array(
|
428 |
+
'method_name' => 'security_mscan_logs',
|
429 |
+
'auth_key' => $api_key,
|
430 |
+
'service_id' => $service_id,
|
431 |
+
'started' => $scan_time,
|
432 |
+
'result' => $scan_result,
|
433 |
+
'total_core_files' => $scanned_total,
|
434 |
+
);
|
435 |
+
|
436 |
+
if(!empty($modified)){
|
437 |
+
$request['failed_files'] = json_encode($modified);
|
438 |
+
$request['failed_files_rows'] = count($modified);
|
439 |
+
}
|
440 |
+
if(!empty($unknown)){
|
441 |
+
$request['unknown_files'] = json_encode($unknown);
|
442 |
+
$request['unknown_files_rows'] = count($unknown);
|
443 |
+
}
|
444 |
+
|
445 |
+
$result = static::send_request($request);
|
446 |
+
$result = $do_check ? static::check_response($result, 'security_mscan_logs') : $result;
|
447 |
+
|
448 |
+
return $result;
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Wrapper for security_mscan_files API method.
|
453 |
+
* Sends file to the cloud for analysis.
|
454 |
+
*
|
455 |
+
* @param string $api_key
|
456 |
+
* @param string $file_path Path to the file
|
457 |
+
* @param array $file File itself
|
458 |
+
* @param string $file_md5 MD5 hash of file
|
459 |
+
* @param array $weak_spots List of weak spots found in file
|
460 |
+
* @param bool $do_check
|
461 |
+
*
|
462 |
+
* @return array|bool|mixed
|
463 |
+
*/
|
464 |
+
static public function method__security_mscan_files($api_key, $file_path, $file, $file_md5, $weak_spots, $do_check = true)
|
465 |
+
{
|
466 |
+
$request = array(
|
467 |
+
'method_name' => 'security_mscan_files',
|
468 |
+
'auth_key' => $api_key,
|
469 |
+
'path_to_sfile' => $file_path,
|
470 |
+
'attached_sfile' => $file,
|
471 |
+
'md5sum_sfile' => $file_md5,
|
472 |
+
'dangerous_code' => $weak_spots,
|
473 |
+
);
|
474 |
+
|
475 |
+
$result = static::send_request($request);
|
476 |
+
$result = $do_check ? static::check_response($result, 'security_mscan_files') : $result;
|
477 |
+
|
478 |
+
return $result;
|
479 |
+
}
|
480 |
+
|
481 |
+
/**
|
482 |
+
* Wrapper for get_antispam_report API method.
|
483 |
+
* Function gets spam domains report.
|
484 |
+
*
|
485 |
+
* @param string $api_key
|
486 |
+
* @param array|string|mixed $data
|
487 |
+
* @param string $date
|
488 |
+
* @param bool $do_check
|
489 |
+
*
|
490 |
+
* @return array|bool|mixed
|
491 |
+
*/
|
492 |
+
static public function method__backlinks_check_cms($api_key, $data, $date = null, $do_check = true)
|
493 |
+
{
|
494 |
+
$request = array(
|
495 |
+
'method_name' => 'backlinks_check_cms',
|
496 |
+
'auth_key' => $api_key,
|
497 |
+
'data' => is_array($data) ? implode(',', $data) : $data,
|
498 |
+
);
|
499 |
+
|
500 |
+
if($date) $request['date'] = $date;
|
501 |
+
|
502 |
+
$result = static::send_request($request);
|
503 |
+
$result = $do_check ? static::check_response($result, 'backlinks_check_cms') : $result;
|
504 |
+
|
505 |
+
return $result;
|
506 |
+
}
|
507 |
+
|
508 |
+
/**
|
509 |
+
* Wrapper for get_antispam_report API method.
|
510 |
+
* Function gets spam domains report
|
511 |
+
*
|
512 |
+
* @param string $api_key
|
513 |
+
* @param array $logs
|
514 |
+
* @param bool $do_check
|
515 |
+
*
|
516 |
+
* @return array|bool|mixed
|
517 |
+
*/
|
518 |
+
static public function method__security_backend_logs($api_key, $logs, $do_check = true)
|
519 |
+
{
|
520 |
+
$request = array(
|
521 |
+
'method_name' => 'security_backend_logs',
|
522 |
+
'auth_key' => $api_key,
|
523 |
+
'logs' => json_encode($logs),
|
524 |
+
'total_logs' => count($logs),
|
525 |
+
);
|
526 |
+
|
527 |
+
$result = static::send_request($request);
|
528 |
+
$result = $do_check ? static::check_response($result, 'security_backend_logs') : $result;
|
529 |
+
|
530 |
+
return $result;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* Wrapper for get_antispam_report API method.
|
535 |
+
* Sends data about auto repairs
|
536 |
+
*
|
537 |
+
* @param string $api_key
|
538 |
+
* @param bool $repair_result
|
539 |
+
* @param string $repair_comment
|
540 |
+
* @param $repaired_processed_files
|
541 |
+
* @param $repaired_total_files_proccessed
|
542 |
+
* @param $backup_id
|
543 |
+
* @param bool $do_check
|
544 |
+
*
|
545 |
+
* @return array|bool|mixed
|
546 |
+
*/
|
547 |
+
static public function method__security_mscan_repairs($api_key, $repair_result, $repair_comment, $repaired_processed_files, $repaired_total_files_proccessed, $backup_id, $do_check = true)
|
548 |
+
{
|
549 |
+
$request = array(
|
550 |
+
'method_name' => 'security_mscan_repairs',
|
551 |
+
'auth_key' => $api_key,
|
552 |
+
'repair_result' => $repair_result,
|
553 |
+
'repair_comment' => $repair_comment,
|
554 |
+
'repair_processed_files' => json_encode($repaired_processed_files),
|
555 |
+
'repair_total_files_processed' => $repaired_total_files_proccessed,
|
556 |
+
'backup_id' => $backup_id,
|
557 |
+
'mscan_log_id' => 1,
|
558 |
+
);
|
559 |
+
|
560 |
+
$result = static::send_request($request);
|
561 |
+
$result = $do_check ? static::check_response($result, 'security_mscan_repairs') : $result;
|
562 |
+
|
563 |
+
return $result;
|
564 |
+
}
|
565 |
+
|
566 |
+
/**
|
567 |
+
* Wrapper for get_antispam_report API method.
|
568 |
+
* Force server to update checksums for specific plugin\theme
|
569 |
+
*
|
570 |
+
* @param string $api_key
|
571 |
+
* @param string $plugins_and_themes_to_refresh
|
572 |
+
* @param bool $do_check
|
573 |
+
*
|
574 |
+
* @return array|bool|mixed
|
575 |
+
*/
|
576 |
+
static public function method__request_checksums($api_key, $plugins_and_themes_to_refresh, $do_check = true)
|
577 |
+
{
|
578 |
+
$request = array(
|
579 |
+
'method_name' => 'request_checksums',
|
580 |
+
'auth_key' => $api_key,
|
581 |
+
'data' => $plugins_and_themes_to_refresh
|
582 |
+
);
|
583 |
+
|
584 |
+
$result = static::send_request($request);
|
585 |
+
$result = $do_check ? static::check_response($result, 'request_checksums') : $result;
|
586 |
+
|
587 |
+
return $result;
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* Function sends raw request to API server
|
592 |
+
*
|
593 |
+
* @param array $data to send
|
594 |
+
* @param string $url of API server
|
595 |
+
* @param integer $timeout timeout in seconds
|
596 |
+
* @param boolean $ssl use ssl on not
|
597 |
+
*
|
598 |
+
* @return array|bool
|
599 |
+
*/
|
600 |
+
static public function send_request($data, $url = self::URL, $timeout = 5, $ssl = false, $ssl_path = '')
|
601 |
+
{
|
602 |
+
// Possibility to switch agent vaersion
|
603 |
+
$data['agent'] = !empty($data['agent'])
|
604 |
+
? $data['agent']
|
605 |
+
: (defined('CLEANTALK_AGENT') ? CLEANTALK_AGENT : self::AGENT);
|
606 |
+
|
607 |
+
// Make URL string
|
608 |
+
$data_string = http_build_query($data);
|
609 |
+
$data_string = str_replace("&", "&", $data_string);
|
610 |
+
|
611 |
+
// For debug purposes
|
612 |
+
if(defined('CLEANTALK_DEBUG') && CLEANTALK_DEBUG){
|
613 |
+
global $apbct_debug;
|
614 |
+
$apbct_debug['sent_data'] = $data;
|
615 |
+
$apbct_debug['request_string'] = $data_string;
|
616 |
+
}
|
617 |
+
|
618 |
+
// Possibility to switch API url
|
619 |
+
$url = defined('CLEANTALK_API_URL') ? CLEANTALK_API_URL : $url;
|
620 |
+
|
621 |
+
if(function_exists('curl_init')){
|
622 |
+
|
623 |
+
$ch = curl_init();
|
624 |
+
|
625 |
+
// Set diff options
|
626 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
627 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
628 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
629 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
630 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
631 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
632 |
+
|
633 |
+
$ssl_path = $ssl_path
|
634 |
+
? $ssl_path
|
635 |
+
: (defined('CLEANTALK_CASERT_PATH') ? CLEANTALK_CASERT_PATH : '');
|
636 |
+
|
637 |
+
// Switch on/off SSL
|
638 |
+
if($ssl && $ssl_path){
|
639 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
640 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
641 |
+
curl_setopt($ch, CURLOPT_CAINFO, $ssl_path);
|
642 |
+
}else{
|
643 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
644 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
645 |
+
}
|
646 |
+
|
647 |
+
// Make a request
|
648 |
+
$result = curl_exec($ch);
|
649 |
+
$errors = curl_error($ch);
|
650 |
+
curl_close($ch);
|
651 |
+
|
652 |
+
// Retry with SSL enabled if failed
|
653 |
+
if($result === false){
|
654 |
+
if($ssl === false){
|
655 |
+
return self::send_request($data, $url, $timeout, true, $ssl_path);
|
656 |
+
}
|
657 |
+
}
|
658 |
+
|
659 |
+
}else{
|
660 |
+
$errors = 'CURL_NOT_INSTALLED';
|
661 |
+
}
|
662 |
+
|
663 |
+
// Trying to use file_get_contents() to make a API call
|
664 |
+
if(!empty($errors)){
|
665 |
+
if(ini_get('allow_url_fopen')){
|
666 |
+
$opts = array(
|
667 |
+
'http' => array(
|
668 |
+
'method' => "POST",
|
669 |
+
'timeout' => $timeout,
|
670 |
+
'content' => $data_string,
|
671 |
+
),
|
672 |
+
);
|
673 |
+
$context = stream_context_create($opts);
|
674 |
+
$result = @file_get_contents($url, 0, $context);
|
675 |
+
|
676 |
+
$errors = $result === false
|
677 |
+
? $errors . '_FAILED_TO_USE_FILE_GET_CONTENTS'
|
678 |
+
: false;
|
679 |
+
|
680 |
+
}else{
|
681 |
+
$errors .= '_AND_ALLOW_URL_FOPEN_IS_DISABLED';
|
682 |
+
}
|
683 |
+
}
|
684 |
+
|
685 |
+
return empty($result) || !empty($errors)
|
686 |
+
? array('error' => $errors)
|
687 |
+
: $result;
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Function checks server response
|
692 |
+
*
|
693 |
+
* @param string $result
|
694 |
+
* @param string $method_name
|
695 |
+
*
|
696 |
+
* @return mixed (array || array('error' => true))
|
697 |
+
*/
|
698 |
+
static public function check_response($result, $method_name = null)
|
699 |
+
{
|
700 |
+
// Errors handling
|
701 |
+
// Bad connection
|
702 |
+
if(is_array($result) && isset($result['error'])){
|
703 |
+
return array(
|
704 |
+
'error' => 'CONNECTION_ERROR: ' . (isset($result['error']) ? ' ' . $result['error'] : ''),
|
705 |
+
);
|
706 |
+
}
|
707 |
+
|
708 |
+
// JSON decode errors
|
709 |
+
$result = json_decode($result, true);
|
710 |
+
if(empty($result)){
|
711 |
+
return array(
|
712 |
+
'error' => 'JSON_DECODE_ERROR',
|
713 |
+
);
|
714 |
+
}
|
715 |
+
|
716 |
+
// Server errors
|
717 |
+
if($result &&
|
718 |
+
(isset($result['error_no']) || isset($result['error_message'])) &&
|
719 |
+
(isset($result['error_no']) && $result['error_no'] != 12)
|
720 |
+
){
|
721 |
+
return array(
|
722 |
+
'error' => "SERVER_ERROR NO: {$result['error_no']} MSG: {$result['error_message']}",
|
723 |
+
'error_no' => $result['error_no'],
|
724 |
+
'error_message' => $result['error_message'],
|
725 |
+
);
|
726 |
+
}
|
727 |
+
|
728 |
+
// Pathces for different methods
|
729 |
+
switch($method_name){
|
730 |
+
|
731 |
+
// notice_paid_till
|
732 |
+
case 'notice_paid_till':
|
733 |
+
|
734 |
+
$result = isset($result['data']) ? $result['data'] : $result;
|
735 |
+
|
736 |
+
if((isset($result['error_no']) && $result['error_no'] == 12) ||
|
737 |
+
(
|
738 |
+
!(isset($result['service_id']) && is_int($result['service_id'])) &&
|
739 |
+
empty($result['moderate_ip'])
|
740 |
+
)
|
741 |
+
)
|
742 |
+
$result['valid'] = 0;
|
743 |
+
else
|
744 |
+
$result['valid'] = 1;
|
745 |
+
|
746 |
+
return $result;
|
747 |
+
|
748 |
+
break;
|
749 |
+
|
750 |
+
// get_antispam_report_breif
|
751 |
+
case 'get_antispam_report_breif':
|
752 |
+
|
753 |
+
$out = isset($result['data']) && is_array($result['data'])
|
754 |
+
? $result['data']
|
755 |
+
: array('error' => 'NO_DATA');
|
756 |
+
|
757 |
+
for($tmp = array(), $i = 0; $i < 7; $i++){
|
758 |
+
$tmp[date('Y-m-d', time() - 86400 * 7 + 86400 * $i)] = 0;
|
759 |
+
}
|
760 |
+
$out['spam_stat'] = (array)array_merge($tmp, isset($out['spam_stat']) ? $out['spam_stat'] : array());
|
761 |
+
$out['top5_spam_ip'] = isset($out['top5_spam_ip']) ? $out['top5_spam_ip'] : array();
|
762 |
+
|
763 |
+
return $out;
|
764 |
+
|
765 |
+
break;
|
766 |
+
|
767 |
+
default:
|
768 |
+
return isset($result['data']) && is_array($result['data'])
|
769 |
+
? $result['data']
|
770 |
+
: array('error' => 'NO_DATA');
|
771 |
+
break;
|
772 |
+
}
|
773 |
+
}
|
774 |
}
|
lib/Cleantalk/Antispam/DB.php
CHANGED
@@ -1,111 +1,111 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Cleantalk\Antispam;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* CleanTalk abstract Data Base driver.
|
7 |
-
* Shows what should be inside.
|
8 |
-
* Uses singleton pattern.
|
9 |
-
*
|
10 |
-
* @version 1.0
|
11 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
12 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
13 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
14 |
-
* @see https://github.com/CleanTalk/php-antispam
|
15 |
-
*/
|
16 |
-
|
17 |
-
class DB
|
18 |
-
{
|
19 |
-
|
20 |
-
private static $instance;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var string Query string
|
24 |
-
*/
|
25 |
-
private $query;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var wpdb result
|
29 |
-
*/
|
30 |
-
private $db_result;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var array Processed result
|
34 |
-
*/
|
35 |
-
public $result = array();
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var string Database prefix
|
39 |
-
*/
|
40 |
-
public $prefix = '';
|
41 |
-
|
42 |
-
public function __construct() { }
|
43 |
-
public function __clone() { }
|
44 |
-
public function __wakeup() { }
|
45 |
-
|
46 |
-
public static function getInstance()
|
47 |
-
{
|
48 |
-
if (!isset(static::$instance)) {
|
49 |
-
static::$instance = new static;
|
50 |
-
static::$instance->init();
|
51 |
-
}
|
52 |
-
|
53 |
-
return static::$instance;
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Alternative constructor.
|
58 |
-
* Initilize Database object and write it to property.
|
59 |
-
* Set tables prefix.
|
60 |
-
*/
|
61 |
-
private function init(){ }
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Set $this->query string for next uses
|
65 |
-
*
|
66 |
-
* @param $query
|
67 |
-
* @return $this
|
68 |
-
*/
|
69 |
-
public function set_query($query){ }
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Safely replace place holders
|
73 |
-
*
|
74 |
-
* @param string $query
|
75 |
-
* @param array $vars
|
76 |
-
*
|
77 |
-
* @return $this
|
78 |
-
*/
|
79 |
-
public function prepare($query, $vars = array()){ }
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Run any raw request
|
83 |
-
*
|
84 |
-
* @param $query
|
85 |
-
*
|
86 |
-
* @return bool|int Raw result
|
87 |
-
*/
|
88 |
-
public function execute($query){ }
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Fetchs first column from query.
|
92 |
-
* May receive raw or prepared query.
|
93 |
-
*
|
94 |
-
* @param bool $query
|
95 |
-
* @param bool $response_type
|
96 |
-
*
|
97 |
-
* @return array|object|void|null
|
98 |
-
*/
|
99 |
-
public function fetch($query = false, $response_type = false){ }
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Fetchs all result from query.
|
103 |
-
* May receive raw or prepared query.
|
104 |
-
*
|
105 |
-
* @param bool $query
|
106 |
-
* @param bool $response_type
|
107 |
-
*
|
108 |
-
* @return array|object|null
|
109 |
-
*/
|
110 |
-
public function fetch_all($query = false, $response_type = false){ }
|
111 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Cleantalk\Antispam;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* CleanTalk abstract Data Base driver.
|
7 |
+
* Shows what should be inside.
|
8 |
+
* Uses singleton pattern.
|
9 |
+
*
|
10 |
+
* @version 1.0
|
11 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
12 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
13 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
14 |
+
* @see https://github.com/CleanTalk/php-antispam
|
15 |
+
*/
|
16 |
+
|
17 |
+
class DB
|
18 |
+
{
|
19 |
+
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var string Query string
|
24 |
+
*/
|
25 |
+
private $query;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var wpdb result
|
29 |
+
*/
|
30 |
+
private $db_result;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array Processed result
|
34 |
+
*/
|
35 |
+
public $result = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string Database prefix
|
39 |
+
*/
|
40 |
+
public $prefix = '';
|
41 |
+
|
42 |
+
public function __construct() { }
|
43 |
+
public function __clone() { }
|
44 |
+
public function __wakeup() { }
|
45 |
+
|
46 |
+
public static function getInstance()
|
47 |
+
{
|
48 |
+
if (!isset(static::$instance)) {
|
49 |
+
static::$instance = new static;
|
50 |
+
static::$instance->init();
|
51 |
+
}
|
52 |
+
|
53 |
+
return static::$instance;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Alternative constructor.
|
58 |
+
* Initilize Database object and write it to property.
|
59 |
+
* Set tables prefix.
|
60 |
+
*/
|
61 |
+
private function init(){ }
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Set $this->query string for next uses
|
65 |
+
*
|
66 |
+
* @param $query
|
67 |
+
* @return $this
|
68 |
+
*/
|
69 |
+
public function set_query($query){ }
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Safely replace place holders
|
73 |
+
*
|
74 |
+
* @param string $query
|
75 |
+
* @param array $vars
|
76 |
+
*
|
77 |
+
* @return $this
|
78 |
+
*/
|
79 |
+
public function prepare($query, $vars = array()){ }
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Run any raw request
|
83 |
+
*
|
84 |
+
* @param $query
|
85 |
+
*
|
86 |
+
* @return bool|int Raw result
|
87 |
+
*/
|
88 |
+
public function execute($query){ }
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Fetchs first column from query.
|
92 |
+
* May receive raw or prepared query.
|
93 |
+
*
|
94 |
+
* @param bool $query
|
95 |
+
* @param bool $response_type
|
96 |
+
*
|
97 |
+
* @return array|object|void|null
|
98 |
+
*/
|
99 |
+
public function fetch($query = false, $response_type = false){ }
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Fetchs all result from query.
|
103 |
+
* May receive raw or prepared query.
|
104 |
+
*
|
105 |
+
* @param bool $query
|
106 |
+
* @param bool $response_type
|
107 |
+
*
|
108 |
+
* @return array|object|null
|
109 |
+
*/
|
110 |
+
public function fetch_all($query = false, $response_type = false){ }
|
111 |
}
|
lib/Cleantalk/Antispam/Helper.php
CHANGED
@@ -578,18 +578,22 @@ class Helper
|
|
578 |
public static function array_merge__save_numeric_keys__recursive($arr1, $arr2)
|
579 |
{
|
580 |
foreach($arr2 as $key => $val){
|
|
|
581 |
// Array | array => array
|
582 |
if(isset($arr1[$key]) && is_array($arr1[$key]) && is_array($val)){
|
583 |
$arr1[$key] = self::array_merge__save_numeric_keys__recursive($arr1[$key], $val);
|
584 |
-
|
|
|
585 |
}elseif(isset($arr1[$key]) && !is_array($arr1[$key]) && is_array($val)){
|
586 |
$tmp = $arr1[$key] =
|
587 |
$arr1[$key] = $val;
|
588 |
$arr1[$key][] = $tmp;
|
589 |
-
|
|
|
590 |
}elseif(isset($arr1[$key]) && is_array($arr1[$key]) && !is_array($val)){
|
591 |
$arr1[$key][] = $val;
|
592 |
-
|
|
|
593 |
}else{
|
594 |
$arr1[$key] = $val;
|
595 |
}
|
578 |
public static function array_merge__save_numeric_keys__recursive($arr1, $arr2)
|
579 |
{
|
580 |
foreach($arr2 as $key => $val){
|
581 |
+
|
582 |
// Array | array => array
|
583 |
if(isset($arr1[$key]) && is_array($arr1[$key]) && is_array($val)){
|
584 |
$arr1[$key] = self::array_merge__save_numeric_keys__recursive($arr1[$key], $val);
|
585 |
+
|
586 |
+
// Scalar | array => array
|
587 |
}elseif(isset($arr1[$key]) && !is_array($arr1[$key]) && is_array($val)){
|
588 |
$tmp = $arr1[$key] =
|
589 |
$arr1[$key] = $val;
|
590 |
$arr1[$key][] = $tmp;
|
591 |
+
|
592 |
+
// array | scalar => array
|
593 |
}elseif(isset($arr1[$key]) && is_array($arr1[$key]) && !is_array($val)){
|
594 |
$arr1[$key][] = $val;
|
595 |
+
|
596 |
+
// scalar | scalar => scalar
|
597 |
}else{
|
598 |
$arr1[$key] = $val;
|
599 |
}
|
lib/Cleantalk/Antispam/SFW.php
CHANGED
@@ -1,332 +1,332 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Cleantalk\Antispam;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* CleanTalk SpamFireWall base class.
|
7 |
-
* Compatible with any CMS.
|
8 |
-
*
|
9 |
-
* @depends Cleantalk\Antispam\Helper class
|
10 |
-
* @depends Cleantalk\Antispam\API class
|
11 |
-
* @depends Cleantalk\Antispam\DB class
|
12 |
-
*
|
13 |
-
* @version 3.3
|
14 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
15 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
16 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
17 |
-
* @see https://github.com/CleanTalk/php-antispam
|
18 |
-
*/
|
19 |
-
class SFW
|
20 |
-
{
|
21 |
-
public $ip = 0;
|
22 |
-
|
23 |
-
public $ip_array = Array();
|
24 |
-
|
25 |
-
public $results = array();
|
26 |
-
public $blocked_ip = '';
|
27 |
-
public $result = false;
|
28 |
-
public $pass = true;
|
29 |
-
|
30 |
-
public $test = false;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var array of arrays array(origin => array(
|
34 |
-
'ip' => '192.168.0.1',
|
35 |
-
'network' => '192.168.0.0',
|
36 |
-
'mask' => '24',
|
37 |
-
'status' => -1 (blocked) | 1 (passed)
|
38 |
-
)
|
39 |
-
*/
|
40 |
-
public $all_ips = array();
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var array of arrays array(origin => array(
|
44 |
-
'ip' => '192.168.0.1',
|
45 |
-
)
|
46 |
-
*/
|
47 |
-
public $passed_ips = array();
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @var array of arrays array(origin => array(
|
51 |
-
'ip' => '192.168.0.1',
|
52 |
-
'network' => '192.168.0.0',
|
53 |
-
'mask' => '24',
|
54 |
-
)
|
55 |
-
*/
|
56 |
-
public $blocked_ips = array();
|
57 |
-
|
58 |
-
// Database
|
59 |
-
protected $db;
|
60 |
-
protected $data_table;
|
61 |
-
protected $log_table;
|
62 |
-
|
63 |
-
//Debug
|
64 |
-
public $debug;
|
65 |
-
public $debug_data = '';
|
66 |
-
|
67 |
-
/**
|
68 |
-
* CleantalkSFW_Base constructor.
|
69 |
-
* Creates Database driver instance.
|
70 |
-
*/
|
71 |
-
public function __construct()
|
72 |
-
{
|
73 |
-
if(empty($this->db)){
|
74 |
-
// Creating database object. Depends on current CMS.
|
75 |
-
$this->db = DB::getInstance();
|
76 |
-
|
77 |
-
// Use default tables if not specified
|
78 |
-
$this->data_table = defined('CLEANTALK_TBL_FIREWALL_DATA') ? CLEANTALK_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
|
79 |
-
$this->log_table = defined('CLEANTALK_TBL_FIREWALL_LOG') ? CLEANTALK_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
|
80 |
-
}
|
81 |
-
|
82 |
-
$this->debug = isset($_GET['debug']) && intval($_GET['debug']) === 1 ? true : false;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
|
87 |
-
*
|
88 |
-
* @param array $ips_input type of IP you want to receive
|
89 |
-
* @param bool $v4_only
|
90 |
-
*
|
91 |
-
* @return array|mixed|null
|
92 |
-
*/
|
93 |
-
public function ip__get($ips_input = array('real', 'remote_addr', 'x_forwarded_for', 'x_real_ip', 'cloud_flare'), $v4_only = true){
|
94 |
-
|
95 |
-
$result = Helper::ip__get($ips_input, $v4_only);
|
96 |
-
|
97 |
-
$result = !empty($result) ? array('real' => $result) : array();
|
98 |
-
|
99 |
-
if(isset($_GET['sfw_test_ip'])){
|
100 |
-
if(Helper::ip__validate($_GET['sfw_test_ip']) !== false){
|
101 |
-
$result['sfw_test'] = $_GET['sfw_test_ip'];
|
102 |
-
$this->test = true;
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
return $result;
|
107 |
-
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Checks IP via Database
|
112 |
-
*/
|
113 |
-
public function ip_check()
|
114 |
-
{
|
115 |
-
foreach($this->ip_array as $origin => $current_ip){
|
116 |
-
|
117 |
-
$query = "SELECT
|
118 |
-
COUNT(network) AS cnt, network, mask
|
119 |
-
FROM ".$this->data_table."
|
120 |
-
WHERE network = ".sprintf("%u", ip2long($current_ip))." & mask;";
|
121 |
-
|
122 |
-
$this->db->set_query($query)->fetch();
|
123 |
-
|
124 |
-
if($this->db->result['cnt']){
|
125 |
-
$this->pass = false;
|
126 |
-
$this->blocked_ips[$origin] = array(
|
127 |
-
'ip' => $current_ip,
|
128 |
-
'network' => long2ip($this->db->result['network']),
|
129 |
-
'mask' => Helper::ip__mask__long_to_number($this->db->result['mask']),
|
130 |
-
);
|
131 |
-
$this->all_ips[$origin] = array(
|
132 |
-
'ip' => $current_ip,
|
133 |
-
'network' => long2ip($this->db->result['network']),
|
134 |
-
'mask' => Helper::ip__mask__long_to_number($this->db->result['mask']),
|
135 |
-
'status' => -1,
|
136 |
-
);
|
137 |
-
}else{
|
138 |
-
$this->passed_ips[$origin] = array(
|
139 |
-
'ip' => $current_ip,
|
140 |
-
);
|
141 |
-
$this->all_ips[$origin] = array(
|
142 |
-
'ip' => $current_ip,
|
143 |
-
'status' => 1,
|
144 |
-
);
|
145 |
-
}
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Add entry to SFW log.
|
151 |
-
* Writes to database.
|
152 |
-
*
|
153 |
-
* @param string $ip
|
154 |
-
* @param string $result "blocked" or "passed"
|
155 |
-
*/
|
156 |
-
public function logs__update($ip, $result){
|
157 |
-
|
158 |
-
if($ip === NULL || $result === NULL){
|
159 |
-
return;
|
160 |
-
}
|
161 |
-
|
162 |
-
$blocked = ($result == 'blocked' ? ' + 1' : '');
|
163 |
-
$time = time();
|
164 |
-
|
165 |
-
$query = "INSERT INTO ".$this->log_table."
|
166 |
-
SET
|
167 |
-
ip = '$ip',
|
168 |
-
all_entries = 1,
|
169 |
-
blocked_entries = 1,
|
170 |
-
entries_timestamp = '".intval($time)."'
|
171 |
-
ON DUPLICATE KEY
|
172 |
-
UPDATE
|
173 |
-
all_entries = all_entries + 1,
|
174 |
-
blocked_entries = blocked_entries".strval($blocked).",
|
175 |
-
entries_timestamp = '".intval($time)."'";
|
176 |
-
|
177 |
-
$this->db->execute($query);
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Sends and wipe SFW log
|
182 |
-
*
|
183 |
-
* @param string $ct_key API key
|
184 |
-
*
|
185 |
-
* @return array|bool array('error' => STRING)
|
186 |
-
*/
|
187 |
-
public function logs__send($ct_key){
|
188 |
-
|
189 |
-
//Getting logs
|
190 |
-
$query = "SELECT * FROM ".$this->log_table.";";
|
191 |
-
$this->db->fetch_all($query);
|
192 |
-
|
193 |
-
if(count($this->db->result)){
|
194 |
-
|
195 |
-
//Compile logs
|
196 |
-
$data = array();
|
197 |
-
foreach($this->db->result as $key => $value){
|
198 |
-
$data[] = array(trim($value['ip']), $value['all_entries'], $value['all_entries']-$value['blocked_entries'], $value['entries_timestamp']);
|
199 |
-
}
|
200 |
-
unset($key, $value);
|
201 |
-
|
202 |
-
//Sending the request
|
203 |
-
$result = API::method__sfw_logs($ct_key, $data);
|
204 |
-
|
205 |
-
//Checking answer and deleting all lines from the table
|
206 |
-
if(empty($result['error'])){
|
207 |
-
if($result['rows'] == count($data)){
|
208 |
-
$this->db->execute("DELETE FROM ".$this->log_table.";");
|
209 |
-
return $result;
|
210 |
-
}
|
211 |
-
return array('error' => 'SENT_AND_RECEIVED_LOGS_COUNT_DOESNT_MACH');
|
212 |
-
}else{
|
213 |
-
return $result;
|
214 |
-
}
|
215 |
-
|
216 |
-
}else{
|
217 |
-
return array('error' => 'NO_LOGS_TO_SEND');
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* Updates SFW local base
|
223 |
-
*
|
224 |
-
* @param string $ct_key API key
|
225 |
-
* @param null|string $file_url File URL with SFW data.
|
226 |
-
* @param bool $immediate Requires immmediate update. Without remote call
|
227 |
-
*
|
228 |
-
* @return array|bool array('error' => STRING)
|
229 |
-
*/
|
230 |
-
public function sfw_update($ct_key, $file_url = null, $immediate = false){
|
231 |
-
|
232 |
-
// Getting remote file name
|
233 |
-
if(!$file_url){
|
234 |
-
|
235 |
-
sleep(6);
|
236 |
-
|
237 |
-
$result = API::method__get_2s_blacklists_db($ct_key, 'file');
|
238 |
-
|
239 |
-
if(empty($result['error'])){
|
240 |
-
|
241 |
-
if( !empty($result['file_url']) ){
|
242 |
-
|
243 |
-
$pattenrs = array();
|
244 |
-
$pattenrs[] = 'get';
|
245 |
-
if(!$immediate) $pattenrs[] = 'async';
|
246 |
-
|
247 |
-
return Helper::http__request(
|
248 |
-
get_option('siteurl'),
|
249 |
-
array(
|
250 |
-
'spbc_remote_call_token' => md5($ct_key),
|
251 |
-
'spbc_remote_call_action' => 'sfw_update',
|
252 |
-
'plugin_name' => 'apbct',
|
253 |
-
'file_url' => $result['file_url'],
|
254 |
-
),
|
255 |
-
$pattenrs
|
256 |
-
);
|
257 |
-
|
258 |
-
}else
|
259 |
-
return array('error' => 'BAD_RESPONSE');
|
260 |
-
}else
|
261 |
-
return $result;
|
262 |
-
}else{
|
263 |
-
|
264 |
-
if(Helper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
|
265 |
-
|
266 |
-
if(ini_get('allow_url_fopen')){
|
267 |
-
|
268 |
-
$gf = gzopen($file_url, 'rb');
|
269 |
-
|
270 |
-
if($gf){
|
271 |
-
|
272 |
-
if(!gzeof($gf)){
|
273 |
-
|
274 |
-
$this->db->execute("DELETE FROM ".$this->data_table.";");
|
275 |
-
|
276 |
-
for($count_result = 0; !gzeof($gf); ){
|
277 |
-
|
278 |
-
$query = "INSERT INTO ".$this->data_table." VALUES %s";
|
279 |
-
|
280 |
-
for($i=0, $values = array(); APBCT_WRITE_LIMIT !== $i && !gzeof($gf); $i++, $count_result++){
|
281 |
-
|
282 |
-
$entry = trim(gzgets($gf, 1024));
|
283 |
-
|
284 |
-
if(empty($entry)) continue;
|
285 |
-
|
286 |
-
$entry = explode(',', $entry);
|
287 |
-
|
288 |
-
// Cast result to int
|
289 |
-
$ip = preg_replace('/[^\d]*/', '', $entry[0]);
|
290 |
-
$mask = preg_replace('/[^\d]*/', '', $entry[1]);
|
291 |
-
|
292 |
-
if(!$ip || !$mask) continue;
|
293 |
-
|
294 |
-
$values[] = '('. $ip .','. $mask .')';
|
295 |
-
|
296 |
-
}
|
297 |
-
|
298 |
-
if(!empty($values)){
|
299 |
-
$query = sprintf($query, implode(',', $values).';');
|
300 |
-
$this->db->execute($query);
|
301 |
-
}
|
302 |
-
|
303 |
-
}
|
304 |
-
|
305 |
-
gzclose($gf);
|
306 |
-
return $count_result;
|
307 |
-
|
308 |
-
}else
|
309 |
-
return array('error' => 'ERROR_GZ_EMPTY');
|
310 |
-
}else
|
311 |
-
return array('error' => 'ERROR_OPEN_GZ_FILE');
|
312 |
-
}else
|
313 |
-
return array('error' => 'ERROR_ALLOW_URL_FOPEN_DISABLED');
|
314 |
-
}else
|
315 |
-
return array('error' => 'NO_REMOTE_FILE_FOUND');
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
/**
|
320 |
-
* Shows DIE page.
|
321 |
-
* Stops script executing.
|
322 |
-
*
|
323 |
-
* @param string $api_key
|
324 |
-
* @param string $cookie_prefix
|
325 |
-
* @param string $cookie_domain
|
326 |
-
* @param bool $test
|
327 |
-
*/
|
328 |
-
public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = '', $test = false)
|
329 |
-
{
|
330 |
-
die("IP {$this->blocked_ip} BLACKLISTED");
|
331 |
-
}
|
332 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Cleantalk\Antispam;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* CleanTalk SpamFireWall base class.
|
7 |
+
* Compatible with any CMS.
|
8 |
+
*
|
9 |
+
* @depends Cleantalk\Antispam\Helper class
|
10 |
+
* @depends Cleantalk\Antispam\API class
|
11 |
+
* @depends Cleantalk\Antispam\DB class
|
12 |
+
*
|
13 |
+
* @version 3.3
|
14 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
15 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
16 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
17 |
+
* @see https://github.com/CleanTalk/php-antispam
|
18 |
+
*/
|
19 |
+
class SFW
|
20 |
+
{
|
21 |
+
public $ip = 0;
|
22 |
+
|
23 |
+
public $ip_array = Array();
|
24 |
+
|
25 |
+
public $results = array();
|
26 |
+
public $blocked_ip = '';
|
27 |
+
public $result = false;
|
28 |
+
public $pass = true;
|
29 |
+
|
30 |
+
public $test = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array of arrays array(origin => array(
|
34 |
+
'ip' => '192.168.0.1',
|
35 |
+
'network' => '192.168.0.0',
|
36 |
+
'mask' => '24',
|
37 |
+
'status' => -1 (blocked) | 1 (passed)
|
38 |
+
)
|
39 |
+
*/
|
40 |
+
public $all_ips = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var array of arrays array(origin => array(
|
44 |
+
'ip' => '192.168.0.1',
|
45 |
+
)
|
46 |
+
*/
|
47 |
+
public $passed_ips = array();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var array of arrays array(origin => array(
|
51 |
+
'ip' => '192.168.0.1',
|
52 |
+
'network' => '192.168.0.0',
|
53 |
+
'mask' => '24',
|
54 |
+
)
|
55 |
+
*/
|
56 |
+
public $blocked_ips = array();
|
57 |
+
|
58 |
+
// Database
|
59 |
+
protected $db;
|
60 |
+
protected $data_table;
|
61 |
+
protected $log_table;
|
62 |
+
|
63 |
+
//Debug
|
64 |
+
public $debug;
|
65 |
+
public $debug_data = '';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* CleantalkSFW_Base constructor.
|
69 |
+
* Creates Database driver instance.
|
70 |
+
*/
|
71 |
+
public function __construct()
|
72 |
+
{
|
73 |
+
if(empty($this->db)){
|
74 |
+
// Creating database object. Depends on current CMS.
|
75 |
+
$this->db = DB::getInstance();
|
76 |
+
|
77 |
+
// Use default tables if not specified
|
78 |
+
$this->data_table = defined('CLEANTALK_TBL_FIREWALL_DATA') ? CLEANTALK_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
|
79 |
+
$this->log_table = defined('CLEANTALK_TBL_FIREWALL_LOG') ? CLEANTALK_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
|
80 |
+
}
|
81 |
+
|
82 |
+
$this->debug = isset($_GET['debug']) && intval($_GET['debug']) === 1 ? true : false;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
|
87 |
+
*
|
88 |
+
* @param array $ips_input type of IP you want to receive
|
89 |
+
* @param bool $v4_only
|
90 |
+
*
|
91 |
+
* @return array|mixed|null
|
92 |
+
*/
|
93 |
+
public function ip__get($ips_input = array('real', 'remote_addr', 'x_forwarded_for', 'x_real_ip', 'cloud_flare'), $v4_only = true){
|
94 |
+
|
95 |
+
$result = Helper::ip__get($ips_input, $v4_only);
|
96 |
+
|
97 |
+
$result = !empty($result) ? array('real' => $result) : array();
|
98 |
+
|
99 |
+
if(isset($_GET['sfw_test_ip'])){
|
100 |
+
if(Helper::ip__validate($_GET['sfw_test_ip']) !== false){
|
101 |
+
$result['sfw_test'] = $_GET['sfw_test_ip'];
|
102 |
+
$this->test = true;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return $result;
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks IP via Database
|
112 |
+
*/
|
113 |
+
public function ip_check()
|
114 |
+
{
|
115 |
+
foreach($this->ip_array as $origin => $current_ip){
|
116 |
+
|
117 |
+
$query = "SELECT
|
118 |
+
COUNT(network) AS cnt, network, mask
|
119 |
+
FROM ".$this->data_table."
|
120 |
+
WHERE network = ".sprintf("%u", ip2long($current_ip))." & mask;";
|
121 |
+
|
122 |
+
$this->db->set_query($query)->fetch();
|
123 |
+
|
124 |
+
if($this->db->result['cnt']){
|
125 |
+
$this->pass = false;
|
126 |
+
$this->blocked_ips[$origin] = array(
|
127 |
+
'ip' => $current_ip,
|
128 |
+
'network' => long2ip($this->db->result['network']),
|
129 |
+
'mask' => Helper::ip__mask__long_to_number($this->db->result['mask']),
|
130 |
+
);
|
131 |
+
$this->all_ips[$origin] = array(
|
132 |
+
'ip' => $current_ip,
|
133 |
+
'network' => long2ip($this->db->result['network']),
|
134 |
+
'mask' => Helper::ip__mask__long_to_number($this->db->result['mask']),
|
135 |
+
'status' => -1,
|
136 |
+
);
|
137 |
+
}else{
|
138 |
+
$this->passed_ips[$origin] = array(
|
139 |
+
'ip' => $current_ip,
|
140 |
+
);
|
141 |
+
$this->all_ips[$origin] = array(
|
142 |
+
'ip' => $current_ip,
|
143 |
+
'status' => 1,
|
144 |
+
);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Add entry to SFW log.
|
151 |
+
* Writes to database.
|
152 |
+
*
|
153 |
+
* @param string $ip
|
154 |
+
* @param string $result "blocked" or "passed"
|
155 |
+
*/
|
156 |
+
public function logs__update($ip, $result){
|
157 |
+
|
158 |
+
if($ip === NULL || $result === NULL){
|
159 |
+
return;
|
160 |
+
}
|
161 |
+
|
162 |
+
$blocked = ($result == 'blocked' ? ' + 1' : '');
|
163 |
+
$time = time();
|
164 |
+
|
165 |
+
$query = "INSERT INTO ".$this->log_table."
|
166 |
+
SET
|
167 |
+
ip = '$ip',
|
168 |
+
all_entries = 1,
|
169 |
+
blocked_entries = 1,
|
170 |
+
entries_timestamp = '".intval($time)."'
|
171 |
+
ON DUPLICATE KEY
|
172 |
+
UPDATE
|
173 |
+
all_entries = all_entries + 1,
|
174 |
+
blocked_entries = blocked_entries".strval($blocked).",
|
175 |
+
entries_timestamp = '".intval($time)."'";
|
176 |
+
|
177 |
+
$this->db->execute($query);
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Sends and wipe SFW log
|
182 |
+
*
|
183 |
+
* @param string $ct_key API key
|
184 |
+
*
|
185 |
+
* @return array|bool array('error' => STRING)
|
186 |
+
*/
|
187 |
+
public function logs__send($ct_key){
|
188 |
+
|
189 |
+
//Getting logs
|
190 |
+
$query = "SELECT * FROM ".$this->log_table.";";
|
191 |
+
$this->db->fetch_all($query);
|
192 |
+
|
193 |
+
if(count($this->db->result)){
|
194 |
+
|
195 |
+
//Compile logs
|
196 |
+
$data = array();
|
197 |
+
foreach($this->db->result as $key => $value){
|
198 |
+
$data[] = array(trim($value['ip']), $value['all_entries'], $value['all_entries']-$value['blocked_entries'], $value['entries_timestamp']);
|
199 |
+
}
|
200 |
+
unset($key, $value);
|
201 |
+
|
202 |
+
//Sending the request
|
203 |
+
$result = API::method__sfw_logs($ct_key, $data);
|
204 |
+
|
205 |
+
//Checking answer and deleting all lines from the table
|
206 |
+
if(empty($result['error'])){
|
207 |
+
if($result['rows'] == count($data)){
|
208 |
+
$this->db->execute("DELETE FROM ".$this->log_table.";");
|
209 |
+
return $result;
|
210 |
+
}
|
211 |
+
return array('error' => 'SENT_AND_RECEIVED_LOGS_COUNT_DOESNT_MACH');
|
212 |
+
}else{
|
213 |
+
return $result;
|
214 |
+
}
|
215 |
+
|
216 |
+
}else{
|
217 |
+
return array('error' => 'NO_LOGS_TO_SEND');
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Updates SFW local base
|
223 |
+
*
|
224 |
+
* @param string $ct_key API key
|
225 |
+
* @param null|string $file_url File URL with SFW data.
|
226 |
+
* @param bool $immediate Requires immmediate update. Without remote call
|
227 |
+
*
|
228 |
+
* @return array|bool array('error' => STRING)
|
229 |
+
*/
|
230 |
+
public function sfw_update($ct_key, $file_url = null, $immediate = false){
|
231 |
+
|
232 |
+
// Getting remote file name
|
233 |
+
if(!$file_url){
|
234 |
+
|
235 |
+
sleep(6);
|
236 |
+
|
237 |
+
$result = API::method__get_2s_blacklists_db($ct_key, 'file');
|
238 |
+
|
239 |
+
if(empty($result['error'])){
|
240 |
+
|
241 |
+
if( !empty($result['file_url']) ){
|
242 |
+
|
243 |
+
$pattenrs = array();
|
244 |
+
$pattenrs[] = 'get';
|
245 |
+
if(!$immediate) $pattenrs[] = 'async';
|
246 |
+
|
247 |
+
return Helper::http__request(
|
248 |
+
get_option('siteurl'),
|
249 |
+
array(
|
250 |
+
'spbc_remote_call_token' => md5($ct_key),
|
251 |
+
'spbc_remote_call_action' => 'sfw_update',
|
252 |
+
'plugin_name' => 'apbct',
|
253 |
+
'file_url' => $result['file_url'],
|
254 |
+
),
|
255 |
+
$pattenrs
|
256 |
+
);
|
257 |
+
|
258 |
+
}else
|
259 |
+
return array('error' => 'BAD_RESPONSE');
|
260 |
+
}else
|
261 |
+
return $result;
|
262 |
+
}else{
|
263 |
+
|
264 |
+
if(Helper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
|
265 |
+
|
266 |
+
if(ini_get('allow_url_fopen')){
|
267 |
+
|
268 |
+
$gf = gzopen($file_url, 'rb');
|
269 |
+
|
270 |
+
if($gf){
|
271 |
+
|
272 |
+
if(!gzeof($gf)){
|
273 |
+
|
274 |
+
$this->db->execute("DELETE FROM ".$this->data_table.";");
|
275 |
+
|
276 |
+
for($count_result = 0; !gzeof($gf); ){
|
277 |
+
|
278 |
+
$query = "INSERT INTO ".$this->data_table." VALUES %s";
|
279 |
+
|
280 |
+
for($i=0, $values = array(); APBCT_WRITE_LIMIT !== $i && !gzeof($gf); $i++, $count_result++){
|
281 |
+
|
282 |
+
$entry = trim(gzgets($gf, 1024));
|
283 |
+
|
284 |
+
if(empty($entry)) continue;
|
285 |
+
|
286 |
+
$entry = explode(',', $entry);
|
287 |
+
|
288 |
+
// Cast result to int
|
289 |
+
$ip = preg_replace('/[^\d]*/', '', $entry[0]);
|
290 |
+
$mask = preg_replace('/[^\d]*/', '', $entry[1]);
|
291 |
+
|
292 |
+
if(!$ip || !$mask) continue;
|
293 |
+
|
294 |
+
$values[] = '('. $ip .','. $mask .')';
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
if(!empty($values)){
|
299 |
+
$query = sprintf($query, implode(',', $values).';');
|
300 |
+
$this->db->execute($query);
|
301 |
+
}
|
302 |
+
|
303 |
+
}
|
304 |
+
|
305 |
+
gzclose($gf);
|
306 |
+
return $count_result;
|
307 |
+
|
308 |
+
}else
|
309 |
+
return array('error' => 'ERROR_GZ_EMPTY');
|
310 |
+
}else
|
311 |
+
return array('error' => 'ERROR_OPEN_GZ_FILE');
|
312 |
+
}else
|
313 |
+
return array('error' => 'ERROR_ALLOW_URL_FOPEN_DISABLED');
|
314 |
+
}else
|
315 |
+
return array('error' => 'NO_REMOTE_FILE_FOUND');
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Shows DIE page.
|
321 |
+
* Stops script executing.
|
322 |
+
*
|
323 |
+
* @param string $api_key
|
324 |
+
* @param string $cookie_prefix
|
325 |
+
* @param string $cookie_domain
|
326 |
+
* @param bool $test
|
327 |
+
*/
|
328 |
+
public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = '', $test = false)
|
329 |
+
{
|
330 |
+
die("IP {$this->blocked_ip} BLACKLISTED");
|
331 |
+
}
|
332 |
+
}
|
lib/Cleantalk/Arr.php
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
namespace Cleantalk;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Arr
|
8 |
+
* Fluent Interface
|
9 |
+
* Allows to work with multi dimensional arrays
|
10 |
+
*
|
11 |
+
* @package Cleantalk
|
12 |
+
*/
|
13 |
+
class Arr
|
14 |
+
{
|
15 |
+
|
16 |
+
private $array = array();
|
17 |
+
private $found = array();
|
18 |
+
private $result = array();
|
19 |
+
|
20 |
+
public function __construct( $array )
|
21 |
+
{
|
22 |
+
$this->array = is_array( $array )
|
23 |
+
? $array
|
24 |
+
: array();
|
25 |
+
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Recursive
|
31 |
+
* Check if Array has keys given keys
|
32 |
+
* Save found keys in $this->found
|
33 |
+
*
|
34 |
+
* @param array|string $keys
|
35 |
+
* @param bool $regexp
|
36 |
+
* @param array $array
|
37 |
+
*
|
38 |
+
* @return Arr
|
39 |
+
*/
|
40 |
+
public function get_keys( $keys = array(), $regexp = false, $array = array() )
|
41 |
+
{
|
42 |
+
$array = $array ? $array : $this->array;
|
43 |
+
$keys = is_array( $keys ) ? $keys : explode( ',', $keys );
|
44 |
+
|
45 |
+
if( empty( $array ) || empty( $keys ) )
|
46 |
+
return $this;
|
47 |
+
|
48 |
+
$this->found = $keys === array('all')
|
49 |
+
? $this->array
|
50 |
+
: $this->search(
|
51 |
+
'key',
|
52 |
+
$array,
|
53 |
+
$keys,
|
54 |
+
$regexp
|
55 |
+
);
|
56 |
+
|
57 |
+
return $this;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Recursive
|
62 |
+
* Check if Array has valuse given valuse
|
63 |
+
* Save found keys in $this->found
|
64 |
+
*
|
65 |
+
* @param array|string $values
|
66 |
+
* @param bool $regexp
|
67 |
+
* @param array $array
|
68 |
+
*
|
69 |
+
* @return $this
|
70 |
+
*/
|
71 |
+
public function get_values( $values = array(), $regexp = false, $array = array() )
|
72 |
+
{
|
73 |
+
$array = $array ? $array : $this->array;
|
74 |
+
$keys = is_array( $values ) ? $values : explode( ',', $values );
|
75 |
+
|
76 |
+
if( empty( $array ) || empty( $values ) )
|
77 |
+
return $this;
|
78 |
+
|
79 |
+
$this->found = $values === array('all')
|
80 |
+
? $this->array
|
81 |
+
: $this->search(
|
82 |
+
'value',
|
83 |
+
$array,
|
84 |
+
$keys,
|
85 |
+
$regexp
|
86 |
+
);
|
87 |
+
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function get_array( $searched = array(), $regexp = false, $array = array() ){
|
92 |
+
|
93 |
+
$array = $array ? $array : $this->array;
|
94 |
+
|
95 |
+
|
96 |
+
if( empty( $array ) || empty( $searched ) )
|
97 |
+
return $this;
|
98 |
+
|
99 |
+
$this->found = $searched === array('all')
|
100 |
+
? $this->array
|
101 |
+
: $this->search(
|
102 |
+
'array',
|
103 |
+
$array,
|
104 |
+
$searched,
|
105 |
+
$regexp
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->found = $this->found === $searched ? $this->found : array();
|
109 |
+
|
110 |
+
return $this;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Recursive
|
115 |
+
* Check if array contains wanted data type
|
116 |
+
*
|
117 |
+
* @param string $type
|
118 |
+
* @param array $array
|
119 |
+
* @param array $found
|
120 |
+
*
|
121 |
+
* @return bool|void
|
122 |
+
*/
|
123 |
+
public function is( $type, $array = array(), $found = array() )
|
124 |
+
{
|
125 |
+
$array = $array ? $array : $this->array;
|
126 |
+
$found = $found ? $found : $this->found;
|
127 |
+
|
128 |
+
foreach ( $array as $key => $value ){
|
129 |
+
|
130 |
+
if( array_key_exists( $key, $found ) ){
|
131 |
+
if( is_array( $found[ $key ] ) ){
|
132 |
+
if( ! $this->is( $type, $value, $found[ $key ] ) ){
|
133 |
+
return false;
|
134 |
+
}
|
135 |
+
}else{
|
136 |
+
switch ( $type ){
|
137 |
+
case 'regexp':
|
138 |
+
$value = preg_match( '/\/.*\//', $value ) === 1 ? $value : '/' . $value . '/';
|
139 |
+
if( @preg_match( $value, null ) === false ){
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
break;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @param string $type
|
154 |
+
* @param array $array
|
155 |
+
* @param array $searched
|
156 |
+
* @param bool $regexp
|
157 |
+
* @param array $found
|
158 |
+
*
|
159 |
+
* @return array
|
160 |
+
*/
|
161 |
+
private function search( $type, $array = array(), $searched = array(), $regexp = false, $found = array() )
|
162 |
+
{
|
163 |
+
foreach ( $array as $key => $value ){
|
164 |
+
|
165 |
+
// Recursion
|
166 |
+
if( is_array( $value ) ){
|
167 |
+
$result = $this->search( $type, $value, $searched, $regexp, array() );
|
168 |
+
if($result)
|
169 |
+
$found[$key] = $result;
|
170 |
+
|
171 |
+
// Execution
|
172 |
+
}else{
|
173 |
+
foreach ( $searched as $searched_key => $searched_val ){
|
174 |
+
switch ($type){
|
175 |
+
case 'key':
|
176 |
+
if( $key == $searched_val || ($regexp && preg_match( '/' . $searched_val . '/', $key) === 1) )
|
177 |
+
$found[$key] = true;
|
178 |
+
break;
|
179 |
+
case 'value':
|
180 |
+
if( stripos($value, $searched_val) !== false || ($regexp && preg_match( '/' . $searched_val . '/', $value) === 1) )
|
181 |
+
$found[$key] = true;
|
182 |
+
break;
|
183 |
+
case 'array':
|
184 |
+
if( stripos($key, $searched_key) !== false || ($regexp && preg_match( '/' . $searched_key . '/', $key) === 1) )
|
185 |
+
if( is_array( $value ) && is_array( $value )){
|
186 |
+
$result = $this->search( 'array', $value, $searched_key, $regexp, array() );
|
187 |
+
if( $result ){
|
188 |
+
$found[ $key ] = $result;
|
189 |
+
}
|
190 |
+
}else{
|
191 |
+
$found[$key] = $value;
|
192 |
+
}
|
193 |
+
break;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
return $found;
|
200 |
+
}
|
201 |
+
|
202 |
+
public function compare( $arr1, $arr2 ){
|
203 |
+
// $arr1 = is_array( $arr1 ) ? $arr1 : array();
|
204 |
+
// $arr2 = is_array( $arr2 ) ? $arr2 : array();
|
205 |
+
foreach ( $arr1 as $key1 => $val1 ){
|
206 |
+
if( $arr1 === $arr2 ){
|
207 |
+
if(is_array($arr1) && is_array($arr2)){
|
208 |
+
$result = $this->compare( $arr1, $arr2 );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Recursive
|
216 |
+
* Delete elements from array with found keys ( $this->found )
|
217 |
+
* If $searched param is differ from 'arr_special_param'
|
218 |
+
*
|
219 |
+
* @param mixed $searched
|
220 |
+
* @param array $array
|
221 |
+
* @param array $found
|
222 |
+
*
|
223 |
+
* @return array
|
224 |
+
*/
|
225 |
+
public function delete( $searched = 'arr_special_param', $array = array(), $found =array() )
|
226 |
+
{
|
227 |
+
$array = $array ? $array : $this->array;
|
228 |
+
$found = $found ? $found : $this->found;
|
229 |
+
|
230 |
+
foreach($array as $key => $value){
|
231 |
+
|
232 |
+
if(array_key_exists($key, $found)){
|
233 |
+
if( is_array( $found[ $key ] ) ){
|
234 |
+
$array[ $key ] = $this->delete( $searched, $value, $found[ $key ] );
|
235 |
+
if( empty( $array[ $key ] ) )
|
236 |
+
unset( $array[ $key ] );
|
237 |
+
}else{
|
238 |
+
if( $searched === 'arr_special_param' || $searched === $value ){
|
239 |
+
unset( $array[ $key ] );
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
$this->result = $array;
|
247 |
+
return $array;
|
248 |
+
}
|
249 |
+
|
250 |
+
public function result(){
|
251 |
+
return (boolean) $this->found;
|
252 |
+
}
|
253 |
+
}
|
lib/CleantalkAPI.php
CHANGED
@@ -1,67 +1,67 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class CleantalkAPI.
|
5 |
-
* Compatible only with Wordpress.
|
6 |
-
*
|
7 |
-
* @depends Cleantalk\Antispam\API
|
8 |
-
*
|
9 |
-
* @version 1.0
|
10 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
11 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
12 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
13 |
-
* @see https://github.com/CleanTalk/wordpress-antispam
|
14 |
-
*/
|
15 |
-
class CleantalkAPI extends Cleantalk\Antispam\API
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* Function sends raw request to API server.
|
19 |
-
* May use built in Wordpress HTTP-API
|
20 |
-
*
|
21 |
-
* @param array Data to send
|
22 |
-
* @param string API server URL
|
23 |
-
* @param int $timeout
|
24 |
-
* @param bool Do we need to use SSL
|
25 |
-
*
|
26 |
-
* @return array|bool
|
27 |
-
*/
|
28 |
-
static public function send_request($data, $url = self::URL, $timeout = 5, $ssl = false, $ssl_path = '')
|
29 |
-
{
|
30 |
-
global $apbct;
|
31 |
-
|
32 |
-
// Possibility to switch API url
|
33 |
-
$url = defined('CLEANTALK_API_URL') ? CLEANTALK_API_URL : $url;
|
34 |
-
|
35 |
-
// Adding agent version to data
|
36 |
-
$data['agent'] = APBCT_AGENT;
|
37 |
-
|
38 |
-
if($apbct->settings['use_buitin_http_api']){
|
39 |
-
|
40 |
-
$args = array(
|
41 |
-
'body' => $data,
|
42 |
-
'timeout' => $timeout,
|
43 |
-
'user-agent' => APBCT_AGENT.' '.get_bloginfo( 'url' ),
|
44 |
-
);
|
45 |
-
|
46 |
-
$result = wp_remote_post($url, $args);
|
47 |
-
|
48 |
-
if( is_wp_error( $result ) ) {
|
49 |
-
$errors = $result->get_error_message();
|
50 |
-
$result = false;
|
51 |
-
}else{
|
52 |
-
$result = wp_remote_retrieve_body($result);
|
53 |
-
}
|
54 |
-
|
55 |
-
// Call CURL version if disabled
|
56 |
-
}else{
|
57 |
-
$ssl_path = $ssl_path
|
58 |
-
? $ssl_path
|
59 |
-
: (defined('APBCT_CASERT_PATH') ? APBCT_CASERT_PATH : '');
|
60 |
-
$result = parent::send_request($data, $url, $timeout, $ssl, $ssl_path);
|
61 |
-
}
|
62 |
-
|
63 |
-
return empty($result) || !empty($errors)
|
64 |
-
? array('error' => true, 'error' => $errors)
|
65 |
-
: $result;
|
66 |
-
}
|
67 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class CleantalkAPI.
|
5 |
+
* Compatible only with Wordpress.
|
6 |
+
*
|
7 |
+
* @depends Cleantalk\Antispam\API
|
8 |
+
*
|
9 |
+
* @version 1.0
|
10 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
11 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
12 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
13 |
+
* @see https://github.com/CleanTalk/wordpress-antispam
|
14 |
+
*/
|
15 |
+
class CleantalkAPI extends Cleantalk\Antispam\API
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Function sends raw request to API server.
|
19 |
+
* May use built in Wordpress HTTP-API
|
20 |
+
*
|
21 |
+
* @param array Data to send
|
22 |
+
* @param string API server URL
|
23 |
+
* @param int $timeout
|
24 |
+
* @param bool Do we need to use SSL
|
25 |
+
*
|
26 |
+
* @return array|bool
|
27 |
+
*/
|
28 |
+
static public function send_request($data, $url = self::URL, $timeout = 5, $ssl = false, $ssl_path = '')
|
29 |
+
{
|
30 |
+
global $apbct;
|
31 |
+
|
32 |
+
// Possibility to switch API url
|
33 |
+
$url = defined('CLEANTALK_API_URL') ? CLEANTALK_API_URL : $url;
|
34 |
+
|
35 |
+
// Adding agent version to data
|
36 |
+
$data['agent'] = APBCT_AGENT;
|
37 |
+
|
38 |
+
if($apbct->settings['use_buitin_http_api']){
|
39 |
+
|
40 |
+
$args = array(
|
41 |
+
'body' => $data,
|
42 |
+
'timeout' => $timeout,
|
43 |
+
'user-agent' => APBCT_AGENT.' '.get_bloginfo( 'url' ),
|
44 |
+
);
|
45 |
+
|
46 |
+
$result = wp_remote_post($url, $args);
|
47 |
+
|
48 |
+
if( is_wp_error( $result ) ) {
|
49 |
+
$errors = $result->get_error_message();
|
50 |
+
$result = false;
|
51 |
+
}else{
|
52 |
+
$result = wp_remote_retrieve_body($result);
|
53 |
+
}
|
54 |
+
|
55 |
+
// Call CURL version if disabled
|
56 |
+
}else{
|
57 |
+
$ssl_path = $ssl_path
|
58 |
+
? $ssl_path
|
59 |
+
: (defined('APBCT_CASERT_PATH') ? APBCT_CASERT_PATH : '');
|
60 |
+
$result = parent::send_request($data, $url, $timeout, $ssl, $ssl_path);
|
61 |
+
}
|
62 |
+
|
63 |
+
return empty($result) || !empty($errors)
|
64 |
+
? array('error' => true, 'error' => $errors)
|
65 |
+
: $result;
|
66 |
+
}
|
67 |
}
|
lib/CleantalkDB.php
CHANGED
@@ -1,150 +1,150 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* CleanTalk Wordpress Data Base driver
|
5 |
-
* Compatible only with Wordpress.
|
6 |
-
* Uses singleton pattern.
|
7 |
-
*
|
8 |
-
* @depends Cleantalk\Antispam\DB
|
9 |
-
*
|
10 |
-
* @version 3.2
|
11 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
12 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
13 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
14 |
-
* @see https://github.com/CleanTalk/wordpress-antispam
|
15 |
-
*/
|
16 |
-
|
17 |
-
class CleantalkDB extends Cleantalk\Antispam\DB
|
18 |
-
{
|
19 |
-
|
20 |
-
private static $instance;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var string Query string
|
24 |
-
*/
|
25 |
-
private $query;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var wpdb result
|
29 |
-
*/
|
30 |
-
private $db_result;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var array Processed result
|
34 |
-
*/
|
35 |
-
public $result = array();
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var string Database prefix
|
39 |
-
*/
|
40 |
-
public $prefix = '';
|
41 |
-
|
42 |
-
public function __construct() { }
|
43 |
-
public function __clone() { }
|
44 |
-
public function __wakeup() { }
|
45 |
-
|
46 |
-
public static function getInstance()
|
47 |
-
{
|
48 |
-
if (!isset(static::$instance)) {
|
49 |
-
static::$instance = new static;
|
50 |
-
static::$instance->init();
|
51 |
-
}
|
52 |
-
|
53 |
-
return static::$instance;
|
54 |
-
}
|
55 |
-
|
56 |
-
private function init(){
|
57 |
-
global $apbct;
|
58 |
-
$this->prefix = $apbct->db_prefix;
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Set $this->query string for next uses
|
62 |
-
*
|
63 |
-
* @param $query
|
64 |
-
* @return $this
|
65 |
-
*/
|
66 |
-
public function set_query($query)
|
67 |
-
{
|
68 |
-
$this->query = $query;
|
69 |
-
return $this;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Safely replace place holders
|
74 |
-
*
|
75 |
-
* @param string $query
|
76 |
-
* @param array $vars
|
77 |
-
*
|
78 |
-
* @return $this
|
79 |
-
*/
|
80 |
-
public function prepare($query, $vars = array())
|
81 |
-
{
|
82 |
-
global $wpdb;
|
83 |
-
|
84 |
-
$query = $query ? $query : $this->query;
|
85 |
-
$vars = $vars ? $vars : array();
|
86 |
-
array_unshift($vars, $query);
|
87 |
-
|
88 |
-
$this->query = call_user_func_array(array($wpdb, 'prepare'), $vars);
|
89 |
-
|
90 |
-
return $this;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Run any raw request
|
95 |
-
*
|
96 |
-
* @param $query
|
97 |
-
*
|
98 |
-
* @return bool|int Raw result
|
99 |
-
*/
|
100 |
-
public function execute($query)
|
101 |
-
{
|
102 |
-
global $wpdb;
|
103 |
-
|
104 |
-
$this->db_result = $wpdb->query($query);
|
105 |
-
|
106 |
-
return $this->db_result;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Fetchs first column from query.
|
111 |
-
* May receive raw or prepared query.
|
112 |
-
*
|
113 |
-
* @param bool $query
|
114 |
-
* @param bool $response_type
|
115 |
-
*
|
116 |
-
* @return array|object|void|null
|
117 |
-
*/
|
118 |
-
public function fetch($query = false, $response_type = false)
|
119 |
-
{
|
120 |
-
global $wpdb;
|
121 |
-
|
122 |
-
$query = $query ? $query : $this->query;
|
123 |
-
$response_type = $response_type ? $response_type : ARRAY_A;
|
124 |
-
|
125 |
-
$this->result = $wpdb->get_row($query, $response_type);
|
126 |
-
|
127 |
-
return $this->result;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Fetchs all result from query.
|
132 |
-
* May receive raw or prepared query.
|
133 |
-
*
|
134 |
-
* @param bool $query
|
135 |
-
* @param bool $response_type
|
136 |
-
*
|
137 |
-
* @return array|object|null
|
138 |
-
*/
|
139 |
-
public function fetch_all($query = false, $response_type = false)
|
140 |
-
{
|
141 |
-
global $wpdb;
|
142 |
-
|
143 |
-
$query = $query ? $query : $this->query;
|
144 |
-
$response_type = $response_type ? $response_type : ARRAY_A;
|
145 |
-
|
146 |
-
$this->result = $wpdb->get_results($query, $response_type);
|
147 |
-
|
148 |
-
return $this->result;
|
149 |
-
}
|
150 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* CleanTalk Wordpress Data Base driver
|
5 |
+
* Compatible only with Wordpress.
|
6 |
+
* Uses singleton pattern.
|
7 |
+
*
|
8 |
+
* @depends Cleantalk\Antispam\DB
|
9 |
+
*
|
10 |
+
* @version 3.2
|
11 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
12 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
13 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
14 |
+
* @see https://github.com/CleanTalk/wordpress-antispam
|
15 |
+
*/
|
16 |
+
|
17 |
+
class CleantalkDB extends Cleantalk\Antispam\DB
|
18 |
+
{
|
19 |
+
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var string Query string
|
24 |
+
*/
|
25 |
+
private $query;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var wpdb result
|
29 |
+
*/
|
30 |
+
private $db_result;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array Processed result
|
34 |
+
*/
|
35 |
+
public $result = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string Database prefix
|
39 |
+
*/
|
40 |
+
public $prefix = '';
|
41 |
+
|
42 |
+
public function __construct() { }
|
43 |
+
public function __clone() { }
|
44 |
+
public function __wakeup() { }
|
45 |
+
|
46 |
+
public static function getInstance()
|
47 |
+
{
|
48 |
+
if (!isset(static::$instance)) {
|
49 |
+
static::$instance = new static;
|
50 |
+
static::$instance->init();
|
51 |
+
}
|
52 |
+
|
53 |
+
return static::$instance;
|
54 |
+
}
|
55 |
+
|
56 |
+
private function init(){
|
57 |
+
global $apbct;
|
58 |
+
$this->prefix = $apbct->db_prefix;
|
59 |
+
}
|
60 |
+
/**
|
61 |
+
* Set $this->query string for next uses
|
62 |
+
*
|
63 |
+
* @param $query
|
64 |
+
* @return $this
|
65 |
+
*/
|
66 |
+
public function set_query($query)
|
67 |
+
{
|
68 |
+
$this->query = $query;
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Safely replace place holders
|
74 |
+
*
|
75 |
+
* @param string $query
|
76 |
+
* @param array $vars
|
77 |
+
*
|
78 |
+
* @return $this
|
79 |
+
*/
|
80 |
+
public function prepare($query, $vars = array())
|
81 |
+
{
|
82 |
+
global $wpdb;
|
83 |
+
|
84 |
+
$query = $query ? $query : $this->query;
|
85 |
+
$vars = $vars ? $vars : array();
|
86 |
+
array_unshift($vars, $query);
|
87 |
+
|
88 |
+
$this->query = call_user_func_array(array($wpdb, 'prepare'), $vars);
|
89 |
+
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Run any raw request
|
95 |
+
*
|
96 |
+
* @param $query
|
97 |
+
*
|
98 |
+
* @return bool|int Raw result
|
99 |
+
*/
|
100 |
+
public function execute($query)
|
101 |
+
{
|
102 |
+
global $wpdb;
|
103 |
+
|
104 |
+
$this->db_result = $wpdb->query($query);
|
105 |
+
|
106 |
+
return $this->db_result;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Fetchs first column from query.
|
111 |
+
* May receive raw or prepared query.
|
112 |
+
*
|
113 |
+
* @param bool $query
|
114 |
+
* @param bool $response_type
|
115 |
+
*
|
116 |
+
* @return array|object|void|null
|
117 |
+
*/
|
118 |
+
public function fetch($query = false, $response_type = false)
|
119 |
+
{
|
120 |
+
global $wpdb;
|
121 |
+
|
122 |
+
$query = $query ? $query : $this->query;
|
123 |
+
$response_type = $response_type ? $response_type : ARRAY_A;
|
124 |
+
|
125 |
+
$this->result = $wpdb->get_row($query, $response_type);
|
126 |
+
|
127 |
+
return $this->result;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Fetchs all result from query.
|
132 |
+
* May receive raw or prepared query.
|
133 |
+
*
|
134 |
+
* @param bool $query
|
135 |
+
* @param bool $response_type
|
136 |
+
*
|
137 |
+
* @return array|object|null
|
138 |
+
*/
|
139 |
+
public function fetch_all($query = false, $response_type = false)
|
140 |
+
{
|
141 |
+
global $wpdb;
|
142 |
+
|
143 |
+
$query = $query ? $query : $this->query;
|
144 |
+
$response_type = $response_type ? $response_type : ARRAY_A;
|
145 |
+
|
146 |
+
$this->result = $wpdb->get_results($query, $response_type);
|
147 |
+
|
148 |
+
return $this->result;
|
149 |
+
}
|
150 |
}
|
lib/CleantalkHelper.php
CHANGED
@@ -1,48 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* CleanTalk Cleantalk Antispam Helper class.
|
5 |
-
* Compatible only with Wordpress.
|
6 |
-
*
|
7 |
-
* @depends Cleantalk\Antispam\Helper
|
8 |
-
*
|
9 |
-
* @package Antispam Plugin by CleanTalk
|
10 |
-
* @subpackage Helper
|
11 |
-
* @Version 1.0
|
12 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
13 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
14 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
15 |
-
* @see https://github.com/CleanTalk/wordpress-antispam
|
16 |
-
*/
|
17 |
-
|
18 |
-
class CleantalkHelper extends Cleantalk\Antispam\Helper
|
19 |
-
{
|
20 |
-
/**
|
21 |
-
* Function sends raw http request
|
22 |
-
*
|
23 |
-
* May use 4 presets(combining possible):
|
24 |
-
* get_code - getting only HTTP response code
|
25 |
-
* async - async requests
|
26 |
-
* get - GET-request
|
27 |
-
* ssl - use SSL
|
28 |
-
*
|
29 |
-
* @param string $url URL
|
30 |
-
* @param array $data POST|GET indexed array with data to send
|
31 |
-
* @param string|array $presets String or Array with presets: get_code, async, get, ssl, dont_split_to_array
|
32 |
-
* @param array $opts Optional option for CURL connection
|
33 |
-
*
|
34 |
-
* @return array|bool (array || array('error' => true))
|
35 |
-
*/
|
36 |
-
static public function http__request($url, $data = array(), $presets = null, $opts = array())
|
37 |
-
{
|
38 |
-
// Set APBCT User-Agent and passing data to parent method
|
39 |
-
$opts = self::array_merge__save_numeric_keys(
|
40 |
-
array(
|
41 |
-
CURLOPT_USERAGENT => 'APBCT-wordpress/' . (defined('APBCT_VERSION') ? APBCT_VERSION : 'unknown') . '; ' . get_bloginfo('url'),
|
42 |
-
),
|
43 |
-
$opts
|
44 |
-
);
|
45 |
-
|
46 |
-
return parent::http__request($url, $data, $presets, $opts);
|
47 |
-
}
|
48 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* CleanTalk Cleantalk Antispam Helper class.
|
5 |
+
* Compatible only with Wordpress.
|
6 |
+
*
|
7 |
+
* @depends Cleantalk\Antispam\Helper
|
8 |
+
*
|
9 |
+
* @package Antispam Plugin by CleanTalk
|
10 |
+
* @subpackage Helper
|
11 |
+
* @Version 1.0
|
12 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
13 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
14 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
15 |
+
* @see https://github.com/CleanTalk/wordpress-antispam
|
16 |
+
*/
|
17 |
+
|
18 |
+
class CleantalkHelper extends Cleantalk\Antispam\Helper
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Function sends raw http request
|
22 |
+
*
|
23 |
+
* May use 4 presets(combining possible):
|
24 |
+
* get_code - getting only HTTP response code
|
25 |
+
* async - async requests
|
26 |
+
* get - GET-request
|
27 |
+
* ssl - use SSL
|
28 |
+
*
|
29 |
+
* @param string $url URL
|
30 |
+
* @param array $data POST|GET indexed array with data to send
|
31 |
+
* @param string|array $presets String or Array with presets: get_code, async, get, ssl, dont_split_to_array
|
32 |
+
* @param array $opts Optional option for CURL connection
|
33 |
+
*
|
34 |
+
* @return array|bool (array || array('error' => true))
|
35 |
+
*/
|
36 |
+
static public function http__request($url, $data = array(), $presets = null, $opts = array())
|
37 |
+
{
|
38 |
+
// Set APBCT User-Agent and passing data to parent method
|
39 |
+
$opts = self::array_merge__save_numeric_keys(
|
40 |
+
array(
|
41 |
+
CURLOPT_USERAGENT => 'APBCT-wordpress/' . (defined('APBCT_VERSION') ? APBCT_VERSION : 'unknown') . '; ' . get_bloginfo('url'),
|
42 |
+
),
|
43 |
+
$opts
|
44 |
+
);
|
45 |
+
|
46 |
+
return parent::http__request($url, $data, $presets, $opts);
|
47 |
+
}
|
48 |
+
}
|
lib/CleantalkSFW.php
CHANGED
@@ -1,136 +1,141 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* CleanTalk SpamFireWall Wordpress class
|
5 |
-
* Compatible only with Wordpress.
|
6 |
-
*
|
7 |
-
* @depends Cleantalk\Antispam\SFW
|
8 |
-
*
|
9 |
-
* @version 3.3
|
10 |
-
* @author Cleantalk team (welcome@cleantalk.org)
|
11 |
-
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
12 |
-
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
13 |
-
* @see https://github.com/CleanTalk/wordpress-antispam
|
14 |
-
*/
|
15 |
-
class CleantalkSFW extends Cleantalk\Antispam\SFW
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* CleantalkSFW_Base constructor.
|
19 |
-
* Creates Database driver instance.
|
20 |
-
*/
|
21 |
-
public function __construct()
|
22 |
-
{
|
23 |
-
|
24 |
-
// Creating database object. Depends on current CMS.
|
25 |
-
$this->db = CleantalkDB::getInstance();
|
26 |
-
|
27 |
-
// Use default tables if not specified
|
28 |
-
$this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
|
29 |
-
$this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
|
30 |
-
|
31 |
-
parent::__construct();
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Shows DIE page.
|
36 |
-
* Stops script executing.
|
37 |
-
*
|
38 |
-
* @param string $api_key
|
39 |
-
* @param string $cookie_prefix
|
40 |
-
* @param string $cookie_domain
|
41 |
-
* @param bool $test
|
42 |
-
*/
|
43 |
-
public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = '', $test = false){
|
44 |
-
|
45 |
-
global $apbct;
|
46 |
-
|
47 |
-
// Statistics
|
48 |
-
if(!empty($this->blocked_ips)){
|
49 |
-
reset($this->blocked_ips);
|
50 |
-
$apbct->stats['last_sfw_block']['time'] = time();
|
51 |
-
$apbct->stats['last_sfw_block']['ip'] = $this->blocked_ips[key($this->blocked_ips)]['ip'];
|
52 |
-
$apbct->save('stats');
|
53 |
-
}
|
54 |
-
|
55 |
-
// Headers
|
56 |
-
if(headers_sent() === false){
|
57 |
-
header('Expires: '.date(DATE_RFC822, mktime(0, 0, 0, 1, 1, 1971)));
|
58 |
-
header('Cache-Control: no-store, no-cache, must-revalidate');
|
59 |
-
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
60 |
-
header('Pragma: no-cache');
|
61 |
-
header("HTTP/1.0 403 Forbidden");
|
62 |
-
}
|
63 |
-
|
64 |
-
// File exists?
|
65 |
-
if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
|
66 |
-
|
67 |
-
$sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
|
68 |
-
|
69 |
-
// Translation
|
70 |
-
$request_uri = $_SERVER['REQUEST_URI'];
|
71 |
-
$sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', __('SpamFireWall is activated for your IP ', 'cleantalk'), $sfw_die_page);
|
72 |
-
$sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', __('To continue working with web site, please make sure that you have enabled JavaScript.', 'cleantalk'), $sfw_die_page);
|
73 |
-
$sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', __('Please click below to pass protection,', 'cleantalk'), $sfw_die_page);
|
74 |
-
$sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', sprintf(__('Or you will be automatically redirected to the requested page after %d seconds.', 'cleantalk'), 1), $sfw_die_page);
|
75 |
-
$sfw_die_page = str_replace('{CLEANTALK_TITLE}', __('Antispam by CleanTalk', 'cleantalk'), $sfw_die_page);
|
76 |
-
$sfw_die_page = str_replace('{TEST_TITLE}', ($this->test ? __('This is the testing page for SpamFireWall', 'cleantalk') : ''), $sfw_die_page);
|
77 |
-
|
78 |
-
if($this->test){
|
79 |
-
$sfw_die_page = str_replace('{REAL_IP__HEADER}', 'Real IP:', $sfw_die_page);
|
80 |
-
$sfw_die_page = str_replace('{TEST_IP__HEADER}', 'Test IP:', $sfw_die_page);
|
81 |
-
$sfw_die_page = str_replace('{TEST_IP}', $this->all_ips['sfw_test']['ip'], $sfw_die_page);
|
82 |
-
$sfw_die_page = str_replace('{REAL_IP}', $this->all_ips['real']['ip'], $sfw_die_page);
|
83 |
-
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', $this->all_ips['sfw_test']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
84 |
-
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', $this->all_ips['real']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
85 |
-
}else{
|
86 |
-
$sfw_die_page = str_replace('{REAL_IP__HEADER}', '', $sfw_die_page);
|
87 |
-
$sfw_die_page = str_replace('{TEST_IP__HEADER}', '', $sfw_die_page);
|
88 |
-
$sfw_die_page = str_replace('{TEST_IP}', '', $sfw_die_page);
|
89 |
-
$sfw_die_page = str_replace('{REAL_IP}', '', $sfw_die_page);
|
90 |
-
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', '', $sfw_die_page);
|
91 |
-
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', '', $sfw_die_page);
|
92 |
-
}
|
93 |
-
|
94 |
-
$sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ips ? $this->blocked_ips[key($this->blocked_ips)]['ip'] : '', $sfw_die_page);
|
95 |
-
|
96 |
-
// Service info
|
97 |
-
$sfw_die_page = str_replace('{REQUEST_URI}', $request_uri, $sfw_die_page);
|
98 |
-
$sfw_die_page = str_replace('{COOKIE_PREFIX}', $cookie_prefix, $sfw_die_page);
|
99 |
-
$sfw_die_page = str_replace('{COOKIE_DOMAIN}', $cookie_domain, $sfw_die_page);
|
100 |
-
$sfw_die_page = str_replace('{SERVICE_ID}', $apbct->data['service_id'], $sfw_die_page);
|
101 |
-
$sfw_die_page = str_replace('{HOST}', $_SERVER['HTTP_HOST'], $sfw_die_page);
|
102 |
-
|
103 |
-
$sfw_die_page = str_replace(
|
104 |
-
'{SFW_COOKIE}',
|
105 |
-
$this->test
|
106 |
-
? $this->all_ips['sfw_test']['ip']
|
107 |
-
: md5(current(end($this->blocked_ips)).$api_key),
|
108 |
-
|
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 |
-
|
136 |
-
}
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* CleanTalk SpamFireWall Wordpress class
|
5 |
+
* Compatible only with Wordpress.
|
6 |
+
*
|
7 |
+
* @depends Cleantalk\Antispam\SFW
|
8 |
+
*
|
9 |
+
* @version 3.3
|
10 |
+
* @author Cleantalk team (welcome@cleantalk.org)
|
11 |
+
* @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
|
12 |
+
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
|
13 |
+
* @see https://github.com/CleanTalk/wordpress-antispam
|
14 |
+
*/
|
15 |
+
class CleantalkSFW extends Cleantalk\Antispam\SFW
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* CleantalkSFW_Base constructor.
|
19 |
+
* Creates Database driver instance.
|
20 |
+
*/
|
21 |
+
public function __construct()
|
22 |
+
{
|
23 |
+
|
24 |
+
// Creating database object. Depends on current CMS.
|
25 |
+
$this->db = CleantalkDB::getInstance();
|
26 |
+
|
27 |
+
// Use default tables if not specified
|
28 |
+
$this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
|
29 |
+
$this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
|
30 |
+
|
31 |
+
parent::__construct();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Shows DIE page.
|
36 |
+
* Stops script executing.
|
37 |
+
*
|
38 |
+
* @param string $api_key
|
39 |
+
* @param string $cookie_prefix
|
40 |
+
* @param string $cookie_domain
|
41 |
+
* @param bool $test
|
42 |
+
*/
|
43 |
+
public function sfw_die($api_key, $cookie_prefix = '', $cookie_domain = '', $test = false){
|
44 |
+
|
45 |
+
global $apbct;
|
46 |
+
|
47 |
+
// Statistics
|
48 |
+
if(!empty($this->blocked_ips)){
|
49 |
+
reset($this->blocked_ips);
|
50 |
+
$apbct->stats['last_sfw_block']['time'] = time();
|
51 |
+
$apbct->stats['last_sfw_block']['ip'] = $this->blocked_ips[key($this->blocked_ips)]['ip'];
|
52 |
+
$apbct->save('stats');
|
53 |
+
}
|
54 |
+
|
55 |
+
// Headers
|
56 |
+
if(headers_sent() === false){
|
57 |
+
header('Expires: '.date(DATE_RFC822, mktime(0, 0, 0, 1, 1, 1971)));
|
58 |
+
header('Cache-Control: no-store, no-cache, must-revalidate');
|
59 |
+
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
60 |
+
header('Pragma: no-cache');
|
61 |
+
header("HTTP/1.0 403 Forbidden");
|
62 |
+
}
|
63 |
+
|
64 |
+
// File exists?
|
65 |
+
if(file_exists(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html")){
|
66 |
+
|
67 |
+
$sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "inc/sfw_die_page.html");
|
68 |
+
|
69 |
+
// Translation
|
70 |
+
$request_uri = $_SERVER['REQUEST_URI'];
|
71 |
+
$sfw_die_page = str_replace('{SFW_DIE_NOTICE_IP}', __('SpamFireWall is activated for your IP ', 'cleantalk'), $sfw_die_page);
|
72 |
+
$sfw_die_page = str_replace('{SFW_DIE_MAKE_SURE_JS_ENABLED}', __('To continue working with web site, please make sure that you have enabled JavaScript.', 'cleantalk'), $sfw_die_page);
|
73 |
+
$sfw_die_page = str_replace('{SFW_DIE_CLICK_TO_PASS}', __('Please click below to pass protection,', 'cleantalk'), $sfw_die_page);
|
74 |
+
$sfw_die_page = str_replace('{SFW_DIE_YOU_WILL_BE_REDIRECTED}', sprintf(__('Or you will be automatically redirected to the requested page after %d seconds.', 'cleantalk'), 1), $sfw_die_page);
|
75 |
+
$sfw_die_page = str_replace('{CLEANTALK_TITLE}', __('Antispam by CleanTalk', 'cleantalk'), $sfw_die_page);
|
76 |
+
$sfw_die_page = str_replace('{TEST_TITLE}', ($this->test ? __('This is the testing page for SpamFireWall', 'cleantalk') : ''), $sfw_die_page);
|
77 |
+
|
78 |
+
if($this->test){
|
79 |
+
$sfw_die_page = str_replace('{REAL_IP__HEADER}', 'Real IP:', $sfw_die_page);
|
80 |
+
$sfw_die_page = str_replace('{TEST_IP__HEADER}', 'Test IP:', $sfw_die_page);
|
81 |
+
$sfw_die_page = str_replace('{TEST_IP}', $this->all_ips['sfw_test']['ip'], $sfw_die_page);
|
82 |
+
$sfw_die_page = str_replace('{REAL_IP}', $this->all_ips['real']['ip'], $sfw_die_page);
|
83 |
+
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', $this->all_ips['sfw_test']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
84 |
+
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', $this->all_ips['real']['status'] == 1 ? 'Passed' : 'Blocked', $sfw_die_page);
|
85 |
+
}else{
|
86 |
+
$sfw_die_page = str_replace('{REAL_IP__HEADER}', '', $sfw_die_page);
|
87 |
+
$sfw_die_page = str_replace('{TEST_IP__HEADER}', '', $sfw_die_page);
|
88 |
+
$sfw_die_page = str_replace('{TEST_IP}', '', $sfw_die_page);
|
89 |
+
$sfw_die_page = str_replace('{REAL_IP}', '', $sfw_die_page);
|
90 |
+
$sfw_die_page = str_replace('{TEST_IP_BLOCKED}', '', $sfw_die_page);
|
91 |
+
$sfw_die_page = str_replace('{REAL_IP_BLOCKED}', '', $sfw_die_page);
|
92 |
+
}
|
93 |
+
|
94 |
+
$sfw_die_page = str_replace('{REMOTE_ADDRESS}', $this->blocked_ips ? $this->blocked_ips[key($this->blocked_ips)]['ip'] : '', $sfw_die_page);
|
95 |
+
|
96 |
+
// Service info
|
97 |
+
$sfw_die_page = str_replace('{REQUEST_URI}', $request_uri, $sfw_die_page);
|
98 |
+
$sfw_die_page = str_replace('{COOKIE_PREFIX}', $cookie_prefix, $sfw_die_page);
|
99 |
+
$sfw_die_page = str_replace('{COOKIE_DOMAIN}', $cookie_domain, $sfw_die_page);
|
100 |
+
$sfw_die_page = str_replace('{SERVICE_ID}', $apbct->data['service_id'], $sfw_die_page);
|
101 |
+
$sfw_die_page = str_replace('{HOST}', $_SERVER['HTTP_HOST'], $sfw_die_page);
|
102 |
+
|
103 |
+
$sfw_die_page = str_replace(
|
104 |
+
'{SFW_COOKIE}',
|
105 |
+
$this->test
|
106 |
+
? $this->all_ips['sfw_test']['ip']
|
107 |
+
: md5(current(end($this->blocked_ips)).$api_key),
|
108 |
+
$sfw_die_page
|
109 |
+
);
|
110 |
+
|
111 |
+
if($this->debug){
|
112 |
+
$debug = '<h1>IP and Networks</h1>'
|
113 |
+
. var_export($this->all_ips, true)
|
114 |
+
.'<h1>Blocked IPs</h1>'
|
115 |
+
. var_export($this->passed_ips, true)
|
116 |
+
.'<h1>Passed IPs</h1>'
|
117 |
+
. var_export($this->blocked_ips, true)
|
118 |
+
. '<h1>Headers</h1>'
|
119 |
+
. var_export(apache_request_headers(), true)
|
120 |
+
. '<h1>REMOTE_ADDR</h1>'
|
121 |
+
. var_export($_SERVER['REMOTE_ADDR'], true)
|
122 |
+
. '<h1>SERVER_ADDR</h1>'
|
123 |
+
. var_export($_SERVER['SERVER_ADDR'], true)
|
124 |
+
. '<h1>IP_ARRAY</h1>'
|
125 |
+
. var_export($this->ip_array, true)
|
126 |
+
. '<h1>ADDITIONAL</h1>'
|
127 |
+
. var_export($this->debug_data, true);
|
128 |
+
}else
|
129 |
+
$debug = '';
|
130 |
+
|
131 |
+
$sfw_die_page = str_replace( "{DEBUG}", $debug, $sfw_die_page );
|
132 |
+
$sfw_die_page = str_replace('{GENERATED}', "<p>The page was generated at ".date("D, d M Y H:i:s")."</p>",$sfw_die_page);
|
133 |
+
|
134 |
+
wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
|
135 |
+
|
136 |
+
}else{
|
137 |
+
wp_die("IP BLACKLISTED", "Blacklisted", Array('response'=>403));
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
141 |
+
}
|
lib/CleantalkState.php
CHANGED
@@ -12,21 +12,33 @@
|
|
12 |
*/
|
13 |
|
14 |
/**
|
15 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
* @property mixed moderate_ip
|
17 |
* @property mixed|string plugin_version
|
18 |
* @property mixed|string db_prefix
|
19 |
-
* @property
|
20 |
-
* @property
|
21 |
-
* @property
|
22 |
-
* @property
|
23 |
-
* @property string
|
24 |
-
* @property string
|
25 |
-
* @property string
|
26 |
-
* @property
|
27 |
-
*
|
28 |
-
*
|
29 |
-
* @property ArrayObject
|
|
|
|
|
|
|
|
|
30 |
*/
|
31 |
class CleantalkState
|
32 |
{
|
@@ -38,7 +50,6 @@ class CleantalkState
|
|
38 |
|
39 |
'spam_firewall' => 1,
|
40 |
'apikey' => '',
|
41 |
-
'custom_key' => 0,
|
42 |
'autoPubRevelantMess' => 0,
|
43 |
|
44 |
/* Forms for protection */
|
@@ -63,13 +74,20 @@ class CleantalkState
|
|
63 |
// Data processing
|
64 |
'protect_logged_in' => 1, // Do anit-spam tests to for logged in users.
|
65 |
'use_ajax' => 1,
|
66 |
-
'use_static_js_key' =>
|
67 |
'general_postdata_test' => 0, //CAPD
|
68 |
'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
|
69 |
'set_cookies__sessions'=> 0, // Use alt sessions for cookies.
|
70 |
'ssl_on' => 0, // Secure connection to servers
|
71 |
'use_buitin_http_api' => 0, // Using Wordpress HTTP built in API
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
// Administrator Panel
|
74 |
'show_adminbar' => 1, // Show the admin bar.
|
75 |
'all_time_counter' => 0,
|
@@ -77,10 +95,7 @@ class CleantalkState
|
|
77 |
'sfw_counter' => 0,
|
78 |
|
79 |
//Others
|
80 |
-
'
|
81 |
-
'relevance_test' => 0, // Test comment for relevance
|
82 |
-
'notice_api_errors' => 0, // Send API error notices to WP admin
|
83 |
-
'user_token' => '', //user token for auto login into spam statistics
|
84 |
'collect_details' => 0, // Collect details about browser of the visitor.
|
85 |
'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
|
86 |
'async_js' => 0,
|
@@ -107,6 +122,11 @@ class CleantalkState
|
|
107 |
'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
|
108 |
'last_remote_call' => 0, //Timestam of last remote call
|
109 |
|
|
|
|
|
|
|
|
|
|
|
110 |
// Account data
|
111 |
'service_id' => 0,
|
112 |
'moderate' => 0,
|
@@ -114,7 +134,7 @@ class CleantalkState
|
|
114 |
'ip_license' => 0,
|
115 |
'spam_count' => 0,
|
116 |
'auto_update' => 0,
|
117 |
-
'user_token' => '',
|
118 |
'license_trial' => 0,
|
119 |
|
120 |
// Notices
|
@@ -158,23 +178,31 @@ class CleantalkState
|
|
158 |
'sfw_enabled' => false,
|
159 |
),
|
160 |
|
161 |
-
// White label
|
162 |
-
'white_label_data' => array(
|
163 |
-
'is_key_recieved' => false,
|
164 |
-
),
|
165 |
-
|
166 |
// Misc
|
167 |
'feedback_request' => '',
|
168 |
'key_is_ok' => 0,
|
169 |
'salt' => '',
|
170 |
);
|
171 |
|
172 |
-
public $
|
|
|
|
|
|
|
173 |
'allow_custom_key' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
'key_is_ok' => 0,
|
175 |
-
'
|
|
|
176 |
'user_token' => '',
|
177 |
'service_id' => 0,
|
|
|
178 |
);
|
179 |
|
180 |
public $def_remote_calls = array(
|
@@ -240,15 +268,19 @@ class CleantalkState
|
|
240 |
* @param array $options Array of strings. Types of settings you want to get.
|
241 |
* @param bool $wpms Is multisite?
|
242 |
*/
|
243 |
-
public function __construct($option_prefix, $options = array('settings')
|
244 |
{
|
245 |
$this->option_prefix = $option_prefix;
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
|
|
|
|
|
|
|
|
252 |
|
253 |
foreach($options as $option_name){
|
254 |
|
@@ -349,6 +381,14 @@ class CleantalkState
|
|
349 |
update_site_option($this->option_prefix.'_network_data', $this->network_data);
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
/**
|
353 |
* Unset and delete option from DB.
|
354 |
*
|
@@ -473,17 +513,12 @@ class CleantalkState
|
|
473 |
// First check in storage
|
474 |
if (array_key_exists($name, $this->storage)){
|
475 |
return $this->storage[$name];
|
476 |
-
|
477 |
// Then in data
|
478 |
}elseif(array_key_exists($name, $this->storage['data'])){
|
479 |
$this->$name = $this->storage['data'][$name];
|
480 |
return $this->storage['data'][$name];
|
481 |
-
|
482 |
-
// Maybe it's apikey?
|
483 |
-
}elseif($name == 'api_key'){
|
484 |
-
$this->$name = $this->storage['settings']['apikey'];
|
485 |
-
return $this->storage['settings']['apikey'];
|
486 |
-
|
487 |
// Otherwise try to get it from db settings table
|
488 |
// it will be arrayObject || scalar || null
|
489 |
}else{
|
12 |
*/
|
13 |
|
14 |
/**
|
15 |
+
* COMMON
|
16 |
+
*
|
17 |
+
* @property string api_key
|
18 |
+
*
|
19 |
+
* STAND ALONE
|
20 |
+
*
|
21 |
+
* @property ArrayObject settings
|
22 |
+
* @property ArrayObject data
|
23 |
+
*
|
24 |
* @property mixed moderate_ip
|
25 |
* @property mixed|string plugin_version
|
26 |
* @property mixed|string db_prefix
|
27 |
+
* @property string settings_link
|
28 |
+
* @property int key_is_ok
|
29 |
+
* @property string logo__small__colored
|
30 |
+
* @property string logo__small
|
31 |
+
* @property string logo
|
32 |
+
* @property string plugin_name
|
33 |
+
* @property string base_name
|
34 |
+
* @property array|mixed errors
|
35 |
+
*
|
36 |
+
* NETWORK
|
37 |
+
* @property ArrayObject network_data
|
38 |
+
* @property ArrayObject network_settings
|
39 |
+
* @property mixed allow_custom_key
|
40 |
+
* @property bool white_label
|
41 |
+
* @property mixed moderate
|
42 |
*/
|
43 |
class CleantalkState
|
44 |
{
|
50 |
|
51 |
'spam_firewall' => 1,
|
52 |
'apikey' => '',
|
|
|
53 |
'autoPubRevelantMess' => 0,
|
54 |
|
55 |
/* Forms for protection */
|
74 |
// Data processing
|
75 |
'protect_logged_in' => 1, // Do anit-spam tests to for logged in users.
|
76 |
'use_ajax' => 1,
|
77 |
+
'use_static_js_key' => -1,
|
78 |
'general_postdata_test' => 0, //CAPD
|
79 |
'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
|
80 |
'set_cookies__sessions'=> 0, // Use alt sessions for cookies.
|
81 |
'ssl_on' => 0, // Secure connection to servers
|
82 |
'use_buitin_http_api' => 0, // Using Wordpress HTTP built in API
|
83 |
|
84 |
+
// Exclusions
|
85 |
+
'exclusions__urls' => '',
|
86 |
+
'exclusions__urls__use_regexp' => 0,
|
87 |
+
'exclusions__fields' => '',
|
88 |
+
'exclusions__fields__use_regexp' => 0,
|
89 |
+
'exclusions__roles' => array('Administrator'),
|
90 |
+
|
91 |
// Administrator Panel
|
92 |
'show_adminbar' => 1, // Show the admin bar.
|
93 |
'all_time_counter' => 0,
|
95 |
'sfw_counter' => 0,
|
96 |
|
97 |
//Others
|
98 |
+
'user_token' => '',
|
|
|
|
|
|
|
99 |
'collect_details' => 0, // Collect details about browser of the visitor.
|
100 |
'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
|
101 |
'async_js' => 0,
|
122 |
'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
|
123 |
'last_remote_call' => 0, //Timestam of last remote call
|
124 |
|
125 |
+
// Antispam
|
126 |
+
'spam_store_days' => 15, // Days before delete comments from folder Spam
|
127 |
+
'relevance_test' => 0, // Test comment for relevance
|
128 |
+
'notice_api_errors' => 0, // Send API error notices to WP admin
|
129 |
+
|
130 |
// Account data
|
131 |
'service_id' => 0,
|
132 |
'moderate' => 0,
|
134 |
'ip_license' => 0,
|
135 |
'spam_count' => 0,
|
136 |
'auto_update' => 0,
|
137 |
+
'user_token' => '', // User token for auto login into spam statistics
|
138 |
'license_trial' => 0,
|
139 |
|
140 |
// Notices
|
178 |
'sfw_enabled' => false,
|
179 |
),
|
180 |
|
|
|
|
|
|
|
|
|
|
|
181 |
// Misc
|
182 |
'feedback_request' => '',
|
183 |
'key_is_ok' => 0,
|
184 |
'salt' => '',
|
185 |
);
|
186 |
|
187 |
+
public $def_network_settings = array(
|
188 |
+
|
189 |
+
// Key
|
190 |
+
'apikey' => '',
|
191 |
'allow_custom_key' => 0,
|
192 |
+
|
193 |
+
// White label settings
|
194 |
+
'white_label' => 0,
|
195 |
+
'white_label__hoster_key' => '',
|
196 |
+
'white_label__plugin_name' => 'Anti-Spam by CleanTalk',
|
197 |
+
);
|
198 |
+
|
199 |
+
public $def_network_data = array(
|
200 |
'key_is_ok' => 0,
|
201 |
+
'moderate' => 0,
|
202 |
+
'valid' => 0,
|
203 |
'user_token' => '',
|
204 |
'service_id' => 0,
|
205 |
+
'auto_update' => 0,
|
206 |
);
|
207 |
|
208 |
public $def_remote_calls = array(
|
268 |
* @param array $options Array of strings. Types of settings you want to get.
|
269 |
* @param bool $wpms Is multisite?
|
270 |
*/
|
271 |
+
public function __construct($option_prefix, $options = array('settings'))
|
272 |
{
|
273 |
$this->option_prefix = $option_prefix;
|
274 |
|
275 |
+
// Network settings
|
276 |
+
$option = get_site_option($this->option_prefix.'_network_settings');
|
277 |
+
$option = is_array($option) ? array_merge($this->def_network_settings, $option) : $this->def_network_settings;
|
278 |
+
$this->network_settings = new ArrayObject($option);
|
279 |
+
|
280 |
+
// Network data
|
281 |
+
$option = get_site_option($this->option_prefix.'_network_data');
|
282 |
+
$option = is_array($option) ? array_merge($this->def_network_data, $option) : $this->def_network_data;
|
283 |
+
$this->network_data = new ArrayObject($option);
|
284 |
|
285 |
foreach($options as $option_name){
|
286 |
|
381 |
update_site_option($this->option_prefix.'_network_data', $this->network_data);
|
382 |
}
|
383 |
|
384 |
+
/**
|
385 |
+
* Save PREFIX_network_data to DB.
|
386 |
+
*/
|
387 |
+
public function saveNetworkSettings()
|
388 |
+
{
|
389 |
+
update_site_option($this->option_prefix.'_network_settings', $this->network_settings);
|
390 |
+
}
|
391 |
+
|
392 |
/**
|
393 |
* Unset and delete option from DB.
|
394 |
*
|
513 |
// First check in storage
|
514 |
if (array_key_exists($name, $this->storage)){
|
515 |
return $this->storage[$name];
|
516 |
+
|
517 |
// Then in data
|
518 |
}elseif(array_key_exists($name, $this->storage['data'])){
|
519 |
$this->$name = $this->storage['data'][$name];
|
520 |
return $this->storage['data'][$name];
|
521 |
+
|
|
|
|
|
|
|
|
|
|
|
522 |
// Otherwise try to get it from db settings table
|
523 |
// it will be arrayObject || scalar || null
|
524 |
}else{
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
|
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
@@ -434,13 +434,6 @@ example.com/some/body
|
|
434 |
You should type this in wp-config.php:
|
435 |
|
436 |
$cleantalk_url_exclusions = array('some');
|
437 |
-
|
438 |
-
= Can I add exclusions for some IP addresses? =
|
439 |
-
Yes, you can. Add this string in your wp-config.php file before defining database constants:
|
440 |
-
|
441 |
-
$cleantalk_ip_exclusions = array('127.0.0.1', '8.8.8.8');
|
442 |
-
|
443 |
-
Now, all requests from IP 127.0.0.1 and 8.8.8.8 will be excluded from anti-spam checking. Remember, that this option will not be applied in registration and comment checking - they are always protected from spam.
|
444 |
|
445 |
= Can I not send my personal data to CleanTalk servers? =
|
446 |
Yes, you can exclude your data. Add this string in your wp-config.php file before defining database constants:
|
@@ -575,6 +568,20 @@ If your website has forms that send data to external sources, you can enable opt
|
|
575 |
10. Website's options.
|
576 |
|
577 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
= 5.126 September 9 2019 =
|
579 |
* Spam protection improved!
|
580 |
* Integration: Option wheel.
|
@@ -1987,6 +1994,20 @@ If your website has forms that send data to external sources, you can enable opt
|
|
1987 |
* First version
|
1988 |
|
1989 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1990 |
= 5.126 September 9 2019 =
|
1991 |
* Spam protection improved!
|
1992 |
* Integration: Option wheel.
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 5.127
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
434 |
You should type this in wp-config.php:
|
435 |
|
436 |
$cleantalk_url_exclusions = array('some');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
= Can I not send my personal data to CleanTalk servers? =
|
439 |
Yes, you can exclude your data. Add this string in your wp-config.php file before defining database constants:
|
568 |
10. Website's options.
|
569 |
|
570 |
== Changelog ==
|
571 |
+
= 5.127 September 30 2019 =
|
572 |
+
* Fix: Delete redirect notice on external forms
|
573 |
+
* Fix: Storing spam for 15 days.
|
574 |
+
* Fix: correct DiVi display message.
|
575 |
+
* Integration: Ultimate Members.
|
576 |
+
* Mod: Setting "Use static JS key" switched to "Auto" if it was "No". Default is "Auto".
|
577 |
+
* Mod: Moving White Label option to main site settings.
|
578 |
+
* New: Use static JS key if cache plugin detected.
|
579 |
+
* New: Settings for URLs, fields, roles exclusions.
|
580 |
+
* New: Regular Expressions support in URLs, fields exclusions.
|
581 |
+
* New: Send validation errors on standard registration form.
|
582 |
+
* Updater: Move exclusions from global variable to settings.
|
583 |
+
* Deprecated: IP exclusions.
|
584 |
+
|
585 |
= 5.126 September 9 2019 =
|
586 |
* Spam protection improved!
|
587 |
* Integration: Option wheel.
|
1994 |
* First version
|
1995 |
|
1996 |
== Upgrade Notice ==
|
1997 |
+
= 5.127 September 30 2019 =
|
1998 |
+
* Fix: Delete redirect notice on external forms
|
1999 |
+
* Fix: Storing spam for 15 days.
|
2000 |
+
* Fix: correct DiVi display message.
|
2001 |
+
* Integration: Ultimate Members.
|
2002 |
+
* Mod: Setting "Use static JS key" switched to "Auto" if it was "No". Default is "Auto".
|
2003 |
+
* Mod: Moving White Label option to main site settings.
|
2004 |
+
* New: Use static JS key if cache plugin detected.
|
2005 |
+
* New: Settings for URLs, fields, roles exclusions.
|
2006 |
+
* New: Regular Expressions support in URLs, fields exclusions.
|
2007 |
+
* New: Send validation errors on standard registration form.
|
2008 |
+
* Updater: Move exclusions from global variable to settings.
|
2009 |
+
* Deprecated: IP exclusions.
|
2010 |
+
|
2011 |
= 5.126 September 9 2019 =
|
2012 |
* Spam protection improved!
|
2013 |
* Integration: Option wheel.
|