diff --git a/css/spbc-admin.min.css b/css/spbc-admin.min.css index f6be7bcf3..521858f2b 100644 --- a/css/spbc-admin.min.css +++ b/css/spbc-admin.min.css @@ -1 +1 @@ -.spbc_translate_links{color:rgba(150,150,20,1)}.spbc_faq_links{color:rgba(20,150,20,1)}.spbc_support_links{color:rgba(150,20,20,1)}.spbc_setting_links{color:rgba(20,20,150,1)}.spbc_translate_links:hover{color:rgba(210,210,20,1)!important}.spbc_faq_links:hover{color:rgba(20,250,20,1)!important}.spbc_support_links:hover{color:rgba(250,20,20,1)!important}.spbc_setting_links:hover{color:rgba(20,20,250,1)!important}.--hide,.spbc_hide{display:none}#wp-admin-bar-cleantalk_admin_bar__parent_node span,.-display--inline-block{display:inline-block}.ctlk---red,.spbcRed{color:red}.spbcGreen{color:green}.spbcTextCenter{text-align:center}.spbc-overflow--visible{overflow:visible!important}._animate--rotate{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node .spbc-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}#wp-admin-bar-spbc_admin_bar__settings_link a,.cleantalk-admin_bar__parent a{display:inline-block!important;padding:0 10px!important}.cleantalk_admin_bar__blocked div{cursor:not-allowed!important}.cleantalk_admin_bar__blocked div a{color:#777!important}b.spbc-admin_bar--online_admins{font-size:11px!important}.cleantalk_admin_bar__title{vertical-align:top;margin-left:5px!important}.clntlk-hint{position:relative!important}.clntlk-hint:hover{color:#fff}.clntlk-hint:hover::after{content:attr(hint);position:absolute;left:100%;top:50%;background:rgba(235,235,235,.85);padding:0 5px;border:1px solid #333;color:#000;font-style:normal;width:max-content;z-index:99999999999999999}.cleantalk_admin_bar__separator{height:0!important}span.green_dot,span.red_dot{height:8px!important;width:8px!important;border-radius:50%!important;display:inline-block!important;margin-left:5px!important}.cleantalk_admin_bar__counter a{padding:0 10px!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}span.red_dot{background-color:#d00!important}span.green_dot{background-color:#0d0!important}#spbct-upload-checker-details{overflow-y:scroll;height:150px}#spbct-upload-checker-details li:nth-child(2n+1){background:#d3d3d3} \ No newline at end of file +.spbc_translate_links{color:rgba(150,150,20,1)}.spbc_faq_links{color:rgba(20,150,20,1)}.spbc_support_links{color:rgba(150,20,20,1)}.spbc_setting_links{color:rgba(20,20,150,1)}.spbc_translate_links:hover{color:rgba(210,210,20,1)!important}.spbc_faq_links:hover{color:rgba(20,250,20,1)!important}.spbc_support_links:hover{color:rgba(250,20,20,1)!important}.spbc_setting_links:hover{color:rgba(20,20,250,1)!important}.--hide,.spbc_hide{display:none}#wp-admin-bar-cleantalk_admin_bar__parent_node span,.-display--inline-block{display:inline-block}.ctlk---red,.spbcRed{color:red}.spbcGreen{color:green}.spbcTextCenter{text-align:center}.spbc-overflow--visible{overflow:visible!important}._animate--rotate{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node .spbc-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}#wp-admin-bar-spbc_admin_bar__settings_link a,.cleantalk-admin_bar__parent a{display:inline-block!important;padding:0 10px!important}.cleantalk_admin_bar__blocked div{cursor:not-allowed!important}.cleantalk_admin_bar__blocked div a{color:#777!important}b.spbc-admin_bar--online_admins{font-size:11px!important}.cleantalk_admin_bar__title{vertical-align:top;margin-left:5px!important}.clntlk-hint{position:relative!important}.clntlk-hint:hover{color:#fff}.clntlk-hint:hover::after{content:attr(hint);position:absolute;left:100%;top:50%;background:rgba(235,235,235,.85);padding:0 5px;border:1px solid #333;color:#000;font-style:normal;width:max-content;z-index:99999999999999999}span.green_dot,span.red_dot{width:8px!important;border-radius:50%!important;display:inline-block!important;margin-left:5px!important}.cleantalk_admin_bar__separator{height:0!important}.cleantalk_admin_bar__counter a{padding:0 10px!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}span.red_dot{height:8px!important;background-color:#d00!important}span.green_dot{height:8px!important;background-color:#0d0!important}#spbct-upload-checker-details{overflow-y:scroll;height:150px;border:1px solid #CCC}#spbct-upload-checker-details li:nth-child(2n+1){background:#CCC} \ No newline at end of file diff --git a/css/src/spbc-admin.css b/css/src/spbc-admin.css index 259612974..20179eee7 100644 --- a/css/src/spbc-admin.css +++ b/css/src/spbc-admin.css @@ -140,7 +140,8 @@ span.green_dot{ #spbct-upload-checker-details { overflow-y: scroll; height: 150px; + border: solid #CCC 1px; } #spbct-upload-checker-details li:nth-child(2n+1) { - background: #d3d3d3; -} \ No newline at end of file + background: #CCC; +} diff --git a/inc/admin-bar.php b/inc/admin-bar.php index a1d1a55ed..323662c02 100644 --- a/inc/admin-bar.php +++ b/inc/admin-bar.php @@ -212,11 +212,13 @@ function spbc_admin__admin_bar__add_child_nodes($wp_admin_bar) : ''; // FireWall - $wp_admin_bar->add_node(array( - 'parent' => 'spbc__parent_node', - 'id' => 'spbc_admin_bar__traffic_control_link', - 'title' => '' . __('FireWall', 'security-malware-firewall') . '', - )); + if ( (int) $spbc->settings['secfw__enabled'] ) { + $wp_admin_bar->add_node(array( + 'parent' => 'spbc__parent_node', + 'id' => 'spbc_admin_bar__traffic_control_link', + 'title' => '' . __('FireWall', 'security-malware-firewall') . '', + )); + } $wp_admin_bar->add_node(array( 'parent' => 'spbc__parent_node', diff --git a/inc/spbc-admin.php b/inc/spbc-admin.php index 6577e50e9..62405cb6f 100644 --- a/inc/spbc-admin.php +++ b/inc/spbc-admin.php @@ -109,6 +109,7 @@ function spbc_admin_init() // Misc add_action('wp_ajax_spbc_settings__get_description', 'spbc_settings__get_description'); + add_action('wp_ajax_spbc_settings__get_recommendation', 'spbc_settings__get_recommendation'); add_action('wp_ajax_spbc_settings__check_renew_banner', 'spbc_settings__check_renew_banner'); add_action('wp_ajax_spbc_sync', 'spbc_sync'); add_action('wp_ajax_spbc_get_key_auto', 'spbc_get_key_auto'); @@ -250,6 +251,7 @@ function spbc_enqueue_scripts($hook) 'is_main_site' => (int) is_main_site(), 'img_path' => SPBC_PATH . '/images', 'key_is_ok' => $spbc->key_is_ok, + 'secfw_enabled' => $spbc->settings['secfw__enabled'], 'ajax_nonce' => wp_create_nonce("spbc_secret_nonce"), 'ajaxurl' => admin_url('admin-ajax.php', 'relative'), //'debug' => !empty($debug) ? 1 : 0, diff --git a/inc/spbc-scanner.php b/inc/spbc-scanner.php index c665a46b0..dec22a893 100644 --- a/inc/spbc-scanner.php +++ b/inc/spbc-scanner.php @@ -124,7 +124,8 @@ function spbc_scanner_count_files($direct_call = false, $path = ABSPATH) 'dir_exceptions' => array(SPBC_PLUGIN_DIR . 'quarantine') ); if ( ! empty($spbc->settings['scanner__dir_exclusions'])) { - $init_params['dir_exceptions'] = array_merge($init_params['dir_exceptions'], explode("\n", $spbc->settings['scanner__dir_exclusions'])); + $excluded_dirs = spbc__get_exists_directories(explode("\n", $spbc->settings['scanner__dir_exclusions'])); + $init_params['dir_exceptions'] = array_merge($init_params['dir_exceptions'], $excluded_dirs); } $scaner = new Scanner\Surface($path_to_scan, $root_path, $init_params); @@ -437,19 +438,13 @@ function spbc_scanner_file_delete($direct_call = false, $file_id = null) $remembered_file_content = file_get_contents($file_path); $result = unlink($file_path); if ($result) { - $response_content = HTTP::getContentFromURL(get_option('home')); - $response_content_admin = HTTP::getContentFromURL(get_option('home') . '/wp-admin/'); - $response_code = HTTP::getResponseCode(get_option('home')); - $response_code_admin = HTTP::getResponseCode(get_option('home') . '/wp-admin/'); + $response_content = HTTP::getContentFromURL(get_option('home'), false); + $response_content_admin = HTTP::getContentFromURL(get_option('home') . '/wp-admin/', false); if ( isset( $response_content['error'], - $response_content_admin['error'], - $response_code['error'], - $response_code_admin['error'] + $response_content_admin['error'] ) || - (is_string($response_code) && preg_match('/5\d\d/', $response_code)) || - (is_string($response_code_admin) && preg_match('/5\d\d/', $response_code_admin)) || spbc_search_page_errors($response_content) || spbc_search_page_errors($response_content_admin) ) { @@ -1587,17 +1582,11 @@ function spbc_scanner_file_quarantine($direct_call = false, $file_id = null) if (unlink($root_path . $file_info['path'])) { $response_content = HTTP::getContentFromURL(get_option('home')); $response_content_admin = HTTP::getContentFromURL(get_option('home') . '/wp-admin/'); - $response_code = HTTP::getResponseCode(get_option('home')); - $response_code_admin = HTTP::getResponseCode(get_option('home') . '/wp-admin/'); if ( isset( $response_content['error'], - $response_content_admin['error'], - $response_code['error'], - $response_code_admin['error'] + $response_content_admin['error'] ) || - (is_string($response_code) && preg_match('/5\d\d/', $response_code)) || - (is_string($response_code_admin) && preg_match('/5\d\d/', $response_code_admin)) || spbc_search_page_errors($response_content) || spbc_search_page_errors($response_content_admin) ) { @@ -1730,12 +1719,12 @@ function spbc_scanner_file_download($direct_call = false, $file_id = null) if (is_readable($file_info['q_path'])) { // Getting file && API call $file_path = substr($file_info['q_path'], stripos($file_info['q_path'], 'wp-content')); - $file = HTTP::getContentFromURL(get_home_url() . '/' . $file_path); + $file_content = HTTP::getContentFromURL(get_home_url() . '/' . $file_path); - if ($file !== false) { + if (empty($file_content['error'])) { $output = array( 'file_name' => preg_replace('/.*(\/|\\\\)(.*)/', '$2', $file_info['path']), - 'file_content' => $file, + 'file_content' => $file_content, ); } else { $output = array('error' => 'FILE_EMPTY'); @@ -2062,3 +2051,21 @@ function spbc_restore_file_from_backup_ajax_action() wp_send_json_success(esc_html__('Success!', 'security-malware-firewall')); } + +/** + * @param $paths array + * + * @return array + */ +function spbc__get_exists_directories($paths) +{ + $exists_dirs = array(); + + foreach ($paths as $path) { + if (is_dir(ABSPATH . $path)) { + $exists_dirs[] = $path; + } + } + + return $exists_dirs; +} diff --git a/inc/spbc-settings.php b/inc/spbc-settings.php index 5bf220871..2388c98ba 100644 --- a/inc/spbc-settings.php +++ b/inc/spbc-settings.php @@ -114,7 +114,7 @@ function spbc_settings__register() // Firewall 'traffic_control' => array( 'type' => 'tab', - 'display' => $spbc->fw_enabled, + 'display' => $spbc->fw_enabled && $spbc->settings['secfw__enabled'], 'title' => __('Firewall', 'security-malware-firewall'), 'icon' => 'spbc-icon-exchange', 'class_prefix' => 'spbc', @@ -353,7 +353,7 @@ function spbc_settings__register() 'type' => 'field', 'title' => __('Change address to login script', 'security-malware-firewall'), 'description' => __('Please note that this will not hide the links to your registration page on your website.', 'security-malware-firewall'), - 'children' => array('login_page_rename__name', 'login_page_rename__redirect',), + 'children' => array('login_page_rename__name', 'login_page_rename__redirect', 'login_page_rename__send_email_notification'), ), 'login_page_rename__name' => array( 'display' => version_compare($wp_version, '4.0-RC1-src', '>='), @@ -380,6 +380,18 @@ function spbc_settings__register() 'class' => 'spbc_middle_text_field', 'parent' => 'login_page_rename__enabled', ), + 'login_page_rename__send_email_notification' => array( + 'display' => version_compare($wp_version, '4.0-RC1-src', '>='), + 'input_type' => 'checkbox', + 'type' => 'field', + 'title_first' => true, + 'title' => __('Send the notification with the new login page URL to the admin email address', 'security-malware-firewall'), + 'description' => __('The email will be send to', 'security-malware-firewall') + . ' (' . get_option('admin_email') . ')', + 'long_description' => true, + 'parent' => 'login_page_rename__enabled', + 'disabled' => !current_user_can('activate_plugins') + ), 'action_shuffle_salts' => array( 'type' => 'field', 'callback' => 'spbc_settings_field__action_shuffle_salts', @@ -397,6 +409,12 @@ function spbc_settings__register() 'type' => 'field', 'input_type' => 'hidden', ), + 'secfw__enabled' => array( + 'type' => 'field', + 'title' => __('Security FireWall', 'security-malware-firewall'), + 'description' => __('This option allows to filter bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.', 'security-malware-firewall'), + 'long_description' => true, + ), 'waf__enabled' => array( 'type' => 'field', 'title' => __('Web Application Firewall', 'security-malware-firewall'), @@ -2541,7 +2559,8 @@ function spbc_field_scanner__files_listing__data_prepare(&$table) $table->items[] = array( 'url' => "" . get_option('home') . "{$row->url}", 'type' => ucfirst($row->type) - . '', + . '' + . '', ); } } @@ -2639,17 +2658,6 @@ function spbc_field_scanner() _e('Found outdated plugins or themes. Please, update to latest versions.', 'security-malware-firewall'); echo '

'; - //* Debug Buttons - // Clear hashes - if (in_array(Server::getDomain(), array('lc', 'loc', 'lh', 'wordpress'), true)) { - echo '' - . '' - . '

'; - } - //*/ - echo '
' . '' . __('Receiving core hashes', 'security-malware-firewall') . ' -> ' @@ -2717,6 +2725,14 @@ function spbc_field_scanner() spbc_scan_results_log_module(); } + // Clear hashes + if (! empty($spbc->data['scanner']['last_scan'])) { + echo '' + . ''; + } + echo '
'; echo spbc_bulk_actions_description(); @@ -3167,7 +3183,7 @@ function spbc_list_table__get_args_by_type($table_type) 'sql' => array( 'where' => ' WHERE severity <> "CRITICAL" AND last_sent IS NULL AND - (status = "MODIFIED" AND severity IS NOT NULL) OR (status = "INFECTED" AND severity = "SUSPICIOUS")', + (status = "MODIFIED" AND severity IS NOT NULL) OR (status = "INFECTED" AND severity IN ("SUSPICIOUS","DANGER") )', ), 'order_by' => array('path' => 'asc'), ) @@ -3737,9 +3753,12 @@ function spbc_sanitize_settings($settings) || $settings['login_page_rename__redirect'] === '' ? $settings['login_page_rename__redirect'] : ''; - // Send email notification to admin if about changing login URL - if (empty($spbc->settings['login_page_rename__enabled']) && $settings['login_page_rename__enabled']) { + if ( + empty($spbc->settings['login_page_rename__enabled']) && + $settings['login_page_rename__enabled'] && + ($settings['login_page_rename__send_email_notification'] && current_user_can('activate_plugins')) + ) { $mail = wp_mail( get_option('admin_email'), $spbc->data["wl_brandname"] . esc_html__(': New login URL', 'security-malware-firewall'), @@ -3752,10 +3771,10 @@ function spbc_sanitize_settings($settings) ); // If email is not sent, disabling the feature - if ( ! $mail) { + if ( !$mail ) { $spbc->error_add( 'login_page_rename', - __('New login URL was not sent. Changes aborted.', 'security-malware-firewall') + __('Can not send notification email to the admin address. New login URL was not sent. Changes aborted.', 'security-malware-firewall') ); $settings['login_page_rename__enabled'] = '0'; } else { @@ -3763,6 +3782,10 @@ function spbc_sanitize_settings($settings) } } + if (!$settings['login_page_rename__send_email_notification']) { + $spbc->error_delete('login_page_rename', true); + } + // Send logs for 2 previous days if ($settings['misc__backend_logs_enable'] && ! $spbc->settings['misc__backend_logs_enable']) { //neither we show this in the UI, method spbc_PHP_logs__collect use time() value to collect logs correct @@ -3803,9 +3826,7 @@ function spbc_sanitize_settings($settings) $dirs = CSV::parseNSV($settings['scanner__dir_exclusions']); $settings['scanner__dir_exclusions'] = array(); foreach ($dirs as $dir) { - if (is_dir(ABSPATH . $dir)) { - $settings['scanner__dir_exclusions'][] = $dir; - } + $settings['scanner__dir_exclusions'][] = strtolower($dir); } $settings['scanner__dir_exclusions'] = implode("\n", $settings['scanner__dir_exclusions']); } @@ -4082,6 +4103,10 @@ function spbc_settings__get_description() : ''; $descriptions = array( + 'secfw__enabled' => array( + 'title' => __('Security FireWall', 'security-malware-firewall'), + 'desc' => __('Security FireWall is a part of the security service and blocks a malicious active before the site pages load.', 'security-malware-firewall') + ), 'waf__xss_check' => array( 'title' => __('XSS check', 'security-malware-firewall'), 'desc' => __('Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to any user. As a result malicious scripts can not get access to the cookie files, session tokens and any other confidential information browsers use and store. Such scripts can even overwrite content of HTML pages. ' . $spbc->data["wl_company_name"] . ' WAF monitors for patterns of these parameters and block them.', 'security-malware-firewall') @@ -4264,6 +4289,13 @@ function spbc_settings__get_description() 'title' => 'str_rot13()', 'desc' => __('Perform the rot13 transform on a string', 'security-malware-firewall') ), + 'login_page_rename__send_email_notification' => array( + 'title' => 'Send email with new login URL', + 'desc' => __('If enabled, the plugin will necessarily send the notification to the admin email before login URL is changed. + If email could not be sent, all the changes will be reverted. + Disable this option if you have mail connection issues or SMTP service is not configured on this WordPress instance. + Please note that only user that has permissions to activate plugins can disable this option.', 'security-malware-firewall'), + ), ); if (!isset($descriptions[ $setting_id ])) { @@ -4273,6 +4305,51 @@ function spbc_settings__get_description() wp_send_json($descriptions[ $setting_id ]); } +/** + * @return void + */ +function spbc_settings__get_recommendation() +{ + global $spbc; + + spbc_check_ajax_referer('spbc_secret_nonce', 'security'); + + if (!isset($_POST['setting_id'])) { + return; + } + + $setting_id = str_replace(' ', '_', $_POST['setting_id']); + + $recomendations = array( + 'listing' => array( + 'title' => __('Directory can be listed from the Internet', 'security-malware-firewall'), + 'desc' => __('The listing of a directory allows an attacker to see the files inside the folder and the very existence of the folder. So if he sees ".git" folder is open for the listing, he can assume that you are using GIT technology and could exploit the known security issues to hack the website.', 'security-malware-firewall') + ), + 'accessible' => array( + 'title' => __('File is accessible from the Internet', 'security-malware-firewall'), + 'desc' => __('To solve this issue rename or move the debug.log') + . '

' + . '' + . __('More info', 'security-malware-firewall') + . '' + ), + 'unsafe_permissions' => array( + 'title' => __('You likely do need to modify file permissions', 'security-malware-firewall'), + 'desc' => __('Do it via FTP or hosting control panel. Set 644 for files and 755 for folders. If you are not sure, contact your hosting provider.', 'security-malware-firewall') + . '

