summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_rules.php
diff options
context:
space:
mode:
authorScott Dale <sdale@pfsense.org>2007-04-24 00:43:50 +0000
committerScott Dale <sdale@pfsense.org>2007-04-24 00:43:50 +0000
commit8ce97a08cce3743cfda46b6df37542cdf1bf0ec1 (patch)
tree5be041cb898f6a7cd07bccd173d6c4b9999f776a /usr/local/www/firewall_rules.php
parent9ce384096ac052ae45051085a406c9680bf9140a (diff)
downloadpfsense-8ce97a08cce3743cfda46b6df37542cdf1bf0ec1.zip
pfsense-8ce97a08cce3743cfda46b6df37542cdf1bf0ec1.tar.gz
check if schedule config is array first
MFC: asap
Diffstat (limited to 'usr/local/www/firewall_rules.php')
-rwxr-xr-xusr/local/www/firewall_rules.php164
1 files changed, 83 insertions, 81 deletions
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index d1455df..1bf4bc5 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -395,103 +395,105 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript
$schedstatus = false;
$dayArray = array ('Mon','Tues','Wed','Thur','Fri','Sat','Sun');
$monthArray = array ('January','February','March','April','May','June','July','August','September','October','November','December');
- foreach ($a_schedules as $schedule)
- {
- if ($schedule['name'] == $filterent['sched'] ){
- $schedstatus = get_time_based_rule_status($schedule);
-
- foreach($schedule['timerange'] as $timerange) {
- $tempFriendlyTime = "";
- $tempID = "";
- $firstprint = false;
- if ($timerange){
- $dayFriendly = "";
- $tempFriendlyTime = "";
-
- //get hours
- $temptimerange = $timerange['hour'];
- $temptimeseparator = strrpos($temptimerange, "-");
-
- $starttime = substr ($temptimerange, 0, $temptimeseparator);
- $stoptime = substr ($temptimerange, $temptimeseparator+1);
+ if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])){
+ foreach ($a_schedules as $schedule)
+ {
+ if ($schedule['name'] == $filterent['sched'] ){
+ $schedstatus = get_time_based_rule_status($schedule);
+
+ foreach($schedule['timerange'] as $timerange) {
+ $tempFriendlyTime = "";
+ $tempID = "";
+ $firstprint = false;
+ if ($timerange){
+ $dayFriendly = "";
+ $tempFriendlyTime = "";
+
+ //get hours
+ $temptimerange = $timerange['hour'];
+ $temptimeseparator = strrpos($temptimerange, "-");
- if ($timerange['month']){
- $tempmontharray = explode(",", $timerange['month']);
- $tempdayarray = explode(",",$timerange['day']);
- $arraycounter = 0;
- $firstDayFound = false;
- $firstPrint = false;
- foreach ($tempmontharray as $monthtmp){
- $month = $tempmontharray[$arraycounter];
- $day = $tempdayarray[$arraycounter];
+ $starttime = substr ($temptimerange, 0, $temptimeseparator);
+ $stoptime = substr ($temptimerange, $temptimeseparator+1);
- if (!$firstDayFound)
- {
- $firstDay = $day;
- $firstmonth = $month;
- $firstDayFound = true;
- }
+ if ($timerange['month']){
+ $tempmontharray = explode(",", $timerange['month']);
+ $tempdayarray = explode(",",$timerange['day']);
+ $arraycounter = 0;
+ $firstDayFound = false;
+ $firstPrint = false;
+ foreach ($tempmontharray as $monthtmp){
+ $month = $tempmontharray[$arraycounter];
+ $day = $tempdayarray[$arraycounter];
- $currentDay = $day;
- $nextDay = $tempdayarray[$arraycounter+1];
- $currentDay++;
- if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
- if ($firstPrint)
- $dayFriendly .= ", ";
- $currentDay--;
- if ($currentDay != $firstDay)
- $dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
- else
- $dayFriendly .= $monthArray[$month-1] . " " . $day;
- $firstDayFound = false;
- $firstPrint = true;
- }
- $arraycounter++;
- }
- }
- else
- {
- $tempdayFriendly = $timerange['position'];
- $firstDayFound = false;
- $tempFriendlyDayArray = explode(",", $tempdayFriendly);
- $currentDay = "";
- $firstDay = "";
- $nextDay = "";
- $counter = 0;
- foreach ($tempFriendlyDayArray as $day){
- if ($day != ""){
if (!$firstDayFound)
{
- $firstDay = $tempFriendlyDayArray[$counter];
+ $firstDay = $day;
+ $firstmonth = $month;
$firstDayFound = true;
}
- $currentDay =$tempFriendlyDayArray[$counter];
- //get next day
- $nextDay = $tempFriendlyDayArray[$counter+1];
- $currentDay++;
- if ($currentDay != $nextDay){
- if ($firstprint)
+
+ $currentDay = $day;
+ $nextDay = $tempdayarray[$arraycounter+1];
+ $currentDay++;
+ if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
+ if ($firstPrint)
$dayFriendly .= ", ";
$currentDay--;
if ($currentDay != $firstDay)
- $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
+ $dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
else
- $dayFriendly .= $dayArray[$firstDay-1];
+ $dayFriendly .= $monthArray[$month-1] . " " . $day;
$firstDayFound = false;
- $firstprint = true;
- }
- $counter++;
+ $firstPrint = true;
+ }
+ $arraycounter++;
}
}
- }
- $timeFriendly = $starttime . " - " . $stoptime;
- $description = $timerange['rangedescr'];
- $sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>";
+ else
+ {
+ $tempdayFriendly = $timerange['position'];
+ $firstDayFound = false;
+ $tempFriendlyDayArray = explode(",", $tempdayFriendly);
+ $currentDay = "";
+ $firstDay = "";
+ $nextDay = "";
+ $counter = 0;
+ foreach ($tempFriendlyDayArray as $day){
+ if ($day != ""){
+ if (!$firstDayFound)
+ {
+ $firstDay = $tempFriendlyDayArray[$counter];
+ $firstDayFound = true;
+ }
+ $currentDay =$tempFriendlyDayArray[$counter];
+ //get next day
+ $nextDay = $tempFriendlyDayArray[$counter+1];
+ $currentDay++;
+ if ($currentDay != $nextDay){
+ if ($firstprint)
+ $dayFriendly .= ", ";
+ $currentDay--;
+ if ($currentDay != $firstDay)
+ $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
+ else
+ $dayFriendly .= $dayArray[$firstDay-1];
+ $firstDayFound = false;
+ $firstprint = true;
+ }
+ $counter++;
+ }
+ }
+ }
+ $timeFriendly = $starttime . " - " . $stoptime;
+ $description = $timerange['rangedescr'];
+ $sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>";
+ }
}
+ $sched_caption = $schedule['descr'];
+ $schedule_span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$sched_caption</h1><p>$sched_content</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>";
+ $schedule_span_end = "</U></span>";
}
- $sched_caption = $schedule['descr'];
- $schedule_span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$sched_caption</h1><p>$sched_content</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>";
- $schedule_span_end = "</U></span>";
}
}
OpenPOWER on IntegriCloud