aboutsummaryrefslogtreecommitdiffstats
path: root/config/mailreport
diff options
context:
space:
mode:
Diffstat (limited to 'config/mailreport')
-rw-r--r--config/mailreport/mail_reports.inc27
-rw-r--r--config/mailreport/mailreport.xml2
-rw-r--r--config/mailreport/status_mail_report_add_graph.php7
3 files changed, 29 insertions, 7 deletions
diff --git a/config/mailreport/mail_reports.inc b/config/mailreport/mail_reports.inc
index aa2bc3ce..6dddf7cd 100644
--- a/config/mailreport/mail_reports.inc
+++ b/config/mailreport/mail_reports.inc
@@ -35,13 +35,13 @@ require_once("filter.inc");
require_once("rrd.inc");
$graph_length = array(
- "8hour" => 28800,
+ "eighthour" => 28800,
"day" => 86400,
"week" => 604800,
"month" => 2764800,
"quarter" => 8035200,
"year" => 31622400,
- "4year" => 126489600);
+ "fouryear" => 126489600);
$logfile_friendly = array(
"dhcpd" => "DHCP",
@@ -88,6 +88,7 @@ function get_dates($curperiod, $graph) {
$offset = 0;
}
switch($graph) {
+ case "eighthour":
case "8hour":
if($curhour < 24)
$starthour = 16;
@@ -142,6 +143,7 @@ function get_dates($curperiod, $graph) {
if($offset != 0)
$end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
break;
+ case "fouryear":
case "4year":
$start = mktime(0, 0, 0, 1, 0, (($curyear - 3) + $offset));
if($offset != 0)
@@ -240,7 +242,9 @@ function mail_report_generate_graph($database, $style, $graph, $start, $end) {
require_once("filter.inc");
require_once("shaper.inc");
require_once("rrd.inc");
+ require_once("util.inc");
global $g;
+ $g['theme'] = get_current_theme();
$pgtitle = array(gettext("System"),gettext("RRD Graphs"),gettext("Image viewer"));
@@ -1241,7 +1245,13 @@ function mail_report_get_log($logfile, $tail, $grepfor) {
if(isset($config['system']['usefifolog'])) {
exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail -n {$tail}", $logarr);
} else {
- exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail -n {$tail}", $logarr);
+ if (is_executable("/usr/local/sbin/clog")) {
+ exec("/usr/local/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail -n {$tail}", $logarr);
+ } elseif (is_executable("/usr/sbin/clog")) {
+ exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail -n {$tail}", $logarr);
+ } else {
+ $logarr = array("Cannot locate clog which is required for reading log files.");
+ }
}
}
return($logarr);
@@ -1255,4 +1265,15 @@ function get_friendly_log_name($logfile) {
return $friendly;
}
+function fixup_graph_timespan($timespan) {
+ switch ($timespan) {
+ case "8hour":
+ return "eighthour";
+ case "4year":
+ return "fouryear";
+ default:
+ return $timespan;
+ }
+}
+
?>
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml
index fe0b98b6..803e205b 100644
--- a/config/mailreport/mailreport.xml
+++ b/config/mailreport/mailreport.xml
@@ -37,7 +37,7 @@
]]>
</copyright>
<name>mailreport</name>
- <version>2.0.10</version>
+ <version>2.1</version>
<title>Status: Email Reports</title>
<additional_files_needed>
<prefix>/usr/local/bin/</prefix>
diff --git a/config/mailreport/status_mail_report_add_graph.php b/config/mailreport/status_mail_report_add_graph.php
index 3f629d56..d6f0d362 100644
--- a/config/mailreport/status_mail_report_add_graph.php
+++ b/config/mailreport/status_mail_report_add_graph.php
@@ -130,16 +130,16 @@ $custom_databases = array_merge($dbheader_custom, $databases);
$styles = array('inverse' => gettext('Inverse'),
'absolute' => gettext('Absolute'));
-$graphs = array("8hour", "day", "week", "month", "quarter", "year", "4year");
+$graphs = array("eighthour", "day", "week", "month", "quarter", "year", "fouryear");
$periods = array("absolute" => gettext("Absolute Timespans"), "current" => gettext("Current Period"), "previous" => gettext("Previous Period"));
$graph_length = array(
- "8hour" => 28800,
+ "eighthour" => 28800,
"day" => 86400,
"week" => 604800,
"month" => 2764800,
"quarter" => 8035200,
"year" => 31622400,
- "4year" => 126489600);
+ "fouryear" => 126489600);
if ($_POST) {
unset($_POST['__csrf_magic']);
@@ -219,6 +219,7 @@ include("head.inc");
<select name="timespan" class="formselect" style="z-index: -10;">
<?php
foreach (array_keys($graph_length) as $timespan) {
+ $pconfig['timespan'] = fixup_graph_timespan($pconfig['timespan']);
echo "<option value=\"$timespan\"";
if ($timespan == $pconfig['timespan']) echo " selected";
echo ">" . htmlspecialchars(ucwords($timespan)) . "</option>\n";