function plugin_list($conn, $page, $search) { $filters = array(); $filters['limit'] = get_query_limits($page); if ($search != '') { $search = utf8_decode($search); $search = escape_sql($search, $conn); $filters['where'] = " (plugin.name LIKE '%{$search}%' OR plugin.description LIKE '%{$search}%')"; } try { list($plugins, $total) = Asset_host_scan::get_all_plugins($conn, '', $filters, TRUE); } catch (Exception $e) { $return['error'] = TRUE; $return['msg'] = $e->getMessage(); return $return; } if ($total > 0) { $selected = get_selected_values(25); } $list = array(); // Special filter "No Plugin Enabled" PID = 0 if (count($plugins) > 0 && $search == '') { $_chk = $selected[0] != '' ? TRUE : FALSE; $_plugin = array('id' => 0, 'name' => _('No Plugin Enabled'), 'class' => 'italic exclusive', 'checked' => $_chk); $list[] = $_plugin; } //Going through the list to format the elements properly: foreach ($plugins as $p_id => $p_data) { $_chk = $selected[$p_id] != '' ? TRUE : FALSE; $_plugin = array('id' => $p_id, 'name' => ucwords($p_data['name']), 'title' => $p_data['description'], 'checked' => $_chk); $list[] = $_plugin; } $data['total'] = intval($total); $data['list'] = $list; $return['error'] = FALSE; $return['data'] = $data; return $return; }
array_push($parameters, $v_data['e_message']); call_user_func_array('ossim_valid', $parameters); if (ossim_error()) { $exp_msg = ossim_get_error(); Av_exception::throw_error(Av_exception::USER_ERROR, $exp_msg); } } //Update Nagios $parameters = array(); $parameters = array_values($s_data); //Adding BD connection array_unshift($parameters, $conn); call_user_func_array($p_function, $parameters); } catch (Exception $e) { $data['status'] = 'error'; } } } if ($data['status'] == 'error') { $db->close(); Util::response_bad_request(_('Some of your changes could not be saved')); } //Add host to nagios Asset_host_scan::save_plugin_in_db($conn, $asset_id, 2007); //report changes Asset_host::report_changes($conn, 'hosts'); } $db->close(); break; } echo json_encode($data);
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);
$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)) {
$longitude = $location['lon']; $zoom = $location['zoom']; $asset_value = $host->get_asset_value(); $threshold_a = $host->get_threshold_a(); $threshold_c = $host->get_threshold_c(); //Host Ips $host_ips = $host->get_ips(); $ips = $host_ips->get_ips('string'); //Host Sensors $host_sensors = $host->get_sensors(); $sensors = $host_sensors->get_sensors(); //Host Devices $host_devices = $host->get_devices(); $devices = $host_devices->get_devices(); //Host Scan $is_nagios_enabled = Asset_host_scan::is_plugin_in_host($conn, $id, 2007); //Closing database connection $db->close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title><?php echo _("OSSIM Framework"); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="Pragma" content="no-cache"/> <script type="text/javascript" src="../js/jquery.min.js"></script>