2006-07-20 00:01:47 +02:00
< ? php
2009-06-08 20:18:20 +02:00
// Pandora FMS - http://pandorafms.com
// ==================================================
2010-05-25 23:29:14 +02:00
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
2009-06-08 20:18:20 +02:00
// Please see http://pandorafms.org for full contribution list
2006-07-20 00:01:47 +02:00
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
2008-08-22 20:07:32 +02:00
// as published by the Free Software Foundation for version 2.
2006-07-20 00:01:47 +02:00
// 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.
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
// Load global vars
2010-03-02 20:25:51 +01:00
global $config ;
2019-01-30 16:18:44 +01:00
enterprise_include ( 'operation/snmpconsole/snmp_view.php' );
enterprise_include ( 'include/functions_snmp.php' );
require_once 'include/functions_agents.php' ;
require_once 'include/functions_snmp.php' ;
check_login ();
$agent_a = check_acl ( $config [ 'id_user' ], 0 , 'AR' );
$agent_w = check_acl ( $config [ 'id_user' ], 0 , 'AW' );
2016-09-08 16:06:12 +02:00
$access = ( $agent_a == true ) ? 'AR' : (( $agent_w == true ) ? 'AW' : 'AR' );
if ( ! $agent_a && ! $agent_w ) {
2019-01-30 16:18:44 +01:00
db_pandora_audit (
'ACL Violation' ,
'Trying to access SNMP Console'
);
include 'general/noaccess.php' ;
exit ;
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2006-07-11 10:49:21 +02:00
2008-10-31 18:08:52 +01:00
// Read parameters
2019-01-30 16:18:44 +01:00
$filter_severity = ( int ) get_parameter ( 'filter_severity' , - 1 );
$filter_fired = ( int ) get_parameter ( 'filter_fired' , - 1 );
$filter_status = ( int ) get_parameter ( 'filter_status' , 0 );
$free_search_string = ( string ) get_parameter ( 'free_search_string' , '' );
$pagination = ( int ) get_parameter ( 'pagination' , $config [ 'block_size' ]);
$offset = ( int ) get_parameter ( 'offset' , 0 );
$trap_type = ( int ) get_parameter ( 'trap_type' , - 1 );
$group_by = ( int ) get_parameter ( 'group_by' , 0 );
$refr = ( int ) get_parameter ( 'refresh' );
2017-04-07 12:08:42 +02:00
$default_refr = ! empty ( $refr ) ? $refr : $config [ 'vc_refr' ];
2019-01-30 16:18:44 +01:00
$date_from_trap = get_parameter ( 'date_from_trap' , '' );
$date_to_trap = get_parameter ( 'date_to_trap' , '' );
$time_from_trap = get_parameter ( 'time_from_trap' , '' );
$time_to_trap = get_parameter ( 'time_to_trap' , '' );
2011-06-29 12:38:07 +02:00
2019-01-30 16:18:44 +01:00
$user_groups = users_get_groups ( $config [ 'id_user' ], $access , false );
2015-07-14 12:50:05 +02:00
2014-03-18 17:08:20 +01:00
$str_user_groups = '' ;
$i = 0 ;
2019-01-30 16:18:44 +01:00
foreach ( $user_groups as $id => $name ) {
if ( $i == 0 ) {
$str_user_groups .= $id ;
} else {
$str_user_groups .= ',' . $id ;
}
$i ++ ;
2014-03-18 17:08:20 +01:00
}
2019-01-30 16:18:44 +01:00
$url = 'index.php?sec=estado&' . 'sec2=operation/snmpconsole/snmp_view&' . 'filter_severity=' . $filter_severity . '&' . 'filter_fired=' . $filter_fired . '&' . 'free_search_string=' . $free_search_string . '&' . 'pagination=' . $pagination . '&' . 'offset=' . $offset . '&' . 'trap_type=' . $trap_type . '&' . 'group_by=' . $group_by . '&' . 'date_from_trap=' . $date_from_trap . '&' . 'date_to_trap=' . $date_to_trap . '&' . 'time_from_trap=' . $time_from_trap . '&' . 'time_to_trap=' . $time_to_trap ;
$statistics [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/snmpconsole/snmp_statistics&pure=' . $config [ 'pure' ] . '&refr=' . $refr . '">' . html_print_image ( 'images/op_reporting.png' , true , [ 'title' => __ ( 'Statistics' )]) . '</a>' ;
$list [ 'text' ] = '<a href="' . $url . '&pure=' . $config [ 'pure' ] . '&refresh=' . $refr . '">' . html_print_image ( 'images/op_snmp.png' , true , [ 'title' => __ ( 'List' )]) . '</a>' ;
2014-09-23 18:05:44 +02:00
$list [ 'active' ] = true ;
2011-06-29 12:38:07 +02:00
2019-01-30 16:18:44 +01:00
if ( $config [ 'pure' ]) {
$fullscreen [ 'text' ] = '<a target="_top" href="' . $url . '&pure=0&refresh=' . $refr . '">' . html_print_image ( 'images/normal_screen.png' , true , [ 'title' => __ ( 'Normal screen' )]) . '</a>' ;
} else {
// Fullscreen
$fullscreen [ 'text' ] = '<a target="_top" href="' . $url . '&pure=1&refresh=' . $refr . '">' . html_print_image ( 'images/full_screen.png' , true , [ 'title' => __ ( 'Full screen' )]) . '</a>' ;
2010-08-12 14:23:25 +02:00
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
// OPERATIONS
2008-10-22 15:20:06 +02:00
// Delete SNMP Trap entry Event (only incident management access).
2019-01-30 16:18:44 +01:00
if ( isset ( $_GET [ 'delete' ])) {
$id_trap = ( int ) get_parameter_get ( 'delete' , 0 );
if ( $id_trap > 0 && check_acl ( $config [ 'id_user' ], 0 , 'IM' )) {
if ( $group_by ) {
$sql_ids_traps = 'SELECT id_trap, source FROM ttrap WHERE oid IN (SELECT oid FROM ttrap WHERE id_trap = ' . $id_trap . ' )
AND source IN ( SELECT source FROM ttrap WHERE id_trap = '.$id_trap.' ) ' ;
$ids_traps = db_get_all_rows_sql ( $sql_ids_traps );
foreach ( $ids_traps as $key => $value ) {
$result = db_process_sql_delete ( 'ttrap' , [ 'id_trap' => $value [ 'id_trap' ]]);
enterprise_hook ( 'snmp_update_forwarded_modules' , [ $value ]);
}
} else {
$forward_info = db_get_row ( 'ttrap' , 'id_trap' , $id_trap );
$result = db_process_sql_delete ( 'ttrap' , [ 'id_trap' => $id_trap ]);
enterprise_hook ( 'snmp_update_forwarded_modules' , [ $forward_info ]);
ui_print_result_message (
$result ,
__ ( 'Successfully deleted' ),
__ ( 'Could not be deleted' )
);
}
} else {
db_pandora_audit (
'ACL Violation' ,
'Trying to delete SNMP event ID #' . $id_trap
);
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2006-03-27 05:37:27 +02:00
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
// Check Event (only incident write access).
2019-01-30 16:18:44 +01:00
if ( isset ( $_GET [ 'check' ])) {
$id_trap = ( int ) get_parameter_get ( 'check' , 0 );
if ( check_acl ( $config [ 'id_user' ], 0 , 'IW' )) {
$values = [
'status' => 1 ,
'id_usuario' => $config [ 'id_user' ],
];
$result = db_process_sql_update ( 'ttrap' , $values , [ 'id_trap' => $id_trap ]);
enterprise_hook ( 'snmp_update_forwarded_modules' , [ $id_trap ]);
ui_print_result_message (
$result ,
__ ( 'Successfully updated' ),
__ ( 'Could not be updated' )
);
} else {
db_pandora_audit (
'ACL Violation' ,
'Trying to checkout SNMP Trap ID' . $id_trap
);
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2006-03-27 05:37:27 +02:00
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
// Mass-process DELETE
2019-01-30 16:18:44 +01:00
if ( isset ( $_POST [ 'deletebt' ])) {
$trap_ids = get_parameter_post ( 'snmptrapid' , []);
if ( is_array ( $trap_ids ) && check_acl ( $config [ 'id_user' ], 0 , 'IW' )) {
if ( $group_by ) {
foreach ( $trap_ids as $key => $value ) {
$sql_ids_traps = 'SELECT id_trap, source FROM ttrap WHERE oid IN (SELECT oid FROM ttrap WHERE id_trap = ' . $value . ' )
AND source IN ( SELECT source FROM ttrap WHERE id_trap = '.$value.' ) ' ;
$ids_traps = db_get_all_rows_sql ( $sql_ids_traps );
foreach ( $ids_traps as $key2 => $value2 ) {
$result = db_process_sql_delete ( 'ttrap' , [ 'id_trap' => $value2 [ 'id_trap' ]]);
enterprise_hook ( 'snmp_update_forwarded_modules' , [ $value2 ]);
}
}
} else {
foreach ( $trap_ids as $id_trap ) {
$forward_info = db_get_row ( 'ttrap' , 'id_trap' , $id_trap );
db_process_sql_delete ( 'ttrap' , [ 'id_trap' => $id_trap ]);
enterprise_hook ( 'snmp_update_forwarded_modules' , [ $forward_info ]);
}
}
} else {
db_pandora_audit (
'ACL Violation' ,
'Trying to mass-delete SNMP Trap ID'
);
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
// Mass-process UPDATE
2019-01-30 16:18:44 +01:00
if ( isset ( $_POST [ 'updatebt' ])) {
$trap_ids = get_parameter_post ( 'snmptrapid' , []);
if ( is_array ( $trap_ids ) && check_acl ( $config [ 'id_user' ], 0 , 'IW' )) {
foreach ( $trap_ids as $id_trap ) {
$sql = sprintf ( " UPDATE ttrap SET status = 1, id_usuario = '%s' WHERE id_trap = %d " , $config [ 'id_user' ], $id_trap );
db_process_sql ( $sql );
enterprise_hook ( 'snmp_update_forwarded_modules' , [ $id_trap ]);
}
} else {
db_pandora_audit (
'ACL Violation' ,
'Trying to mass-delete SNMP Trap ID'
);
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2006-03-27 05:37:27 +02:00
2019-01-30 16:18:44 +01:00
// All traps
$all_traps = db_get_all_rows_sql ( 'SELECT DISTINCT source FROM ttrap' );
2015-07-14 12:50:05 +02:00
2019-01-30 16:18:44 +01:00
if ( empty ( $all_traps )) {
$all_traps = [];
}
2014-06-02 13:02:18 +02:00
2008-10-31 18:08:52 +01:00
// Set filters
2019-01-30 16:18:44 +01:00
$agents = [];
$oids = [];
$severities = get_priorities ();
$alerted = [
__ ( 'Not fired' ),
__ ( 'Fired' ),
];
2011-11-17 17:57:54 +01:00
foreach ( $all_traps as $trap ) {
2019-01-30 16:18:44 +01:00
$agent = agents_get_agent_with_ip ( $trap [ 'source' ]);
$agents [ $trap [ 'source' ]] = $agent !== false ? ( $agent [ 'alias' ] ? $agent [ 'alias' ] : $agent [ 'nombre' ]) : $trap [ 'source' ];
$oid = enterprise_hook ( 'get_oid' , [ $trap ]);
if ( $oid === ENTERPRISE_NOT_HOOK ) {
$oid = $trap [ 'oid' ];
}
$oids [ $oid ] = $oid ;
2008-10-31 18:08:52 +01:00
}
2017-03-15 11:37:47 +01:00
$prea = array_keys ( $user_groups );
2019-01-30 16:18:44 +01:00
$ids = join ( ',' , $prea );
// Cuantos usuarios hay operadores con un grupo que exista y no lo tenga ningun usuario
2017-03-15 11:37:47 +01:00
$user_in_group_wo_agents = db_get_value_sql ( 'select count(DISTINCT(id_usuario)) from tusuario_perfil where id_usuario ="' . $config [ 'id_user' ] . '" and id_perfil = 1 and id_grupo in (select id_grupo from tgrupo where id_grupo in (' . $ids . ') and id_grupo not in (select id_grupo from tagente))' );
2015-07-14 12:50:05 +02:00
2019-01-30 16:18:44 +01:00
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
case 'postgresql' :
if ( $user_in_group_wo_agents == 0 ) {
$rows = db_get_all_rows_filter (
'tagente' ,
[ 'id_grupo' => array_keys ( $user_groups )],
[ 'id_agente' ]
);
$id_agents = [];
foreach ( $rows as $row ) {
$id_agents [] = $row [ 'id_agente' ];
}
$address_by_user_groups = agents_get_addresses ( $id_agents );
foreach ( $address_by_user_groups as $i => $a ) {
$address_by_user_groups [ $i ] = '"' . $a . '"' ;
}
} else {
$rows = db_get_all_rows_filter (
'tagente' ,
[],
[ 'id_agente' ]
);
$id_agents = [];
foreach ( $rows as $row ) {
$id_agents [] = $row [ 'id_agente' ];
}
$all_address_agents = agents_get_addresses ( $id_agents );
foreach ( $all_address_agents as $i => $a ) {
$all_address_agents [ $i ] = '"' . $a . '"' ;
}
}
break ;
2015-11-19 13:02:03 +01:00
}
2015-07-14 12:50:05 +02:00
2019-01-30 16:18:44 +01:00
if ( empty ( $address_by_user_groups )) {
$address_by_user_groups = [];
array_unshift ( $address_by_user_groups , '""' );
2016-04-04 12:14:57 +02:00
}
2019-01-30 16:18:44 +01:00
if ( empty ( $all_address_agents )) {
$all_address_agents = [];
array_unshift ( $all_address_agents , '""' );
2016-04-04 12:14:57 +02:00
}
2015-07-14 12:50:05 +02:00
2019-01-30 16:18:44 +01:00
// Make query to extract traps of DB.
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
$sql = ' SELECT *
2014-03-18 17:08:20 +01:00
FROM ttrap
2015-07-14 12:50:05 +02:00
WHERE (
2019-01-30 16:18:44 +01:00
`source` IN ( '.implode(' , ' , $address_by_user_groups ) . " ) OR
2015-07-14 12:50:05 +02:00
`source` = '' OR
2019-01-30 16:18:44 +01:00
`source` NOT IN ( " .implode(',', $all_address_agents ).')
2015-07-14 12:50:05 +02:00
)
% s
2013-06-05 14:13:29 +02:00
ORDER BY timestamp DESC
2019-01-30 16:18:44 +01:00
LIMIT % d , % d ' ;
break ;
case 'postgresql' :
$sql = ' SELECT *
2014-03-18 17:08:20 +01:00
FROM ttrap
2015-07-14 12:50:05 +02:00
WHERE (
2019-01-30 16:18:44 +01:00
source IN ( '.implode(' , ' , $address_by_user_groups ) . " ) OR
2015-07-14 12:50:05 +02:00
source = '' OR
2019-01-30 16:18:44 +01:00
source NOT IN ( " .implode(',', $all_address_agents ).')
2015-07-14 12:50:05 +02:00
)
% s
2014-03-18 17:08:20 +01:00
ORDER BY timestamp DESC
2019-01-30 16:18:44 +01:00
LIMIT % d OFFSET % d ' ;
break ;
case 'oracle' :
$sql = " SELECT *
2015-04-30 20:11:07 +02:00
FROM ttrap
WHERE ( source IN (
SELECT direccion FROM tagente
WHERE id_grupo IN ( $str_user_groups )
2016-01-08 09:33:34 +01:00
) OR source = '' OR source NOT IN ( SELECT direccion FROM tagente WHERE direccion IS NOT NULL )) % s
2015-04-30 20:11:07 +02:00
ORDER BY timestamp DESC " ;
2019-01-30 16:18:44 +01:00
break ;
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/incidents/incident.php,
operation/agentes/status_monitor.php, operation/agentes/datos_agente.php,
operation/servers/view_server.php, operation/snmpconsole/snmp_view.php,
operation/events/events_rss.php, operation/events/events_list.php,
operation/events/events_marquee.php, operation/search_users.php,
mobile/operation/agents/monitor_status.php,
mobile/operation/agents/view_agents.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/include/functions_web.php, godmode/admin_access_logs.php,
godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php,
godmode/reporting/reporting_builder.list_items.php: changed and addded in
the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that
it is standard for PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 18:55:37 +01:00
}
2015-11-19 13:02:03 +01:00
2019-01-30 16:18:44 +01:00
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
case 'postgresql' :
$sql_all = ' SELECT *
2015-11-19 13:02:03 +01:00
FROM ttrap
WHERE (
2019-01-30 16:18:44 +01:00
source IN ( '.implode(' , ' , $address_by_user_groups ) . " ) OR
2015-11-19 13:02:03 +01:00
source = '' OR
2019-01-30 16:18:44 +01:00
source NOT IN ( " .implode(',', $all_address_agents ).')
2015-11-19 13:02:03 +01:00
)
% s
2019-01-30 16:18:44 +01:00
ORDER BY timestamp DESC ' ;
$sql_count = ' SELECT COUNT ( id_trap )
2015-11-19 13:02:03 +01:00
FROM ttrap
WHERE (
2019-01-30 16:18:44 +01:00
source IN ( '.implode(' , ' , $address_by_user_groups ) . " ) OR
2015-11-19 13:02:03 +01:00
source = '' OR
2019-01-30 16:18:44 +01:00
source NOT IN ( " .implode(',', $all_address_agents ).')
2015-11-19 13:02:03 +01:00
)
2019-01-30 16:18:44 +01:00
% s ' ;
break ;
case 'oracle' :
$sql_all = " SELECT *
2015-11-19 13:02:03 +01:00
FROM ttrap
WHERE ( source IN (
SELECT direccion FROM tagente
WHERE id_grupo IN ( $str_user_groups )
2016-01-08 09:33:34 +01:00
) OR source = '' OR source NOT IN ( SELECT direccion FROM tagente WHERE direccion IS NOT NULL ))
2015-11-19 13:02:03 +01:00
% s
ORDER BY timestamp DESC " ;
2019-01-30 16:18:44 +01:00
$sql_count = " SELECT COUNT(id_trap)
2015-11-19 13:02:03 +01:00
FROM ttrap
WHERE (
source IN (
SELECT direccion FROM tagente
WHERE id_grupo IN ( $str_user_groups )
2016-01-08 09:33:34 +01:00
) OR source = '' OR source NOT IN ( SELECT direccion FROM tagente WHERE direccion IS NOT NULL ))
2015-11-19 13:02:03 +01:00
% s " ;
2019-01-30 16:18:44 +01:00
break ;
2015-11-19 13:02:03 +01:00
}
2019-01-30 16:18:44 +01:00
// $whereSubquery = 'WHERE 1=1';
2014-03-18 17:08:20 +01:00
$whereSubquery = '' ;
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
2019-01-30 16:18:44 +01:00
if ( $filter_fired != - 1 ) {
$whereSubquery .= ' AND alerted = ' . $filter_fired ;
}
2014-03-27 11:48:19 +01:00
2011-11-17 17:57:54 +01:00
if ( $free_search_string != '' ) {
2019-01-30 16:18:44 +01:00
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
$whereSubquery .= '
AND ( source LIKE " %'. $free_search_string .'% " OR
oid LIKE " %'. $free_search_string .'% " OR
oid_custom LIKE " %'. $free_search_string .'% " OR
type_custom LIKE " %'. $free_search_string .'% " OR
value LIKE " %'. $free_search_string .'% " OR
value_custom LIKE " %'. $free_search_string .'% " OR
id_usuario LIKE " %'. $free_search_string .'% " OR
text LIKE " %'. $free_search_string .'% " OR
description LIKE " %'. $free_search_string .'% " ) ' ;
break ;
case 'postgresql' :
case 'oracle' :
$whereSubquery .= '
AND ( source LIKE \ '%' . $free_search_string . ' % \ ' OR
oid LIKE \ '%' . $free_search_string . ' % \ ' OR
oid_custom LIKE \ '%' . $free_search_string . ' % \ ' OR
type_custom LIKE \ '%' . $free_search_string . ' % \ ' OR
value LIKE \ '%' . $free_search_string . ' % \ ' OR
value_custom LIKE \ '%' . $free_search_string . ' % \ ' OR
id_usuario LIKE \ '%' . $free_search_string . ' % \ ' OR
text LIKE \ '%' . $free_search_string . ' % \ ' OR
description LIKE \ '%' . $free_search_string . '%\')' ;
break ;
}
2011-11-17 17:57:54 +01:00
}
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
2019-01-30 16:18:44 +01:00
if ( $date_from_trap != '' ) {
if ( $time_from_trap != '' ) {
$whereSubquery .= '
AND ( UNIX_TIMESTAMP ( timestamp ) > UNIX_TIMESTAMP ( " '. $date_from_trap .' '. $time_from_trap .' " ))
2017-05-16 14:40:30 +02:00
' ;
2019-01-30 16:18:44 +01:00
} else {
$whereSubquery .= '
AND ( UNIX_TIMESTAMP ( timestamp ) > UNIX_TIMESTAMP ( " '. $date_from_trap .' 23:59:59 " ))
2017-05-16 14:40:30 +02:00
' ;
2019-01-30 16:18:44 +01:00
}
2017-05-16 14:40:30 +02:00
}
2019-01-30 16:18:44 +01:00
if ( $date_to_trap != '' ) {
if ( $time_to_trap ) {
$whereSubquery .= '
AND ( UNIX_TIMESTAMP ( timestamp ) < UNIX_TIMESTAMP ( " '. $date_to_trap .' '. $time_to_trap .' " ))
2017-05-16 14:40:30 +02:00
' ;
2019-01-30 16:18:44 +01:00
} else {
$whereSubquery .= '
AND ( UNIX_TIMESTAMP ( timestamp ) < UNIX_TIMESTAMP ( " '. $date_to_trap .' 23:59:59 " ))
2017-05-16 14:40:30 +02:00
' ;
2019-01-30 16:18:44 +01:00
}
2017-05-16 14:40:30 +02:00
}
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
if ( $filter_severity != - 1 ) {
2019-01-30 16:18:44 +01:00
// Test if install the enterprise to search oid in text or oid field in ttrap.
if ( $config [ 'enterprise_installed' ]) {
$whereSubquery .= ' AND (
( alerted = 0 AND severity = '.$filter_severity.' ) OR
( alerted = 1 AND priority = '.$filter_severity.' )) ' ;
} else {
$whereSubquery .= ' AND (
( alerted = 0 AND 1 = '.$filter_severity.' ) OR
( alerted = 1 AND priority = '.$filter_severity.' )) ' ;
}
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
}
2019-01-30 16:18:44 +01:00
if ( $filter_status != - 1 ) {
$whereSubquery .= ' AND status = ' . $filter_status ;
2012-02-02 13:00:30 +01:00
}
2019-01-30 16:18:44 +01:00
if ( $trap_type == 5 ) {
$whereSubquery .= ' AND type NOT IN (0, 1, 2, 3, 4)' ;
} else if ( $trap_type != - 1 ) {
$whereSubquery .= ' AND type = ' . $trap_type ;
2012-02-02 13:00:30 +01:00
}
2012-02-10 11:36:11 +01:00
2015-05-04 14:51:06 +02:00
// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive
if ( $group_by && $config [ 'dbtype' ] != 'oracle' ) {
2019-01-30 16:18:44 +01:00
$where_without_group = $whereSubquery ;
$whereSubquery .= ' GROUP BY source,oid' ;
2014-03-17 12:31:48 +01:00
}
2019-01-30 16:18:44 +01:00
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
$sql = sprintf ( $sql , $whereSubquery , $offset , $pagination );
break ;
case 'postgresql' :
$sql = sprintf ( $sql , $whereSubquery , $pagination , $offset );
break ;
case 'oracle' :
$set = [];
$set [ 'limit' ] = $pagination ;
$set [ 'offset' ] = $offset ;
$sql = sprintf ( $sql , $whereSubquery );
$sql = oracle_recode_query ( $sql , $set );
break ;
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/incidents/incident.php,
operation/agentes/status_monitor.php, operation/agentes/datos_agente.php,
operation/servers/view_server.php, operation/snmpconsole/snmp_view.php,
operation/events/events_rss.php, operation/events/events_list.php,
operation/events/events_marquee.php, operation/search_users.php,
mobile/operation/agents/monitor_status.php,
mobile/operation/agents/view_agents.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/include/functions_web.php, godmode/admin_access_logs.php,
godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php,
godmode/reporting/reporting_builder.list_items.php: changed and addded in
the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that
it is standard for PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 18:55:37 +01:00
}
2019-01-30 16:18:44 +01:00
2014-06-10 17:21:58 +02:00
$sql_all = sprintf ( $sql_all , $whereSubquery );
$sql_count = sprintf ( $sql_count , $whereSubquery );
2009-11-06 16:44:02 +01:00
2015-11-27 09:51:26 +01:00
$table = new stdClass ();
2015-04-22 16:46:08 +02:00
$table -> width = '100%' ;
$table -> cellpadding = 0 ;
$table -> cellspacing = 0 ;
$table -> class = 'databox filters' ;
2019-01-30 16:18:44 +01:00
$table -> size = [];
2014-06-10 17:21:58 +02:00
$table -> size [ 0 ] = '120px' ;
2019-01-30 16:18:44 +01:00
$table -> data = [];
2008-10-31 18:08:52 +01:00
// Alert status select
2019-01-30 16:18:44 +01:00
$table -> data [ 1 ][ 0 ] = '<strong>' . __ ( 'Alert' ) . '</strong>' ;
$table -> data [ 1 ][ 1 ] = html_print_select (
$alerted ,
'filter_fired' ,
$filter_fired ,
'javascript:this.form.submit();' ,
__ ( 'All' ),
'-1' ,
true
);
2008-10-31 18:08:52 +01:00
// Block size for pagination select
2019-01-30 16:18:44 +01:00
$table -> data [ 2 ][ 0 ] = '<strong>' . __ ( 'Block size for pagination' ) . '</strong>' ;
2009-05-27 16:12:40 +02:00
$paginations [ 25 ] = 25 ;
$paginations [ 50 ] = 50 ;
$paginations [ 100 ] = 100 ;
$paginations [ 200 ] = 200 ;
$paginations [ 500 ] = 500 ;
2019-01-30 16:18:44 +01:00
$table -> data [ 2 ][ 1 ] = html_print_select (
$paginations ,
'pagination' ,
$pagination ,
'this.form.submit();' ,
__ ( 'Default' ),
$config [ 'block_size' ],
true
);
2008-10-31 18:08:52 +01:00
// Severity select
2019-01-30 16:18:44 +01:00
$table -> data [ 1 ][ 2 ] = '<strong>' . __ ( 'Severity' ) . '</strong>' ;
$table -> data [ 1 ][ 3 ] = html_print_select (
$severities ,
'filter_severity' ,
$filter_severity ,
'this.form.submit();' ,
__ ( 'All' ),
- 1 ,
true
);
2008-10-31 18:08:52 +01:00
2009-10-30 19:56:12 +01:00
// Status
2019-01-30 16:18:44 +01:00
$table -> data [ 3 ][ 0 ] = '<strong>' . __ ( 'Status' ) . '</strong>' ;
2013-07-10 18:49:05 +02:00
$status_array [ - 1 ] = __ ( 'All' );
$status_array [ 0 ] = __ ( 'Not validated' );
$status_array [ 1 ] = __ ( 'Validated' );
2019-01-30 16:18:44 +01:00
$table -> data [ 3 ][ 1 ] = html_print_select (
$status_array ,
'filter_status' ,
$filter_status ,
'this.form.submit();' ,
'' ,
'' ,
true
);
2009-10-30 19:56:12 +01:00
2011-11-17 17:57:54 +01:00
// Free search (search by all alphanumeric fields)
2019-01-30 16:18:44 +01:00
$table -> data [ 2 ][ 3 ] = '<strong>' . __ ( 'Free search' ) . '</strong>' . ui_print_help_tip (
__ (
' Search by any alphanumeric field in the trap .
REMEMBER trap sources need to be searched by IP Address '
),
true
);
$table -> data [ 2 ][ 4 ] = html_print_input_text (
'free_search_string' ,
$free_search_string ,
'' ,
40 ,
0 ,
true
);
$table -> data [ 4 ][ 0 ] = '<strong>' . __ ( 'From (Date)' ) . '</strong>' ;
$table -> data [ 4 ][ 1 ] = html_print_input_text ( 'date_from_trap' , $date_from_trap , '' , 15 , 10 , true );
$table -> data [ 4 ][ 2 ] = '<strong>' . __ ( 'To (Date)' ) . '</strong>' ;
$table -> data [ 4 ][ 3 ] = html_print_input_text ( 'date_to_trap' , $date_to_trap , '' , 15 , 10 , true );
$table -> data [ 5 ][ 0 ] = '<strong>' . __ ( 'From (Time)' ) . '</strong>' ;
$table -> data [ 5 ][ 1 ] = html_print_input_text ( 'time_from_trap' , $time_from_trap , false , 15 , 10 , true );
$table -> data [ 5 ][ 2 ] = '<strong>' . __ ( 'To (Time)' ) . '</strong>' ;
$table -> data [ 5 ][ 3 ] = html_print_input_text ( 'time_to_trap' , $time_to_trap , false , 15 , 10 , true );
2017-05-16 14:40:30 +02:00
2012-02-02 13:00:30 +01:00
// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other)
2019-01-30 16:18:44 +01:00
$table -> data [ 6 ][ 1 ] = '<strong>' . __ ( 'Trap type' ) . '</strong>' . ui_print_help_tip ( __ ( 'Search by trap type' ), true );
$trap_types = [
- 1 => __ ( 'None' ),
0 => __ ( 'Cold start (0)' ),
1 => __ ( 'Warm start (1)' ),
2 => __ ( 'Link down (2)' ),
3 => __ ( 'Link up (3)' ),
4 => __ ( 'Authentication failure (4)' ),
5 => __ ( 'Other' ),
];
$table -> data [ 6 ][ 2 ] = html_print_select (
$trap_types ,
'trap_type' ,
$trap_type ,
'this.form.submit();' ,
'' ,
'' ,
true ,
false ,
false
);
2012-02-02 13:00:30 +01:00
2015-05-04 14:51:06 +02:00
// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive
if ( $config [ 'dbtype' ] != 'oracle' ) {
2019-01-30 16:18:44 +01:00
$table -> data [ 3 ][ 3 ] = '<strong>' . __ ( 'Group by Enterprise String/IP' ) . '</strong>' ;
$table -> data [ 3 ][ 4 ] = __ ( 'Yes' ) . ' ' . html_print_radio_button ( 'group_by' , 1 , '' , $group_by , true ) . ' ' ;
$table -> data [ 3 ][ 4 ] .= __ ( 'No' ) . ' ' . html_print_radio_button ( 'group_by' , 0 , '' , $group_by , true );
2015-05-04 14:51:06 +02:00
}
2014-03-17 12:31:48 +01:00
2019-01-30 16:18:44 +01:00
$filter = '<form method="POST" action="index.php?' . 'sec=snmpconsole&' . 'sec2=operation/snmpconsole/snmp_view&' . 'refresh=' . (( int ) get_parameter ( 'refresh' , 0 )) . '&' . 'pure=' . $config [ 'pure' ] . '">' ;
2011-06-29 12:38:07 +02:00
$filter .= html_print_table ( $table , true );
2019-01-30 16:18:44 +01:00
$filter .= '<div style="width: ' . $table -> width . '; text-align: right;">' ;
2011-11-17 17:57:54 +01:00
$filter .= html_print_submit_button ( __ ( 'Update' ), 'search' , false , 'class="sub upd"' , true );
$filter .= '</div>' ;
2011-06-29 12:38:07 +02:00
$filter .= '</form>' ;
2008-10-31 18:08:52 +01:00
2019-01-30 16:18:44 +01:00
$filter_resume = [];
2017-06-22 09:28:07 +02:00
$filter_resume [ 'filter_fired' ] = $alerted [ $filter_fired ];
$filter_resume [ 'filter_severity' ] = $severities [ $filter_severity ];
$filter_resume [ 'pagination' ] = $paginations [ $pagination ];
$filter_resume [ 'free_search_string' ] = $free_search_string ;
$filter_resume [ 'filter_status' ] = $status_array [ $filter_status ];
$filter_resume [ 'group_by' ] = $group_by ;
$filter_resume [ 'date_from_trap' ] = $date_from_trap ;
$filter_resume [ 'time_from_trap' ] = $time_from_trap ;
$filter_resume [ 'date_to_trap' ] = $date_to_trap ;
$filter_resume [ 'time_to_trap' ] = $time_to_trap ;
$filter_resume [ 'trap_type' ] = $trap_types [ $trap_type ];
2015-07-14 12:50:05 +02:00
2014-09-23 18:05:44 +02:00
$traps = db_get_all_rows_sql ( $sql );
$trapcount = ( int ) db_get_value_sql ( $sql_count );
2008-10-22 15:20:06 +02:00
2019-01-30 16:18:44 +01:00
// No traps
if ( empty ( $traps )) {
// Header
ui_print_page_header (
__ ( 'SNMP Console' ),
'images/op_snmp.png' ,
false ,
'' ,
false ,
[
$list ,
$statistics ,
]
);
$sql2 = ' SELECT *
2017-06-12 12:05:23 +02:00
FROM ttrap
WHERE (
2019-01-30 16:18:44 +01:00
`source` IN ( '.implode(' , ' , $address_by_user_groups ) . " ) OR
2017-06-12 12:05:23 +02:00
`source` = '' OR
2019-01-30 16:18:44 +01:00
`source` NOT IN ( " .implode(',', $all_address_agents ).')
2017-06-12 12:05:23 +02:00
)
AND status = 0
2019-01-30 16:18:44 +01:00
ORDER BY timestamp DESC ' ;
$traps2 = db_get_all_rows_sql ( $sql2 );
if ( ! empty ( $traps2 )) {
ui_toggle ( $filter , __ ( 'Toggle filter(s)' ));
print_snmp_tags_active_filters ( $filter_resume );
ui_print_info_message ([ 'no_close' => true , 'message' => __ ( 'There are no SNMP traps in database that contains this filter' ) ]);
} else {
ui_print_info_message ([ 'no_close' => true , 'message' => __ ( 'There are no SNMP traps in database' ) ]);
}
return ;
} else {
if ( $config [ 'pure' ]) {
echo '<div id="dashboard-controls">' ;
echo '<div id="menu_tab">' ;
echo '<ul class="mn">' ;
// Normal view button
echo '<li class="nomn">' ;
$normal_url = 'index.php?' . 'sec=snmpconsole&' . 'sec2=operation/snmpconsole/snmp_view&' . 'filter_severity=' . $filter_severity . '&' . 'filter_fired=' . $filter_fired . '&' . 'filter_status=' . $filter_status . '&' . 'refresh=' . (( int ) get_parameter ( 'refresh' , 0 )) . '&' . 'pure=0&' . 'trap_type=' . $trap_type . '&' . 'group_by=' . $group_by . '&' . 'free_search_string=' . $free_search_string . '&' . 'date_from_trap=' . $date_from_trap . '&' . 'date_to_trap=' . $date_to_trap . '&' . 'time_from_trap=' . $time_from_trap . '&' . 'time_to_trap=' . $time_to_trap ;
$urlPagination = $normal_url . '&' . 'pagination=' . $pagination . '&' . 'offset=' . $offset ;
echo '<a href="' . $urlPagination . '">' ;
echo html_print_image ( 'images/normal_screen.png' , true , [ 'title' => __ ( 'Exit fullscreen' )]);
echo '</a>' ;
echo '</li>' ;
// Auto refresh control
echo '<li class="nomn">' ;
echo '<div class="dashboard-refr" style="margin-top: 6px;">' ;
echo '<div class="dashboard-countdown" style="display: inline;"></div>' ;
$normal_url = 'index.php?' . 'sec=snmpconsole&' . 'sec2=operation/snmpconsole/snmp_view&' . 'filter_severity=' . $filter_severity . '&' . 'filter_fired=' . $filter_fired . '&' . 'filter_status=' . $filter_status . '&' . 'refresh=' . (( int ) get_parameter ( 'refresh' , 0 )) . '&' . 'pure=1&' . 'trap_type=' . $trap_type . '&' . 'group_by=' . $group_by . '&' . 'free_search_string=' . $free_search_string . '&' . 'date_from_trap=' . $date_from_trap . '&' . 'date_to_trap=' . $date_to_trap . '&' . 'time_from_trap=' . $time_from_trap . '&' . 'time_to_trap=' . $time_to_trap ;
$urlPagination = $normal_url . '&' . 'pagination=' . $pagination . '&' . 'offset=' . $offset ;
echo '<form id="refr-form" method="get" action="' . $urlPagination . '" style="display: inline;">' ;
echo __ ( 'Refresh every' ) . ':' ;
echo html_print_select ( get_refresh_time_array (), 'refresh' , $refr , '' , '' , 0 , true , false , false );
echo '</form>' ;
echo '</li>' ;
html_print_input_hidden ( 'sec' , 'snmpconsole' );
html_print_input_hidden ( 'sec2' , 'operation/snmpconsole/snmp_view' );
html_print_input_hidden ( 'pure' , 1 );
html_print_input_hidden ( 'refresh' , ( $refr > 0 ? $refr : $default_refr ));
// Dashboard name
echo '<li class="nomn">' ;
echo '<div class="dashboard-title">' . __ ( 'SNMP Traps' ) . '</div>' ;
echo '</li>' ;
echo '</ul>' ;
echo '</div>' ;
echo '</div>' ;
ui_require_css_file ( 'pandora_enterprise' , ENTERPRISE_DIR . '/include/styles/' );
ui_require_css_file ( 'pandora_dashboard' , ENTERPRISE_DIR . '/include/styles/' );
ui_require_css_file ( 'cluetip' );
ui_require_jquery_file ( 'countdown' );
ui_require_javascript_file ( 'pandora_dashboard' , ENTERPRISE_DIR . '/include/javascript/' );
ui_require_javascript_file ( 'wz_jsgraphics' );
ui_require_javascript_file ( 'pandora_visual_console' );
} else {
// Header
ui_print_page_header (
__ ( 'SNMP Console' ),
'images/op_snmp.png' ,
false ,
'' ,
false ,
[
$fullscreen ,
$list ,
$statistics ,
]
);
}
2014-09-23 18:05:44 +02:00
}
2008-10-22 17:05:15 +02:00
2017-04-07 12:08:42 +02:00
ui_toggle ( $filter , __ ( 'Toggle filter(s)' ));
2019-01-30 16:18:44 +01:00
unset ( $table );
2017-04-07 12:08:42 +02:00
2017-06-22 09:28:07 +02:00
print_snmp_tags_active_filters ( $filter_resume );
2014-09-23 18:05:44 +02:00
if (( $config [ 'dbtype' ] == 'oracle' ) && ( $traps !== false )) {
2019-01-30 16:18:44 +01:00
for ( $i = 0 ; $i < count ( $traps ); $i ++ ) {
unset ( $traps [ $i ][ 'rnum' ]);
}
2014-09-23 18:05:44 +02:00
}
2008-10-22 17:05:15 +02:00
2019-01-30 16:18:44 +01:00
$url_snmp = 'index.php?' . 'sec=snmpconsole&' . 'sec2=operation/snmpconsole/snmp_view&' . 'filter_severity=' . $filter_severity . '&' . 'filter_fired=' . $filter_fired . '&' . 'filter_status=' . $filter_status . '&' . 'refresh=' . (( int ) get_parameter ( 'refresh' , 0 )) . '&' . 'pure=' . $config [ 'pure' ] . '&' . 'trap_type=' . $trap_type . '&' . 'group_by=' . $group_by . '&' . 'free_search_string=' . $free_search_string . '&' . 'date_from_trap=' . $date_from_trap . '&' . 'date_to_trap=' . $date_to_trap . '&' . 'time_from_trap=' . $time_from_trap . '&' . 'time_to_trap=' . $time_to_trap ;
$urlPagination = $url_snmp . '&' . 'pagination=' . $pagination . '&' . 'offset=' . $offset ;
ui_pagination ( $trapcount , $urlPagination , $offset , $pagination );
echo '<form name="eventtable" method="POST" action="' . $url_snmp . '">' ;
2008-10-22 15:20:06 +02:00
2015-04-22 16:46:08 +02:00
$table -> cellpadding = 0 ;
$table -> cellspacing = 0 ;
$table -> width = '100%' ;
2019-01-30 16:18:44 +01:00
$table -> class = 'databox data' ;
$table -> head = [];
$table -> size = [];
$table -> data = [];
$table -> align = [];
$table -> headstyle = [];
2008-10-22 15:20:06 +02:00
2014-09-23 18:05:44 +02:00
$table -> head [ 0 ] = __ ( 'Status' );
2019-01-30 16:18:44 +01:00
$table -> align [ 0 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 0 ] = '5%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 0 ] = 'text-align: center' ;
2008-10-22 17:05:15 +02:00
2014-09-23 18:05:44 +02:00
$table -> head [ 1 ] = __ ( 'SNMP Agent' );
2019-01-30 16:18:44 +01:00
$table -> align [ 1 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 1 ] = '15%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 1 ] = 'text-align: center' ;
2014-03-27 11:48:19 +01:00
2015-01-21 14:47:54 +01:00
$table -> head [ 2 ] = __ ( 'Enterprise String' );
2019-01-30 16:18:44 +01:00
$table -> align [ 2 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 2 ] = '18%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 2 ] = 'text-align: center' ;
2008-10-09 18:56:31 +02:00
2014-09-23 18:05:44 +02:00
if ( $group_by ) {
2019-01-30 16:18:44 +01:00
$table -> head [ 3 ] = __ ( 'Count' );
$table -> align [ 3 ] = 'center' ;
$table -> size [ 3 ] = '5%' ;
$table -> headstyle [ 3 ] = 'text-align: center' ;
2014-09-23 18:05:44 +02:00
}
2013-10-14 14:00:56 +02:00
2015-01-21 14:47:54 +01:00
$table -> head [ 4 ] = __ ( 'Trap subtype' );
2019-01-30 16:18:44 +01:00
$table -> align [ 4 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 4 ] = '10%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 4 ] = 'text-align: center' ;
2014-03-18 17:08:20 +01:00
2014-09-23 18:05:44 +02:00
$table -> head [ 5 ] = __ ( 'User ID' );
2019-01-30 16:18:44 +01:00
$table -> align [ 5 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 5 ] = '10%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 5 ] = 'text-align: center' ;
2014-09-23 18:05:44 +02:00
$table -> head [ 6 ] = __ ( 'Timestamp' );
2019-01-30 16:18:44 +01:00
$table -> align [ 6 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 6 ] = '10%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 6 ] = 'text-align: center' ;
2014-09-23 18:05:44 +02:00
$table -> head [ 7 ] = __ ( 'Alert' );
2019-01-30 16:18:44 +01:00
$table -> align [ 7 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 7 ] = '5%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 7 ] = 'text-align: center' ;
2014-09-23 18:05:44 +02:00
$table -> head [ 8 ] = __ ( 'Action' );
2019-01-30 16:18:44 +01:00
$table -> align [ 8 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 8 ] = '10%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 8 ] = 'text-align: center' ;
2014-09-23 18:05:44 +02:00
2019-01-30 16:18:44 +01:00
$table -> head [ 9 ] = html_print_checkbox_extended (
'allbox' ,
1 ,
false ,
false ,
'javascript:CheckAll();' ,
'class="chk" title="' . __ ( 'All' ) . '"' ,
true
);
$table -> align [ 9 ] = 'center' ;
2014-09-23 18:05:44 +02:00
$table -> size [ 9 ] = '5%' ;
2018-10-01 16:59:17 +02:00
$table -> headstyle [ 9 ] = 'text-align: center' ;
2014-09-23 18:05:44 +02:00
2019-01-30 16:18:44 +01:00
$table -> style [ 8 ] = 'background: #F3F3F3; color: #111 !important;' ;
2014-09-23 18:05:44 +02:00
// Skip offset records
$idx = 0 ;
if ( $traps !== false ) {
2019-01-30 16:18:44 +01:00
foreach ( $traps as $trap ) {
$data = [];
if ( empty ( $trap [ 'description' ])) {
$trap [ 'description' ] = '' ;
}
$severity = enterprise_hook ( 'get_severity' , [ $trap ]);
if ( $severity === ENTERPRISE_NOT_HOOK ) {
$severity = $trap [ 'alerted' ] == 1 ? $trap [ 'priority' ] : 1 ;
}
// Status
if ( $trap [ 'status' ] == 0 ) {
$data [ 0 ] = html_print_image (
'images/pixel_red.png' ,
true ,
[
'title' => __ ( 'Not validated' ),
'width' => '20' ,
'height' => '20' ,
]
);
} else {
$data [ 0 ] = html_print_image (
'images/pixel_green.png' ,
true ,
[
'title' => __ ( 'Validated' ),
'width' => '20' ,
'height' => '20' ,
]
);
}
// Agent matching source address
$table -> cellclass [ $idx ][ 1 ] = get_priority_class ( $severity );
$agent = agents_get_agent_with_ip ( $trap [ 'source' ]);
if ( $agent === false ) {
if ( ! check_acl ( $config [ 'id_user' ], 0 , 'AR' )) {
continue ;
}
$data [ 1 ] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&new_agent=1&direccion=' . $trap [ 'source' ] . '" title="' . __ ( 'Create agent' ) . '">' . $trap [ 'source' ] . '</a>' ;
} else {
if ( ! check_acl ( $config [ 'id_user' ], $agent [ 'id_grupo' ], 'AR' )) {
continue ;
}
$data [ 1 ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $agent [ 'id_agente' ] . '" title="' . __ ( 'View agent details' ) . '">' ;
$data [ 1 ] .= '<strong>' . $agent [ 'alias' ] . ui_print_help_tip ( $trap [ 'source' ], true , 'images/tip-blanco.png' );
'</strong></a>' ;
}
// OID
$table -> cellclass [ $idx ][ 2 ] = get_priority_class ( $severity );
if ( ! empty ( $trap [ 'text' ])) {
$enterprise_string = $trap [ 'text' ];
} else if ( ! empty ( $trap [ 'oid' ])) {
$enterprise_string = $trap [ 'oid' ];
} else {
$enterprise_string = __ ( 'N/A' );
}
$data [ 2 ] = '<a href="javascript: toggleVisibleExtendedInfo(' . $trap [ 'id_trap' ] . ');">' . $enterprise_string . '</a>' ;
// Count
if ( $group_by ) {
$sql = " SELECT * FROM ttrap WHERE 1=1
2014-09-23 18:05:44 +02:00
$where_without_group
AND oid = '".$trap[' oid ']."'
AND source = '".$trap[' source ']."' " ;
2019-01-30 16:18:44 +01:00
$group_traps = db_get_all_rows_sql ( $sql );
$count_group_traps = count ( $group_traps );
$table -> cellclass [ $idx ][ 3 ] = get_priority_class ( $severity );
$data [ 3 ] = '<strong>' . $count_group_traps . '</strong></a>' ;
}
// Value
$table -> cellclass [ $idx ][ 4 ] = get_priority_class ( $severity );
if ( empty ( $trap [ 'value' ])) {
$data [ 4 ] = __ ( 'N/A' );
} else {
$data [ 4 ] = ui_print_truncate_text ( $trap [ 'value' ], GENERIC_SIZE_TEXT , false );
}
// User
$table -> cellclass [ $idx ][ 5 ] = get_priority_class ( $severity );
if ( ! empty ( $trap [ 'status' ])) {
$data [ 5 ] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit&ver=' . $trap [ 'id_usuario' ] . '">' . substr ( $trap [ 'id_usuario' ], 0 , 8 ) . '</a>' ;
if ( ! empty ( $trap [ 'id_usuario' ])) {
$data [ 5 ] .= ui_print_help_tip ( get_user_fullname ( $trap [ 'id_usuario' ]), true );
}
} else {
$data [ 5 ] = '--' ;
}
// Timestamp
$table -> cellclass [ $idx ][ 6 ] = get_priority_class ( $severity );
$data [ 6 ] = '<span title="' . $trap [ 'timestamp' ] . '">' ;
$data [ 6 ] .= ui_print_timestamp ( $trap [ 'timestamp' ], true );
$data [ 6 ] .= '</span>' ;
// Use alert severity if fired
if ( ! empty ( $trap [ 'alerted' ])) {
$data [ 7 ] = html_print_image ( 'images/pixel_yellow.png' , true , [ 'width' => '20' , 'height' => '20' , 'border' => '0' , 'title' => __ ( 'Alert fired' )]);
} else {
$data [ 7 ] = html_print_image ( 'images/pixel_gray.png' , true , [ 'width' => '20' , 'height' => '20' , 'border' => '0' , 'title' => __ ( 'Alert not fired' )]);
}
// Actions
$data [ 8 ] = '' ;
if ( empty ( $trap [ 'status' ]) && check_acl ( $config [ 'id_user' ], 0 , 'IW' )) {
$data [ 8 ] .= '<a href="' . $url_snmp . '&check=' . $trap [ 'id_trap' ] . '">' . html_print_image ( 'images/ok.png' , true , [ 'border' => '0' , 'title' => __ ( 'Validate' )]) . '</a> ' ;
}
if ( $trap [ 'source' ] == '' ) {
$is_admin = db_get_value ( 'is_admin' , 'tusuario' , 'id_user' , $config [ 'id_user' ]);
if ( $is_admin ) {
$data [ 8 ] .= '<a href="' . $url_snmp . '&delete=' . $trap [ 'id_trap' ] . '&offset=' . $offset . '" onClick="javascript:return confirm(\'' . __ ( 'Are you sure?' ) . '\')">' . html_print_image ( 'images/cross.png' , true , [ 'border' => '0' , 'title' => __ ( 'Delete' )]) . '</a> ' ;
}
} else {
$agent_trap_group = db_get_value ( 'id_grupo' , 'tagente' , 'nombre' , $trap [ 'source' ]);
if (( check_acl ( $config [ 'id_user' ], $agent_trap_group , 'AW' ))) {
$data [ 8 ] .= '<a href="' . $url_snmp . '&delete=' . $trap [ 'id_trap' ] . '&offset=' . $offset . '" onClick="javascript:return confirm(\'' . __ ( 'Are you sure?' ) . '\')">' . html_print_image ( 'images/cross.png' , true , [ 'border' => '0' , 'title' => __ ( 'Delete' )]) . '</a> ' ;
}
}
$data [ 8 ] .= '<a href="javascript: toggleVisibleExtendedInfo(' . $trap [ 'id_trap' ] . ');">' . html_print_image ( 'images/eye.png' , true , [ 'alt' => __ ( 'Show more' ), 'title' => __ ( 'Show more' )]) . '</a>' ;
$data [ 8 ] .= enterprise_hook ( 'editor_link' , [ $trap ]);
$data [ 9 ] = html_print_checkbox_extended ( 'snmptrapid[]' , $trap [ 'id_trap' ], false , false , '' , 'class="chk"' , true );
array_push ( $table -> data , $data );
// Hiden file for description
$string = ' < table style = " border:solid 1px #D3D3D3; " width = " 90% " class = " toggle " >
2014-09-23 18:05:44 +02:00
< tr >
2019-01-30 16:18:44 +01:00
< td align = " left " valign = " top " width = " 15% " > '.' < b > '.__(' Variable bindings : ').' </ b ></ td >
2014-09-23 18:05:44 +02:00
< td align = " left " > ' ;
2019-01-30 16:18:44 +01:00
if ( $group_by ) {
$new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&' . 'filter_severity=' . $filter_severity . '&' . 'filter_fired=' . $filter_fired . '&' . 'filter_status=' . $filter_status . '&' . 'refresh=' . (( int ) get_parameter ( 'refresh' , 0 )) . '&' . 'pure=' . $config [ 'pure' ] . '&' . 'group_by=0&' . 'free_search_string=' . $free_search_string . '&' . 'date_from_trap=' . $date_from_trap . '&' . 'date_to_trap=' . $date_to_trap . '&' . 'time_from_trap=' . $time_from_trap . '&' . 'time_to_trap=' . $time_to_trap ;
$string .= '<a href=' . $new_url . '>' . __ ( 'See more details' ) . '</a>' ;
} else {
// Print binding vars separately
$binding_vars = explode ( " \t " , $trap [ 'oid_custom' ]);
foreach ( $binding_vars as $var ) {
$string .= $var . '<br/>' ;
}
}
$string .= ' </ td >
2014-09-23 18:05:44 +02:00
</ tr >
< tr >
2019-01-30 16:18:44 +01:00
< td align = " left " valign = " top " > '.' < b > '.__(' Enterprise String : ').' </ td >
< td align = " left " > '.$trap[' oid '].' </ td >
2014-09-23 18:05:44 +02:00
</ tr > ' ;
2019-01-30 16:18:44 +01:00
if ( $trap [ 'description' ] != '' ) {
$string .= ' < tr >
< td align = " left " valign = " top " > '.' < b > '.__(' Description : ').' </ td >
< td align = " left " > '.$trap[' description '].' </ td >
2013-06-18 10:16:50 +02:00
</ tr > ' ;
2019-01-30 16:18:44 +01:00
}
if ( $trap [ 'type' ] != '' ) {
$trap_types = [
- 1 => __ ( 'None' ),
0 => __ ( 'Cold start (0)' ),
1 => __ ( 'Warm start (1)' ),
2 => __ ( 'Link down (2)' ),
3 => __ ( 'Link up (3)' ),
4 => __ ( 'Authentication failure (4)' ),
5 => __ ( 'Other' ),
];
switch ( $trap [ 'type' ]) {
case - 1 :
$desc_trap_type = __ ( 'None' );
break ;
case 0 :
$desc_trap_type = __ ( 'Cold start (0)' );
break ;
case 1 :
$desc_trap_type = __ ( 'Warm start (1)' );
break ;
case 2 :
$desc_trap_type = __ ( 'Link down (2)' );
break ;
case 3 :
$desc_trap_type = __ ( 'Link up (3)' );
break ;
case 4 :
$desc_trap_type = __ ( 'Authentication failure (4)' );
break ;
default :
$desc_trap_type = __ ( 'Other' );
break ;
}
$string .= '<tr><td align="left" valign="top">' . '<b>' . __ ( 'Trap type:' ) . '</b>' . '</td>' . '<td align="left">' . $desc_trap_type . '</td></tr>' ;
}
if ( $group_by ) {
$sql = " SELECT * FROM ttrap WHERE 1=1
2014-09-23 18:05:44 +02:00
$where_without_group
AND oid = '".$trap[' oid ']."'
AND source = '".$trap[' source ']."' " ;
2019-01-30 16:18:44 +01:00
$group_traps = db_get_all_rows_sql ( $sql );
$count_group_traps = count ( $group_traps );
$sql = " SELECT timestamp FROM ttrap WHERE 1=1
2014-09-23 18:05:44 +02:00
$where_without_group
AND oid = '".$trap[' oid ']."'
AND source = '".$trap[' source ']."'
2019-01-30 16:18:44 +01:00
ORDER BY `timestamp` DESC " ;
$last_trap = db_get_value_sql ( $sql );
$sql = " SELECT timestamp FROM ttrap WHERE 1=1
2014-09-23 18:05:44 +02:00
$where_without_group
AND oid = '".$trap[' oid ']."'
AND source = '".$trap[' source ']."'
ORDER BY `timestamp` ASC " ;
2019-01-30 16:18:44 +01:00
$first_trap = db_get_value_sql ( $sql );
$string .= ' < tr >
< td align = " left " valign = " top " > '.' < b > '.__(' Count : ').' </ td >
< td align = " left " > '.$count_group_traps.' </ td >
2014-09-23 18:05:44 +02:00
</ tr > ' ;
2019-01-30 16:18:44 +01:00
$string .= ' < tr >
< td align = " left " valign = " top " > '.' < b > '.__(' First trap : ').' </ td >
< td align = " left " > '.$first_trap.' </ td >
2014-09-23 18:05:44 +02:00
</ tr > ' ;
2019-01-30 16:18:44 +01:00
$string .= ' < tr >
< td align = " left " valign = " top " > '.' < b > '.__(' Last trap : ').' </ td >
< td align = " left " > '.$last_trap.' </ td >
2014-09-23 18:05:44 +02:00
</ tr > ' ;
2019-01-30 16:18:44 +01:00
}
$string .= '</table>' ;
$data = [ $string ];
// $data = array($trap['description']);
$idx ++ ;
$table -> rowclass [ $idx ] = 'trap_info_' . $trap [ 'id_trap' ];
$table -> colspan [ $idx ][ 0 ] = 10 ;
$table -> rowstyle [ $idx ] = 'display: none;' ;
array_push ( $table -> data , $data );
$idx ++ ;
}
2014-09-23 18:05:44 +02:00
}
2014-06-10 17:21:58 +02:00
2014-09-23 18:05:44 +02:00
// No matching traps
if ( $idx == 0 ) {
2019-01-30 16:18:44 +01:00
echo '<div class="nf">' . __ ( 'No matching traps found' ) . '</div>' ;
} else {
html_print_table ( $table );
2014-09-23 18:05:44 +02:00
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
2019-01-30 16:18:44 +01:00
unset ( $table );
2014-06-10 17:21:58 +02:00
2014-09-23 18:05:44 +02:00
echo '<div style="width:98%; text-align:right;">' ;
2019-01-30 16:18:44 +01:00
if ( check_acl ( $config [ 'id_user' ], 0 , 'IW' )) {
html_print_submit_button ( __ ( 'Validate' ), 'updatebt' , false , 'class="sub ok"' );
2014-09-23 18:05:44 +02:00
}
2014-06-10 17:21:58 +02:00
2019-01-30 16:18:44 +01:00
if ( check_acl ( $config [ 'id_user' ], 0 , 'IM' )) {
echo ' ' ;
html_print_submit_button ( __ ( 'Delete' ), 'deletebt' , false , 'class="sub delete" onClick="javascript:return confirm(\'' . __ ( 'Are you sure?' ) . '\')"' );
2014-09-23 18:05:44 +02:00
}
2019-01-30 16:18:44 +01:00
echo '</div></form>' ;
2014-09-23 18:05:44 +02:00
echo '<div style="float:left; padding-left:30px; line-height: 17px; vertical-align: top; width:120px;">' ;
2019-01-30 16:18:44 +01:00
echo '<h3>' . __ ( 'Status' ) . '</h3>' ;
echo html_print_image (
'images/pixel_green.png' ,
true ,
[
'width' => '20' ,
'height' => '20' ,
]
) . ' - ' . __ ( 'Validated' );
2014-09-23 18:05:44 +02:00
echo '<br />' ;
2019-01-30 16:18:44 +01:00
echo html_print_image (
'images/pixel_red.png' ,
true ,
[
'width' => '20' ,
'height' => '20' ,
]
) . ' - ' . __ ( 'Not validated' );
2014-09-23 18:05:44 +02:00
echo '</div>' ;
echo '<div style="float:left; padding-left:30px; line-height: 17px; vertical-align: top; width:120px;">' ;
2019-01-30 16:18:44 +01:00
echo '<h3>' . __ ( 'Alert' ) . '</h3>' ;
echo html_print_image (
'images/pixel_yellow.png' ,
true ,
[
'width' => '20' ,
'height' => '20' ,
]
) . ' - ' . __ ( 'Fired' );
2014-09-23 18:05:44 +02:00
echo '<br />' ;
2019-01-30 16:18:44 +01:00
echo html_print_image (
'images/pixel_gray.png' ,
true ,
[
'width' => '20' ,
'height' => '20' ,
]
) . ' - ' . __ ( 'Not fired' );
2014-09-23 18:05:44 +02:00
echo '</div>' ;
echo '<div style="float:left; padding-left:30px; line-height: 19px; vertical-align: top; width:120px;">' ;
2019-01-30 16:18:44 +01:00
echo '<h3>' . __ ( 'Action' ) . '</h3>' ;
echo html_print_image ( 'images/ok.png' , true ) . ' - ' . __ ( 'Validate' );
2014-09-23 18:05:44 +02:00
echo '<br />' ;
2019-01-30 16:18:44 +01:00
echo html_print_image ( 'images/cross.png' , true ) . ' - ' . __ ( 'Delete' );
2014-09-23 18:05:44 +02:00
echo '</div>' ;
echo '<div style="float:left; padding-left:30px; line-height: 17px; vertical-align: top; width:120px;">' ;
echo '<h3>' . __ ( 'Legend' ) . '</h3>' ;
2019-01-30 16:18:44 +01:00
foreach ( get_priorities () as $num => $name ) {
echo '<span class="' . get_priority_class ( $num ) . '">' . $name . '</span>' ;
echo '<br />' ;
2008-11-20 22:26:59 +01:00
}
2019-01-30 16:18:44 +01:00
2014-09-23 18:05:44 +02:00
echo '</div>' ;
echo '<div style="clear:both;"> </div>' ;
2017-05-16 14:40:30 +02:00
ui_include_time_picker ();
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
?>
2008-10-31 18:08:52 +01:00
2008-10-22 15:20:06 +02:00
< script language = " JavaScript " type = " text/javascript " >
2017-04-07 12:08:42 +02:00
2019-01-30 16:18:44 +01:00
$ ( document ) . ready ( function () {
var $startDate = $ ( " #text-date_from_trap " );
var $startTime = $ ( " #text-time_from_trap " );
var $endDate = $ ( " #text-date_to_trap " );
var $endTime = $ ( " #text-time_to_trap " );
$startDate . datepicker ({
dateFormat : " <?php echo DATE_FORMAT_JS; ?> " ,
onClose : function ( selectedDate ) {
$endDate . datepicker ( " option " , " minDate " , selectedDate );
}
});
$endDate . datepicker ({
dateFormat : " <?php echo DATE_FORMAT_JS; ?> " ,
onClose : function ( selectedDate ) {
$startDate . datepicker ( " option " , " maxDate " , selectedDate );
}
});
$startTime . timepicker ({
showSecond : true ,
timeFormat : '<?php echo TIME_FORMAT_JS; ?>' ,
timeOnlyTitle : '<?php echo __(' Choose time '); ?>' ,
timeText : '<?php echo __(' Time '); ?>' ,
hourText : '<?php echo __(' Hour '); ?>' ,
minuteText : '<?php echo __(' Minute '); ?>' ,
secondText : '<?php echo __(' Second '); ?>' ,
currentText : '<?php echo __(' Now '); ?>' ,
closeText : '<?php echo __(' Close '); ?>'
});
$endTime . timepicker ({
showSecond : true ,
timeFormat : '<?php echo TIME_FORMAT_JS; ?>' ,
timeOnlyTitle : '<?php echo __(' Choose time '); ?>' ,
timeText : '<?php echo __(' Time '); ?>' ,
hourText : '<?php echo __(' Hour '); ?>' ,
minuteText : '<?php echo __(' Minute '); ?>' ,
secondText : '<?php echo __(' Second '); ?>' ,
currentText : '<?php echo __(' Now '); ?>' ,
closeText : '<?php echo __(' Close '); ?>'
});
var controls = document . getElementById ( 'dashboard-controls' );
autoHideElement ( controls , 1000 );
var startCountDown = function ( duration , cb ) {
$ ( 'div.dashboard-countdown' ) . countdown ( 'destroy' );
if ( ! duration ) return ;
var t = new Date ();
t . setTime ( t . getTime () + duration * 1000 );
$ ( 'div.dashboard-countdown' ) . countdown ({
until : t ,
format : 'MS' ,
layout : '(%M%nn%M:%S%nn%S <?php echo __(' Until next '); ?>) ' ,
alwaysExpire : true ,
onExpiry : function () {
$ ( 'div.dashboard-countdown' ) . countdown ( 'destroy' );
cb ();
}
});
}
// Auto refresh select
$ ( 'form#refr-form' ) . submit ( function ( event ) {
event . preventDefault ();
});
var handleRefrChange = function ( event ) {
event . preventDefault ();
var url = $ ( 'form#refr-form' ) . prop ( 'action' );
var refr = Number . parseInt ( event . target . value , 10 );
startCountDown ( refr , function () {
window . location = url + '&refresh=' + refr ;
});
}
$ ( 'form#refr-form select' ) . change ( handleRefrChange ) . change ();
});
function CheckAll () {
for ( var i = 0 ; i < document . eventtable . elements . length ; i ++ ) {
var e = document . eventtable . elements [ i ];
if ( e . type == 'checkbox' && e . name != 'allbox' )
e . checked = ! e . checked ;
}
}
function toggleDiv ( divid ) {
if ( document . getElementById ( divid ) . style . display == 'none' ) {
document . getElementById ( divid ) . style . display = 'block' ;
}
else {
document . getElementById ( divid ) . style . display = 'none' ;
}
}
function toggleVisibleExtendedInfo ( id_trap ) {
display = $ ( '.trap_info_' + id_trap ) . css ( 'display' );
if ( display != 'none' ) {
$ ( '.trap_info_' + id_trap ) . css ( 'display' , 'none' );
}
else {
$ ( '.trap_info_' + id_trap ) . css ( 'display' , '' );
}
}
2017-04-07 12:08:42 +02:00
2017-05-17 17:37:10 +02:00
</ script >