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 '' - . '' - . '' + . __('Clear scanner logs', 'security-malware-firewall') + . '
' + . ''; + } + echo ''+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('Clear scanner logs
'+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('' + 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'Clear scanner logs
' + this.getSiteUTCShiftedTimeString() + ' - ' + items[ key ].path + ': ' + items[ key ].status + '
' );\n\t\t}\n\t};\n\n\tlogStageEntry(data){\n\t\tthis.logRaw( '' + this.getSiteUTCShiftedTimeString() + ' - ' + '' + data.title + ' ' + '' + data.description + '
' );\n\t};\n\n\tshowLinkForShuffleSalts(message) {\n\t\tjQuery('#spbc_notice_about_shuffle_link').remove();\n\t\tjQuery(jQuery('.spbc_tab--active .spbc_wrapper_field p')[1])\n\t\t\t.after(\n\t\t\t\t'"+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('"+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.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.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('"+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.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('\" + 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,EAAQD,CAAI,CACzC,CAYD,CAEA,SAASmC,4BAA4BG,EAAQf,EAAMtB,EAAQsC,GAE1DpB,OAAOoB,CAAG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AAegL,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.desc+\"
\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction spbc_settings__show_recommendation(label, setting_id){\n\t\n\tvar remove_recommendation_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.spbc_long_desc').length == 0 || jQuery(e.target).hasClass('spbc_long_desc__cancel')) && !jQuery(e.target).hasClass('spbc_long_recommendation__show'))){\n\t\t\tjQuery('.spbc_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_recommendation_func);\n\t\t}\n\t};\n\t\n\tremove_recommendation_func();\n\t\n\tlabel.after(\"\");\n\tvar obj = jQuery('#spbc_long_desc__'+setting_id);\n\tobj.append(\"\")\n\t\t.append(\"\")\n\t\t.css({\n\t\t\ttop: label.position().top + 25,\n\t\t\tleft: label.position().left + 5\n\t\t});\n\n\t\n\tspbc_sendAJAXRequest(\n\t\t{action: 'spbc_settings__get_recommendation', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"\")\n\t\t\t\t\t.append(\"\")\n\t\t\t\t\t.append(\"\"+result.desc+\"
\");\n\n\t\t\t\tjQuery(document).on('click', remove_recommendation_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\n// Shows/hides full text\nfunction spbcStartShowHide(){\n\tjQuery('.spbcShortText')\n\t\t.off('mouseover' )\n\t\t.on('mouseover', function(){ jQuery(this).next().show(); })\n\t\t.off('mouseout' )\n\t\t.on('mouseout', function(){ jQuery(this).next().hide(); });\n\tjQuery('.spbcFullText')\n\t\t.off('mouseout' )\n\t\t.on('mouseout', function(){ jQuery(this).hide(); })\n\t\t.off('mouseover' )\n\t\t.on('mouseover', function(){ jQuery(this).show(); })\n}\n\n// Generate and save confirmation code\nfunction spbctGenerateConfirmationCode() {\n\n\tvar data = {};\n\tvar res = {};\n\tres.success = false;\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_generate_confirmation_code';\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tres.success = true;\n\t\t\t} else {\n\t\t\t\tres.text = result.data;\n\t\t\t}\n\t\t},\n\t});\n\treturn res;\n}\n// Check confirmation code\nfunction spbctCheckConfirmationCode( radioButton, timeout, timer ) {\n\n\tvar element = radioButton;\n\tvar data = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_check_confirmation_code';\n\tdata.code = jQuery('#confirmation-code input').val();\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tjQuery('[name *= 2fa__enable]').attr(\"checked\", \"\");\n\t\t\t\telement.checked = true;\n\t\t\t\tjQuery('#spbc_setting_2fa__roles').removeAttr('disabled');\n\t\t\t\tjQuery('#spbc_setting_2fa__roles > option:first').attr('selected','selected');\n\t\t\t\tclearTimeout( timeout );\n\t\t\t\ttimer.remove();\n\t\t\t\tjQuery('#confirmation-code').dialog( \"close\" );\n\t\t\t} else {\n\t\t\t\talert('Code verification failed!');\n\t\t\t}\n\t\t},\n\t});\n\n}\n\n/**\n * Checking current account status for renew notice\n */\nfunction spbc_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#spbc_renew_notice').length)\n\t\t\t\t\t\t\tjQuery('#spbc_renew_notice').hide('slow');\n\t\t\t\t\t\tif (jQuery('#spbc_trial_notice').length)\n\t\t\t\t\t\t\tjQuery('#spbc_trial_notice').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 60000);\n}\n\njQuery(document).ready(function(){\n\t\n\tjQuery('#spbc_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Checking email receiving possibility for activation 2FA\n\tjQuery(document).on('click', '[name*=fa__enable]:not([value=0]),#confirmation-code--resend', function(e){\n\n\t\te.preventDefault();\n\n\t\tjQuery('#confirmation-code--resend').attr('disabled', 'disabled')\n\t\t\t.append('\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_import_button .spbc_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_import_button .spbc_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#spbc_settings_templates_export_button', function(){\n\t\tjQuery('#spbc-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#spbc_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#spbc_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#spbc_settings_templates_export_button .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_export_button .spbc_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_export_button .spbc_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#spbc_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tspbc_sendAJAXRequest(\n\t\t\t{action: 'spbc_settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#spbc_settings_templates_reset_button .spbc_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#spbc_settings_templates_reset_button .spbc_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#spbc_settings_templates_reset_button .spbc_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){spbcModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"\" + result.data + \"
\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tjQuery(document).on('change', '#spbc_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#spbc_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#spbc_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\t//* TAB_CONTROL\n\t\n\t\tjQuery('.spbc_tab_nav-summary').data('loaded', true); // Summary tab loaded by default\n\t\tjQuery('.spbc_tabs_nav_wrapper').on('click', '.spbc_tab_nav', function(event){\n\t\t\tspbc_switchTab(event.currentTarget);\n\t\t});\n\t\t\n\t\t// Get additional params\n var params = {\n target: location.search.match(/spbc_target=(\\S*?)(&|$)/) ? location.search.match(/spbc_target=(\\S*?)(&|$)/)[1] : null,\n action: location.search.match(/spbc_action=(\\S*?)(&|$)/) ? location.search.match(/spbc_action=(\\S*?)(&|$)/)[1] : null,\n times: location.search.match(/spbc_times=(\\S*?)(&|$)/) ? location.search.match(/spbc_times=(\\S*?)(&|$)/)[1] : 3,\n };\n // Legacy support\n params.target = location.search.match(/spbc_highlight=(\\S*?)(&|$)/) ? location.search.match(/spbc_highlight=(\\S*?)(&|$)/)[1] : params.target;\n params.action = location.search.search(/spbc_highlight=(\\S*?)(&|$)/) != -1\n ? 'highlight'\n : params.action;\n\n\t\t// Get open tab form query\n\t\tvar spbc_tab = document.getElementsByClassName('spbc_tab_nav-' + (location.search.match(/spbc_tab=(\\S*?)(&|$)/) ? location.search.match(/spbc_tab=(\\S*?)(&|$)/)[1] : ''))[0] || null;\n\n\t\t// TAB SWITCHING\n\t\t// Switch by URL\n\t\tif(spbc_tab){\n\n\t\t// Switch to DEBUG\n\t\t}else if( +spbcSettings.debug ){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-debug')[0];\n\t\t// Switch by DEFAULT\n\t\t}else if( +spbcSettings.wpms && !+spbcSettings.is_main_site){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-security_log')[0];\n\t\t// Switch if Key is OK and SFW is ON\n\t\t}else if( +spbcSettings.key_is_ok && +spbcSettings.secfw_enabled ){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-traffic_control')[0];\n\t\t// Switch if Key is OK\n\t\t}else if( +spbcSettings.key_is_ok ){\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-scanner')[0];\n\t\t// Switch if KEY IS BAD\n\t\t}else{\n\t\t\tspbc_tab = document.getElementsByClassName('spbc_tab_nav-settings_general')[0];\n\t\t\tparams = {\n\t\t\t target: 'spbc_key',\n action: 'highlight',\n times: 3,\n };\n\t\t}\n\t\t\n\t\t// Switch tab\n\t\tif(spbc_tab) spbc_switchTab(spbc_tab, params);\n\t\t\n\t//*/ TAB_CONROL END\n\t\n\t//* REFRESH TAB IF ctrl+F5\n\tvar ctrlKeyDown = false;\n\n\tjQuery(document).on(\"keyup\", function(e) {\n\t\tif ((e.which || e.keyCode) == 17) ctrlKeyDown = false;\n\t});\n\n\tjQuery(document).on(\"keydown\", function(e) {\n\t\tif (((e.which || e.keyCode) == 116) && ctrlKeyDown) {\n\t\t\te.preventDefault();\n\n\t\t\tvar active_tab = jQuery('.spbc_tab_nav--active')[0];\n\t\t\tvar tab_name = active_tab.classList[1].replace('spbc_tab_nav-', '');\n\n\t\t\tif (tab_name === 'scanner') return; \n\n\t\t\tjQuery(active_tab).data('loaded', false);\n\n\t\t\tspbc_switchTab(active_tab);\n\n\t\t} else if ((e.which || e.keyCode) == 17) {\n\t ctrlKeyDown = true;\n\t }\n\t});\n\t//*/ REFRESH TAB IF ctrl+F5 END\n});"],"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,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,EAAO0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AAU1K,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(""+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(''),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
%s
{};if(1==o.success){console.log(o);var a,n='
%s
%s
%s
%s%s
"+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(''),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
%s
{};if(1==o.success){console.log(o);var n,a='
%s
%s
%s
%s%s
@@ -6,5 +6,5 @@ function spbc_popup_tip___show(e){function s(e){void 0!==e&&(0!=jQuery(e.target) ${e.data.content}-
\" + 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('')\n\n\tlet spinner = jQuery('#spbc_file_view_preloader')\n\tlet size_multiplier = (wp_wrap.width() * 0.0004)\n\n\tspinner.height(128 * size_multiplier)\n\tspinner.width(128 * size_multiplier)\n\tspinner.css({left: dialog_window.width()/2 - (128 * size_multiplier / 2)})\n\tspinner.css({top: dialog_window.height()/2 - (128 * size_multiplier / 2)})\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonView_callback(result){\n\n\tlet dialog_window = jQuery('#spbc_dialog')\n\tdialog_window.empty();\n\n\tjQuery('#spbc_file_view_preloader').css({display:'none'})\n\n\tlet row_template = '%s
%s
%s
%s
' +\n\t\t\t\t'%s
' +\n\t\t\t\t'%s
%s%s
%s
%s%s
\n \n ${result.data.content}\n
\n
\n \" + 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('')\n\n\tlet spinner = jQuery('#spbc_file_view_preloader')\n\tlet size_multiplier = (wp_wrap.width() * 0.0004)\n\n\tspinner.height(128 * size_multiplier)\n\tspinner.width(128 * size_multiplier)\n\tspinner.css({left: dialog_window.width()/2 - (128 * size_multiplier / 2)})\n\tspinner.css({top: dialog_window.height()/2 - (128 * size_multiplier / 2)})\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonView_callback(result){\n\n\tlet dialog_window = jQuery('#spbc_dialog')\n\tdialog_window.empty();\n\n\tjQuery('#spbc_file_view_preloader').css({display:'none'})\n\n\tlet row_template = '%s
%s
%s
%s
' +\n\t\t\t\t'%s
' +\n\t\t\t\t'%s
%s%s
%s
%s%s
\n \n ${result.data.content}\n
\n
\n Clear scanner logs
"+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 = '