' + . '' + . __('More info', 'security-malware-firewall') + . '' + ), + ); + + if (!isset($recomendations[ $setting_id ])) { + return; + } + + wp_send_json($recomendations[ $setting_id ]); +} + function spbc_show_GDPR_text() { return wpautop('The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided. @@ -4617,7 +4694,8 @@ function spbc_scanner__last_scan_info($direct_call = false) isset($spbc->data['scanner']['scanned_total']) ? $spbc->data['scanner']['scanned_total'] : null ); if ($spbc->settings['scanner__outbound_links']) { - $output .= sprintf(' ' . __('Outbound links found: %s.', 'security-malware-firewall'), isset($spbc->data['scanner']['last_scan_links_amount']) ? $spbc->data['scanner']['last_scan_links_amount'] : 0); + $count_outbound_links = (string)spbc__get_count_outbound_links(); + $output .= sprintf(' ' . __('Outbound links found: %s.', 'security-malware-firewall'), $count_outbound_links); } } else { $output = __('Website hasn\'t been scanned yet.', 'security-malware-firewall'); @@ -4645,8 +4723,9 @@ function spbc_get_next_scan_launch_time_text() && isset($task['next_call']) ) { return sprintf( - ' ' . __('The next automatic scan is scheduled on %s.', 'security-malware-firewall'), - date('M d Y H:i:s e ' . spbc_wp_timezone_string(), $task['next_call']) + ' ' . __('The next automatic scan is scheduled on %s %s.', 'security-malware-firewall'), + date('M d Y H:i:s', $task['next_call']), + spbc_wp_timezone_string() ); } return ''; @@ -4718,3 +4797,12 @@ function spbc_field_scanner__prepare_data__file_monitoring_files(&$table) { $table = Scanner\FileMonitoringModule\FileMonitoringTabData::prepareDataToAccordion($table); } + +function spbc__get_count_outbound_links() +{ + global $wpdb; + + return $wpdb->get_var( + "SELECT COUNT(*) FROM " . SPBC_TBL_SCAN_LINKS . ";" + ); +} diff --git a/inc/spbc-tools.php b/inc/spbc-tools.php index 9149d978f..1f6629805 100644 --- a/inc/spbc-tools.php +++ b/inc/spbc-tools.php @@ -276,7 +276,7 @@ function spbc_wp_timezone_string() $abs_hour = abs($hours); $abs_mins = abs($minutes * 60); - return sprintf('%s%02d:%02d', $sign, $abs_hour, $abs_mins); + return sprintf('%s %s%02d:%02d', date('e'), $sign, $abs_hour, $abs_mins); } /** diff --git a/js/spbc-scanner-plugin.min.js b/js/spbc-scanner-plugin.min.js index 5032782d1..14df29394 100644 --- a/js/spbc-scanner-plugin.min.js +++ b/js/spbc-scanner-plugin.min.js @@ -1,2 +1,2 @@ -"use strict";class spbcMalwareScanner{first_start=!0;active=!1;root="";settings=[];states=["get_cms_hashes","get_modules_hashes","clean_results","file_system_analysis","get_approved_hashes","signature_analysis","heuristic_analysis","auto_cure_backup","auto_cure","outbound_links","frontend_analysis","important_files_listing","send_results"];state=null;offset=0;amount=0;total_scanned=0;scan_percent=0;percent_completed=0;paused=!1;button=null;spinner=null;progress_overall=null;progressbar=null;progressbar_text=null;timeout=6e4;state_timer=0;constructor(t){for(var s in console.log("init"),jQuery("#spbcscan-results-log-module").length&&jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),void 0!==t.settings.auto_cure&&(t.settings.scanner__auto_cure_backup="1"),t)void 0!==this[s]&&(this[s]=t[s])}actionControl(){null===this.state?this.start():this.paused?(this.resume(),this.controller()):this.pause()}start(){this.active=!0,this.state_timer=Math.round((new Date).getTime()/1e3),this.state=this.getNextState(null),this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold"),this.progressbar.show(500),this.progress_overall.show(500),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),setTimeout(()=>{this.controller()},1e3)}pause(t,s,e){console.log("PAUSE"),this.button.html(spbcScaner.button_scan_resume),this.spinner.css({display:"none"}),this.paused=!0,this.active=!1}resume(t){console.log("RESUME"),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),this.paused=!1,this.active=!0}end(t){this.progressbar.hide(500),this.progress_overall.hide(500),this.button.html(spbcScaner.button_scan_perform),this.spinner.css({display:"none"}),this.state=null,this.total_links=0,this.plug=!1,this.total_scanned=0,this.active=!1,t?document.location=document.location:spbc_sendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(t,s,e,a){jQuery(a).accordion("destroy").html(t).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide(),spbc_scanner__reload_scan_info()}},jQuery("#spbc_scan_accordion"))}controller(t){if(console.log(this.state),void 0!==t&&t.end){if(this.state=this.getNextState(this.state),void 0===this.state)return void this.end();this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold")}if(!0!==this.paused){var s={action:"spbc_scanner_controller_front",method:this.state,offset:this.offset},t={type:"GET",success:this.success,callback:this.successCallback,error:this.error,errorOutput:this.errorOutput,complete:null,context:this,timeout:12e4};switch(this.state){case"get_modules_hashes":this.amount=2;break;case"clear_table":this.amount=1e4;break;case"file_system_analysis":this.amount=700;break;case"auto_cure":this.amount=5;break;case"outbound_links":this.amount=10;break;case"frontend_analysis":this.amount=spbcSettings.frontendAnalysisAmount;break;case"signature_analysis":this.amount=10,s.status="UNKNOWN,MODIFIED,OK,INFECTED";break;case"heuristic_analysis":this.amount=4,s.status="UNKNOWN,MODIFIED,OK,INFECTED"}s.amount=this.amount,spbc_sendAJAXRequest(s,t,jQuery("#spbc_scan_accordion"))}}getNextState(t){return t=null===t?this.states[0]:this.states[this.states.indexOf(t)+1],t=void 0!==this.settings["scanner__"+t]&&0==+this.settings["scanner__"+t]?this.getNextState(t):t}setPercents(t){this.percent_completed=Math.floor(100*t)/100,this.progressbar.progressbar("option","value",this.percent_completed),this.progressbar_text.text(spbcScaner["progressbar_"+this.state]+" - "+this.percent_completed+"%")}success(t){t.error?this.error({status:200,responseText:t.error},t.error,t.msg):this.successCallback&&this.successCallback(t,this.data,this.obj)}successCallback(t){console.log(t),void 0!==t.total&&(this.scan_percent=100/t.total),void 0!==t.processed_items&&("heuristic_analysis"===this.state&&0!==typeof t.total&&this.logRaw('

Heuristic Analysis

'),"signature_analysis"===this.state&&0!==typeof t.total&&this.logRaw('

Signature Analysis

'),this.logFileEntry(t.processed_items)),void 0!==t.stage_data_for_logging&&this.logStageEntry(t.stage_data_for_logging),"undefined"!==t.cured&&0{this.controller(t)},300))}error(t,s,e){var a=this.errorOutput;if(console.log("%c APBCT_AJAX_ERROR","color: red;"),console.log(s),console.log(e),console.log(t),200===t.status)if("parsererror"===s)a("Unexpected response from server. See console for details.",this.state),console.log("%c "+t.responseText,"color: pink;");else{let t=s;void 0!==e&&(t+=" Additional info: "+e),a(t,this.state)}else 500===t.status?a("Internal server error.",this.state):a("Unexpected response code: "+t.status+". Error: "+s,this.state);this.progressbar&&this.progressbar.fadeOut("slow"),this.end()}errorOutput(t,s){spbcModal.open().putError(t+"
Stage: "+s)}logRaw(t){jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper .panel-body").prepend(t)}logFileEntry(t){for(var s in t)this.logRaw('

'+this.getSiteUTCShiftedTimeString()+" - "+t[s].path+": "+t[s].status+"

")}logStageEntry(t){this.logRaw('

'+this.getSiteUTCShiftedTimeString()+" - "+t.title+" "+t.description+"

")}showLinkForShuffleSalts(t){jQuery("#spbc_notice_about_shuffle_link").remove(),jQuery(jQuery(".spbc_tab--active .spbc_wrapper_field p")[1]).after('")}getSiteUTCShiftedTimeString(){var t=!1,s=-1*(new Date).getTimezoneOffset()*1e3*60,s=(t="undefined"!=typeof spbcScaner&&void 0!==spbcScaner.timezone_shift&&!1!==spbcScaner.timezone_shift?Date.now()-s+1e3*spbcScaner.timezone_shift:t)?new Date(t):new Date,t=new Intl.DateTimeFormat("en-US",{month:"short"}).format,e=String(s.getMinutes()).padStart(2,"0"),a=String(s.getSeconds()).padStart(2,"0");return t(s)+" "+s.getDate()+" "+s.getFullYear()+" "+s.getHours()+":"+e+":"+a}} +"use strict";class spbcMalwareScanner{first_start=!0;active=!1;root="";settings=[];states=["get_cms_hashes","get_modules_hashes","clean_results","file_system_analysis","get_approved_hashes","signature_analysis","heuristic_analysis","auto_cure_backup","auto_cure","outbound_links","frontend_analysis","important_files_listing","send_results"];state=null;offset=0;amount=0;total_scanned=0;scan_percent=0;percent_completed=0;paused=!1;button=null;spinner=null;progress_overall=null;progressbar=null;progressbar_text=null;timeout=6e4;state_timer=0;constructor(s){for(var t in console.log("init"),jQuery("#spbcscan-results-log-module").length&&jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),void 0!==s.settings.auto_cure&&(s.settings.scanner__auto_cure_backup="1"),s)void 0!==this[t]&&(this[t]=s[t])}actionControl(){null===this.state?this.start():this.paused?(this.resume(),this.controller()):this.pause()}start(){this.active=!0,this.state_timer=Math.round((new Date).getTime()/1e3),this.state=this.getNextState(null),this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold"),this.progressbar.show(500),this.progress_overall.show(500),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),setTimeout(()=>{this.controller()},1e3)}pause(s,t,e){console.log("PAUSE"),this.button.html(spbcScaner.button_scan_resume),this.spinner.css({display:"none"}),this.paused=!0,this.active=!1}resume(s){console.log("RESUME"),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),this.paused=!1,this.active=!0}end(s){this.progressbar.hide(500),this.progress_overall.hide(500),this.button.html(spbcScaner.button_scan_perform),this.spinner.css({display:"none"}),this.state=null,this.total_links=0,this.plug=!1,this.total_scanned=0,this.active=!1,s?document.location=document.location:(spbc_sendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(s,t,e,a){jQuery(a).accordion("destroy").html(s).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide(),spbc_scanner__reload_scan_info()}},jQuery("#spbc_scan_accordion")),jQuery("#spbc_scanner_clear").length||jQuery('
').insertBefore("#spbcscan-scanner-caption"))}controller(s){if(console.log(this.state),void 0!==s&&s.end){if(this.state=this.getNextState(this.state),void 0===this.state)return void this.end();this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold")}if(!0!==this.paused){var t={action:"spbc_scanner_controller_front",method:this.state,offset:this.offset},s={type:"GET",success:this.success,callback:this.successCallback,error:this.error,errorOutput:this.errorOutput,complete:null,context:this,timeout:12e4};switch(this.state){case"get_modules_hashes":this.amount=2;break;case"clear_table":this.amount=1e4;break;case"file_system_analysis":this.amount=700;break;case"auto_cure":this.amount=5;break;case"outbound_links":this.amount=10;break;case"frontend_analysis":this.amount=spbcSettings.frontendAnalysisAmount;break;case"signature_analysis":this.amount=10,t.status="UNKNOWN,MODIFIED,OK,INFECTED";break;case"heuristic_analysis":this.amount=4,t.status="UNKNOWN,MODIFIED,OK,INFECTED"}t.amount=this.amount,spbc_sendAJAXRequest(t,s,jQuery("#spbc_scan_accordion"))}}getNextState(s){return s=null===s?this.states[0]:this.states[this.states.indexOf(s)+1],s=void 0!==this.settings["scanner__"+s]&&0==+this.settings["scanner__"+s]?this.getNextState(s):s}setPercents(s){this.percent_completed=Math.floor(100*s)/100,this.progressbar.progressbar("option","value",this.percent_completed),this.progressbar_text.text(spbcScaner["progressbar_"+this.state]+" - "+this.percent_completed+"%")}success(s){s.error?this.error({status:200,responseText:s.error},s.error,s.msg):this.successCallback&&this.successCallback(s,this.data,this.obj)}successCallback(s){console.log(s),void 0!==s.total&&(this.scan_percent=100/s.total),void 0!==s.processed_items&&("heuristic_analysis"===this.state&&0!==typeof s.total&&this.logRaw('

Heuristic Analysis

'),"signature_analysis"===this.state&&0!==typeof s.total&&this.logRaw('

Signature Analysis

'),this.logFileEntry(s.processed_items)),void 0!==s.stage_data_for_logging&&this.logStageEntry(s.stage_data_for_logging),"undefined"!==s.cured&&0{this.controller(s)},300))}error(s,t,e){var a=this.errorOutput;if(console.log("%c APBCT_AJAX_ERROR","color: red;"),console.log(t),console.log(e),console.log(s),200===s.status)if("parsererror"===t)a("Unexpected response from server. See console for details.",this.state),console.log("%c "+s.responseText,"color: pink;");else{let s=t;void 0!==e&&(s+=" Additional info: "+e),a(s,this.state)}else 500===s.status?a("Internal server error.",this.state):a("Unexpected response code: "+s.status+". Error: "+t,this.state);this.progressbar&&this.progressbar.fadeOut("slow"),this.end()}errorOutput(s,t){spbcModal.open().putError(s+"
Stage: "+t)}logRaw(s){jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper .panel-body").prepend(s)}logFileEntry(s){for(var t in s)this.logRaw('

'+this.getSiteUTCShiftedTimeString()+" - "+s[t].path+": "+s[t].status+"

")}logStageEntry(s){this.logRaw('

'+this.getSiteUTCShiftedTimeString()+" - "+s.title+" "+s.description+"

")}showLinkForShuffleSalts(s){jQuery("#spbc_notice_about_shuffle_link").remove(),jQuery(jQuery(".spbc_tab--active .spbc_wrapper_field p")[1]).after('")}getSiteUTCShiftedTimeString(){var s=!1,t=-1*(new Date).getTimezoneOffset()*1e3*60,t=(s="undefined"!=typeof spbcScaner&&void 0!==spbcScaner.timezone_shift&&!1!==spbcScaner.timezone_shift?Date.now()-t+1e3*spbcScaner.timezone_shift:s)?new Date(s):new Date,s=new Intl.DateTimeFormat("en-US",{month:"short"}).format,e=String(t.getMinutes()).padStart(2,"0"),a=String(t.getSeconds()).padStart(2,"0");return s(t)+" "+t.getDate()+" "+t.getFullYear()+" "+t.getHours()+":"+e+":"+a}} //# sourceMappingURL=spbc-scanner-plugin.min.js.map diff --git a/js/spbc-scanner-plugin.min.js.map b/js/spbc-scanner-plugin.min.js.map index 7a80aced5..f818345b5 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';\n\nclass spbcMalwareScanner{\n\n\tfirst_start = true;\n\n\tactive = false;\n\n\troot = '';\n\tsettings = [];\n\tstates = [\n\t\t'get_cms_hashes',\n\t\t'get_modules_hashes',\n\t\t'clean_results',\n\t\t'file_system_analysis',\n\t\t'get_approved_hashes',\n\t\t'signature_analysis',\n\t\t'heuristic_analysis',\n\t\t'auto_cure_backup',\n\t\t'auto_cure',\n\t\t'outbound_links',\n\t\t'frontend_analysis',\n\t\t'important_files_listing',\n\t\t'send_results',\n\t];\n\tstate = null;\n\toffset = 0;\n\tamount = 0;\n\ttotal_scanned = 0;\n\tscan_percent = 0;\n\tpercent_completed = 0;\n\n\tpaused = false;\n\n\tbutton = null;\n\tspinner = null;\n\n\tprogress_overall = null;\n\tprogressbar = null;\n\tprogressbar_text = null;\n\n\ttimeout = 60000;\n\n\tstate_timer = 0;\n\n\tconstructor ( properties ) {\n\n\t\tconsole.log('init');\n\t\tif (jQuery('#spbcscan-results-log-module').length) {\n\t\t\tjQuery('.spbc-scan-log-title').removeClass('spbc---hidden')\n\t\t}\n\n\t\t// Crunch for cure backups\n\t\tif( typeof properties['settings']['auto_cure'] !== 'undefined' ){\n\t\t\tproperties['settings']['scanner__auto_cure_backup'] = '1';\n\t\t}\n\n\t\tfor( let key in properties ){\n\t\t\tif( typeof this[key] !== 'undefined' ){\n\t\t\t\tthis[key] = properties[key];\n\t\t\t}\n\t\t}\n\n\t};\n\n\tactionControl(){\n\n\t\tif(this.state === null){\n\t\t\tthis.start();\n\n\t\t}else if(this.paused){\n\t\t\tthis.resume();\n\t\t\tthis.controller();\n\n\t\t}else{\n\t\t\tthis.pause();\n\t\t}\n\t};\n\n\tstart(){\n\n\t\tthis.active = true;\n\t\tthis.state_timer = Math.round(new Date().getTime() /1000);\n\n\t\tthis.state = this.getNextState( null );\n\n\t\tthis.setPercents( 0 );\n\t\tthis.scan_percent = 0;\n\t\tthis.offset = 0;\n\t\tthis.progress_overall.children('span')\n\t\t\t.removeClass('spbc_bold')\n\t\t\t.filter('.spbc_overall_scan_status_' + this.state)\n\t\t\t.addClass('spbc_bold');\n\n\t\tthis.progressbar.show(500);\n\t\tthis.progress_overall.show(500);\n\t\tthis.button.html(spbcScaner.button_scan_pause);\n\t\tthis.spinner.css({display: 'inline'});\n\n\t\tsetTimeout(() => {\n\t\t\tthis.controller();\n\t\t}, 1000);\n\n\t};\n\n\tpause( result, data, opt ){\n\t\tconsole.log('PAUSE');\n\t\tthis.button.html(spbcScaner.button_scan_resume);\n\t\tthis.spinner.css({display: 'none'});\n\t\tthis.paused = true;\n\t\tthis.active = false;\n\t};\n\n\tresume( opt ){\n\t\tconsole.log('RESUME');\n\t\tthis.button.html(spbcScaner.button_scan_pause);\n\t\tthis.spinner.css({display: 'inline'});\n\t\tthis.paused = false;\n\t\tthis.active = true;\n\t};\n\n\tend( reload ){\n\n\t\tthis.progressbar.hide(500);\n\t\tthis.progress_overall.hide(500);\n\t\tthis.button.html(spbcScaner.button_scan_perform);\n\t\tthis.spinner.css({display: 'none'});\n\t\tthis.state = null;\n\t\tthis.total_links = 0;\n\t\tthis.plug = false;\n\t\tthis.total_scanned = 0;\n\t\tthis.active = false;\n\n\t\tif(reload){\n\t\t\tdocument.location = document.location;\n\t\t}else{\n\t\t\tspbc_sendAJAXRequest(\n\t\t\t\t{action: 'spbc_scanner_tab__reload_accordion'},\n\t\t\t\t{\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tjQuery(obj).accordion('destroy')\n\t\t\t\t\t\t\t.html(result)\n\t\t\t\t\t\t\t.accordion({\n\t\t\t\t\t\t\t\theader: 'h3',\n\t\t\t\t\t\t\t\theightStyle: 'content',\n\t\t\t\t\t\t\t\tcollapsible: true,\n\t\t\t\t\t\t\t\tactive: false,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tspbc_tbl__bulk_actions__listen();\n\t\t\t\t\t\tspbc_tbl__row_actions__listen();\n\t\t\t\t\t\tspbc_tbl__pagination__listen();\n\t\t\t\t\t\tspbc_tbl__sort__listen();\n\t\t\t\t\t\tspbcStartShowHide();\n\t\t\t\t\t\tspbc_scanner__reload_scan_info();\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tjQuery('#spbc_scan_accordion')\n\t\t\t);\n\t\t}\n\n\t};\n\n\tcontroller( result ) {\n\n\t\tconsole.log(this.state);\n\n\t\t// The current stage is over. Switching to the new one\n\t\tif( typeof result !== 'undefined' && result.end ){\n\n\t\t\tthis.state = this.getNextState( this.state );\n\n\t\t\t// End condition\n\t\t\tif (typeof this.state === 'undefined'){\n\t\t\t\tthis.end();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set percent to 0\n\t\t\tthis.setPercents( 0 );\n\t\t\tthis.scan_percent = 0;\n\t\t\tthis.offset = 0;\n\n\t\t\t// Changing visualizing of the current stage\n\t\t\tthis.progress_overall.children('span')\n\t\t\t\t.removeClass('spbc_bold')\n\t\t\t\t.filter('.spbc_overall_scan_status_' + this.state)\n\t\t\t\t.addClass('spbc_bold');\n\t\t}\n\n\t\t// Break execution if paused\n\t\tif( this.paused === true )\n\t\t\treturn;\n\n\t\t// // AJAX params\n\t\tlet data = {\n\t\t\taction: 'spbc_scanner_controller_front',\n\t\t\tmethod: this.state,\n\t\t\toffset: this.offset,\n\t\t};\n\n\t\tvar params = {\n\t\t\ttype: 'GET',\n\t\t\tsuccess: this.success,\n\t\t\tcallback: this.successCallback,\n\t\t\terror: this.error,\n\t\t\terrorOutput: this.errorOutput,\n\t\t\tcomplete: null,\n\t\t\tcontext: this,\n\t\t\ttimeout: 120000\n\t\t};\n\n\t\tswitch (this.state) {\n\t\t\tcase 'get_modules_hashes': this.amount = 2; break;\n\t\t\tcase 'clear_table': this.amount = 10000; break;\n\t\t\tcase 'file_system_analysis': this.amount = 700; break;\n\t\t\tcase 'auto_cure': this.amount = 5; break;\n\t case 'outbound_links': this.amount = 10; break;\n\t case 'frontend_analysis': this.amount = spbcSettings.frontendAnalysisAmount; break;\n\t\t\tcase 'signature_analysis': this.amount = 10; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED'; break;\n\t\t\tcase 'heuristic_analysis': this.amount = 4; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED'; break;\n\t\t}\n\n\t\tdata.amount = this.amount;\n\n\t\tspbc_sendAJAXRequest(\n\t\t\tdata,\n\t\t\tparams,\n\t\t\tjQuery('#spbc_scan_accordion')\n\t\t);\n\n\t};\n\n\tgetNextState( state ) {\n\n\t\tstate = state === null ? this.states[0] : this.states[ this.states.indexOf( state ) + 1 ];\n\n\t\tif (typeof this.settings[ 'scanner__' + state ] !== 'undefined' && +this.settings[ 'scanner__' + state ] === 0)\n\t\t\tstate = this.getNextState( state );\n\n\t\treturn state;\n\t};\n\n\tsetPercents( percents ){\n\t\tthis.percent_completed = Math.floor( percents * 100 ) / 100;\n\t\tthis.progressbar.progressbar( 'option', 'value', this.percent_completed );\n\t\tthis.progressbar_text.text( spbcScaner[ 'progressbar_' + this.state ] + ' - ' + this.percent_completed + '%' );\n\t};\n\n\tsuccess( response ){\n\n\t\tif( !! response.error ){\n\n\t\t\tthis.error(\n\t\t\t\t{status: 200, responseText: response.error},\n\t\t\t\tresponse.error,\n\t\t\t\tresponse.msg\n\t\t\t);\n\n\t\t}else{\n\t\t\tif( this.successCallback )\n\t\t\t\tthis.successCallback( response, this.data, this.obj );\n\t\t}\n\n\t};\n\n\t// Processing response from backend\n\tsuccessCallback( result ){\n\n\t\tconsole.log( result );\n\n\t\tif( typeof result.total !== 'undefined' )\n\t\t\tthis.scan_percent = 100 / result.total;\n\n\t\tif( typeof result.processed_items !== 'undefined'){\n\n\t\t\tif( this.state === 'heuristic_analysis' && typeof result.total !== 0 )\n\t\t\t\tthis.logRaw('

Heuristic Analysis

');\n\t\t\tif( this.state === 'signature_analysis' && typeof result.total !== 0 )\n\t\t\t\tthis.logRaw('

Signature Analysis

');\n\n\t\t\tthis.logFileEntry( result.processed_items );\n\t\t}\n\n\t\tif( typeof result.stage_data_for_logging !== 'undefined'){\n\t\t\tthis.logStageEntry( result.stage_data_for_logging );\n\t\t}\n\n\t\t// Add link on shuffle salt if cured\n\t\tif (result.cured !== 'undefined' && Number(result.cured) > 0) {\n\t\t\tthis.showLinkForShuffleSalts(result.message);\n\t\t}\n\n\t\tif( result.end !== true && result.end !== 1 ){\n\t\t\tthis.setPercents( this.percent_completed + result.processed * this.scan_percent );\n\t\t\tthis.offset = this.offset + result.processed;\n\t\t\tthis.controller( result );\n\t\t}else{\n\t\t\tconsole.log( this.state + \" stage took \" + ( Math.round(new Date().getTime() /1000) - this.state_timer ) + \" seconds to complete\" );\n\t\t\tthis.state_timer = Math.round(new Date().getTime()/1000);\n\t\t\tthis.setPercents( 100 );\n\t\t\tthis.scan_percent = 0;\n\t\t\tthis.offset = 0;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.controller( result );\n\t\t\t}, 300);\n\t\t}\n\t};\n\n\terror( xhr, status, error ){\n\n\t\tlet errorOutput = this.errorOutput;\n\n\t\tconsole.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n\t\tconsole.log( status );\n\t\tconsole.log( error );\n\t\tconsole.log( xhr );\n\n\t\tif( xhr.status === 200 ){\n\t\t\tif( status === 'parsererror' ){\n\t\t\t\terrorOutput( 'Unexpected response from server. See console for details.', this.state );\n\t\t\t\tconsole.log( '%c ' + xhr.responseText, 'color: pink;' );\n\t\t\t}else{\n\t\t\t\tlet error_string = status;\n\t\t\t\tif( typeof error !== 'undefined' )\n\t\t\t\t\terror_string += ' Additional info: ' + error;\n\t\t\t\terrorOutput( error_string, this.state );\n\t\t\t}\n\t\t}else if(xhr.status === 500){\n\t\t\terrorOutput( 'Internal server error.', this.state);\n\t\t}else\n\t\t\terrorOutput('Unexpected response code: ' + xhr.status + '. Error: ' + status, this.state);\n\n\t\tif( this.progressbar )\n\t\t\tthis.progressbar.fadeOut('slow');\n\n\t\tthis.end();\n\t};\n\n\terrorOutput( error_msg, stage ){\n\t\tspbcModal.open().putError( error_msg + '
Stage: ' + stage);\n\t};\n\n\tlogRaw(message_to_log ){\n\t\tjQuery('.spbc-scan-log-title').removeClass('spbc---hidden');\n\t\tjQuery('.spbc_log-wrapper').removeClass('spbc---hidden');\n\t\tjQuery('.spbc_log-wrapper .panel-body').prepend( message_to_log );\n\t};\n\n\tlogFileEntry(items){\n\t\tfor ( var key in items ){\n\t\t\tthis.logRaw( '

' + 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'
' +\n\t\t\t\t'' +\n\t\t\t\tmessage +\n\t\t\t\t'' +\n\t\t\t\t'
'\n\t\t\t);\n\t}\n\n\tgetSiteUTCShiftedTimeString(){\n\t\tvar utc_shifted_ts = false;\n\t\t//gettings current system/browser offset\n\t\tvar current_browser_offset = new Date().getTimezoneOffset();\n\t\tcurrent_browser_offset = current_browser_offset * -1 * 1000 * 60;\n\t\t//chek if global ct object is defined\n\t\tif (typeof spbcScaner !== \"undefined\"\n\t\t\t&& typeof spbcScaner.timezone_shift !== \"undefined\"\n\t\t\t&& spbcScaner.timezone_shift !== false){\n\t\t\tutc_shifted_ts = Date.now() - current_browser_offset + (spbcScaner.timezone_shift * 1000);\n\t\t}\n\t\tvar ct_date = utc_shifted_ts ? new Date(utc_shifted_ts) : new Date();\n\t\t//construct date string\n\t\tvar shortMonthName = new Intl.DateTimeFormat(\"en-US\", { month: \"short\" }).format;\n\t\tvar minutes = String(ct_date.getMinutes()).padStart(2, '0');\n\t\tvar seconds = String(ct_date.getSeconds()).padStart(2, '0');\n\t\treturn shortMonthName(ct_date) + ' ' + ct_date.getDate() + ' ' + ct_date.getFullYear() + ' ' + ct_date.getHours() + ':' + minutes + ':' + seconds\n\t}\n\n}"],"names":["spbcMalwareScanner","first_start","active","root","settings","states","state","offset","amount","total_scanned","scan_percent","percent_completed","paused","button","spinner","progress_overall","progressbar","progressbar_text","timeout","state_timer","constructor","properties","let","key","console","log","jQuery","length","removeClass","this","actionControl","start","resume","controller","pause","Math","round","Date","getTime","getNextState","setPercents","children","filter","addClass","show","html","spbcScaner","button_scan_pause","css","display","setTimeout","result","data","opt","button_scan_resume","end","reload","hide","button_scan_perform","total_links","plug","document","location","spbc_sendAJAXRequest","action","notJson","callback","params","obj","accordion","header","heightStyle","collapsible","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","spbc_scanner__reload_scan_info","method","type","success","successCallback","error","errorOutput","complete","context","spbcSettings","frontendAnalysisAmount","status","indexOf","percents","floor","text","response","responseText","msg","total","processed_items","logRaw","logFileEntry","stage_data_for_logging","logStageEntry","cured","Number","showLinkForShuffleSalts","message","processed","xhr","error_string","fadeOut","error_msg","stage","spbcModal","open","putError","message_to_log","prepend","items","getSiteUTCShiftedTimeString","path","title","description","remove","after","utc_shifted_ts","current_browser_offset","getTimezoneOffset","ct_date","timezone_shift","now","shortMonthName","Intl","DateTimeFormat","month","format","minutes","String","getMinutes","padStart","seconds","getSeconds","getDate","getFullYear","getHours"],"mappings":"AAAA,mBAEMA,mBAELC,YAAc,CAAA,EAEdC,OAAS,CAAA,EAETC,KAAQ,GACRC,SAAW,GACXC,OAAS,CACR,iBACA,qBACA,gBACA,uBACA,sBACA,qBACA,qBACA,mBACA,YACA,iBACA,oBACA,0BACA,gBAEDC,MAAQ,K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ugin.min.js","sources":["spbc-scanner-plugin.js"],"sourcesContent":["'use strict';\n\nclass spbcMalwareScanner{\n\n\tfirst_start = true;\n\n\tactive = false;\n\n\troot = '';\n\tsettings = [];\n\tstates = [\n\t\t'get_cms_hashes',\n\t\t'get_modules_hashes',\n\t\t'clean_results',\n\t\t'file_system_analysis',\n\t\t'get_approved_hashes',\n\t\t'signature_analysis',\n\t\t'heuristic_analysis',\n\t\t'auto_cure_backup',\n\t\t'auto_cure',\n\t\t'outbound_links',\n\t\t'frontend_analysis',\n\t\t'important_files_listing',\n\t\t'send_results',\n\t];\n\tstate = null;\n\toffset = 0;\n\tamount = 0;\n\ttotal_scanned = 0;\n\tscan_percent = 0;\n\tpercent_completed = 0;\n\n\tpaused = false;\n\n\tbutton = null;\n\tspinner = null;\n\n\tprogress_overall = null;\n\tprogressbar = null;\n\tprogressbar_text = null;\n\n\ttimeout = 60000;\n\n\tstate_timer = 0;\n\n\tconstructor ( properties ) {\n\n\t\tconsole.log('init');\n\t\tif (jQuery('#spbcscan-results-log-module').length) {\n\t\t\tjQuery('.spbc-scan-log-title').removeClass('spbc---hidden')\n\t\t}\n\n\t\t// Crunch for cure backups\n\t\tif( typeof properties['settings']['auto_cure'] !== 'undefined' ){\n\t\t\tproperties['settings']['scanner__auto_cure_backup'] = '1';\n\t\t}\n\n\t\tfor( let key in properties ){\n\t\t\tif( typeof this[key] !== 'undefined' ){\n\t\t\t\tthis[key] = properties[key];\n\t\t\t}\n\t\t}\n\n\t};\n\n\tactionControl(){\n\n\t\tif(this.state === null){\n\t\t\tthis.start();\n\n\t\t}else if(this.paused){\n\t\t\tthis.resume();\n\t\t\tthis.controller();\n\n\t\t}else{\n\t\t\tthis.pause();\n\t\t}\n\t};\n\n\tstart(){\n\n\t\tthis.active = true;\n\t\tthis.state_timer = Math.round(new Date().getTime() /1000);\n\n\t\tthis.state = this.getNextState( null );\n\n\t\tthis.setPercents( 0 );\n\t\tthis.scan_percent = 0;\n\t\tthis.offset = 0;\n\t\tthis.progress_overall.children('span')\n\t\t\t.removeClass('spbc_bold')\n\t\t\t.filter('.spbc_overall_scan_status_' + this.state)\n\t\t\t.addClass('spbc_bold');\n\n\t\tthis.progressbar.show(500);\n\t\tthis.progress_overall.show(500);\n\t\tthis.button.html(spbcScaner.button_scan_pause);\n\t\tthis.spinner.css({display: 'inline'});\n\n\t\tsetTimeout(() => {\n\t\t\tthis.controller();\n\t\t}, 1000);\n\n\t};\n\n\tpause( result, data, opt ){\n\t\tconsole.log('PAUSE');\n\t\tthis.button.html(spbcScaner.button_scan_resume);\n\t\tthis.spinner.css({display: 'none'});\n\t\tthis.paused = true;\n\t\tthis.active = false;\n\t};\n\n\tresume( opt ){\n\t\tconsole.log('RESUME');\n\t\tthis.button.html(spbcScaner.button_scan_pause);\n\t\tthis.spinner.css({display: 'inline'});\n\t\tthis.paused = false;\n\t\tthis.active = true;\n\t};\n\n\tend( reload ){\n\n\t\tthis.progressbar.hide(500);\n\t\tthis.progress_overall.hide(500);\n\t\tthis.button.html(spbcScaner.button_scan_perform);\n\t\tthis.spinner.css({display: 'none'});\n\t\tthis.state = null;\n\t\tthis.total_links = 0;\n\t\tthis.plug = false;\n\t\tthis.total_scanned = 0;\n\t\tthis.active = false;\n\n\t\tif(reload){\n\t\t\tdocument.location = document.location;\n\t\t}else{\n\t\t\tspbc_sendAJAXRequest(\n\t\t\t\t{action: 'spbc_scanner_tab__reload_accordion'},\n\t\t\t\t{\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tjQuery(obj).accordion('destroy')\n\t\t\t\t\t\t\t.html(result)\n\t\t\t\t\t\t\t.accordion({\n\t\t\t\t\t\t\t\theader: 'h3',\n\t\t\t\t\t\t\t\theightStyle: 'content',\n\t\t\t\t\t\t\t\tcollapsible: true,\n\t\t\t\t\t\t\t\tactive: false,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tspbc_tbl__bulk_actions__listen();\n\t\t\t\t\t\tspbc_tbl__row_actions__listen();\n\t\t\t\t\t\tspbc_tbl__pagination__listen();\n\t\t\t\t\t\tspbc_tbl__sort__listen();\n\t\t\t\t\t\tspbcStartShowHide();\n\t\t\t\t\t\tspbc_scanner__reload_scan_info();\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tjQuery('#spbc_scan_accordion')\n\t\t\t);\n\n\t\t\tif (!jQuery('#spbc_scanner_clear').length) {\n\t\t\t\tlet clear_link = '

Clear scanner logs


';\n\t\t\t\tjQuery(clear_link).insertBefore('#spbcscan-scanner-caption');\n\t\t\t}\n\t\t}\n\n\t};\n\n\tcontroller( result ) {\n\n\t\tconsole.log(this.state);\n\n\t\t// The current stage is over. Switching to the new one\n\t\tif( typeof result !== 'undefined' && result.end ){\n\n\t\t\tthis.state = this.getNextState( this.state );\n\n\t\t\t// End condition\n\t\t\tif (typeof this.state === 'undefined'){\n\t\t\t\tthis.end();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set percent to 0\n\t\t\tthis.setPercents( 0 );\n\t\t\tthis.scan_percent = 0;\n\t\t\tthis.offset = 0;\n\n\t\t\t// Changing visualizing of the current stage\n\t\t\tthis.progress_overall.children('span')\n\t\t\t\t.removeClass('spbc_bold')\n\t\t\t\t.filter('.spbc_overall_scan_status_' + this.state)\n\t\t\t\t.addClass('spbc_bold');\n\t\t}\n\n\t\t// Break execution if paused\n\t\tif( this.paused === true )\n\t\t\treturn;\n\n\t\t// // AJAX params\n\t\tlet data = {\n\t\t\taction: 'spbc_scanner_controller_front',\n\t\t\tmethod: this.state,\n\t\t\toffset: this.offset,\n\t\t};\n\n\t\tvar params = {\n\t\t\ttype: 'GET',\n\t\t\tsuccess: this.success,\n\t\t\tcallback: this.successCallback,\n\t\t\terror: this.error,\n\t\t\terrorOutput: this.errorOutput,\n\t\t\tcomplete: null,\n\t\t\tcontext: this,\n\t\t\ttimeout: 120000\n\t\t};\n\n\t\tswitch (this.state) {\n\t\t\tcase 'get_modules_hashes': this.amount = 2; break;\n\t\t\tcase 'clear_table': this.amount = 10000; break;\n\t\t\tcase 'file_system_analysis': this.amount = 700; break;\n\t\t\tcase 'auto_cure': this.amount = 5; break;\n\t case 'outbound_links': this.amount = 10; break;\n\t case 'frontend_analysis': this.amount = spbcSettings.frontendAnalysisAmount; break;\n\t\t\tcase 'signature_analysis': this.amount = 10; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED'; break;\n\t\t\tcase 'heuristic_analysis': this.amount = 4; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED'; break;\n\t\t}\n\n\t\tdata.amount = this.amount;\n\n\t\tspbc_sendAJAXRequest(\n\t\t\tdata,\n\t\t\tparams,\n\t\t\tjQuery('#spbc_scan_accordion')\n\t\t);\n\n\t};\n\n\tgetNextState( state ) {\n\n\t\tstate = state === null ? this.states[0] : this.states[ this.states.indexOf( state ) + 1 ];\n\n\t\tif (typeof this.settings[ 'scanner__' + state ] !== 'undefined' && +this.settings[ 'scanner__' + state ] === 0)\n\t\t\tstate = this.getNextState( state );\n\n\t\treturn state;\n\t};\n\n\tsetPercents( percents ){\n\t\tthis.percent_completed = Math.floor( percents * 100 ) / 100;\n\t\tthis.progressbar.progressbar( 'option', 'value', this.percent_completed );\n\t\tthis.progressbar_text.text( spbcScaner[ 'progressbar_' + this.state ] + ' - ' + this.percent_completed + '%' );\n\t};\n\n\tsuccess( response ){\n\n\t\tif( !! response.error ){\n\n\t\t\tthis.error(\n\t\t\t\t{status: 200, responseText: response.error},\n\t\t\t\tresponse.error,\n\t\t\t\tresponse.msg\n\t\t\t);\n\n\t\t}else{\n\t\t\tif( this.successCallback )\n\t\t\t\tthis.successCallback( response, this.data, this.obj );\n\t\t}\n\n\t};\n\n\t// Processing response from backend\n\tsuccessCallback( result ){\n\n\t\tconsole.log( result );\n\n\t\tif( typeof result.total !== 'undefined' )\n\t\t\tthis.scan_percent = 100 / result.total;\n\n\t\tif( typeof result.processed_items !== 'undefined'){\n\n\t\t\tif( this.state === 'heuristic_analysis' && typeof result.total !== 0 )\n\t\t\t\tthis.logRaw('

Heuristic Analysis

');\n\t\t\tif( this.state === 'signature_analysis' && typeof result.total !== 0 )\n\t\t\t\tthis.logRaw('

Signature Analysis

');\n\n\t\t\tthis.logFileEntry( result.processed_items );\n\t\t}\n\n\t\tif( typeof result.stage_data_for_logging !== 'undefined'){\n\t\t\tthis.logStageEntry( result.stage_data_for_logging );\n\t\t}\n\n\t\t// Add link on shuffle salt if cured\n\t\tif (result.cured !== 'undefined' && Number(result.cured) > 0) {\n\t\t\tthis.showLinkForShuffleSalts(result.message);\n\t\t}\n\n\t\tif( result.end !== true && result.end !== 1 ){\n\t\t\tthis.setPercents( this.percent_completed + result.processed * this.scan_percent );\n\t\t\tthis.offset = this.offset + result.processed;\n\t\t\tthis.controller( result );\n\t\t}else{\n\t\t\tconsole.log( this.state + \" stage took \" + ( Math.round(new Date().getTime() /1000) - this.state_timer ) + \" seconds to complete\" );\n\t\t\tthis.state_timer = Math.round(new Date().getTime()/1000);\n\t\t\tthis.setPercents( 100 );\n\t\t\tthis.scan_percent = 0;\n\t\t\tthis.offset = 0;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.controller( result );\n\t\t\t}, 300);\n\t\t}\n\t};\n\n\terror( xhr, status, error ){\n\n\t\tlet errorOutput = this.errorOutput;\n\n\t\tconsole.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n\t\tconsole.log( status );\n\t\tconsole.log( error );\n\t\tconsole.log( xhr );\n\n\t\tif( xhr.status === 200 ){\n\t\t\tif( status === 'parsererror' ){\n\t\t\t\terrorOutput( 'Unexpected response from server. See console for details.', this.state );\n\t\t\t\tconsole.log( '%c ' + xhr.responseText, 'color: pink;' );\n\t\t\t}else{\n\t\t\t\tlet error_string = status;\n\t\t\t\tif( typeof error !== 'undefined' )\n\t\t\t\t\terror_string += ' Additional info: ' + error;\n\t\t\t\terrorOutput( error_string, this.state );\n\t\t\t}\n\t\t}else if(xhr.status === 500){\n\t\t\terrorOutput( 'Internal server error.', this.state);\n\t\t}else\n\t\t\terrorOutput('Unexpected response code: ' + xhr.status + '. Error: ' + status, this.state);\n\n\t\tif( this.progressbar )\n\t\t\tthis.progressbar.fadeOut('slow');\n\n\t\tthis.end();\n\t};\n\n\terrorOutput( error_msg, stage ){\n\t\tspbcModal.open().putError( error_msg + '
Stage: ' + stage);\n\t};\n\n\tlogRaw(message_to_log ){\n\t\tjQuery('.spbc-scan-log-title').removeClass('spbc---hidden');\n\t\tjQuery('.spbc_log-wrapper').removeClass('spbc---hidden');\n\t\tjQuery('.spbc_log-wrapper .panel-body').prepend( message_to_log );\n\t};\n\n\tlogFileEntry(items){\n\t\tfor ( var key in items ){\n\t\t\tthis.logRaw( '

' + 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'
' +\n\t\t\t\t'' +\n\t\t\t\tmessage +\n\t\t\t\t'' +\n\t\t\t\t'
'\n\t\t\t);\n\t}\n\n\tgetSiteUTCShiftedTimeString(){\n\t\tvar utc_shifted_ts = false;\n\t\t//gettings current system/browser offset\n\t\tvar current_browser_offset = new Date().getTimezoneOffset();\n\t\tcurrent_browser_offset = current_browser_offset * -1 * 1000 * 60;\n\t\t//chek if global ct object is defined\n\t\tif (typeof spbcScaner !== \"undefined\"\n\t\t\t&& typeof spbcScaner.timezone_shift !== \"undefined\"\n\t\t\t&& spbcScaner.timezone_shift !== false){\n\t\t\tutc_shifted_ts = Date.now() - current_browser_offset + (spbcScaner.timezone_shift * 1000);\n\t\t}\n\t\tvar ct_date = utc_shifted_ts ? new Date(utc_shifted_ts) : new Date();\n\t\t//construct date string\n\t\tvar shortMonthName = new Intl.DateTimeFormat(\"en-US\", { month: \"short\" }).format;\n\t\tvar minutes = String(ct_date.getMinutes()).padStart(2, '0');\n\t\tvar seconds = String(ct_date.getSeconds()).padStart(2, '0');\n\t\treturn shortMonthName(ct_date) + ' ' + ct_date.getDate() + ' ' + ct_date.getFullYear() + ' ' + ct_date.getHours() + ':' + minutes + ':' + seconds\n\t}\n\n}"],"names":["spbcMalwareScanner","first_start","active","root","settings","states","state","offset","amount","total_scanned","scan_percent","percent_completed","paused","button","spinner","progress_overall","progressbar","progressbar_text","timeout","state_timer","constructor","properties","let","key","console","log","jQuery","length","removeClass","this","actionControl","start","resume","controller","pause","Math","round","Date","getTime","getNextState","setPercents","children","filter","addClass","show","html","spbcScaner","button_scan_pause","css","display","setTimeout","result","data","opt","button_scan_resume","end","reload","hide","button_scan_perform","total_links","plug","document","location","spbc_sendAJAXRequest","action","notJson","callback","params","obj","accordion","header","heightStyle","collapsible","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","spbc_scanner__reload_scan_info","insertBefore","method","type","success","successCallback","error","errorOutput","complete","context","spbcSettings","frontendAnalysisAmount","status","indexOf","percents","floor","text","response","responseText","msg","total","processed_items","logRaw","logFileEntry","stage_data_for_logging","logStageEntry","cured","Number","showLinkForShuffleSalts","message","processed","xhr","error_string","fadeOut","error_msg","stage","spbcModal","open","putError","message_to_log","prepend","items","getSiteUTCShiftedTimeString","path","title","description","remove","after","utc_shifted_ts","current_browser_offset","getTimezoneOffset","ct_date","timezone_shift","now","shortMonthName","Intl","DateTimeFormat","month","format","minutes","String","getMinutes","padStart","seconds","getSeconds","getDate","getFullYear","getHours"],"mappings":"AAAA,mBAEMA,mBAELC,YAAc,CAAA,EAEdC,OAAS,CAAA,EAETC,KAAQ,GACRC,SAAW,GACXC,OAAS,CACR,iBACA,qBAC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,CAAO,EAAI,IAAMA,EAAQc,QAAQ,EAAI,IAAMd,EAAQe,YAAY,EAAI,IAAMf,EAAQgB,SAAS,EAAI,IAAMR,EAAU,IAAMI,CAC3I,CAED"} \ No newline at end of file diff --git a/js/spbc-settings.min.js b/js/spbc-settings.min.js index a8660f610..3912541c8 100644 --- a/js/spbc-settings.min.js +++ b/js/spbc-settings.min.js @@ -1,2 +1,2 @@ -function spbc_switchTab(e,t){var s=e.classList[1].replace("spbc_tab_nav-",""),c=new URLSearchParams(window.location.search),n=(c.set("spbc_tab",s),window.location.hash),n=window.location.pathname+"?"+c.toString()+n;if(history.replaceState(null,"",n),"backups"!==c.get("spbc_tab")&&jQuery(".spbc_tab_nav-backups").hide(),jQuery(".spbc_tab_nav").removeClass("spbc_tab_nav--active"),jQuery(".spbc_tab").removeClass("spbc_tab--active"),jQuery(e).addClass("spbc_tab_nav--active"),jQuery(".spbc_tab-"+s).addClass("spbc_tab--active"),jQuery(e).data("loaded")){if(t&&t.action)switch(t.action){case"highlight":spbcHighlightElement(t.target,t.times);break;case"click":setTimeout(function(){jQuery("#"+t.additional.target).click()},500)}}else{n={action:"spbc_settings__draw_elements",tab_name:s,security:spbcSettings.ajax_nonce},t={callback:spbc_draw_settings_callback,notJson:!0,additional:t||null};spbc_sendAJAXRequest(n,t,e)}}function spbc_draw_settings_callback(e,t,s,c){jQuery(c).data("loaded",!0),jQuery(".spbc_tab-"+t.tab_name).replaceWith(e);c=jQuery(".spbc_tab-"+t.tab_name);if(c.addClass("spbc_tab--active"),jQuery(document).off("click",".spbc_long_description__show"),jQuery(document).on("click",".spbc_long_description__show",function(){spbc_settings__show_description(self=jQuery(this),self.attr("setting"))}),s.additional)switch(s.additional.action){case"highlight":spbcHighlightElement(s.additional.target,s.additional.times);break;case"click":setTimeout(function(){jQuery("#"+s.additional.target).click()},500)}jQuery(c).on("click",".spbc_hint-send_"+t.tab_name,function(){jQuery(".spbc_hint-send_"+t.tab_name).hide(),spbc_sendAJAXRequest({action:"spbc_send_"+t.tab_name,tab_name:t.tab_name},{callback:spbc_send_logs_callback})}),window.location.hash&&document.getElementById(window.location.hash.substring(1)).scrollIntoView()}function spbc_send_logs_callback(e,t,s,c){jQuery(".spbc_tab_nav-"+t.tab_name).data("loaded",!1),spbc_switchTab(document.getElementsByClassName("spbc_tab_nav-"+t.tab_name)[0])}function spbcSettingsDependenciesbyId(e,o){"string"==typeof e&&((tmp=[]).push(e),e=tmp),o=void 0===o?null:+o,e.forEach(function(e,t,s){function c(){a.setAttribute("disabled","disabled")}function n(){a.removeAttribute("disabled")}var a=document.getElementById("spbc_setting_"+e);(null!==o?1===o?n:c:null===a.getAttribute("disabled")?c:n)()})}function spbcSettingsDependencies(e,o){e="string"==typeof e?e.split(","):e,o=void 0===o?+event.target.checked:+o,e.forEach(function(e,t,s){document.getElementsByName("spbc_settings["+e+"]").forEach(function(e,t,s){function c(){e.setAttribute("disabled","disabled")}function n(){e.removeAttribute("disabled")}(null!==o?1===o?n:c:null===e.getAttribute("disabled")?c:n)();var a=e.getAttribute("children");null!==a&&spbcSettingsDependencies(a,o&&e.checked)})})}function spbc_settings__show_description(e,t){function n(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_long_desc").length&&!jQuery(e.target).hasClass("spbc_long_desc__cancel")||jQuery(e.target).hasClass("spbc_long_description__show"))||(jQuery(".spbc_long_desc").remove(),jQuery(document).off("click",n))}n(),e.after("
");var s=jQuery("#spbc_long_desc__"+t);s.append("").append("
").css({top:e.position().top+25,left:e.position().left+5}),spbc_sendAJAXRequest({action:"spbc_settings__get_description",setting_id:t},{spinner:s.children("img"),callback:function(e,t,s,c){c.empty().append("
").append("").append("

"+e.title+"

").append("

"+e.desc+"

"),jQuery(document).on("click",n)}},s)}function spbcStartShowHide(){jQuery(".spbcShortText").off("mouseover").on("mouseover",function(){jQuery(this).next().show()}).off("mouseout").on("mouseout",function(){jQuery(this).next().hide()}),jQuery(".spbcFullText").off("mouseout").on("mouseout",function(){jQuery(this).hide()}).off("mouseover").on("mouseover",function(){jQuery(this).show()})}function spbctGenerateConfirmationCode(){var e={},t={success:!1};return e.security=spbcSettings.ajax_nonce,e.action="spbc_generate_confirmation_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?t.success=!0:t.text=e.data}}),t}function spbctCheckConfirmationCode(e,t,s){var c=e,e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_confirmation_code",e.code=jQuery("#confirmation-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("[name *= 2fa__enable]").attr("checked",""),c.checked=!0,jQuery("#spbc_setting_2fa__roles").removeAttr("disabled"),jQuery("#spbc_setting_2fa__roles > option:first").attr("selected","selected"),clearTimeout(t),s.remove(),jQuery("#confirmation-code").dialog("close")):alert("Code verification failed!")}})}function spbc_banner_check(){var n=setInterval(function(){spbc_sendAJAXRequest({action:"spbc_settings__check_renew_banner"},{callback:function(e,t,s,c){e.close_renew_banner&&(jQuery("#spbc_renew_notice").length&&jQuery("#spbc_renew_notice").hide("slow"),jQuery("#spbc_trial_notice").length&&jQuery("#spbc_trial_notice").hide("slow"),clearInterval(n))}})},6e4)}String.prototype.printf=function(){var e,t=this;for(e in arguments)var s=t.substring(0,t.indexOf("%s",0)),c=t.substring(t.indexOf("%s",0)+2,t.length),t=s+arguments[e]+c;return t},jQuery(document).ready(function(){jQuery("#spbc_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery(document).on("click","[name*=fa__enable]:not([value=0]),#confirmation-code--resend",function(e){e.preventDefault(),jQuery("#confirmation-code--resend").attr("disabled","disabled").append('
');var t=setTimeout(function(){jQuery("#confirmation-code--resend").removeAttr("disabled"),jQuery("#confirmation-code--resend>.circle").remove()},3e4),s=spbctGenerateConfirmationCode();s.success?(jQuery("#confirmation-code input").val(""),jQuery("#confirmation-code").dialog({modal:!0,title:"Confirmation code",width:310,buttons:{Cancel:function(){jQuery(this).dialog("close"),clearTimeout(t),jQuery("#confirmation-code--resend>.circle").remove()},Ok:function(){spbctCheckConfirmationCode(e.target,t,jQuery("#confirmation-code--resend>.circle"))}},draggable:!1,resizable:!1})):alert(s.text)}),(jQuery("#spbc_renew_notice").length||jQuery("#spbc_trial_notice").length)&&spbc_banner_check(),jQuery("#spbc_button__sync").on("click",function(){spbc_sendAJAXRequest({action:"spbc_sync"},{timeout:25e3,button:document.getElementById("spbc_button__sync"),spinner:jQuery("#spbc_button__sync .spbc_preloader_button"),callback:function(e,t,s,c){jQuery("#spbc_button__sync .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_button__sync .spbc_success").hide(300)},2e3),e.reload&&document.location.reload()}})}),spbcSettings.key_changed&&jQuery("#spbc_button__sync").click(),jQuery(document).on("click","#spbc_setting_get_key_auto",function(){spbc_sendAJAXRequest({action:"spbc_get_key_auto"},{timeout:25e3,button:document.getElementById("spbc_setting_get_key_auto"),spinner:jQuery("#spbc_setting_get_key_auto .spbc_preloader_button"),callback:function(e,t,s,c){jQuery("#spbc_setting_get_key_auto .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_setting_get_key_auto .spbc_success").hide(300)},2e3),e.reload&&document.location.reload(),e.getTemplates&&(spbcModal.loaded=e.getTemplates,spbcModal.open(),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}))}})}),jQuery(document).on("click","#spbc_settings_templates_import_button",function(){jQuery("#spbc-ajax-result").remove();var n,e=jQuery("option:selected",jQuery("#spbc_settings_templates_import"));jQuery("#spbc_settings_templates_import_name").css("border-color","inherit"),void 0===e.data("id")?console.log('Attribute "data-id" not set for the option.'):(e={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")},n=this,spbc_sendAJAXRequest({action:"spbc_settings_templates_import",data:e},{timeout:25e3,button:n,spinner:jQuery("#spbc_settings_templates_import_button .spbc_preloader_button"),callback:function(e,t,s,c){e.success?(jQuery("

"+e.data+"

").insertAfter(jQuery(n)),jQuery("#spbc_settings_templates_import_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_import_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):jQuery("

"+e.data+"

").insertAfter(jQuery(n))}}))}),jQuery(document).on("click","#spbc_settings_templates_export_button",function(){jQuery("#spbc-ajax-result").remove();var e=jQuery("option:selected",jQuery("#spbc_settings_templates_export")),t=jQuery("#spbc_settings_templates_export_name");if(t.css("border-color","inherit"),void 0===e.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===e.data("id")){var s=t.val();if(""===s)return void t.css("border-color","red");s={template_name:s}}else s={template_id:e.data("id")};var n=this;spbc_sendAJAXRequest({action:"spbc_settings_templates_export",data:s},{timeout:25e3,button:n,spinner:jQuery("#spbc_settings_templates_export_button .spbc_preloader_button"),callback:function(e,t,s,c){e.success?(jQuery("

"+e.data+"

").insertAfter(jQuery(n)),jQuery("#spbc_settings_templates_export_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_export_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):jQuery("

"+e.data+"

").insertAfter(jQuery(n))}})}}),jQuery(document).on("click","#spbc_settings_templates_reset_button",function(){var n=this;spbc_sendAJAXRequest({action:"spbc_settings_templates_reset"},{timeout:25e3,button:n,spinner:jQuery("#spbc_settings_templates_reset_button .spbc_preloader_button"),callback:function(e,t,s,c){e.success?(jQuery("

"+e.data+"

").insertAfter(jQuery(n)),jQuery("#spbc_settings_templates_reset_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_reset_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):jQuery("

"+e.data+"

").insertAfter(jQuery(n))}})}),jQuery(document).on("change","#spbc_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#spbc_settings_templates_export_name").show():jQuery(this).parent().parent().find("#spbc_settings_templates_export_name").hide()}),jQuery(".spbc_tab_nav-summary").data("loaded",!0),jQuery(".spbc_tabs_nav_wrapper").on("click",".spbc_tab_nav",function(e){spbc_switchTab(e.currentTarget)});var e={target:location.search.match(/spbc_target=(\S*?)(&|$)/)?location.search.match(/spbc_target=(\S*?)(&|$)/)[1]:null,action:location.search.match(/spbc_action=(\S*?)(&|$)/)?location.search.match(/spbc_action=(\S*?)(&|$)/)[1]:null,times:location.search.match(/spbc_times=(\S*?)(&|$)/)?location.search.match(/spbc_times=(\S*?)(&|$)/)[1]:3},t=(e.target=location.search.match(/spbc_highlight=(\S*?)(&|$)/)?location.search.match(/spbc_highlight=(\S*?)(&|$)/)[1]:e.target,e.action=-1!=location.search.search(/spbc_highlight=(\S*?)(&|$)/)?"highlight":e.action,document.getElementsByClassName("spbc_tab_nav-"+(location.search.match(/spbc_tab=(\S*?)(&|$)/)?location.search.match(/spbc_tab=(\S*?)(&|$)/)[1]:""))[0]||null),s=(t||(+spbcSettings.debug?t=document.getElementsByClassName("spbc_tab_nav-debug")[0]:+spbcSettings.wpms&&!+spbcSettings.is_main_site?t=document.getElementsByClassName("spbc_tab_nav-security_log")[0]:+spbcSettings.key_is_ok?t=document.getElementsByClassName("spbc_tab_nav-traffic_control")[0]:(t=document.getElementsByClassName("spbc_tab_nav-settings_general")[0],e={target:"spbc_key",action:"highlight",times:3})),t&&spbc_switchTab(t,e),!1);jQuery(document).on("keyup",function(e){17==(e.which||e.keyCode)&&(s=!1)}),jQuery(document).on("keydown",function(e){var t;116==(e.which||e.keyCode)&&s?(e.preventDefault(),"scanner"!==(t=jQuery(".spbc_tab_nav--active")[0]).classList[1].replace("spbc_tab_nav-","")&&(jQuery(t).data("loaded",!1),spbc_switchTab(t))):17==(e.which||e.keyCode)&&(s=!0)})}); +function spbc_switchTab(e,t){var s=e.classList[1].replace("spbc_tab_nav-",""),c=new URLSearchParams(window.location.search),n=(c.set("spbc_tab",s),window.location.hash),n=window.location.pathname+"?"+c.toString()+n;if(history.replaceState(null,"",n),"backups"!==c.get("spbc_tab")&&jQuery(".spbc_tab_nav-backups").hide(),jQuery(".spbc_tab_nav").removeClass("spbc_tab_nav--active"),jQuery(".spbc_tab").removeClass("spbc_tab--active"),jQuery(e).addClass("spbc_tab_nav--active"),jQuery(".spbc_tab-"+s).addClass("spbc_tab--active"),jQuery(e).data("loaded")){if(t&&t.action)switch(t.action){case"highlight":spbcHighlightElement(t.target,t.times);break;case"click":setTimeout(function(){jQuery("#"+t.additional.target).click()},500)}}else{n={action:"spbc_settings__draw_elements",tab_name:s,security:spbcSettings.ajax_nonce},t={callback:spbc_draw_settings_callback,notJson:!0,additional:t||null};spbc_sendAJAXRequest(n,t,e)}}function spbc_draw_settings_callback(e,t,s,c){jQuery(c).data("loaded",!0),jQuery(".spbc_tab-"+t.tab_name).replaceWith(e);c=jQuery(".spbc_tab-"+t.tab_name);if(c.addClass("spbc_tab--active"),jQuery(document).off("click",".spbc_long_description__show"),jQuery(document).on("click",".spbc_long_description__show",function(){spbc_settings__show_description(self=jQuery(this),self.attr("setting"))}),jQuery(document).off("click",".spbc_long_recommendation__show"),jQuery(document).on("click",".spbc_long_recommendation__show",function(){spbc_settings__show_recommendation(self=jQuery(this),self.attr("setting"))}),s.additional)switch(s.additional.action){case"highlight":spbcHighlightElement(s.additional.target,s.additional.times);break;case"click":setTimeout(function(){jQuery("#"+s.additional.target).click()},500)}jQuery(c).on("click",".spbc_hint-send_"+t.tab_name,function(){jQuery(".spbc_hint-send_"+t.tab_name).hide(),spbc_sendAJAXRequest({action:"spbc_send_"+t.tab_name,tab_name:t.tab_name},{callback:spbc_send_logs_callback})}),window.location.hash&&document.getElementById(window.location.hash.substring(1)).scrollIntoView()}function spbc_send_logs_callback(e,t,s,c){jQuery(".spbc_tab_nav-"+t.tab_name).data("loaded",!1),spbc_switchTab(document.getElementsByClassName("spbc_tab_nav-"+t.tab_name)[0])}function spbcSettingsDependenciesbyId(e,o){"string"==typeof e&&((tmp=[]).push(e),e=tmp),o=void 0===o?null:+o,e.forEach(function(e,t,s){function c(){a.setAttribute("disabled","disabled")}function n(){a.removeAttribute("disabled")}var a=document.getElementById("spbc_setting_"+e);(null!==o?1===o?n:c:null===a.getAttribute("disabled")?c:n)()})}function spbcSettingsDependencies(e,o){e="string"==typeof e?e.split(","):e,o=void 0===o?+event.target.checked:+o,e.forEach(function(e,t,s){document.getElementsByName("spbc_settings["+e+"]").forEach(function(e,t,s){function c(){e.setAttribute("disabled","disabled")}function n(){e.removeAttribute("disabled")}(null!==o?1===o?n:c:null===e.getAttribute("disabled")?c:n)();var a=e.getAttribute("children");null!==a&&spbcSettingsDependencies(a,o&&e.checked)})})}function spbc_settings__show_description(e,t){function n(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_long_desc").length&&!jQuery(e.target).hasClass("spbc_long_desc__cancel")||jQuery(e.target).hasClass("spbc_long_description__show"))||(jQuery(".spbc_long_desc").remove(),jQuery(document).off("click",n))}n(),e.after("
");var s=jQuery("#spbc_long_desc__"+t);s.append("").append("
").css({top:e.position().top+25,left:e.position().left+5}),spbc_sendAJAXRequest({action:"spbc_settings__get_description",setting_id:t},{spinner:s.children("img"),callback:function(e,t,s,c){c.empty().append("
").append("").append("

"+e.title+"

").append("

"+e.desc+"

"),jQuery(document).on("click",n)}},s)}function spbc_settings__show_recommendation(e,t){function n(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_long_desc").length&&!jQuery(e.target).hasClass("spbc_long_desc__cancel")||jQuery(e.target).hasClass("spbc_long_recommendation__show"))||(jQuery(".spbc_long_desc").remove(),jQuery(document).off("click",n))}n(),e.after("
");var s=jQuery("#spbc_long_desc__"+t);s.append("").append("
").css({top:e.position().top+25,left:e.position().left+5}),spbc_sendAJAXRequest({action:"spbc_settings__get_recommendation",setting_id:t},{spinner:s.children("img"),callback:function(e,t,s,c){c.empty().append("
").append("").append("

"+e.title+"

").append("

"+e.desc+"

"),jQuery(document).on("click",n)}},s)}function spbcStartShowHide(){jQuery(".spbcShortText").off("mouseover").on("mouseover",function(){jQuery(this).next().show()}).off("mouseout").on("mouseout",function(){jQuery(this).next().hide()}),jQuery(".spbcFullText").off("mouseout").on("mouseout",function(){jQuery(this).hide()}).off("mouseover").on("mouseover",function(){jQuery(this).show()})}function spbctGenerateConfirmationCode(){var e={},t={success:!1};return e.security=spbcSettings.ajax_nonce,e.action="spbc_generate_confirmation_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?t.success=!0:t.text=e.data}}),t}function spbctCheckConfirmationCode(e,t,s){var c=e,e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_confirmation_code",e.code=jQuery("#confirmation-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("[name *= 2fa__enable]").attr("checked",""),c.checked=!0,jQuery("#spbc_setting_2fa__roles").removeAttr("disabled"),jQuery("#spbc_setting_2fa__roles > option:first").attr("selected","selected"),clearTimeout(t),s.remove(),jQuery("#confirmation-code").dialog("close")):alert("Code verification failed!")}})}function spbc_banner_check(){var n=setInterval(function(){spbc_sendAJAXRequest({action:"spbc_settings__check_renew_banner"},{callback:function(e,t,s,c){e.close_renew_banner&&(jQuery("#spbc_renew_notice").length&&jQuery("#spbc_renew_notice").hide("slow"),jQuery("#spbc_trial_notice").length&&jQuery("#spbc_trial_notice").hide("slow"),clearInterval(n))}})},6e4)}String.prototype.printf=function(){var e,t=this;for(e in arguments)var s=t.substring(0,t.indexOf("%s",0)),c=t.substring(t.indexOf("%s",0)+2,t.length),t=s+arguments[e]+c;return t},jQuery(document).ready(function(){jQuery("#spbc_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery(document).on("click","[name*=fa__enable]:not([value=0]),#confirmation-code--resend",function(e){e.preventDefault(),jQuery("#confirmation-code--resend").attr("disabled","disabled").append('
');var t=setTimeout(function(){jQuery("#confirmation-code--resend").removeAttr("disabled"),jQuery("#confirmation-code--resend>.circle").remove()},3e4),s=spbctGenerateConfirmationCode();s.success?(jQuery("#confirmation-code input").val(""),jQuery("#confirmation-code").dialog({modal:!0,title:"Confirmation code",width:310,buttons:{Cancel:function(){jQuery(this).dialog("close"),clearTimeout(t),jQuery("#confirmation-code--resend>.circle").remove()},Ok:function(){spbctCheckConfirmationCode(e.target,t,jQuery("#confirmation-code--resend>.circle"))}},draggable:!1,resizable:!1})):alert(s.text)}),(jQuery("#spbc_renew_notice").length||jQuery("#spbc_trial_notice").length)&&spbc_banner_check(),jQuery("#spbc_button__sync").on("click",function(){spbc_sendAJAXRequest({action:"spbc_sync"},{timeout:25e3,button:document.getElementById("spbc_button__sync"),spinner:jQuery("#spbc_button__sync .spbc_preloader_button"),callback:function(e,t,s,c){jQuery("#spbc_button__sync .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_button__sync .spbc_success").hide(300)},2e3),e.reload&&document.location.reload()}})}),spbcSettings.key_changed&&jQuery("#spbc_button__sync").click(),jQuery(document).on("click","#spbc_setting_get_key_auto",function(){spbc_sendAJAXRequest({action:"spbc_get_key_auto"},{timeout:25e3,button:document.getElementById("spbc_setting_get_key_auto"),spinner:jQuery("#spbc_setting_get_key_auto .spbc_preloader_button"),callback:function(e,t,s,c){jQuery("#spbc_setting_get_key_auto .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_setting_get_key_auto .spbc_success").hide(300)},2e3),e.reload&&document.location.reload(),e.getTemplates&&(spbcModal.loaded=e.getTemplates,spbcModal.open(),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}))}})}),jQuery(document).on("click","#spbc_settings_templates_import_button",function(){jQuery("#spbc-ajax-result").remove();var n,e=jQuery("option:selected",jQuery("#spbc_settings_templates_import"));jQuery("#spbc_settings_templates_import_name").css("border-color","inherit"),void 0===e.data("id")?console.log('Attribute "data-id" not set for the option.'):(e={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")},n=this,spbc_sendAJAXRequest({action:"spbc_settings_templates_import",data:e},{timeout:25e3,button:n,spinner:jQuery("#spbc_settings_templates_import_button .spbc_preloader_button"),callback:function(e,t,s,c){e.success?(jQuery("

"+e.data+"

").insertAfter(jQuery(n)),jQuery("#spbc_settings_templates_import_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_import_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):jQuery("

"+e.data+"

").insertAfter(jQuery(n))}}))}),jQuery(document).on("click","#spbc_settings_templates_export_button",function(){jQuery("#spbc-ajax-result").remove();var e=jQuery("option:selected",jQuery("#spbc_settings_templates_export")),t=jQuery("#spbc_settings_templates_export_name");if(t.css("border-color","inherit"),void 0===e.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===e.data("id")){var s=t.val();if(""===s)return void t.css("border-color","red");s={template_name:s}}else s={template_id:e.data("id")};var n=this;spbc_sendAJAXRequest({action:"spbc_settings_templates_export",data:s},{timeout:25e3,button:n,spinner:jQuery("#spbc_settings_templates_export_button .spbc_preloader_button"),callback:function(e,t,s,c){e.success?(jQuery("

"+e.data+"

").insertAfter(jQuery(n)),jQuery("#spbc_settings_templates_export_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_export_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):jQuery("

"+e.data+"

").insertAfter(jQuery(n))}})}}),jQuery(document).on("click","#spbc_settings_templates_reset_button",function(){var n=this;spbc_sendAJAXRequest({action:"spbc_settings_templates_reset"},{timeout:25e3,button:n,spinner:jQuery("#spbc_settings_templates_reset_button .spbc_preloader_button"),callback:function(e,t,s,c){e.success?(jQuery("

"+e.data+"

").insertAfter(jQuery(n)),jQuery("#spbc_settings_templates_reset_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_reset_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):jQuery("

"+e.data+"

").insertAfter(jQuery(n))}})}),jQuery(document).on("change","#spbc_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#spbc_settings_templates_export_name").show():jQuery(this).parent().parent().find("#spbc_settings_templates_export_name").hide()}),jQuery(".spbc_tab_nav-summary").data("loaded",!0),jQuery(".spbc_tabs_nav_wrapper").on("click",".spbc_tab_nav",function(e){spbc_switchTab(e.currentTarget)});var e={target:location.search.match(/spbc_target=(\S*?)(&|$)/)?location.search.match(/spbc_target=(\S*?)(&|$)/)[1]:null,action:location.search.match(/spbc_action=(\S*?)(&|$)/)?location.search.match(/spbc_action=(\S*?)(&|$)/)[1]:null,times:location.search.match(/spbc_times=(\S*?)(&|$)/)?location.search.match(/spbc_times=(\S*?)(&|$)/)[1]:3},t=(e.target=location.search.match(/spbc_highlight=(\S*?)(&|$)/)?location.search.match(/spbc_highlight=(\S*?)(&|$)/)[1]:e.target,e.action=-1!=location.search.search(/spbc_highlight=(\S*?)(&|$)/)?"highlight":e.action,document.getElementsByClassName("spbc_tab_nav-"+(location.search.match(/spbc_tab=(\S*?)(&|$)/)?location.search.match(/spbc_tab=(\S*?)(&|$)/)[1]:""))[0]||null),s=(t||(+spbcSettings.debug?t=document.getElementsByClassName("spbc_tab_nav-debug")[0]:+spbcSettings.wpms&&!+spbcSettings.is_main_site?t=document.getElementsByClassName("spbc_tab_nav-security_log")[0]:+spbcSettings.key_is_ok&&+spbcSettings.secfw_enabled?t=document.getElementsByClassName("spbc_tab_nav-traffic_control")[0]:+spbcSettings.key_is_ok?t=document.getElementsByClassName("spbc_tab_nav-scanner")[0]:(t=document.getElementsByClassName("spbc_tab_nav-settings_general")[0],e={target:"spbc_key",action:"highlight",times:3})),t&&spbc_switchTab(t,e),!1);jQuery(document).on("keyup",function(e){17==(e.which||e.keyCode)&&(s=!1)}),jQuery(document).on("keydown",function(e){var t;116==(e.which||e.keyCode)&&s?(e.preventDefault(),"scanner"!==(t=jQuery(".spbc_tab_nav--active")[0]).classList[1].replace("spbc_tab_nav-","")&&(jQuery(t).data("loaded",!1),spbc_switchTab(t))):17==(e.which||e.keyCode)&&(s=!0)})}); //# sourceMappingURL=spbc-settings.min.js.map diff --git a/js/spbc-settings.min.js.map b/js/spbc-settings.min.js.map index 85ef653f1..3aff6c443 100644 --- a/js/spbc-settings.min.js.map +++ b/js/spbc-settings.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-settings.min.js","sources":["spbc-settings.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n var before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n var after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n formatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Switching tabs\nfunction spbc_switchTab(tab, params){\n\n\tvar tab_name = tab.classList[1].replace('spbc_tab_nav-', '');\n\n\t// update url \n\tvar searchParams = new URLSearchParams(window.location.search)\n searchParams.set(\"spbc_tab\", tab_name);\n\tvar hashParam = window.location.hash;\n var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString() + hashParam;\n\n history.replaceState(null, '', newRelativePathQuery);\n\n\t// Hiding a tab 'Backups' if exist\n if(searchParams.get('spbc_tab') !== 'backups') {\n \tjQuery('.spbc_tab_nav-backups').hide();\n }\n\n // update active tab\n\tjQuery('.spbc_tab_nav').removeClass('spbc_tab_nav--active');\n\tjQuery('.spbc_tab').removeClass('spbc_tab--active');\n\tjQuery(tab).addClass('spbc_tab_nav--active');\n\tjQuery('.spbc_tab-'+tab_name).addClass('spbc_tab--active');\n\n\tif(!jQuery(tab).data('loaded')){\n\t\tvar data = {\n\t\t\taction: 'spbc_settings__draw_elements',\n\t\t\ttab_name: tab_name,\n\t\t\tsecurity: spbcSettings.ajax_nonce\n\t\t};\n\t\tvar params = {\n\t\t\tcallback: spbc_draw_settings_callback,\n\t\t\tnotJson: true,\n additional: params || null,\n\t\t};\n\t\tspbc_sendAJAXRequest( data, params, tab );\n\t}else if(params && params.action){\n switch (params.action){\n case 'highlight':\n spbcHighlightElement(params.target, params.times);\n break;\n case 'click':\n setTimeout(function(){\n jQuery('#'+params.additional.target).click();\n }, 500);\n break;\n }\n\t}\n}\n\nfunction spbc_draw_settings_callback(result, data, params, obj){\n\n\tjQuery(obj).data('loaded', true);\n\tjQuery('.spbc_tab-'+data.tab_name).replaceWith(result);\n\tvar tab = jQuery('.spbc_tab-'+data.tab_name);\n\ttab.addClass('spbc_tab--active');\n\n\tjQuery(document).off( 'click', '.spbc_long_description__show');\n\tjQuery(document).on('click', '.spbc_long_description__show', function(){\n\t\tself = jQuery(this);\n\t\tspbc_settings__show_description(self, self.attr('setting'));\n\t});\n\n\tif(params.additional){\n\t switch (params.additional.action) {\n case 'highlight':\n\t\t spbcHighlightElement(params.additional.target, params.additional.times);\n break;\n case 'click':\n setTimeout(function(){\n\t\t jQuery('#'+params.additional.target).click();\n }, 500);\n break;\n }\n }\n\n\tjQuery(tab).on('click', '.spbc_hint-send_'+data.tab_name, function(){\n\t\t\tjQuery('.spbc_hint-send_'+data.tab_name).hide();\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_send_'+data.tab_name, tab_name: data.tab_name},\n\t\t\t{callback: spbc_send_logs_callback}\n\t\t);\n\t});\n\n\t// scroll to anchor\n\tif (window.location.hash) {\n\t\tdocument.getElementById(window.location.hash.substring(1)).scrollIntoView();\n\t}\n}\n\nfunction spbc_send_logs_callback(result, data, params, obj){\n\tjQuery('.spbc_tab_nav-'+data.tab_name).data('loaded', false);\n\tspbc_switchTab(document.getElementsByClassName('spbc_tab_nav-'+data.tab_name)[0]);\n}\n\n// Settings dependences\nfunction spbcSettingsDependenciesbyId(settingsIDs, enable){\n\n\tif(typeof settingsIDs === 'string'){\n\t\ttmp = [];\n\t\ttmp.push(settingsIDs);\n\t\tsettingsIDs = tmp;\n\t}\n\n\tenable = typeof enable === 'undefined' ? null : +enable;\n\n\tsettingsIDs.forEach(function(settingID, i, arr){\n\n\t\tvar elem = document.getElementById('spbc_setting_'+settingID),\n do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n do_enable = function(){elem.removeAttribute('disabled');};\n\n if(enable !== null) // Set\n enable === 1 ? do_enable() : do_disable();\n else // Switch\n elem.getAttribute('disabled') === null ? do_disable() : do_enable();\n\n\t});\n}\n\n/**\n * Recursive in case children found!\n *\n * Settings dependencies\n *\n */\nfunction spbcSettingsDependencies(settingNames, enable){\n\n\t// Cast settingNames to array\n\tsettingNames = typeof settingNames === 'string' ? settingNames.split(',') : settingNames;\n\tenable = typeof enable === 'undefined' ? +event.target.checked : +enable;\n\n\tsettingNames.forEach(function(settingName, i, arr){\n\n\t\tdocument.getElementsByName('spbc_settings['+settingName+']')\n\t\t\t.forEach(function( elem, i, arr ){\n\n\t\t\t\tvar\tdo_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\t\t\t\tif(enable !== null) // Set\n\t\t\t\t\tenable === 1 ? do_enable() : do_disable();\n\t\t\t\telse // Switch\n\t\t\t\t\telem.getAttribute('disabled') === null ? do_disable() : do_enable();\n\n\t\t\t\tvar children = elem.getAttribute('children');\n\t\t\t\tif( children !== null ){\n\t\t\t\t\tspbcSettingsDependencies(children, enable && elem.checked);\n\t\t\t\t}\n\t\t\t});\n\t});\n}\n\nfunction spbc_settings__show_description(label, setting_id){\n\t\n\tvar remove_desc_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_description__show'))){\n\t\t\tjQuery('.spbc_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\t\n\tremove_desc_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_description', 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.title+\"

\")\n\t\t\t\t\t.append(\"

\"+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\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('
');\n\t\tvar enableResend = setTimeout(function(){\n\t\t\tjQuery('#confirmation-code--resend').removeAttr('disabled');\n\t\t\tjQuery('#confirmation-code--resend>.circle').remove();\n\t\t}, 30000);\n\n\t\tvar res = spbctGenerateConfirmationCode();\n\t\tif( res.success ) {\n\t\t\tjQuery('#confirmation-code input').val('');\n\t\t\tjQuery('#confirmation-code').dialog({\n\t\t\t\tmodal: true,\n\t\t\t\ttitle: 'Confirmation code',\n\t\t\t\twidth: 310,\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\tclearTimeout( enableResend );\n\t\t\t\t\t\tjQuery('#confirmation-code--resend>.circle').remove();\n\t\t\t\t\t},\n\t\t\t\t\tOk: function() {\n\t\t\t\t\t\tspbctCheckConfirmationCode(e.target, enableResend, jQuery('#confirmation-code--resend>.circle'));\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(res.text);\n\t\t}\n\t});\n\t\n\tif (jQuery('#spbc_renew_notice').length || jQuery('#spbc_trial_notice').length) {\n\t\tspbc_banner_check();\n\t}\n\n\t// Sync button\n\tjQuery('#spbc_button__sync').on('click', function(){\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('spbc_button__sync' ),\n\t\t\t\tspinner: jQuery('#spbc_button__sync .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#spbc_button__sync .spbc_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_button__sync .spbc_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( spbcSettings.key_changed ){\n\t\tjQuery('#spbc_button__sync').click();\n\t}\n\n\t// Get Key Auto button\n\tjQuery(document).on('click', '#spbc_setting_get_key_auto', function(){\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('spbc_setting_get_key_auto' ),\n\t\t\t\tspinner: jQuery('#spbc_setting_get_key_auto .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#spbc_setting_get_key_auto .spbc_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_setting_get_key_auto .spbc_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tspbcModal.loaded = result.getTemplates;\n\t\t\t\t\t\tspbcModal.open();\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}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#spbc_settings_templates_import_button', function(){\n\t\tjQuery('#spbc-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#spbc_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#spbc_settings_templates_import_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\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings_templates_import', 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_import_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_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 BAD\n\t\t}else if( +spbcSettings.key_is_ok ){\n\t\t\t// spbc_tab = document.getElementsByClassName('spbc_tab_nav-summary')[0];\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-traffic_control')[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});"],"names":["spbc_switchTab","tab","params","tab_name","classList","replace","searchParams","URLSearchParams","window","location","search","hashParam","set","hash","newRelativePathQuery","pathname","toString","history","replaceState","get","jQuery","hide","removeClass","addClass","data","action","spbcHighlightElement","target","times","setTimeout","additional","click","security","spbcSettings","ajax_nonce","callback","spbc_draw_settings_callback","notJson","spbc_sendAJAXRequest","result","obj","replaceWith","document","off","on","spbc_settings__show_description","self","this","attr","spbc_send_logs_callback","getElementById","substring","scrollIntoView","getElementsByClassName","spbcSettingsDependenciesbyId","settingsIDs","enable","tmp","push","forEach","settingID","i","arr","do_disable","elem","setAttribute","do_enable","removeAttribute","getAttribute","spbcSettingsDependencies","settingNames","split","event","checked","settingName","getElementsByName","children","label","setting_id","remove_desc_func","e","parent","length","hasClass","remove","after","append","css","top","position","left","spinner","empty","title","desc","spbcStartShowHide","next","show","spbctGenerateConfirmationCode","res","success","ajax","type","async","url","ajaxurl","text","spbctCheckConfirmationCode","radioButton","timeout","timer","element","code","val","removeAttr","clearTimeout","dialog","alert","spbc_banner_check","bannerChecker","setInterval","close_renew_banner","clearInterval","String","prototype","printf","arg","formatted","arguments","before_formatted","indexOf","after_formatted","ready","modal","my","at","of","width","height","draggable","resizable","closeText","preventDefault","enableResend","buttons","Cancel","Ok","button","reload","key_changed","getTemplates","spbcModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","insertAfter","close","templateNameInput","templateName","find","currentTarget","match","spbc_tab","ctrlKeyDown","debug","wpms","is_main_site","key_is_ok","which","keyCode","active_tab"],"mappings":"AAYA,SAASA,eAAeC,EAAKC,GAE5B,IAAIC,EAAWF,EAAIG,UAAU,GAAGC,QAAQ,gBAAiB,EAAE,EAGvDC,EAAe,IAAIC,gBAAgBC,OAAOC,SAASC,MAAM,EAEzDC,GADDL,EAAaM,IAAI,WAAYT,CAAQ,EACxBK,OAAOC,SAASI,MACzBC,EAAuBN,OAAOC,SAASM,SAAW,IAAMT,EAAaU,SAAS,EAAIL,EAezF,GAbGM,QAAQC,aAAa,KAAM,GAAIJ,CAAoB,EAGf,YAAjCR,EAAaa,IAAI,UAAU,GAC7BC,OAAO,uBAAuB,EAAEC,KAAK,EAIzCD,OAAO,eAAe,EAAEE,YAAY,sBAAsB,EAC1DF,OAAO,WAAW,EAAEE,YAAY,kBAAkB,EAClDF,OAAOnB,CAAG,EAAEsB,SAAS,sBAAsB,EAC3CH,OAAO,aAAajB,CAAQ,EAAEoB,SAAS,kBAAkB,EAErDH,OAAOnB,CAAG,EAAEuB,KAAK,QAAQ,GAYvB,GAAGtB,GAAUA,EAAOuB,OACnB,OAAQvB,EAAOuB,QACX,IAAK,YACDC,qBAAqBxB,EAAOyB,OAAQzB,EAAO0B,KAAK,EAChD,MACJ,IAAK,QACDC,WAAW,WACPT,OAAO,IAAIlB,EAAO4B,WAAWH,MAAM,EAAEI,MAAM,CAC/C,EAAG,GAAG,CAEd,CACP,KAvB+B,CAC1BP,EAAO,CACVC,OAAQ,+BACRtB,SAAUA,EACV6B,SAAUC,aAAaC,UACxB,EACIhC,EAAS,CACZiC,SAAUC,4BACVC,QAAS,CAAA,EACAP,WAAY5B,GAAU,IAChC,EACAoC,qBAAsBd,EAAMtB,EAAQ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C,QAAQ,gBAAiB,EAAE,IAIlEe,OAAO4J,CAAU,EAAExJ,KAAK,SAAU,CAAA,CAAK,EAEvCxB,eAAegL,CAAU,IAEW,KAAzBhG,EAAE8F,OAAS9F,EAAE+F,WAClBN,EAAc,CAAA,EAEtB,CAAC,CAEF,CAAC"} \ No newline at end of file +{"version":3,"file":"spbc-settings.min.js","sources":["spbc-settings.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n var before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n var after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n formatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Switching tabs\nfunction spbc_switchTab(tab, params){\n\n\tvar tab_name = tab.classList[1].replace('spbc_tab_nav-', '');\n\n\t// update url \n\tvar searchParams = new URLSearchParams(window.location.search)\n searchParams.set(\"spbc_tab\", tab_name);\n\tvar hashParam = window.location.hash;\n var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString() + hashParam;\n\n history.replaceState(null, '', newRelativePathQuery);\n\n\t// Hiding a tab 'Backups' if exist\n if(searchParams.get('spbc_tab') !== 'backups') {\n \tjQuery('.spbc_tab_nav-backups').hide();\n }\n\n // update active tab\n\tjQuery('.spbc_tab_nav').removeClass('spbc_tab_nav--active');\n\tjQuery('.spbc_tab').removeClass('spbc_tab--active');\n\tjQuery(tab).addClass('spbc_tab_nav--active');\n\tjQuery('.spbc_tab-'+tab_name).addClass('spbc_tab--active');\n\n\tif(!jQuery(tab).data('loaded')){\n\t\tvar data = {\n\t\t\taction: 'spbc_settings__draw_elements',\n\t\t\ttab_name: tab_name,\n\t\t\tsecurity: spbcSettings.ajax_nonce\n\t\t};\n\t\tvar params = {\n\t\t\tcallback: spbc_draw_settings_callback,\n\t\t\tnotJson: true,\n additional: params || null,\n\t\t};\n\t\tspbc_sendAJAXRequest( data, params, tab );\n\t}else if(params && params.action){\n switch (params.action){\n case 'highlight':\n spbcHighlightElement(params.target, params.times);\n break;\n case 'click':\n setTimeout(function(){\n jQuery('#'+params.additional.target).click();\n }, 500);\n break;\n }\n\t}\n}\n\nfunction spbc_draw_settings_callback(result, data, params, obj){\n\n\tjQuery(obj).data('loaded', true);\n\tjQuery('.spbc_tab-'+data.tab_name).replaceWith(result);\n\tvar tab = jQuery('.spbc_tab-'+data.tab_name);\n\ttab.addClass('spbc_tab--active');\n\n\tjQuery(document).off( 'click', '.spbc_long_description__show');\n\tjQuery(document).on('click', '.spbc_long_description__show', function(){\n\t\tself = jQuery(this);\n\t\tspbc_settings__show_description(self, self.attr('setting'));\n\t});\n\n\tjQuery(document).off( 'click', '.spbc_long_recommendation__show');\n\tjQuery(document).on('click', '.spbc_long_recommendation__show', function(){\n\t\tself = jQuery(this);\n\t\tspbc_settings__show_recommendation(self, self.attr('setting'));\n\t});\n\n\tif(params.additional){\n\t switch (params.additional.action) {\n case 'highlight':\n\t\t spbcHighlightElement(params.additional.target, params.additional.times);\n break;\n case 'click':\n setTimeout(function(){\n\t\t jQuery('#'+params.additional.target).click();\n }, 500);\n break;\n }\n }\n\n\tjQuery(tab).on('click', '.spbc_hint-send_'+data.tab_name, function(){\n\t\t\tjQuery('.spbc_hint-send_'+data.tab_name).hide();\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_send_'+data.tab_name, tab_name: data.tab_name},\n\t\t\t{callback: spbc_send_logs_callback}\n\t\t);\n\t});\n\n\t// scroll to anchor\n\tif (window.location.hash) {\n\t\tdocument.getElementById(window.location.hash.substring(1)).scrollIntoView();\n\t}\n}\n\nfunction spbc_send_logs_callback(result, data, params, obj){\n\tjQuery('.spbc_tab_nav-'+data.tab_name).data('loaded', false);\n\tspbc_switchTab(document.getElementsByClassName('spbc_tab_nav-'+data.tab_name)[0]);\n}\n\n// Settings dependences\nfunction spbcSettingsDependenciesbyId(settingsIDs, enable){\n\n\tif(typeof settingsIDs === 'string'){\n\t\ttmp = [];\n\t\ttmp.push(settingsIDs);\n\t\tsettingsIDs = tmp;\n\t}\n\n\tenable = typeof enable === 'undefined' ? null : +enable;\n\n\tsettingsIDs.forEach(function(settingID, i, arr){\n\n\t\tvar elem = document.getElementById('spbc_setting_'+settingID),\n do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n do_enable = function(){elem.removeAttribute('disabled');};\n\n if(enable !== null) // Set\n enable === 1 ? do_enable() : do_disable();\n else // Switch\n elem.getAttribute('disabled') === null ? do_disable() : do_enable();\n\n\t});\n}\n\n/**\n * Recursive in case children found!\n *\n * Settings dependencies\n *\n */\nfunction spbcSettingsDependencies(settingNames, enable){\n\n\t// Cast settingNames to array\n\tsettingNames = typeof settingNames === 'string' ? settingNames.split(',') : settingNames;\n\tenable = typeof enable === 'undefined' ? +event.target.checked : +enable;\n\n\tsettingNames.forEach(function(settingName, i, arr){\n\n\t\tdocument.getElementsByName('spbc_settings['+settingName+']')\n\t\t\t.forEach(function( elem, i, arr ){\n\n\t\t\t\tvar\tdo_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\t\t\t\tif(enable !== null) // Set\n\t\t\t\t\tenable === 1 ? do_enable() : do_disable();\n\t\t\t\telse // Switch\n\t\t\t\t\telem.getAttribute('disabled') === null ? do_disable() : do_enable();\n\n\t\t\t\tvar children = elem.getAttribute('children');\n\t\t\t\tif( children !== null ){\n\t\t\t\t\tspbcSettingsDependencies(children, enable && elem.checked);\n\t\t\t\t}\n\t\t\t});\n\t});\n}\n\nfunction spbc_settings__show_description(label, setting_id){\n\t\n\tvar remove_desc_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_description__show'))){\n\t\t\tjQuery('.spbc_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\t\n\tremove_desc_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_description', 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.title+\"

\")\n\t\t\t\t\t.append(\"

\"+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.title+\"

\")\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('
');\n\t\tvar enableResend = setTimeout(function(){\n\t\t\tjQuery('#confirmation-code--resend').removeAttr('disabled');\n\t\t\tjQuery('#confirmation-code--resend>.circle').remove();\n\t\t}, 30000);\n\n\t\tvar res = spbctGenerateConfirmationCode();\n\t\tif( res.success ) {\n\t\t\tjQuery('#confirmation-code input').val('');\n\t\t\tjQuery('#confirmation-code').dialog({\n\t\t\t\tmodal: true,\n\t\t\t\ttitle: 'Confirmation code',\n\t\t\t\twidth: 310,\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\tclearTimeout( enableResend );\n\t\t\t\t\t\tjQuery('#confirmation-code--resend>.circle').remove();\n\t\t\t\t\t},\n\t\t\t\t\tOk: function() {\n\t\t\t\t\t\tspbctCheckConfirmationCode(e.target, enableResend, jQuery('#confirmation-code--resend>.circle'));\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(res.text);\n\t\t}\n\t});\n\t\n\tif (jQuery('#spbc_renew_notice').length || jQuery('#spbc_trial_notice').length) {\n\t\tspbc_banner_check();\n\t}\n\n\t// Sync button\n\tjQuery('#spbc_button__sync').on('click', function(){\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('spbc_button__sync' ),\n\t\t\t\tspinner: jQuery('#spbc_button__sync .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#spbc_button__sync .spbc_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_button__sync .spbc_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( spbcSettings.key_changed ){\n\t\tjQuery('#spbc_button__sync').click();\n\t}\n\n\t// Get Key Auto button\n\tjQuery(document).on('click', '#spbc_setting_get_key_auto', function(){\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('spbc_setting_get_key_auto' ),\n\t\t\t\tspinner: jQuery('#spbc_setting_get_key_auto .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#spbc_setting_get_key_auto .spbc_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_setting_get_key_auto .spbc_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tspbcModal.loaded = result.getTemplates;\n\t\t\t\t\t\tspbcModal.open();\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}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#spbc_settings_templates_import_button', function(){\n\t\tjQuery('#spbc-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#spbc_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#spbc_settings_templates_import_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\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings_templates_import', 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_import_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_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});"],"names":["spbc_switchTab","tab","params","tab_name","classList","replace","searchParams","URLSearchParams","window","location","search","hashParam","set","hash","newRelativePathQuery","pathname","toString","history","replaceState","get","jQuery","hide","removeClass","addClass","data","action","spbcHighlightElement","target","times","setTimeout","additional","click","security","spbcSettings","ajax_nonce","callback","spbc_draw_settings_callback","notJson","spbc_sendAJAXRequest","result","obj","replaceWith","document","off","on","spbc_settings__show_description","self","this","attr","spbc_settings__show_recommendation","spbc_send_logs_callback","getElementById","substring","scrollIntoView","getElementsByClassName","spbcSettingsDependenciesbyId","settingsIDs","enable","tmp","push","forEach","settingID","i","arr","do_disable","elem","setAttribute","do_enable","removeAttribute","getAttribute","spbcSettingsDependencies","settingNames","split","event","checked","settingName","getElementsByName","children","label","setting_id","remove_desc_func","e","parent","length","hasClass","remove","after","append","css","top","position","left","spinner","empty","title","desc","remove_recommendation_func","spbcStartShowHide","next","show","spbctGenerateConfirmationCode","res","success","ajax","type","async","url","ajaxurl","text","spbctCheckConfirmationCode","radioButton","timeout","timer","element","code","val","removeAttr","clearTimeout","dialog","alert","spbc_banner_check","bannerChecker","setInterval","close_renew_banner","clearInterval","String","prototype","printf","arg","formatted","arguments","before_formatted","indexOf","after_formatted","ready","modal","my","at","of","width","height","draggable","resizable","closeText","preventDefault","enableResend","buttons","Cancel","Ok","button","reload","key_changed","getTemplates","spbcModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","insertAfter","close","templateNameInput","templateName","find","currentTarget","match","spbc_tab","ctrlKeyDown","debug","wpms","is_main_site","key_is_ok","secfw_enabled","which","keyCode","active_tab"],"mappings":"AAYA,SAASA,eAAeC,EAAKC,GAE5B,IAAIC,EAAWF,EAAIG,UAAU,GAAGC,QAAQ,gBAAiB,EAAE,EAGvDC,EAAe,IAAIC,gBAAgBC,OAAOC,SAASC,MAAM,EAEzDC,GADDL,EAAaM,IAAI,WAAYT,CAAQ,EACxBK,OAAOC,SAASI,MACzBC,EAAuBN,OAAOC,SAASM,SAAW,IAAMT,EAAaU,SAAS,EAAIL,EAezF,GAbGM,QAAQC,aAAa,KAAM,GAAIJ,CAAoB,EAGf,YAAjCR,EAAaa,IAAI,UAAU,GAC7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,aAAa4I,MAAQ,CAAC,CAAC5I,aAAa6I,aAC9CJ,EAAWhI,SAASY,uBAAuB,2BAA2B,EAAE,GAE/D,CAACrB,aAAa8I,WAAa,CAAC9I,aAAa+I,cAClDN,EAAWhI,SAASY,uBAAuB,8BAA8B,EAAE,GAElE,CAACrB,aAAa8I,UACvBL,EAAWhI,SAASY,uBAAuB,sBAAsB,EAAE,IAGnEoH,EAAWhI,SAASY,uBAAuB,+BAA+B,EAAE,GAC5EpD,EAAS,CACLyB,OAAQ,WACCF,OAAQ,YACRG,MAAO,CACX,IAIP8I,GAAU1K,eAAe0K,EAAUxK,CAAM,EAK3B,CAAA,GAElBkB,OAAOsB,QAAQ,EAAEE,GAAG,QAAS,SAASqC,GACP,KAAzBA,EAAEgG,OAAShG,EAAEiG,WAAgBP,EAAc,CAAA,EACjD,CAAC,EAEDvJ,OAAOsB,QAAQ,EAAEE,GAAG,UAAW,SAASqC,GACvC,IAGKkG,EAH0B,MAAzBlG,EAAEgG,OAAShG,EAAEiG,UAAoBP,GACtC1F,EAAE+D,eAAe,EAKA,aAHbmC,EAAa/J,OAAO,uBAAuB,EAAE,IACvBhB,UAAU,GAAGC,QAAQ,gBAAiB,EAAE,IAIlEe,OAAO+J,CAAU,EAAE3J,KAAK,SAAU,CAAA,CAAK,EAEvCxB,eAAemL,CAAU,IAEW,KAAzBlG,EAAEgG,OAAShG,EAAEiG,WAClBP,EAAc,CAAA,EAEtB,CAAC,CAEF,CAAC"} \ No newline at end of file diff --git a/js/spbc-settings_tab--scanner.min.js b/js/spbc-settings_tab--scanner.min.js index dcccd17d8..8e6d3d7bc 100644 --- a/js/spbc-settings_tab--scanner.min.js +++ b/js/spbc-settings_tab--scanner.min.js @@ -1,4 +1,4 @@ -function spbc_popup_tip___show(e){function s(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_popup_tip--wrapper").length&&!jQuery(e.target).hasClass("spbc_popup_tip--icon---cancel")||jQuery(e.target).hasClass("spbc_popup_tip--icon---show"))||(jQuery(".spbc_popup_tip--wrapper").hide(),jQuery(document).off("click",s))}var t=e.attr("spbc_tip_title")||null,o=e.attr("spbc_tip_text")||null,a=(s(),e.after("
"),jQuery(".spbc_popup_tip--wrapper"));a.empty().append("
").css({top:e.position().top-2,left:e.position().left+25}),a.append("").append("

"+t+"

").append("

"+o+"

"),jQuery(document).on("click",s),e.parents("tr").on("mouseout",s)}function spbc_scanner_button_file_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_view",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_analysis_log_delete_from_log(e){var e=jQuery(e),s={action:"spbc_scanner_analysis_log_delete_from_log",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:window.location.reload(),errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_button_page_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_page_view",page_url:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}},t=jQuery("#wpwrap"),o=jQuery("#spbc_dialog"),a=(o.dialog({modal:!0,title:"Loading..",position:{my:"center top",at:"center top+100px",of:window},width:t.width()/100*90,show:{effect:"blind",duration:500},draggable:!1,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow="auto",jQuery("#spbc_dialog").height(document.documentElement.clientHeight/100*25)},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}}),o.append('Wait for downloading'),jQuery("#spbc_file_view_preloader")),t=4e-4*t.width();a.height(128*t),a.width(128*t),a.css({left:o.width()/2-128*t/2}),a.css({top:o.height()/2-128*t/2}),spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonView_callback(e){var s,t=jQuery("#spbc_dialog");t.empty(),jQuery("#spbc_file_view_preloader").css({display:"none"});for(s in e.file)t.append('
%s

%s


'.printf(s,e.file[s]));let o=19*Object.keys(e.file).length<76?76:19*Object.keys(e.file).length,a=document.documentElement.clientHeight/100*75,n=o%s

%s


':n).printf(e,s.file[e]));jQuery("#spbc_dialog").append(n.printf("",""))}jQuery("#spbc_dialog div").last().remove();let i=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,p=document.documentElement.clientHeight/100*75,l=i{};if(1==o.success){console.log(o);var a,n='
%s

%s


',c=[];for(a in o.weak_spots=JSON.parse(o.weak_spots),o.weak_spots)c=c.concat(Object.keys(o.weak_spots[a]));var r,c=[...new Set(c)].sort(),i=new Map(Object.entries(o.weak_spots.CRITICAL));for(r in c){var p=+c[r];for(let t=p-2;t<=2+p;t++)if(void 0!==o.file[t]){var l=p===t;let e,s;e=l?'
%s

%s


':n,s=l?e.printf(t,i.get(c[r])):e.printf(t,o.file[t]),jQuery("#spbc_dialog").append(s)}jQuery("#spbc_dialog").append(n.printf("","")),jQuery("#spbc_dialog div").last().remove()}}else jQuery("#spbc_dialog").append('
%s
'.printf(o.content)),t=()=>{document.location.reload()};let _=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,d=document.documentElement.clientHeight/100*75,u=_Modified',"Line",'Original'));for(var a=1;void 0!==s.file[a]||void 0!==s.file_original[a];a++)if(void 0===s.file[a]&&(s.file[a]=""),void 0===s.file_original[a]&&(s.file_original[a]=""),-1!=s.difference.indexOf(a)){for(let e=a-2;e<=a+2;e++)void 0!==s.file[e]&&void 0!==s.file_original[a]&&jQuery("#spbc_dialog").append((a===e?'

%s

%s

%s


':o).printf(s.file[e]||"",e,s.file_original[e]||""));jQuery("#spbc_dialog").append(o.printf("","",""))}var n=19*jQuery("#spbc_dialog div").length+19,c=document.documentElement.clientHeight/100*75,r=n{document.getElementById("spbc_scanner__last_scan_info").innerText=e.data}})}function spbc_scanner_file_monitoring_show_current_snapshot(e){var e=jQuery(e),s=e.parents(".row-actions").attr("uid");const t=e.closest(".column-path").find(".title").text(),o=jQuery("[data-remodal-id=spbc-file-monitoring-modal]");o.remodal().open();e={action:"spbc_file_monitoring_show_snapshots",file_id:s,security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success&&(o.find("#spbc-fm-snapshot-list ul").remove(),o.find("#spbc-fm-snapshot-file-name").text(t),drawSnapshotList(e.data,o),drawCurrentSnapshot(e.data[0].id,o))}})}function drawSnapshotList(e,s){let t="";for(var o of e)t+=`
  • ${o.created_at}
  • `;e=`
      +function spbc_popup_tip___show(e){function s(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_popup_tip--wrapper").length&&!jQuery(e.target).hasClass("spbc_popup_tip--icon---cancel")||jQuery(e.target).hasClass("spbc_popup_tip--icon---show"))||(jQuery(".spbc_popup_tip--wrapper").hide(),jQuery(document).off("click",s))}var t=e.attr("spbc_tip_title")||null,o=e.attr("spbc_tip_text")||null,n=(s(),e.after("
      "),jQuery(".spbc_popup_tip--wrapper"));n.empty().append("
      ").css({top:e.position().top-2,left:e.position().left+25}),n.append("").append("

      "+t+"

      ").append("

      "+o+"

      "),jQuery(document).on("click",s),e.parents("tr").on("mouseout",s)}function spbc_scanner_button_file_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_view",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_analysis_log_delete_from_log(e){var e=jQuery(e),s={action:"spbc_scanner_analysis_log_delete_from_log",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:window.location.reload(),errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_button_page_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_page_view",page_url:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}},t=jQuery("#wpwrap"),o=jQuery("#spbc_dialog"),n=(o.dialog({modal:!0,title:"Loading..",position:{my:"center top",at:"center top+100px",of:window},width:t.width()/100*90,show:{effect:"blind",duration:500},draggable:!1,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow="auto",jQuery("#spbc_dialog").height(document.documentElement.clientHeight/100*25)},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}}),o.append('Wait for downloading'),jQuery("#spbc_file_view_preloader")),t=4e-4*t.width();n.height(128*t),n.width(128*t),n.css({left:o.width()/2-128*t/2}),n.css({top:o.height()/2-128*t/2}),spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonView_callback(e){var s,t=jQuery("#spbc_dialog");t.empty(),jQuery("#spbc_file_view_preloader").css({display:"none"});for(s in e.file)t.append('
      %s

      %s


      '.printf(s,e.file[s]));let o=19*Object.keys(e.file).length<76?76:19*Object.keys(e.file).length,n=document.documentElement.clientHeight/100*75,a=o%s

      %s


      ':a).printf(e,s.file[e]));jQuery("#spbc_dialog").append(a.printf("",""))}jQuery("#spbc_dialog div").last().remove();let i=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,p=document.documentElement.clientHeight/100*75,l=i{};if(1==o.success){console.log(o);var n,a='
      %s

      %s


      ',c=[];for(n in o.weak_spots=JSON.parse(o.weak_spots),o.weak_spots)c=c.concat(Object.keys(o.weak_spots[n]));var r,c=[...new Set(c)].sort(),i=new Map(Object.entries(o.weak_spots.CRITICAL));for(r in c){var p=+c[r];for(let t=p-2;t<=2+p;t++)if(void 0!==o.file[t]){var l=p===t;let e,s;e=l?'
      %s

      %s


      ':a,s=l?e.printf(t,i.get(c[r])):e.printf(t,o.file[t]),jQuery("#spbc_dialog").append(s)}jQuery("#spbc_dialog").append(a.printf("","")),jQuery("#spbc_dialog div").last().remove()}}else jQuery("#spbc_dialog").append('
      %s
      '.printf(o.content)),t=()=>{document.location.reload()};let _=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,d=document.documentElement.clientHeight/100*75,u=_Modified',"Line",'Original'));for(var n=1;void 0!==s.file[n]||void 0!==s.file_original[n];n++)if(void 0===s.file[n]&&(s.file[n]=""),void 0===s.file_original[n]&&(s.file_original[n]=""),-1!=s.difference.indexOf(n)){for(let e=n-2;e<=n+2;e++)void 0!==s.file[e]&&void 0!==s.file_original[n]&&jQuery("#spbc_dialog").append((n===e?'

      %s

      %s

      %s


      ':o).printf(s.file[e]||"",e,s.file_original[e]||""));jQuery("#spbc_dialog").append(o.printf("","",""))}var a=19*jQuery("#spbc_dialog div").length+19,c=document.documentElement.clientHeight/100*75,r=a{document.getElementById("spbc_scanner__last_scan_info").innerText=e.data}})}function spbc_scanner_file_monitoring_show_current_snapshot(e){var e=jQuery(e),s=e.parents(".row-actions").attr("uid");const t=e.closest(".column-path").find(".title").text(),o=jQuery("[data-remodal-id=spbc-file-monitoring-modal]");o.remodal().open();e={action:"spbc_file_monitoring_show_snapshots",file_id:s,security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success&&(o.find("#spbc-fm-snapshot-list ul").remove(),o.find("#spbc-fm-snapshot-file-name").text(t),drawSnapshotList(e.data,o),drawCurrentSnapshot(e.data[0].id,o))}})}function drawSnapshotList(e,s){let t="";for(var o of e)t+=`
    • ${o.created_at}
    • `;e=`
        ${t}
      `;s.find("#spbc-fm-snapshot-list").append(e)}function drawCurrentSnapshot(s,t){var e={action:"spbc_file_monitoring_show_current_snapshot",snapshot_id:s,security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,beforeSend:function(){jQuery("#spbc-file-monitoring-modal-preloader").show()},success:function(e){e.success&&(t.find("#spbc-fm-snapshot-view .wrap").remove(),t.find("[data-spanshot-id").removeClass("active"),t.find("[data-spanshot-id="+s+"]").addClass("active"),e=`
      @@ -6,5 +6,5 @@ function spbc_popup_tip___show(e){function s(e){void 0!==e&&(0!=jQuery(e.target)
                                       ${e.data.content}
                                   
                               
      -
      `,jQuery("#spbc-file-monitoring-modal-preloader").hide(),t.find("#spbc-fm-snapshot-view").append(e),document.querySelectorAll("pre code").forEach(e=>{hljs.highlightElement(e)}))}})}function spbc_scanner_button_cure_file_ajax_handler(e){e={action:"spbc_file_cure_ajax_action",file_fast_hash:jQuery(e).parents(".row-actions").attr("uid"),security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(spbcModal.open().put(e.data),document.addEventListener("spbcModalClosed",function(e){document.location.reload()})):spbcModal.open().putError(e.data)}})}function spbc_scanner_button_restore_from_backup_ajax_handler(e){e={action:"spbc_restore_file_from_backup_ajax_action",file_fast_hash:jQuery(e).parents(".row-actions").attr("uid"),security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(spbcModal.open().put(e.data),document.addEventListener("spbcModalClosed",function(e){document.location.reload()})):spbcModal.open().putError(e.data)}})}jQuery(document).ready(function(){spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide(),jQuery("#spbc_scaner_progress_bar").progressbar({value:0,create:function(e,s){e.target.style.position="relative",e.target.style.marginBottom="12px"},change:function(e,s){jQuery(".spbc_progressbar_counter span").text(jQuery(e.target).progressbar("option","value")+" %")}}),jQuery("#spbc_scan_accordion").accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1,activate:function(e,s){0===s.oldPanel.length&&0===s.oldHeader.length&&jQuery("#spbc_scan_accordion").accordion("option","classes.ui-accordion-content","ui-corner-bottom spbc-overflow--visible")},beforeActivate:function(e,s){1===s.oldPanel.length&&1===s.oldHeader.length&&jQuery("#spbc_scan_accordion").accordion("option","classes.ui-accordion-content","ui-corner-bottom")}}),window.spbc_scanner=new spbcMalwareScanner({settings:spbcScaner.settings,states:spbcScaner.states,button:jQuery("#spbc_perform_scan"),spinner:jQuery("#spbc_perform_scan").next(),callback:null,progress_overall:jQuery("#spbc_scaner_progress_overall"),progressbar:jQuery("#spbc_scaner_progress_bar"),progressbar_text:jQuery(".spbc_progressbar_counter span"),wrapper:document.getElementsByClassName("spbc_unchecked_file_list"),warnings:{long_scan:jQuery(".spbc_hint_warning__long_scan"),outdated:jQuery(".spbc_hint_warning__outdated")}}),jQuery(document).on("click",".spbc_popup_tip--icon---show",function(){spbc_popup_tip___show(jQuery(this))}),jQuery("#spbc_perform_scan").on("click",function(){jQuery("#spbcscan-results-log-module").remove(),spbc_scanner.actionControl(),jQuery(".spbc_log-wrapper .panel-body").length||jQuery(".spbc_log-wrapper").append('
      '),jQuery(".spbc_log-wrapper").resizable({handles:"n, s",containment:"document"})}),jQuery("#spbcscan-results-log-module").resizable({handles:"n, s",containment:"document"}),jQuery("#spbc_scanner_clear").on("click",function(){confirm("Do you wanna clear the table with file scan results?")&&(console.log("CLEAR"),spbc_sendAJAXRequest({action:"spbc_scanner_clear"},{type:"GET",successCallback:function(){document.location=document.location},complete:null,errorOutput:null,context:this,timeout:4e4}))}),jQuery("#spbc_scanner_save_to_pdf").on("click",function(){jQuery.ajax({url:spbcSettings.ajaxurl,type:"POST",data:{action:"spbc_scanner_save_to_pdf",security:spbcSettings.ajax_nonce,no_cache:Math.random()},xhrFields:{responseType:"blob"},success:function(o){jQuery.ajax({url:spbcSettings.ajaxurl,type:"POST",data:{action:"spbc_scanner_get_pdf_file_name",security:spbcSettings.ajax_nonce,no_cache:Math.random()},xhrFields:{responseType:"text"},success:function(e){var s=new Blob([o]),t=document.createElement("a");t.href=window.URL.createObjectURL(s),t.download=e.data,t.click()}})}})}),jQuery(document).on("click",".spbc-fm-snapshot-list [data-spanshot-id]",function(){var e=jQuery(this).data("spanshot-id");e!==jQuery(".spbc-fm-snapshot-list [data-spanshot-id].active").data("spanshot-id")&&drawCurrentSnapshot(e,jQuery("[data-remodal-id=spbc-file-monitoring-modal]"))})}); + `,jQuery("#spbc-file-monitoring-modal-preloader").hide(),t.find("#spbc-fm-snapshot-view").append(e),document.querySelectorAll("pre code").forEach(e=>{hljs.highlightElement(e)}))}})}function spbc_scanner_button_cure_file_ajax_handler(e){e={action:"spbc_file_cure_ajax_action",file_fast_hash:jQuery(e).parents(".row-actions").attr("uid"),security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(spbcModal.open().put(e.data),document.addEventListener("spbcModalClosed",function(e){document.location.reload()})):spbcModal.open().putError(e.data)}})}function spbc_scanner_button_restore_from_backup_ajax_handler(e){e={action:"spbc_restore_file_from_backup_ajax_action",file_fast_hash:jQuery(e).parents(".row-actions").attr("uid"),security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(spbcModal.open().put(e.data),document.addEventListener("spbcModalClosed",function(e){document.location.reload()})):spbcModal.open().putError(e.data)}})}function spbc_scanner_button_clear_scan_results(){confirm("Do you confirm to clear the scan results?")&&(console.log("CLEAR"),spbc_sendAJAXRequest({action:"spbc_scanner_clear"},{type:"GET",successCallback:function(){document.location=document.location},complete:null,errorOutput:null,context:this,timeout:4e4,success:function(){document.location.reload()}}))}jQuery(document).ready(function(){spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide(),jQuery("#spbc_scaner_progress_bar").progressbar({value:0,create:function(e,s){e.target.style.position="relative",e.target.style.marginBottom="12px"},change:function(e,s){jQuery(".spbc_progressbar_counter span").text(jQuery(e.target).progressbar("option","value")+" %")}}),jQuery("#spbc_scan_accordion").accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1,activate:function(e,s){0===s.oldPanel.length&&0===s.oldHeader.length&&jQuery("#spbc_scan_accordion").accordion("option","classes.ui-accordion-content","ui-corner-bottom spbc-overflow--visible")},beforeActivate:function(e,s){1===s.oldPanel.length&&1===s.oldHeader.length&&jQuery("#spbc_scan_accordion").accordion("option","classes.ui-accordion-content","ui-corner-bottom")}}),window.spbc_scanner=new spbcMalwareScanner({settings:spbcScaner.settings,states:spbcScaner.states,button:jQuery("#spbc_perform_scan"),spinner:jQuery("#spbc_perform_scan").next(),callback:null,progress_overall:jQuery("#spbc_scaner_progress_overall"),progressbar:jQuery("#spbc_scaner_progress_bar"),progressbar_text:jQuery(".spbc_progressbar_counter span"),wrapper:document.getElementsByClassName("spbc_unchecked_file_list"),warnings:{long_scan:jQuery(".spbc_hint_warning__long_scan"),outdated:jQuery(".spbc_hint_warning__outdated")}}),jQuery(document).on("click",".spbc_popup_tip--icon---show",function(){spbc_popup_tip___show(jQuery(this))}),jQuery("#spbc_perform_scan").on("click",function(){jQuery("#spbcscan-results-log-module").remove(),spbc_scanner.actionControl(),jQuery(".spbc_log-wrapper .panel-body").length||jQuery(".spbc_log-wrapper").append('
      '),jQuery(".spbc_log-wrapper").resizable({handles:"n, s",containment:"document"})}),jQuery("#spbcscan-results-log-module").resizable({handles:"n, s",containment:"document"}),jQuery("#spbc_scanner_clear").on("click",function(){confirm("Do you confirm to clear the scan results?")&&(console.log("CLEAR"),spbc_sendAJAXRequest({action:"spbc_scanner_clear"},{type:"GET",successCallback:function(){document.location=document.location},complete:null,errorOutput:null,context:this,timeout:4e4,success:function(){document.location.reload()}}))}),jQuery("#spbc_scanner_save_to_pdf").on("click",function(){jQuery.ajax({url:spbcSettings.ajaxurl,type:"POST",data:{action:"spbc_scanner_save_to_pdf",security:spbcSettings.ajax_nonce,no_cache:Math.random()},xhrFields:{responseType:"blob"},success:function(o){jQuery.ajax({url:spbcSettings.ajaxurl,type:"POST",data:{action:"spbc_scanner_get_pdf_file_name",security:spbcSettings.ajax_nonce,no_cache:Math.random()},xhrFields:{responseType:"text"},success:function(e){var s=new Blob([o]),t=document.createElement("a");t.href=window.URL.createObjectURL(s),t.download=e.data,t.click()}})}})}),jQuery(document).on("click",".spbc-fm-snapshot-list [data-spanshot-id]",function(){var e=jQuery(this).data("spanshot-id");e!==jQuery(".spbc-fm-snapshot-list [data-spanshot-id].active").data("spanshot-id")&&drawCurrentSnapshot(e,jQuery("[data-remodal-id=spbc-file-monitoring-modal]"))})}); //# sourceMappingURL=spbc-settings_tab--scanner.min.js.map diff --git a/js/spbc-settings_tab--scanner.min.js.map b/js/spbc-settings_tab--scanner.min.js.map index c7d810c8d..0b10266c8 100644 --- a/js/spbc-settings_tab--scanner.min.js.map +++ b/js/spbc-settings_tab--scanner.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-settings_tab--scanner.min.js","sources":["spbc-settings_tab--scanner.js"],"sourcesContent":["function spbc_popup_tip___show(show_icon){\n\n\tvar tip_title = show_icon.attr('spbc_tip_title') || null;\n\tvar\ttip_text = show_icon.attr('spbc_tip_text') || null;\n\tvar remove_desc_func = function(e){\n\n\t\tif(\n\t\t\ttypeof e === 'undefined' ||\n\t\t\t(\n\t\t\t\t(jQuery(e.target).parent('.spbc_popup_tip--wrapper').length == 0 || jQuery(e.target).hasClass('spbc_popup_tip--icon---cancel')) &&\n\t\t\t\t!jQuery(e.target).hasClass('spbc_popup_tip--icon---show')\n\t\t\t)\n\t\t){\n\t\t\tjQuery('.spbc_popup_tip--wrapper').hide();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tshow_icon.after(\"
      \");\n\n\tvar obj = jQuery('.spbc_popup_tip--wrapper');\n\n\tobj.empty()\n\t\t.append(\"
      \")\n\t\t.css({\n\t\t\ttop: show_icon.position().top - 2,\n\t\t\tleft: show_icon.position().left + 25\n\t\t});\n\tobj.append(\"\")\n\t\t.append(\"

      \" + tip_title + \"

      \")\n\t\t.append(\"

      \" + 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\tconst self = jQuery(obj);\n\tconst data = {\n\t\taction: 'spbc_scanner_analysis_log_delete_from_log',\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: window.location.reload(),\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\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('\"Wait')\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


      ';\n\n\tfor(let row in result.file){\n\t\tdialog_window.append(row_template.printf(row, result.file[row]));\n\t}\n\n\tlet content_height = Object.keys(result.file).length * 19 < 76 ? 76 : Object.keys(result.file).length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'hidden' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tdialog_window.css({\n\t\theight: height,\n\t\toverflow: overflow\n\t})\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: ('Loaded: ' + result.file_path),\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\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 = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() { \n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close'); \n\t\t\t}); \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\tconsole.log('FILE_VIEWED');\n\n}\n\nfunction spbc_scanner_button_file_view_bad_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_scannerButtonViewBadFile_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_bad_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parent().attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonViewBad_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonViewBadFile_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE_FILE');\n\tconsole.log(arguments);\n\tjQuery('#spbc_dialog').empty();\n\n\tvar row_template = '
      %s

      %s


      ',\n\t\trow_template_bad = '
      %s

      %s


      ',\n\t\tstr_nums = [];\n\n\tresult.weak_spots = JSON.parse(result.weak_spots);\n\tfor(let severity in result.weak_spots){\n\t\tstr_nums = str_nums.concat(Object.keys(result.weak_spots[severity]));\n\t}\n\tstr_nums = [...new Set(str_nums)].sort(); // Sort bad line\n\n\tfor(let str_num in str_nums){\n\n\t\tlet row = +str_nums[str_num],\n\t\t\tdisplay_depth = 2;\n\n\t\t// Display only existing lines of file\n\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\tjQuery('#spbc_dialog').append((row === curr_row ? row_template_bad : row_template).printf(curr_row, result.file[curr_row]));\n\t\t\t}\n\t\t}\n\n\t\t// Placing an empty string between results\n\t\tjQuery('#spbc_dialog').append(row_template. printf('', ''));\n\n\t}\n\n\t// Removing last empty string\n\tjQuery('#spbc_dialog div').last().remove();\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\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 = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() { \n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close'); \n\t\t\t}); \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\nfunction spbc_scannerButtonViewBad_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE');\n\n\tconsole.log(arguments);\n\n\tlet afterClose = () => {};\n\n\tif ( result.success == true ) {\n\t\tconsole.log(result);\n\t\tvar row_template = '
      ' +\n\t\t\t\t'%s' +\n\t\t\t\t'

      %s

      ' +\n\t\t\t\t'
      ',\n\t\t\trow_template_bad = '
      ' +\n\t\t\t\t'%s' +\n\t\t\t\t'

      %s

      ' +\n\t\t\t\t'
      ',\n\t\t\tstr_nums = [];\n\n\t\tresult.weak_spots = JSON.parse(result.weak_spots);\n\t\tfor(let severity in result.weak_spots){\n\t\t\tstr_nums = str_nums.concat(Object.keys(result.weak_spots[severity]));\n\t\t}\n\n\t\tstr_nums = [...new Set(str_nums)].sort(); // Sort bad line\n\t\t//get a map of bad strings\n\t\tlet bad_strings_map = new Map(Object.entries(result.weak_spots.CRITICAL)) //TODO: Probably there can get something else except CRITICAL in the future\n\t\tfor(let str_num in str_nums){\n\n\t\t\tlet row = +str_nums[str_num],\n\t\t\t\tdisplay_depth = 2;\n\n\t\t\t// Display only existing lines of file\n\t\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\t\tlet is_bad_string = (row === curr_row)\n\t\t\t\t\tlet unformatted_row\n\t\t\t\t\tlet highlited_row\n\t\t\t\t\tif (is_bad_string){\n\t\t\t\t\t\tunformatted_row = row_template_bad\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunformatted_row = row_template\n\t\t\t\t\t}\n\t\t\t\t\tif (is_bad_string){\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, bad_strings_map.get(str_nums[str_num]));\n\t\t\t\t\t} else {\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, result.file[curr_row]);\n\t\t\t\t\t}\n\t\t\t\t\tjQuery('#spbc_dialog').append(highlited_row);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Placing an empty string between results\n\t\t\tjQuery('#spbc_dialog').append(row_template. printf('', ''));\n\n\t\t\t// Removing last empty string\n\t\t\tjQuery('#spbc_dialog div').last().remove();\n\t\t}\n\t} else {\n\t\tlet wrapperElement = '
      %s
      '\n\t\tjQuery('#spbc_dialog').append(wrapperElement.printf(result.content));\n\t\tafterClose = () => {document.location.reload();};\n\t}\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\theight = 'auto',\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll';\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\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 = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() { \n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close'); \n\t\t\t}); \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\tclose: afterClose,\n\t});\n}\n\nfunction spbc_scanner_button_file_compare_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_compare',\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_scannerButtonFileCompare_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonFileCompare_callback(result, data, params){\n\n\tconsole.log('FILE_COMPARED');\n\n\tlet row_template = '

      %s

      %s

      %s


      ';\n\tlet row_template_bad = '

      %s

      %s

      %s


      ';\n\n\tjQuery('#spbc_dialog').append(row_template.printf('Modified', 'Line', 'Original'));\n\n\tfor(var row=1, prev = false, next = false; typeof result.file[row] != 'undefined' || typeof result.file_original[row] != 'undefined'; row++){\n\n\t\tif(typeof result.file[row] == 'undefined') result.file[row] = '';\n\t\tif(typeof result.file_original[row] == 'undefined') result.file_original[row] = '';\n\n\t\t// Display only existing lines of file\n\t\tif(result.difference.indexOf(row) != -1){\n\t\t\tfor(let display_depth = 2, curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' && typeof result.file_original[row] !== 'undefined') {\n\t\t\t\t\tjQuery('#spbc_dialog').append(\n\t\t\t\t\t\t(row === curr_row ? row_template_bad : row_template).printf(\n\t\t\t\t\t\t\tresult.file[curr_row] ? result.file[curr_row] : '',\n\t\t\t\t\t\t\tcurr_row,\n\t\t\t\t\t\t\tresult.file_original[curr_row] ? result.file_original[curr_row] : ''\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tjQuery('#spbc_dialog').append(row_template. printf('', '', ''));\n\t\t}\n\t}\n\n\tvar content_height = jQuery('#spbc_dialog div').length * 19 + 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\theight: height,\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: true,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\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\nfunction spbc_scanner__reload_scan_info() {\n\tjQuery('.spbc_hint__last_scan_title').text(spbcScaner.look_below_for_scan_res);\n\tconst data = {\n\t\taction: 'spbc_scanner__last_scan_info'\n\t};\n\tconst params = {\n\t\tcallback: (result) => {\n\t\t\tdocument.getElementById('spbc_scanner__last_scan_info').innerText = result.data;\n\t\t}\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Show snapshots of file\n * @param obj\n */\nfunction spbc_scanner_file_monitoring_show_current_snapshot(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileId = self.parents('.row-actions').attr('uid');\n\tconst file_name = self.closest('.column-path').find('.title').text();\n\n\t// Init and open remodal\n\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\tconst remodalObject = remodal.remodal();\n\tremodalObject.open();\n\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_snapshots',\n\t\tfile_id: fileId,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-list ul').remove();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-file-name').text(file_name);\n\t\t\t\tdrawSnapshotList(result.data, remodal);\n\t\t\t\tdrawCurrentSnapshot(result.data[0].id, remodal);\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n *\n * @param data\n * @param remodal\n */\nfunction drawSnapshotList(data, remodal)\n{\n\tlet list = '';\n\n\tfor (let item of data) {\n\t\tlist += `
    • ${item.created_at}
    • `;\n\t}\n\n\tlet html =\n\t\t`
        \n ${list}\n
      `;\n\n\tremodal.find('#spbc-fm-snapshot-list').append(html);\n}\n\nfunction drawCurrentSnapshot(snapshot_id, remodal)\n{\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_current_snapshot',\n\t\tsnapshot_id,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tbeforeSend: function() {\n\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').show();\n\t\t},\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view .wrap').remove();\n\t\t\t\tremodal.find('[data-spanshot-id').removeClass('active');\n\t\t\t\tremodal.find('[data-spanshot-id=' + snapshot_id + ']').addClass('active');\n\n\t\t\t\tlet html =\n\t\t\t\t\t`
      \n
      \n                            \n                                ${result.data.content}\n                            \n                        
      \n
      `;\n\n\t\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').hide();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view').append(html);\n\t\t\t\tdocument.querySelectorAll('pre code').forEach((el) => {\n\t\t\t\t\thljs.highlightElement(el);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Cure file\n * @param obj\n */\nfunction spbc_scanner_button_cure_file_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_file_cure_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Restore file from backup\n * @param obj\n */\nfunction spbc_scanner_button_restore_from_backup_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_restore_file_from_backup_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// EVENT HADLING\n\tspbc_tbl__bulk_actions__listen(); // Table. Row bulk handler\n\tspbc_tbl__row_actions__listen(); // Table. Row actions handler\n\tspbc_tbl__pagination__listen(); // Table. Pagination handler\n\tspbc_tbl__sort__listen(); // Table. Sort handler\n\n\tspbcStartShowHide();\n\n\t// Preparing progressbar\n\tjQuery('#spbc_scaner_progress_bar').progressbar({\n\t\tvalue: 0,\n\t\tcreate: function( event, ui ) {\n\t\t\tevent.target.style.position = 'relative';\n\t\t\tevent.target.style.marginBottom = '12px';\n\t\t},\n\t\tchange: function(event, ui){\n\t\t\tjQuery('.spbc_progressbar_counter span').text(jQuery(event.target).progressbar('option', 'value') + ' %');\n\t\t},\n\t});\n\n\t// Preparing accordion\n\tjQuery('#spbc_scan_accordion').accordion({\n\t\theader: \"h3\",\n\t\theightStyle: 'content',\n\t\tcollapsible: true,\n\t\tactive: false,\n\t\tactivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 0 && ui.oldHeader.length === 0 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom spbc-overflow--visible\");\n\t\t},\n\t\tbeforeActivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 1 && ui.oldHeader.length === 1 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom\");\n\t\t}\n\t});\n\n\t// Init scanner plugin\n\twindow.spbc_scanner = new spbcMalwareScanner({\n\t\tsettings: spbcScaner.settings,\n\t\tstates: spbcScaner.states,\n\t\tbutton: jQuery('#spbc_perform_scan'),\n\t\tspinner: jQuery('#spbc_perform_scan').next(),\n\t\tcallback: null,\n\t\tprogress_overall: jQuery('#spbc_scaner_progress_overall'),\n\t\tprogressbar: jQuery('#spbc_scaner_progress_bar'),\n\t\tprogressbar_text: jQuery('.spbc_progressbar_counter span'),\n\t\twrapper: document.getElementsByClassName('spbc_unchecked_file_list'),\n\t\twarnings: {\n\t\t\tlong_scan: jQuery('.spbc_hint_warning__long_scan'),\n\t\t\toutdated: jQuery('.spbc_hint_warning__outdated')\n\t\t}\n\t});\n\n\tjQuery(document).on('click', '.spbc_popup_tip--icon---show', function(){\n\t\tspbc_popup_tip___show( jQuery( this ) );\n\t});\n\n\tjQuery('#spbc_perform_scan').on('click', function(){\n\t\tjQuery('#spbcscan-results-log-module').remove();\n\t\tspbc_scanner.actionControl();\n\n\t\tif (!jQuery(\".spbc_log-wrapper .panel-body\").length) {\n\t\t\tjQuery(\".spbc_log-wrapper\").append('
      ');\n\t\t}\n\n\t\tjQuery(\".spbc_log-wrapper\").resizable({\n\t\t\thandles: 'n, s',\n\t\t\tcontainment: 'document',\n\t\t});\n\t});\n\n\tjQuery(\"#spbcscan-results-log-module\").resizable({\n\t\thandles: 'n, s',\n\t\tcontainment: 'document',\n\t});\n\n\t//DEBUG\n\t// Clear table\n\tjQuery('#spbc_scanner_clear').on('click', function(){\n\n\t\tif( ! confirm('Do you wanna clear the table with file scan results?') )\n\t\t\treturn;\n\n\t\tconsole.log('CLEAR');\n\n\t\tspbc_sendAJAXRequest(\n\t\t\t{ action: 'spbc_scanner_clear', },\n\t\t\t{\n\t\t\t\ttype: 'GET',\n\t\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\t\tcomplete: null,\n\t\t\t\terrorOutput: null,\n\t\t\t\tcontext: this,\n\t\t\t\ttimeout: 40000\n\t\t\t},\n\t\t);\n\t});\n\n\tjQuery('#spbc_scanner_save_to_pdf').on('click', function(){\n\t\tjQuery.ajax({\n\t\t\turl: spbcSettings.ajaxurl,\n\t\t\ttype: 'POST',\n\t\t\tdata: {\n\t\t\t\taction: 'spbc_scanner_save_to_pdf',\n\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\tno_cache: Math.random()\n\t\t\t},\n\t\t\txhrFields: {\n\t\t\t\tresponseType: 'blob'\n\t\t\t},\n\t\t\tsuccess: function(data) {\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\turl: spbcSettings.ajaxurl,\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\taction: 'spbc_scanner_get_pdf_file_name',\n\t\t\t\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\t\t\t\tno_cache: Math.random()\n\t\t\t\t\t\t},\n\t\t\t\t\t\txhrFields: {\n\t\t\t\t\t\t\tresponseType: 'text'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(filename) {\n\t\t\t\t\t\t\tlet blob=new Blob([data]);\n\t\t\t\t\t\t\tlet link=document.createElement('a');\n\t\t\t\t\t\t\tlink.href=window.URL.createObjectURL(blob);\n\t\t\t\t\t\t\tlink.download=filename.data;\n\t\t\t\t\t\t\tlink.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t});\n\t});\n\n\t// Select snapshot\n\tjQuery(document).on('click', '.spbc-fm-snapshot-list [data-spanshot-id]', function() {\n\t\tconst currentSnapshotId = jQuery(this).data('spanshot-id');\n\t\tconst activeSnapshotId = jQuery('.spbc-fm-snapshot-list [data-spanshot-id].active').data('spanshot-id');\n\n\t\tif (currentSnapshotId === activeSnapshotId) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\t\tdrawCurrentSnapshot(currentSnapshotId, remodal)\n\t});\n});"],"names":["spbc_popup_tip___show","show_icon","remove_desc_func","e","jQuery","target","parent","length","hasClass","hide","document","off","tip_title","attr","tip_text","obj","after","empty","append","css","top","position","left","on","parents","spbc_scanner_button_file_view_event","self","data","action","file_id","params","spinner","siblings","callback","spbc_scannerButtonView_callback","errorOutput","msg","spbcModal","open","putError","spbc_sendAJAXRequest","spbc_scanner_analysis_log_delete_from_log","window","location","reload","spbc_scanner_button_page_view_event","page_url","wp_wrap","dialog_window","dialog","modal","title","my","at","of","width","show","effect","duration","draggable","resizable","closeText","classes","ui-dialog","event","ui","style","overflow","height","documentElement","beforeClose","body","size_multiplier","result","let","row","display","file","printf","content_height","Object","keys","visible_height","file_path","console","log","spbc_scanner_button_file_view_bad_event","spbc_scannerButtonViewBadFile_callback","spbc_scanner_button_page_view_bad_event","spbc_scannerButtonViewBad_callback","arguments","severity","str_num","row_template","str_nums","weak_spots","JSON","parse","concat","Set","sort","curr_row","last","remove","afterClose","success","bad_strings_map","Map","entries","CRITICAL","is_bad_string","unformatted_row","highlited_row","get","content","close","spbc_scanner_button_file_compare_event","spbc_scannerButtonFileCompare_callback","file_original","difference","indexOf","spbc_scanner__reload_scan_info","text","spbcScaner","look_below_for_scan_res","getElementById","innerText","spbc_scanner_file_monitoring_show_current_snapshot","fileId","file_name","closest","find","remodal","security","spbcSettings","ajax_nonce","ajax","type","async","url","ajaxurl","drawSnapshotList","drawCurrentSnapshot","id","list","item","created_at","html","snapshot_id","beforeSend","removeClass","addClass","querySelectorAll","forEach","hljs","highlightElement","el","spbc_scanner_button_cure_file_ajax_handler","file_fast_hash","put","addEventListener","spbc_scanner_button_restore_from_backup_ajax_handler","ready","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","progressbar","value","create","marginBottom","change","accordion","header","heightStyle","collapsible","active","activate","oldPanel","oldHeader","beforeActivate","spbc_scanner","spbcMalwareScanner","settings","states","button","next","progress_overall","progressbar_text","wrapper","getElementsByClassName","warnings","long_scan","outdated","this","actionControl","handles","containment","confirm","successCallback","complete","context","timeout","no_cache","Math","random","xhrFields","responseType","filename","blob","Blob","link","createElement","href","URL","createObjectURL","download","click","currentSnapshotId"],"mappings":"AAAA,SAASA,sBAAsBC,GAIP,SAAnBC,EAA4BC,GAGjB,KAAA,IAANA,IAEyD,GAA9DC,OAAOD,EAAEE,MAAM,EAAEC,OAAO,0BAA0B,EAAEC,QAAeH,CAAAA,OAAOD,EAAEE,MAAM,EAAEG,SAAS,+BAA+B,GAC5HJ,OAAOD,EAAEE,MAAM,EAAEG,SAAS,6BAA6B,KAGzDJ,OAAO,0BAA0B,EAAEK,KAAK,EACxCL,OAAOM,QAAQ,EAAEC,IAAI,QAAST,CAAgB,EAEhD,CAdA,IAAIU,EAAYX,EAAUY,KAAK,gBAAgB,GAAK,KAChDC,EAAYb,EAAUY,KAAK,eAAe,GAAM,KAm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Y9L,SAASiC,SAAWjC,SAASiC,QAAS,EACnE8J,SAAU,KACVtK,YAAa,KACbuK,QAASP,KACTQ,QAAS,GACV,CACD,EACD,CAAC,EAEDvM,OAAO,2BAA2B,EAAEmB,GAAG,QAAS,WAC/CnB,OAAOoI,KAAK,CACXG,IAAKL,aAAaM,QAClBH,KAAM,OACN9G,KAAM,CACLC,OAAQ,2BACRyG,SAAUC,aAAaC,WACvBqE,SAAUC,KAAKC,OAAO,CACvB,EACAC,UAAW,CACVC,aAAc,MACf,EACAvG,QAAS,SAAS9E,GACjBvB,OAAOoI,KAAK,CACVG,IAAKL,aAAaM,QAClBH,KAAM,OACN9G,KAAM,CACLC,OAAQ,iCACRyG,SAAUC,aAAaC,WACvBqE,SAAUC,KAAKC,OAAO,CACvB,EACAC,UAAW,CACVC,aAAc,MACf,EACAvG,QAAS,SAASwG,GACjBvI,IAAIwI,EAAK,IAAIC,KAAK,CAACxL,EAAK,EACpByL,EAAK1M,SAAS2M,cAAc,GAAG,EACnCD,EAAKE,KAAK5K,OAAO6K,IAAIC,gBAAgBN,CAAI,EACzCE,EAAKK,SAASR,EAAStL,KACvByL,EAAKM,MAAM,CACZ,CACD,CACD,CACD,CACD,CAAC,CACF,CAAC,EAGDtN,OAAOM,QAAQ,EAAEa,GAAG,QAAS,4CAA6C,WACzE,IAAMoM,EAAoBvN,OAAO+L,IAAI,EAAExK,KAAK,aAAa,EAGrDgM,IAFqBvN,OAAO,kDAAkD,EAAEuB,KAAK,aAAa,GAOtGmH,oBAAoB6E,EADJvN,OAAO,8CAA8C,CACvB,CAC/C,CAAC,CACF,CAAC"} \ No newline at end of file +{"version":3,"file":"spbc-settings_tab--scanner.min.js","sources":["spbc-settings_tab--scanner.js"],"sourcesContent":["function spbc_popup_tip___show(show_icon){\n\n\tvar tip_title = show_icon.attr('spbc_tip_title') || null;\n\tvar\ttip_text = show_icon.attr('spbc_tip_text') || null;\n\tvar remove_desc_func = function(e){\n\n\t\tif(\n\t\t\ttypeof e === 'undefined' ||\n\t\t\t(\n\t\t\t\t(jQuery(e.target).parent('.spbc_popup_tip--wrapper').length == 0 || jQuery(e.target).hasClass('spbc_popup_tip--icon---cancel')) &&\n\t\t\t\t!jQuery(e.target).hasClass('spbc_popup_tip--icon---show')\n\t\t\t)\n\t\t){\n\t\t\tjQuery('.spbc_popup_tip--wrapper').hide();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tshow_icon.after(\"
      \");\n\n\tvar obj = jQuery('.spbc_popup_tip--wrapper');\n\n\tobj.empty()\n\t\t.append(\"
      \")\n\t\t.css({\n\t\t\ttop: show_icon.position().top - 2,\n\t\t\tleft: show_icon.position().left + 25\n\t\t});\n\tobj.append(\"\")\n\t\t.append(\"

      \" + tip_title + \"

      \")\n\t\t.append(\"

      \" + 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\tconst self = jQuery(obj);\n\tconst data = {\n\t\taction: 'spbc_scanner_analysis_log_delete_from_log',\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: window.location.reload(),\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\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('\"Wait')\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


      ';\n\n\tfor(let row in result.file){\n\t\tdialog_window.append(row_template.printf(row, result.file[row]));\n\t}\n\n\tlet content_height = Object.keys(result.file).length * 19 < 76 ? 76 : Object.keys(result.file).length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'hidden' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tdialog_window.css({\n\t\theight: height,\n\t\toverflow: overflow\n\t})\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: ('Loaded: ' + result.file_path),\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\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 = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() { \n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close'); \n\t\t\t}); \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\tconsole.log('FILE_VIEWED');\n\n}\n\nfunction spbc_scanner_button_file_view_bad_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_scannerButtonViewBadFile_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_bad_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parent().attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonViewBad_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonViewBadFile_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE_FILE');\n\tconsole.log(arguments);\n\tjQuery('#spbc_dialog').empty();\n\n\tvar row_template = '
      %s

      %s


      ',\n\t\trow_template_bad = '
      %s

      %s


      ',\n\t\tstr_nums = [];\n\n\tresult.weak_spots = JSON.parse(result.weak_spots);\n\tfor(let severity in result.weak_spots){\n\t\tstr_nums = str_nums.concat(Object.keys(result.weak_spots[severity]));\n\t}\n\tstr_nums = [...new Set(str_nums)].sort(); // Sort bad line\n\n\tfor(let str_num in str_nums){\n\n\t\tlet row = +str_nums[str_num],\n\t\t\tdisplay_depth = 2;\n\n\t\t// Display only existing lines of file\n\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\tjQuery('#spbc_dialog').append((row === curr_row ? row_template_bad : row_template).printf(curr_row, result.file[curr_row]));\n\t\t\t}\n\t\t}\n\n\t\t// Placing an empty string between results\n\t\tjQuery('#spbc_dialog').append(row_template. printf('', ''));\n\n\t}\n\n\t// Removing last empty string\n\tjQuery('#spbc_dialog div').last().remove();\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\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 = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() { \n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close'); \n\t\t\t}); \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\nfunction spbc_scannerButtonViewBad_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE');\n\n\tconsole.log(arguments);\n\n\tlet afterClose = () => {};\n\n\tif ( result.success == true ) {\n\t\tconsole.log(result);\n\t\tvar row_template = '
      ' +\n\t\t\t\t'%s' +\n\t\t\t\t'

      %s

      ' +\n\t\t\t\t'
      ',\n\t\t\trow_template_bad = '
      ' +\n\t\t\t\t'%s' +\n\t\t\t\t'

      %s

      ' +\n\t\t\t\t'
      ',\n\t\t\tstr_nums = [];\n\n\t\tresult.weak_spots = JSON.parse(result.weak_spots);\n\t\tfor(let severity in result.weak_spots){\n\t\t\tstr_nums = str_nums.concat(Object.keys(result.weak_spots[severity]));\n\t\t}\n\n\t\tstr_nums = [...new Set(str_nums)].sort(); // Sort bad line\n\t\t//get a map of bad strings\n\t\tlet bad_strings_map = new Map(Object.entries(result.weak_spots.CRITICAL)) //TODO: Probably there can get something else except CRITICAL in the future\n\t\tfor(let str_num in str_nums){\n\n\t\t\tlet row = +str_nums[str_num],\n\t\t\t\tdisplay_depth = 2;\n\n\t\t\t// Display only existing lines of file\n\t\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\t\tlet is_bad_string = (row === curr_row)\n\t\t\t\t\tlet unformatted_row\n\t\t\t\t\tlet highlited_row\n\t\t\t\t\tif (is_bad_string){\n\t\t\t\t\t\tunformatted_row = row_template_bad\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunformatted_row = row_template\n\t\t\t\t\t}\n\t\t\t\t\tif (is_bad_string){\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, bad_strings_map.get(str_nums[str_num]));\n\t\t\t\t\t} else {\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, result.file[curr_row]);\n\t\t\t\t\t}\n\t\t\t\t\tjQuery('#spbc_dialog').append(highlited_row);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Placing an empty string between results\n\t\t\tjQuery('#spbc_dialog').append(row_template. printf('', ''));\n\n\t\t\t// Removing last empty string\n\t\t\tjQuery('#spbc_dialog div').last().remove();\n\t\t}\n\t} else {\n\t\tlet wrapperElement = '
      %s
      '\n\t\tjQuery('#spbc_dialog').append(wrapperElement.printf(result.content));\n\t\tafterClose = () => {document.location.reload();};\n\t}\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\theight = 'auto',\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll';\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\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 = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() { \n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close'); \n\t\t\t}); \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\tclose: afterClose,\n\t});\n}\n\nfunction spbc_scanner_button_file_compare_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_compare',\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_scannerButtonFileCompare_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonFileCompare_callback(result, data, params){\n\n\tconsole.log('FILE_COMPARED');\n\n\tlet row_template = '

      %s

      %s

      %s


      ';\n\tlet row_template_bad = '

      %s

      %s

      %s


      ';\n\n\tjQuery('#spbc_dialog').append(row_template.printf('Modified', 'Line', 'Original'));\n\n\tfor(var row=1, prev = false, next = false; typeof result.file[row] != 'undefined' || typeof result.file_original[row] != 'undefined'; row++){\n\n\t\tif(typeof result.file[row] == 'undefined') result.file[row] = '';\n\t\tif(typeof result.file_original[row] == 'undefined') result.file_original[row] = '';\n\n\t\t// Display only existing lines of file\n\t\tif(result.difference.indexOf(row) != -1){\n\t\t\tfor(let display_depth = 2, curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' && typeof result.file_original[row] !== 'undefined') {\n\t\t\t\t\tjQuery('#spbc_dialog').append(\n\t\t\t\t\t\t(row === curr_row ? row_template_bad : row_template).printf(\n\t\t\t\t\t\t\tresult.file[curr_row] ? result.file[curr_row] : '',\n\t\t\t\t\t\t\tcurr_row,\n\t\t\t\t\t\t\tresult.file_original[curr_row] ? result.file_original[curr_row] : ''\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tjQuery('#spbc_dialog').append(row_template. printf('', '', ''));\n\t\t}\n\t}\n\n\tvar content_height = jQuery('#spbc_dialog div').length * 19 + 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\theight: height,\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: true,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\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\nfunction spbc_scanner__reload_scan_info() {\n\tjQuery('.spbc_hint__last_scan_title').text(spbcScaner.look_below_for_scan_res);\n\tconst data = {\n\t\taction: 'spbc_scanner__last_scan_info'\n\t};\n\tconst params = {\n\t\tcallback: (result) => {\n\t\t\tdocument.getElementById('spbc_scanner__last_scan_info').innerText = result.data;\n\t\t}\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Show snapshots of file\n * @param obj\n */\nfunction spbc_scanner_file_monitoring_show_current_snapshot(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileId = self.parents('.row-actions').attr('uid');\n\tconst file_name = self.closest('.column-path').find('.title').text();\n\n\t// Init and open remodal\n\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\tconst remodalObject = remodal.remodal();\n\tremodalObject.open();\n\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_snapshots',\n\t\tfile_id: fileId,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-list ul').remove();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-file-name').text(file_name);\n\t\t\t\tdrawSnapshotList(result.data, remodal);\n\t\t\t\tdrawCurrentSnapshot(result.data[0].id, remodal);\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n *\n * @param data\n * @param remodal\n */\nfunction drawSnapshotList(data, remodal)\n{\n\tlet list = '';\n\n\tfor (let item of data) {\n\t\tlist += `
    • ${item.created_at}
    • `;\n\t}\n\n\tlet html =\n\t\t`
        \n ${list}\n
      `;\n\n\tremodal.find('#spbc-fm-snapshot-list').append(html);\n}\n\nfunction drawCurrentSnapshot(snapshot_id, remodal)\n{\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_current_snapshot',\n\t\tsnapshot_id,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tbeforeSend: function() {\n\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').show();\n\t\t},\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view .wrap').remove();\n\t\t\t\tremodal.find('[data-spanshot-id').removeClass('active');\n\t\t\t\tremodal.find('[data-spanshot-id=' + snapshot_id + ']').addClass('active');\n\n\t\t\t\tlet html =\n\t\t\t\t\t`
      \n
      \n                            \n                                ${result.data.content}\n                            \n                        
      \n
      `;\n\n\t\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').hide();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view').append(html);\n\t\t\t\tdocument.querySelectorAll('pre code').forEach((el) => {\n\t\t\t\t\thljs.highlightElement(el);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Cure file\n * @param obj\n */\nfunction spbc_scanner_button_cure_file_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_file_cure_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Restore file from backup\n * @param obj\n */\nfunction spbc_scanner_button_restore_from_backup_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_restore_file_from_backup_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Clear scan results\n */\nfunction spbc_scanner_button_clear_scan_results()\n{\n\tif( ! confirm('Do you confirm to clear the scan results?') )\n\t\treturn;\n\n\tconsole.log('CLEAR');\n\n\tspbc_sendAJAXRequest(\n\t\t{ action: 'spbc_scanner_clear', },\n\t\t{\n\t\t\ttype: 'GET',\n\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\tcomplete: null,\n\t\t\terrorOutput: null,\n\t\t\tcontext: this,\n\t\t\ttimeout: 40000,\n\t\t\tsuccess: function() {\n\t\t\t\tdocument.location.reload();\n\t\t\t},\n\t\t},\n\t);\n}\n\njQuery(document).ready(function(){\n\n\t// EVENT HADLING\n\tspbc_tbl__bulk_actions__listen(); // Table. Row bulk handler\n\tspbc_tbl__row_actions__listen(); // Table. Row actions handler\n\tspbc_tbl__pagination__listen(); // Table. Pagination handler\n\tspbc_tbl__sort__listen(); // Table. Sort handler\n\n\tspbcStartShowHide();\n\n\t// Preparing progressbar\n\tjQuery('#spbc_scaner_progress_bar').progressbar({\n\t\tvalue: 0,\n\t\tcreate: function( event, ui ) {\n\t\t\tevent.target.style.position = 'relative';\n\t\t\tevent.target.style.marginBottom = '12px';\n\t\t},\n\t\tchange: function(event, ui){\n\t\t\tjQuery('.spbc_progressbar_counter span').text(jQuery(event.target).progressbar('option', 'value') + ' %');\n\t\t},\n\t});\n\n\t// Preparing accordion\n\tjQuery('#spbc_scan_accordion').accordion({\n\t\theader: \"h3\",\n\t\theightStyle: 'content',\n\t\tcollapsible: true,\n\t\tactive: false,\n\t\tactivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 0 && ui.oldHeader.length === 0 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom spbc-overflow--visible\");\n\t\t},\n\t\tbeforeActivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 1 && ui.oldHeader.length === 1 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom\");\n\t\t}\n\t});\n\n\t// Init scanner plugin\n\twindow.spbc_scanner = new spbcMalwareScanner({\n\t\tsettings: spbcScaner.settings,\n\t\tstates: spbcScaner.states,\n\t\tbutton: jQuery('#spbc_perform_scan'),\n\t\tspinner: jQuery('#spbc_perform_scan').next(),\n\t\tcallback: null,\n\t\tprogress_overall: jQuery('#spbc_scaner_progress_overall'),\n\t\tprogressbar: jQuery('#spbc_scaner_progress_bar'),\n\t\tprogressbar_text: jQuery('.spbc_progressbar_counter span'),\n\t\twrapper: document.getElementsByClassName('spbc_unchecked_file_list'),\n\t\twarnings: {\n\t\t\tlong_scan: jQuery('.spbc_hint_warning__long_scan'),\n\t\t\toutdated: jQuery('.spbc_hint_warning__outdated')\n\t\t}\n\t});\n\n\tjQuery(document).on('click', '.spbc_popup_tip--icon---show', function(){\n\t\tspbc_popup_tip___show( jQuery( this ) );\n\t});\n\n\tjQuery('#spbc_perform_scan').on('click', function(){\n\t\tjQuery('#spbcscan-results-log-module').remove();\n\t\tspbc_scanner.actionControl();\n\n\t\tif (!jQuery(\".spbc_log-wrapper .panel-body\").length) {\n\t\t\tjQuery(\".spbc_log-wrapper\").append('
      ');\n\t\t}\n\n\t\tjQuery(\".spbc_log-wrapper\").resizable({\n\t\t\thandles: 'n, s',\n\t\t\tcontainment: 'document',\n\t\t});\n\t});\n\n\tjQuery(\"#spbcscan-results-log-module\").resizable({\n\t\thandles: 'n, s',\n\t\tcontainment: 'document',\n\t});\n\n\t// Clear scanner's tables\n\tjQuery('#spbc_scanner_clear').on('click', function(){\n\n\t\tif( ! confirm('Do you confirm to clear the scan results?') )\n\t\t\treturn;\n\n\t\tconsole.log('CLEAR');\n\n\t\tspbc_sendAJAXRequest(\n\t\t\t{ action: 'spbc_scanner_clear', },\n\t\t\t{\n\t\t\t\ttype: 'GET',\n\t\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\t\tcomplete: null,\n\t\t\t\terrorOutput: null,\n\t\t\t\tcontext: this,\n\t\t\t\ttimeout: 40000,\n\t\t\t\tsuccess: function() {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t});\n\n\tjQuery('#spbc_scanner_save_to_pdf').on('click', function(){\n\t\tjQuery.ajax({\n\t\t\turl: spbcSettings.ajaxurl,\n\t\t\ttype: 'POST',\n\t\t\tdata: {\n\t\t\t\taction: 'spbc_scanner_save_to_pdf',\n\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\tno_cache: Math.random()\n\t\t\t},\n\t\t\txhrFields: {\n\t\t\t\tresponseType: 'blob'\n\t\t\t},\n\t\t\tsuccess: function(data) {\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\turl: spbcSettings.ajaxurl,\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\taction: 'spbc_scanner_get_pdf_file_name',\n\t\t\t\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\t\t\t\tno_cache: Math.random()\n\t\t\t\t\t\t},\n\t\t\t\t\t\txhrFields: {\n\t\t\t\t\t\t\tresponseType: 'text'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(filename) {\n\t\t\t\t\t\t\tlet blob=new Blob([data]);\n\t\t\t\t\t\t\tlet link=document.createElement('a');\n\t\t\t\t\t\t\tlink.href=window.URL.createObjectURL(blob);\n\t\t\t\t\t\t\tlink.download=filename.data;\n\t\t\t\t\t\t\tlink.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t});\n\t});\n\n\t// Select snapshot\n\tjQuery(document).on('click', '.spbc-fm-snapshot-list [data-spanshot-id]', function() {\n\t\tconst currentSnapshotId = jQuery(this).data('spanshot-id');\n\t\tconst activeSnapshotId = jQuery('.spbc-fm-snapshot-list [data-spanshot-id].active').data('spanshot-id');\n\n\t\tif (currentSnapshotId === activeSnapshotId) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\t\tdrawCurrentSnapshot(currentSnapshotId, remodal)\n\t});\n});"],"names":["spbc_popup_tip___show","show_icon","remove_desc_func","e","jQuery","target","parent","length","hasClass","hide","document","off","tip_title","attr","tip_text","obj","after","empty","append","css","top","position","left","on","parents","spbc_scanner_button_file_view_event","self","data","action","file_id","params","spinner","siblings","callback","spbc_scannerButtonView_callback","errorOutput","msg","spbcModal","open","putError","spbc_sendAJAXRequest","spbc_scanner_analysis_log_delete_from_log","window","location","reload","spbc_scanner_button_page_view_event","page_url","wp_wrap","dialog_window","dialog","modal","title","my","at","of","width","show","effect","duration","draggable","resizable","closeText","classes","ui-dialog","event","ui","style","overflow","height","documentElement","beforeClose","body","size_multiplier","result","let","row","display","file","printf","content_height","Object","keys","visible_height","file_path","console","log","spbc_scanner_button_file_view_bad_event","spbc_scannerButtonViewBadFile_callback","spbc_scanner_button_page_view_bad_event","spbc_scannerButtonViewBad_callback","arguments","severity","str_num","row_template","str_nums","weak_spots","JSON","parse","concat","Set","sort","curr_row","last","remove","afterClose","success","bad_strings_map","Map","entries","CRITICAL","is_bad_string","unformatted_row","highlited_row","get","content","close","spbc_scanner_button_file_compare_event","spbc_scannerButtonFileCompare_callback","file_original","difference","indexOf","spbc_scanner__reload_scan_info","text","spbcScaner","look_below_for_scan_res","getElementById","innerText","spbc_scanner_file_monitoring_show_current_snapshot","fileId","file_name","closest","find","remodal","security","spbcSettings","ajax_nonce","ajax","type","async","url","ajaxurl","drawSnapshotList","drawCurrentSnapshot","id","list","item","created_at","html","snapshot_id","beforeSend","removeClass","addClass","querySelectorAll","forEach","hljs","highlightElement","el","spbc_scanner_button_cure_file_ajax_handler","file_fast_hash","put","addEventListener","spbc_scanner_button_restore_from_backup_ajax_handler","spbc_scanner_button_clear_scan_results","confirm","successCallback","complete","context","this","timeout","ready","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","progressbar","value","create","marginBottom","change","accordion","header","heightStyle","collapsible","active","activate","oldPanel","oldHeader","beforeActivate","spbc_scanner","spbcMalwareScanner","settings","states","button","next","progress_overall","progressbar_text","wrapper","getElementsByClassName","warnings","long_scan","outdated","actionControl","handles","containment","no_cache","Math","random","xhrFields","responseType","filename","blob","Blob","link","createElement","href","URL","createObjectURL","download","click","currentSnapshotId"],"mappings":"AAAA,SAASA,sBAAsBC,GAIP,SAAnBC,EAA4BC,GAGjB,KAAA,IAANA,IAEyD,GAA9DC,OAAOD,EAAEE,MAAM,EAAEC,OAAO,0BAA0B,EAAEC,QAAeH,CAAAA,OAAOD,EAAEE,MAAM,EAAEG,SAAS,+BAA+B,GAC5HJ,OAAOD,EAAEE,MAAM,EAAEG,SAAS,6BAA6B,KAGzDJ,OAAO,0BAA0B,EAAEK,KAAK,EACxCL,OAAOM,QAAQ,EAAEC,IAAI,QAAST,CAAgB,EAEhD,CAdA,IAAIU,EAAYX,EAAUY,KAAK,gBAAgB,GAAK,KAChDC,EAAYb,EAAUY,KAAK,eAAe,GAAM,KAmBhDE,GAJJb,EAAiB,EAEjBD,EAAUe,MAAM,6CAA6C,EAEnDZ,OAAO,0BAA0B,GAE3CW,EAAIE,MAAM,EACRC,OAAO,2CAA2C,EAClDC,IAAI,CACJC,IAAKnB,EAAUoB,SAAS,EAAED,IAAM,EAChCE,KAAMrB,EAAUoB,SAAS,EAAEC,KAAO,EACnC,CAAC,EACFP,EAAIG,OAAO,2DAA2D,EACpEA,OAAO,qCAAuCN,EAAY,OAAO,EACjEM,OAAO,mCAAqCJ,EAAW,MAAM,EAE/DV,OAAOM,QAAQ,EAAEa,GAAG,QAASrB,CAAgB,EAC7CD,E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D,QAAS,WACR/F,SAASiC,SAASC,OAAO,CAC1B,CACD,CACD,EACD,CAAC,EAEDxC,OAAO,2BAA2B,EAAEmB,GAAG,QAAS,WAC/CnB,OAAOoI,KAAK,CACXG,IAAKL,aAAaM,QAClBH,KAAM,OACN9G,KAAM,CACLC,OAAQ,2BACRyG,SAAUC,aAAaC,WACvBsE,SAAUC,KAAKC,OAAO,CACvB,EACAC,UAAW,CACVC,aAAc,MACf,EACAxG,QAAS,SAAS9E,GACjBvB,OAAOoI,KAAK,CACVG,IAAKL,aAAaM,QAClBH,KAAM,OACN9G,KAAM,CACLC,OAAQ,iCACRyG,SAAUC,aAAaC,WACvBsE,SAAUC,KAAKC,OAAO,CACvB,EACAC,UAAW,CACVC,aAAc,MACf,EACAxG,QAAS,SAASyG,GACjBxI,IAAIyI,EAAK,IAAIC,KAAK,CAACzL,EAAK,EACpB0L,EAAK3M,SAAS4M,cAAc,GAAG,EACnCD,EAAKE,KAAK7K,OAAO8K,IAAIC,gBAAgBN,CAAI,EACzCE,EAAKK,SAASR,EAASvL,KACvB0L,EAAKM,MAAM,CACZ,CACD,CACD,CACD,CACD,CAAC,CACF,CAAC,EAGDvN,OAAOM,QAAQ,EAAEa,GAAG,QAAS,4CAA6C,WACzE,IAAMqM,EAAoBxN,OAAOmK,IAAI,EAAE5I,KAAK,aAAa,EAGrDiM,IAFqBxN,OAAO,kDAAkD,EAAEuB,KAAK,aAAa,GAOtGmH,oBAAoB8E,EADJxN,OAAO,8CAA8C,CACvB,CAC/C,CAAC,CACF,CAAC"} \ No newline at end of file diff --git a/js/src/spbc-scanner-plugin.js b/js/src/spbc-scanner-plugin.js index 1a194ba13..b7b3ccd4e 100644 --- a/js/src/spbc-scanner-plugin.js +++ b/js/src/spbc-scanner-plugin.js @@ -157,6 +157,12 @@ class spbcMalwareScanner{ }, jQuery('#spbc_scan_accordion') ); + + if (!jQuery('#spbc_scanner_clear').length) { + let clear_link = '
      '; + jQuery(clear_link).insertBefore('#spbcscan-scanner-caption'); + } } }; diff --git a/js/src/spbc-settings.js b/js/src/spbc-settings.js index 9f43bc021..863399ef7 100644 --- a/js/src/spbc-settings.js +++ b/js/src/spbc-settings.js @@ -72,6 +72,12 @@ function spbc_draw_settings_callback(result, data, params, obj){ spbc_settings__show_description(self, self.attr('setting')); }); + jQuery(document).off( 'click', '.spbc_long_recommendation__show'); + jQuery(document).on('click', '.spbc_long_recommendation__show', function(){ + self = jQuery(this); + spbc_settings__show_recommendation(self, self.attr('setting')); + }); + if(params.additional){ switch (params.additional.action) { case 'highlight': @@ -201,6 +207,46 @@ function spbc_settings__show_description(label, setting_id){ ); } +function spbc_settings__show_recommendation(label, setting_id){ + + var remove_recommendation_func = function(e){ + if(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'))){ + jQuery('.spbc_long_desc').remove(); + jQuery(document).off('click', remove_recommendation_func); + } + }; + + remove_recommendation_func(); + + label.after("
      "); + var obj = jQuery('#spbc_long_desc__'+setting_id); + obj.append("") + .append("
      ") + .css({ + top: label.position().top + 25, + left: label.position().left + 5 + }); + + + spbc_sendAJAXRequest( + {action: 'spbc_settings__get_recommendation', setting_id: setting_id}, + { + spinner: obj.children('img'), + callback: function(result, data, params, obj){ + + obj.empty() + .append("
      ") + .append("") + .append("

      "+result.title+"

      ") + .append("

      "+result.desc+"

      "); + + jQuery(document).on('click', remove_recommendation_func); + } + }, + obj + ); +} + // Shows/hides full text function spbcStartShowHide(){ jQuery('.spbcShortText') @@ -550,10 +596,12 @@ jQuery(document).ready(function(){ // Switch by DEFAULT }else if( +spbcSettings.wpms && !+spbcSettings.is_main_site){ spbc_tab = document.getElementsByClassName('spbc_tab_nav-security_log')[0]; - // Switch if KEY IS BAD - }else if( +spbcSettings.key_is_ok ){ - // spbc_tab = document.getElementsByClassName('spbc_tab_nav-summary')[0]; + // Switch if Key is OK and SFW is ON + }else if( +spbcSettings.key_is_ok && +spbcSettings.secfw_enabled ){ spbc_tab = document.getElementsByClassName('spbc_tab_nav-traffic_control')[0]; + // Switch if Key is OK + }else if( +spbcSettings.key_is_ok ){ + spbc_tab = document.getElementsByClassName('spbc_tab_nav-scanner')[0]; // Switch if KEY IS BAD }else{ spbc_tab = document.getElementsByClassName('spbc_tab_nav-settings_general')[0]; diff --git a/js/src/spbc-settings_tab--scanner.js b/js/src/spbc-settings_tab--scanner.js index a5269184f..e5c447287 100644 --- a/js/src/spbc-settings_tab--scanner.js +++ b/js/src/spbc-settings_tab--scanner.js @@ -616,6 +616,32 @@ function spbc_scanner_button_restore_from_backup_ajax_handler(obj) }); } +/** + * Clear scan results + */ +function spbc_scanner_button_clear_scan_results() +{ + if( ! confirm('Do you confirm to clear the scan results?') ) + return; + + console.log('CLEAR'); + + spbc_sendAJAXRequest( + { action: 'spbc_scanner_clear', }, + { + type: 'GET', + successCallback: function(){ document.location = document.location }, + complete: null, + errorOutput: null, + context: this, + timeout: 40000, + success: function() { + document.location.reload(); + }, + }, + ); +} + jQuery(document).ready(function(){ // EVENT HADLING @@ -694,11 +720,10 @@ jQuery(document).ready(function(){ containment: 'document', }); - //DEBUG - // Clear table + // Clear scanner's tables jQuery('#spbc_scanner_clear').on('click', function(){ - if( ! confirm('Do you wanna clear the table with file scan results?') ) + if( ! confirm('Do you confirm to clear the scan results?') ) return; console.log('CLEAR'); @@ -711,7 +736,10 @@ jQuery(document).ready(function(){ complete: null, errorOutput: null, context: this, - timeout: 40000 + timeout: 40000, + success: function() { + document.location.reload(); + }, }, ); }); diff --git a/lib/CleantalkSP/Common/Helpers/Data.php b/lib/CleantalkSP/Common/Helpers/Data.php index 495aa34df..d356c8f63 100644 --- a/lib/CleantalkSP/Common/Helpers/Data.php +++ b/lib/CleantalkSP/Common/Helpers/Data.php @@ -163,8 +163,8 @@ public static function removeDirectoryRecursively($dir_path) } } } - - return rmdir($dir_path); + //ignore rmd warns if folder contains . prefix in files/folders + return @rmdir($dir_path); } return true; diff --git a/lib/CleantalkSP/Common/Helpers/HTTP.php b/lib/CleantalkSP/Common/Helpers/HTTP.php index f0117711b..470d7b40d 100644 --- a/lib/CleantalkSP/Common/Helpers/HTTP.php +++ b/lib/CleantalkSP/Common/Helpers/HTTP.php @@ -2,6 +2,7 @@ namespace CleantalkSP\Common\Helpers; +use CleantalkSP\Common\Validate; use CleantalkSP\Templates\Singleton; use CleantalkSP\Common\HTTP\Request; @@ -79,27 +80,47 @@ public static function removeParametersFromURL($url, $parameters) * * @param string $url * - * @return array|string[] + * @return false|int */ public static function getResponseCode($url) { $http = new Request(); - return $http->setUrl($url) - ->setPresets(['get_code', 'no_cache']) - ->request(); + $code = $http->setUrl($url) + ->setPresets(['get_code', 'no_cache']) + ->request(); + + if (!empty($code['error'])) { + return false; + } + + if (is_array($code)) { + $code = reset($code); + } + + if (is_string($code)) { + $code = (int) $code; + } + + return Validate::isValidHTTPResponseCode($code) ? $code : false; } /** * Wrapper for http_request * Requesting data via HTTP request with GET method * - * @param string $url + * @param string $url url of the source + * @param bool $check_response_code flag to check if response code is 200, default is true. + * If code is incorrect return array with error HTTP_RESPONSE_BAD. * * @return array|mixed|string */ - public static function getContentFromURL($url) + public static function getContentFromURL($url, $check_response_code = true) { + if ( $check_response_code && static::getResponseCode($url) !== 200 ) { + return array('error' => 'HTTP_RESPONSE_BAD'); + } + $http = new Request(); return $http @@ -135,12 +156,6 @@ public static function getDataFromGZ($url) */ public static function getDataFromRemoteGZ($url) { - // Check the response code - $response_code = static::getResponseCode($url); - if (is_int($response_code) && $response_code !== 200) { // Check if it's there - return array('error' => 'Bad HTTP response from file location: ' . $response_code); - } - // Get data $data = static::getContentFromURL($url); if (! empty($data['error'])) { diff --git a/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/Modules/Entropy.php b/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/Modules/Entropy.php index 4f5a976f2..2d5a940e9 100644 --- a/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/Modules/Entropy.php +++ b/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/Modules/Entropy.php @@ -30,6 +30,7 @@ public function __construct($path) * * @param Variables $variables * @return void + * @psalm-suppress UndefinedClass */ public function analyse(Variables $variables) { @@ -54,6 +55,9 @@ public function analyse(Variables $variables) continue; } $num_tokens = count($encoder->encode($variable)); + if ( ! $num_tokens ) { + continue; + } $res = strlen($variable) / $num_tokens; if ( $res < 2 ) { $detected_unreadable_variables[$variables_obj[$variable][0][2]] = [$variable]; @@ -70,6 +74,7 @@ public function analyse(Variables $variables) * * @param $path * @return bool + * @psalm-suppress UndefinedClass */ private function analyseFile($path) { @@ -89,6 +94,9 @@ private function analyseFile($path) foreach ( $filtered_names as $filtered_name ) { $num_tokens = count($encoder->encode($filtered_name)); + if ( ! $num_tokens ) { + continue; + } $res = strlen($filtered_name) / $num_tokens; $sum += $res; } diff --git a/lib/CleantalkSP/Common/Validate.php b/lib/CleantalkSP/Common/Validate.php index 1525684db..317e4ea29 100644 --- a/lib/CleantalkSP/Common/Validate.php +++ b/lib/CleantalkSP/Common/Validate.php @@ -126,4 +126,16 @@ public static function isValidFilePath($variable) { return false; } + + /** + * Validate http response code + * + * @param int $variable + * + * @return bool + */ + public static function isValidHTTPResponseCode($variable) + { + return (bool)preg_match('/^[1-5][0-9][0-9]$/', (string)$variable); + } } diff --git a/lib/CleantalkSP/Security/Firewall.php b/lib/CleantalkSP/Security/Firewall.php index 4df10e582..328ff0c99 100644 --- a/lib/CleantalkSP/Security/Firewall.php +++ b/lib/CleantalkSP/Security/Firewall.php @@ -108,6 +108,8 @@ public function loadFwModule(FirewallModule $module) */ public function run() { + global $spbc; + $results = array(); // Check requests by all enabled modules @@ -133,7 +135,9 @@ public function run() $result = $this->reduceFirewallResultsByPriority($results); // Write log - $this->updateLog($result); + if ( (int) $spbc->settings['secfw__enabled'] ) { + $this->updateLog($result); + } // Do finish action - die or set cookies if ( isset($result->module) ) { @@ -143,7 +147,9 @@ public function run() $this->fw_modules[$result->module]->_die($result); // Allowed } else { - $this->fw_modules[$result->module]->actionsForPassed($result); + if ( (int) $spbc->settings['secfw__enabled'] ) { + $this->fw_modules[$result->module]->actionsForPassed($result); + } } } } diff --git a/lib/CleantalkSP/SpbctWP/Firewall/FirewallModule.php b/lib/CleantalkSP/SpbctWP/Firewall/FirewallModule.php index 276ef9e5d..a4349fb69 100644 --- a/lib/CleantalkSP/SpbctWP/Firewall/FirewallModule.php +++ b/lib/CleantalkSP/SpbctWP/Firewall/FirewallModule.php @@ -76,9 +76,10 @@ public function _die(Result $result) // phpcs:ignore PSR2.Methods.MethodDeclarat break; case 'DENY_BY_WAF_FILE': $reason = __( - 'Blocked by Web Application Firewall: Malicious files upload.', + 'Blocked by Web Application Firewall: Malicious files upload: ', 'security-malware-firewall' ); + $reason .= isset($result->pattern['file_path']) ? $result->pattern['file_path'] : ''; break; case 'DENY_BY_BFP': $reason = __('Blocked by BruteForce Protection: Too many invalid logins.', 'security-malware-firewall'); diff --git a/lib/CleantalkSP/SpbctWP/Firewall/WAF.php b/lib/CleantalkSP/SpbctWP/Firewall/WAF.php index 5b422839a..e4dbbe45c 100644 --- a/lib/CleantalkSP/SpbctWP/Firewall/WAF.php +++ b/lib/CleantalkSP/SpbctWP/Firewall/WAF.php @@ -28,6 +28,12 @@ class WAF extends FirewallModule private $waf_xss_signatures = array(); private $waf_suspicious_signatures = array(); + /** + * List there all the severity levels that WAF should react to during upload + * @var string[] + */ + private static $waf_uploads_severity_warning_levels = array('CRITICAL'); + /** * @psalm-suppress PossiblyUnusedProperty */ @@ -329,19 +335,25 @@ private function wafFileCheck() if ( ! empty($heuristic_result->weak_spots) ) { $patterns = array(); foreach ( $heuristic_result->weak_spots as $severity => $result ) { - $patterns[$severity] = reset($result); + // critical files only should be collected on WAF upload check + if ( static::doUploadStopOnSeverity($severity) ) { + $patterns[$severity] = reset($result); + $patterns['file_path'] = $file_to_check->path; + } } - return new Result( - array( - 'module' => 'WAF', - 'ip' => end($this->ip_array), - 'status' => 'DENY_BY_WAF_FILE', - 'pattern' => $patterns, - 'triggered_for' => 'uploaded_module', - 'waf_action' => 'DENY', - ) - ); + if ( !empty($patterns) ) { + return new Result( + array( + 'module' => 'WAF', + 'ip' => end($this->ip_array), + 'status' => 'DENY_BY_WAF_FILE', + 'pattern' => $patterns, + 'triggered_for' => 'uploaded_module', + 'waf_action' => 'DENY', + ) + ); + } } } } @@ -370,30 +382,62 @@ public static function wafFileCheckModulesCheck( 'output_file_details' => array('path', 'full_hash'), ) ); - $dir_scan->setElements(); - $results = $dir_scan->scan(true); // Output the result - show_message('  ' . __('Checked files:', 'security-malware-firewall')); $details = '
      '; $details .= '
        '; - if ( ! empty($results['error']) ) { - $details .= '
      •   Error occurred while checking file ' . $results['path'] . ': ' . $results['error'] . "
      • "; - } - $overall_result = $results['status'] === 'OK'; + $overall_result = true; + $total_files_checked_count = 0; + + try { + $dir_scan->setElements(); + $results = $dir_scan->scan(true); + $total_files_checked_count = count($results); + foreach ($results as $result) { + // if http error collected or result array invalid + if ( !empty($result['error']) || in_array(array('path','status','severity'), array_keys($result))) { + $details .= '
      •   ' + . __('Error occurred while checking file', 'security_malware_firewall') + . '' + . ' ' + . (!empty($result['path']) ? $result['path'] : '') + . ':' + . ' ' + . !empty($result['error']) ? $result['error'] : __('internal directory scan error', 'security_malware_firewall') + . "
      • "; + } else { + $file_is_ok = !static::doUploadStopOnStatus($result['status']) && !static::doUploadStopOnSeverity($result['severity']); + if ( !$file_is_ok ) { + // Cutting useless path prefix + $title = json_encode($result['weak_spots']); + $title = $title ? esc_html($title) : 'Unknown weak spots'; + $display_path = preg_replace('#^.wp-content.upgrade[\\\\].+?[\\\\]#', '', $result['path']); + $details .= "
      •     $display_path: {$result['status']}
      • "; + $overall_result = false; + } + } + } + } catch (\Exception $e) { + $details = '
      •   ' + . __('internal directory scan error', 'security_malware_firewall') + . ':' + . ' ' + . $e; + $overall_result = true; + } - // Cutting useless path prefix - $display_path = preg_replace('#^.wp-content.upgrade[\\\\].+?[\\\\]#', '', $results['path']); - $details .= "
      •     $display_path: {$results['status']}
      • "; $details .= '
      '; $details .= '
      '; - show_message($details); + + show_message('  ' . __('Checked files count: ', 'security-malware-firewall') . $total_files_checked_count); // Output result message if ( $overall_result ) { show_message('  No malware has been found. Installation continues.'); } else { + show_message('  ' . __('List of infected files:', 'security-malware-firewall')); + show_message($details); // Remove the directory with bad plugin Data::removeDirectoryRecursively($source); @@ -512,6 +556,7 @@ public static function wafFileGetLastBlockedInfo() if ( $result ) { $result = $result[0]; + $result->pattern = str_replace('\\', '\\\\', $result->pattern); $out = array( 'blocked' => true, 'warning' => $spbc->data["wl_brandname"] . __( @@ -660,4 +705,40 @@ private static function whatToCheckAdditionally($signature) return 'nothing'; } + + /** + * Check if needs to stop upload process on severity level. For theme/plugin upload uses self::$waf_uploads_severity_warning_levels + * @param string $severity file severity + * @return bool + */ + private static function doUploadStopOnSeverity($severity) + { + if ( + empty($severity) || + !is_string($severity) || + !in_array($severity, array('CRITICAL', 'SUSPICIOUS', 'DANGER')) + ) { + return false; + } + + $uri = parse_url(Server::get('REQUEST_URI')); + + //check only plugin/theme upload + if (!empty($uri['query']) && + ( + strpos($uri['query'], 'action=upload-plugin') !== false || + strpos($uri['query'], 'action=upload-theme') !== false + ) + ) { + return in_array($severity, self::$waf_uploads_severity_warning_levels); + } + + //do block on any severity + return true; + } + + private static function doUploadStopOnStatus($status) + { + return is_string($status) && !in_array($status, array('OK', 'APROVED', 'APPROVED_BY_CT', 'MODIFIED', 'UNKNOWN')); + } } diff --git a/lib/CleantalkSP/SpbctWP/RemoteCalls.php b/lib/CleantalkSP/SpbctWP/RemoteCalls.php index 1bd1720e4..a3458a71f 100644 --- a/lib/CleantalkSP/SpbctWP/RemoteCalls.php +++ b/lib/CleantalkSP/SpbctWP/RemoteCalls.php @@ -267,11 +267,12 @@ public static function action__scanner__controller() // phpcs:ignore PSR1.Method * @psalm-suppress PossiblyUnusedMethod * @psalm-suppress UnusedVariable */ - public static function action__scanner__check_file() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps + public static function action__scanner__check_dir() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps { $file_infos = Get::get('file_infos'); - if ( ! $file_infos || ! is_array($file_infos) ) { + if ( ! is_array($file_infos) || ! $file_infos ) { wp_send_json(array('error' => 'INVALID_FILE_INFOS')); + return; } $results = array(); @@ -284,7 +285,7 @@ public static function action__scanner__check_file() // phpcs:ignore PSR1.Method ) ); $dir_scan->setFiles([$file_info]); - $results = $dir_scan->scan(); + $results[] = $dir_scan->scan(); } wp_send_json($results); diff --git a/lib/CleantalkSP/SpbctWP/Scanner/DirectoryScan.php b/lib/CleantalkSP/SpbctWP/Scanner/DirectoryScan.php index bbfc9bba0..b4e1c4332 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/DirectoryScan.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/DirectoryScan.php @@ -93,8 +93,6 @@ public function setFiles($files) * * @param bool $multi_thread * - * @throws Exception - * * @return array */ public function scan($multi_thread = false) @@ -130,7 +128,7 @@ private function scanInMultipleThreads() $url_pack[] = HTTP::appendParametersToURL( get_option('home'), RemoteCalls::buildParameters( - 'scanner__check_file', + 'scanner__check_dir', 'spbc', $spbc->api_key, array('file_infos' => $file_pack) @@ -163,7 +161,6 @@ private function scanInMultipleThreads() */ public static function scanInMultipleThreadsCallback($response_content, $_url) { - $response_content = preg_replace('@^(OK|FAIL)\s@', '', $response_content); $response_content = json_decode($response_content, true); if ( $response_content === null ) { @@ -210,8 +207,7 @@ private function scanInSingleThread() throw new Exception('Heuristic scanner. ' . $heur_result['error'], 0); }*/ - $result = Controller::mergeResults($sign_result->weak_spots, $heur_result->weak_spots); - + $result = Controller::mergeResults($sign_result, $heur_result); $this->results = array_merge($this->results, $result); $this->results['path'] = $file['path']; } diff --git a/lib/CleantalkSP/SpbctWP/Scanner/Frontend.php b/lib/CleantalkSP/SpbctWP/Scanner/Frontend.php index 01ca2fc7e..b11b3b553 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/Frontend.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/Frontend.php @@ -2,6 +2,7 @@ namespace CleantalkSP\SpbctWP\Scanner; +use CleantalkSP\SpbctWP\API; use CleantalkSP\SpbctWP\Helpers\HTTP; /** @@ -219,17 +220,12 @@ public function getContent() if (defined('SPBCT_ALLOW_CURL_SINGLE') && SPBCT_ALLOW_CURL_SINGLE) { foreach ( $this->pages as $key => &$page ) { if ( filter_var($page['guid'], FILTER_VALIDATE_URL) ) { - if ( HTTP::getResponseCode($page['guid']) === 200 ) { - $result = HTTP::getContentFromURL($page['guid']); - if (empty($result['error'])) { - $this->pages[ $key ]['content'] = $result; - } else { - $this->postMarkAsChecked($page['ID']); - unset($this->pages[ $key ]); - } + $result = HTTP::getContentFromURL($page['guid']); + if (empty($result['error'])) { + $this->pages[ $key ]['content'] = $result; } else { $this->postMarkAsChecked($page['ID']); - unset($this->pages[$key]); + unset($this->pages[ $key ]); } } else { $this->postMarkAsChecked($page['ID']); @@ -370,4 +366,90 @@ public static function resetCheckResult() return $wpdb->query('DELETE FROM ' . SPBC_TBL_SCAN_FRONTEND . ';'); } + + /** + * Sending logs about scanned frontend malware + * + * @return void + * @throws \Exception + */ + public static function sendFmsLogs() + { + global $spbc, $wpdb; + + $spbc->data['scanner']['last_scan__front_end'] = time(); + + $fms_logs_data = $wpdb->get_results( + 'SELECT page_id, url, weak_spots, dbd_found, redirect_found, signature, csrf' + . ' FROM ' . SPBC_TBL_SCAN_FRONTEND + . ' WHERE approved IS NULL OR approved <> 1;', + ARRAY_A + ); + + $fms_logs_data_prepare = []; + foreach ($fms_logs_data as $fms_value) { + $weak_codes = json_decode($fms_value['weak_spots'], true)['CRITICAL']; + if (is_null($weak_codes)) { + continue; + } + + $page_text_arr = []; + $page_content = HTTP::getContentFromURL($fms_value['url']); + + if (!empty($page_content['error'])) { + continue; + } + + foreach (preg_split("/((\r?\n)|(\r\n?))/", $page_content) as $line) { + $page_text_arr[] = $line; + } + $page_text = implode("\n", $page_text_arr); + + foreach ( $weak_codes as $weak_code ) { + $weak_code = htmlspecialchars_decode($weak_code); + $weak_code = str_replace(array("__SPBCT_RED__", "__SPBCT_RED_END__"), "", $weak_code); + $bad_code_len = 200; + $page_content_before_bad_code = substr($page_text, strpos($page_text, $weak_code) - $bad_code_len, $bad_code_len); + $page_content_after_bad_code = substr($page_text, strpos($page_text, $weak_code) + strlen($weak_code), $bad_code_len); + + // @ToDo check danger_code_type for every $weak_line separately + if ($fms_value['dbd_found']) { + $weak_type = 'DBD'; + } elseif ($fms_value['signature']) { + $weak_type = 'SIG'; + } elseif ($fms_value['csrf']) { + $weak_type = 'CSRF'; + } else { + $weak_type = 'REDIR'; + } + + //[,, <100 before>, <100 after>, , ] + $fms_logs_data_prepare[] = [ + $fms_value['url'], + $weak_code, + $page_content_before_bad_code, + $page_content_after_bad_code, + get_the_modified_date('Y-m-d H:i:s', $fms_value['page_id']), + $weak_type + ]; + } + } + + $scanner_start_local_date = isset($spbc->data['scanner']['scanner_start_local_date']) + ? $spbc->data['scanner']['scanner_start_local_date'] + : current_time('Y-m-d H:i:s'); + + if (count($fms_logs_data_prepare) > 0) { + $result_fms = API::method__security_fms_logs( + $spbc->settings['spbc_key'], // API key + $spbc->data['scanner']['total_site_pages'], // Total pages + count($fms_logs_data_prepare), // Total infected pages + $scanner_start_local_date, // Scanner start date + json_encode($fms_logs_data_prepare) // Logs data + ); + if ( ! empty($result_fms['error']) ) { + throw new \Exception(' Frontend result send: ' . $result_fms['error_message']); + } + } + } } diff --git a/lib/CleantalkSP/SpbctWP/Scanner/Helper.php b/lib/CleantalkSP/SpbctWP/Scanner/Helper.php index f36f45597..dd2a527cb 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/Helper.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/Helper.php @@ -20,7 +20,7 @@ public static function getHashesForCMS($cms, $version) $file_path = 'https://cleantalk-security.s3.amazonaws.com/cms_checksums/' . $cms . '/' . $version . '/' . $cms . '_' . $version . '.json.gz'; if ( HTTP::getResponseCode($file_path) === 200 ) { - $gz_data = HTTP::getContentFromURL($file_path); + $gz_data = HTTP::getContentFromURL($file_path, false); if ( empty($gz_data['error']) ) { if ( function_exists('gzdecode') ) { @@ -64,7 +64,7 @@ public static function getHashesForModules($cms, $type, $plugin, $version) $file_path = 'https://cleantalk-security.s3.amazonaws.com/extensions_checksums/' . $cms . '/' . $type . 's/' . $plugin . '/' . $version . '.csv.gz'; if ( HTTP::getResponseCode($file_path) === 200 ) { - $gz_data = HTTP::getContentFromURL($file_path); + $gz_data = HTTP::getContentFromURL($file_path, false); if ( empty($gz_data['error']) ) { if ( function_exists('gzdecode') ) { @@ -126,7 +126,7 @@ public static function getHashesForApprovedFiles($cms, $type, $version) $file_path = 'https://cleantalk-security.s3-us-west-2.amazonaws.com/extensions_checksums/' . $cms . '/' . $type . '/' . $version . '.csv.gz'; if ( HTTP::getResponseCode($file_path) === 200 ) { - $gz_data = HTTP::getContentFromURL($file_path); + $gz_data = HTTP::getContentFromURL($file_path, false); if ( empty($gz_data['error']) ) { if ( function_exists('gzdecode') ) { @@ -245,9 +245,11 @@ public static function getOriginalFile($file_info) break; } + $page_content = HTTP::getContentFromURL($url_path); + /** @psalm-suppress TypeDoesNotContainType */ - return (int) HTTP::getResponseCode($url_path) === 200 - ? HTTP::getContentFromURL($url_path) - : array('error' => "Couldn't get an original file"); + return empty($page_content['error']) + ? $page_content + : array('error' => "Couldn't get an original file: " . $page_content['error']); } } diff --git a/lib/CleantalkSP/SpbctWP/Scanner/Links.php b/lib/CleantalkSP/SpbctWP/Scanner/Links.php index 8790ac289..19f91781f 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/Links.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/Links.php @@ -159,11 +159,12 @@ public function getPosts($amount) // Getting default pages if ( $this->check_default && ! count($this->content) ) { foreach ( $this->default_pages as $page ) { - if ( HTTP::getResponseCode(get_site_url() . $page) === 200 ) { + $post_content = HTTP::getContentFromURL(get_site_url() . $page); + if ( empty($post_content['error']) ) { $this->content[] = array( 'post_type' => 'default', 'post_id' => get_site_url() . $page, - 'post_content' => HTTP::getContentFromURL(get_site_url() . $page), + 'post_content' => $post_content, ); } } diff --git a/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php b/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php index 573da1862..aae467c07 100755 --- a/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php @@ -708,14 +708,7 @@ public function clean_results($offset = null, $amount = 50000) // phpcs:ignore P } // Deleting newly added exclusions - foreach ( explode("\n", $spbc->settings['scanner__dir_exclusions']) as $exclusion ) { - if ( $exclusion ) { - $this->db->prepare( - 'DELETE FROM ' . SPBC_TBL_SCAN_FILES . ' WHERE path LIKE %s', - ['%' . $this->db->escapeLike($exclusion) . '%'] - )->execute(); - } - } + $this->deleteFilesOfExclusionDirs($spbc->settings['scanner__dir_exclusions']); $out = array( 'total' => (int)$deleted, @@ -803,7 +796,7 @@ public function countFileSystem($path_to_scan = ABSPATH) if ( ! empty($spbc->settings['scanner__dir_exclusions']) ) { $init_params['dir_exceptions'] = array_merge( $init_params['dir_exceptions'], - explode("\n", $spbc->settings['scanner__dir_exclusions']) + spbc__get_exists_directories(explode("\n", $spbc->settings['scanner__dir_exclusions'])) ); } @@ -852,7 +845,7 @@ public function file_system_analysis($offset = null, $amount = null, $path_to_sc if ( ! empty($spbc->settings['scanner__dir_exclusions']) ) { $init_params['dir_exceptions'] = array_merge( $init_params['dir_exceptions'], - explode("\n", $spbc->settings['scanner__dir_exclusions']) + spbc__get_exists_directories(explode("\n", $spbc->settings['scanner__dir_exclusions'])) ); } @@ -1895,13 +1888,13 @@ public function important_files_listing() // phpcs:ignore PSR1.Methods.CamelCaps foreach ( $addresses_to_check_listing as $address ) { $url_to_check = get_option('home') . $address; + $page = HTTP::getContentFromURL($url_to_check); if ( - HTTP::getResponseCode($url_to_check) === 200 + empty($page['error']) && + is_string($page) && + strpos($page, 'Index of ' . $address) !== false ) { - $page = HTTP::getContentFromURL($url_to_check); - if ( strpos($page, 'Index of ' . $address) !== false ) { - $out['accessible_urls'][] = array('url' => $address, 'type' => 'listing'); - } + $out['accessible_urls'][] = array('url' => $address, 'type' => 'listing'); } } @@ -2091,55 +2084,10 @@ public function send_results() // phpcs:ignore PSR1.Methods.CamelCapsMethodName. // Frontend analysis if ( isset($spbc->settings['scanner__frontend_analysis']) && $spbc->settings['scanner__frontend_analysis'] ) { - $spbc->data['scanner']['last_scan__front_end'] = time(); - - $fms_logs_data = $this->db->fetchAll( - 'SELECT `url`, `weak_spots`' - . ' FROM ' . SPBC_TBL_SCAN_FRONTEND - . ' WHERE approved IS NULL OR approved <> 1;' - ); - - $fms_logs_data_prepare = []; - foreach ($fms_logs_data as $fms_key => $fms_value) { - $weak_code = json_decode($fms_value['weak_spots'], true)['CRITICAL']; - if (is_null($weak_code)) { - continue; - } - $weak_code = array_values($weak_code)[0]; - $weak_code = htmlspecialchars_decode($weak_code); - $weak_code = str_replace("__SPBCT_RED__", "", $weak_code); - $weak_code = str_replace("__SPBCT_RED_END__", "", $weak_code); - - $page_text_arr = []; - $page_content = HTTP::getContentFromURL($fms_value['url']); - foreach (preg_split("/((\r?\n)|(\r\n?))/", $page_content) as $line) { - $page_text_arr[] = $line; - } - $page_text = implode("\n", $page_text_arr); - - $bad_code_len = 200; - $page_content_before_bad_code = substr($page_text, strpos($page_text, $weak_code) - $bad_code_len, $bad_code_len); - $page_content_after_bad_code = substr($page_text, strpos($page_text, $weak_code) + strlen($weak_code), $bad_code_len); - - $fms_logs_data_prepare[] = [ - $fms_value['url'], - $weak_code, - $page_content_before_bad_code, - $page_content_after_bad_code - ]; - } - - if (count($fms_logs_data_prepare) > 0) { - $result_fms = API::method__security_fms_logs( - $spbc->settings['spbc_key'], // API key - $spbc->data['scanner']['total_site_pages'], // Total pages - count($fms_logs_data_prepare), // Total infected pages - $scanner_start_local_date, // Scanner start date - json_encode($fms_logs_data_prepare) // Logs data - ); - if ( ! empty($result_fms['error']) ) { - $error .= ' Frontend result send: ' . $result_fms['error_message']; - } + try { + Frontend::sendFmsLogs(); + } catch (\Exception $exception) { + $error .= $exception->getMessage(); } } @@ -2185,4 +2133,25 @@ public function file_monitoring() // phpcs:ignore PSR1.Methods.CamelCapsMethodNa return $file_monitoring->handle()->getResults(); } + + /** + * Delete files which paths are included to the scanner exclusions directories. + * @param string $scanner__dir_exclusions + * @return bool|int + * @psalm-suppress PossiblyUnusedReturnValue + */ + public function deleteFilesOfExclusionDirs($scanner__dir_exclusions) + { + $deleted_count = 0; + foreach ( spbc__get_exists_directories(explode("\n", $scanner__dir_exclusions)) as $exclusion ) { + if ( $exclusion ) { + $result = $this->db->prepare( + 'DELETE FROM ' . SPBC_TBL_SCAN_FILES . ' WHERE LOWER(path) LIKE LOWER(%s)', + ['%' . $this->db->escapeLike($exclusion) . '%'] + )->execute(); + $deleted_count = !empty($result) ? $deleted_count + (int)$result : $deleted_count; + } + } + return $deleted_count; + } } diff --git a/lib/CleantalkSP/SpbctWP/Scanner/Stages/SignatureAnalysis/Repository.php b/lib/CleantalkSP/SpbctWP/Scanner/Stages/SignatureAnalysis/Repository.php index 286d999ef..bb68dea8a 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/Stages/SignatureAnalysis/Repository.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/Stages/SignatureAnalysis/Repository.php @@ -34,15 +34,13 @@ public static function getSignaturesFromCloud($latest_signature_submitted_time) { // Check signatures version. File contains time of the signatures latest update. $version_file_url = 'https://cleantalk-security.s3.us-west-2.amazonaws.com/security_signatures/version.txt'; - if ( HTTP::getResponseCode($version_file_url) === 200 ) { - $latest_signatures = HTTP::getContentFromURL($version_file_url); - if ( ! empty($latest_signatures['error']) || ! strtotime($latest_signatures) ) { - return array('error' => 'WRONG_VERSION_FILE'); - } + $latest_signatures = HTTP::getContentFromURL($version_file_url); + if ( ! empty($latest_signatures['error']) || ! strtotime($latest_signatures) ) { + return array('error' => 'WRONG_VERSION_FILE'); + } - if ( strtotime($latest_signature_submitted_time) >= strtotime($latest_signatures) ) { - return array('error' => 'UP_TO_DATE'); - } + if ( strtotime($latest_signature_submitted_time) >= strtotime($latest_signatures) ) { + return array('error' => 'UP_TO_DATE'); } // _v2 since 2.31 version diff --git a/lib/CleantalkSP/SpbctWP/Scanner/Surface.php b/lib/CleantalkSP/SpbctWP/Scanner/Surface.php index 1afa4f464..be8e5b07a 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/Surface.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/Surface.php @@ -212,7 +212,7 @@ public function countFilesInDir($main_path) if ( is_dir($path) ) { // Directory names filter foreach ( $this->dirs_except as $dir_except ) { - if ( strpos($path, $dir_except) ) { + if ( strpos(strtolower($path), $dir_except) ) { continue(2); } } @@ -320,7 +320,7 @@ public function getFileStructure($main_path) } elseif ( is_dir($path) ) { // Directory names filter foreach ( $this->dirs_except as $dir_except ) { - if ( strpos($path, $dir_except) ) { + if ( strpos(strtolower($path), $dir_except) ) { continue(2); } } diff --git a/lib/CleantalkSP/SpbctWP/Scanner/UnsafePermissionsModule/UnsafePermissionFunctions.php b/lib/CleantalkSP/SpbctWP/Scanner/UnsafePermissionsModule/UnsafePermissionFunctions.php index 74d71b2ed..a78b89c13 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/UnsafePermissionsModule/UnsafePermissionFunctions.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/UnsafePermissionsModule/UnsafePermissionFunctions.php @@ -118,6 +118,7 @@ public function getDataToAccordion() $data_to_accordion[] = (object) array( 'path' => array_keys($file)[0], 'perms' => $file[array_keys($file)[0]] + . '', ); } } @@ -128,6 +129,7 @@ public function getDataToAccordion() $data_to_accordion[] = (object) array( 'path' => array_keys($dir)[0], 'perms' => $dir[array_keys($dir)[0]] + . '', ); } } diff --git a/lib/CleantalkSP/SpbctWP/State.php b/lib/CleantalkSP/SpbctWP/State.php index 79a733096..d474c8b39 100644 --- a/lib/CleantalkSP/SpbctWP/State.php +++ b/lib/CleantalkSP/SpbctWP/State.php @@ -44,6 +44,7 @@ class State extends \CleantalkSP\Common\State 'login_page_rename__enabled' => 0, 'login_page_rename__name' => 'login', 'login_page_rename__redirect' => '', + 'login_page_rename__send_email_notification' => 1, 'there_was_signature_treatment' => 0, // Firewall @@ -79,6 +80,7 @@ class State extends \CleantalkSP\Common\State 'scanner__frontend_analysis__domains_exclusions' => "twitter.com\nyoutube.com\nyoutube-nocookie.com\nimg.youtube.com\nmail.ru\nok.ru\nvk.com\nrutube.ru\ndailymotion.com\nyandex.ru\nflikr.com\nfacebook.com\nvimeo.com\nmetacafe.com\nyahoo.com\nmailchimp.com\ngoogletagmanager.com\ngoogle.com\n", // Web Application Firewall + 'secfw__enabled' => 1, 'waf__enabled' => 1, 'waf__xss_check' => 1, 'waf__sql_check' => 1, @@ -223,7 +225,7 @@ class State extends \CleantalkSP\Common\State // Scanner 'scanner__controller' => array('last_call' => 0, 'cooldown' => 1), - 'scanner__check_file' => array('last_call' => 0, 'cooldown' => 0), + 'scanner__check_dir' => array('last_call' => 0, 'cooldown' => 0), // Debug 'debug' => array('last_call' => 0,), diff --git a/lib/CleantalkSP/Updater/UpdaterScripts.php b/lib/CleantalkSP/Updater/UpdaterScripts.php index 4a6b1cba3..af219a7fc 100644 --- a/lib/CleantalkSP/Updater/UpdaterScripts.php +++ b/lib/CleantalkSP/Updater/UpdaterScripts.php @@ -1125,4 +1125,13 @@ public static function updateTo_2_110_0() //phpcs:ignore PSR1.Methods.CamelCapsM { Cron::addTask('security_log_clear', 'spbc_security_log_clear', 86400, time() + 43200); } + + public static function updateTo_2_114_0() //phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps + { + global $spbc; + + // New remote calls + $spbc->remote_calls['scanner__check_dir'] = array('last_call' => 0, 'cooldown' => 0); + $spbc->save('remote_calls', true, false); + } } diff --git a/readme.txt b/readme.txt index 438bc7311..8d7928b70 100644 --- a/readme.txt +++ b/readme.txt @@ -301,6 +301,14 @@ This is required for the Security FireWall to function properly. Plugins that ar == Changelog == += 2.114 July 17 2023 = +* New: Scanner. Added pop up with info how to fix file listening and unsafe permissions. +* New: SecFW. Manage Firewall as option and refactored clear scanner logs button for admin access. +* New: User can disable email notification on change login url. +* Ref: General. HTTP lib refactoring. +* Ref: Settings. Added spbc__get_exists_directories(). +* Fix: Scan. Fixed count outbound links. + = 2.113 July 03 2023 = * Ref: Update. Scanner. Remove green dot and fix typo. * Ref: Update. Scanner. Added bulk actions for frontend malware and fix tabs view. diff --git a/security-malware-firewall.php b/security-malware-firewall.php index f66bf9967..39e96330d 100644 --- a/security-malware-firewall.php +++ b/security-malware-firewall.php @@ -5,7 +5,7 @@ Plugin URI: https://wordpress.org/plugins/security-malware-firewall/ Description: Security & Malware scan by CleanTalk to protect your website from online threats and viruses. IP/Country FireWall, Web application FireWall. Detailed stats and logs to have full control. Author: CleanTalk Security -Version: 2.113 +Version: 2.114-dev Author URI: https://cleantalk.org Text Domain: security-malware-firewall Domain Path: /i18n @@ -179,7 +179,7 @@ } //First start -if ( $spbc->settings && $spbc->key_is_ok ) { +if ( $spbc->settings && $spbc->key_is_ok) { // FireWall if ( ! $spbc->fw_stats['is_on_maintenance'] @@ -436,21 +436,22 @@ function spbc_firewall__check() $firewall = new Firewall(); - // Necessary: Load Security FireWall module - $firewall->loadFwModule( - new FW( - array( - 'data_table__common' => SPBC_TBL_FIREWALL_DATA, - 'data_table__personal' => SPBC_TBL_FIREWALL_DATA__IPS, - 'data_table__personal_countries' => SPBC_TBL_FIREWALL_DATA__COUNTRIES, - 'log_table' => SPBC_TBL_FIREWALL_LOG, - 'state' => $spbc, - 'api_key' => $spbc->api_key, - 'cookie_domain' => parse_url(get_option('home'), PHP_URL_HOST), - 'data__set_cookies' => $spbc->settings['data__set_cookies'], + if ( (int) $spbc->settings['secfw__enabled'] ) { + $firewall->loadFwModule( + new FW( + array( + 'data_table__common' => SPBC_TBL_FIREWALL_DATA, + 'data_table__personal' => SPBC_TBL_FIREWALL_DATA__IPS, + 'data_table__personal_countries' => SPBC_TBL_FIREWALL_DATA__COUNTRIES, + 'log_table' => SPBC_TBL_FIREWALL_LOG, + 'state' => $spbc, + 'api_key' => $spbc->api_key, + 'cookie_domain' => parse_url(get_option('home'), PHP_URL_HOST), + 'data__set_cookies' => $spbc->settings['data__set_cookies'], + ) ) - ) - ); + ); + } if ( $spbc->settings['traffic_control__enabled'] && ! is_admin() ) { $firewall->loadFwModule( @@ -1831,9 +1832,14 @@ function spbc_is_user_logged_in() function spbc_user_is_admin() { global $spbc; - return - Cookie::get('spbc_is_logged_in') === md5($spbc->data['salt'] . parse_url(get_option('home'), PHP_URL_HOST)) && - Cookie::get('spbc_admin_logged_in') === md5($spbc->data['salt'] . 'admin' . parse_url(get_option('home'), PHP_URL_HOST)); + + if (!empty($spbc->settings['data__set_cookies'])) { + return + Cookie::get('spbc_is_logged_in') === md5($spbc->data['salt'] . parse_url(get_option('home'), PHP_URL_HOST)) && + Cookie::get('spbc_admin_logged_in') === md5($spbc->data['salt'] . 'admin' . parse_url(get_option('home'), PHP_URL_HOST)); + } + + return is_admin(); } //Function to send logs @@ -2014,7 +2020,9 @@ function spbc_access_key_notices($spbc_key = null) { global $spbc; - if ( ! $spbc->key_is_ok ) { + $spbc_key = $spbc_key ?: $spbc->settings['spbc_key']; + + if ( ! $spbc_key ) { return array( 'error' => 'KEY_IS_NOT_OK' ); }