Files sent for analysis.
",jQuery("#spbc_scan_accordion_tab_critical").after(o+c),i.click())}setTimeout(function(){a.html(e).css({background:"inherit"}).find(".column-primary .row-actions .tbl-row_action--"+n.add_action).remove(),spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcStartShowHide()},5e3)}spbcBulkAction&&spbcBulkAction.click()}function spbcTblPaginationListen(){let n={action:"spbc_tbl-pagination"},a={callback:spbcTblPaginationCallback,notJson:!0};jQuery(".tbl-pagination--button").on("click",function(){jQuery(this).parents(".tbl-root").find(".tbl-pagination--button").attr("disabled","disabled")}),jQuery(".tbl-pagination--go").on("click",function(){var e=jQuery(this),t=e.parents(".tbl-root");n.page=e.siblings(".tbl-pagination--curr_page").val(),n.type=t.attr("type"),a.spinner=e.siblings(".tbl-preloader--small"),spbcSendAJAXRequest(n,a,t)}),jQuery(".tbl-pagination--prev").on("click",function(){var e=jQuery(this),t=e.parents(".tbl-root");n.page=e.parents(".tbl-pagination--wrapper").attr("prev_page"),n.type=t.attr("type"),a.spinner=e.siblings(".tbl-preloader--small"),spbcSendAJAXRequest(n,a,t)}),jQuery(".tbl-pagination--next").on("click",function(){var e=jQuery(this),t=e.parents(".tbl-root");n.page=e.parents(".tbl-pagination--wrapper").attr("next_page"),n.type=t.attr("type"),a.spinner=e.siblings(".tbl-preloader--small"),spbcSendAJAXRequest(n,a,t)}),jQuery(".tbl-pagination--end").on("click",function(){var e=jQuery(this),t=e.parents(".tbl-root");n.page=e.parents(".tbl-pagination--wrapper").attr("last_page"),n.type=t.attr("type"),a.spinner=e.siblings(".tbl-preloader--small"),spbcSendAJAXRequest(n,a,t)}),jQuery(".tbl-pagination--start").on("click",function(){var e=jQuery(this),t=e.parents(".tbl-root");n.page=1,n.type=t.attr("type"),a.spinner=e.siblings(".tbl-preloader--small"),spbcSendAJAXRequest(n,a,t)})}function spbcTblPaginationCallback(e,t,n,a){jQuery(a).html(e).find(".tbl-pagination--button").removeAttr("disabled"),spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcTblPaginationListen(),spbcTblSortListen(),spbcStartShowHide()}function spbcTblSortListen(){let a={callback:spbcTblSortCallback,notJson:!0};jQuery(".tbl-column-sortable").on("click",function(e){var t,n;e.target.classList.contains("tbl-sorting_indicator")&&(n="links"==(t=(e=jQuery(this)).parents(".tbl-root")).attr("type")?jQuery("#spbc_tbl__scanner__outbound_links b").html():"",e={action:"spbc_tbl-sort",order_by:e.attr("id"),order:e.attr("sort_direction"),type:t.attr("type"),domain:n},spbcSendAJAXRequest(e,a,t))})}function spbcTblSortCallback(e,t,n,a){jQuery(a).html(e),spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcTblPaginationListen(),spbcTblSortListen()}function spbcScannerSwitchTable(e,t){var e=jQuery(e),n=e.parents(".row-actions").attr("uid");spbcSendAJAXRequest({action:"spbc_tbl-switch",type:t,domain:n},{callback:spbcTblPaginationCallback,notJson:!0},e.parents(".tbl-root"))}function spbcShowHideRows(e,t){t=jQuery("."+t+"_block_"+e);t.hasClass("mob_table_active")?t.removeClass("mob_table_active"):t.addClass("mob_table_active")}function spbcUpdateEstimatedTime(){spbcUpdateTables(),setInterval(()=>{spbcUpdateTables()},6e4)}function spbcUpdateTables(e,t){var n={action:"spbc_settings__draw_elements",tab_name:"scanner",security:spbcSettings.ajax_nonce};spbcSendAJAXRequest(n,{callback:spbcViewUpdateEstimatedTime,notJson:!0,additional:t||null},e)}function spbcViewUpdateEstimatedTime(e){e=(new DOMParser).parseFromString(e,"text/html");let t=e.querySelectorAll("#spbc_tbl__scanner_analysis_log tbody tr"),i=document.querySelectorAll("#spbc_tbl__scanner_analysis_log tbody tr");(e=e.querySelector("#spbc_last_update_time"))&&e.innerText;i.forEach(e=>{if("Done"!==e.querySelector(".pscan_estimated_execution_time").innerText){let n,a,c,s="";t.forEach(t=>{i.forEach(e=>{null!==e.querySelector(".spbcFullText")&&(s=e.querySelector(".spbcFullText").innerText),t.querySelector(".spbcFullText").innerText===s&&(n=t.querySelector(".pscan_status").innerHTML,e.querySelector(".pscan_status").innerHTML=n,a=t.querySelector(".pscan_estimated_execution_time").innerHTML,e.querySelector(".pscan_estimated_execution_time").innerHTML=a,c=t.querySelector(".analysis_comment").innerHTML,e.querySelector(".analysis_comment").innerHTML=c)})})}}),spbcUpdatePscanCloudAnalysisInfo()}function spbcUpdatePscanCloudAnalysisInfo(){var e={action:"spbc_analysyis_files_stats__get_html",sub_action:"give_me_html",security:spbcSettings.ajax_nonce};spbcSendAJAXRequest(e,{callback:spbcViweUpdateAnalysisInfo,notJson:!0})}function spbcViweUpdateAnalysisInfo(e){var t=document.getElementById("spbc_analysis_files_stats");t&&(t.innerHTML=e)}jQuery(document).ready(function(){spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcTblPaginationListen(),spbcTblSortListen(),spbcUpdateEstimatedTime()});
//# sourceMappingURL=spbc-table.min.js.map
diff --git a/js/spbc-table.min.js.map b/js/spbc-table.min.js.map
index 056552dda..a2e2db99d 100644
--- a/js/spbc-table.min.js.map
+++ b/js/spbc-table.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"spbc-table.min.js","sources":["spbc-table.js"],"sourcesContent":["let spbcBulkAction = null;\nconst noConfirmActions = spbcGetNoConfirmActions(spbcPublic);\n\n/**\n * Reloads scanner accordion and set all the listeners\n * @param {string|null} interactControlTab ajaxResult If is set, will use this var as interactivity data.\n * @param {string|null} updateText\n */\nfunction spbcReloadAccordion(interactControlTab = null, updateText = '') {\n spbcSendAJAXRequest(\n {action: 'spbc_scanner_tab__reload_accordion'},\n {\n notJson: true,\n callback: function(result, data, params, obj) {\n jQuery(obj).accordion('destroy');\n jQuery(obj).html(result);\n jQuery(obj).accordion({\n header: 'h3',\n heightStyle: 'content',\n collapsible: true,\n active: false,\n });\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcStartShowHide();\n if (interactControlTab !== null && updateText !== null) {\n interactScannerTab(interactControlTab, updateText);\n }\n },\n },\n jQuery('#spbc_scan_accordion'),\n );\n}\n\n/**\n * Open refreshed tab after scanner reload.\n * @param {string} controlTab\n * @param {string} updateText\n */\nfunction interactScannerTab(controlTab, updateText) {\n let refreshControlTabSelector;\n let headerSelector;\n let headerUpdateStatus;\n\n if (\n typeof(controlTab) !== 'string' ||\n controlTab === '' ||\n typeof(updateText) !== 'string' ||\n updateText === ''\n ) {\n return;\n }\n\n // init refresh controlled tabs\n refreshControlTabSelector = jQuery('#spbc_scan_accordion div[refresh_control_tab=\"' + controlTab + '\"]')[0];\n\n // init header to click\n headerSelector = 'h3[aria-controls=spbc_scan_accordion_tab_' + controlTab + ']';\n headerSelector = jQuery(headerSelector)[0];\n\n if (\n typeof(refreshControlTabSelector) === 'undefined' ||\n typeof(headerSelector) === 'undefined'\n ) {\n return;\n }\n\n // show updated caption\n jQuery('')\n .appendTo(headerSelector);\n headerUpdateStatus = jQuery('.spbc_accordion_header_caption__update_status');\n jQuery('')\n .appendTo(headerUpdateStatus);\n\n // do click to open tab\n headerSelector.click();\n\n // highlight header\n refreshControlTabSelector.setAttribute(\n 'class',\n 'ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-active',\n );\n\n // hide all actions on partial reload\n jQuery('.row-actions').hide();\n}\n\n/**\n * Table bulk actions\n */\nfunction spbcTblBulkActionsListen() {\n jQuery('.tbl-bulk_actions-all--apply')\n .off('click')\n .on('click', function() {\n // @ToDo perhaps spbcScanner.active is not defined anywhere.\n // check this and implement `active` status in the right place\n if ( spbcScanner.active ) {\n alert(spbcTableLocalize.scannerIsActive);\n return;\n }\n\n let self = jQuery(this);\n let allowedBulkActions = [\n 'approve',\n 'disapprove',\n 'send',\n 'check_analysis_status',\n 'approve_page',\n 'disapprove_page',\n 'cure',\n 'delete_from_analysis_log',\n ];\n let action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\n\n if ( allowedBulkActions.indexOf( action ) !== -1 ) {\n if (!noConfirmActions.any.includes(action)) {\n if (!confirm(spbcTable.warning_bulk)) {\n return;\n }\n }\n let data = {\n action: 'spbc_tbl-action--bulk',\n add_action: action,\n status: self.parents('.tbl-root').attr('type'),\n };\n\n if (action === 'cure') {\n const selectedItems = self.closest('#spbc_tbl__scanner_cure_log').find('.cb-select');\n let selectedIds = [];\n\n selectedItems.each(function(index, element) {\n const elementId = jQuery(element).val();\n selectedIds.push(elementId);\n });\n data.selectedIds = selectedIds;\n }\n\n if (action === 'delete_from_analysis_log') {\n const selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select');\n let fileIds = [];\n\n selectedItems.each(function(index, element) {\n const elementId = jQuery(element).val();\n fileIds.push(elementId);\n });\n data.file_ids = fileIds;\n }\n\n let params = {\n button: this,\n spinner: self.children('.tbl-preloader--small'),\n callback: function(out) {\n spbcReloadAccordion();\n if ( action === 'check_analysis_status' && typeof out !== 'undefined') {\n let html = '
Analysis status updated.' +\n ' Total: ' + out.counters.total +\n ', updated: ' + out.counters.updated +\n ', skipped: ' + out.counters.skipped +\n ', failed: ' + out.counters.failed +\n ', queued: ' + out.counters.queued +\n '
';\n spbcModal.open().put( html );\n }\n if ( action === 'send' && typeof out !== 'undefined') {\n let html = '
Files have been sent: ' +\n out.files_sent_counter +\n '
';\n spbcModal.open().put(html);\n }\n },\n errorOutput: function( errorText, comment ) {\n if ( comment ) {\n errorText = errorText + '
' + comment;\n }\n spbcModal.open().putError( errorText );\n },\n timeout: 60000,\n };\n\n spbcSendAJAXRequest(data, params);\n } else {\n alert('This action is not supported for all files yet =(');\n }\n });\n\n jQuery('.tbl-bulk_actions--apply')\n .off('click')\n .on('click', function(e) {\n let self = spbcBulkAction || jQuery(this);\n spbcBulkAction = self;\n let action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\n\n if (!spbcBulkAction && !noConfirmActions.any.includes(action) && !confirm(spbcTable.warning_bulk)) {\n return;\n }\n\n if (action === 'cure') {\n spbcScannerCureSelected(jQuery(this));\n return;\n }\n\n if (action === 'delete_from_analysis_log') {\n spbcScannerAnalysisLogDeleteFromLog(jQuery(this));\n return;\n }\n\n if (action === 'allow' || action === 'ban') {\n let sendAction = action === 'ban' ? 'deny' : action;\n let items = self.parents('.tbl-root').find('.cb-select:checked');\n if (items) {\n self.children('.tbl-preloader--small').show();\n items.each(function() {\n let ip = jQuery(this).parents('tr').find('.tbl-row_action--'+action).data('ip');\n spbcSecLogsFilterIp(ip, sendAction, true);\n jQuery(this).prop('checked', false);\n });\n }\n self.children('.tbl-preloader--small').hide();\n let msg = action === 'allow' ? 'Allowed' : 'Banned';\n let html = '
Success. Selected IPs have been ' +\n msg +\n '. Changes will be applied within 10 minutes.' +\n '
';\n spbcModal.open().put( html );\n setTimeout(spbcReloadAccordion, 1900);\n\n return;\n }\n\n if ( action !== '-1' && self.parents('.tbl-root').find('.cb-select').is(':checked') ) {\n self.children('.tbl-preloader--small').show();\n // eslint-disable-next-line max-len\n if (self.parents('.tbl-root').find('.cb-select:checked').first().parents('tr').find('.tbl-row_action--'+action)[0]) {\n self\n .parents('.tbl-root')\n .find('.cb-select:checked')\n .first()\n .parents('tr')\n .find('.tbl-row_action--'+action)\n .click();\n self.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\n } else {\n self.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\n self.click();\n }\n } else {\n self.children('.tbl-preloader--small').hide();\n spbcBulkAction = null;\n if ( action === 'check_analysis_status' || action === 'disapprove' ) {\n let html = '
';\n spbcModal.open().put( html );\n }\n if ( action === 'send') {\n let html = '
';\n spbcModal.open().put( html );\n }\n setTimeout(spbcReloadAccordion, 1900);\n }\n // reset spbcBulkAction if action is restricted\n if (noConfirmActions.restricted.includes(action)) {\n spbcBulkAction = null;\n }\n });\n}\n\n/**\n * Cure selected files\n * @param {obj} current\n */\nfunction spbcScannerCureSelected(current) {\n const selectedItems = current.closest('#spbc_tbl__scanner_cure_log').find('.cb-select:checked');\n let selectedIds = [];\n\n if (selectedItems.length === 0) {\n alert('Please, select elements.');\n }\n\n selectedItems.each(function(index, element) {\n const elementId = jQuery(element).val();\n selectedIds.push(elementId);\n });\n\n const data = {\n action: 'spbc_cure_selected',\n security: spbcSettings.ajax_nonce,\n selectedIds: selectedIds,\n };\n jQuery.ajax({\n type: 'POST',\n url: spbcSettings.ajaxurl,\n data: data,\n beforeSend: function() {\n current\n .closest('#spbc_tbl__scanner_cure_log')\n .find('.tbl-button---white_blue .tbl-preloader--in_button')\n .show();\n },\n success: function(result) {\n current\n .closest('#spbc_tbl__scanner_cure_log')\n .find('.tbl-button---white_blue .tbl-preloader--in_button')\n .hide();\n if (result.success) {\n spbcModal.open().put(result.data);\n document.addEventListener('spbcModalClosed', function( e ) {\n document.location.reload();\n });\n } else {\n spbcModal.open().putError(result.data);\n }\n },\n });\n}\n\n/**\n * Table row actions\n */\nfunction spbcTblRowActionsListen() {\n jQuery('.tbl-row_action--ajax')\n .off('click')\n .on('click', function() {\n if ( spbcScanner.active ) {\n alert(spbcTableLocalize.scannerIsActive);\n return;\n }\n let self = jQuery(this);\n let data = {\n action: 'spbc_tbl-action--row',\n add_action: self.attr('row-action'),\n id: self.parents('.row-actions').attr('uid'),\n cols: self.parents('.row-actions').attr('cols_amount'),\n page_url: self.parent().attr('uid'),\n page_id: self.parent().attr('page_id'),\n };\n let params = {\n callback: spbcTblRowActionsCallback,\n errorOutput: function(msg, comment, hideSupportLink) {\n spbcModal.open().putError( msg, hideSupportLink );\n },\n spinner: self.parent().siblings('.tbl-preloader--tiny'),\n };\n\n // @ToDo delete this timeout after ready task #10014\n if ( self.attr('row-action') === 'delete' ) {\n params.timeout = 60000;\n }\n\n let fileName = self.parent().parent()[0].firstChild.innerHTML;\n let confirmationHeader = spbcTable['warning_h_'+self.attr('row-action')] || spbcTable.warning_default;\n let confirmationText = spbcTable['warning_t_'+self.attr('row-action')] || '';\n // init row actions with no confirm required\n if ( spbcBulkAction || noConfirmActions.any.includes(data.add_action) ) {\n // do not request user confirmation if the action is excluded or if it is a bulk action\n spbcSendAJAXRequest(data, params, self.parents('tr'));\n } else {\n // do request confirmation otherwise\n const yesButtonText = self.attr('row-action') === 'quarantine' ? 'Quarantine' : 'Yes';\n const noButtonText = self.attr('row-action') === 'quarantine' ? 'Cancel' : 'No';\n spbcModal.open().confirm(confirmationHeader, confirmationText, fileName, (confirmed) => {\n if (confirmed) {\n spbcSendAJAXRequest(data, params, self.parents('tr'));\n }\n }, yesButtonText, noButtonText);\n }\n });\n}\n\n/**\n * Row actions with no confirm required.\n * @param {object} spbcPublic Global localized SPBC object\n * @return {{}}\n */\nfunction spbcGetNoConfirmActions(spbcPublic) {\n let noConfirmActionsEmpty = {\n 'any': [],\n 'restricted': [],\n 'defaults': [],\n };\n let noConfirmActions = noConfirmActionsEmpty;\n try {\n if ( typeof spbcPublic !== 'undefined' && spbcPublic.hasOwnProperty('no_confirm_row_actions')) {\n noConfirmActions = JSON.parse(spbcPublic.no_confirm_row_actions);\n }\n if (\n typeof noConfirmActions.any.includes !== 'function' ||\n typeof noConfirmActions.restricted.includes !== 'function' ||\n typeof noConfirmActions.defaults.includes !== 'function'\n ) {\n noConfirmActions = noConfirmActionsEmpty;\n }\n } catch (e) {\n noConfirmActions = noConfirmActionsEmpty;\n }\n return noConfirmActions;\n}\n\n/**\n * Callback for table row actions\n *\n * @param {obj|string} result\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcTblRowActionsCallback(result, data, params, obj) {\n if (result.color) {\n obj.css({background: result.background, color: result.color});\n }\n if (result.html) {\n obj.parent().parent().parent().prepend(result.html);\n setTimeout(function() {\n obj.fadeOut(300);\n }, 1500);\n if ( ! spbcBulkAction) {\n setTimeout(spbcReloadAccordion, 1900);\n }\n }\n\n if (\n data.add_action === 'copy_file_info'\n ) {\n if (result.success === true && result.data.file_info) {\n window.\n prompt('Copy the file info below and send it to support@cleantalk.org: ', result.data.file_info);\n } else {\n let errorText = (typeof result.data.error !== 'undefined') ?\n result.data.error :\n 'Unknown copy_file_info error';\n spbcModal.open().putError( errorText );\n }\n }\n\n if (result.temp_html) {\n let tmp=obj.html();\n obj.html(result.temp_html);\n if (result.updated_template !== undefined) {\n let updatedType = result.updated_template_type;\n let template = result.updated_template;\n let rowsInTemplate = jQuery(template).find('.wp-list-table tbody tr');\n let countRowInTemplate = rowsInTemplate.length;\n let targetTab = jQuery('[aria-controls=\"spbc_scan_accordion_tab_' + updatedType + '\"]');\n\n if (targetTab.length > 0) {\n let table = jQuery('#spbc_tbl__scanner_' + updatedType);\n // Count files in header\n jQuery('.spbc_bad_type_count.' + updatedType + '_counter').text(countRowInTemplate);\n // Count rows in table\n let countExistingRows = table.find('.wp-list-table tbody tr').length;\n table.remove();\n jQuery('#spbc_scan_accordion_tab_' + updatedType).append(template);\n // Marked new rows\n jQuery(jQuery('#spbc_scan_accordion_tab_' + updatedType)\n .find('.wp-list-table tbody tr'))\n .each(function(index, element) {\n if (++index > countExistingRows) {\n jQuery(element).css('outline', '1px solid green');\n }\n });\n targetTab.click();\n } else {\n if (updatedType === 'analysis_log') {\n // eslint-disable-next-line max-len\n let tabHeaderTemplate = '';\n // eslint-disable-next-line max-len\n let tabBodyTemplate = '
Files sent for analysis.
' +\n template +\n '
';\n jQuery('#spbc_scan_accordion_tab_critical').after(tabHeaderTemplate + tabBodyTemplate);\n targetTab.click();\n }\n }\n }\n setTimeout(function() {\n obj\n .html(tmp)\n .css({background: 'inherit'})\n .find('.column-primary .row-actions .tbl-row_action--' + data.add_action)\n .remove();\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcStartShowHide();\n }, 5000);\n }\n if (spbcBulkAction) {\n spbcBulkAction.click();\n }\n}\n\n/**\n * Table pagination actions\n */\nfunction spbcTblPaginationListen() {\n let data = {action: 'spbc_tbl-pagination'};\n let params = {callback: spbcTblPaginationCallback, notJson: true};\n jQuery('.tbl-pagination--button').on('click', function() {\n jQuery(this).parents('.tbl-root').find('.tbl-pagination--button').attr('disabled', 'disabled');\n });\n jQuery('.tbl-pagination--go').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.siblings('.tbl-pagination--curr_page').val();\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--prev').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.parents('.tbl-pagination--wrapper').attr('prev_page');\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--next').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.parents('.tbl-pagination--wrapper').attr('next_page');\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--end').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.parents('.tbl-pagination--wrapper').attr('last_page');\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--start').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = 1;\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n}\n\n/**\n * Callback for Table pagination actions\n *\n * @param {obj|string} result\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcTblPaginationCallback(result, data, params, obj) {\n jQuery(obj)\n .html(result)\n .find('.tbl-pagination--button').removeAttr('disabled');\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcStartShowHide();\n}\n\n/**\n * Table sort actions\n */\nfunction spbcTblSortListen() {\n let params = {callback: spbcTblSortCallback, notJson: true};\n jQuery('.tbl-column-sortable').on('click', function(e) {\n if (e.target.classList.contains('tbl-sorting_indicator')) {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n let domain = obj.attr('type') == 'links'? jQuery('#spbc_tbl__scanner__outbound_links b').html(): '';\n let data = {\n action: 'spbc_tbl-sort',\n order_by: self.attr('id'),\n order: self.attr('sort_direction'),\n type: obj.attr('type'),\n domain: domain,\n };\n spbcSendAJAXRequest(data, params, obj);\n }\n });\n}\n\n/**\n * Callback for Table sort actions\n *\n * @param {obj|string} result\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcTblSortCallback(result, data, params, obj) {\n jQuery(obj).html(result);\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n}\n\njQuery(document).ready(function() {\n // Table. Row actions handler\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcUpdateEstimatedTime();\n});\n\n/**\n * Switching table handler\n * Using by inline php code\n *\n * @param {obj} obj\n * @param {obj} table\n *\n */\nfunction spbcScannerSwitchTable(obj, table) {/* eslint-disable-line no-unused-vars */\n let _obj = jQuery(obj);\n let domain = _obj.parents('.row-actions').attr('uid');\n let data = {action: 'spbc_tbl-switch', type: table, domain: domain};\n let params = {callback: spbcTblPaginationCallback, notJson: true};\n spbcSendAJAXRequest(data, params, _obj.parents('.tbl-root'));\n}\n\n/**\n * Open/close table rows handler\n * Using by inline php code\n *\n * @param {string} blockId\n * @param {string} columnKey\n */\nfunction spbcShowHideRows(blockId, columnKey) {/* eslint-disable-line no-unused-vars */\n let className = '.' + columnKey + '_block_' + blockId;\n let block = jQuery(className);\n if (block.hasClass('mob_table_active')) {\n block.removeClass('mob_table_active');\n } else {\n block.addClass('mob_table_active');\n }\n}\n\n/**\n * Update estimated time\n */\nfunction spbcUpdateEstimatedTime() {\n spbcUpdateTables();\n setInterval(() => {\n spbcUpdateTables();\n }, 60000);\n}\n\n/**\n * Update tables\n * @param {obj} tab\n * @param {obj} params\n */\nfunction spbcUpdateTables(tab, params) {\n // todo params is always not provided!\n let tabName = 'scanner';\n let data = {\n action: 'spbc_settings__draw_elements',\n tab_name: tabName,\n security: spbcSettings.ajax_nonce,\n };\n let currentParams = {\n callback: spbcViewUpdateEstimatedTime,\n notJson: true,\n additional: params || null,\n };\n spbcSendAJAXRequest( data, currentParams, tab );\n}\n\n/**\n * Update estimated time\n * @param {string} result\n */\nfunction spbcViewUpdateEstimatedTime(result) {\n // todo the function unsafely trust the result, needs to validate\n const parser = new DOMParser();\n const newTables = parser.parseFromString(result, 'text/html');\n // todo validate if selector is valid\n const newAnalysisRows = newTables.querySelectorAll('#spbc_tbl__scanner_analysis_log tbody tr');\n // todo validate if selector is valid\n const currentAnalysisRows = document.querySelectorAll('#spbc_tbl__scanner_analysis_log tbody tr');\n // todo what this was for?\n let newLastUpdateTime = newTables.querySelector('#spbc_last_update_time');\n if (newLastUpdateTime) {\n newLastUpdateTime = newLastUpdateTime.innerText;\n }\n\n currentAnalysisRows.forEach((currentRow) => {\n if (currentRow.querySelector('.pscan_estimated_execution_time').innerText === 'Done') {\n return;\n }\n\n let status = '';\n let time = '';\n let comment = '';\n let text = '';\n newAnalysisRows.forEach((newRow) => {\n currentAnalysisRows.forEach((currentRow) => {\n // validate selector result\n if (currentRow.querySelector('.spbcFullText') !== null) {\n text = currentRow.querySelector('.spbcFullText').innerText;\n }\n if (newRow.querySelector('.spbcFullText').innerText === text) {\n // todo all the selectors data is not protected against null values!\n status = newRow.querySelector('.pscan_status').innerHTML;\n currentRow.querySelector('.pscan_status').innerHTML = status;\n time = newRow.querySelector('.pscan_estimated_execution_time').innerHTML;\n currentRow.querySelector('.pscan_estimated_execution_time').innerHTML = time;\n comment = newRow.querySelector('.analysis_comment').innerHTML;\n currentRow.querySelector('.analysis_comment').innerHTML = comment;\n }\n });\n });\n });\n\n spbcUpdatePscanCloudAnalysisInfo();\n}\n\n/**\n * Update psacn cloud analysis info\n */\nfunction spbcUpdatePscanCloudAnalysisInfo() {\n let data = {\n action: 'spbc_analysyis_files_stats__get_html',\n sub_action: 'give_me_html',\n security: spbcSettings.ajax_nonce,\n };\n\n let params = {\n callback: spbcViweUpdateAnalysisInfo,\n notJson: true,\n };\n\n spbcSendAJAXRequest(data, params);\n}\n\n/**\n * Update analysis info\n * @param {string} result\n */\nfunction spbcViweUpdateAnalysisInfo(result) {\n let info = document.getElementById('spbc_analysis_files_stats');\n\n if (info) {\n info.innerHTML = result;\n }\n}\n"],"names":["let","spbcBulkAction","noConfirmActions","spbcGetNoConfirmActions","spbcPublic","spbcReloadAccordion","interactControlTab","updateText","spbcSendAJAXRequest","action","notJson","callback","result","data","params","obj","jQuery","accordion","html","header","heightStyle","collapsible","active","spbcTblBulkActionsListen","spbcTblRowActionsListen","spbcTblPaginationListen","spbcTblSortListen","spbcStartShowHide","interactScannerTab","controlTab","refreshControlTabSelector","headerUpdateStatus","headerSelector","appendTo","click","setAttribute","hide","off","on","spbcScanner","alert","spbcTableLocalize","scannerIsActive","self","this","siblings","children","first","selectedIndex","value","indexOf","any","includes","confirm","spbcTable","warning_bulk","add_action","status","parents","attr","selectedItems","closest","find","selectedIds","each","index","element","elementId","val","push","fileIds","file_ids","button","spinner","out","counters","total","updated","skipped","failed","queued","spbcModal","open","put","files_sent_counter","errorOutput","errorText","comment","putError","timeout","e","spbcScannerCureSelected","spbcScannerAnalysisLogDeleteFromLog","sendAction","items","msg","show","ip","spbcSecLogsFilterIp","prop","setTimeout","is","restricted","current","length","security","spbcSettings","ajax_nonce","ajax","type","url","ajaxurl","beforeSend","success","document","addEventListener","location","reload","id","cols","page_url","parent","page_id","spbcTblRowActionsCallback","hideSupportLink","yesButtonText","noButtonText","fileName","firstChild","innerHTML","confirmationHeader","warning_default","confirmationText","confirmed","noConfirmActionsEmpty","defaults","hasOwnProperty","JSON","parse","no_confirm_row_actions","color","css","background","prepend","fadeOut","file_info","window","prompt","error","temp_html","tmp","undefined","updated_template","updatedType","updated_template_type","template","countRowInTemplate","targetTab","table","text","countExistingRows","remove","append","tabHeaderTemplate","tabBodyTemplate","after","spbcTblPaginationCallback","page","removeAttr","spbcTblSortCallback","domain","target","classList","contains","order_by","order","spbcScannerSwitchTable","_obj","spbcShowHideRows","blockId","columnKey","block","hasClass","removeClass","addClass","spbcUpdateEstimatedTime","spbcUpdateTables","setInterval","tab","tab_name","spbcViewUpdateEstimatedTime","additional","newTables","DOMParser","parseFromString","newAnalysisRows","querySelectorAll","currentAnalysisRows","newLastUpdateTime","querySelector","innerText","forEach","currentRow","time","newRow","spbcUpdatePscanCloudAnalysisInfo","sub_action","spbcViweUpdateAnalysisInfo","info","getElementById","ready"],"mappings":"AAAAA,IAAIC,eAAiB,KACrB,MAAMC,iBAAmBC,wBAAwBC,UAAU,EAO3D,SAASC,oBAAoBC,EAAqB,KAAMC,EAAa,IACjEC,oBACI,CAACC,OAAQ,oCAAoC,EAC7C,CACIC,QAAS,CAAA,EACTC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACrCC,OAAOD,CAAG,EAAEE,UAAU,SAAS,EAC/BD,OAAOD,CAAG,EAAEG,KAAKN,CAAM,EACvBI,OAAOD,CAAG,EAAEE,UAAU,CAClBE,OAAQ,KACRC,YAAa,UACbC,YAAa,CAAA,EACbC,OAAQ,CAAA,CACZ,CAAC,EACDC,yBAAyB,EACzBC,wBAAwB,EACxBC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB,EACS,OAAvBrB,GAA8C,OAAfC,GAC/BqB,mBAAmBtB,EAAoBC,CAAU,CAEzD,CACJ,EACAS,OAAO,sBAAsB,CACjC,CACJ,CAOA,SAASY,mBAAmBC,EAAYtB,GACpCP,IAAI8B,EAEAC,EAGuB,UAAvB,OAAM,GACS,KAAfF,GACuB,UAAvB,OAAM,GACS,KAAftB,IAMJuB,EAA4Bd,OAAO,iDAAmDa,EAAa,IAAI,EAAE,GAGzGG,EAAiB,4CAA8CH,EAAa,IAC5EG,EAAiBhB,OAAOgB,CAA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EACAwE,EAAO,GACXoC,EAAgBM,QAAQ,IACpBJ,EAAoBI,QAAQ,IAE0B,OAA9CC,EAAWH,cAAc,eAAe,IACxCxC,EAAO2C,EAAWH,cAAc,eAAe,EAAEC,WAEjDI,EAAOL,cAAc,eAAe,EAAEC,YAAczC,IAEpDtG,EAASmJ,EAAOL,cAAc,eAAe,EAAEtE,UAC/CyE,EAAWH,cAAc,eAAe,EAAEtE,UAAYxE,EACtDkJ,EAAOC,EAAOL,cAAc,iCAAiC,EAAEtE,UAC/DyE,EAAWH,cAAc,iCAAiC,EAAEtE,UAAY0E,EACxEpH,EAAUqH,EAAOL,cAAc,mBAAmB,EAAEtE,UACpDyE,EAAWH,cAAc,mBAAmB,EAAEtE,UAAY1C,EAElE,CAAC,CACL,CAAC,CAtBD,CAuBJ,CAAC,EAEDsH,iCAAiC,CACrC,CAKA,SAASA,mCACL7M,IAAIa,EAAO,CACPJ,OAAQ,uCACRqM,WAAY,eACZrG,SAAUC,aAAaC,UAC3B,EAOAnG,oBAAoBK,EALP,CACTF,SAAUoM,2BACVrM,QAAS,CAAA,CACb,CAEgC,CACpC,CAMA,SAASqM,2BAA2BnM,GAChCZ,IAAIgN,EAAO9F,SAAS+F,eAAe,2BAA2B,EAE1DD,IACAA,EAAK/E,UAAYrH,EAEzB,CAtJAI,OAAOkG,QAAQ,EAAEgG,MAAM,WAEnB3L,yBAAyB,EACzBC,wBAAwB,EACxBC,wBAAwB,EACxBC,kBAAkB,EAClB+J,wBAAwB,CAC5B,CAAC"}
\ No newline at end of file
+{"version":3,"file":"spbc-table.min.js","sources":["spbc-table.js"],"sourcesContent":["let spbcBulkAction = null;\nconst noConfirmActions = spbcGetNoConfirmActions(spbcPublic);\n\n/**\n * Reloads scanner accordion and set all the listeners\n * @param {string|null} interactControlTab ajaxResult If is set, will use this var as interactivity data.\n * @param {string|null} updateText\n */\nfunction spbcReloadAccordion(interactControlTab = null, updateText = '') {\n spbcSendAJAXRequest(\n {action: 'spbc_scanner_tab__reload_accordion'},\n {\n notJson: true,\n callback: function(result, data, params, obj) {\n jQuery(obj).accordion('destroy');\n jQuery(obj).html(result);\n jQuery(obj).accordion({\n header: 'h3',\n heightStyle: 'content',\n collapsible: true,\n active: false,\n });\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcStartShowHide();\n if (interactControlTab !== null && updateText !== null) {\n interactScannerTab(interactControlTab, updateText);\n }\n },\n },\n jQuery('#spbc_scan_accordion'),\n );\n}\n\n/**\n * Open refreshed tab after scanner reload.\n * @param {string} controlTab\n * @param {string} updateText\n */\nfunction interactScannerTab(controlTab, updateText) {\n let refreshControlTabSelector;\n let headerSelector;\n let headerUpdateStatus;\n\n if (\n typeof(controlTab) !== 'string' ||\n controlTab === '' ||\n typeof(updateText) !== 'string' ||\n updateText === ''\n ) {\n return;\n }\n\n // init refresh controlled tabs\n refreshControlTabSelector = jQuery('#spbc_scan_accordion div[refresh_control_tab=\"' + controlTab + '\"]')[0];\n\n // init header to click\n headerSelector = 'h3[aria-controls=spbc_scan_accordion_tab_' + controlTab + ']';\n headerSelector = jQuery(headerSelector)[0];\n\n if (\n typeof(refreshControlTabSelector) === 'undefined' ||\n typeof(headerSelector) === 'undefined'\n ) {\n return;\n }\n\n // show updated caption\n jQuery('')\n .appendTo(headerSelector);\n headerUpdateStatus = jQuery('.spbc_accordion_header_caption__update_status');\n jQuery('')\n .appendTo(headerUpdateStatus);\n\n // do click to open tab\n headerSelector.click();\n\n // highlight header\n refreshControlTabSelector.setAttribute(\n 'class',\n 'ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-active',\n );\n\n // hide all actions on partial reload\n jQuery('.row-actions').hide();\n}\n\n/**\n * Table bulk actions\n */\nfunction spbcTblBulkActionsListen() {\n jQuery('.tbl-bulk_actions-all--apply')\n .off('click')\n .on('click', function() {\n // @ToDo perhaps spbcScanner.active is not defined anywhere.\n // check this and implement `active` status in the right place\n if ( spbcScanner.active ) {\n alert(spbcTableLocalize.scannerIsActive);\n return;\n }\n\n let self = jQuery(this);\n let allowedBulkActions = [\n 'approve',\n 'disapprove',\n 'send',\n 'check_analysis_status',\n 'approve_page',\n 'disapprove_page',\n 'cure',\n 'delete_from_analysis_log',\n ];\n let action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\n\n if ( allowedBulkActions.indexOf( action ) !== -1 ) {\n if (!noConfirmActions.any.includes(action)) {\n if (!confirm(spbcTable.warning_bulk)) {\n return;\n }\n }\n let data = {\n action: 'spbc_tbl-action--bulk',\n add_action: action,\n status: self.parents('.tbl-root').attr('type'),\n };\n\n if (action === 'cure') {\n const selectedItems = self.closest('#spbc_tbl__scanner_cure_log').find('.cb-select');\n let selectedIds = [];\n\n selectedItems.each(function(index, element) {\n const elementId = jQuery(element).val();\n selectedIds.push(elementId);\n });\n data.selectedIds = selectedIds;\n }\n\n if (action === 'delete_from_analysis_log') {\n const selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select');\n let fileIds = [];\n\n selectedItems.each(function(index, element) {\n const elementId = jQuery(element).val();\n fileIds.push(elementId);\n });\n data.file_ids = fileIds;\n }\n\n let params = {\n button: this,\n spinner: self.children('.tbl-preloader--small'),\n callback: function(out) {\n spbcReloadAccordion();\n if ( action === 'check_analysis_status' && typeof out !== 'undefined') {\n let html = '
Analysis status updated.' +\n ' Total: ' + out.counters.total +\n ', updated: ' + out.counters.updated +\n ', skipped: ' + out.counters.skipped +\n ', failed: ' + out.counters.failed +\n ', queued: ' + out.counters.queued +\n '
';\n spbcModal.open().put( html );\n }\n if ( action === 'send' && typeof out !== 'undefined') {\n let html = '
Files have been sent: ' +\n out.files_sent_counter +\n '
';\n spbcModal.open().put(html);\n }\n },\n errorOutput: function( errorText, comment ) {\n if ( comment ) {\n errorText = errorText + '
Additional information:
' + comment;\n }\n spbcModal.open().putError( errorText );\n },\n timeout: 60000,\n };\n\n spbcSendAJAXRequest(data, params);\n } else {\n alert('This action is not supported for all files yet =(');\n }\n });\n\n jQuery('.tbl-bulk_actions--apply')\n .off('click')\n .on('click', function(e) {\n let self = spbcBulkAction || jQuery(this);\n spbcBulkAction = self;\n let action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\n\n if (!spbcBulkAction && !noConfirmActions.any.includes(action) && !confirm(spbcTable.warning_bulk)) {\n return;\n }\n\n if (action === 'cure') {\n spbcScannerCureSelected(jQuery(this));\n return;\n }\n\n if (action === 'delete_from_analysis_log') {\n spbcScannerAnalysisLogDeleteFromLog(jQuery(this));\n return;\n }\n\n if (action === 'allow' || action === 'ban') {\n let sendAction = action === 'ban' ? 'deny' : action;\n let items = self.parents('.tbl-root').find('.cb-select:checked');\n if (items) {\n self.children('.tbl-preloader--small').show();\n items.each(function() {\n let ip = jQuery(this).parents('tr').find('.tbl-row_action--'+action).data('ip');\n spbcSecLogsFilterIp(ip, sendAction, true);\n jQuery(this).prop('checked', false);\n });\n }\n self.children('.tbl-preloader--small').hide();\n let msg = action === 'allow' ? 'Allowed' : 'Banned';\n let html = '
Success. Selected IPs have been ' +\n msg +\n '. Changes will be applied within 10 minutes.' +\n '
';\n spbcModal.open().put( html );\n setTimeout(spbcReloadAccordion, 1900);\n\n return;\n }\n\n if ( action !== '-1' && self.parents('.tbl-root').find('.cb-select').is(':checked') ) {\n self.children('.tbl-preloader--small').show();\n // eslint-disable-next-line max-len\n if (self.parents('.tbl-root').find('.cb-select:checked').first().parents('tr').find('.tbl-row_action--'+action)[0]) {\n self\n .parents('.tbl-root')\n .find('.cb-select:checked')\n .first()\n .parents('tr')\n .find('.tbl-row_action--'+action)\n .click();\n self.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\n } else {\n self.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\n self.click();\n }\n } else {\n self.children('.tbl-preloader--small').hide();\n spbcBulkAction = null;\n if ( action === 'check_analysis_status' || action === 'disapprove' ) {\n let html = '
All available files are updated.' + '
';\n spbcModal.open().put( html );\n }\n if ( action === 'send') {\n let html = '
All available files are sent.' + '
';\n spbcModal.open().put( html );\n }\n setTimeout(spbcReloadAccordion, 1900);\n }\n // reset spbcBulkAction if action is restricted\n if (noConfirmActions.restricted.includes(action)) {\n spbcBulkAction = null;\n }\n });\n}\n\n/**\n * Cure selected files\n * @param {obj} current\n */\nfunction spbcScannerCureSelected(current) {\n const selectedItems = current.closest('#spbc_tbl__scanner_cure_log').find('.cb-select:checked');\n let selectedIds = [];\n\n if (selectedItems.length === 0) {\n alert('Please, select elements.');\n }\n\n selectedItems.each(function(index, element) {\n const elementId = jQuery(element).val();\n selectedIds.push(elementId);\n });\n\n const data = {\n action: 'spbc_cure_selected',\n security: spbcSettings.ajax_nonce,\n selectedIds: selectedIds,\n };\n jQuery.ajax({\n type: 'POST',\n url: spbcSettings.ajaxurl,\n data: data,\n beforeSend: function() {\n current\n .closest('#spbc_tbl__scanner_cure_log')\n .find('.tbl-button---white_blue .tbl-preloader--in_button')\n .show();\n },\n success: function(result) {\n current\n .closest('#spbc_tbl__scanner_cure_log')\n .find('.tbl-button---white_blue .tbl-preloader--in_button')\n .hide();\n if (result.success) {\n spbcModal.open().put(result.data);\n document.addEventListener('spbcModalClosed', function( e ) {\n document.location.reload();\n });\n } else {\n spbcModal.open().putError(result.data);\n }\n },\n });\n}\n\n/**\n * Table row actions\n */\nfunction spbcTblRowActionsListen() {\n jQuery('.tbl-row_action--ajax')\n .off('click')\n .on('click', function() {\n if ( spbcScanner.active ) {\n alert(spbcTableLocalize.scannerIsActive);\n return;\n }\n let self = jQuery(this);\n let data = {\n action: 'spbc_tbl-action--row',\n add_action: self.attr('row-action'),\n id: self.parents('.row-actions').attr('uid'),\n cols: self.parents('.row-actions').attr('cols_amount'),\n page_url: self.parent().attr('uid'),\n page_id: self.parent().attr('page_id'),\n };\n let params = {\n callback: spbcTblRowActionsCallback,\n errorOutput: function(msg, comment, hideSupportLink) {\n spbcModal.open().putError( msg, hideSupportLink );\n },\n spinner: self.parent().siblings('.tbl-preloader--tiny'),\n };\n\n // @ToDo delete this timeout after ready task #10014\n if ( self.attr('row-action') === 'delete' ) {\n params.timeout = 60000;\n }\n\n let fileName = self.parent().parent()[0].firstChild.innerHTML;\n let confirmationHeader = spbcTable['warning_h_'+self.attr('row-action')] || spbcTable.warning_default;\n let confirmationText = spbcTable['warning_t_'+self.attr('row-action')] || '';\n // init row actions with no confirm required\n if ( spbcBulkAction || noConfirmActions.any.includes(data.add_action) ) {\n // do not request user confirmation if the action is excluded or if it is a bulk action\n spbcSendAJAXRequest(data, params, self.parents('tr'));\n } else {\n // do request confirmation otherwise\n const yesButtonText = self.attr('row-action') === 'quarantine' ? 'Quarantine' : 'Yes';\n const noButtonText = self.attr('row-action') === 'quarantine' ? 'Cancel' : 'No';\n spbcModal.open().confirm(confirmationHeader, confirmationText, fileName, (confirmed) => {\n if (confirmed) {\n spbcSendAJAXRequest(data, params, self.parents('tr'));\n }\n }, yesButtonText, noButtonText);\n }\n });\n}\n\n/**\n * Row actions with no confirm required.\n * @param {object} spbcPublic Global localized SPBC object\n * @return {{}}\n */\nfunction spbcGetNoConfirmActions(spbcPublic) {\n let noConfirmActionsEmpty = {\n 'any': [],\n 'restricted': [],\n 'defaults': [],\n };\n let noConfirmActions = noConfirmActionsEmpty;\n try {\n if ( typeof spbcPublic !== 'undefined' && spbcPublic.hasOwnProperty('no_confirm_row_actions')) {\n noConfirmActions = JSON.parse(spbcPublic.no_confirm_row_actions);\n }\n if (\n typeof noConfirmActions.any.includes !== 'function' ||\n typeof noConfirmActions.restricted.includes !== 'function' ||\n typeof noConfirmActions.defaults.includes !== 'function'\n ) {\n noConfirmActions = noConfirmActionsEmpty;\n }\n } catch (e) {\n noConfirmActions = noConfirmActionsEmpty;\n }\n return noConfirmActions;\n}\n\n/**\n * Callback for table row actions\n *\n * @param {obj|string} result\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcTblRowActionsCallback(result, data, params, obj) {\n if (result.color) {\n obj.css({background: result.background, color: result.color});\n }\n if (result.html) {\n obj.parent().parent().parent().prepend(result.html);\n setTimeout(function() {\n obj.fadeOut(300);\n }, 1500);\n if ( ! spbcBulkAction) {\n setTimeout(spbcReloadAccordion, 1900);\n }\n }\n\n if (\n data.add_action === 'copy_file_info'\n ) {\n if (result.success === true && result.data.file_info) {\n window.\n prompt('Copy the file info below and send it to support@cleantalk.org: ', result.data.file_info);\n } else {\n let errorText = (typeof result.data.error !== 'undefined') ?\n result.data.error :\n 'Unknown copy_file_info error';\n spbcModal.open().putError( errorText );\n }\n }\n\n if (result.temp_html) {\n let tmp=obj.html();\n obj.html(result.temp_html);\n if (result.updated_template !== undefined) {\n let updatedType = result.updated_template_type;\n let template = result.updated_template;\n let rowsInTemplate = jQuery(template).find('.wp-list-table tbody tr');\n let countRowInTemplate = rowsInTemplate.length;\n let targetTab = jQuery('[aria-controls=\"spbc_scan_accordion_tab_' + updatedType + '\"]');\n\n if (targetTab.length > 0) {\n let table = jQuery('#spbc_tbl__scanner_' + updatedType);\n // Count files in header\n jQuery('.spbc_bad_type_count.' + updatedType + '_counter').text(countRowInTemplate);\n // Count rows in table\n let countExistingRows = table.find('.wp-list-table tbody tr').length;\n table.remove();\n jQuery('#spbc_scan_accordion_tab_' + updatedType).append(template);\n // Marked new rows\n jQuery(jQuery('#spbc_scan_accordion_tab_' + updatedType)\n .find('.wp-list-table tbody tr'))\n .each(function(index, element) {\n if (++index > countExistingRows) {\n jQuery(element).css('outline', '1px solid green');\n }\n });\n targetTab.click();\n } else {\n if (updatedType === 'analysis_log') {\n // eslint-disable-next-line max-len\n let tabHeaderTemplate = '';\n // eslint-disable-next-line max-len\n let tabBodyTemplate = '
Files sent for analysis.
' +\n template +\n '
';\n jQuery('#spbc_scan_accordion_tab_critical').after(tabHeaderTemplate + tabBodyTemplate);\n targetTab.click();\n }\n }\n }\n setTimeout(function() {\n obj\n .html(tmp)\n .css({background: 'inherit'})\n .find('.column-primary .row-actions .tbl-row_action--' + data.add_action)\n .remove();\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcStartShowHide();\n }, 5000);\n }\n if (spbcBulkAction) {\n spbcBulkAction.click();\n }\n}\n\n/**\n * Table pagination actions\n */\nfunction spbcTblPaginationListen() {\n let data = {action: 'spbc_tbl-pagination'};\n let params = {callback: spbcTblPaginationCallback, notJson: true};\n jQuery('.tbl-pagination--button').on('click', function() {\n jQuery(this).parents('.tbl-root').find('.tbl-pagination--button').attr('disabled', 'disabled');\n });\n jQuery('.tbl-pagination--go').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.siblings('.tbl-pagination--curr_page').val();\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--prev').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.parents('.tbl-pagination--wrapper').attr('prev_page');\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--next').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.parents('.tbl-pagination--wrapper').attr('next_page');\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--end').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = self.parents('.tbl-pagination--wrapper').attr('last_page');\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n jQuery('.tbl-pagination--start').on('click', function() {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n data.page = 1;\n data.type = obj.attr('type');\n params.spinner = self.siblings('.tbl-preloader--small');\n spbcSendAJAXRequest(data, params, obj);\n });\n}\n\n/**\n * Callback for Table pagination actions\n *\n * @param {obj|string} result\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcTblPaginationCallback(result, data, params, obj) {\n jQuery(obj)\n .html(result)\n .find('.tbl-pagination--button').removeAttr('disabled');\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcStartShowHide();\n}\n\n/**\n * Table sort actions\n */\nfunction spbcTblSortListen() {\n let params = {callback: spbcTblSortCallback, notJson: true};\n jQuery('.tbl-column-sortable').on('click', function(e) {\n if (e.target.classList.contains('tbl-sorting_indicator')) {\n let self = jQuery(this);\n let obj = self.parents('.tbl-root');\n let domain = obj.attr('type') == 'links'? jQuery('#spbc_tbl__scanner__outbound_links b').html(): '';\n let data = {\n action: 'spbc_tbl-sort',\n order_by: self.attr('id'),\n order: self.attr('sort_direction'),\n type: obj.attr('type'),\n domain: domain,\n };\n spbcSendAJAXRequest(data, params, obj);\n }\n });\n}\n\n/**\n * Callback for Table sort actions\n *\n * @param {obj|string} result\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcTblSortCallback(result, data, params, obj) {\n jQuery(obj).html(result);\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n}\n\njQuery(document).ready(function() {\n // Table. Row actions handler\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcUpdateEstimatedTime();\n});\n\n/**\n * Switching table handler\n * Using by inline php code\n *\n * @param {obj} obj\n * @param {obj} table\n *\n */\nfunction spbcScannerSwitchTable(obj, table) {/* eslint-disable-line no-unused-vars */\n let _obj = jQuery(obj);\n let domain = _obj.parents('.row-actions').attr('uid');\n let data = {action: 'spbc_tbl-switch', type: table, domain: domain};\n let params = {callback: spbcTblPaginationCallback, notJson: true};\n spbcSendAJAXRequest(data, params, _obj.parents('.tbl-root'));\n}\n\n/**\n * Open/close table rows handler\n * Using by inline php code\n *\n * @param {string} blockId\n * @param {string} columnKey\n */\nfunction spbcShowHideRows(blockId, columnKey) {/* eslint-disable-line no-unused-vars */\n let className = '.' + columnKey + '_block_' + blockId;\n let block = jQuery(className);\n if (block.hasClass('mob_table_active')) {\n block.removeClass('mob_table_active');\n } else {\n block.addClass('mob_table_active');\n }\n}\n\n/**\n * Update estimated time\n */\nfunction spbcUpdateEstimatedTime() {\n spbcUpdateTables();\n setInterval(() => {\n spbcUpdateTables();\n }, 60000);\n}\n\n/**\n * Update tables\n * @param {obj} tab\n * @param {obj} params\n */\nfunction spbcUpdateTables(tab, params) {\n // todo params is always not provided!\n let tabName = 'scanner';\n let data = {\n action: 'spbc_settings__draw_elements',\n tab_name: tabName,\n security: spbcSettings.ajax_nonce,\n };\n let currentParams = {\n callback: spbcViewUpdateEstimatedTime,\n notJson: true,\n additional: params || null,\n };\n spbcSendAJAXRequest( data, currentParams, tab );\n}\n\n/**\n * Update estimated time\n * @param {string} result\n */\nfunction spbcViewUpdateEstimatedTime(result) {\n // todo the function unsafely trust the result, needs to validate\n const parser = new DOMParser();\n const newTables = parser.parseFromString(result, 'text/html');\n // todo validate if selector is valid\n const newAnalysisRows = newTables.querySelectorAll('#spbc_tbl__scanner_analysis_log tbody tr');\n // todo validate if selector is valid\n const currentAnalysisRows = document.querySelectorAll('#spbc_tbl__scanner_analysis_log tbody tr');\n // todo what this was for?\n let newLastUpdateTime = newTables.querySelector('#spbc_last_update_time');\n if (newLastUpdateTime) {\n newLastUpdateTime = newLastUpdateTime.innerText;\n }\n\n currentAnalysisRows.forEach((currentRow) => {\n if (currentRow.querySelector('.pscan_estimated_execution_time').innerText === 'Done') {\n return;\n }\n\n let status = '';\n let time = '';\n let comment = '';\n let text = '';\n newAnalysisRows.forEach((newRow) => {\n currentAnalysisRows.forEach((currentRow) => {\n // validate selector result\n if (currentRow.querySelector('.spbcFullText') !== null) {\n text = currentRow.querySelector('.spbcFullText').innerText;\n }\n if (newRow.querySelector('.spbcFullText').innerText === text) {\n // todo all the selectors data is not protected against null values!\n status = newRow.querySelector('.pscan_status').innerHTML;\n currentRow.querySelector('.pscan_status').innerHTML = status;\n time = newRow.querySelector('.pscan_estimated_execution_time').innerHTML;\n currentRow.querySelector('.pscan_estimated_execution_time').innerHTML = time;\n comment = newRow.querySelector('.analysis_comment').innerHTML;\n currentRow.querySelector('.analysis_comment').innerHTML = comment;\n }\n });\n });\n });\n\n spbcUpdatePscanCloudAnalysisInfo();\n}\n\n/**\n * Update psacn cloud analysis info\n */\nfunction spbcUpdatePscanCloudAnalysisInfo() {\n let data = {\n action: 'spbc_analysyis_files_stats__get_html',\n sub_action: 'give_me_html',\n security: spbcSettings.ajax_nonce,\n };\n\n let params = {\n callback: spbcViweUpdateAnalysisInfo,\n notJson: true,\n };\n\n spbcSendAJAXRequest(data, params);\n}\n\n/**\n * Update analysis info\n * @param {string} result\n */\nfunction spbcViweUpdateAnalysisInfo(result) {\n let info = document.getElementById('spbc_analysis_files_stats');\n\n if (info) {\n info.innerHTML = result;\n }\n}\n"],"names":["let","spbcBulkAction","noConfirmActions","spbcGetNoConfirmActions","spbcPublic","spbcReloadAccordion","interactControlTab","updateText","spbcSendAJAXRequest","action","notJson","callback","result","data","params","obj","jQuery","accordion","html","header","heightStyle","collapsible","active","spbcTblBulkActionsListen","spbcTblRowActionsListen","spbcTblPaginationListen","spbcTblSortListen","spbcStartShowHide","interactScannerTab","controlTab","refreshControlTabSelector","headerUpdateStatus","headerSelector","appendTo","click","setAttribute","hide","off","on","spbcScanner","alert","spbcTableLocalize","scannerIsActive","self","this","siblings","children","first","selectedIndex","value","indexOf","any","includes","confirm","spbcTable","warning_bulk","add_action","status","parents","attr","selectedItems","closest","find","selectedIds","each","index","element","elementId","val","push","fileIds","file_ids","button","spinner","out","counters","total","updated","skipped","failed","queued","spbcModal","open","put","files_sent_counter","errorOutput","errorText","comment","putError","timeout","e","spbcScannerCureSelected","spbcScannerAnalysisLogDeleteFromLog","sendAction","items","msg","show","ip","spbcSecLogsFilterIp","prop","setTimeout","is","restricted","current","length","security","spbcSettings","ajax_nonce","ajax","type","url","ajaxurl","beforeSend","success","document","addEventListener","location","reload","id","cols","page_url","parent","page_id","spbcTblRowActionsCallback","hideSupportLink","yesButtonText","noButtonText","fileName","firstChild","innerHTML","confirmationHeader","warning_default","confirmationText","confirmed","noConfirmActionsEmpty","defaults","hasOwnProperty","JSON","parse","no_confirm_row_actions","color","css","background","prepend","fadeOut","file_info","window","prompt","error","temp_html","tmp","undefined","updated_template","updatedType","updated_template_type","template","countRowInTemplate","targetTab","table","text","countExistingRows","remove","append","tabHeaderTemplate","tabBodyTemplate","after","spbcTblPaginationCallback","page","removeAttr","spbcTblSortCallback","domain","target","classList","contains","order_by","order","spbcScannerSwitchTable","_obj","spbcShowHideRows","blockId","columnKey","block","hasClass","removeClass","addClass","spbcUpdateEstimatedTime","spbcUpdateTables","setInterval","tab","tab_name","spbcViewUpdateEstimatedTime","additional","newTables","DOMParser","parseFromString","newAnalysisRows","querySelectorAll","currentAnalysisRows","newLastUpdateTime","querySelector","innerText","forEach","currentRow","time","newRow","spbcUpdatePscanCloudAnalysisInfo","sub_action","spbcViweUpdateAnalysisInfo","info","getElementById","ready"],"mappings":"AAAAA,IAAIC,eAAiB,KACfC,iBAAmBC,wBAAwBC,UAAU,EAO3D,SAASC,oBAAoBC,EAAqB,KAAMC,EAAa,IACjEC,oBACI,CAACC,OAAQ,oCAAoC,EAC7C,CACIC,QAAS,CAAA,EACTC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACrCC,OAAOD,CAAG,EAAEE,UAAU,SAAS,EAC/BD,OAAOD,CAAG,EAAEG,KAAKN,CAAM,EACvBI,OAAOD,CAAG,EAAEE,UAAU,CAClBE,OAAQ,KACRC,YAAa,UACbC,YAAa,CAAA,EACbC,OAAQ,CAAA,CACZ,CAAC,EACDC,yBAAyB,EACzBC,wBAAwB,EACxBC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB,EACS,OAAvBrB,GAA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AClB+J,wBAAwB,CAC5B,CAAC"}
\ No newline at end of file
diff --git a/js/src/spbc-scanner-plugin.js b/js/src/spbc-scanner-plugin.js
index c7a1851fd..4a3145e9b 100644
--- a/js/src/spbc-scanner-plugin.js
+++ b/js/src/spbc-scanner-plugin.js
@@ -22,6 +22,7 @@ class SpbcMalwareScanner {/* eslint-disable-line no-unused-vars */
'schedule_send_heuristic_suspicious_files',
'auto_cure_backup',
'auto_cure',
+ 'os_cron_analysis',
'outbound_links',
'frontend_analysis',
'important_files_listing',
diff --git a/lib/CleantalkSP/Common/Helpers/CSV.php b/lib/CleantalkSP/Common/Helpers/CSV.php
index 257e196e4..1b78b0207 100644
--- a/lib/CleantalkSP/Common/Helpers/CSV.php
+++ b/lib/CleantalkSP/Common/Helpers/CSV.php
@@ -30,27 +30,6 @@ public static function sanitizeFromEmptyLines($buffer)
return $buffer;
}
- /**
- * Parse Comma-separated values, without formatting to csv
- *
- * @param $buffer
- *
- * @return false|string[]
- */
- public static function parseCSVLite($buffer)
- {
- $buffer = explode("\n", $buffer);
- $buffer = self::sanitizeFromEmptyLines($buffer);
-
- foreach ($buffer as &$line) {
- if ($line !== '') {
- $line = substr($line, 6);
- }
- }
-
- return $buffer;
- }
-
/**
* Parse Comma-separated values
*
diff --git a/lib/CleantalkSP/Common/Helpers/HTTP.php b/lib/CleantalkSP/Common/Helpers/HTTP.php
index ed02e32d5..4fce8b9c7 100644
--- a/lib/CleantalkSP/Common/Helpers/HTTP.php
+++ b/lib/CleantalkSP/Common/Helpers/HTTP.php
@@ -94,8 +94,8 @@ public static function getResponseCode($url, $ignore_redirects = false)
}
$code = $http->setUrl($url)
- ->setPresets($presets)
- ->request();
+ ->setPresets($presets)
+ ->request();
if (!empty($code['error'])) {
return false;
@@ -325,10 +325,6 @@ public static function sortHostsByResponseTime($hosts)
*/
public static function ping($host)
{
- if ($host === 'localhost' || !function_exists('fsockopen')) {
- return 0.001;
- }
-
$starttime = microtime(true);
$file = @fsockopen($host, 80, $errno, $errstr, 1500 / 1000);
$stoptime = microtime(true);
diff --git a/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php b/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php
old mode 100755
new mode 100644
index 963f508c4..e73378b44
--- a/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php
+++ b/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php
@@ -28,6 +28,7 @@
use CleantalkSP\SpbctWP\Helpers\Helper as QueueHelper;
use CleantalkSP\SpbctWP\Helpers\CSV;
use CleantalkSP\SpbctWP\RemoteCalls;
+use CleantalkSP\SpbctWP\Scanner\ScanningStagesModule\Stages\OSCronAnalysis;
use CleantalkSP\SpbctWP\Scanner\Stages\SendResultsStage;
use CleantalkSP\SpbctWP\Scanner\Stages\CureStage;
@@ -41,6 +42,7 @@ class ScannerQueue
'get_modules_hashes',
'clean_results',
'file_system_analysis',
+ 'os_cron_analysis',
'get_denied_hashes',
'get_approved_hashes',
'signature_analysis',
@@ -1017,6 +1019,58 @@ public function file_system_analysis($offset = null, $amount = null, $path_to_sc
return $output;
}
+ /**
+ * Check crontab for scheduled scans
+ *
+ * @return array
+ * @psalm-suppress ForbiddenCode
+ */
+ public function os_cron_analysis() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
+ {
+ $scanning_stages_storage = new ScanningStagesStorage();
+ $scanning_stages_storage->converter->loadCollection();
+ $stage_data_obj = $scanning_stages_storage->getStage(OSCronAnalysis::class);
+
+ /* */
+ $result = shell_exec('crontab -l');
+
+ if (!$result) {
+ ScanningLogFacade::writeToLog(
+ '
' . $stage_data_obj::getTitle() . ' ' . __('No crontab found.', 'security-malware-firewall')
+ );
+
+ return array(
+ 'end' => 1,
+ );
+ }
+
+ $result = explode("\n", $result);
+ $result = array_map('trim', $result);
+ $result = array_filter($result, function ($item) {
+ return !empty($item);
+ });
+
+ $result = array_map(function ($item) {
+ $parts = preg_split('/\s+/', $item, 6);
+ $timePattern = implode(' ', array_slice($parts, 0, 5));
+ $command = $parts[5];
+ return [
+ 'id' => uniqid(),
+ 'status' => 'found',
+ 'repeat' => $timePattern,
+ 'command' => $command,
+ ];
+ }, $result);
+
+ update_option('spbc_oscron_result', json_encode($result));
+
+ ScanningLogFacade::writeToLog(
+ '
' . $stage_data_obj::getTitle() . ' ' . $stage_data_obj->getDescription()
+ );
+
+ return array('end' => 1);
+ }
+
/**
* Getting remote hashes of denied files
*
diff --git a/lib/CleantalkSP/SpbctWP/Scanner/ScanningLog/Repository.php b/lib/CleantalkSP/SpbctWP/Scanner/ScanningLog/Repository.php
old mode 100644
new mode 100755
diff --git a/lib/CleantalkSP/SpbctWP/Scanner/ScanningStagesModule/Stages/OSCronAnalysis.php b/lib/CleantalkSP/SpbctWP/Scanner/ScanningStagesModule/Stages/OSCronAnalysis.php
new file mode 100755
index 000000000..4b9946e81
--- /dev/null
+++ b/lib/CleantalkSP/SpbctWP/Scanner/ScanningStagesModule/Stages/OSCronAnalysis.php
@@ -0,0 +1,36 @@
+scanned_count_files
+ . '.';
+ }
+
+ public function getName()
+ {
+ return __CLASS__;
+ }
+
+ public function getData()
+ {
+ return array(
+ // 'scanned_count_files' => $this->scanned_count_files
+ );
+ }
+}
diff --git a/lib/CleantalkSP/SpbctWP/State.php b/lib/CleantalkSP/SpbctWP/State.php
index 4211d474d..ed3297be2 100644
--- a/lib/CleantalkSP/SpbctWP/State.php
+++ b/lib/CleantalkSP/SpbctWP/State.php
@@ -75,6 +75,7 @@ class State extends \CleantalkSP\Common\State
'scanner__schedule_send_heuristic_suspicious_files' => 2, //0 - OFF, 1 - ON, 2 - AUTO
'scanner__signature_analysis' => 1,
'scanner__auto_cure' => 1,
+ 'scanner__os_cron_analysis' => 1,
'scanner__dir_exclusions' => '',
'scanner__dir_exclusions_view' => '',
'scanner__list_unknown' => 1,