aboutsummaryrefslogtreecommitdiffstats
path: root/config/mailreport
diff options
context:
space:
mode:
authorDaniel Hunsaker <danhunsaker@gmail.com>2014-01-08 09:32:41 -0700
committerDaniel Hunsaker <danhunsaker@gmail.com>2014-01-08 09:32:41 -0700
commit6e61f09defd4f204a7b982653d9c49c98ebbe648 (patch)
tree44c34780779d696d031020ebc8e5b83a15f4a857 /config/mailreport
parenta2073ee9c35e1a82412852ff78d0b3a37eea2d5c (diff)
downloadpfsense-packages-6e61f09defd4f204a7b982653d9c49c98ebbe648.tar.gz
pfsense-packages-6e61f09defd4f204a7b982653d9c49c98ebbe648.tar.bz2
pfsense-packages-6e61f09defd4f204a7b982653d9c49c98ebbe648.zip
Added quarterly and yearly mailreport frequencies
- Defined frequencies for quarterly and yearly mail reports - Extended frequency-to-crontab conversion logic to cover new frequency settings - Added form elements for new frequency configurations - Bumped version number, and added files to deinstall command for cleaner removal Signed-off-by: Daniel Hunsaker <danhunsaker@gmail.com>
Diffstat (limited to 'config/mailreport')
-rw-r--r--config/mailreport/mailreport.xml4
-rw-r--r--config/mailreport/status_mail_report_edit.php93
2 files changed, 86 insertions, 11 deletions
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml
index 5a759984..3b926753 100644
--- a/config/mailreport/mailreport.xml
+++ b/config/mailreport/mailreport.xml
@@ -37,7 +37,7 @@
]]>
</copyright>
<name>mailreport</name>
- <version>2.0.6</version>
+ <version>2.0.7</version>
<title>Status: Mail Reports</title>
<additional_files_needed>
<prefix>/usr/local/bin/</prefix>
@@ -96,6 +96,8 @@
exec("rmdir /usr/local/etc/phpmailer");
exec("rm /usr/local/www/status_mail_report.php");
exec("rm /usr/local/www/status_mail_report_edit.php");
+ exec("rm /usr/local/www/status_mail_report_add_cmd.php");
+ exec("rm /usr/local/www/status_mail_report_add_log.php");
exec("rm /usr/local/www/status_mail_report_add_graph.php");
]]>
</custom_php_deinstall_command>
diff --git a/config/mailreport/status_mail_report_edit.php b/config/mailreport/status_mail_report_edit.php
index 9e6bb071..6572c370 100644
--- a/config/mailreport/status_mail_report_edit.php
+++ b/config/mailreport/status_mail_report_edit.php
@@ -91,17 +91,35 @@ if ($_GET['act'] == "del") {
}
}
-$frequencies = array("daily", "weekly", "monthly");
+$frequencies = array("daily", "weekly", "monthly", "quarterly", "yearly");
$daysofweek = array(
"" => "",
- "0" => "sunday",
- "1" => "monday",
- "2" => "tuesday",
- "3" => "wednesday",
- "4" => "thursday",
- "5" => "friday",
- "6" => "saturday");
+ "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']);
@@ -131,11 +149,40 @@ if ($_POST) {
if ($pconfig['frequency'] == "monthly") {
$pconfig['dayofmonth'] = isset($pconfig['dayofmonth']) ? $pconfig['dayofmonth'] : 1;
$friendly = "Monthly, on day {$pconfig['dayofmonth']} at {$friendlytime}";
- } else {
+ } 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}";
+ } else {
+ if (isset($pconfig['monthofyear']))
+ unset($pconfig['monthofyear']);
+ }
+
// Copy back into the schedule.
$pconfig['cmd']["row"] = $a_cmds;
$pconfig['log']["row"] = $a_logs;
@@ -214,7 +261,33 @@ include("head.inc");
<option value="<?php echo $dom; ?>" <?php if($pconfig["dayofmonth"] === $dom) echo "selected"; ?>><?php echo $dom; ?></option>
<?php endforeach; ?>
</select>
- <br/>Select the day of the month to send the report. Only valid for monthly reports.
+ <br/>Select the day of the month to send the report. Only valid for monthly and yearly reports.
+ <br/>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td class="vncell" valign="top" colspan="1">Time of Quarter</td>
+ <td class="vtable" colspan="3">
+ <select name="monthofquarter">
+ <?php foreach($monthofquarter as $moq): ?>
+ <option value="<?php echo $moq; ?>" <?php if($pconfig["monthofquarter"] === $moq) echo "selected"; ?>><?php echo $moq; ?></option>
+ <?php endforeach; ?>
+ </select>
+ <br/>Select the time of the quarter to send the report. Only valid for quarter reports.
+ <br/>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td class="vncell" valign="top" colspan="1">Month of the Year</td>
+ <td class="vtable" colspan="3">
+ <select name="monthofyear">
+ <?php foreach($monthofyear as $moy): ?>
+ <option value="<?php echo $moy; ?>" <?php if($pconfig["monthofyear"] === $moy) echo "selected"; ?>><?php echo $moy; ?></option>
+ <?php endforeach; ?>
+ </select>
+ <br/>Select the month of the year to send the report. Only valid for yearly reports.
<br/>
</td>
<td></td>