All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* pfSense_MODULE: system */ ##|+PRIV ##|*IDENT=page-status-mailreportsedit ##|*NAME=Status: Email Reports: Edit Report page ##|*DESCR=Allow access to the 'Status: Email Reports: Edit Report' page. ##|*MATCH=status_mail_report_edit.php* ##|-PRIV require("guiconfig.inc"); require_once("mail_reports.inc"); $cmdid = $_REQUEST['cmdid']; $logid = $_REQUEST['logid']; $graphid = $_REQUEST['graphid']; $id = $_REQUEST['id']; if (!is_array($config['mailreports']['schedule'])) $config['mailreports']['schedule'] = array(); $a_mailreports = &$config['mailreports']['schedule']; if (isset($id) && $a_mailreports[$id]) { if (!is_array($a_mailreports[$id]['row'])) $a_mailreports[$id]['row'] = array(); $pconfig = $a_mailreports[$id]; $a_cmds = $a_mailreports[$id]['cmd']['row']; $a_logs = $a_mailreports[$id]['log']['row']; $a_graphs = $a_mailreports[$id]['row']; } if (!is_array($pconfig)) $pconfig = array(); if (!is_array($a_cmds)) $a_cmds = array(); if (!is_array($a_logs)) $a_logs = array(); if (!is_array($a_graphs)) $a_graphs = array(); if ($_GET['act'] == "del") { if (is_numeric($cmdid) && $a_cmds[$cmdid]) { unset($a_cmds[$cmdid]); $a_mailreports[$id]['cmd']['row'] = $a_cmds; write_config(); header("Location: status_mail_report_edit.php?id={$id}"); return; } elseif (is_numeric($logid) && $a_logs[$logid]) { unset($a_logs[$logid]); $a_mailreports[$id]['log']['row'] = $a_logs; write_config(); header("Location: status_mail_report_edit.php?id={$id}"); return; } elseif (is_numeric($graphid) && $a_graphs[$graphid]) { unset($a_graphs[$graphid]); $a_mailreports[$id]['row'] = $a_graphs; write_config(); header("Location: status_mail_report_edit.php?id={$id}"); return; } } $frequencies = array("daily", "weekly", "monthly", "quarterly", "yearly"); $daysofweek = array( "" => "", "0" => "Sunday", "1" => "Monday", "2" => "Tuesday", "3" => "Wednesday", "4" => "Thursday", "5" => "Friday", "6" => "Saturday"); $dayofmonth = array("", "1", "15"); $monthofquarter = array( "" => "", "1" => "beginning", "2" => "middle"); $monthofyear = array( "" => "", "1" => "January", "2" => "February", "3" => "March", "4" => "April", "5" => "May", "6" => "June", "7" => "July", "8" => "August", "9" => "September", "10" => "October", "11" => "November", "12" => "December"); if ($_POST) { unset($_POST['__csrf_magic']); $pconfig = $_POST; if ($_POST['Submit'] == "Send Now") { mwexec_bg("/usr/local/bin/mail_reports_generate.php {$id}"); header("Location: status_mail_report_edit.php?id={$id}"); return; } $friendly = ""; // Default to midnight if unset/invalid. $pconfig['timeofday'] = isset($pconfig['timeofday']) ? $pconfig['timeofday'] : 0; $friendlytime = sprintf("%02d:00", $pconfig['timeofday']); $friendly = "Daily at {$friendlytime}"; // If weekly, check for day of week if ($pconfig['frequency'] == "weekly") { $pconfig['dayofweek'] = isset($pconfig['dayofweek']) ? $pconfig['dayofweek'] : 0; $friendly = "Weekly, on {$daysofweek[$pconfig['dayofweek']]} at {$friendlytime}"; } else { if (isset($pconfig['dayofweek'])) unset($pconfig['dayofweek']); } // If monthly, check for day of the month if ($pconfig['frequency'] == "monthly") { $pconfig['dayofmonth'] = isset($pconfig['dayofmonth']) ? $pconfig['dayofmonth'] : 1; $friendly = "Monthly, on day {$pconfig['dayofmonth']} at {$friendlytime}"; } elseif ($pconfig['frequency'] != "yearly") { if (isset($pconfig['dayofmonth'])) unset($pconfig['dayofmonth']); } // If quarterly, check for day of the month if ($pconfig['frequency'] == "quarterly") { $pconfig['monthofquarter'] = isset($pconfig['monthofquarter']) ? $pconfig['monthofquarter'] : 1; $friendly = "Quarterly, at the {$monthofquarter[$pconfig['monthofquarter']]}, at {$friendlytime}"; switch ($pconfig['monthofquarter']) { case 2: $pconfig['dayofmonth'] = 15; $pconfig['monthofyear'] = "2,5,8,11"; break; case 1: default: $pconfig['dayofmonth'] = 1; $pconfig['monthofyear'] = "1,4,7,10"; break; } } else { if (isset($pconfig['monthofquarter'])) unset($pconfig['monthofquarter']); } // If yearly, check for day of the month if ($pconfig['frequency'] == "yearly") { $pconfig['monthofyear'] = isset($pconfig['monthofyear']) ? $pconfig['monthofyear'] : 1; $friendly = "Yearly, on day {$pconfig['dayofmonth']} of {$monthofyear[$pconfig['monthofyear']]} at {$friendlytime}"; } elseif ($pconfig['frequency'] != "quarterly") { if (isset($pconfig['monthofyear'])) unset($pconfig['monthofyear']); } // Copy back into the schedule. $pconfig['cmd']["row"] = $a_cmds; $pconfig['log']["row"] = $a_logs; $pconfig["row"] = $a_graphs; $pconfig['schedule_friendly'] = $friendly; if (isset($id) && $a_mailreports[$id]) $a_mailreports[$id] = $pconfig; else $a_mailreports[] = $pconfig; // Fix up cron job(s) set_mail_report_cron_jobs($a_mailreports); write_config(); configure_cron(); header("Location: status_mail_report.php"); return; } $pgtitle = array(gettext("Status"),gettext("Edit Email Reports")); include("head.inc"); ?>
General Settings
Report Schedule
Frequency
Select the frequency for the report to be sent via email.
Day of the Week
Select the day of the week to send the report. Only valid for weekly reports.
Day of the Month
Select the day of the month to send the report. Only valid for monthly and yearly reports.
Time of Quarter
Select the time of the quarter to send the report. Only valid for quarter reports.
Month of the Year
Select the month of the year to send the report. Only valid for yearly reports.
Hour of Day
Select the hour of the day when the report should be sent. Be aware that scheduling reports between 1am-3am can cause issues during DST switches in zones that have them. Valid for any type of report.
Report Commands

Save the report first, then items may be added.
  ')">
Report Logs

Save the report first, then items may be added.
  ')">
Report Graphs

Save the report first, then items may be added.
  ')">
"> "> ">



Configure your SMTP settings under System -> Advanced, on the Notifications tab.