2011-12-21 14:09:26 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
2012-10-04 Ramon Novoa <rnovoa@artica.es>
* include/functions_html.php,
include/functions_netflow.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
operation/netflow/nf_live_view.php,
operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
godmode/netflow/nf_report_form.php,
godmode/netflow/nf_edit.php: Added metaconsole integration to netflow
reports.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7043 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-04 12:49:11 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_ui.php");
|
|
|
|
include_once($config['homedir'] . "/include/functions_db.php");
|
|
|
|
include_once($config['homedir'] . "/include/functions_netflow.php");
|
2011-12-21 14:09:26 +01:00
|
|
|
|
|
|
|
check_login ();
|
|
|
|
|
2015-03-06 12:28:05 +01:00
|
|
|
enterprise_hook('open_meta_frame');
|
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
if (! check_acl ($config["id_user"], 0, "AW")) {
|
|
|
|
db_pandora_audit("ACL Violation",
|
|
|
|
"Trying to access event viewer");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
return;
|
|
|
|
}
|
2012-11-29 11:30:46 +01:00
|
|
|
|
|
|
|
$pure = get_parameter('pure', 0);
|
2013-02-04 13:19:17 +01:00
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
//Header
|
2012-10-04 Ramon Novoa <rnovoa@artica.es>
* include/functions_html.php,
include/functions_netflow.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
operation/netflow/nf_live_view.php,
operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
godmode/netflow/nf_report_form.php,
godmode/netflow/nf_edit.php: Added metaconsole integration to netflow
reports.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7043 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-04 12:49:11 +02:00
|
|
|
if (! defined ('METACONSOLE')) {
|
2013-04-10 09:57:54 +02:00
|
|
|
ui_print_page_header (__('Manage Netflow Filter'), "images/gm_netflow.png", false, "", true);
|
2014-06-26 13:32:14 +02:00
|
|
|
|
|
|
|
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
|
|
|
if ($is_windows) {
|
|
|
|
ui_print_error_message(__('Not supported in Windows systems'));
|
|
|
|
}
|
2013-02-04 13:19:17 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-10-04 Ramon Novoa <rnovoa@artica.es>
* include/functions_html.php,
include/functions_netflow.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
operation/netflow/nf_live_view.php,
operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
godmode/netflow/nf_report_form.php,
godmode/netflow/nf_edit.php: Added metaconsole integration to netflow
reports.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7043 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-04 12:49:11 +02:00
|
|
|
$nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')),
|
2013-02-04 13:19:17 +01:00
|
|
|
array('link' => 'index.php?sec=netf&sec2=godmode/netflow/nf_edit', 'text' => __('Netflow filters')));
|
|
|
|
|
2012-10-04 Ramon Novoa <rnovoa@artica.es>
* include/functions_html.php,
include/functions_netflow.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
operation/netflow/nf_live_view.php,
operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
godmode/netflow/nf_report_form.php,
godmode/netflow/nf_edit.php: Added metaconsole integration to netflow
reports.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7043 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-04 12:49:11 +02:00
|
|
|
ui_meta_print_page_header($nav_bar);
|
2012-11-28 16:04:27 +01:00
|
|
|
|
|
|
|
ui_meta_print_header(__("Netflow filters"));
|
2012-10-04 Ramon Novoa <rnovoa@artica.es>
* include/functions_html.php,
include/functions_netflow.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
operation/netflow/nf_live_view.php,
operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
godmode/netflow/nf_report_form.php,
godmode/netflow/nf_edit.php: Added metaconsole integration to netflow
reports.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7043 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-04 12:49:11 +02:00
|
|
|
}
|
2011-12-21 14:09:26 +01:00
|
|
|
|
|
|
|
$delete = (bool) get_parameter ('delete');
|
|
|
|
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
|
|
|
$id = (int) get_parameter ('id');
|
|
|
|
$name = (string) get_parameter ('name');
|
|
|
|
|
|
|
|
if ($delete) {
|
2011-12-30 11:06:56 +01:00
|
|
|
$id_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id);
|
2011-12-21 14:09:26 +01:00
|
|
|
$result = db_process_sql_delete ('tnetflow_filter',
|
|
|
|
array ('id_sg' => $id));
|
2013-02-04 13:19:17 +01:00
|
|
|
|
2011-12-30 11:06:56 +01:00
|
|
|
$result2 = db_process_sql_delete ('tnetflow_report_content',
|
|
|
|
array ('id_filter' => $id_filter));
|
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/file_manager.php, godmode/setup/news.php,
godmode/users/configure_user.php, godmode/users/user_list.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_alerts.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_nc_groups.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/netflow/nf_edit.php, godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php, godmode/netflow/nf.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/agentes/estado_agente.php, operation/agentes/sla_view.php,
operation/agentes/tactical.php,
operation/agentes/estado_generalagente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/integria_incidents/incident_detail.php,
operation/gis_maps/index.php, operation/events/events_list.php,
operation/events/events.php, operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/graph_viewer.php, operation/search_reports.php,
operation/netflow/nf_view.php: cleaned source code.
* godmode/massive/massive_operations.php,
godmode/massive/massive_edit_modules.php: fixed the massive edition
of "any" module in agents.
Fixes: #3543484
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6806 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-24 18:38:48 +02:00
|
|
|
|
2011-12-30 11:06:56 +01:00
|
|
|
if ($result !== false) {
|
|
|
|
$result = true;
|
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/file_manager.php, godmode/setup/news.php,
godmode/users/configure_user.php, godmode/users/user_list.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_alerts.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_nc_groups.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/netflow/nf_edit.php, godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php, godmode/netflow/nf.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/agentes/estado_agente.php, operation/agentes/sla_view.php,
operation/agentes/tactical.php,
operation/agentes/estado_generalagente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/integria_incidents/incident_detail.php,
operation/gis_maps/index.php, operation/events/events_list.php,
operation/events/events.php, operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/graph_viewer.php, operation/search_reports.php,
operation/netflow/nf_view.php: cleaned source code.
* godmode/massive/massive_operations.php,
godmode/massive/massive_edit_modules.php: fixed the massive edition
of "any" module in agents.
Fixes: #3543484
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6806 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-24 18:38:48 +02:00
|
|
|
}
|
|
|
|
else {
|
2011-12-30 11:06:56 +01:00
|
|
|
$result = false;
|
|
|
|
}
|
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/file_manager.php, godmode/setup/news.php,
godmode/users/configure_user.php, godmode/users/user_list.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_alerts.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_nc_groups.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/netflow/nf_edit.php, godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php, godmode/netflow/nf.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/agentes/estado_agente.php, operation/agentes/sla_view.php,
operation/agentes/tactical.php,
operation/agentes/estado_generalagente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/integria_incidents/incident_detail.php,
operation/gis_maps/index.php, operation/events/events_list.php,
operation/events/events.php, operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/graph_viewer.php, operation/search_reports.php,
operation/netflow/nf_view.php: cleaned source code.
* godmode/massive/massive_operations.php,
godmode/massive/massive_edit_modules.php: fixed the massive edition
of "any" module in agents.
Fixes: #3543484
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6806 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-24 18:38:48 +02:00
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
ui_print_result_message ($result,
|
|
|
|
__('Successfully deleted'),
|
|
|
|
__('Not deleted. Error deleting data'));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($multiple_delete) {
|
|
|
|
$ids = (array)get_parameter('delete_multiple', array());
|
|
|
|
|
|
|
|
foreach ($ids as $id) {
|
2011-12-30 11:06:56 +01:00
|
|
|
$id_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id);
|
2011-12-21 14:09:26 +01:00
|
|
|
$result = db_process_sql_delete ('tnetflow_filter',
|
|
|
|
array ('id_sg' => $id));
|
2011-12-30 11:06:56 +01:00
|
|
|
|
|
|
|
$result2 = db_process_sql_delete ('tnetflow_report_content',
|
|
|
|
array ('id_filter' => $id_filter));
|
2013-02-04 13:19:17 +01:00
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
if ($result === false) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($result !== false) $result = true;
|
|
|
|
else $result = false;
|
2013-02-04 13:19:17 +01:00
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
ui_print_result_message ($result,
|
|
|
|
__('Successfully deleted'),
|
|
|
|
__('Not deleted. Error deleting data'));
|
|
|
|
}
|
|
|
|
|
2012-01-12 11:52:15 +01:00
|
|
|
$own_info = get_user_info ($config['id_user']);
|
2012-01-11 16:02:27 +01:00
|
|
|
// Get group list that user has access
|
2012-01-12 11:52:15 +01:00
|
|
|
$groups_user = users_get_groups ($config['id_user'], "AW", $own_info['is_admin'], true);
|
2013-02-27 17:53:14 +01:00
|
|
|
$sql = "SELECT *
|
|
|
|
FROM tnetflow_filter
|
|
|
|
WHERE id_group IN (0, ".implode(',', array_keys ($groups_user)).")";
|
2012-01-11 16:02:27 +01:00
|
|
|
$filters = db_get_all_rows_sql($sql);
|
2011-12-21 14:09:26 +01:00
|
|
|
if ($filters === false)
|
2011-12-23 09:37:36 +01:00
|
|
|
$filters = array ();
|
2011-12-21 14:09:26 +01:00
|
|
|
|
2012-01-12 16:05:25 +01:00
|
|
|
$table->width = '90%';
|
2015-03-06 15:16:56 +01:00
|
|
|
if (defined('METACONSOLE')){
|
2015-03-06 12:28:05 +01:00
|
|
|
$table->width = '100%';
|
|
|
|
}
|
2011-12-21 14:09:26 +01:00
|
|
|
$table->head = array ();
|
|
|
|
$table->head[0] = __('Name');
|
2012-01-12 16:05:25 +01:00
|
|
|
$table->head[1] = __('Group');
|
|
|
|
$table->head[2] = __('Action') .
|
2013-02-04 13:19:17 +01:00
|
|
|
html_print_checkbox('all_delete', 0, false, true, false,
|
|
|
|
'check_all_checkboxes();');
|
2011-12-21 14:09:26 +01:00
|
|
|
$table->style = array ();
|
|
|
|
$table->style[0] = 'font-weight: bold';
|
|
|
|
$table->align = array ();
|
2012-01-12 16:05:25 +01:00
|
|
|
$table->align[1] = 'center';
|
2011-12-21 14:09:26 +01:00
|
|
|
$table->align[2] = 'center';
|
|
|
|
$table->size = array ();
|
2012-01-12 16:05:25 +01:00
|
|
|
$table->size[0] = '60%';
|
|
|
|
$table->size[1] = '30%';
|
|
|
|
$table->size[2] = '80px';
|
2011-12-21 14:09:26 +01:00
|
|
|
$table->data = array ();
|
|
|
|
|
|
|
|
$total_filters = db_get_all_rows_filter ('tnetflow_filter', false, 'COUNT(*) AS total');
|
|
|
|
$total_filters = $total_filters[0]['total'];
|
|
|
|
|
2011-12-21 17:07:15 +01:00
|
|
|
//ui_pagination ($total_filters, $url);
|
2011-12-21 14:09:26 +01:00
|
|
|
|
|
|
|
foreach ($filters as $filter) {
|
|
|
|
$data = array ();
|
|
|
|
|
2012-11-29 11:30:46 +01:00
|
|
|
$data[0] = '<a href="' . $config['homeurl'] . 'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&id='.$filter['id_sg'].'&pure='.$pure.'">'.$filter['id_name'].'</a>';
|
|
|
|
$data[1] = ui_print_group_icon($filter['id_group'], true, "groups_small", '', !defined('METACONSOLE'));
|
2012-01-12 16:05:25 +01:00
|
|
|
$data[2] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
|
2012-11-29 11:30:46 +01:00
|
|
|
href='" . $config['homeurl'] . "index.php?sec=netf&sec2=godmode/netflow/nf_edit&delete=1&id=".$filter['id_sg']."&offset=0&pure=$pure'>" .
|
2011-12-21 14:09:26 +01:00
|
|
|
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
|
|
|
|
html_print_checkbox_extended ('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true);
|
|
|
|
|
|
|
|
array_push ($table->data, $data);
|
|
|
|
}
|
|
|
|
|
2013-08-05 16:23:27 +02:00
|
|
|
if (isset($data)) {
|
2012-11-29 11:30:46 +01:00
|
|
|
echo "<form method='post' action='" . $config['homeurl'] . "index.php?sec=netf&sec2=godmode/netflow/nf_edit&pure=$pure'>";
|
2011-12-21 14:09:26 +01:00
|
|
|
html_print_input_hidden('multiple_delete', 1);
|
|
|
|
html_print_table ($table);
|
2015-03-06 12:28:05 +01:00
|
|
|
if (defined('METACONSOLE'))
|
|
|
|
echo "<div style='padding-bottom: 20px; text-align: right; width:100%'>";
|
|
|
|
else
|
|
|
|
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
|
|
|
echo "</div>";
|
|
|
|
echo "</form>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo "<div class='nf'>".__('There are no defined filters')."</div>";
|
|
|
|
}
|
2012-01-16 12:08:28 +01:00
|
|
|
|
2015-03-06 12:28:05 +01:00
|
|
|
echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&pure='.$pure.'">';
|
|
|
|
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
|
|
|
html_print_submit_button (__('Create filter'), 'crt', false, 'class="sub wand"');
|
|
|
|
echo "</div>";
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
enterprise_hook('close_meta_frame');
|
2012-01-16 12:08:28 +01:00
|
|
|
|
2011-12-21 14:09:26 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function check_all_checkboxes() {
|
|
|
|
if ($("input[name=all_delete]").attr('checked')) {
|
|
|
|
$(".check_delete").attr('checked', true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$(".check_delete").attr('checked', false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|