Ejemplo n.º 1
0
<?php 
//There are some validation errors
if ($data['status'] == 'error') {
    $txt_error = '<div>' . _('The following errors occurred') . ":</div>\n                  <div style='padding: 10px;'>" . implode('<br/>', $data['data']) . '</div>';
    $config_nt = array('content' => $txt_error, 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align: left;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
} else {
    $scan_report = file_get_contents($scan_report_file);
    $scan_report = unserialize($scan_report);
    //Sensor context
    $ctx = $scan_report['sensor']['ctx'];
    session_write_close();
    $db = new ossim_db();
    $conn = $db->connect();
    $data = Av_scan::save_scan_report_in_db($conn, $scan_report, $_POST);
    //Check general status
    if (count($data['general']['hosts_in_group']) == 0) {
        $data['general']['status'] = 'error';
        $data['general']['data'] = _('Error! Assets could not be updated');
    } else {
        if (count($data['general']['hosts_in_group']) == $data['general']['total_hosts']) {
            $data['general']['status'] = 'success';
            $data['general']['data'] = _('Asset information succesfully updated');
            foreach ($data['by_host'] as $h_key => $h_data) {
                if ($h_data['status'] == 'warning') {
                    $data['general']['status'] = 'warning';
                    $data['general']['data'] = _('Asset information succesfully updated');
                    break;
                }
            }