$e_message = _('Some host services could not be toggled'); //At least, one service was toggled, we have to clear the cache $data['reload_tree'] = TRUE; } } //Formatted message $data['data'] = '<div>' . _('We Found the following errors') . ":</div>\n\t\t\t\t\t <div style='padding: 5px;'>" . $e_message . '</div>'; } //Enable o disable Nagios in host $filters = array('where' => "h.id IN (UNHEX('" . $p_data['host_id'] . "')) AND nagios = 1"); $_host_services = Asset_host_services::get_list($conn, $filters); $host_services = $_host_services[0]; if (count($host_services) >= 1) { Asset_host_scan::save_plugin_in_db($conn, $p_data['host_id'], 2007); } else { Asset_host_scan::delete_plugin_from_db($conn, $p_data['host_id'], 2007); } $db->close(); break; case 'delete_properties': //Error counter $e_counter = 0; //Properties $properties = base64_decode(POST('properties')); $properties = json_decode($properties, TRUE); $data['status'] = 'OK'; $data['data'] = _('Host properties removed successfully'); $data['reload_tree'] = TRUE; $db = new ossim_db(); $conn = $db->connect(); if (is_array($properties) && !empty($properties)) {
if (Asset_group_scan::is_plugin_in_group($conn, $id, 2007)) { Asset_group_scan::delete_plugin_from_db($conn, $id, 2007); } Asset_group_scan::save_plugin_in_db($conn, $id, 2007); foreach ($hosts as $host_id) { if (!Asset_host_scan::is_plugin_in_host($conn, $host_id, 2007)) { Asset_host_scan::save_plugin_in_db($conn, $host_id, 2007); } } } else { if (Asset_group_scan::is_plugin_in_group($conn, $id, 2007)) { Asset_group_scan::delete_plugin_from_db($conn, $id, 2007); } foreach ($hosts as $host_id) { if (Asset_host_scan::is_plugin_in_host($conn, $host_id, 2007)) { Asset_host_scan::delete_plugin_from_db($conn, $host_id, 2007); } } } $data['status'] = 'OK'; $data['data'] = _('Asset group saved successfully'); $db->close(); } catch (Exception $e) { $data['status'] = 'error'; $data['data'] = array('php_exception' => $e->getMessage()); } } if ($data['status'] == 'error') { $txt_error = '<div>' . _('We Found the following errors') . ":</div>\n\t\t\t\t\t <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);