aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/mailreport/mail_reports.inc32
-rw-r--r--config/mailreport/mail_reports_generate.php4
-rw-r--r--config/mailreport/mailreport.xml2
-rw-r--r--config/mailreport/status_mail_report_add_cmd.php8
-rw-r--r--config/mailreport/status_mail_report_add_log.php6
-rw-r--r--config/mailreport/status_mail_report_edit.php2
6 files changed, 44 insertions, 10 deletions
diff --git a/config/mailreport/mail_reports.inc b/config/mailreport/mail_reports.inc
index 7d68055d..85b67ddf 100644
--- a/config/mailreport/mail_reports.inc
+++ b/config/mailreport/mail_reports.inc
@@ -43,6 +43,28 @@ $graph_length = array(
"year" => 31622400,
"4year" => 126489600);
+$logfile_friendly = array(
+ "dhcpd" => "DHCP",
+ "filter" => "Firewall (raw)",
+ "gateways" => "Gateway Events",
+ "installer" => "Installation",
+ "ipsec" => "IPsec VPN",
+ "l2tps" => "L2TP Server (raw)",
+ "lighttpd" => "Web Server (lighttpd)",
+ "ntpd" => "NTP",
+ "openvpn" => "OpenVPN",
+ "poes" => "PPPoE Server (raw)",
+ "portalauth" => "Captive Portal Authentication",
+ "ppp" => "PPP",
+ "pptps" => "PPTP Server (raw)",
+ "relayd" => "Load Balancer (relayd)",
+ "resolver" => "DNS Resolver",
+ "routing" => "Routing",
+ "system" => "System",
+ "vpn" => "PPTP/L2TP/PPPoE Server Login Events",
+ "wireless" => "Wireless"
+);
+
function get_dates($curperiod, $graph) {
global $graph_length;
$now = time();
@@ -208,7 +230,7 @@ function mail_report_send($headertext, $cmdtext, $logtext, $attachments) {
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
- echo "<strong>Message sent to {$userid}!</strong>\n";
+ echo "<strong>Message sent to {$address}!</strong>\n";
}
}
@@ -1226,4 +1248,12 @@ function mail_report_get_log($logfile, $tail, $grepfor) {
return($logarr);
}
+function get_friendly_log_name($logfile) {
+ global $logfile_friendly;
+ $friendly = str_replace(".log", "", $logfile);
+ if (!empty($logfile_friendly[$friendly]))
+ $friendly = $logfile_friendly[$friendly];
+ return $friendly;
+}
+
?>
diff --git a/config/mailreport/mail_reports_generate.php b/config/mailreport/mail_reports_generate.php
index 81205ecb..a784c596 100644
--- a/config/mailreport/mail_reports_generate.php
+++ b/config/mailreport/mail_reports_generate.php
@@ -69,7 +69,7 @@ if ((!is_array($cmds) || !(count($cmds) > 0))
$cmdtext = "";
foreach ($cmds as $cmd) {
$output = "";
- $cmdtext .= "Command output for {$cmd['descr']}<br />\n";
+ $cmdtext .= "Command output: {$cmd['descr']} (" . htmlspecialchars($cmd['detail']) . ")<br />\n";
exec($cmd['detail'], $output);
$cmdtext .= "<pre>\n";
$cmdtext .= implode("\n", $output);
@@ -81,7 +81,7 @@ $logtext = "";
foreach ($logs as $log) {
$lines = empty($log['lines']) ? 50 : $log['lines'];
$filter = empty($log['detail']) ? null : array($log['detail']);
- $logtext .= "Log output for {$log['logfile']}<br />\n";
+ $logtext .= "Log output: " . get_friendly_log_name($log['logfile']) . " ({$log['logfile']})<br />\n";
$logtext .= "<pre>\n";
$logtext .= implode("\n", mail_report_get_log($log['logfile'], $lines, $filter));
$logtext .= "\n</pre>";
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml
index a437851c..d27d3a28 100644
--- a/config/mailreport/mailreport.xml
+++ b/config/mailreport/mailreport.xml
@@ -37,7 +37,7 @@
]]>
</copyright>
<name>mailreport</name>
- <version>2.0</version>
+ <version>2.0.4</version>
<title>Status: Mail Reports</title>
<additional_files_needed>
<prefix>/usr/local/bin/</prefix>
diff --git a/config/mailreport/status_mail_report_add_cmd.php b/config/mailreport/status_mail_report_add_cmd.php
index adbdcd77..4a82f051 100644
--- a/config/mailreport/status_mail_report_add_cmd.php
+++ b/config/mailreport/status_mail_report_add_cmd.php
@@ -118,6 +118,14 @@ include("head.inc");
</td>
</tr>
<tr>
+ <td>&nbsp;</td>
+ <td>
+ <br/>NOTE: The command will be run during the report and its stdout output will be included in the report body. Be extremely careful what commands you choose to run, the same warnings apply as those when using Diagnostics &gt; Command.
+ <br/>
+ <br/>Do not use this solely as a way to run a command on a schedule, use the Cron package for that purpose instead.
+ </td>
+ </tr>
+ <tr>
<td colspan="2" align="center">
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>">
<a href="status_mail_report_edit.php?id=<?php echo $reportid;?>"><input name="cancel" type="button" class="formbtn" value="<?=gettext("Cancel");?>"></a>
diff --git a/config/mailreport/status_mail_report_add_log.php b/config/mailreport/status_mail_report_add_log.php
index 5a2261be..75d092b5 100644
--- a/config/mailreport/status_mail_report_add_log.php
+++ b/config/mailreport/status_mail_report_add_log.php
@@ -72,9 +72,6 @@ if (isset($id) && !($a_logs[$id])) {
return;
}
-
-
-
$logpath = "/var/log/";
chdir($logpath);
$logfiles = glob("*.log");
@@ -118,12 +115,11 @@ include("head.inc");
<select name="logfile" class="formselect" style="z-index: -10;">
<?php
foreach ($logfiles as $logfile) {
- $friendly = str_replace(".log", "", $logfile);
echo "<option value=\"{$logfile}\"";
if ($pconfig['logfile'] == $logfile) {
echo " selected";
}
- echo ">" . htmlspecialchars($friendly) . "</option>\n";
+ echo ">" . htmlspecialchars(get_friendly_log_name($logfile)) . "</option>\n";
}
?>
</select>
diff --git a/config/mailreport/status_mail_report_edit.php b/config/mailreport/status_mail_report_edit.php
index c1289442..7ddb4c36 100644
--- a/config/mailreport/status_mail_report_edit.php
+++ b/config/mailreport/status_mail_report_edit.php
@@ -293,7 +293,7 @@ include("head.inc");
</tr>
<?php $i = 0; foreach ($a_logs as $log): ?>
<tr ondblclick="document.location='status_mail_report_add_log.php?reportid=<?php echo $id ;?>&amp;id=<?=$i;?>'">
- <td class="listlr"><?php echo $log['logfile']; ?></td>
+ <td class="listlr"><?php echo get_friendly_log_name($log['logfile']); ?></td>
<td class="listlr"><?php echo $log['lines']; ?></td>
<td colspan="2" class="listlr"><?php echo $log['detail']; ?></td>
<td valign="middle" nowrap class="list">