From 2311c66e100c0e39c44b7a33d07dd732a250980a Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 8 Oct 2014 14:57:36 +0200 Subject: [PATCH] Fixed an infinite loop on the function "reporting_get_planned_downtimes_intervals" --- .../include/functions_reporting.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4bf73d8a5b..bca1a554c3 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -871,6 +871,12 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi * @return Array with time intervals. */ function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_date, $end_date, $check_services = false) { + global $config; + + require_once ($config['homedir'] . '/include/functions_planned_downtimes.php'); + + $malformed_planned_downtimes = planned_downtimes_get_malformed(); + $sql_downtime = "SELECT DISTINCT(tpd.id), tpd.* FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tplanned_downtime_modules tpdm, tagente_modulo tam WHERE (tpd.id = tpda.id_downtime @@ -896,6 +902,20 @@ function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_dat $downtime_dates[] = $dates; } else if ($downtime_type == 'periodically') { + + // If a planned downtime have malformed dates, its intervals aren't taken account + $downtime_malformed = false; + foreach ($malformed_planned_downtimes as $malformed_planned_downtime) { + if ($downtime_id == $malformed_planned_downtime['id']) { + $downtime_malformed = true; + break; + } + } + if ($downtime_malformed == true) { + continue; + } + // If a planned downtime have malformed dates, its intervals aren't taken account + $downtime_time_from = $downtime['periodically_time_from']; $downtime_time_to = $downtime['periodically_time_to'];