diff --git a/css/spbc-table.min.css b/css/spbc-table.min.css
index f497c5752..a277bd750 100644
--- a/css/spbc-table.min.css
+++ b/css/spbc-table.min.css
@@ -1 +1 @@
-#spbc_tbl__scanner_frontend_malware th,tbody td{position:relative}[disabled]:hover{cursor:not-allowed}.tbl-width--50px{width:50px}.tbl-width--100px{width:100px}.tbl-width--sma{width:7em}.tbl-widtqh--mid{width:6em}.tbl-min_width--big{width:12em}tr .row-actions{left:0}.tbl-row_action:hover{cursor:pointer;text-decoration:underline}tr .row-actions span{color:gray}tr:hover .row-actions span.tbl-row_action{color:#0073aa}tr:hover .row-actions span.tbl-row_action--delete,tr:hover .row-actions span.tbl-row_action--replace{color:#a00}tr:hover .row-actions span.tbl-row_action--approve{color:#0a0}.tbl-row_action--hide{color:gray}.tbl-sorting_indicator{margin-left:10px;visibility:hidden}.tbl-sorting_indicator--sorted{color:rgba(0,0,0,.6);visibility:visible}.tbl-column-sortable:hover{cursor:pointer}.tbl-column-sortable:hover .tbl-sorting_indicator{visibility:visible;color:rgba(0,0,0,1)}.spbc_hint--icon{color:#999}.spbc_hint--icon:hover{color:#000}.spbc_hint--icon:hover+.spbc_hint--text{display:block}.spbc_hint--text{display:none;color:#999}.tbl-button{display:inline-block;line-height:20px;height:30px;margin:0;padding:0 10px 1px;cursor:pointer;border:1px solid #ccc;border-radius:3px;color:#555;background:#f7f7f7;vertical-align:top}.tbl-button---white_blue{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}.tbl-select{padding:2px;line-height:20px!important;height:25px!important}.tbl-preloader--small{display:none;width:15px;height:15px;margin:0 5px;vertical-align:middle}.tbl-preloader--tiny{display:none;width:10px;height:10px;margin:0 5px}.tbl-preloader--in_button{margin:0 0 0 8px}.tbl-bulk_actions--wrapper{display:inline-block;margin:5px 0}.tbl-bulk_actions--apply,.tbl-pagination--button,.tbl-pagination--total{margin:0 5px}.tbl-pagination--wrapper{display:inline-block;padding:5px 0;vertical-align:middle}.tbl-pagination--total{vertical-align:baseline}.tbl-pagination--curr_page{width:36px;padding:3px 5px;font-size:13px;text-align:center}@media screen and (max-width:782px){#spbc_tbl__secuirty_logs .wp-list-table tr,#spbc_tbl__traffic_control_logs .wp-list-table tr{margin:0 0 1rem}#spbc_tbl__traffic_control_logs .wp-list-table,#spbc_tbl__traffic_control_logs .wp-list-table thead,tbody,td,tr{display:block}#spbc_tbl__traffic_control_logs .wp-list-table thead tr{position:absolute;top:-9999px;left:-9999px}#spbc_tbl__traffic_control_logs .wp-list-table td{display:flex;align-items:center;border:none;border-bottom:1px solid #eee;position:relative;padding-left:50%;height:100%;padding-top:10px;padding-bottom:10px}#spbc_tbl__traffic_control_logs .wp-list-table td:before{position:absolute;top:0;left:6px;width:45%;padding-right:10px;white-space:nowrap;height:inherit;display:grid;align-items:center}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(1):before{content:"IP"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(2):before{content:"Country"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(3):before{content:"Last Request"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(4):before{content:"Status"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(5):before{content:"Requests"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(6):before{content:"Requests per 5 minutes"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(7):before{content:"Page"}#spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(8):before{content:"User Agent"}#spbc_tbl__secuirty_logs .wp-list-table,#spbc_tbl__secuirty_logs .wp-list-table thead,tbody,td,tr{display:block}#spbc_tbl__secuirty_logs .wp-list-table thead tr{position:absolute;top:-9999px;left:-9999px}#spbc_tbl__secuirty_logs .wp-list-table td{display:flex;align-items:center;border:none;border-bottom:1px solid #eee;position:relative;padding-left:50%;height:100%;padding-top:10px;padding-bottom:10px}#spbc_tbl__secuirty_logs .wp-list-table td:before{position:absolute;top:0;left:6px;width:45%;padding-right:10px;white-space:nowrap;height:inherit;display:grid;align-items:center}#spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(1):before{content:"User"}#spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(2):before{content:"IP"}#spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(3):before{content:"Date"}#spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(4):before{content:"Action"}#spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(5):before{content:"Page"}.spbcShortTextBlock{width:100%}#spbc_tbl__secuirty_logs .wp-list-table .mob_entries,#spbc_tbl__traffic_control_logs .wp-list-table .mob_entries{display:none}}
\ No newline at end of file
+#spbc_tbl__scanner_frontend_malware th,tbody td{position:relative}[disabled]:hover{cursor:not-allowed}.tbl-width--50px{width:50px}.tbl-width--100px{width:100px}.tbl-width--sma{width:7em}.tbl-widtqh--mid{width:6em}.tbl-min_width--big{width:12em}tr .row-actions{left:0}.tbl-row_action:hover{cursor:pointer;text-decoration:underline}tr .row-actions span{color:gray}tr:hover .row-actions span.tbl-row_action{color:#0073aa}tr:hover .row-actions span.tbl-row_action--delete,tr:hover .row-actions span.tbl-row_action--replace{color:#a00}tr:hover .row-actions span.tbl-row_action--approve{color:#0a0}.tbl-row_action--hide{color:gray}.tbl-sorting_indicator{margin-left:10px;visibility:hidden}.tbl-sorting_indicator--sorted{color:rgba(0,0,0,.6);visibility:visible}.tbl-column-sortable:hover{cursor:pointer}.tbl-column-sortable:hover .tbl-sorting_indicator{visibility:visible;color:rgba(0,0,0,1)}.spbc_hint--icon{color:#999}.spbc_hint--icon:hover{color:#000}.spbc_hint--icon:hover+.spbc_hint--text{display:block}.spbc_hint--text{display:none;color:#999}.tbl-button{display:inline-block;line-height:20px;height:30px;margin:0;padding:0 10px 1px;cursor:pointer;border:1px solid #ccc;border-radius:3px;color:#555;background:#f7f7f7;vertical-align:top}.tbl-button---white_blue{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}.tbl-select{padding:2px;line-height:20px!important;height:25px!important}.tbl-preloader--small{display:none;width:15px;height:15px;margin:0 5px;vertical-align:middle}.tbl-preloader--tiny{display:none;width:10px;height:10px;margin:0 5px}.tbl-preloader--in_button{margin:0 0 0 8px}.tbl-bulk_actions--wrapper{display:inline-block;margin:5px 0}.tbl-bulk_actions--apply,.tbl-pagination--button,.tbl-pagination--total{margin:0 5px}.tbl-pagination--wrapper{display:inline-block;padding:5px 0;vertical-align:middle}.tbl-pagination--total{vertical-align:baseline}.tbl-pagination--curr_page{width:36px;padding:3px 5px;font-size:13px;text-align:center}@media screen and (max-width:782px){#spbc_settings_form .wp-list-table,#spbc_settings_form .wp-list-table thead,tbody,td,tr{display:block}#spbc_settings_form .wp-list-table thead tr{position:absolute;top:-9999px;left:-9999px}#spbc_settings_form .wp-list-table tr{margin:0 0 1rem}#spbc_settings_form .wp-list-table td{display:block;position:relative;height:100%;padding:10px 0 10px 35%}#spbc_settings_form .wp-list-table tbody td:before{content:attr(data-before)!important;position:absolute;left:10px}#spbc_settings_form .spbcShortTextBlock{width:100%}#spbc_settings_form .wp-list-table tbody .mob_entries{display:none}#spbc_settings_form .wp-list-table tbody .mob_table_active{display:block}}
\ No newline at end of file
diff --git a/css/src/spbc-table.css b/css/src/spbc-table.css
index c91ec5814..7e6af55cf 100644
--- a/css/src/spbc-table.css
+++ b/css/src/spbc-table.css
@@ -78,100 +78,39 @@ tr:hover .row-actions span.tbl-row_action--approve{color: #0a0;}
}
@media screen and (max-width: 782px) {
- #spbc_tbl__traffic_control_logs .wp-list-table {
+ #spbc_settings_form .wp-list-table {
display: block;
}
- #spbc_tbl__traffic_control_logs .wp-list-table thead, tbody, td, tr {
+ #spbc_settings_form .wp-list-table thead, tbody, td, tr {
display: block;
}
- #spbc_tbl__traffic_control_logs .wp-list-table thead tr {
+ #spbc_settings_form .wp-list-table thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
- #spbc_tbl__traffic_control_logs .wp-list-table tr {
+ #spbc_settings_form .wp-list-table tr {
margin: 0 0 1rem 0;
}
- #spbc_tbl__traffic_control_logs .wp-list-table td {
- display: flex;
- align-items: center;
- border: none;
- border-bottom: 1px solid #eee;
- position: relative;
- padding-left: 50%;
- height: 100%;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- #spbc_tbl__traffic_control_logs .wp-list-table td:before {
- position: absolute;
- top: 0;
- left: 6px;
- width: 45%;
- padding-right: 10px;
- white-space: nowrap;
- height: inherit;
- display: grid;
- align-items: center;
- }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(1):before { content: "IP"; }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(2):before { content: "Country"; }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(3):before { content: "Last Request"; }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(4):before { content: "Status"; }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(5):before { content: "Requests";}
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(6):before { content: "Requests per 5 minutes"; }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(7):before { content: "Page"; }
- #spbc_tbl__traffic_control_logs .wp-list-table td:nth-of-type(8):before { content: "User Agent"; }
- .spbcShortTextBlock {
- width: 100%;
- }
-
- #spbc_tbl__secuirty_logs .wp-list-table {
+ #spbc_settings_form .wp-list-table td {
display: block;
- }
- #spbc_tbl__secuirty_logs .wp-list-table thead, tbody, td, tr {
- display: block;
- }
- #spbc_tbl__secuirty_logs .wp-list-table thead tr {
- position: absolute;
- top: -9999px;
- left: -9999px;
- }
- #spbc_tbl__secuirty_logs .wp-list-table tr {
- margin: 0 0 1rem 0;
- }
- #spbc_tbl__secuirty_logs .wp-list-table td {
- display: flex;
- align-items: center;
- border: none;
- border-bottom: 1px solid #eee;
position: relative;
- padding-left: 50%;
height: 100%;
- padding-top: 10px;
- padding-bottom: 10px;
+ padding: 10px 0 10px 35%;
}
- #spbc_tbl__secuirty_logs .wp-list-table td:before {
+ #spbc_settings_form .wp-list-table tbody td:before {
+ content: attr(data-before) !important;
position: absolute;
- top: 0;
- left: 6px;
- width: 45%;
- padding-right: 10px;
- white-space: nowrap;
- height: inherit;
- display: grid;
- align-items: center;
+ left: 10px;
}
- #spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(1):before { content: "User"; }
- #spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(2):before { content: "IP"; }
- #spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(3):before { content: "Date"; }
- #spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(4):before { content: "Action"; }
- #spbc_tbl__secuirty_logs .wp-list-table td:nth-of-type(5):before { content: "Page";}
- .spbcShortTextBlock {
+ #spbc_settings_form .spbcShortTextBlock {
width: 100%;
}
-
- #spbc_tbl__traffic_control_logs .wp-list-table .mob_entries, #spbc_tbl__secuirty_logs .wp-list-table .mob_entries {
+ #spbc_settings_form .wp-list-table tbody .mob_entries {
display: none;
}
+
+ #spbc_settings_form .wp-list-table tbody .mob_table_active {
+ display: block;
+ }
}
\ No newline at end of file
diff --git a/inc/fw-update.php b/inc/fw-update.php
index f32438620..21b2047e0 100644
--- a/inc/fw-update.php
+++ b/inc/fw-update.php
@@ -25,6 +25,10 @@ function spbc_security_firewall_update__init($delay = null)
sleep((int)$delay);
+ $spbc->fw_stats['last_update_log'] = [];
+
+ spbc_security_firewall_update_log(__FUNCTION__);
+
// Prevent start an update if update is already running and started less than 2 minutes ago
if (
$spbc->fw_stats['updating_id'] &&
@@ -44,9 +48,11 @@ function spbc_security_firewall_update__init($delay = null)
// Delete temporary tables
FW::dataTablesDeleteTemporary(DB::getInstance(), array(
- SPBC_TBL_FIREWALL_DATA,
- SPBC_TBL_FIREWALL_DATA__IPS,
- SPBC_TBL_FIREWALL_DATA__COUNTRIES,
+ SPBC_TBL_FIREWALL_DATA_V4,
+ SPBC_TBL_FIREWALL_DATA_V6,
+ SPBC_TBL_FIREWALL_DATA__IPS_V4,
+ SPBC_TBL_FIREWALL_DATA__IPS_V6,
+ SPBC_TBL_FIREWALL_DATA__COUNTRIES
));
$wp_upload_dir = wp_upload_dir();
@@ -74,8 +80,13 @@ function spbc_security_firewall_update__init($delay = null)
)
);
- // Make a direct update if folder creation or test RC fail
- if ( ! empty($prepare_dir__result['error']) || ! empty($test_rc_result['error'])) {
+ // Make a direct update if folder creation, test RC fail or force const exist
+ if ( ! empty($prepare_dir__result['error']) ||
+ ! empty($test_rc_result['error']) ||
+ (defined('SPBCT_FORCE_DIRECT_SECFW_UPDATE') && SPBCT_FORCE_DIRECT_SECFW_UPDATE)
+ ) {
+ spbc_security_firewall_update_log('go to direct update');
+
return spbc_security_firewall_update_direct();
}
@@ -91,6 +102,10 @@ function spbc_security_firewall_update__init($delay = null)
array( 'async' )
);
+ if ( ! empty($result['error']) ) {
+ spbc_security_firewall_update_log(json_encode($result['error']));
+ }
+
return ( ! empty($result['error']) && $queue->isQueueFinished() ) ? $result : true;
}
@@ -105,6 +120,8 @@ function spbc_security_firewall_update__worker($checker_work = null)
{
global $spbc;
+ spbc_security_firewall_update_log(__FUNCTION__);
+
if ( ! $spbc->key_is_ok ) {
return array( 'error' => 'KEY_IS_NOT_VALID' );
}
@@ -133,6 +150,7 @@ function spbc_security_firewall_update__worker($checker_work = null)
// Queue is already empty. Exit.
$queue = new Queue('fw_update', 'update_security_firewall__worker');
if ( $queue->isQueueFinished() ) {
+ spbc_security_firewall_update_log('is queue finished');
return true;
}
@@ -144,11 +162,11 @@ function spbc_security_firewall_update__worker($checker_work = null)
sleep(1);
$queue->refreshQueue();
if ( ! $queue->isQueueInProgress() ) {
- // The stage executed, break waiting and continue sfw_update__worker process
+ spbc_security_firewall_update_log('The stage executed, break waiting and continue sfw_update__worker process');
break;
}
if ( $i >= 4 ) {
- // The stage still not executed, exit from sfw_update__worker
+ spbc_security_firewall_update_log('The stage still not executed, exit from sfw_update__worker');
return true;
}
}
@@ -174,6 +192,8 @@ function spbc_security_firewall_update__worker($checker_work = null)
// This is the repeat stage request, do not generate any new RC
if ( stripos(Request::get('stage'), 'Repeat') !== false ) {
+ spbc_security_firewall_update_log('repeat request');
+
return true;
}
@@ -183,6 +203,10 @@ function spbc_security_firewall_update__worker($checker_work = null)
array( 'async' )
);
+ if ( ! empty($result['error']) ) {
+ $spbc->error_add('firewall_update', current(array_column($queue->queue['stages'], 'error')));
+ }
+
return ! empty($result['error']) && $queue->isQueueFinished() ? $result : true;
}
@@ -331,16 +355,20 @@ function spbc_security_firewall_update__prepare()
global $wpdb;
// Make sure that the table exists. Creating it if not.
$db_tables_creator = new \CleantalkSP\SpbctWP\DB\TablesCreator();
- $db_tables_creator->createTable($wpdb->base_prefix . 'spbc_firewall_data');
- $db_tables_creator->createTable($wpdb->prefix . 'spbc_firewall__personal_ips');
- $db_tables_creator->createTable($wpdb->prefix . 'spbc_firewall__personal_countries');
+ $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA_V4);
+ $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA_V6);
+ $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA__IPS_V4);
+ $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA__IPS_V6);
+ $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA__COUNTRIES);
// Update only personal tables for daughter blogs
$result = FW::dataTablesCreateTemporaryTablesForTables(
DB::getInstance(),
array(
- SPBC_TBL_FIREWALL_DATA,
- SPBC_TBL_FIREWALL_DATA__IPS,
+ SPBC_TBL_FIREWALL_DATA_V4,
+ SPBC_TBL_FIREWALL_DATA_V6,
+ SPBC_TBL_FIREWALL_DATA__IPS_V4,
+ SPBC_TBL_FIREWALL_DATA__IPS_V6,
SPBC_TBL_FIREWALL_DATA__COUNTRIES
)
);
@@ -350,9 +378,13 @@ function spbc_security_firewall_update__prepare()
}
// Copying data without country code
- $result = FW::dataTablesCopyCountiesDataFromMainTable(DB::getInstance(), SPBC_TBL_FIREWALL_DATA);
- if ( ! empty($result['error']) ) {
- return $result;
+ $result_v4 = FW::dataTablesCopyCountiesDataFromMainTable(DB::getInstance(), SPBC_TBL_FIREWALL_DATA_V4);
+ $result_v6 = FW::dataTablesCopyCountiesDataFromMainTable(DB::getInstance(), SPBC_TBL_FIREWALL_DATA_V6);
+ if ( ! empty($result_v4['error']) ) {
+ return $result_v4;
+ }
+ if ( ! empty($result_v6['error']) ) {
+ return $result_v6;
}
$spbc->fw_stats['update_percent'] = 15;
@@ -487,8 +519,10 @@ function spbc_security_firewall_update__end_of_update()
//Increment firewall entries
$tables_to_work_with = array(
- SPBC_TBL_FIREWALL_DATA,
- SPBC_TBL_FIREWALL_DATA__IPS,
+ SPBC_TBL_FIREWALL_DATA_V4,
+ SPBC_TBL_FIREWALL_DATA_V6,
+ SPBC_TBL_FIREWALL_DATA__IPS_V4,
+ SPBC_TBL_FIREWALL_DATA__IPS_V6,
SPBC_TBL_FIREWALL_DATA__COUNTRIES
);
@@ -512,9 +546,13 @@ function spbc_security_firewall_update__end_of_update()
$spbc->fw_stats['updating_last_start'] = 0;
$spbc->fw_stats['last_updated'] = current_time('timestamp');
$spbc->fw_stats['is_on_maintenance'] = false; // Remove maintenance mode
- $spbc->fw_stats['entries'] =
- $wpdb->get_var('SELECT COUNT(*) FROM ' . SPBC_TBL_FIREWALL_DATA) +
- $wpdb->get_var('SELECT COUNT(*) FROM ' . SPBC_TBL_FIREWALL_DATA__IPS);
+
+ $sql_count_networks = "SELECT SUM(cnt) FROM (
+ SELECT COUNT(*) as cnt FROM " . SPBC_TBL_FIREWALL_DATA_V4 . "
+ UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA_V6 . "
+ UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V4 . "
+ UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V6 . ") cnt";
+ $spbc->fw_stats['entries'] = $wpdb->get_var($sql_count_networks);
$spbc->save('fw_stats', true, false);
@@ -625,6 +663,7 @@ function spbc_security_firewall_update_direct()
// process_file
foreach ( $urls as $url ) {
+ spbc_security_firewall_update_log('process ' . $url);
$result_process_file = spbc_security_firewall_update__process_file($url);
if ( ! empty($result_process_file['error']) ) {
return $result_process_file;
@@ -647,3 +686,19 @@ function spbc_security_firewall_update_direct()
return $result_end_of_update;
}
+
+/**
+ * Log steps
+ *
+ * @param string $step
+ * @return void
+ */
+function spbc_security_firewall_update_log($step)
+{
+ global $spbc;
+
+ $time = date('Y-m-d H:i:s', time());
+ $spbc->fw_stats['last_update_log'][] = [$time, $step];
+
+ $spbc->save('fw_stats', true, false);
+}
diff --git a/inc/spbc-admin.php b/inc/spbc-admin.php
index a10f3271f..d7c6d26a1 100644
--- a/inc/spbc-admin.php
+++ b/inc/spbc-admin.php
@@ -105,8 +105,8 @@ function spbc_admin_init()
add_action('wp_ajax_spbc_send_traffic_control', 'spbc_send_firewall_logs', 1, 0);
add_action('wp_ajax_spbc_send_security_log', 'spbc_send_logs', 1, 0);
- // WAF. Notification about blocked file.
- add_action('wp_ajax_spbc_check_file_block', array(WAF::class, 'wafFileGetLastBlockedInfo'));
+ // UploadChecker. Notification about blocked file.
+ add_action('wp_ajax_spbc_check_file_block', array(\CleantalkSP\SpbctWP\Firewall\UploadChecker::class, 'uploadCheckerGetLastBlockInfo'));
// Backups
add_action('wp_ajax_spbc_rollback', 'spbc_rollback');
@@ -286,7 +286,7 @@ function spbc_enqueue_scripts($hook)
'data__set_cookies__alt_sessions_type' => $spbc->settings['data__set_cookies__alt_sessions_type'],
));
- if ($spbc->settings['waf__file_check'] && in_array($hook, array('upload.php', 'media-new.php'))) {
+ if ($spbc->settings['upload_checker__file_check'] && in_array($hook, array('upload.php', 'media-new.php'))) {
wp_enqueue_script('spbc-upload-js', SPBC_PATH . '/js/spbc-upload.min.js', array('jquery'), SPBC_VERSION, false);
}
@@ -441,7 +441,7 @@ function ($key) {
'waf__enabled' => __('Bla bla', 'security-malware-firewall'),
'waf__xss_check' => __('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.', 'security-malware-firewall'),
'waf__sql_check' => __('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.', 'security-malware-firewall'),
- 'waf__file_check' => __('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.', 'security-malware-firewall'),
+ 'upload_checker__file_check' => __('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.', 'security-malware-firewall'),
'traffic_control__enabled' => __('It analyzes quantity of requests towards website from any IP address for a certain period of time. For example, for an ordinary visitor it\'s impossible to generate 2000 requests within 1 hour. Big amount of requests towards website from the same IP address indicates that there is a high chance of presence of a malicious program.', 'security-malware-firewall'),
'scanner__outbound_links' => __('This option allows you to know the number of outgoing links on your website and website addresses they lead to. These websites addresses will be checked with the CleanTalk Database and the results will show if they were used in spam messages. The option\'s purpose is to check your website and find hidden, forgotten and spam links. You should always remember if you have links to other websites which have a bad reputation, it could affect your visitors\' trust and your SEO.', 'security-malware-firewall'),
'scanner__heuristic_analysis' => __('Often, authors of malicious code disguise their code which makes it difficult to identify it by their signatures. The malicious code itself can be placed anywhere on the site, for example the obfuscated PHP-code in the "logo.png" file, and the code itself is called by one inconspicuous line in "index.php". Therefore, the usage of plugins to search for malicious code is preferable. Heuristic analysis can indicate suspicious PHP constructions in a file that you should pay attention to.', 'security-malware-firewall'),
@@ -806,7 +806,8 @@ function spbc_set_malware_scan_warns()
$query = 'SELECT COUNT(*)
FROM ' . SPBC_TBL_SCAN_FILES . '
WHERE (STATUS = "INFECTED" AND severity = "CRITICAL" AND analysis_status IS NULL)
- OR STATUS = "DENIED_BY_CLOUD"';
+ OR STATUS = "DENIED_BY_CLOUD"
+ OR STATUS = "DENIED_BY_CT"';
$critical_count = (int)$wpdb->get_var($query) > 0;
$query = 'SELECT COUNT(*)
@@ -822,7 +823,8 @@ function spbc_set_malware_scan_warns()
$query = 'SELECT COUNT(*)
FROM ' . SPBC_TBL_SCAN_FILES . '
- WHERE pscan_status = "DANGEROUS" OR analysis_status = "DANGEROUS" OR status = "DENIED_BY_CT"';
+ WHERE pscan_status = "DANGEROUS" OR analysis_status = "DANGEROUS" OR
+ (status = "DENIED_BY_CT" AND last_sent IS NOT NULL)';
$analysis_has_dangerous = (int)$wpdb->get_var($query) > 0;
$query = 'SELECT COUNT(*)
diff --git a/inc/spbc-scanner.php b/inc/spbc-scanner.php
index b54d4a2c8..b6514bd5b 100644
--- a/inc/spbc-scanner.php
+++ b/inc/spbc-scanner.php
@@ -274,6 +274,13 @@ function spbc_scanner_file_send($direct_call = false, $file_id = null, $do_resca
$mixed_result = Arr::mergeWithSavingNumericKeysRecursive((array)$result_heur, (array)$result_sign);
+ if ( isset($mixed_result['weak_spots']) &&
+ is_array($mixed_result['weak_spots']) &&
+ isset($mixed_result['weak_spots'][0]) &&
+ count($mixed_result['weak_spots']) > 1 ) {
+ unset($mixed_result['weak_spots'][0]);
+ }
+
$wpdb->update(
SPBC_TBL_SCAN_FILES,
array(
@@ -581,7 +588,7 @@ function spbc_scanner_file_approve($direct_call = false, $file_id = null)
$wpdb->update(
SPBC_TBL_SCAN_FILES,
array(
- 'status' => 'APROVED',
+ 'status' => 'APPROVED_BY_USER',
'previous_state' => $previous,
'pscan_status' => null,
'pscan_processing_status' => null,
@@ -763,6 +770,7 @@ function spbc_scanner_pscan_check_analysis_status($direct_call = false, $file_id
. ' SET '
. ' pscan_processing_status = "DONE",'
. ' pscan_status = %s ,'
+ . ' severity = "CRITICAL",'
. ' pscan_balls = %s,'
. ' status = "DENIED_BY_CLOUD"'
. ' WHERE pscan_file_id = %s',
@@ -1017,7 +1025,7 @@ function spbc_scanner_file_send_for_analysis__bulk($fast_hashes_list = array())
$sql_result = $wpdb->get_results(
'SELECT fast_hash FROM ' . SPBC_TBL_SCAN_FILES . '
WHERE last_sent IS NULL
- AND status NOT IN ("OK","APROVED","APPROVED_BY_CT","APPROVED_BY_CLOUD")',
+ AND status NOT IN ("OK","APPROVED_BY_USER","APPROVED_BY_CT","APPROVED_BY_CLOUD")',
ARRAY_A
);
@@ -1069,10 +1077,10 @@ function spbc_get_sql_where_addiction_for_table_of_category($category)
case 'critical':
$res = ' WHERE status IN ("DENIED_BY_CLOUD", "DENIED_BY_CT")
OR (
- severity IN("CRITICAL")
+ severity = "CRITICAL"
AND (
status <> "QUARANTINED" AND
- status <> "APROVED" AND
+ status <> "APPROVED_BY_USER" AND
status <> "APPROVED_BY_CT"
)
AND (
@@ -1085,24 +1093,25 @@ function spbc_get_sql_where_addiction_for_table_of_category($category)
case 'suspicious':
$res = ' WHERE severity <> "CRITICAL" AND
last_sent IS NULL AND
- (status = "MODIFIED" AND severity IS NOT NULL)
- OR (status = "INFECTED" AND severity IN ("SUSPICIOUS","DANGER") )';
+ (status = "MODIFIED" AND source_type IS NOT NULL)
+ OR (status = "INFECTED" AND severity = "SUSPICIOUS")';
break;
case 'approved':
- $res = ' WHERE ( status = "APROVED" OR status = "APPROVED_BY_CT" OR status = "APPROVED_BY_CLOUD") AND source_type IS NULL';
+ $res = ' WHERE ( status = "APPROVED_BY_USER" OR status = "APPROVED_BY_CT" OR status = "APPROVED_BY_CLOUD") AND source_type IS NULL';
break;
case 'analysis_log':
$res = ' WHERE last_sent IS NOT NULL';
break;
case 'unknown':
- $res = ' WHERE status NOT IN ("APROVED","APPROVED_BY_CT","APPROVED_BY_CLOUD","DENIED_BY_CT") AND
+ $res = ' WHERE status NOT IN ("APPROVED_BY_USER","APPROVED_BY_CT","APPROVED_BY_CLOUD","DENIED_BY_CT") AND
detected_at >= ' . (time() - $spbc->settings['scanner__list_unknown__older_than'] * 86400) . ' AND
source IS NULL AND
+ source_type IS NULL AND
path NOT LIKE "%wp-content%themes%" AND
path NOT LIKE "%wp-content%plugins%" AND
path NOT LIKE "%wp-content%cache%" AND
path NOT LIKE "%wp-config.php" AND
- (severity IS NULL OR severity NOT IN ("CRITICAL", "DANGER", "SUSPICIOUS")) AND
+ (severity IS NULL OR severity NOT IN ("CRITICAL", "SUSPICIOUS")) AND
last_sent IS NULL';
break;
case 'quarantined':
@@ -1288,14 +1297,16 @@ function spbc_scanner_page_view($direct_call = false, $page_url = false)
$page_text = array();
+ $page_url_sql = str_replace('.', '%', $page_url);
+
// Getting file info.
$sql_result = $wpdb->get_results(
$wpdb->prepare(
'SELECT weak_spots'
. ' FROM ' . SPBC_TBL_SCAN_FRONTEND
- . ' WHERE url = %s'
+ . ' WHERE url LIKE %s'
. ' LIMIT 1',
- $page_url
+ $page_url_sql
),
ARRAY_A
);
@@ -1972,6 +1983,10 @@ function spbc_scanner_save_to_pdf($direct_call = false)
$pdf->drawFilesListByType('critical_files');
+ $pdf->AddPage();
+
+ $pdf->drawFilesListByType('suspicious_files');
+
$pdf->Output();
}
diff --git a/inc/spbc-settings.php b/inc/spbc-settings.php
index 7dac8841e..21844c0a9 100644
--- a/inc/spbc-settings.php
+++ b/inc/spbc-settings.php
@@ -1,5 +1,7 @@
array(
'waf__xss_check',
'waf__sql_check',
- 'waf__file_check',
'waf__exploit_check',
'waf_blocker__enabled'
),
@@ -445,21 +446,6 @@ function spbc_settings__register()
'long_description' => true,
'parent' => 'waf__enabled',
),
- 'waf__file_check' => array(
- 'type' => 'field',
- 'title' => __('Check uploaded files', 'security-malware-firewall'),
- 'description' => __('Check uploaded files for malicious code.', 'security-malware-firewall'),
- 'long_description' => true,
- 'parent' => 'waf__enabled',
- 'children' => array('waf__file_check__uploaded_plugins')
- ),
- 'waf__file_check__uploaded_plugins' => array(
- 'type' => 'field',
- 'title' => __('Check plugins and themes while uploading', 'security-malware-firewall'),
- 'description' => __('Check the plugins and themes uploaded via WordPress built in interface with heuristic and signature analysis.', 'security-malware-firewall'),
- 'parent' => 'waf__file_check',
- 'class' => 'spbc_sub2_setting',
- ),
'waf__exploit_check' => array(
'type' => 'field',
'title' => __('Check for exploits', 'security-malware-firewall'),
@@ -472,6 +458,20 @@ function spbc_settings__register()
'description' => __('Blocking a visitor for 24 hours after several WAF detected brute force attempts.', 'security-malware-firewall'),
'parent' => 'waf__enabled',
),
+ 'upload_checker__file_check' => array(
+ 'type' => 'field',
+ 'title' => __('Run the Upload Checker module for uploaded files', 'security-malware-firewall'),
+ 'description' => __('The plugin will scan files uploaded to the WordPress media library for known malicious code with heuristic and signature analysis. If malware found, upload will stop.', 'security-malware-firewall'),
+ 'long_description' => true,
+ 'children' => array('upload_checker__do_check_wordpress_modules')
+ ),
+ 'upload_checker__do_check_wordpress_modules' => array(
+ 'type' => 'field',
+ 'title' => __('Check plugins and themes archives before install', 'security-malware-firewall'),
+ 'description' => __('Check the plugins and themes uploaded via WordPress built in interface with heuristic and signature analysis.', 'security-malware-firewall'),
+ 'parent' => 'upload_checker__file_check',
+ 'class' => 'spbc_sub2_setting',
+ ),
'traffic_control__enabled' => array(
'type' => 'field',
'title' => __('Traffic Control', 'security-malware-firewall'),
@@ -536,6 +536,12 @@ function spbc_settings__register()
'options' => spbc_settings_field__secfw__get_ip__get_labels(),
'title' => __('Get visitors IP from additional headers', 'security-malware-firewall'),
'description' => spbc_settings_field__secfw__get_ip__get_description(),
+ 'long_description' => true,
+ ),
+ 'secfw__get_ip__enable_cdn_auto_self_check' => array(
+ 'type' => 'field',
+ 'title' => __('Enable automatic CDN headers checker', 'security-malware-firewall'),
+ 'description' => CDNHeadersChecker::getOptionDescriptionText(),
),
),
),
@@ -1649,6 +1655,16 @@ function spbc_field_statistics()
: __('Unknown last PHP log sending time.', 'security-malware-firewall'));
}
+ echo '
';
+
+
+ //cdn checker data
+ add_filter('safe_style_css', function ($styles) {
+ $styles[] = 'display';
+ return $styles;
+ });
+ echo Escape::escKsesPreset(CDNHeadersChecker::getSummaryBlockHTML(), 'spbc_cdn_checker_table');
+
echo '
';
echo 'Plugin version: ' . SPBC_VERSION;
echo '';
@@ -2168,7 +2184,7 @@ function spbc_field_traffic_control_logs__prepare_data(&$table)
break;
case 'DENY_BY_WAF_FILE':
$status = ''
- . __('Blocked by Web Application Firewall: ', 'security-malware-firewall')
+ . __('Blocked by Upload Checker module: ', 'security-malware-firewall')
. ''
. __('Malicious files upload.', 'security-malware-firewall')
. ''
@@ -2474,22 +2490,6 @@ function spbc_field_scanner__prepare_data__files(&$table)
$ws_string .= '
Danger: ' - . (strlen($weak_spot_in_string) > 30 - ? substr($weak_spot_in_string, 0, 30) . '...' - : $weak_spot_in_string); - - $ws_string .= '
'; - } - } } $table->items[ $key ]['weak_spots'] = $ws_string; @@ -2577,7 +2577,7 @@ function spbc_field_scanner__prepare_data__analysis_log(&$table) $analysis_comment = __('Quarantined by user', 'security-malware-firewall'); } - if ( isset($row->status) && $row->status === 'APROVED' ) { + if ( isset($row->status) && $row->status === 'APPROVED_BY_USER' ) { $pscan_status = 'APPROVED'; $analysis_comment = __('Approved by user', 'security-malware-firewall'); } @@ -3187,11 +3187,9 @@ function spbc_list_table__get_args_by_type($table_type) 'mtime' => array('heading' => 'Last Modified',), ), 'actions' => array( - 'delete' => array('name' => 'Delete',), 'view' => array('name' => 'View', 'handler' => 'spbc_scanner_button_file_view_event(this);',), ), 'bulk_actions' => array( - 'delete' => array('name' => 'Delete',), ), 'sortable' => array('path', 'size', 'perms', 'mtime',), 'pagination' => array( @@ -3560,10 +3558,12 @@ function spbc_list_table__get_args_by_type($table_type) ), 'if_empty_items' => false, 'actions' => array( + 'delete' => array('name' => 'Delete',), 'approve' => array('name' => 'Approve',), 'view' => array('name' => 'View',), ), 'bulk_actions' => array( + 'delete' => array('name' => 'Delete',), 'approve' => array('name' => 'Approve',), ), 'sql' => array( @@ -4513,7 +4513,7 @@ function spbc_settings__get_description() 'title' => __('SQL-injection check', 'security-malware-firewall'), '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.', 'security-malware-firewall') ), - 'waf__file_check' => array( + 'upload_checker__file_check' => array( 'title' => __('Check uploaded files', 'security-malware-firewall'), '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.', 'security-malware-firewall') ), @@ -4721,6 +4721,10 @@ function spbc_settings__get_description() 'desc' => __('The file hash is in denied list. It means that the Security analysts have marked this file as critically dangerous early. We do recommend you to order the Security Audit service.', 'security-malware-firewall') ), + 'secfw__get_ip' => array( + 'title' => IP::getOptionLongDescriptionArray()['title'], + 'desc' => IP::getOptionLongDescriptionArray()['desc'], + ), 'no_description' => array( 'title' => esc_html($setting_id), 'desc' => __('No description provided yet for this item. We are sorry about this. Please, contact support@cleantalk.org for further help.', 'security-malware-firewall'), @@ -4995,6 +4999,17 @@ function spbc__send_local_settings_to_api($settings) API::methodSendLocalSettings($api_key, $hostname, $settings); } +add_action('spbc_before_returning_settings', 'spbc_cdn_checker__run_check_on_settings_change'); + +function spbc_cdn_checker__run_check_on_settings_change($settings) +{ + if ( isset($settings['secfw__get_ip__enable_cdn_auto_self_check']) && $settings['secfw__get_ip__enable_cdn_auto_self_check'] != 0) { + CDNHeadersChecker::sendCDNCheckerRequest(); + SpbcCron::updateTask('cdn_check', 'spbc_cdn_checker__send_request', 86400, time() + 86400); + } +} + + /** * */ @@ -5037,24 +5052,10 @@ function spbc_settings_field__secfw__get_ip__get_description() function spbc_settings_field__secfw__get_ip__get_labels() { - $available_header = array( - 2 => array('slug' => 'remote_addr', 'name' => 'Remote Addr'), - 3 => array('slug' => 'x_forwarded_for', 'name' => 'X-Forwarder-For'), - 4 => array('slug' => 'x_real_ip', 'name' => 'X-Real-Ip'), - 5 => array('slug' => 'incapsula', 'name' => 'Incap-Client-Ip'), - 6 => array('slug' => 'ico_x_forwarded_for', 'name' => 'Ico-X-Forwarded-For'), - 7 => array('slug' => 'stackpath', 'name' => 'X-Sp-Forwarded-Ip'), - 8 => array('slug' => 'x_forwarded_by', 'name' => 'X-Client-Ip'), - 9 => array('slug' => 'sucury', 'name' => 'X-Sucuri-Clientip'), - 10 => array('slug' => 'ezoic', 'name' => 'X-Middleton-Ip'), - 11 => array('slug' => 'gtranslate', 'name' => 'X-Gt-Viewer-Ip'), - 12 => array('slug' => 'cloud_flare', 'name' => 'Cf-Connecting-Ip'), - 13 => array('slug' => 'ovh', 'name' => 'Remote-Ip'), - ); $options = array(); $options[] = array('val' => 1, 'label' => __('Auto', 'security-malware-firewall'),); - foreach ( $available_header as $key => $header ) { + foreach (IP::$known_headers_collection as $key => $header ) { IP::get($header['slug'], [], true); $option_value = $header['name']; $option_value .= isset(IP::getInstance()->ips_stored[$header['slug']]) @@ -5225,7 +5226,7 @@ function spbc__get_security_status_license_html() // Security license expires if ((int)$spbc->data['notice_show'] === 1) { return '' - . __('Security license expires in next 7 days', 'security-malware-firewall') + . __('Security license expires in next 30 days', 'security-malware-firewall') . ''; } } diff --git a/js/spbc-admin.min.js b/js/spbc-admin.min.js index 243396084..815b463b8 100644 --- a/js/spbc-admin.min.js +++ b/js/spbc-admin.min.js @@ -1,2 +1,2 @@ -function spbcGetGoogleQrCode(){var e={},c={};return e.security=spbcSettings.ajax_nonce,e.action="spbc_get_google_qr_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){c=e}}),c}function spbcCheckGoogleCode(){var e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_google_code",e.code=jQuery("#spbct-google-qr-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("#spbct-google-qr-code").dialog("close"),document.location.reload()):alert(e.data)}})}function spbcDisableG2fa(e){var c={};c.security=spbcSettings.ajax_nonce,c.action="spbc_disable_google_2fa",c.user_id=jQuery(e).data("user-id"),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:c,success:function(e){e.success?document.location.reload():alert(e.data)}})}jQuery(document).ready(function(){jQuery(".spbc_update_notice").on("click","button",function(){spbc_setCookie("spbc_update_banner_closed",1,2592e3)}),jQuery(document).on("click","#spbc-g2fa-enable",function(e){e.preventDefault();e=spbcGetGoogleQrCode();e.success?(jQuery("#spbct-google-qr-code-img").html(e.data.img+""+e.data.code+"
"),jQuery("#spbct-google-qr-code input").val(""),jQuery("#spbct-google-qr-code").dialog({modal:!0,title:"Google authenticator activation",buttons:{Cancel:function(){jQuery(this).dialog("close")},Ok:function(){spbcCheckGoogleCode()}},draggable:!1,resizable:!1})):alert(spbcGetGoogleQrCode.data)}),jQuery(document).on("click","#spbc-g2fa-disable",function(e){e.preventDefault(),confirm("Are you sure?")&&spbcDisableG2fa(this)});function e(e,c,t){setTimeout(function(){null!==e&&(jQuery(".spbc-admin_bar--user_counter").html(e.count),e.count<=3?(jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").show(),jQuery(".spbc-admin_bar--online_admins").html(e.users.join(", "))):jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").hide()),spbc_sendAJAXRequest(c,t)},15e3)}1==+spbcSettings.admin_bar__admins_online_counter&&e(null,{action:"spbc_get_authorized_admins"},{callback:e}),jQuery("body").on("click",".spbc-notice .notice-dismiss",function(e){e=jQuery(e.target).parent(".notice").attr("id");e&&spbc_sendAJAXRequest({action:"spbc_dismiss_banner",banner_id:e},{callback:null})}),1==+spbcSettings.needToWhitelist&&spbc_sendAJAXRequest({action:"spbc_private_list_add"},{callback:null})}); +function spbcGetGoogleQrCode(){var e={},c={};return e.security=spbcSettings.ajax_nonce,e.action="spbc_get_google_qr_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){c=e}}),c}function spbcCheckGoogleCode(){var e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_google_code",e.code=jQuery("#spbct-google-qr-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("#spbct-google-qr-code").dialog("close"),document.location.reload()):alert(e.data)}})}function spbcDisableG2fa(e){var c={};c.security=spbcSettings.ajax_nonce,c.action="spbc_disable_google_2fa",c.user_id=jQuery(e).data("user-id"),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:c,success:function(e){e.success?document.location.reload():alert(e.data)}})}function spbcSummaryShowCDNCheckerTable(){event.preventDefault();var e=document.getElementById("spbc_stats_cdn_checker_table");void 0!==e&&("block"===e.style.display?e.style.display="none":e.style.display="block")}jQuery(document).ready(function(){jQuery(".spbc_update_notice").on("click","button",function(){spbc_setCookie("spbc_update_banner_closed",1,2592e3)}),jQuery(document).on("click","#spbc-g2fa-enable",function(e){e.preventDefault();e=spbcGetGoogleQrCode();e.success?(jQuery("#spbct-google-qr-code-img").html(e.data.img+""+e.data.code+"
"),jQuery("#spbct-google-qr-code input").val(""),jQuery("#spbct-google-qr-code").dialog({modal:!0,title:"Google authenticator activation",buttons:{Cancel:function(){jQuery(this).dialog("close")},Ok:function(){spbcCheckGoogleCode()}},draggable:!1,resizable:!1})):alert(spbcGetGoogleQrCode.data)}),jQuery(document).on("click","#spbc-g2fa-disable",function(e){e.preventDefault(),confirm("Are you sure?")&&spbcDisableG2fa(this)});function e(e,c,t){setTimeout(function(){null!==e&&(jQuery(".spbc-admin_bar--user_counter").html(e.count),e.count<=3?(jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").show(),jQuery(".spbc-admin_bar--online_admins").html(e.users.join(", "))):jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").hide()),spbc_sendAJAXRequest(c,t)},15e3)}1==+spbcSettings.admin_bar__admins_online_counter&&e(null,{action:"spbc_get_authorized_admins"},{callback:e}),jQuery("body").on("click",".spbc-notice .notice-dismiss",function(e){e=jQuery(e.target).parent(".notice").attr("id");e&&spbc_sendAJAXRequest({action:"spbc_dismiss_banner",banner_id:e},{callback:null})}),1==+spbcSettings.needToWhitelist&&spbc_sendAJAXRequest({action:"spbc_private_list_add"},{callback:null})}); //# sourceMappingURL=spbc-admin.min.js.map diff --git a/js/spbc-admin.min.js.map b/js/spbc-admin.min.js.map index 231f47dd9..f58bb3713 100644 --- a/js/spbc-admin.min.js.map +++ b/js/spbc-admin.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-admin.min.js","sources":["spbc-admin.js"],"sourcesContent":["function spbcGetGoogleQrCode() {\r\n\tvar data = {};\r\n\tvar res = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_get_google_qr_code';\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tres = result;\r\n\t\t},\r\n\t});\r\n\treturn res;\r\n}\r\n\r\nfunction spbcCheckGoogleCode() {\r\n\tvar data = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_check_google_code';\r\n\tdata.code = jQuery('#spbct-google-qr-code input').val();\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(result.success) {\r\n\t\t\t\tjQuery('#spbct-google-qr-code').dialog( \"close\" );\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t} else {\r\n\t\t\t\talert(result.data);\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nfunction spbcDisableG2fa( element ) {\r\n\tvar data = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_disable_google_2fa';\r\n data.user_id = jQuery(element).data('user-id');\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(result.success) {\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t} else {\r\n\t\t\t\talert(result.data);\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// Auto update banner close handler \r\n\tjQuery('.spbc_update_notice').on('click', 'button', function(){\r\n\t\tspbc_setCookie('spbc_update_banner_closed', 1, 86400 * 30);\r\n\t});\r\n\r\n\t// Enable G2FA from user profile page\r\n\tjQuery(document).on('click', '#spbc-g2fa-enable', function(e){\r\n\r\n\t\te.preventDefault();\r\n\t\tvar spbcGoogleQrCode = spbcGetGoogleQrCode();\r\n\r\n\t\tif( spbcGoogleQrCode.success ) {\r\n\t\t\tvar qr_code_div = jQuery('#spbct-google-qr-code-img');\r\n\t\t\tqr_code_div.html(spbcGoogleQrCode.data.img + '' + spbcGoogleQrCode.data.code + '
');\r\n\t\t\tjQuery('#spbct-google-qr-code input').val('');\r\n\t\t\tjQuery('#spbct-google-qr-code').dialog({\r\n\t\t\t\tmodal: true,\r\n\t\t\t\ttitle: 'Google authenticator activation',\r\n\t\t\t\tbuttons: {\r\n\t\t\t\t\tCancel: function() {\r\n\t\t\t\t\t\tjQuery( this ).dialog( \"close\" );\r\n\t\t\t\t\t},\r\n\t\t\t\t\tOk: function() {\r\n\t\t\t\t\t\tspbcCheckGoogleCode();\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tdraggable: false,\r\n\t\t\t\tresizable: false,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\talert(spbcGetGoogleQrCode.data);\r\n\t\t}\r\n\r\n\t});\r\n\r\n\t// Disable G2FA from user profile page\r\n\tjQuery(document).on('click', '#spbc-g2fa-disable', function(e){\r\n\r\n\t\te.preventDefault();\r\n\t\tif( confirm( 'Are you sure?' ) ) {\r\n\t\t\tspbcDisableG2fa( this );\r\n\t\t}\r\n\r\n\t});\r\n\r\n\tvar refresh_user_online_counter = function( result, data, params ){\r\n\t\tsetTimeout(function () {\r\n\t\t\tif( result !== null ){\r\n\t\t\t\tjQuery('.spbc-admin_bar--user_counter').html(result.count);\r\n\t\t\t\tif( result.count <= 3 ) {\r\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').show();\r\n\t\t\t\t\tjQuery('.spbc-admin_bar--online_admins').html(result.users.join(', '));\r\n\t\t\t\t}else{\r\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').hide();\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tspbc_sendAJAXRequest( data, params );\r\n\t\t}, 15000 );\r\n\t};\r\n\r\n\tif( +spbcSettings.admin_bar__admins_online_counter === 1 ) {\r\n\t\trefresh_user_online_counter(null, {action: 'spbc_get_authorized_admins'}, {callback: refresh_user_online_counter});\r\n\t}\r\n\r\n\t// Dismiss admin banner\r\n\tjQuery('body').on('click', '.spbc-notice .notice-dismiss', function(e){\r\n\t\tvar bannerId = jQuery(e.target).parent('.notice').attr('id');\r\n\t\tif( bannerId ) {\r\n\t\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_dismiss_banner', 'banner_id' : bannerId }, { 'callback' : null } );\r\n\t\t}\r\n\t});\r\n\r\n\tif (+spbcSettings.needToWhitelist === 1) {\r\n\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_private_list_add' }, { 'callback' : null } );\r\n\t}\r\n});"],"names":["spbcGetGoogleQrCode","data","res","security","spbcSettings","ajax_nonce","action","jQuery","ajax","type","async","url","ajaxurl","success","result","spbcCheckGoogleCode","code","val","dialog","document","location","reload","alert","spbcDisableG2fa","element","user_id","ready","on","spbc_setCookie","e","preventDefault","spbcGoogleQrCode","html","img","modal","title","buttons","Cancel","this","Ok","draggable","resizable","confirm","refresh_user_online_counter","params","setTimeout","count","show","users","join","hide","spbc_sendAJAXRequest","admin_bar__admins_online_counter","callback","bannerId","target","parent","attr","banner_id","needToWhitelist"],"mappings":"AAAA,SAASA,sBACR,IAAIC,EAAO,GACPC,EAAM,GAaV,OAZAD,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,0BAEdC,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAAS,SAASC,GACjBZ,EAAMY,CACP,CACD,CAAC,EACMZ,CACR,CAEA,SAASa,sBACR,IAAId,EAAO,GACXA,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,yBACdL,EAAKe,KAAOT,OAAO,6BAA6B,EAAEU,IAAI,EAEtDV,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAAS,SAASC,GACdA,EAAOD,SACTN,OAAO,uBAAuB,EAAEW,OAAQ,OAAQ,EAChDC,SAASC,SAASC,OAAO,GAEzBC,MAAMR,EAAOb,IAAI,CAEnB,CACD,CAAC,CACF,CAEA,SAASsB,gBAAiBC,GACzB,IAAIvB,EAAO,GACXA,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,0BACXL,EAAKwB,QAAUlB,OAAOiB,CAAO,EAAEvB,KAAK,SAAS,EAEhDM,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAA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CACpC,EAAG,IAAM,CACV,CAEuD,GAAnD,CAACxC,aAAagD,kCACjBT,EAA4B,KAAM,CAACrC,OAAQ,4BAA4B,EAAG,CAAC+C,SAAUV,CAA2B,CAAC,EAIlHpC,OAAO,MAAM,EAAEoB,GAAG,QAAS,+BAAgC,SAASE,GAC/DyB,EAAW/C,OAAOsB,EAAE0B,MAAM,EAAEC,OAAO,SAAS,EAAEC,KAAK,IAAI,EACvDH,GACHH,qBAAsB,CAAE7C,OAAW,sBAAuBoD,UAAcJ,CAAS,EAAG,CAAED,SAAa,IAAK,CAAE,CAE5G,CAAC,EAEqC,GAAlC,CAACjD,aAAauD,iBACjBR,qBAAsB,CAAE7C,OAAW,uBAAwB,EAAG,CAAE+C,SAAa,IAAK,CAAE,CAEtF,CAAC"} \ No newline at end of file +{"version":3,"file":"spbc-admin.min.js","sources":["spbc-admin.js"],"sourcesContent":["function spbcGetGoogleQrCode() {\n\tvar data = {};\n\tvar res = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_get_google_qr_code';\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tres = result;\n\t\t},\n\t});\n\treturn res;\n}\n\nfunction spbcCheckGoogleCode() {\n\tvar data = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_check_google_code';\n\tdata.code = jQuery('#spbct-google-qr-code input').val();\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tjQuery('#spbct-google-qr-code').dialog( \"close\" );\n\t\t\t\tdocument.location.reload();\n\t\t\t} else {\n\t\t\t\talert(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\nfunction spbcDisableG2fa( element ) {\n\tvar data = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_disable_google_2fa';\n data.user_id = jQuery(element).data('user-id');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tdocument.location.reload();\n\t\t\t} else {\n\t\t\t\talert(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\njQuery(document).ready(function(){\n\t\n\t// Auto update banner close handler \n\tjQuery('.spbc_update_notice').on('click', 'button', function(){\n\t\tspbc_setCookie('spbc_update_banner_closed', 1, 86400 * 30);\n\t});\n\n\t// Enable G2FA from user profile page\n\tjQuery(document).on('click', '#spbc-g2fa-enable', function(e){\n\n\t\te.preventDefault();\n\t\tvar spbcGoogleQrCode = spbcGetGoogleQrCode();\n\n\t\tif( spbcGoogleQrCode.success ) {\n\t\t\tvar qr_code_div = jQuery('#spbct-google-qr-code-img');\n\t\t\tqr_code_div.html(spbcGoogleQrCode.data.img + '' + spbcGoogleQrCode.data.code + '
');\n\t\t\tjQuery('#spbct-google-qr-code input').val('');\n\t\t\tjQuery('#spbct-google-qr-code').dialog({\n\t\t\t\tmodal: true,\n\t\t\t\ttitle: 'Google authenticator activation',\n\t\t\t\tbuttons: {\n\t\t\t\t\tCancel: function() {\n\t\t\t\t\t\tjQuery( this ).dialog( \"close\" );\n\t\t\t\t\t},\n\t\t\t\t\tOk: function() {\n\t\t\t\t\t\tspbcCheckGoogleCode();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdraggable: false,\n\t\t\t\tresizable: false,\n\t\t\t});\n\t\t} else {\n\t\t\talert(spbcGetGoogleQrCode.data);\n\t\t}\n\n\t});\n\n\t// Disable G2FA from user profile page\n\tjQuery(document).on('click', '#spbc-g2fa-disable', function(e){\n\n\t\te.preventDefault();\n\t\tif( confirm( 'Are you sure?' ) ) {\n\t\t\tspbcDisableG2fa( this );\n\t\t}\n\n\t});\n\n\tvar refresh_user_online_counter = function( result, data, params ){\n\t\tsetTimeout(function () {\n\t\t\tif( result !== null ){\n\t\t\t\tjQuery('.spbc-admin_bar--user_counter').html(result.count);\n\t\t\t\tif( result.count <= 3 ) {\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').show();\n\t\t\t\t\tjQuery('.spbc-admin_bar--online_admins').html(result.users.join(', '));\n\t\t\t\t}else{\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').hide();\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tspbc_sendAJAXRequest( data, params );\n\t\t}, 15000 );\n\t};\n\n\tif( +spbcSettings.admin_bar__admins_online_counter === 1 ) {\n\t\trefresh_user_online_counter(null, {action: 'spbc_get_authorized_admins'}, {callback: refresh_user_online_counter});\n\t}\n\n\t// Dismiss admin banner\n\tjQuery('body').on('click', '.spbc-notice .notice-dismiss', function(e){\n\t\tvar bannerId = jQuery(e.target).parent('.notice').attr('id');\n\t\tif( bannerId ) {\n\t\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_dismiss_banner', 'banner_id' : bannerId }, { 'callback' : null } );\n\t\t}\n\t});\n\n\tif (+spbcSettings.needToWhitelist === 1) {\n\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_private_list_add' }, { 'callback' : null } );\n\t}\n});"],"names":["spbcGetGoogleQrCode","data","res","security","spbcSettings","ajax_nonce","action","jQuery","ajax","type","async","url","ajaxurl","success","result","spbcCheckGoogleCode","code","val","dialog","document","location","reload","alert","spbcDisableG2fa","element","user_id","ready","on","spbc_setCookie","e","preventDefault","spbcGoogleQrCode","html","img","modal","title","buttons","Cancel","this","Ok","draggable","resizable","confirm","refresh_user_online_counter","params","setTimeout","count","show","users","join","hide","spbc_sendAJAXRequest","admin_bar__admins_online_counter","callback","bannerId","target","parent","attr","banner_id","needToWhitelist"],"mappings":"AAAA,SAASA,sBACR,IAAIC,EAAO,GACPC,EAAM,GAaV,OAZAD,EA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7C,OAAW,uBAAwB,EAAG,CAAE+C,SAAa,IAAK,CAAE,CAEtF,CAAC"} \ No newline at end of file diff --git a/js/spbc-common.min.js.map b/js/spbc-common.min.js.map index e8dc83bd2..2c18e12d3 100644 --- a/js/spbc-common.min.js.map +++ b/js/spbc-common.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-common.min.js","sources":["spbc-common.js"],"sourcesContent":["function spbc_timestamp(){\r\n\treturn Math.floor(+new Date() / 1000);\r\n}\r\n\r\n// Hightlights element\r\nfunction spbcHighlightElement(id, times){\r\n\ttimes = times-1 || 0;\r\n\tjQuery(\"html, body\").animate({ scrollTop: jQuery(jQuery('#'+id)).offset().top - 100 }, \"slow\");\r\n\tjQuery('#'+id).addClass('spbc_highlighted');\r\n\tjQuery('#'+id).animate({outlineColor: \"rgba(255, 0, 0, 1.0)\" }, 400, 'linear', function(){\r\n\t\tjQuery('#'+id).animate({outlineColor: \"rgba(255, 0, 0, 0.0)\" }, 400, 'linear', function(){\r\n\t\t\tif(times>0){\r\n\t\t\t\tspbcHighlightElement(id, times);\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('#'+id).removeClass('spbc_highlighted');\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n}\r\n\r\nfunction spbc_sendAJAXRequest(data, params, obj){\r\n\r\n\tvar dataType = params.notJson ? 'text' : 'json';\r\n\r\n\t// Default params\r\n\tvar button = params.button || null;\r\n\tvar spinner = params.spinner || null;\r\n\tvar progressbar = params.progressbar || null;\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 context = params.context || this;\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.security = spbcSettings.ajax_nonce;\r\n\tdata.no_cache = Math.random();\r\n\r\n\t// Using passed successCallback() or default\r\n\tvar success = params.success || function(result){\r\n\t\tif(button){\r\n\t\t\tbutton.removeAttribute('disabled');\r\n\t\t\tbutton.style.cursor = 'pointer';\r\n\t\t}\r\n\r\n\t\tif(spinner) {\r\n\t\t\tjQuery(spinner).css('display', 'none');\r\n\t\t}\r\n\r\n\t\tif(!notJson && typeof result !== 'object'){\r\n\t\t\tresult = JSON.parse(result);\r\n\t\t}\r\n\r\n\t\tif(result.error){\r\n\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\r\n\t\t\tlet error_comment = typeof result.error_comment !== 'undefined' ? result.error_comment : null;\r\n\t\t\terrorOutput( result.error, error_comment );\r\n\t\t}else if(callback){\r\n\t\t\t\tcallback(result, data, params, obj);\r\n\t\t}\r\n\t};\r\n\r\n\t// Using passed successCallback() or default\r\n\tvar error = params.error || function(jqXHR, textStatus, errorThrown){\r\n\t\tif(button){\r\n\t\t\tbutton.removeAttribute('disabled');\r\n\t\t\tbutton.style.cursor = 'pointer';\r\n\t\t}\r\n\t\tif(spinner){\r\n\t\t\tjQuery(spinner).css('display', 'none');\r\n\t\t}\r\n\r\n\t\tconsole.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\r\n\t\tconsole.log( textStatus );\r\n\t\tconsole.log( errorThrown );\r\n\t\tconsole.log( jqXHR );\r\n\r\n\t\terrorOutput( textStatus );\r\n\t};\r\n\r\n\tvar errorOutput = params.errorOutput || function( msg ){};\r\n\r\n\tjQuery.ajax({\r\n\t\tcontext: context,\r\n\t\ttype: \"POST\",\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tdataType: dataType,\r\n\t\tsuccess: success,\r\n\t\terror: error,\r\n\t\ttimeout: timeout,\r\n\t});\r\n}"],"names":["spbc_timestamp","Math","floor","Date","spbcHighlightElement","id","times","jQuery","animate","scrollTop","offset","top","addClass","outlineColor","removeClass","spbc_sendAJAXRequest","data","params","obj","dataType","notJson","button","spinner","progressbar","callback","timeout","context","this","success","setAttribute","style","cursor","css","security","spbcSettings","ajax_nonce","no_cache","random","result","error_comment","removeAttribute","JSON","parse","error","setTimeout","fadeOut","errorOutput","jqXHR","textStatus","errorThrown","console","log","msg","ajax","type","url","ajaxurl"],"mappings":"AAAA,SAASA,iBACR,OAAOC,KAAKC,MAAM,CAAC,IAAIC,KAAS,GAAI,CACrC,CAGA,SAASC,qBAAqBC,EAAIC,GACjCA,EAAQA,EAAM,GAAK,EACnBC,OAAO,YAAY,EAAEC,QAAQ,CAAEC,UAAWF,OAAOA,OAAO,IAAIF,CAAE,CAAC,EAAEK,OAAO,EAAEC,IAAM,GAAI,EAAG,MAAM,EAC7FJ,OAAO,IAAIF,CAAE,EAAEO,SAAS,kBAAkB,EAC1CL,OAAO,IAAIF,CAAE,EAAEG,QAAQ,CAACK,aAAc,sBAAuB,EAAG,IAAK,SAAU,WAC9EN,OAAO,IAAIF,CAAE,EAAEG,QAAQ,CAACK,aAAc,sBAAuB,EAAG,IAAK,SAAU,WACrE,EAANP,EACFF,qBAAqBC,EAAIC,CAAK,EAE9BC,OAAO,IAAIF,CAAE,EAAES,YAAY,kBAAkB,CAE/C,CAAC,CACF,CAAC,CACF,CAEA,SAASC,qBAAqBC,EAAMC,EAAQC,GAE3C,IAAIC,EAAcF,EAAOG,QAAU,OAAS,OAGxCC,EAAcJ,EAAOI,QAAe,KACpCC,EAAcL,EAAOK,SAAe,KACpCC,EAAcN,EAAOM,aAAe,KACpCC,EAAcP,EAAOO,UAAe,KACpCJ,EAAcH,EAAOG,SAAe,KACpCK,EAAcR,EAAOQ,SAAe,KACpCP,EAAcA,GAAsB,KACpCQ,EAAcT,EAAOS,SAAeC,KAWpCC,GARDP,IAAUA,EAAOQ,aAAa,WAAY,UAAU,EAAGR,EAAOS,MAAMC,OAAS,eAC7ET,GAASf,OAAOe,CAAO,EAAEU,IAAI,UAAW,QAAQ,EAGnDhB,EAAKiB,SAAWC,aAAaC,WAC7BnB,EAAKoB,SAAWnC,KAAKoC,OAAO,EAGdpB,EAAOW,SAAW,SAASU,GAcxC,IAEKC,EAfFlB,IACFA,EAAOmB,gBAAgB,UAAU,EACjCnB,EAAOS,MAAMC,OAAS,WAGpBT,GACFf,OAAOe,CAAO,EAAEU,IAAI,UAAW,MAAM,GAIrCM,EADGlB,GAA6B,UAAlB,OAAOkB,EAInBA,EAHOG,KAAKC,MAAMJ,CAAM,GAGjBK,OACTC,WAAW,WAAerB,GAAaA,EAAYsB,QAAQ,MAAM,CAAG,EAAG,GAAI,EACvEN,EAAgD,KAAA,IAAzBD,EAAOC,cAAgCD,EAAOC,cAAgB,KACzFO,EAAaR,EAAOK,MAAOJ,CAAc,GACjCf,GACPA,EAASc,EAAQtB,EAAMC,EAAQC,CAAG,CAErC,GAGIyB,EAAQ1B,EAAO0B,OAAS,SAASI,EAAOC,EAAYC,GACpD5B,IACFA,EAAOmB,gBAAgB,UAAU,EACjCnB,EAAOS,MAAMC,OAAS,WAEpBT,GACFf,OAAOe,CAAO,EAAEU,IAAI,UAAW,MAAM,EAGtCkB,QAAQC,IAAK,sBAAuB,aAAc,EAClDD,QAAQC,IAAKH,CAAW,EACxBE,QAAQC,IAAKF,CAAY,EACzBC,QAAQC,IAAKJ,CAAM,EAEnBD,EAAaE,CAAW,CACzB,EAEIF,EAAc7B,EAAO6B,aAAe,SAAUM,KAElD7C,OAAO8C,KAAK,CACX3B,QAAUA,EACV4B,KAAU,OACVC,IAAUrB,aAAasB,QACvBxC,KAAUA,EACVG,SAAUA,EACVS,QAAUA,EACVe,MAAUA,EACVlB,QAAUA,CACX,CAAC,CACF"} \ No newline at end of file +{"version":3,"file":"spbc-common.min.js","sources":["spbc-common.js"],"sourcesContent":["function spbc_timestamp(){\n\treturn Math.floor(+new Date() / 1000);\n}\n\n// Hightlights element\nfunction spbcHighlightElement(id, times){\n\ttimes = times-1 || 0;\n\tjQuery(\"html, body\").animate({ scrollTop: jQuery(jQuery('#'+id)).offset().top - 100 }, \"slow\");\n\tjQuery('#'+id).addClass('spbc_highlighted');\n\tjQuery('#'+id).animate({outlineColor: \"rgba(255, 0, 0, 1.0)\" }, 400, 'linear', function(){\n\t\tjQuery('#'+id).animate({outlineColor: \"rgba(255, 0, 0, 0.0)\" }, 400, 'linear', function(){\n\t\t\tif(times>0){\n\t\t\t\tspbcHighlightElement(id, times);\n\t\t\t}else{\n\t\t\t\tjQuery('#'+id).removeClass('spbc_highlighted');\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction spbc_sendAJAXRequest(data, params, obj){\n\n\tvar dataType = params.notJson ? 'text' : 'json';\n\n\t// Default params\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\tvar callback = params.callback || null;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar context = params.context || this;\n\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\t// Adding security code\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.no_cache = Math.random();\n\n\t// Using passed successCallback() or default\n\tvar success = params.success || function(result){\n\t\tif(button){\n\t\t\tbutton.removeAttribute('disabled');\n\t\t\tbutton.style.cursor = 'pointer';\n\t\t}\n\n\t\tif(spinner) {\n\t\t\tjQuery(spinner).css('display', 'none');\n\t\t}\n\n\t\tif(!notJson && typeof result !== 'object'){\n\t\t\tresult = JSON.parse(result);\n\t\t}\n\n\t\tif(result.error){\n\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\tlet error_comment = typeof result.error_comment !== 'undefined' ? result.error_comment : null;\n\t\t\terrorOutput( result.error, error_comment );\n\t\t}else if(callback){\n\t\t\t\tcallback(result, data, params, obj);\n\t\t}\n\t};\n\n\t// Using passed successCallback() or default\n\tvar error = params.error || function(jqXHR, textStatus, errorThrown){\n\t\tif(button){\n\t\t\tbutton.removeAttribute('disabled');\n\t\t\tbutton.style.cursor = 'pointer';\n\t\t}\n\t\tif(spinner){\n\t\t\tjQuery(spinner).css('display', 'none');\n\t\t}\n\n\t\tconsole.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n\t\tconsole.log( textStatus );\n\t\tconsole.log( errorThrown );\n\t\tconsole.log( jqXHR );\n\n\t\terrorOutput( textStatus );\n\t};\n\n\tvar errorOutput = params.errorOutput || function( msg ){};\n\n\tjQuery.ajax({\n\t\tcontext: context,\n\t\ttype: \"POST\",\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tdataType: dataType,\n\t\tsuccess: success,\n\t\terror: error,\n\t\ttimeout: timeout,\n\t});\n}"],"names":["spbc_timestamp","Math","floor","Date","spbcHighlightElement","id","times","jQuery","animate","scrollTop","offset","top","addClass","outlineColor","removeClass","spbc_sendAJAXRequest","data","params","obj","dataType","notJson","button","spinner","progressbar","callback","timeout","context","this","success","setAttribute","style","cursor","css","security","spbcSettings","ajax_nonce","no_cache","random","result","error_comment","removeAttribute","JSON","parse","error","setTimeout","fadeOut","errorOutput","jqXHR","textStatus","errorThrown","console","log","msg","ajax","type","url","ajaxurl"],"mappings":"AAAA,SAASA,iBACR,OAAOC,KAAKC,MAAM,CAAC,IAAIC,KAAS,GAAI,CACrC,CAGA,SAASC,qBAAqBC,EAAIC,GACjCA,EAAQA,EAAM,GAAK,EACnBC,OAAO,YAAY,EAAEC,QAAQ,CAAEC,UAAWF,OAAOA,OAAO,IAAIF,CAAE,CAAC,EAAEK,OAAO,EAAEC,IAAM,GAAI,EAAG,MAAM,EAC7FJ,OAAO,IAAIF,CAAE,EAAEO,SAAS,kBAAkB,EAC1CL,OAAO,IAAIF,CAAE,EAAEG,QAAQ,CAACK,aAAc,sBAAuB,EAAG,IAAK,SAAU,WAC9EN,OAAO,IAAIF,CAAE,EAAEG,QAAQ,CAACK,aAAc,sBAAuB,EAAG,IAAK,SAAU,WACrE,EAANP,EACFF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AM,EAGtCkB,QAAQC,IAAK,sBAAuB,aAAc,EAClDD,QAAQC,IAAKH,CAAW,EACxBE,QAAQC,IAAKF,CAAY,EACzBC,QAAQC,IAAKJ,CAAM,EAEnBD,EAAaE,CAAW,CACzB,EAEIF,EAAc7B,EAAO6B,aAAe,SAAUM,KAElD7C,OAAO8C,KAAK,CACX3B,QAAUA,EACV4B,KAAU,OACVC,IAAUrB,aAAasB,QACvBxC,KAAUA,EACVG,SAAUA,EACVS,QAAUA,EACVe,MAAUA,EACVlB,QAAUA,CACX,CAAC,CACF"} \ No newline at end of file diff --git a/js/spbc-cookie.min.js.map b/js/spbc-cookie.min.js.map index 8065c4002..a8796bfe5 100644 --- a/js/spbc-cookie.min.js.map +++ b/js/spbc-cookie.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-cookie.min.js","sources":["spbc-cookie.js"],"sourcesContent":["function spbc_setCookie( cookies, value, expires ){\r\n\r\n if( typeof cookies === 'string' && ( typeof value === 'string' || typeof value === 'number' ) ){\r\n cookies = [ [ cookies, value, expires ] ];\r\n }\r\n\r\n // Cookies disabled\r\n if( +spbcPublic.data__set_cookies === 0 ){\r\n return;\r\n\r\n // Using traditional cookies\r\n }else if( +spbcPublic.data__set_cookies === 1 ){\r\n cookies.forEach( function (item, i, arr\t) {\r\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\r\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\r\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\r\n });\r\n\r\n // Using alternative cookies\r\n }else if( +spbcPublic.data__set_cookies === 2 ){\r\n\r\n // Using REST API handler\r\n if( +spbcPublic.data__set_cookies__alt_sessions_type === 1 ){\r\n spbc_sendRESTRequest(\r\n 'alt_sessions',\r\n {\r\n method: 'POST',\r\n data: { cookies: cookies }\r\n }\r\n );\r\n\r\n }\r\n // Using AJAX request and handler\r\n // }else if( +spbcPublic.data__set_cookies__alt_sessions_type === 2 ) {\r\n // apbct_public_sendAJAX(\r\n // {\r\n // action: 'apbct_alt_session__save__AJAX',\r\n // cookies: cookies,\r\n // },\r\n // {\r\n // apbct_ajax: 1,\r\n // notJson: 1,\r\n // }\r\n // );\r\n // }\r\n }\r\n}\r\n\r\nfunction spbc_sendRESTRequest( route, params ) {\r\n\r\n var callback = params.callback || null;\r\n var data = params.data || [];\r\n var method = params.method || 'POST';\r\n\r\n jQuery.ajax({\r\n type: method,\r\n url: spbcPublic._rest_url + 'cleantalk-security/v1/' + route,\r\n data: data,\r\n beforeSend : function ( xhr ) {\r\n xhr.setRequestHeader( 'X-WP-Nonce', spbcPublic._rest_nonce );\r\n },\r\n success: function(result){\r\n if(result.error){\r\n console.log('Security by Cleantalk. Error: ' + (result.error || 'Unknown'));\r\n }else{\r\n if(callback) {\r\n var obj = null;\r\n callback(result, route, params, obj);\r\n }\r\n }\r\n },\r\n error: function(jqXHR, textStatus, errorThrown){\r\n if( errorThrown ) {\r\n console.log('SPBCT_REST_ERROR');\r\n console.log(jqXHR);\r\n console.log(textStatus);\r\n console.log('Security by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/security-malware-firewall/');\r\n }\r\n },\r\n });\r\n\r\n}"],"names":["spbc_setCookie","cookies","value","expires","spbcPublic","data__set_cookies","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__set_cookies__alt_sessions_type","spbc_sendRESTRequest","method","data","route","params","callback","jQuery","ajax","type","url","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","success","result","error","console","log","jqXHR","textStatus","errorThrown"],"mappings":"AAAA,SAASA,eAAgBC,EAASC,EAAOC,GAEd,UAAnB,OAAOF,GAA2C,UAAjB,OAAOC,GAAuC,UAAjB,OAAOA,IACrED,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAII,GAAlC,CAACC,WAAWC,oBAI4B,GAAlC,CAACD,WAAWC,kBAClBJ,EAAQK,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIN,EAA6B,KAAA,IAAZI,EAAK,GAAqB,WAAaJ,EAAU,KAAO,GACzEO,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,EAAK,EAAE,EAAI,KAAOJ,EAAU,uBAAyBO,CAC9G,CAAC,EAGuC,GAAlC,CAACN,WAAWC,mBAGuC,GAArD,CAACD,WAAWY,sCACZC,qBACI,eACA,CACIC,OAAQ,OACRC,KAAM,CAAElB,QAASA,CAAQ,CAC7B,CACJ,EAiBZ,CAEA,SAASgB,qBAAsBG,EAAOC,GAElC,IAAIC,EAAWD,EAAOC,UAAY,KAC9BH,EAAWE,EAAOF,MAAQ,GAC1BD,EAAWG,EAAOH,QAAU,OAEhCK,OAAOC,KAAK,CACRC,KAAMP,EACNQ,IAAKtB,WAAWuB,UAAY,yBAA2BP,EACvDD,KAAMA,EACNS,WAAa,SAAWC,GACpBA,EAAIC,iBAAkB,aAAc1B,WAAW2B,WAAY,CAC/D,EACAC,QAAS,SAASC,GACXA,EAAOC,MACNC,QAAQC,IAAI,kCAAoCH,EAAOC,OAAS,UAAU,EAEvEZ,GAECA,EAASW,EAAQb,EAAOC,EADd,IACyB,CAG/C,EACAa,MAAO,SAASG,EAAOC,EAAYC,GAC3BA,IACAJ,QAAQC,IAAI,kBAAkB,EAC9BD,QAAQC,IAAIC,CAAK,EACjBF,QAAQC,IAAIE,CAAU,EACtBH,QAAQC,IAAI,gDAAkDG,EAAc,yGAAyG,EAE7L,CACJ,CAAC,CAEL"} \ No newline at end of file +{"version":3,"file":"spbc-cookie.min.js","sources":["spbc-cookie.js"],"sourcesContent":["function spbc_setCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && ( typeof value === 'string' || typeof value === 'number' ) ){\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( +spbcPublic.data__set_cookies === 0 ){\n return;\n\n // Using traditional cookies\n }else if( +spbcPublic.data__set_cookies === 1 ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( +spbcPublic.data__set_cookies === 2 ){\n\n // Using REST API handler\n if( +spbcPublic.data__set_cookies__alt_sessions_type === 1 ){\n spbc_sendRESTRequest(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n }\n // Using AJAX request and handler\n // }else if( +spbcPublic.data__set_cookies__alt_sessions_type === 2 ) {\n // apbct_public_sendAJAX(\n // {\n // action: 'apbct_alt_session__save__AJAX',\n // cookies: cookies,\n // },\n // {\n // apbct_ajax: 1,\n // notJson: 1,\n // }\n // );\n // }\n }\n}\n\nfunction spbc_sendRESTRequest( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: spbcPublic._rest_url + 'cleantalk-security/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', spbcPublic._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Security by Cleantalk. Error: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('SPBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Security by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/security-malware-firewall/');\n }\n },\n });\n\n}"],"names":["spbc_setCookie","cookies","value","expires","spbcPublic","data__set_cookies","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__set_cookies__alt_sessions_type","spbc_sendRESTRequest","method","data","route","params","callback","jQuery","ajax","type","url","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","success","result","error","console","log","jqXHR","textStatus","errorThrown"],"mappings":"AAAA,SAASA,eAAgBC,EAASC,EAAOC,GAEd,UAAnB,OAAOF,GAA2C,UAAjB,OAAOC,GAAuC,UAAjB,OAAOA,IACrED,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAII,GAAlC,CAACC,WAAWC,oBAI4B,GAAlC,CAACD,WAAWC,kBAClBJ,EAAQK,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIN,EAA6B,KAAA,IAAZI,EAAK,GAAqB,WAAaJ,EAAU,KAAO,GACzEO,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,EAAK,EAAE,EAAI,KAAOJ,EAAU,uBAAyBO,CAC9G,CAAC,EAGuC,GAAlC,CAACN,WAAWC,mBAGuC,GAArD,CAACD,WAAWY,sCACZC,qBACI,eACA,CACIC,OAAQ,OACRC,KAAM,CAAElB,QAASA,CAAQ,CAC7B,CACJ,EAiBZ,CAEA,SAASgB,qBAAsBG,EAAOC,GAElC,IAAIC,EAAWD,EAAOC,UAAY,KAC9BH,EAAWE,EAAOF,MAAQ,GAC1BD,EAAWG,EAAOH,QAAU,OAEhCK,OAAOC,KAAK,CACRC,KAAMP,EACNQ,IAAKtB,WAAWuB,UAAY,yBAA2BP,EACvDD,KAAMA,EACNS,WAAa,SAAWC,GACpBA,EAAIC,iBAAkB,aAAc1B,WAAW2B,WAAY,CAC/D,EACAC,QAAS,SAASC,GACXA,EAAOC,MACNC,QAAQC,IAAI,kCAAoCH,EAAOC,OAAS,UAAU,EAEvEZ,GAECA,EAASW,EAAQb,EAAOC,EADd,IACyB,CAG/C,EACAa,MAAO,SAASG,EAAOC,EAAYC,GAC3BA,IACAJ,QAAQC,IAAI,kBAAkB,EAC9BD,QAAQC,IAAIC,CAAK,EACjBF,QAAQC,IAAIE,CAAU,EACtBH,QAAQC,IAAI,gDAAkDG,EAAc,yGAAyG,EAE7L,CACJ,CAAC,CAEL"} \ No newline at end of file diff --git a/js/spbc-dashboard-widget.min.js.map b/js/spbc-dashboard-widget.min.js.map index 199eb6815..313dfb739 100644 --- a/js/spbc-dashboard-widget.min.js.map +++ b/js/spbc-dashboard-widget.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-dashboard-widget.min.js","sources":["spbc-dashboard-widget.js"],"sourcesContent":["jQuery(document).ready(function(){\r\n\r\n\t// Set \"refresh\" link handler\r\n\tjQuery(\".spbc_widget_refresh_link\").on('click', function(){\r\n\t\tjQuery('.spbc_preloader').show();\r\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#spbc_widget_wrapper').offset().top - 130);}, 1);\r\n\t\tsetTimeout(function(){jQuery(\"#spbc_refresh_form\").submit();}, 2500);\r\n\t});\r\n\r\n\tif(location.hash == '#ct_widget')\r\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#spbc_widget_wrapper').offset().top - 130);}, 1);\r\n\r\n\t// Fixing default wrapper style\r\n\tjQuery(\"#spbc_widget_wrapper\").parent().css('padding', 0);\r\n\r\n\tlocale = navigator.language || navigator.userLanguage;\r\n\r\n\tvar date_formatter = new Intl.DateTimeFormat(locale, {\r\n\t\tmonth: \"short\",\r\n\t\tday: \"numeric\"\r\n\t});\r\n\r\n\tfunction reformatWidgetData(spbcDashboardWidget){\r\n\t\tlet widgetData = {'labels':[],'counts':[]}\r\n\t\tfor (let i = 0; i < spbcDashboardWidget.length; i++) {\r\n\t\t\twidgetData.labels.push(date_formatter.format(new Date(spbcDashboardWidget[i]['0'])))\r\n\t\t\twidgetData.counts.push(spbcDashboardWidget[i]['1'])\r\n\t\t}\r\n\t\treturn widgetData\r\n\t}\r\n\r\n\tconst ctx = document.getElementById('spbc_widget_chart')\r\n\t//let widgetData = reformatWidgetData(spbcDashboardWidget['data'])\r\n\tlet widgetDataFW = reformatWidgetData(spbcDashboardWidget['data_fw'])\r\n\tlet widgetDataBFP = reformatWidgetData(spbcDashboardWidget['data_bfp'])\r\n\r\n\tnew Chart(ctx, {\r\n\t\ttype: 'bar',\r\n\t\tdata: {\r\n\t\t\tlabels: widgetDataFW.labels,\r\n\t\t\tdatasets: [\r\n\t\t\t\t{\r\n\t\t\t\t\tlabel: 'Visitors blocked by Bruteforce Protection',\r\n\t\t\t\t\tdata: widgetDataBFP.counts,\r\n\t\t\t\t\tborderWidth: 1,\r\n\t\t\t\t\tbackgroundColor: 'gray'\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tlabel: 'Visitors blocked by Firewall',\r\n\t\t\t\t\tdata: widgetDataFW.counts,\r\n\t\t\t\t\tborderWidth: 1,\r\n\t\t\t\t\tbackgroundColor: 'steelblue'\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t\t},\r\n\t\toptions: {\r\n\t\t\tlegend: {\r\n\t\t\t\tdisplay: false\r\n\t\t\t},\r\n\t\t\tmaintainAspectRatio: false,\r\n\t\t\tresponsive: true,\r\n\t\t\tscales: {\r\n\t\t\t\ty: {\r\n\t\t\t\t\tticks: {\r\n\t\t\t\t\t\tprecision: 0\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\ttitle: {\r\n\t\t\t\tdisplay: true,\r\n\t\t\t\ttext: 'Blocked attacks',\r\n\t\t\t\tfontSize: 18\r\n\t\t\t},\r\n\t\t\tplugins: {\r\n\t\t\t\tlegend: {\r\n\t\t\t\t\tdisplay: false\r\n\t\t\t\t},\r\n\t\t\t\ttitle: {\r\n\t\t\t\t\tdisplay: true,\r\n\t\t\t\t\ttext: 'Blocked attacks',\r\n\t\t\t\t\tfont: {\r\n\t\t\t\t\t\tsize: 18,\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\telements: {\r\n\t\t\t\tbar:{\r\n\t\t\t\t\tbackgroundColor: 'steelblue'\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tanimations: {\r\n\t\t\t\ttension: {\r\n\t\t\t\t\tduration: 1000,\r\n\t\t\t\t\teasing: 'linear',\r\n\t\t\t\t\tfrom: 1,\r\n\t\t\t\t\tto: 0,\r\n\t\t\t\t\tloop: true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t}\r\n\t});\r\n\r\n});\r\n"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","locale","navigator","language","userLanguage","date_formatter","Intl","DateTimeFormat","month","day","reformatWidgetData","spbcDashboardWidget","let","widgetData","labels","counts","i","length","push","format","Date","ctx","getElementById","widgetDataFW","widgetDataBFP","Chart","type","data","datasets","label","borderWidth","backgroundColor","options","legend","display","maintainAspectRatio","responsive","scales","y","ticks","precision","title","text","fontSize","plugins","font","size","elements","bar","animations","tension","duration","easing","from","to","loop"],"mappings":"AAAAA,OAAOC,QAAQ,EAAEC,MAAM,WAGtBF,OAAO,2BAA2B,EAAEG,GAAG,QAAS,WAC/CH,OAAO,iBAAiB,EAAEI,KAAK,EAC/BC,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsB,EAAEQ,OAAO,EAAEC,IAAM,GAAG,CAAE,EAAG,CAAC,EAChGJ,WAAW,WAAWL,OAAO,oBAAoB,EAAEU,OAAO,CAAE,EAAG,IAAI,CACpE,CAAC,EAEmB,cAAjBC,SAASC,MACXP,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsB,EAAEQ,OAAO,EAAEC,IAAM,GAAG,CAAE,EAAG,CAAC,EAGjGT,OAAO,sBAAsB,EAAEa,OAAO,EAAEC,IAAI,UAAW,CAAC,EAExDC,OAASC,UAAUC,UAAYD,UAAUE,aAEzC,IAAIC,EAAiB,IAAIC,KAAKC,eAAeN,OAAQ,CACpDO,MAAO,QACPC,IAAK,SACN,CAAC,EAED,SAASC,EAAmBC,GAC3BC,IAAIC,EAAa,CAACC,OAAS,GAAGC,OAAS,EAAE,EACzC,IAAKH,IAAII,EAAI,EAAGA,EAAIL,EAAoBM,OAAQD,CAAC,GAChDH,EAAWC,OAAOI,KAAKb,EAAec,OAAO,IAAIC,KAAKT,EAAoBK,GAAG,EAAI,CAAC,CAAC,EACnFH,EAAWE,OAAOG,KAAKP,EAAoBK,GAAG,EAAI,EAEnD,OAAOH,CACR,CAEA,IAAMQ,EAAMlC,SAASmC,eAAe,mBAAmB,EAEnDC,EAAeb,EAAmBC,oBAA6B,OAAC,EAChEa,EAAgBd,EAAmBC,oBAA8B,QAAC,EAEtE,IAAIc,MAAMJ,EAAK,CACdK,KAAM,MACNC,KAAM,CACLb,OAAQS,EAAaT,OACrBc,SAAU,CACT,CACCC,MAAO,4CACPF,KAAMH,EAAcT,OACpBe,YAAa,EACbC,gBAAiB,MAClB,EACA,CACCF,MAAO,+BACPF,KAAMJ,EAAaR,OACnBe,YAAa,EACbC,gBAAiB,WAClB,EAEF,EACAC,QAAS,CACRC,OAAQ,CACPC,QAAS,CAAA,CACV,EACAC,oBAAqB,CAAA,EACrBC,WAAY,CAAA,EACZC,OAAQ,CACPC,EAAG,CACFC,MAAO,CACNC,UAAW,CACZ,CACD,CACD,EACAC,MAAO,CACNP,QAAS,CAAA,EACTQ,KAAM,kBACNC,SAAU,EACX,EACAC,QAAS,CACRX,OAAQ,CACPC,QAAS,CAAA,CACV,EACAO,MAAO,CACNP,QAAS,CAAA,EACTQ,KAAM,kBACNG,KAAM,CACLC,KAAM,EACP,CACD,CACD,EACAC,SAAU,CACTC,IAAI,CACHjB,gBAAiB,WAClB,CACD,EACAkB,WAAY,CACXC,QAAS,CACRC,SAAU,IACVC,OAAQ,SACRC,KAAM,EACNC,GAAI,EACJC,KAAM,CAAA,CACP,CACD,CAED,CACD,CAAC,CAEF,CAAC"} \ No newline at end of file +{"version":3,"file":"spbc-dashboard-widget.min.js","sources":["spbc-dashboard-widget.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Set \"refresh\" link handler\n\tjQuery(\".spbc_widget_refresh_link\").on('click', function(){\n\t\tjQuery('.spbc_preloader').show();\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#spbc_widget_wrapper').offset().top - 130);}, 1);\n\t\tsetTimeout(function(){jQuery(\"#spbc_refresh_form\").submit();}, 2500);\n\t});\n\n\tif(location.hash == '#ct_widget')\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#spbc_widget_wrapper').offset().top - 130);}, 1);\n\n\t// Fixing default wrapper style\n\tjQuery(\"#spbc_widget_wrapper\").parent().css('padding', 0);\n\n\tlocale = navigator.language || navigator.userLanguage;\n\n\tvar date_formatter = new Intl.DateTimeFormat(locale, {\n\t\tmonth: \"short\",\n\t\tday: \"numeric\"\n\t});\n\n\tfunction reformatWidgetData(spbcDashboardWidget){\n\t\tlet widgetData = {'labels':[],'counts':[]}\n\t\tfor (let i = 0; i < spbcDashboardWidget.length; i++) {\n\t\t\twidgetData.labels.push(date_formatter.format(new Date(spbcDashboardWidget[i]['0'])))\n\t\t\twidgetData.counts.push(spbcDashboardWidget[i]['1'])\n\t\t}\n\t\treturn widgetData\n\t}\n\n\tconst ctx = document.getElementById('spbc_widget_chart')\n\t//let widgetData = reformatWidgetData(spbcDashboardWidget['data'])\n\tlet widgetDataFW = reformatWidgetData(spbcDashboardWidget['data_fw'])\n\tlet widgetDataBFP = reformatWidgetData(spbcDashboardWidget['data_bfp'])\n\n\tnew Chart(ctx, {\n\t\ttype: 'bar',\n\t\tdata: {\n\t\t\tlabels: widgetDataFW.labels,\n\t\t\tdatasets: [\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Visitors blocked by Bruteforce Protection',\n\t\t\t\t\tdata: widgetDataBFP.counts,\n\t\t\t\t\tborderWidth: 1,\n\t\t\t\t\tbackgroundColor: 'gray'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Visitors blocked by Firewall',\n\t\t\t\t\tdata: widgetDataFW.counts,\n\t\t\t\t\tborderWidth: 1,\n\t\t\t\t\tbackgroundColor: 'steelblue'\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\toptions: {\n\t\t\tlegend: {\n\t\t\t\tdisplay: false\n\t\t\t},\n\t\t\tmaintainAspectRatio: false,\n\t\t\tresponsive: true,\n\t\t\tscales: {\n\t\t\t\ty: {\n\t\t\t\t\tticks: {\n\t\t\t\t\t\tprecision: 0\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\ttitle: {\n\t\t\t\tdisplay: true,\n\t\t\t\ttext: 'Blocked attacks',\n\t\t\t\tfontSize: 18\n\t\t\t},\n\t\t\tplugins: {\n\t\t\t\tlegend: {\n\t\t\t\t\tdisplay: false\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\tdisplay: true,\n\t\t\t\t\ttext: 'Blocked attacks',\n\t\t\t\t\tfont: {\n\t\t\t\t\t\tsize: 18,\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\telements: {\n\t\t\t\tbar:{\n\t\t\t\t\tbackgroundColor: 'steelblue'\n\t\t\t\t}\n\t\t\t},\n\t\t\tanimations: {\n\t\t\t\ttension: {\n\t\t\t\t\tduration: 1000,\n\t\t\t\t\teasing: 'linear',\n\t\t\t\t\tfrom: 1,\n\t\t\t\t\tto: 0,\n\t\t\t\t\tloop: true\n\t\t\t\t}\n\t\t\t},\n\n\t\t}\n\t});\n\n});\n"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","locale","navigator","language","userLanguage","date_formatter","Intl","DateTimeFormat","month","day","reformatWidgetData","spbcDashboardWidget","let","widgetData","labels","counts","i","length","push","format","Date","ctx","getElementById","widgetDataFW","widgetDataBFP","Chart","type","data","datasets","label","borderWidth","backgroundColor","options","legend","display","maintainAspectRatio","responsive","scales","y","ticks","precision","title","text","fontSize","plugins","font","size","elements","bar","animations","tension","duration","easing","from","to","loop"],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Be,YAAa,EACbC,gBAAiB,WAClB,EAEF,EACAC,QAAS,CACRC,OAAQ,CACPC,QAAS,CAAA,CACV,EACAC,oBAAqB,CAAA,EACrBC,WAAY,CAAA,EACZC,OAAQ,CACPC,EAAG,CACFC,MAAO,CACNC,UAAW,CACZ,CACD,CACD,EACAC,MAAO,CACNP,QAAS,CAAA,EACTQ,KAAM,kBACNC,SAAU,EACX,EACAC,QAAS,CACRX,OAAQ,CACPC,QAAS,CAAA,CACV,EACAO,MAAO,CACNP,QAAS,CAAA,EACTQ,KAAM,kBACNG,KAAM,CACLC,KAAM,EACP,CACD,CACD,EACAC,SAAU,CACTC,IAAI,CACHjB,gBAAiB,WAClB,CACD,EACAkB,WAAY,CACXC,QAAS,CACRC,SAAU,IACVC,OAAQ,SACRC,KAAM,EACNC,GAAI,EACJC,KAAM,CAAA,CACP,CACD,CAED,CACD,CAAC,CAEF,CAAC"} \ No newline at end of file diff --git a/js/spbc-modal.min.js.map b/js/spbc-modal.min.js.map index e4f811fc8..6ee61daa4 100644 --- a/js/spbc-modal.min.js.map +++ b/js/spbc-modal.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-modal.min.js","sources":["spbc-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\r\nspbcModal = {\r\n\r\n // Flags\r\n loaded: false,\r\n loading: false,\r\n opened: false,\r\n opening: false,\r\n\r\n // Methods\r\n load: function( action ) {\r\n if( ! this.loaded ) {\r\n this.loading = true;\r\n callback = function( result, data, params, obj ) {\r\n spbcModal.loading = false;\r\n spbcModal.loaded = result;\r\n document.dispatchEvent(\r\n new CustomEvent( \"spbcModalContentLoaded\", {\r\n bubbles: true,\r\n } )\r\n );\r\n };\r\n if( typeof spbc_sendAJAXRequest === \"function\" ) {\r\n spbc_sendAJAXRequest( { 'action' : action }, { 'callback': callback, 'notJson': true } );\r\n }\r\n\r\n }\r\n },\r\n\r\n putError: function( errorText ){\r\n var html = '' + errorText + '
'\r\n + 'Contact tech support';\r\n this.put(html);\r\n },\r\n\r\n put: function ( html ) {\r\n spbcModal.loading = false;\r\n spbcModal.loaded = html;\r\n document.dispatchEvent(\r\n new CustomEvent( \"spbcModalContentLoaded\", {\r\n bubbles: true,\r\n } )\r\n );\r\n },\r\n\r\n open: function () {\r\n /* Cleantalk Modal CSS start */\r\n var renderCss = function () {\r\n var cssStr = '';\r\n for ( key in this.styles ) {\r\n cssStr += key + ':' + this.styles[key] + ';';\r\n }\r\n return cssStr;\r\n };\r\n var overlayCss = {\r\n styles: {\r\n \"z-index\": \"9999\",\r\n \"position\": \"fixed\",\r\n \"top\": \"0\",\r\n \"left\": \"0\",\r\n \"width\": \"100%\",\r\n \"height\": \"100%\",\r\n \"background\": \"rgba(0,0,0,0.5)\",\r\n \"display\": \"flex\",\r\n \"justify-content\" : \"center\",\r\n \"align-items\" : \"center\",\r\n },\r\n toString: renderCss\r\n };\r\n var innerCss = {\r\n styles: {\r\n \"position\" : \"relative\",\r\n \"padding\" : \"20px\",\r\n \"max-width\" : \"550px\",\r\n \"max-height\" : \"500px\",\r\n \"background\" : \"#FFF\",\r\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\r\n \"border-radius\" : \"4px\",\r\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\r\n },\r\n toString: renderCss\r\n };\r\n var closeCss = {\r\n styles: {\r\n \"position\" : \"absolute\",\r\n \"background\" : \"#FFF\",\r\n \"width\" : \"20px\",\r\n \"height\" : \"20px\",\r\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\r\n \"border-radius\" : \"15px\",\r\n \"cursor\" : \"pointer\",\r\n \"top\" : \"-8px\",\r\n \"right\" : \"-8px\",\r\n },\r\n toString: renderCss\r\n };\r\n var closeCssBefore = {\r\n styles: {\r\n \"content\" : \"\\\"\\\"\",\r\n \"display\" : \"block\",\r\n \"position\" : \"absolute\",\r\n \"background\" : \"#000\",\r\n \"border-radius\" : \"1px\",\r\n \"width\" : \"2px\",\r\n \"height\" : \"16px\",\r\n \"top\" : \"2px\",\r\n \"left\" : \"9px\",\r\n \"transform\" : \"rotate(45deg)\",\r\n },\r\n toString: renderCss\r\n };\r\n var closeCssAfter = {\r\n styles: {\r\n \"content\" : \"\\\"\\\"\",\r\n \"display\" : \"block\",\r\n \"position\" : \"absolute\",\r\n \"background\" : \"#000\",\r\n \"border-radius\" : \"1px\",\r\n \"width\" : \"2px\",\r\n \"height\" : \"16px\",\r\n \"top\" : \"2px\",\r\n \"left\" : \"9px\",\r\n \"transform\" : \"rotate(-45deg)\",\r\n },\r\n toString: renderCss\r\n };\r\n var contentCss = {\r\n styles: {\r\n \"overflow-y\": \"auto\",\r\n \"max-height\": \"460px\",\r\n \"overflow-x\": \"hidden\",\r\n },\r\n toString: renderCss\r\n };\r\n var bodyCss = {\r\n styles: {\r\n \"overflow\" : \"hidden\",\r\n },\r\n toString: renderCss\r\n };\r\n var spbcModalStyle = document.createElement( 'style' );\r\n spbcModalStyle.setAttribute( 'id', 'spbc-modal-styles' );\r\n spbcModalStyle.innerHTML = 'body.spbc-modal-opened{' + bodyCss + '}';\r\n spbcModalStyle.innerHTML += '#spbc-modal-overlay{' + overlayCss + '}';\r\n spbcModalStyle.innerHTML += '#spbc-modal-close{' + closeCss + '}';\r\n spbcModalStyle.innerHTML += '#spbc-modal-close:before{' + closeCssBefore + '}';\r\n spbcModalStyle.innerHTML += '#spbc-modal-close:after{' + closeCssAfter + '}';\r\n spbcModalStyle.innerHTML += '#spbc-modal-content{' + contentCss + '}';\r\n document.body.append( spbcModalStyle );\r\n /* Cleantalk Modal CSS end */\r\n\r\n var overlay = document.createElement( 'div' );\r\n overlay.setAttribute( 'id', 'spbc-modal-overlay' );\r\n document.body.append( overlay );\r\n\r\n document.body.classList.add( 'spbc-modal-opened' );\r\n\r\n var inner = document.createElement( 'div' );\r\n inner.setAttribute( 'id', 'spbc-modal-inner' );\r\n inner.setAttribute( 'style', innerCss );\r\n overlay.append( inner );\r\n\r\n var close = document.createElement( 'div' );\r\n close.setAttribute( 'id', 'spbc-modal-close' );\r\n inner.append( close );\r\n\r\n var content = document.createElement( 'div' );\r\n if ( this.loaded ) {\r\n content.innerHTML = this.loaded;\r\n } else {\r\n content.innerHTML = 'Loading...';\r\n }\r\n content.setAttribute( 'id', 'spbc-modal-content' );\r\n inner.append( content );\r\n\r\n this.opened = true;\r\n\r\n return this;\r\n },\r\n\r\n close: function () {\r\n spbcModal.loaded = '';\r\n spbcModal.loading = false;\r\n document.body.classList.remove( 'spbc-modal-opened' );\r\n document.getElementById( 'spbc-modal-overlay' ).remove();\r\n document.getElementById( 'spbc-modal-styles' ).remove();\r\n document.dispatchEvent(\r\n new CustomEvent( \"spbcModalClosed\", {\r\n bubbles: true,\r\n } )\r\n );\r\n }\r\n\r\n};\r\n\r\n/* Cleantalk Modal helpers */\r\ndocument.addEventListener('click',function( e ){\r\n if( e.target && e.target.id === 'spbc-modal-overlay' || e.target.id === 'spbc-modal-close' ){\r\n spbcModal.close();\r\n }\r\n});\r\ndocument.addEventListener(\"spbcModalContentLoaded\", function( e ) {\r\n if( spbcModal.opened && spbcModal.loaded ) {\r\n document.getElementById( 'spbc-modal-content' ).innerHTML = spbcModal.loaded;\r\n }\r\n});"],"names":["spbcModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","spbc_sendAJAXRequest","notJson","putError","errorText","put","html","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","max-width","max-height","border","border-radius","box-shadow","closeCss","cursor","right","closeCssBefore","content","transform","closeCssAfter","contentCss","overflow-y","overflow-x","bodyCss","overflow","spbcModalStyle","createElement","overlay","setAttribute","innerHTML","body","append","inner","classList","add","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"AACAA,UAAY,CAGRC,OAAQ,CAAA,EACRC,QAAS,CAAA,EACTC,OAAQ,CAAA,EACRC,QAAS,CAAA,EAGTC,KAAM,SAAUC,GACNC,K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M,GAW5C,OAVKrD,KAAKN,OACNkD,EAAQY,UAAYxD,KAAKN,OAEzBkD,EAAQY,UAAY,aAExBZ,EAAQW,aAAc,KAAM,oBAAqB,EACjDI,EAAMD,OAAQd,CAAQ,EAEtB5C,KAAKJ,OAAS,CAAA,EAEPI,IACX,EAEA8D,MAAO,WACHrE,UAAUC,OAAS,GACnBD,UAAUE,QAAU,CAAA,EACpBW,SAASmD,KAAKG,UAAUG,OAAQ,mBAAoB,EACpDzD,SAAS0D,eAAgB,oBAAqB,EAAED,OAAO,EACvDzD,SAAS0D,eAAgB,mBAAoB,EAAED,OAAO,EACtDzD,SAASC,cACL,IAAIC,YAAa,kBAAmB,CAChCC,QAAS,CAAA,CACb,CAAE,CACN,CACJ,CAEJ,EAGAH,SAAS2D,iBAAiB,QAAQ,SAAUC,IACpCA,EAAEC,QAA0B,uBAAhBD,EAAEC,OAAOC,IAA+C,qBAAhBF,EAAEC,OAAOC,KAC7D3E,UAAUqE,MAAM,CAExB,CAAC,EACDxD,SAAS2D,iBAAiB,yBAA0B,SAAUC,GACtDzE,UAAUG,QAAUH,UAAUC,SAC9BY,SAAS0D,eAAgB,oBAAqB,EAAER,UAAY/D,UAAUC,OAE9E,CAAC"} \ No newline at end of file +{"version":3,"file":"spbc-modal.min.js","sources":["spbc-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\nspbcModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n spbcModal.loading = false;\n spbcModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"spbcModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof spbc_sendAJAXRequest === \"function\" ) {\n spbc_sendAJAXRequest( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n putError: function( errorText ){\n var html = '' + errorText + '
'\n + 'Contact tech support';\n this.put(html);\n },\n\n put: function ( html ) {\n spbcModal.loading = false;\n spbcModal.loaded = html;\n document.dispatchEvent(\n new CustomEvent( \"spbcModalContentLoaded\", {\n bubbles: true,\n } )\n );\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"20px\",\n \"max-width\" : \"550px\",\n \"max-height\" : \"500px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var contentCss = {\n styles: {\n \"overflow-y\": \"auto\",\n \"max-height\": \"460px\",\n \"overflow-x\": \"hidden\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var spbcModalStyle = document.createElement( 'style' );\n spbcModalStyle.setAttribute( 'id', 'spbc-modal-styles' );\n spbcModalStyle.innerHTML = 'body.spbc-modal-opened{' + bodyCss + '}';\n spbcModalStyle.innerHTML += '#spbc-modal-overlay{' + overlayCss + '}';\n spbcModalStyle.innerHTML += '#spbc-modal-close{' + closeCss + '}';\n spbcModalStyle.innerHTML += '#spbc-modal-close:before{' + closeCssBefore + '}';\n spbcModalStyle.innerHTML += '#spbc-modal-close:after{' + closeCssAfter + '}';\n spbcModalStyle.innerHTML += '#spbc-modal-content{' + contentCss + '}';\n document.body.append( spbcModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'spbc-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'spbc-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'spbc-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'spbc-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n }\n content.setAttribute( 'id', 'spbc-modal-content' );\n inner.append( content );\n\n this.opened = true;\n\n return this;\n },\n\n close: function () {\n spbcModal.loaded = '';\n spbcModal.loading = false;\n document.body.classList.remove( 'spbc-modal-opened' );\n document.getElementById( 'spbc-modal-overlay' ).remove();\n document.getElementById( 'spbc-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"spbcModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'spbc-modal-overlay' || e.target.id === 'spbc-modal-close' ){\n spbcModal.close();\n }\n});\ndocument.addEventListener(\"spbcModalContentLoaded\", function( e ) {\n if( spbcModal.opened && spbcModal.loaded ) {\n document.getElementById( 'spbc-modal-content' ).innerHTML = spbcModal.loaded;\n }\n});"],"names":["spbcModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","spbc_sendAJAXRequest","notJson","putError","errorText","put","html","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","max-width","max-height","border","border-radius","box-shadow","closeCss","cursor","right","closeCssBefore","content","transform","closeCssAfter","contentCss","overflow-y","overflow-x","bodyCss","overflow","spbcModalStyle","createElement","overlay","setAttribute","innerHTML","body","append","inner","classList","add","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"AACAA,UAAY,CAGRC,OAAQ,CAAA,EACRC,QAAS,CAAA,EACTC,OAAQ,CAAA,EACRC,QAAS,CAAA,EAGTC,KAAM,SAAUC,GACNC,KAAKN,SACPM,KAAKL,QAAU,CAAA,EACfM,SAAW,SAAUC,EAAQC,EAAMC,EAAQC,GACvCZ,UAAUE,QAAU,CAAA,EACpBF,UAAUC,OAASQ,EACnBI,SAASC,cACL,IAAIC,YAAa,yBAA0B,CACvCC,QAAS,CAAA,CACb,CAAE,CACN,CACJ,EACoC,YAAhC,OAAOC,sBACPA,qBAAsB,CAAEX,OAAWA,CAAO,EAAG,CAAEE,SAAYA,SAAUU,QAAW,CAAA,CAAK,CAAE,EAInG,EAEAC,SAAU,SAAUC,GAIhBb,KAAKc,IAHM,iCACGD,EACR,mKACO,CACjB,EAEAC,IAAK,SAAWC,GACZtB,UAAUE,QAAU,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ChCC,QAAS,CAAA,CACb,CAAE,CACN,CACJ,CAEJ,EAGAH,SAAS2D,iBAAiB,QAAQ,SAAUC,IACpCA,EAAEC,QAA0B,uBAAhBD,EAAEC,OAAOC,IAA+C,qBAAhBF,EAAEC,OAAOC,KAC7D3E,UAAUqE,MAAM,CAExB,CAAC,EACDxD,SAAS2D,iBAAiB,yBAA0B,SAAUC,GACtDzE,UAAUG,QAAUH,UAAUC,SAC9BY,SAAS0D,eAAgB,oBAAqB,EAAER,UAAY/D,UAAUC,OAE9E,CAAC"} \ No newline at end of file diff --git a/js/spbc-scanner-plugin.min.js.map b/js/spbc-scanner-plugin.min.js.map index fdf718653..1b349cdef 100644 --- a/js/spbc-scanner-plugin.min.js.map +++ b/js/spbc-scanner-plugin.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-scanner-plugin.min.js","sources":["spbc-scanner-plugin.js"],"sourcesContent":["'use strict';\r\n\r\nclass spbcMalwareScanner{\r\n\r\n\tfirst_start = true;\r\n\r\n\tactive = false;\r\n\r\n\troot = '';\r\n\tsettings = [];\r\n\tstates = [\r\n\t\t'get_cms_hashes',\r\n\t\t'get_modules_hashes',\r\n\t\t'clean_results',\r\n\t\t'file_system_analysis',\r\n\t\t'get_approved_hashes',\r\n\t\t'get_denied_hashes',\r\n\t\t'signature_analysis',\r\n\t\t'heuristic_analysis',\r\n\t\t'schedule_send_heuristic_critical_files',\r\n\t\t'auto_cure_backup',\r\n\t\t'auto_cure',\r\n\t\t'outbound_links',\r\n\t\t'frontend_analysis',\r\n\t\t'important_files_listing',\r\n\t\t'send_results',\r\n\t];\r\n\tstate = null;\r\n\toffset = 0;\r\n\tamount = 0;\r\n\tamount_coefficient = 1;\r\n\ttotal_scanned = 0;\r\n\tscan_percent = 0;\r\n\tpercent_completed = 0;\r\n\r\n\tpaused = false;\r\n\r\n\tbutton = null;\r\n\tspinner = null;\r\n\r\n\tprogress_overall = null;\r\n\tprogressbar = null;\r\n\tprogressbar_text = null;\r\n\r\n\ttimeout = 60000;\r\n\r\n\tstate_timer = 0;\r\n\r\n\tconstructor ( properties ) {\r\n\r\n\t\tconsole.log('init');\r\n\t\tif (jQuery('#spbcscan-results-log-module').length) {\r\n\t\t\tjQuery('.spbc-scan-log-title').removeClass('spbc---hidden')\r\n\t\t}\r\n\r\n\t\t// Crunch for cure backups\r\n\t\tif( typeof properties['settings']['auto_cure'] !== 'undefined' ){\r\n\t\t\tproperties['settings']['scanner__auto_cure_backup'] = '1';\r\n\t\t}\r\n\r\n\t\tfor( let key in properties ){\r\n\t\t\tif( typeof this[key] !== 'undefined' ){\r\n\t\t\t\tthis[key] = properties[key];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tactionControl(){\r\n\r\n\t\tif(this.state === null){\r\n\t\t\tthis.start();\r\n\r\n\t\t}else if(this.paused){\r\n\t\t\tthis.resume();\r\n\t\t\tthis.controller();\r\n\r\n\t\t}else{\r\n\t\t\tthis.pause();\r\n\t\t}\r\n\t};\r\n\r\n\tstart(){\r\n\r\n\t\tthis.active = true;\r\n\t\tthis.state_timer = Math.round(new Date().getTime() /1000);\r\n\r\n\t\tthis.state = this.getNextState( null );\r\n\r\n\t\tthis.setPercents( 0 );\r\n\t\tthis.scan_percent = 0;\r\n\t\tthis.offset = 0;\r\n\t\tthis.progress_overall.children('span')\r\n\t\t\t.removeClass('spbc_bold')\r\n\t\t\t.filter('.spbc_overall_scan_status_' + this.state)\r\n\t\t\t.addClass('spbc_bold');\r\n\r\n\t\tthis.progressbar.show(500);\r\n\t\tthis.progress_overall.show(500);\r\n\t\tthis.button.html(spbcScaner.button_scan_pause);\r\n\t\tthis.spinner.css({display: 'inline'});\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.controller();\r\n\t\t}, 1000);\r\n\r\n\t};\r\n\r\n\tpause( result, data, opt ){\r\n\t\tconsole.log('PAUSE');\r\n\t\tthis.button.html(spbcScaner.button_scan_resume);\r\n\t\tthis.spinner.css({display: 'none'});\r\n\t\tthis.paused = true;\r\n\t\tthis.active = false;\r\n\t};\r\n\r\n\tresume( opt ){\r\n\t\tconsole.log('RESUME');\r\n\t\tthis.button.html(spbcScaner.button_scan_pause);\r\n\t\tthis.spinner.css({display: 'inline'});\r\n\t\tthis.paused = false;\r\n\t\tthis.active = true;\r\n\t};\r\n\r\n\tend( reload ){\r\n\r\n\t\tthis.progressbar.hide(500);\r\n\t\tthis.progress_overall.hide(500);\r\n\t\tthis.button.html(spbcScaner.button_scan_perform);\r\n\t\tthis.spinner.css({display: 'none'});\r\n\t\tthis.state = null;\r\n\t\tthis.total_links = 0;\r\n\t\tthis.plug = false;\r\n\t\tthis.total_scanned = 0;\r\n\t\tthis.active = false;\r\n\r\n\t\tif(reload){\r\n\t\t\tdocument.location = document.location;\r\n\t\t}else{\r\n\t\t\tspbc_sendAJAXRequest(\r\n\t\t\t\t{action: 'spbc_scanner_tab__reload_accordion'},\r\n\t\t\t\t{\r\n\t\t\t\t\tnotJson: true,\r\n\t\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\t\tjQuery(obj).accordion('destroy')\r\n\t\t\t\t\t\t\t.html(result)\r\n\t\t\t\t\t\t\t.accordion({\r\n\t\t\t\t\t\t\t\theader: 'h3',\r\n\t\t\t\t\t\t\t\theightStyle: 'content',\r\n\t\t\t\t\t\t\t\tcollapsible: true,\r\n\t\t\t\t\t\t\t\tactive: false,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\tspbc_tbl__bulk_actions__listen();\r\n\t\t\t\t\t\tspbc_tbl__row_actions__listen();\r\n\t\t\t\t\t\tspbc_tbl__pagination__listen();\r\n\t\t\t\t\t\tspbc_tbl__sort__listen();\r\n\t\t\t\t\t\tspbcStartShowHide();\r\n\t\t\t\t\t\tspbc_scanner__reload_scan_info();\r\n\t\t\t\t\t},\r\n\t\t\t\t},\r\n\t\t\t\tjQuery('#spbc_scan_accordion')\r\n\t\t\t);\r\n\r\n\t\t\tif (!jQuery('#spbc_scanner_clear').length) {\r\n\t\t\t\tlet clear_link = 'Clear scanner logs
' + this.getSiteUTCShiftedTimeString() + ' - ' + items[ key ].path + ': ' + items[ key ].status + '
' );\r\n\t\t}\r\n\t};\r\n\r\n\tlogStageEntry(data){\r\n\t\tthis.logRaw( '' + this.getSiteUTCShiftedTimeString() + ' - ' + '' + data.title + ' ' + '' + data.description + '
' );\r\n\t};\r\n\r\n\tshowLinkForShuffleSalts(message) {\r\n\t\tjQuery('#spbc_notice_about_shuffle_link').remove();\r\n\t\tjQuery(jQuery('.spbc_tab--active .spbc_wrapper_field p')[1])\r\n\t\t\t.after(\r\n\t\t\t\t'Clear scanner logs
' + this.getSiteUTCShiftedTimeString() + ' - ' + items[ key ].path + ': ' + items[ key ].status + '
' );\n\t\t}\n\t};\n\n\tlogStageEntry(data){\n\t\tthis.logRaw( '' + this.getSiteUTCShiftedTimeString() + ' - ' + '' + data.title + ' ' + '' + data.description + '
' );\n\t};\n\n\tshowLinkForShuffleSalts(message) {\n\t\tjQuery('#spbc_notice_about_shuffle_link').remove();\n\t\tjQuery(jQuery('.spbc_tab--active .spbc_wrapper_field p')[1])\n\t\t\t.after(\n\t\t\t\t'\"+result.desc+\"
\");\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}\r\n\r\nfunction spbc_settings__show_recommendation(label, setting_id){\r\n\t\r\n\tvar remove_recommendation_func = function(e){\r\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.spbc_long_desc').length == 0 || jQuery(e.target).hasClass('spbc_long_desc__cancel')) && !jQuery(e.target).hasClass('spbc_long_recommendation__show'))){\r\n\t\t\tjQuery('.spbc_long_desc').remove();\r\n\t\t\tjQuery(document).off('click', remove_recommendation_func);\r\n\t\t}\r\n\t};\r\n\t\r\n\tremove_recommendation_func();\r\n\t\r\n\tlabel.after(\"\");\r\n\tvar obj = jQuery('#spbc_long_desc__'+setting_id);\r\n\tobj.append(\"\")\r\n\t\t.append(\"\")\r\n\t\t.css({\r\n\t\t\ttop: label.position().top + 25,\r\n\t\t\tleft: label.position().left + 5\r\n\t\t});\r\n\r\n\t\r\n\tspbc_sendAJAXRequest(\r\n\t\t{action: 'spbc_settings__get_recommendation', 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(\"\")\r\n\t\t\t\t\t.append(\"\")\r\n\t\t\t\t\t.append(\"\"+result.desc+\"
\");\r\n\r\n\t\t\t\tjQuery(document).on('click', remove_recommendation_func);\r\n\t\t\t}\r\n\t\t},\r\n\t\tobj\r\n\t);\r\n}\r\n\r\n// Shows/hides full text\r\nfunction spbcStartShowHide(){\r\n\tjQuery('.spbcShortText')\r\n\t\t.off('mouseover' )\r\n\t\t.on('mouseover', function(){ jQuery(this).next().show(); })\r\n\t\t.off('mouseout' )\r\n\t\t.on('mouseout', function(){ jQuery(this).next().hide(); });\r\n\tjQuery('.spbcFullText')\r\n\t\t.off('mouseout' )\r\n\t\t.on('mouseout', function(){ jQuery(this).hide(); })\r\n\t\t.off('mouseover' )\r\n\t\t.on('mouseover', function(){ jQuery(this).show(); })\r\n}\r\n\r\n// Generate and save confirmation code\r\nfunction spbctGenerateConfirmationCode() {\r\n\r\n\tvar data = {};\r\n\tvar res = {};\r\n\tres.success = false;\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_generate_confirmation_code';\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(result.success) {\r\n\t\t\t\tres.success = true;\r\n\t\t\t} else {\r\n\t\t\t\tres.text = result.data;\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n\treturn res;\r\n}\r\n// Check confirmation code\r\nfunction spbctCheckConfirmationCode( radioButton, timeout, timer ) {\r\n\r\n\tvar element = radioButton;\r\n\tvar data = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_check_confirmation_code';\r\n\tdata.code = jQuery('#confirmation-code input').val();\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(result.success) {\r\n\t\t\t\tjQuery('[name *= 2fa__enable]').attr(\"checked\", \"\");\r\n\t\t\t\telement.checked = true;\r\n\t\t\t\tjQuery('#spbc_setting_2fa__roles').removeAttr('disabled');\r\n\t\t\t\tjQuery('#spbc_setting_2fa__roles > option:first').attr('selected','selected');\r\n\t\t\t\tclearTimeout( timeout );\r\n\t\t\t\ttimer.remove();\r\n\t\t\t\tjQuery('#confirmation-code').dialog( \"close\" );\r\n\t\t\t} else {\r\n\t\t\t\talert('Code verification failed!');\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n\r\n}\r\n\r\n/**\r\n * Checking current account status for renew notice\r\n */\r\nfunction spbc_banner_check() {\r\n\tvar bannerChecker = setInterval( function() {\r\n\t\tspbc_sendAJAXRequest(\r\n\t\t\t{action: 'spbc_settings__check_renew_banner'},\r\n\t\t\t{\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif (result.close_renew_banner) {\r\n\t\t\t\t\t\tif (jQuery('#spbc_renew_notice').length)\r\n\t\t\t\t\t\t\tjQuery('#spbc_renew_notice').hide('slow');\r\n\t\t\t\t\t\tif (jQuery('#spbc_trial_notice').length)\r\n\t\t\t\t\t\t\tjQuery('#spbc_trial_notice').hide('slow');\r\n\t\t\t\t\t\tclearInterval(bannerChecker);\r\n\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}, 60000);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\tjQuery('#spbc_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\t// Checking email receiving possibility for activation 2FA\r\n\tjQuery(document).on('click', '[name*=fa__enable]:not([value=0]),#confirmation-code--resend', function(e){\r\n\r\n\t\te.preventDefault();\r\n\r\n\t\tjQuery('#confirmation-code--resend').attr('disabled', 'disabled')\r\n\t\t\t.append('\" + result.data + \"
\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_import_button .spbc_success').show(300);\r\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_import_button .spbc_success').hide(300);}, 2000);\r\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\t// Export settings\r\n\tjQuery( document ).on('click', '#spbc_settings_templates_export_button', function(){\r\n\t\tjQuery('#spbc-ajax-result').remove();\r\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#spbc_settings_templates_export'));\r\n\t\tvar templateNameInput = jQuery('#spbc_settings_templates_export_name');\r\n\t\ttemplateNameInput.css('border-color', 'inherit');\r\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\r\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif( optionSelected.data('id') === 'new_template' ) {\r\n\t\t\tvar templateName = templateNameInput.val();\r\n\t\t\tif( templateName === '' ) {\r\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tvar data = {\r\n\t\t\t\t'template_name' : templateName\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar data = {\r\n\t\t\t\t'template_id' : optionSelected.data('id')\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar button = this;\r\n\t\tspbc_sendAJAXRequest(\r\n\t\t\t{action: 'spbc_settings_templates_export', data: data},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: button,\r\n\t\t\t\tspinner: jQuery('#spbc_settings_templates_export_button .spbc_preloader_button' ),\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif(result.success) {\r\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_export_button .spbc_success').show(300);\r\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_export_button .spbc_success').hide(300);}, 2000);\r\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\t// Reset settings\r\n\tjQuery( document ).on('click', '#spbc_settings_templates_reset_button', function(){\r\n\t\tvar button = this;\r\n\t\tspbc_sendAJAXRequest(\r\n\t\t\t{action: 'spbc_settings_templates_reset'},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: button,\r\n\t\t\t\tspinner: jQuery('#spbc_settings_templates_reset_button .spbc_preloader_button' ),\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif(result.success) {\r\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_reset_button .spbc_success').show(300);\r\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_reset_button .spbc_success').hide(300);}, 2000);\r\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\tjQuery(document).on('change', '#spbc_settings_templates_export',function(){\r\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\r\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\r\n\t\t\tjQuery(this).parent().parent().find('#spbc_settings_templates_export_name').show();\r\n\t\t} else {\r\n\t\t\tjQuery(this).parent().parent().find('#spbc_settings_templates_export_name').hide();\r\n\t\t}\r\n\t});\r\n\r\n\t//* TAB_CONTROL\r\n\t\r\n\t\tjQuery('.spbc_tab_nav-summary').data('loaded', true); // Summary tab loaded by default\r\n\t\tjQuery('.spbc_tabs_nav_wrapper').on('click', '.spbc_tab_nav', function(event){\r\n\t\t\tspbc_switchTab(event.currentTarget);\r\n\t\t});\r\n\t\t\r\n\t\t// Get additional params\r\n var params = {\r\n target: location.search.match(/spbc_target=(\\S*?)(&|$)/) ? location.search.match(/spbc_target=(\\S*?)(&|$)/)[1] : null,\r\n action: location.search.match(/spbc_action=(\\S*?)(&|$)/) ? location.search.match(/spbc_action=(\\S*?)(&|$)/)[1] : null,\r\n times: location.search.match(/spbc_times=(\\S*?)(&|$)/) ? location.search.match(/spbc_times=(\\S*?)(&|$)/)[1] : 3,\r\n };\r\n // Legacy support\r\n params.target = location.search.match(/spbc_highlight=(\\S*?)(&|$)/) ? location.search.match(/spbc_highlight=(\\S*?)(&|$)/)[1] : params.target;\r\n params.action = location.search.search(/spbc_highlight=(\\S*?)(&|$)/) != -1\r\n ? 'highlight'\r\n : params.action;\r\n\r\n\t\t// Get open tab form query\r\n\t\tvar spbc_tab = document.getElementsByClassName('spbc_tab_nav-' + (location.search.match(/spbc_tab=(\\S*?)(&|$)/) ? location.search.match(/spbc_tab=(\\S*?)(&|$)/)[1] : ''))[0] || null;\r\n\r\n\t\t// TAB SWITCHING\r\n\t\t// Switch by URL\r\n\t\tif(spbc_tab){\r\n\r\n\t\t// Switch to DEBUG\r\n\t\t}else if( +spbcSettings.debug ){\r\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-debug')[0];\r\n\t\t// Switch by DEFAULT\r\n\t\t}else if( +spbcSettings.wpms && !+spbcSettings.is_main_site){\r\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-security_log')[0];\r\n\t\t// Switch if Key is OK and SFW is ON\r\n\t\t}else if( +spbcSettings.key_is_ok && +spbcSettings.secfw_enabled ){\r\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-traffic_control')[0];\r\n\t\t// Switch if Key is OK\r\n\t\t}else if( +spbcSettings.key_is_ok ){\r\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-scanner')[0];\r\n\t\t// Switch if KEY IS BAD\r\n\t\t}else{\r\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-settings_general')[0];\r\n\t\t\tparams = {\r\n\t\t\t target: 'spbc_key',\r\n action: 'highlight',\r\n times: 3,\r\n };\r\n\t\t}\r\n\t\t\r\n\t\t// Switch tab\r\n\t\tif(spbc_tab) spbc_switchTab(spbc_tab, params);\r\n\t\t\r\n\t//*/ TAB_CONROL END\r\n\t\r\n\t//* REFRESH TAB IF ctrl+F5\r\n\tvar ctrlKeyDown = false;\r\n\r\n\tjQuery(document).on(\"keyup\", function(e) {\r\n\t\tif ((e.which || e.keyCode) == 17) ctrlKeyDown = false;\r\n\t});\r\n\r\n\tjQuery(document).on(\"keydown\", function(e) {\r\n\t\tif (((e.which || e.keyCode) == 116) && ctrlKeyDown) {\r\n\t\t\te.preventDefault();\r\n\r\n\t\t\tvar active_tab = jQuery('.spbc_tab_nav--active')[0];\r\n\t\t\tvar tab_name = active_tab.classList[1].replace('spbc_tab_nav-', '');\r\n\r\n\t\t\tif (tab_name === 'scanner') return; \r\n\r\n\t\t\tjQuery(active_tab).data('loaded', false);\r\n\r\n\t\t\tspbc_switchTab(active_tab);\r\n\r\n\t\t} else if ((e.which || e.keyCode) == 17) {\r\n\t ctrlKeyDown = true;\r\n\t }\r\n\t});\r\n\t//*/ REFRESH TAB IF ctrl+F5 END\r\n\r\n\t/**\r\n * Change cleantalk account email\r\n */\r\n jQuery(document).on('click', '#spbc-change-account-email', function(e) {\r\n e.preventDefault();\r\n\r\n let $this = jQuery(this);\r\n let accountEmailField = jQuery('#spbc-account-email');\r\n let accountEmail = accountEmailField.text();\r\n\r\n\t\tspbcToggleClass($this, 'active');\r\n\r\n if ($this.hasClass('active')) {\r\n $this.text($this.data('save-text'));\r\n accountEmailField.attr('contenteditable', 'true');\r\n\t\t\taccountEmailField.focus();\r\n accountEmailField.on('keydown', function(e) {\r\n if (e.code === 'Enter') {\r\n e.preventDefault();\r\n }\r\n });\r\n accountEmailField.on('input', function(e) {\r\n if (e.inputType === 'insertParagraph') {\r\n e.preventDefault();\r\n }\r\n });\r\n } else {\r\n spbc_sendAJAXRequest(\r\n {\r\n action: 'spbc_update_account_email',\r\n accountEmail: accountEmail,\r\n },\r\n {\r\n timeout: 5000,\r\n callback: function(result, data, params, obj) {\r\n if (result.success !== undefined && result.success === 'ok') {\r\n if (result.manuallyLink !== undefined) {\r\n jQuery('#spbc-key-manually-link').attr('href', result.manuallyLink);\r\n }\r\n }\r\n\r\n if (result.error !== undefined) {\r\n\t\t\t\t\t\t\r\n jQuery('#spbc-account-email').css('border-color', 'red');\r\n }\r\n },\r\n\t\t\t\t\terrorOutput: function(msg) {\r\n\t\t\t\t\t\tspbcModal.loaded = msg;\r\n\t\t\t\t\t\tspbcModal.open();\r\n\t\t\t\t\t}\r\n },\r\n );\r\n\r\n accountEmailField.attr('contenteditable', 'false');\r\n $this.text($this.data('default-text'));\r\n }\r\n });\r\n});\r\n\r\n/**\r\n * @param {string} className\r\n */\r\nfunction spbcToggleClass(arr, className) {\r\n\tfor (let i=0; i\"+result.desc+\"
\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction spbc_settings__show_recommendation(label, setting_id){\n\t\n\tvar remove_recommendation_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.spbc_long_desc').length == 0 || jQuery(e.target).hasClass('spbc_long_desc__cancel')) && !jQuery(e.target).hasClass('spbc_long_recommendation__show'))){\n\t\t\tjQuery('.spbc_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_recommendation_func);\n\t\t}\n\t};\n\t\n\tremove_recommendation_func();\n\t\n\tlabel.after(\"\");\n\tvar obj = jQuery('#spbc_long_desc__'+setting_id);\n\tobj.append(\"\")\n\t\t.append(\"\")\n\t\t.css({\n\t\t\ttop: label.position().top + 25,\n\t\t\tleft: label.position().left + 5\n\t\t});\n\n\t\n\tspbc_sendAJAXRequest(\n\t\t{action: 'spbc_settings__get_recommendation', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"\")\n\t\t\t\t\t.append(\"\")\n\t\t\t\t\t.append(\"\"+result.desc+\"
\");\n\n\t\t\t\tjQuery(document).on('click', remove_recommendation_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\n// Shows/hides full text\nfunction spbcStartShowHide(){\n\tjQuery('.spbcShortText')\n\t\t.off('mouseover' )\n\t\t.on('mouseover', function(){ jQuery(this).next().show(); })\n\t\t.off('mouseout' )\n\t\t.on('mouseout', function(){ jQuery(this).next().hide(); });\n\tjQuery('.spbcFullText')\n\t\t.off('mouseout' )\n\t\t.on('mouseout', function(){ jQuery(this).hide(); })\n\t\t.off('mouseover' )\n\t\t.on('mouseover', function(){ jQuery(this).show(); })\n}\n\n// Generate and save confirmation code\nfunction spbctGenerateConfirmationCode() {\n\n\tvar data = {};\n\tvar res = {};\n\tres.success = false;\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_generate_confirmation_code';\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tres.success = true;\n\t\t\t} else {\n\t\t\t\tres.text = result.data;\n\t\t\t}\n\t\t},\n\t});\n\treturn res;\n}\n// Check confirmation code\nfunction spbctCheckConfirmationCode( radioButton, timeout, timer ) {\n\n\tvar element = radioButton;\n\tvar data = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_check_confirmation_code';\n\tdata.code = jQuery('#confirmation-code input').val();\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tjQuery('[name *= 2fa__enable]').attr(\"checked\", \"\");\n\t\t\t\telement.checked = true;\n\t\t\t\tjQuery('#spbc_setting_2fa__roles').removeAttr('disabled');\n\t\t\t\tjQuery('#spbc_setting_2fa__roles > option:first').attr('selected','selected');\n\t\t\t\tclearTimeout( timeout );\n\t\t\t\ttimer.remove();\n\t\t\t\tjQuery('#confirmation-code').dialog( \"close\" );\n\t\t\t} else {\n\t\t\t\talert('Code verification failed!');\n\t\t\t}\n\t\t},\n\t});\n\n}\n\n/**\n * Checking current account status for renew notice\n */\nfunction spbc_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#spbc_renew_notice').length)\n\t\t\t\t\t\t\tjQuery('#spbc_renew_notice').hide('slow');\n\t\t\t\t\t\tif (jQuery('#spbc_trial_notice').length)\n\t\t\t\t\t\t\tjQuery('#spbc_trial_notice').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 60000);\n}\n\njQuery(document).ready(function(){\n\t\n\tjQuery('#spbc_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Checking email receiving possibility for activation 2FA\n\tjQuery(document).on('click', '[name*=fa__enable]:not([value=0]),#confirmation-code--resend', function(e){\n\n\t\te.preventDefault();\n\n\t\tjQuery('#confirmation-code--resend').attr('disabled', 'disabled')\n\t\t\t.append('\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_import_button .spbc_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_import_button .spbc_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#spbc_settings_templates_export_button', function(){\n\t\tjQuery('#spbc-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#spbc_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#spbc_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#spbc_settings_templates_export_button .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_export_button .spbc_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_export_button .spbc_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#spbc_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#spbc_settings_templates_reset_button .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_reset_button .spbc_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_reset_button .spbc_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tjQuery(document).on('change', '#spbc_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#spbc_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#spbc_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\t//* TAB_CONTROL\n\t\n\t\tjQuery('.spbc_tab_nav-summary').data('loaded', true); // Summary tab loaded by default\n\t\tjQuery('.spbc_tabs_nav_wrapper').on('click', '.spbc_tab_nav', function(event){\n\t\t\tspbc_switchTab(event.currentTarget);\n\t\t});\n\t\t\n\t\t// Get additional params\n var params = {\n target: location.search.match(/spbc_target=(\\S*?)(&|$)/) ? location.search.match(/spbc_target=(\\S*?)(&|$)/)[1] : null,\n action: location.search.match(/spbc_action=(\\S*?)(&|$)/) ? location.search.match(/spbc_action=(\\S*?)(&|$)/)[1] : null,\n times: location.search.match(/spbc_times=(\\S*?)(&|$)/) ? location.search.match(/spbc_times=(\\S*?)(&|$)/)[1] : 3,\n };\n // Legacy support\n params.target = location.search.match(/spbc_highlight=(\\S*?)(&|$)/) ? location.search.match(/spbc_highlight=(\\S*?)(&|$)/)[1] : params.target;\n params.action = location.search.search(/spbc_highlight=(\\S*?)(&|$)/) != -1\n ? 'highlight'\n : params.action;\n\n\t\t// Get open tab form query\n\t\tvar spbc_tab = document.getElementsByClassName('spbc_tab_nav-' + (location.search.match(/spbc_tab=(\\S*?)(&|$)/) ? location.search.match(/spbc_tab=(\\S*?)(&|$)/)[1] : ''))[0] || null;\n\n\t\t// TAB SWITCHING\n\t\t// Switch by URL\n\t\tif(spbc_tab){\n\n\t\t// Switch to DEBUG\n\t\t}else if( +spbcSettings.debug ){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-debug')[0];\n\t\t// Switch by DEFAULT\n\t\t}else if( +spbcSettings.wpms && !+spbcSettings.is_main_site){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-security_log')[0];\n\t\t// Switch if Key is OK and SFW is ON\n\t\t}else if( +spbcSettings.key_is_ok && +spbcSettings.secfw_enabled ){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-traffic_control')[0];\n\t\t// Switch if Key is OK\n\t\t}else if( +spbcSettings.key_is_ok ){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-scanner')[0];\n\t\t// Switch if KEY IS BAD\n\t\t}else{\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-settings_general')[0];\n\t\t\tparams = {\n\t\t\t target: 'spbc_key',\n action: 'highlight',\n times: 3,\n };\n\t\t}\n\t\t\n\t\t// Switch tab\n\t\tif(spbc_tab) spbc_switchTab(spbc_tab, params);\n\t\t\n\t//*/ TAB_CONROL END\n\t\n\t//* REFRESH TAB IF ctrl+F5\n\tvar ctrlKeyDown = false;\n\n\tjQuery(document).on(\"keyup\", function(e) {\n\t\tif ((e.which || e.keyCode) == 17) ctrlKeyDown = false;\n\t});\n\n\tjQuery(document).on(\"keydown\", function(e) {\n\t\tif (((e.which || e.keyCode) == 116) && ctrlKeyDown) {\n\t\t\te.preventDefault();\n\n\t\t\tvar active_tab = jQuery('.spbc_tab_nav--active')[0];\n\t\t\tvar tab_name = active_tab.classList[1].replace('spbc_tab_nav-', '');\n\n\t\t\tif (tab_name === 'scanner') return; \n\n\t\t\tjQuery(active_tab).data('loaded', false);\n\n\t\t\tspbc_switchTab(active_tab);\n\n\t\t} else if ((e.which || e.keyCode) == 17) {\n\t ctrlKeyDown = true;\n\t }\n\t});\n\t//*/ REFRESH TAB IF ctrl+F5 END\n\n\t/**\n * Change cleantalk account email\n */\n jQuery(document).on('click', '#spbc-change-account-email', function(e) {\n e.preventDefault();\n\n let $this = jQuery(this);\n let accountEmailField = jQuery('#spbc-account-email');\n let accountEmail = accountEmailField.text();\n\n\t\tspbcToggleClass($this, 'active');\n\n if ($this.hasClass('active')) {\n $this.text($this.data('save-text'));\n accountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.focus();\n accountEmailField.on('keydown', function(e) {\n if (e.code === 'Enter') {\n e.preventDefault();\n }\n });\n accountEmailField.on('input', function(e) {\n if (e.inputType === 'insertParagraph') {\n e.preventDefault();\n }\n });\n } else {\n spbc_sendAJAXRequest(\n {\n action: 'spbc_update_account_email',\n accountEmail: accountEmail,\n },\n {\n timeout: 5000,\n callback: function(result, data, params, obj) {\n if (result.success !== undefined && result.success === 'ok') {\n if (result.manuallyLink !== undefined) {\n jQuery('#spbc-key-manually-link').attr('href', result.manuallyLink);\n }\n }\n\n if (result.error !== undefined) {\n\t\t\t\t\t\t\n jQuery('#spbc-account-email').css('border-color', 'red');\n }\n },\n\t\t\t\t\terrorOutput: function(msg) {\n\t\t\t\t\t\tspbcModal.loaded = msg;\n\t\t\t\t\t\tspbcModal.open();\n\t\t\t\t\t}\n },\n );\n\n accountEmailField.attr('contenteditable', 'false');\n $this.text($this.data('default-text'));\n }\n });\n});\n\n/**\n * @param {string} className\n */\nfunction spbcToggleClass(arr, className) {\n\tfor (let i=0; i\" + tip_text + \"
\");\r\n\r\n\tjQuery(document).on('click', remove_desc_func);\r\n\tshow_icon.parents('tr').on('mouseout', remove_desc_func);\r\n}\r\n\r\nfunction spbc_scanner_button_file_view_event(obj){\r\n\tvar self = jQuery(obj);\r\n\tvar data = {\r\n\t\taction: 'spbc_scanner_file_view',\r\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\r\n\t};\r\n\tvar params = {\r\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\r\n\t\tcallback: spbc_scannerButtonView_callback,\r\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\r\n\t};\r\n\tspbc_sendAJAXRequest(data, params);\r\n}\r\n\r\n/**\r\n * Delete file from analysis log\r\n */\r\nfunction spbc_scanner_analysis_log_delete_from_log(obj) {\r\n\r\n\tlet fileIds = [];\r\n\tconst self = jQuery(obj);\r\n\tlet spinner;\r\n\r\n\tif ( jQuery(obj).hasClass('tbl-row_action') ) {\r\n\t\tfileIds.push(self.parents('.row-actions').attr('uid'));\r\n\t\tspinner = self.parent().siblings('.tbl-preloader--tiny');\r\n\t} else {\r\n\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select:checked');\r\n\t\tif (selectedItems.length === 0) {\r\n\t\t\talert('Please, select elements.');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tselectedItems.each(function (index, element) {\r\n\t\t\tconst elementId = jQuery(element).val();\r\n\t\t\tfileIds.push(elementId);\r\n\t\t});\r\n\t\tspinner = self.children('.tbl-preloader--small');\r\n\t}\r\n\r\n\tconst data = {\r\n\t\taction: 'spbc_scanner_analysis_log_delete_from_log',\r\n\t\tfile_ids: fileIds,\r\n\t};\r\n\r\n\tvar params = {\r\n\t\tspinner: spinner,\r\n\t\tcallback: function() { window.location.reload(); },\r\n\t};\r\n\r\n\tspbc_sendAJAXRequest(data, params);\r\n}\r\n\r\nfunction spbc_scanner_button_page_view_event(obj){\r\n\tvar self = jQuery(obj);\r\n\tvar data = {\r\n\t\taction: 'spbc_scanner_page_view',\r\n\t\tpage_url: self.parents('.row-actions').attr('uid'),\r\n\t};\r\n\tvar params = {\r\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\r\n\t\tcallback: spbc_scannerButtonView_callback,\r\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\r\n\t};\r\n\r\n\tlet wp_wrap = jQuery('#wpwrap')\r\n\tlet dialog_window = jQuery('#spbc_dialog')\r\n\r\n\tdialog_window.dialog({\r\n\t\tmodal:true,\r\n\t\ttitle: 'Loading..',\r\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\r\n\t\twidth: +(wp_wrap.width() / 100 * 90),\r\n\t\tshow: { effect: \"blind\", duration: 500 },\r\n\t\tdraggable: false,\r\n\t\tresizable: false,\r\n\t\tcloseText: \"X\",\r\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\r\n\t\topen: function(event, ui) {\r\n\t\t\tevent.target.style.overflow = 'auto';\r\n\t\t\tjQuery('#spbc_dialog').height((document.documentElement.clientHeight) / 100 * 25);\r\n\t\t},\r\n\t\tbeforeClose: function(event, ui) {\r\n\t\t\tdocument.body.style.overflow = 'auto';\r\n\t\t\tjQuery('#spbc_dialog').empty();\r\n\t\t},\r\n\t})\r\n\r\n\tdialog_window.append('')\r\n\r\n\tlet spinner = jQuery('#spbc_file_view_preloader')\r\n\tlet size_multiplier = (wp_wrap.width() * 0.0004)\r\n\r\n\tspinner.height(128 * size_multiplier)\r\n\tspinner.width(128 * size_multiplier)\r\n\tspinner.css({left: dialog_window.width()/2 - (128 * size_multiplier / 2)})\r\n\tspinner.css({top: dialog_window.height()/2 - (128 * size_multiplier / 2)})\r\n\r\n\tspbc_sendAJAXRequest(data, params);\r\n}\r\n\r\nfunction spbc_scannerButtonView_callback(result){\r\n\r\n\tlet dialog_window = jQuery('#spbc_dialog')\r\n\tdialog_window.empty();\r\n\r\n\tjQuery('#spbc_file_view_preloader').css({display:'none'})\r\n\r\n\tlet row_template = '%s
%s
%s
%s
' +\r\n\t\t\t\t'%s
' +\r\n\t\t\t\t'%s
%s%s
%s
%s%s
\r\n \r\n ${result.data.content}\r\n
\r\n
\r\n \" + tip_text + \"
\");\n\n\tjQuery(document).on('click', remove_desc_func);\n\tshow_icon.parents('tr').on('mouseout', remove_desc_func);\n}\n\nfunction spbc_scanner_button_file_view_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_view',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonView_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Delete file from analysis log\n */\nfunction spbc_scanner_analysis_log_delete_from_log(obj) {\n\n\tlet fileIds = [];\n\tconst self = jQuery(obj);\n\tlet spinner;\n\n\tif ( jQuery(obj).hasClass('tbl-row_action') ) {\n\t\tfileIds.push(self.parents('.row-actions').attr('uid'));\n\t\tspinner = self.parent().siblings('.tbl-preloader--tiny');\n\t} else {\n\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select:checked');\n\t\tif (selectedItems.length === 0) {\n\t\t\talert('Please, select elements.');\n\t\t\treturn;\n\t\t}\n\n\t\tselectedItems.each(function (index, element) {\n\t\t\tconst elementId = jQuery(element).val();\n\t\t\tfileIds.push(elementId);\n\t\t});\n\t\tspinner = self.children('.tbl-preloader--small');\n\t}\n\n\tconst data = {\n\t\taction: 'spbc_scanner_analysis_log_delete_from_log',\n\t\tfile_ids: fileIds,\n\t};\n\n\tvar params = {\n\t\tspinner: spinner,\n\t\tcallback: function() { window.location.reload(); },\n\t};\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonView_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\n\tlet wp_wrap = jQuery('#wpwrap')\n\tlet dialog_window = jQuery('#spbc_dialog')\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: 'Loading..',\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(wp_wrap.width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: false,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').height((document.documentElement.clientHeight) / 100 * 25);\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t})\n\n\tdialog_window.append('')\n\n\tlet spinner = jQuery('#spbc_file_view_preloader')\n\tlet size_multiplier = (wp_wrap.width() * 0.0004)\n\n\tspinner.height(128 * size_multiplier)\n\tspinner.width(128 * size_multiplier)\n\tspinner.css({left: dialog_window.width()/2 - (128 * size_multiplier / 2)})\n\tspinner.css({top: dialog_window.height()/2 - (128 * size_multiplier / 2)})\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonView_callback(result){\n\n\tlet dialog_window = jQuery('#spbc_dialog')\n\tdialog_window.empty();\n\n\tjQuery('#spbc_file_view_preloader').css({display:'none'})\n\n\tlet row_template = '%s
%s
%s
%s
' +\n\t\t\t\t'%s
' +\n\t\t\t\t'%s
%s%s
%s
%s%s
\n \n ${result.data.content}\n
\n
\n Analysis status updated. Total: "+t.counters.total+", updated: "+t.counters.updated+", skipped: "+t.counters.skipped+", failed: "+t.counters.failed+", queued: "+t.counters.queued+"
",spbcModal.open().put(e)),"send"===a&&(e="Files have been sent: "+t.files_sent_counter+"
",spbcModal.open().put(e))},errorOutput:function(t,e){e&&(t=t+"Success. Selected IPs have been "+s+". Changes will be applied within 10 minutes.
";spbcModal.open().put(s),void setTimeout(spbc_reload_accordion,1900)}else"-1"!==n&&a.parents(".tbl-root").find(".cb-select").is(":checked")?(a.children(".tbl-preloader--small").show(),a.parents(".tbl-root").find(".cb-select:checked").first().parents("tr").find(".tbl-row_action--"+n)[0]?(a.parents(".tbl-root").find(".cb-select:checked").first().parents("tr").find(".tbl-row_action--"+n).click(),a.parents(".tbl-root").find(".cb-select:checked").first().prop("checked",!1)):(a.parents(".tbl-root").find(".cb-select:checked").first().prop("checked",!1),a.click())):(a.children(".tbl-preloader--small").hide(),spbc_bulk_action=null,"check_analysis_status"===n&&spbcModal.open().put("All available files are updated.
"),"send"===n&&spbcModal.open().put("All available files are sent.
"),setTimeout(spbc_reload_accordion,1900))}})}function spbc_scanner__cure_selected(e){var t=e.closest("#spbc_tbl__scanner_cure_log").find(".cb-select:checked");let a=[];0===t.length&&alert("Please, select elements."),t.each(function(t,e){e=jQuery(e).val();a.push(e)});t={action:"spbc_cure_selected",security:spbcSettings.ajax_nonce,selectedIds:a};jQuery.ajax({type:"POST",url:spbcSettings.ajaxurl,data:t,beforeSend:function(){e.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").show()},success:function(t){e.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").hide(),t.success?(spbcModal.open().put(t.data),document.addEventListener("spbcModalClosed",function(t){document.location.reload()})):spbcModal.open().putError(t.data)}})}function spbc_tbl__row_actions__listen(){jQuery(".tbl-row_action--ajax").off("click").on("click",function(){var t,e,a,n;console.log("spbc_tbl__row_actions__listen click"),spbc_scanner.active?alert(spbcTableLocalize.scannerIsActive):(e={action:"spbc_tbl-action--row",add_action:(t=jQuery(this)).attr("row-action"),id:t.parents(".row-actions").attr("uid"),cols:t.parents(".row-actions").attr("cols_amount"),page_url:t.parent().attr("uid"),page_id:t.parent().attr("page_id")},a={callback:spbc_tbl__row_actions__callback,errorOutput:function(t){spbcModal.open().putError(t)},spinner:t.parent().siblings(".tbl-preloader--tiny")},!spbc_bulk_action&&(n=spbcTable["warning_"+t.attr("row-action")]||spbcTable.warning_default,"copy_file_info"===e.add_action||"check_analysis_status"===e.add_action||confirm(n))&&spbc_sendAJAXRequest(e,a,t.parents("tr")),spbc_bulk_action&&spbc_sendAJAXRequest(e,a,t.parents("tr")))})}function spbc_tbl__row_actions__callback(t,e,a,n){if(t.color&&n.css({background:t.background,color:t.color}),t.html&&(n.parent().parent().parent().prepend(t.html),setTimeout(function(){n.fadeOut(300)},1500),spbc_bulk_action||setTimeout(spbc_reload_accordion,1900)),"copy_file_info"===e.add_action&&(!0===t.success&&t.data.file_info?window.prompt("Copy the file info below and send it to support@cleantalk.org: ",t.data.file_info):(c=void 0!==t.data.error?t.data.error:"Unknown copy_file_info error",spbcModal.open().putError(c))),t.temp_html){var s=n.html();if(n.html(t.temp_html),void 0!==t.updated_template){var c=t.updated_template_type,t=t.updated_template,l=jQuery(t).find(".wp-list-table tbody tr").length,i=jQuery('[aria-controls="spbc_scan_accordion_tab_'+c+'"]');if(0