2008-04-23 22:51:37 +02:00
< ? php
2009-06-08 20:17:33 +02:00
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
2008-04-23 22:51:37 +02:00
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
2009-06-08 20:17:33 +02:00
// as published by the Free Software Foundation for version 2.
2008-04-23 22:51:37 +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.
2009-06-08 20:17:33 +02:00
2009-03-05 18:40:40 +01:00
ini_set ( 'display_errors' , 0 ); //Don't display other errors, messes up XML
2009-03-12 19:44:37 +01:00
2009-03-05 18:40:40 +01:00
require_once " ../../include/config.php " ;
require_once " ../../include/functions.php " ;
2008-07-25 20:37:32 +02:00
require_once " ../../include/functions_db.php " ;
2010-01-25 20:47:38 +01:00
require_once " ../../include/functions_api.php " ;
2010-11-04 18:41:37 +01:00
ini_set ( 'display_errors' , 0 ); //Don't display other errors, messes up XML
2010-07-02 14:21:39 +02:00
2010-01-25 20:47:38 +01:00
$ipOrigin = $_SERVER [ 'REMOTE_ADDR' ];
// Uncoment this to activate ACL on RSS Events
2010-09-27 13:24:43 +02:00
if ( ! isInACL ( $ipOrigin )) {
2010-01-25 20:47:38 +01:00
exit ;
2010-09-27 13:24:43 +02:00
}
2010-09-01 15:34:15 +02:00
// Check user credentials
$user = get_parameter ( 'user' );
$hashup = get_parameter ( 'hashup' );
$pss = get_user_info ( $user );
$hashup2 = md5 ( $user . $pss [ 'password' ]);
2010-11-04 18:41:37 +01:00
if ( $hashup != $hashup2 ) {
2010-09-01 15:34:15 +02:00
exit ;
}
2010-01-25 20:47:38 +01:00
header ( " Content-Type: application/xml; charset=UTF-8 " ); //Send header before starting to output
2008-04-23 22:51:37 +02:00
2009-03-05 18:40:40 +01:00
function rss_error_handler ( $errno , $errstr , $errfile , $errline ) {
global $config ;
$base = 'http' . ( isset ( $_SERVER [ 'HTTPS' ]) && $_SERVER [ 'HTTPS' ] == TRUE ? 's' : '' ) . '://' . $_SERVER [ 'HTTP_HOST' ];
$url = $base . $config [ " homeurl " ];
$selfurl = $base . $_SERVER [ 'PHP_SELF' ] . '?' . $_SERVER [ 'QUERY_STRING' ];
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>' ; //' Fixes certain highlighters freaking out on the PHP closing tag
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' ;
$rss_feed .= '<channel><title>Pandora RSS Feed</title><description>Latest events on Pandora</description>' ;
$rss_feed .= '<lastBuildDate>' . date ( DATE_RFC822 , 0 ) . '</lastBuildDate>' ;
$rss_feed .= '<link>' . $url . '</link>' ; //Link back to the main Pandora page
2009-03-12 19:44:37 +01:00
$rss_feed .= '<atom:link href="' . safe_input ( $selfurl ) . '" rel="self" type="application/rss+xml" />' ; //Alternative for Atom feeds. It's the same.
2009-03-05 18:40:40 +01:00
$rss_feed .= '<item><guid>' . $url . '/index.php?sec=eventos&sec2=operation/events/events</guid><title>Error creating feed</title>' ;
$rss_feed .= '<description>There was an error creating the feed: ' . $errno . ' - ' . $errstr . ' in ' . $errfile . ' on line ' . $errline . '</description>' ;
$rss_feed .= '<link>' . $url . '/index.php?sec=eventos&sec2=operation/events/events</link></item>' ;
exit ( $rss_feed ); //Exit by displaying the feed
}
set_error_handler ( 'rss_error_handler' , E_ALL ); //Errors output as RSS
2009-03-12 19:44:37 +01:00
2008-09-03 17:47:09 +02:00
$ev_group = get_parameter ( " ev_group " , 0 ); // group
$search = get_parameter ( " search " , " " ); // free search
$event_type = get_parameter ( " event_type " , '' ); // 0 all
$severity = ( int ) get_parameter ( " severity " , - 1 ); // -1 all
$status = ( int ) get_parameter ( " status " , 0 ); // -1 all, 0 only red, 1 only green
$id_agent = ( int ) get_parameter ( " id_agent " , - 1 );
$id_event = ( int ) get_parameter ( " id_event " , - 1 ); //This will allow to select only 1 event (eg. RSS)
2010-07-02 14:21:39 +02:00
$event_view_hr = ( int ) get_parameter ( " event_view_hr " , 0 );
2008-04-23 22:51:37 +02:00
2008-09-03 17:47:09 +02:00
$sql_post = " " ;
2010-07-02 14:21:39 +02:00
if ( $event_view_hr > 0 ) {
$unixtime = ( int ) ( get_system_time () - ( $event_view_hr * 3600 )); //Put hours in seconds
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.utimestamp > " . $unixtime ;
2010-07-02 14:21:39 +02:00
}
2008-09-03 17:47:09 +02:00
if ( $ev_group > 1 )
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.id_grupo = $ev_group " ;
2010-09-27 13:24:43 +02:00
switch ( $status ) {
case 0 :
case 1 :
case 2 :
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.estado = " . $status ;
2010-09-27 13:24:43 +02:00
break ;
case 3 :
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND (tevento.estado = 0 OR tevento.estado = 2) " ;
2010-09-27 13:24:43 +02:00
break ;
}
2008-09-03 17:47:09 +02:00
if ( $search != " " )
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.evento LIKE '% $search %' " ;
2010-11-04 18:41:37 +01:00
if ( $event_type != " " ) {
2010-07-02 14:21:39 +02:00
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
2010-11-04 18:41:37 +01:00
if ( $event_type == " warning " || $event_type == " critical " || $event_type == " normal " ) {
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.event_type LIKE '% $event_type %' " ;
2010-07-02 14:21:39 +02:00
}
2010-11-04 18:41:37 +01:00
elseif ( $event_type == " not_normal " ) {
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.event_type LIKE '%warning%' OR tevento.event_type LIKE '%critical%' OR tevento.event_type LIKE '%unknown%' " ;
2010-07-02 14:21:39 +02:00
}
else
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.event_type = ' " . $event_type . " ' " ;
2010-07-02 14:21:39 +02:00
}
2008-09-03 17:47:09 +02:00
if ( $severity != - 1 )
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.criticity >= " . $severity ;
2010-09-27 13:24:43 +02:00
if ( $id_agent == - 2 ) {
$text_agent = ( string ) get_parameter ( " text_agent " , __ ( " All " ));
switch ( $text_agent )
{
case __ ( 'All' ) :
$id_agent = - 1 ;
break ;
case __ ( 'Server' ) :
$id_agent = 0 ;
break ;
default :
$id_agent = get_agent_id ( $text_agent );
break ;
}
}
else {
switch ( $id_agent )
{
case - 1 :
$text_agent = __ ( 'All' );
break ;
case 0 :
$text_agent = __ ( 'Server' );
break ;
default :
$text_agent = get_agent_name ( $id_agent );
break ;
}
}
2008-09-03 17:47:09 +02:00
if ( $id_agent != - 1 )
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.id_agente = " . $id_agent ;
2008-09-03 17:47:09 +02:00
if ( $id_event != - 1 )
$sql_post .= " AND id_evento = " . $id_event ;
2010-07-02 14:21:39 +02:00
2010-09-01 15:34:15 +02:00
// Avoid to show system events to not administrators
if ( ! check_acl ( $user , 0 , " PM " ))
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql_post .= " AND tevento.event_type <> 'system' " ;
2010-09-01 15:34:15 +02:00
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_servers.php,
include/ajax/reporting.ajax.php, include/fgraph.php,
include/functions_db.php, include/functions_alerts.php,
include/functions_reports.php, extensions/system_info.php,
extensions/agents_modules.php, operation/agentes/group_view.php,
operation/events/events_rss.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php, extras/pandora_diag.php,
general/logon_ok.php, godmode/db/db_audit.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/agentes/planned_downtime.php,
godmode/setup/setup.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.php: changes for to use character " in
the SQL queries for PostgreSQL, in some cases. In other case there are more
changes for to create SQL query PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4062 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-07 17:59:14 +01:00
$sql = " SELECT tevento.id_evento AS event_id,
tevento . id_agente AS id_agent ,
tevento . id_usuario AS validated_by ,
tevento . id_grupo AS id_group ,
tevento . estado AS validated ,
tevento . evento AS event_descr ,
tevento . utimestamp AS unix_timestamp ,
tevento . event_type AS event_type
2010-07-02 14:21:39 +02:00
FROM tevento
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
WHERE 1 = 1 " . $sql_post . "
2008-09-03 17:47:09 +02:00
ORDER BY utimestamp DESC LIMIT 0 , 30 " ;
2008-04-23 22:51:37 +02:00
2008-09-03 17:47:09 +02:00
$result = get_db_all_rows_sql ( $sql );
2008-04-23 22:51:37 +02:00
2009-03-05 18:40:40 +01:00
$base = 'http' . ( isset ( $_SERVER [ 'HTTPS' ]) && $_SERVER [ 'HTTPS' ] == TRUE ? 's' : '' ) . '://' . $_SERVER [ 'HTTP_HOST' ];
$url = $base . $config [ " homeurl " ];
$selfurl = $base . $_SERVER [ 'PHP_SELF' ] . '?' . $_SERVER [ 'QUERY_STRING' ];
if ( empty ( $result )) {
$lastbuild = 0 ; //Last build in 1970
2010-11-04 18:41:37 +01:00
}
else {
2009-03-05 18:40:40 +01:00
$lastbuild = ( int ) $result [ 0 ][ 'unix_timestamp' ];
}
2008-04-23 22:51:37 +02:00
2009-03-12 19:44:37 +01:00
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>' ; // ' <?php ' -- Fixes highlighters thinking that the closing tag is PHP
2009-03-05 18:40:40 +01:00
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' ;
2008-09-03 17:47:09 +02:00
$rss_feed .= '<channel><title>Pandora RSS Feed</title><description>Latest events on Pandora</description>' ;
2009-03-05 18:40:40 +01:00
$rss_feed .= '<lastBuildDate>' . date ( DATE_RFC822 , $lastbuild ) . '</lastBuildDate>' ; //Last build date is the last event - that way readers won't mark it as having new posts
$rss_feed .= '<link>' . $url . '</link>' ; //Link back to the main Pandora page
2009-03-12 19:44:37 +01:00
$rss_feed .= '<atom:link href="' . safe_input ( $selfurl ) . '" rel="self" type="application/rss+xml" />' ; //Alternative for Atom feeds. It's the same.
2008-04-23 22:51:37 +02:00
2009-03-05 18:40:40 +01:00
if ( empty ( $result )) {
2008-09-03 17:47:09 +02:00
$result = array ();
2009-03-12 19:44:37 +01:00
$rss_feed .= '<item><guid>' . safe_input ( $url . '/index.php?sec=eventos&sec2=operation/events/events' ) . '</guid><title>No results</title>' ;
2008-09-03 17:47:09 +02:00
$rss_feed .= '<description>There are no results. Click on the link to see all Pending events</description>' ;
2009-03-12 19:44:37 +01:00
$rss_feed .= '<link>' . safe_input ( $url . '/index.php?sec=eventos&sec2=operation/events/events' ) . '</link></item>' ;
2008-09-03 17:47:09 +02:00
}
2008-04-23 22:51:37 +02:00
2008-09-03 17:47:09 +02:00
foreach ( $result as $row ) {
2010-09-01 15:34:15 +02:00
if ( ! check_acl ( $user , $row [ " id_group " ], " AR " )) {
continue ;
}
2010-07-02 14:21:39 +02:00
if ( $row [ " event_type " ] == " system " ) {
$agent_name = __ ( 'System' );
}
elseif ( $row [ " id_agent " ] > 0 ) {
// Agent name
$agent_name = get_agent_name ( $row [ " id_agent " ]);
}
else {
$agent_name = __ ( 'Alert' ) . __ ( 'SNMP' );
}
2008-04-23 22:51:37 +02:00
//This is mandatory
$rss_feed .= '<item><guid>' ;
2009-03-12 19:44:37 +01:00
$rss_feed .= safe_input ( $url . " /index.php?sec=eventos&sec2=operation/events/events&id_event= " . $row [ 'event_id' ]);
2008-04-23 22:51:37 +02:00
$rss_feed .= '</guid><title>' ;
2010-07-02 14:21:39 +02:00
$rss_feed .= $agent_name ;
2008-04-23 22:51:37 +02:00
$rss_feed .= '</title><description>' ;
2009-11-25 15:56:51 +01:00
$rss_feed .= safe_input ( $row [ 'event_descr' ]);
2008-09-03 17:47:09 +02:00
if ( $row [ 'validated' ] == 1 ) {
2010-07-02 14:21:39 +02:00
$rss_feed .= safe_input ( '<br /><br />' ) . 'Validated by ' . safe_input ( $row [ 'validated_by' ]);
2008-09-03 17:47:09 +02:00
}
2008-04-23 22:51:37 +02:00
$rss_feed .= '</description><link>' ;
2009-03-12 19:44:37 +01:00
$rss_feed .= safe_input ( $url . " /index.php?sec=eventos&sec2=operation/events/events&id_event= " . $row [ " event_id " ]);
2008-04-23 22:51:37 +02:00
$rss_feed .= '</link>' ;
2008-09-03 17:47:09 +02:00
2008-04-23 22:51:37 +02:00
//The rest is optional
$rss_feed .= '<pubDate>' . date ( DATE_RFC822 , $row [ 'unix_timestamp' ]) . '</pubDate>' ;
//This is mandatory again
$rss_feed .= '</item>' ;
}
$rss_feed .= " </channel></rss> " ;
echo $rss_feed ;
2009-06-08 20:17:33 +02:00
?>