From 25147efff43f4aa9971e3026a06afe12898d1984 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 29 Oct 2013 08:52:08 -0400 Subject: Mail Reports: Ensure some variables are actually arrays before using them, avoids an error and some console output if certain portions of a report have never been used. Version bump. --- config/mailreport/mail_reports_generate.php | 18 +++++++++++++++--- config/mailreport/mailreport.xml | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'config/mailreport') diff --git a/config/mailreport/mail_reports_generate.php b/config/mailreport/mail_reports_generate.php index a784c596..c31909c9 100644 --- a/config/mailreport/mail_reports_generate.php +++ b/config/mailreport/mail_reports_generate.php @@ -53,9 +53,21 @@ if (!$config['mailreports']['schedule'][$id]) exit; $thisreport = $config['mailreports']['schedule'][$id]; -$cmds = $thisreport['cmd']['row']; -$logs = $thisreport['log']['row']; -$graphs = $thisreport['row']; + +if (is_array($thisreport['cmd']) && is_array($thisreport['cmd']['row'])) + $cmds = $thisreport['cmd']['row']; +else + $cmds = array(); + +if (is_array($thisreport['log']) && is_array($thisreport['log']['row'])) + $logs = $thisreport['log']['row']; +else + $logs = array(); + +if (is_array($thisreport['row'])) + $graphs = $thisreport['row']; +else + $graphs = array(); // If there is nothing to do, bail! if ((!is_array($cmds) || !(count($cmds) > 0)) diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml index 000fc675..5a759984 100644 --- a/config/mailreport/mailreport.xml +++ b/config/mailreport/mailreport.xml @@ -37,7 +37,7 @@ ]]> mailreport - 2.0.5 + 2.0.6 Status: Mail Reports /usr/local/bin/ -- cgit v1.2.3