From f9dc4ed094a7e26c71c0773f54383b74576b1b09 Mon Sep 17 00:00:00 2001 From: slerena Date: Fri, 3 Apr 2009 10:44:26 +0000 Subject: [PATCH] 2009-04-03 Sancho Lerena * include/functions_reporting.php, * include/functions_db.php: Fixed a notice who breaks the PDF report. Added homeurl preffix to some includes that breaks PDF reporting. * pandora_console_upgrade: Fixedd issue with old-style config.php. * godmode/alerts/alert_list.php: Fixed bad combo values (ID insted names). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1596 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 ++++++++++ pandora_console/godmode/alerts/alert_list.php | 3 +-- pandora_console/include/functions_db.php | 15 ++++++++++----- pandora_console/include/functions_reporting.php | 3 ++- pandora_console/pandora_console_upgrade | 11 +++++++++++ 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 94afe3ab58..fcc47fc64f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2009-04-03 Sancho Lerena + + * include/functions_reporting.php, + * include/functions_db.php: Fixed a notice who breaks the PDF report. + Added homeurl preffix to some includes that breaks PDF reporting. + + * pandora_console_upgrade: Fixedd issue with old-style config.php. + + * godmode/alerts/alert_list.php: Fixed bad combo values (ID insted names). + 2009-04-02 Sancho Lerena * pandoradb.sql: Final DB changes proposed for closing this month the DB diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index 85ab2fb8c6..dbdccd392b 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -332,8 +332,7 @@ if (! $id_agente) { false, '', '', true); $table->data['agent'][0] = __('Agent'); - $table->data['agent'][1] = print_select (array_keys (get_group_agents (array_keys ($groups), false, "none")), - 'id_agent', 0, false, __('Select'), 0, true); + $table->data['agent'][1] = print_select (get_group_agents (array_keys ($groups), false, "none"), 'id_agent', 0, false, __('Select'), 0, true); $table->data['agent'][1] .= ' '; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 5b0d3a632a..93034264d2 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -844,7 +844,9 @@ function get_alert_fires_in_period ($id_alert_module, $period, $date = 0) { * @return array An array with alerts dictionaries defined in a group. */ function get_group_alerts ($id_group) { - require_once ('include/functions_agents.php'); + global $config; + + require_once ($config["homedir"].'/include/functions_agents.php'); $alerts = array (); $agents = get_group_agents ($id_group, false, "none"); @@ -874,12 +876,15 @@ function get_alerts_fired ($alerts, $period = 0, $date = 0) { $alerts_fired = array (); $agents = array (); + foreach ($alerts as $alert) { - $fires = get_alert_fires_in_period ($alert['id'], $period, $date); - if (! $fires) { - continue; + if (isset($alert['id'])){ + $fires = get_alert_fires_in_period ($alert['id'], $period, $date); + if (! $fires) { + continue; + } + $alerts_fired[$alert['id']] = $fires; } - $alerts_fired[$alert['id']] = $fires; } return $alerts_fired; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c2d63164f9..3020e9096f 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -475,6 +475,7 @@ function print_group_reporting ($id_group, $return = false) { * @return object A table object with the alert reporting.. */ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { + global $config; $table->data = array (); $table->head = array (); $table->head[0] = __('Type'); @@ -484,7 +485,7 @@ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { $table->head[4] = __('Last fired'); $table->head[5] = __('Times Fired'); - require_once ('include/functions_alerts.php'); + require_once ($config["homedir"].'/include/functions_alerts.php'); $alerts = get_agent_alerts ($id_agent); /* FIXME: Add compound alerts to the report. Some extra code is needed here */ diff --git a/pandora_console/pandora_console_upgrade b/pandora_console/pandora_console_upgrade index f1217769f0..9ee562bc41 100644 --- a/pandora_console/pandora_console_upgrade +++ b/pandora_console/pandora_console_upgrade @@ -24,6 +24,17 @@ pandora_upgrade () { fi echo "Installing new console code in $PANDORAPATH" cp -R * $PANDORAPATH + + # This makes the old-style config.php file usable with 3.0 + + line=$(grep "?>" -n $PANDORAPATH/include/config.php | head -1 | cut -f1 -d:) + line=$(($line - 1)) + head -$line $PANDORAPATH/include/config.php > /tmp/asdf + echo "require_once ('config_process.php');" >> /tmp/asdf + echo "?>" >> /tmp/asdf + mv /tmp/asdf $PANDORAPATH/include/config.php + + # Upgrade Database ? if [ "$UPGRADEDB" == "1" ] then