Exemplo n.º 1
0
            $net->set_name($name);
            if ($can_i_modify_ips == TRUE) {
                $net->set_ips($ips_string);
            }
            $net->set_descr($descr);
            if ($icon != '') {
                $net->set_icon($icon);
            }
            $net->set_external($external);
            $net->set_asset_value($asset_value);
            $net->set_threshold_c($threshold_c);
            $net->set_threshold_a($threshold_a);
            $net->set_owner($owner);
            $net->set_sensors($sensors);
            $net->save_in_db($conn);
            Asset_net_scan::delete_plugin_from_db($conn, $id, 2007);
            if (!empty($nagios)) {
                Asset_net_scan::save_plugin_in_db($conn, $id, 2007);
            }
            $data['status'] = 'OK';
            $data['data'] = _('Net saved successfully');
            $db->close();
        } else {
            $data['status'] = 'error';
            $data['data'] = array('no_create_asset' => _("Sorry, you don't have permissions to create assets"));
        }
    } catch (Exception $e) {
        $data['status'] = 'error';
        $data['data'] = array('php_exception' => $e->getMessage());
    }
}