Skip to content

Commit

Permalink
Fix. Scanner results. Approved category updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Glomberg committed Sep 19, 2023
1 parent ccfe1a6 commit 8f50e74
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion inc/spbc-scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ function spbc_get_sql_where_addiction_for_table_of_category($category)
OR (status = "INFECTED" AND severity IN ("SUSPICIOUS","DANGER") )';
break;
case 'approved':
$res = ' WHERE status = "APROVED"';
$res = ' WHERE ( status = "APROVED" OR status = "APPROVED_BY_CT" ) AND source_type IS NULL';
break;
case 'analysis_log':
$res = ' WHERE last_sent IS NOT NULL';
Expand Down
50 changes: 41 additions & 9 deletions inc/spbc-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2292,16 +2292,22 @@ function spbc_field_scanner__prepare_data__files(&$table)
unset($row->actions['quarantine']);
}

$cloud_status = __('Not checked by Cloud Analysis or ' . $spbc->data["wl_company_name"] . ' Team yet.', 'security-malware-firewall');
if ( !empty($row->pscan_status) ) {
if ( $row->pscan_status === 'DANGEROUS' ) {
$cloud_status = '<span class="spbcRed">' . __('File is denied by Cloud analysis', 'security-malware-firewall') . '</span>';
if ( $table->type === 'approved' ) {
$status = $row->status === 'APPROVED_BY_CT'
? esc_html__('CleanTalk Team', 'security-malware-firewall')
: esc_html__('User', 'security-malware-firewall');
} else {
$status = __('Not checked by Cloud Analysis or ' . $spbc->data["wl_company_name"] . ' Team yet.', 'security-malware-firewall');
if ( !empty($row->pscan_status) ) {
if ( $row->pscan_status === 'DANGEROUS' ) {
$status = '<span class="spbcRed">' . __('File is denied by Cloud analysis', 'security-malware-firewall') . '</span>';
}
}
}

if ( !empty($row->analysis_status) ) {
if ( $row->analysis_status === 'DANGEROUS' ) {
$cloud_status = '<span class="spbcRed">' . __('File is denied by ' . $spbc->data["wl_company_name"] . ' team', 'security-malware-firewall') . '</span>';
if ( !empty($row->analysis_status) ) {
if ( $row->analysis_status === 'DANGEROUS' ) {
$status = '<span class="spbcRed">' . __('File is denied by ' . $spbc->data["wl_company_name"] . ' team', 'security-malware-firewall') . '</span>';
}
}
}

Expand All @@ -2315,7 +2321,7 @@ function spbc_field_scanner__prepare_data__files(&$table)
? '<div class="spbcShortText">...' . $row->path . '</div><div class="spbcFullText spbc_hide">' . $root_path . $row->path . '</div>'
: $root_path . $row->path,
'actions' => $row->actions,
'status' => $cloud_status,
'status' => $status,
);

if (isset($row->weak_spots)) {
Expand Down Expand Up @@ -2655,6 +2661,30 @@ function spbc_field_scanner__files_listing__data_prepare(&$table)
}
}

/**
* Modify data to the Approved section
*
* @return void
*/
function spbc_field_scanner__approved__data_prepare(&$table)
{
if ($table->items_count) {
foreach ($table->rows as $row) {
$table->items[] = array(
'cb' => $row->page_id,
'path' => $row->path,
'weak_spots' => $row->weak_spots,
'size' => $row->size,
'perms' => $row->perms,
'mtime' => $row->mtime,
'status' => $row->status === 'APPROVED_BY_CT'
? esc_html__('CleanTalk Team', 'security-malware-firewall')
: esc_html__('User', 'security-malware-firewall'),
);
}
}
}

function spbc_field_scanner__log()
{
global $spbc;
Expand Down Expand Up @@ -3394,13 +3424,15 @@ function spbc_list_table__get_args_by_type($table_type)
$accordion_default_args,
array(
'func_data_prepare' => 'spbc_field_scanner__prepare_data__files',
//'func_data_prepare' => 'spbc_field_scanner__approved__data_prepare',
'columns' => array(
'cb' => array('heading' => '<input type=checkbox>', 'class' => 'check-column', 'width_percent' => 2),
'path' => array('heading' => 'Path', 'primary' => true, 'width_percent' => 40),
'weak_spots' => array('heading' => 'Detected', 'width_percent' => 20),
'size' => array('heading' => 'Size, bytes', 'width_percent' => 7),
'perms' => array('heading' => 'Permissions', 'width_percent' => 7),
'mtime' => array('heading' => 'Last Modified', 'width_percent' => 7),
'status' => array('heading' => 'Approved by', 'width_percent' => 15),
),
'if_empty_items' => false,
'actions' => array(
Expand Down

0 comments on commit 8f50e74

Please sign in to comment.