Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
972737ec
Commit
972737ec
authored
Aug 25, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) refactor firewall_schedule_edit.php
parent
9ac2f805
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1052 additions
and
1109 deletions
+1052
-1109
firewall_schedule_edit.php
src/www/firewall_schedule_edit.php
+1052
-1109
No files found.
src/www/firewall_schedule_edit.php
View file @
972737ec
...
@@ -75,108 +75,94 @@ function schedule_sort(){
...
@@ -75,108 +75,94 @@ function schedule_sort(){
usort
(
$config
[
'schedules'
][
'schedule'
],
"schedulecmp"
);
usort
(
$config
[
'schedules'
][
'schedule'
],
"schedulecmp"
);
}
}
$pgtitle
=
array
(
gettext
(
"Firewall"
),
gettext
(
"Schedules"
),
gettext
(
"Edit"
));
$referer
=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/firewall_schedule.php'
);
$dayArray
=
array
(
gettext
(
'Mon'
),
gettext
(
'Tues'
),
gettext
(
'Wed'
),
gettext
(
'Thur'
),
gettext
(
'Fri'
),
gettext
(
'Sat'
),
gettext
(
'Sun'
));
$dayArray
=
array
(
gettext
(
'Mon'
),
gettext
(
'Tues'
),
gettext
(
'Wed'
),
gettext
(
'Thur'
),
gettext
(
'Fri'
),
gettext
(
'Sat'
),
gettext
(
'Sun'
));
$monthArray
=
array
(
gettext
(
'January'
),
gettext
(
'February'
),
gettext
(
'March'
),
gettext
(
'April'
),
gettext
(
'May'
),
gettext
(
'June'
),
gettext
(
'July'
),
gettext
(
'August'
),
gettext
(
'September'
),
gettext
(
'October'
),
gettext
(
'November'
),
gettext
(
'December'
));
$monthArray
=
array
(
gettext
(
'January'
),
gettext
(
'February'
),
gettext
(
'March'
),
gettext
(
'April'
),
gettext
(
'May'
),
gettext
(
'June'
),
gettext
(
'July'
),
gettext
(
'August'
),
gettext
(
'September'
),
gettext
(
'October'
),
gettext
(
'November'
),
gettext
(
'December'
));
if
(
!
is_array
(
$config
[
'schedules'
][
'schedule'
]))
$config
[
'schedules'
][
'schedule'
]
=
array
();
if
(
!
isset
(
$config
[
'schedules'
][
'schedule'
]))
{
$config
[
'schedules'
][
'schedule'
]
=
array
();
}
$a_schedules
=
&
$config
[
'schedules'
][
'schedule'
];
$a_schedules
=
&
$config
[
'schedules'
][
'schedule'
];
if
(
is_numericint
(
$_GET
[
'id'
]))
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
$id
=
$_GET
[
'id'
];
// input record id, if valid
if
(
isset
(
$_POST
[
'id'
])
&&
is_numericint
(
$_POST
[
'id'
]))
if
(
!
empty
(
$_GET
[
'name'
]))
{
$id
=
$_POST
[
'id'
];
// quick hack, cleanup follows
if
(
!
empty
(
$_GET
[
'name'
]))
{
foreach
(
$a_schedules
as
$i
=>
$sched
)
{
foreach
(
$a_schedules
as
$i
=>
$sched
)
{
if
(
$sched
[
'name'
]
==
$_GET
[
'name'
])
{
if
(
$sched
[
'name'
]
==
$_GET
[
'name'
])
{
$id
=
$i
;
$id
=
$i
;
break
;
break
;
}
}
}
}
}
}
elseif
(
isset
(
$_GET
[
'dup'
])
&&
isset
(
$a_schedules
[
$_GET
[
'dup'
]]))
{
$configId
=
$_GET
[
'dup'
];
if
(
isset
(
$id
)
&&
$a_schedules
[
$id
])
{
}
elseif
(
isset
(
$_GET
[
'id'
])
&&
isset
(
$a_schedules
[
$_GET
[
'id'
]]))
{
$pconfig
[
'name'
]
=
$a_schedules
[
$id
][
'name'
];
$id
=
$_GET
[
'id'
];
$pconfig
[
'descr'
]
=
html_entity_decode
(
$a_schedules
[
$id
][
'descr'
]);
$configId
=
$id
;
$pconfig
[
'timerange'
]
=
$a_schedules
[
$id
][
'timerange'
];
}
$pconfig
[
'schedlabel'
]
=
$a_schedules
[
$id
][
'schedlabel'
];
$pconfig
[
'name'
]
=
$a_schedules
[
$configId
][
'name'
];
$getSchedule
=
true
;
$pconfig
[
'descr'
]
=
$a_schedules
[
$configId
][
'descr'
];
}
$pconfig
[
'timerange'
]
=
isset
(
$a_schedules
[
$configId
][
'timerange'
])
?
$a_schedules
[
$configId
][
'timerange'
]
:
array
();
$pconfig
[
'schedlabel'
]
=
isset
(
$a_schedules
[
$configId
][
'schedlabel'
])
?
$a_schedules
[
$configId
][
'schedlabel'
]
:
uniqid
();
if
(
$_POST
)
{
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
if
(
isset
(
$_POST
[
'id'
])
&&
isset
(
$a_schedules
[
$_POST
[
'id'
]]))
{
$id
=
$_POST
[
'id'
];
}
$pconfig
=
$_POST
;
if
(
strtolower
(
$_POST
[
'name'
])
==
"lan"
)
// validate
if
(
strtolower
(
$pconfig
[
'name'
])
==
"lan"
)
$input_errors
[]
=
gettext
(
"Schedule may not be named LAN."
);
$input_errors
[]
=
gettext
(
"Schedule may not be named LAN."
);
if
(
strtolower
(
$_POST
[
'name'
])
==
"wan"
)
if
(
strtolower
(
$pconfig
[
'name'
])
==
"wan"
)
$input_errors
[]
=
gettext
(
"Schedule may not be named WAN."
);
$input_errors
[]
=
gettext
(
"Schedule may not be named WAN."
);
if
(
strtolower
(
$_POST
[
'name'
])
==
""
)
if
(
strtolower
(
$pconfig
[
'name'
])
==
""
)
$input_errors
[]
=
gettext
(
"Schedule name cannot be blank."
);
$input_errors
[]
=
gettext
(
"Schedule name cannot be blank."
);
$x
=
is_validaliasname
(
$pconfig
[
'name'
]);
$x
=
is_validaliasname
(
$_POST
[
'name'
]);
if
(
!
isset
(
$x
))
{
if
(
!
isset
(
$x
))
{
$input_errors
[]
=
gettext
(
"Reserved word used for schedule name."
);
$input_errors
[]
=
gettext
(
"Reserved word used for schedule name."
);
}
else
{
}
elseif
(
$x
==
false
)
{
if
(
is_validaliasname
(
$_POST
[
'name'
])
==
false
)
$input_errors
[]
=
gettext
(
"The schedule name may only consist of the characters a-z, A-Z, 0-9"
);
$input_errors
[]
=
gettext
(
"The schedule name may only consist of the characters a-z, A-Z, 0-9"
);
}
}
/* check for name conflicts */
/* check for name conflicts */
foreach
(
$a_schedules
as
$schedule
)
{
foreach
(
$a_schedules
as
$schedId
=>
$schedule
)
{
if
(
isset
(
$id
)
&&
(
$a_schedules
[
$id
])
&&
(
$a_schedules
[
$id
]
===
$schedule
))
if
(
$schedId
!=
$id
&&
$schedule
[
'name'
]
==
$pconfig
[
'name'
])
{
continue
;
if
(
$schedule
[
'name'
]
==
$_POST
[
'name'
])
{
$input_errors
[]
=
gettext
(
"A Schedule with this name already exists."
);
$input_errors
[]
=
gettext
(
"A Schedule with this name already exists."
);
break
;
break
;
}
}
}
}
$schedule
=
array
();
$schedule
[
'name'
]
=
$_POST
[
'name'
];
// parse time ranges
$schedule
[
'descr'
]
=
htmlentities
(
$_POST
[
'descr'
],
ENT_QUOTES
,
'UTF-8'
);
$pconfig
[
'timerange'
]
=
array
(
);
$timerangeFound
=
false
;
$timerangeFound
=
false
;
for
(
$x
=
0
;
$x
<
99
;
$x
++
){
for
(
$x
=
0
;
$x
<
99
;
$x
++
){
if
(
$_POST
[
'schedule'
.
$x
])
{
if
(
$pconfig
[
'schedule'
.
$x
])
{
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$_POST
[
'starttime'
.
$x
]))
{
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$pconfig
[
'starttime'
.
$x
]))
{
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid start time - '%s'"
),
$_POST
[
'starttime'
.
$x
]);
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid start time - '%s'"
),
$pconfig
[
'starttime'
.
$x
]);
continue
;
continue
;
}
}
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$_POST
[
'stoptime'
.
$x
]))
{
if
(
!
preg_match
(
'/^[0-9]+:[0-9]+$/'
,
$pconfig
[
'stoptime'
.
$x
]))
{
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid stop time - '%s'"
),
$_POST
[
'stoptime'
.
$x
]);
$input_errors
[]
=
sprintf
(
gettext
(
"Invalid stop time - '%s'"
),
$pconfig
[
'stoptime'
.
$x
]);
continue
;
continue
;
}
}
$timerangeFound
=
true
;
$timerangeFound
=
true
;
$timeparts
=
array
();
$timeparts
=
array
();
$firstprint
=
false
;
$firstprint
=
false
;
$timestr
=
$_POST
[
'schedule'
.
$x
];
$timestr
=
$pconfig
[
'schedule'
.
$x
];
$timehourstr
=
$_POST
[
'starttime'
.
$x
];
$timehourstr
=
$pconfig
[
'starttime'
.
$x
];
$timehourstr
.=
"-"
;
$timehourstr
.=
"-"
;
$timehourstr
.=
$_POST
[
'stoptime'
.
$x
];
$timehourstr
.=
$pconfig
[
'stoptime'
.
$x
];
$timedescrstr
=
htmlentities
(
$_POST
[
'timedescr'
.
$x
],
ENT_QUOTES
,
'UTF-8'
);
$timedescrstr
=
htmlentities
(
$pconfig
[
'timedescr'
.
$x
],
ENT_QUOTES
,
'UTF-8'
);
$dashpos
=
strpos
(
$timestr
,
'-'
);
$dashpos
=
strpos
(
$timestr
,
'-'
);
if
(
$dashpos
===
false
)
if
(
$dashpos
===
false
)
{
{
$timeparts
[
'position'
]
=
$timestr
;
$timeparts
[
'position'
]
=
$timestr
;
}
}
else
{
else
{
$tempindarray
=
array
();
$tempindarray
=
array
();
$monthstr
=
""
;
$monthstr
=
""
;
$daystr
=
""
;
$daystr
=
""
;
$tempindarray
=
explode
(
","
,
$timestr
);
$tempindarray
=
explode
(
","
,
$timestr
);
foreach
(
$tempindarray
as
$currentselection
)
foreach
(
$tempindarray
as
$currentselection
)
{
{
if
(
$currentselection
){
if
(
$currentselection
){
if
(
$firstprint
)
if
(
$firstprint
)
{
{
$monthstr
.=
","
;
$monthstr
.=
","
;
$daystr
.=
","
;
$daystr
.=
","
;
}
}
...
@@ -193,52 +179,42 @@ if ($_POST) {
...
@@ -193,52 +179,42 @@ if ($_POST) {
}
}
$timeparts
[
'hour'
]
=
$timehourstr
;
$timeparts
[
'hour'
]
=
$timehourstr
;
$timeparts
[
'rangedescr'
]
=
$timedescrstr
;
$timeparts
[
'rangedescr'
]
=
$timedescrstr
;
$schedule
[
'timerange'
][
$x
]
=
$timeparts
;
$pconfig
[
'timerange'
][
$x
]
=
$timeparts
;
}
}
}
}
if
(
!
$timerangeFound
)
if
(
count
(
$pconfig
[
'timerange'
])
==
0
)
{
$input_errors
[]
=
gettext
(
"The schedule must have at least one time range configured."
);
$input_errors
[]
=
gettext
(
"The schedule must have at least one time range configured."
);
}
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
$schedule
=
array
();
if
(
!
empty
(
$pconfig
[
'schedlabel'
]))
$schedule
[
'name'
]
=
$pconfig
[
'name'
];
$schedule
[
'descr'
]
=
$pconfig
[
'descr'
];
$schedule
[
'timerange'
]
=
$pconfig
[
'timerange'
];
$schedule
[
'schedlabel'
]
=
$pconfig
[
'schedlabel'
];
$schedule
[
'schedlabel'
]
=
$pconfig
[
'schedlabel'
];
else
$schedule
[
'schedlabel'
]
=
uniqid
();
if
(
isset
(
$id
)
&&
$a_schedules
[
$id
])
{
if
(
isset
(
$id
))
{
$a_schedules
[
$id
]
=
$schedule
;
$a_schedules
[
$id
]
=
$schedule
;
}
}
else
{
else
{
$a_schedules
[]
=
$schedule
;
$a_schedules
[]
=
$schedule
;
}
}
schedule_sort
();
schedule_sort
();
if
(
write_config
())
if
(
write_config
())
{
filter_configure
();
filter_configure
();
}
header
(
"Location: firewall_schedule.php"
);
header
(
"Location: firewall_schedule.php"
);
exit
;
exit
;
}
}
//we received input errors, copy data to prevent retype
else
{
if
(
!
$_POST
[
'schedule0'
])
$getSchedule
=
false
;
else
$getSchedule
=
true
;
$pconfig
[
'name'
]
=
$schedule
[
'name'
];
$pconfig
[
'descr'
]
=
$schedule
[
'descr'
];
$pconfig
[
'timerange'
]
=
$schedule
[
'timerange'
];
}
}
}
include
(
"head.inc"
);
/* put your custom HTML head content here */
/* using some of the new function calls */
$pgtitle
=
array
(
gettext
(
"Firewall"
),
gettext
(
"Schedules"
),
gettext
(
"Edit"
));
$jscriptstr
=
<<<EOD
legacy_html_escape_form_data
(
$pconfig
);
include
(
"head.inc"
);
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
//
<!
[
CDATA
[
var
daysSelected
=
""
;
var
daysSelected
=
""
;
...
@@ -376,11 +352,11 @@ function daytoggle(id) {
...
@@ -376,11 +352,11 @@ function daytoggle(id) {
}
}
function
update_month
(){
function
update_month
(){
var indexNum = document.forms[0]
.monthsel.selectedIndex;
var
indexNum
=
document
.
iform
.
monthsel
.
selectedIndex
;
var selected = document.forms[0]
.monthsel.options[indexNum].text;
var
selected
=
document
.
iform
.
monthsel
.
options
[
indexNum
].
text
;
for
(
i
=
0
;
i
<=
11
;
i
++
){
for
(
i
=
0
;
i
<=
11
;
i
++
){
option = document.forms[0]
.monthsel.options[i].text;
option
=
document
.
iform
.
monthsel
.
options
[
i
].
text
;
document
.
popupMonthLayer
=
eval
(
'
document.getElementById (option)
'
);
document
.
popupMonthLayer
=
eval
(
'
document.getElementById (option)
'
);
if
(
selected
==
option
)
{
if
(
selected
==
option
)
{
...
@@ -648,15 +624,15 @@ function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimeh
...
@@ -648,15 +624,15 @@ function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimeh
tr
.
appendChild
(
td
);
tr
.
appendChild
(
td
);
td
=
d
.
createElement
(
"
td
"
);
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML="<input type='text' readonly class='vexpl'
name='starttime" + schCounter + "' id='starttime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + starttimehour + ":" + starttimemin + "' />";
td
.
innerHTML
=
"
<input type='text' readonly
name='starttime
"
+
schCounter
+
"
' id='starttime
"
+
schCounter
+
"
' style=' word-wrap:break-word; width:100%; border:0px solid;' value='
"
+
starttimehour
+
"
:
"
+
starttimemin
+
"
' />
"
;
tr
.
appendChild
(
td
);
tr
.
appendChild
(
td
);
td
=
d
.
createElement
(
"
td
"
);
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML="<input type='text' readonly class='vexpl'
name='stoptime" + schCounter + "' id='stoptime" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + stoptimehour + ":" + stoptimemin + "' />";
td
.
innerHTML
=
"
<input type='text' readonly
name='stoptime
"
+
schCounter
+
"
' id='stoptime
"
+
schCounter
+
"
' style=' word-wrap:break-word; width:100%; border:0px solid;' value='
"
+
stoptimehour
+
"
:
"
+
stoptimemin
+
"
' />
"
;
tr
.
appendChild
(
td
);
tr
.
appendChild
(
td
);
td
=
d
.
createElement
(
"
td
"
);
td
=
d
.
createElement
(
"
td
"
);
td.innerHTML="<input type='text' readonly class='vexpl'
name='timedescr" + schCounter + "' id='timedescr" + schCounter + "' style=' word-wrap:break-word; width:100%; border:0px solid;' value='" + tempdescr + "' />";
td
.
innerHTML
=
"
<input type='text' readonly
name='timedescr
"
+
schCounter
+
"
' id='timedescr
"
+
schCounter
+
"
' style=' word-wrap:break-word; width:100%; border:0px solid;' value='
"
+
tempdescr
+
"
' />
"
;
tr
.
appendChild
(
td
);
tr
.
appendChild
(
td
);
td
=
d
.
createElement
(
"
td
"
);
td
=
d
.
createElement
(
"
td
"
);
...
@@ -763,6 +739,7 @@ function editRow(incTime, el) {
...
@@ -763,6 +739,7 @@ function editRow(incTime, el) {
}
}
removeRownoprompt
(
el
);
removeRownoprompt
(
el
);
}
}
$
(
'
.selectpicker
'
).
selectpicker
(
'
refresh
'
);
}
}
function
removeRownoprompt
(
el
)
{
function
removeRownoprompt
(
el
)
{
...
@@ -792,126 +769,113 @@ function removeRow(el) {
...
@@ -792,126 +769,113 @@ function removeRow(el) {
}
}
//]]>
//]]>
</script>
</script>
EOD;
?>
<body>
<body>
<?php
include
(
"fbegin.inc"
);
echo
$jscriptstr
;
?>
<?php
include
(
"fbegin.inc"
);
echo
$jscriptstr
;
?>
<section
class=
"page-content-main"
>
<section
class=
"page-content-main"
>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<div
class=
"row"
>
<?php
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<?php
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<div
id=
"inputerrors"
></div>
<section
class=
"col-xs-12"
>
<section
class=
"col-xs-12"
>
<div
class=
"content-box content-box-main"
>
<div
class=
"content-box"
>
<header
class=
"content-box-head container-fluid"
>
<h3>
<?=
gettext
(
"Schedule information"
);
?>
</h3>
</header>
<div
class=
"content-box-main"
>
<form
action=
"firewall_schedule_edit.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<form
action=
"firewall_schedule_edit.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<input
type=
"hidden"
name=
"schedlabel"
value=
"
<?=
$pconfig
[
'schedlabel'
];
?>
"
/>
<div
class=
"table-responsive"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-striped table-sort
"
>
<table
class=
"table table-striped
"
>
<tbody>
<tbody>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Schedule Name"
);
?>
</td>
<td
width=
"15%"
><strong>
<?=
gettext
(
"Schedule information"
);
?>
</strong></td>
<td
width=
"85%"
class=
"vtable"
>
<td
width=
"85%"
align=
"right"
>
<?php
if
(
is_schedule_inuse
(
$pconfig
[
'name'
])
==
true
)
:
?>
<small>
<?=
gettext
(
"full help"
);
?>
</small>
<input
name=
"name"
type=
"hidden"
id=
"name"
size=
"40"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'name'
]);
?>
"
/>
<i
class=
"fa fa-toggle-off text-danger"
style=
"cursor: pointer;"
id=
"show_all_help_page"
type=
"button"
></i></a>
<?php
echo
$pconfig
[
'name'
];
?>
</td>
</tr>
<tr>
<td><a
id=
"help_for_name"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Schedule Name"
);
?>
</td>
<td>
<?php
if
(
is_schedule_inuse
(
$pconfig
[
'name'
])
==
true
)
:?>
<
input
name
=
"name"
type
=
"hidden"
id
=
"name"
value
=
"<?=htmlspecialchars(
$pconfig['name']
);?>"
/>
<?=
$pconfig
[
'name'
];
?>
<p>
<p>
<span
class=
"vexpl"
>
<?=
gettext
(
"NOTE: This schedule is in use so the name may not be modified!"
);
?>
</span
>
<?=
gettext
(
"NOTE: This schedule is in use so the name may not be modified!"
);
?
>
</p>
</p>
<?php
else
:
?>
<?php
<input
name=
"name"
type=
"text"
id=
"name"
size=
"40"
maxlength=
"40"
class=
"form-control unknown"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'name'
]);
?>
"
/><br
/>
else
:
?>
<span
class=
"vexpl"
>
<input
name=
"name"
type=
"text"
id=
"name"
value=
"
<?=
$pconfig
[
'name'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_name"
>
<?=
gettext
(
"The name of the alias may only consist of the characters a-z, A-Z and 0-9"
);
?>
<?=
gettext
(
"The name of the alias may only consist of the characters a-z, A-Z and 0-9"
);
?>
</span>
</div>
<?php
endif
;
?>
<?php
endif
;
?>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Description"
);
?>
</td>
<td><a
id=
"help_for_description"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Description"
);
?>
</td>
<td
width=
"85%"
class=
"vtable"
><input
name=
"descr"
type=
"text"
id=
"descr"
size=
"40"
maxlength=
"40"
class=
"form-control unknown"
value=
"
<?=
htmlspecialchars
(
$pconfig
[
'descr'
]);
?>
"
/><br
/>
<td>
<span
class=
"vexpl"
>
<input
name=
"descr"
type=
"text"
id=
"descr"
value=
"
<?=
$pconfig
[
'descr'
];
?>
"
/><br
/>
<div
class=
"hidden"
for=
"help_for_name"
>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
);
?>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
);
?>
</span>
</div>
</td>
</td>
</tr>
</tr>
<!-- tr>
</tr -->
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Month"
);
?>
</td>
<td><a
id=
"help_for_month"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Month"
);
?>
</td>
<td
width=
"85%"
class=
"vtable"
>
<td
>
<select
name=
"monthsel"
class=
"form-control
"
id=
"monthsel"
onchange=
"update_month();"
>
<select
name=
"monthsel"
class=
"selectpicker"
data-width=
"auto"
data-live-search=
"true
"
id=
"monthsel"
onchange=
"update_month();"
>
<?php
<?php
$monthcounter
=
date
(
"n"
);
$monthcounter
=
date
(
"n"
);
$monthlimit
=
$monthcounter
+
12
;
$monthlimit
=
$monthcounter
+
12
;
$yearcounter
=
date
(
"Y"
);
$yearcounter
=
date
(
"Y"
);
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
?>
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
?>
<option
value=
"
<?php
echo
$monthcounter
;
?>
"
>
<?php
echo
date
(
"F_y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</option>
<option
value=
"
<?=
$monthcounter
;
?>
"
>
<?=
date
(
"F_y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</option>
<?php
<?php
if
(
$monthcounter
==
12
)
if
(
$monthcounter
==
12
)
{
{
$monthcounter
=
1
;
$monthcounter
=
1
;
$yearcounter
++
;
$yearcounter
++
;
}
}
else
{
else
{
$monthcounter
++
;
$monthcounter
++
;
}
}
}
?>
}
?>
</select><br
/><br
/>
</select>
<?php
<br
/><br
/>
<?php
$firstmonth
=
TRUE
;
$firstmonth
=
TRUE
;
$monthcounter
=
date
(
"n"
);
$monthcounter
=
date
(
"n"
);
$yearcounter
=
date
(
"Y"
);
$yearcounter
=
date
(
"Y"
);
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
for
(
$k
=
0
;
$k
<
12
;
$k
++
){
$firstdayofmonth
=
date
(
"w"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
$firstdayofmonth
=
date
(
"w"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
if
(
$firstdayofmonth
==
0
)
if
(
$firstdayofmonth
==
0
)
{
$firstdayofmonth
=
7
;
$firstdayofmonth
=
7
;
}
$daycounter
=
1
;
$daycounter
=
1
;
//number of day in month
//number of day in month
$numberofdays
=
date
(
"t"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
$numberofdays
=
date
(
"t"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
$firstdayprinted
=
FALSE
;
$firstdayprinted
=
FALSE
;
$lasttr
=
FALSE
;
$lasttr
=
FALSE
;
$positioncounter
=
1
;
//7 for Sun, 1 for Mon, 2 for Tues, etc
$positioncounter
=
1
;
//7 for Sun, 1 for Mon, 2 for Tues, etc
?>
?>
<div
id=
"
<?php
echo
date
(
"F_y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
"
style=
" position:relative; display:
<?php
if
(
$firstmonth
)
echo
"block"
;
else
echo
"none"
;
?>
"
>
<div
id=
"
<?=
date
(
"F_y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
"
style=
" position:relative; display:
<?=
$firstmonth
?
"block"
:
"none"
;
?>
"
>
<table
border=
"1"
cellspacing=
"1"
cellpadding=
"1"
id=
"calTable
<?=
$monthcounter
.
$yearcounter
;
?>
"
class=
"tabcont
"
summary=
"month"
>
<table
border=
"1"
cellspacing=
"1"
cellpadding=
"1"
id=
"calTable
<?=
$monthcounter
.
$yearcounter
;
?>
"
class=
"table table-condensed
"
summary=
"month"
>
<thead>
<thead>
<tr><td
colspan=
"7"
align=
"center"
class=
"listbg"
>
<?php
echo
date
(
"F_Y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</td></tr>
<tr><td
colspan=
"7"
align=
"center"
>
<?=
date
(
"F_Y"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
1
,
date
(
$yearcounter
)));
?>
</td></tr>
<tr>
<tr>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p1');"
><u>
<?=
gettext
(
"Mon"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p1');"
><u>
<?=
gettext
(
"Mon"
);
?>
</u></td>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p2');"
><u>
<?=
gettext
(
"Tue"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p2');"
><u>
<?=
gettext
(
"Tue"
);
?>
</u></td>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p3');"
><u>
<?=
gettext
(
"Wed"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p3');"
><u>
<?=
gettext
(
"Wed"
);
?>
</u></td>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p4');"
><u>
<?=
gettext
(
"Thu"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p4');"
><u>
<?=
gettext
(
"Thu"
);
?>
</u></td>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p5');"
><u>
<?=
gettext
(
"Fri"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p5');"
><u>
<?=
gettext
(
"Fri"
);
?>
</u></td>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p6');"
><u>
<?=
gettext
(
"Sat"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p6');"
><u>
<?=
gettext
(
"Sat"
);
?>
</u></td>
<td
align=
"center"
class=
"listhdr
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p7');"
><u>
<?=
gettext
(
"Sun"
);
?>
</u></td>
<td
align=
"cente
r"
style=
"cursor: pointer;"
onclick=
"daytoggle('w1p7');"
><u>
<?=
gettext
(
"Sun"
);
?>
</u></td>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<?php
<?php
$firstmonth
=
FALSE
;
$firstmonth
=
FALSE
;
while
(
$daycounter
<=
$numberofdays
){
while
(
$daycounter
<=
$numberofdays
){
$weekcounter
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
date
(
$daycounter
),
date
(
$yearcounter
)));
$weekcounter
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$monthcounter
),
date
(
$daycounter
),
date
(
$yearcounter
)));
$weekcounter
=
ltrim
(
$weekcounter
,
"0"
);
$weekcounter
=
ltrim
(
$weekcounter
,
"0"
);
if
(
$positioncounter
==
1
)
if
(
$positioncounter
==
1
)
{
{
echo
"<tr>"
;
echo
"<tr>"
;
}
}
if
(
$firstdayofmonth
==
$positioncounter
){
?>
if
(
$firstdayofmonth
==
$positioncounter
){
?>
...
@@ -920,122 +884,112 @@ EOD;
...
@@ -920,122 +884,112 @@ EOD;
$daycounter
++
;
$daycounter
++
;
$firstdayprinted
=
TRUE
;
$firstdayprinted
=
TRUE
;
echo
"</td>"
;
echo
"</td>"
;
}
}
elseif
(
$firstdayprinted
==
TRUE
&&
$daycounter
<=
$numberofdays
){
?>
elseif
(
$firstdayprinted
==
TRUE
&&
$daycounter
<=
$numberofdays
){
?>
<td
align=
"center"
style=
"cursor: pointer;"
class=
"listr"
id=
"w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
"
onclick=
"daytoggle('w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
-m
<?=
$monthcounter
;
?>
d
<?=
$daycounter
;
?>
');"
>
<td
align=
"center"
style=
"cursor: pointer;"
class=
"listr"
id=
"w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
"
onclick=
"daytoggle('w
<?=
$weekcounter
;
?>
p
<?=
$positioncounter
;
?>
-m
<?=
$monthcounter
;
?>
d
<?=
$daycounter
;
?>
');"
>
<?php
echo
$daycounter
;
<?php
echo
$daycounter
;
$daycounter
++
;
$daycounter
++
;
echo
"</td>"
;
echo
"</td>"
;
}
}
else
{
else
{
echo
"<td align=
\"
center
\"
class=
\"
listr
\"
></td>"
;
echo
"<td align=
\"
center
\"
class=
\"
listr
\"
></td>"
;
}
}
if
(
$positioncounter
==
7
||
$daycounter
>
$numberofdays
)
{
if
(
$positioncounter
==
7
||
$daycounter
>
$numberofdays
)
{
$positioncounter
=
1
;
$positioncounter
=
1
;
echo
"</tr>"
;
echo
"</tr>"
;
}
}
else
{
else
{
$positioncounter
++
;
$positioncounter
++
;
}
}
}
//end while loop?>
}
//end while loop?>
</
tbody
>
</
tbody
>
</
table
>
</
table
>
</
div
>
</
div
>
<?
php
<?
php
if
(
$monthcounter
==
12
)
{
if
(
$monthcounter
==
12
)
{
$monthcounter
=
1
;
$monthcounter
=
1
;
$yearcounter
++
;
$yearcounter
++
;
}
}
else
{
else
{
$monthcounter
++
;
$monthcounter
++
;
}
}
}
//end for loop
}
//end for loop
?>
?>
<div
class=
"hidden"
for=
"help_for_month"
>
<br
/>
<br
/>
<?=
gettext
(
"Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday."
);
?>
<?=
gettext
(
"Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday."
);
?>
</div>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Time"
);
?>
</td>
<td><a
id=
"help_for_time"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Time"
);
?>
</td>
<td
width=
"85%"
class=
"vtable"
>
<td
>
<table
cellspacing=
"2"
class=
"tabcont"
summary=
"time"
>
<table
cellspacing=
"2"
class=
"tabcont"
summary=
"time"
>
<tr>
<tr>
<td
class=
"listhdrr"
align=
"center"
>
<?=
gettext
(
"Start Time"
);
?>
</td><td></td><td
class=
"listhdrr"
align=
"center"
>
<?=
gettext
(
"Stop Time"
);
?>
</td>
<td>
<?=
gettext
(
"Start Time"
);
?>
</td>
<td>
<?=
gettext
(
"Stop Time"
);
?>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
<td>
<select
name=
"starttimehour"
class=
"form-control"
id=
"starttimehour"
>
<div
class=
"input-group"
>
<?php
<select
name=
"starttimehour"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"starttimehour"
>
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
<?php
{
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
:?>
echo
"<option value=
\"
$i
\"
>"
;
<
option
value
=
"<?=
$i
;?>"
><?=
$i
;
?>
</option>
echo
$i
;
<?php
echo
"</option>"
;
endfor
;
?>
}
</select>
?>
<select
name=
"starttimemin"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"starttimemin"
>
</select>
<?=
gettext
(
"Hr"
);
?>
<select
name=
"starttimemin"
class=
"form-control"
id=
"starttimemin"
>
<option
value=
"00"
>
00
</option>
<option
value=
"00"
>
00
</option>
<option
value=
"15"
>
15
</option>
<option
value=
"15"
>
15
</option>
<option
value=
"30"
>
30
</option>
<option
value=
"30"
>
30
</option>
<option
value=
"45"
>
45
</option>
<option
value=
"45"
>
45
</option>
<option
value=
"59"
>
59
</option>
<option
value=
"59"
>
59
</option>
</select>
<?=
gettext
(
"Min"
);
?>
</select>
</div>
</td>
</td>
<td></td>
<td>
<td>
<select
name=
"stoptimehour"
class=
"form-control"
id=
"stoptimehour"
>
<div
class=
"input-group"
>
<?php
<select
name=
"stoptimehour"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"stoptimehour"
>
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
<?php
{
for
(
$i
=
0
;
$i
<
24
;
$i
++
)
:?>
if
(
$i
==
23
)
<
option
value
=
"<?=
$i
;?>"
><?=
$i
;
?>
</option>
$selected
=
"selected=
\"
selected
\"
"
;
<?php
else
endfor
;
?>
$selected
=
""
;
</select>
<select
name=
"stoptimemin"
class=
"selectpicker form-control"
data-width=
"auto"
data-size=
"5"
data-live-search=
"true"
id=
"stoptimemin"
>
echo
"<option value=
\"
$i
\"
$selected
>"
;
echo
$i
;
echo
"</option>"
;
}
?>
</select>
<?=
gettext
(
"Hr"
);
?>
<select
name=
"stoptimemin"
class=
"form-control"
id=
"stoptimemin"
>
<option
value=
"00"
>
00
</option>
<option
value=
"00"
>
00
</option>
<option
value=
"15"
>
15
</option>
<option
value=
"15"
>
15
</option>
<option
value=
"30"
>
30
</option>
<option
value=
"30"
>
30
</option>
<option
value=
"45"
>
45
</option>
<option
value=
"45"
>
45
</option>
<option
value=
"59"
selected=
"selected"
>
59
</option>
<option
value=
"59"
selected=
"selected"
>
59
</option>
</select>
<?=
gettext
(
"Min"
);
?>
</select>
</div>
</td>
</td>
</tr>
</tr>
</table><br
/>
</table>
<div
class=
"hidden"
for=
"help_for_time"
>
<br
/>
<?=
gettext
(
"Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59."
)
?>
<?=
gettext
(
"Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59."
)
?>
</div>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Time Range Description"
)
?>
</td>
<td><a
id=
"help_for_timerange_desc"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Time Range Description"
)
?>
</td>
<td
width=
"85%"
class=
"vtable"
><input
name=
"timerangedescr"
type=
"text"
class=
"form-control unknown"
id=
"timerangedescr"
size=
"40"
maxlength=
"40"
/><br
/>
<td>
<span
class=
"vexpl"
>
<input
name=
"timerangedescr"
type=
"text"
id=
"timerangedescr"
/>
<div
class=
"hidden"
for=
"help_for_timerange_desc"
>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
)
?>
<?=
gettext
(
"You may enter a description here for your reference (not parsed)."
)
?>
</span
>
</div
>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"22%"
valign=
"top"
>
</td>
<td
>
</td>
<td
width=
"78%"
>
<td
>
<input
type=
"button"
value=
"
<?=
gettext
(
"Add Time"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:processEntries();"
/>
<input
type=
"button"
value=
"
<?=
gettext
(
"Add Time"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:processEntries();"
/>
<input
type=
"button"
value=
"
<?=
gettext
(
"Clear Selection"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:clearCalendar(); clearTime(); clearDescr();"
/>
<input
type=
"button"
value=
"
<?=
gettext
(
"Clear Selection"
);
?>
"
class=
"btn btn-default"
onclick=
"javascript:clearCalendar(); clearTime(); clearDescr();"
/>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vtable"
></td>
<td
></td>
<td
width=
"85%"
class=
"vtable"
></td>
<td
></td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
...
@@ -1047,20 +1001,19 @@ EOD;
...
@@ -1047,20 +1001,19 @@ EOD;
</thead>
</thead>
<tbody>
<tbody>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Configured Ranges"
);
?>
</td>
<td
>
<?=
gettext
(
"Configured Ranges"
);
?>
</td>
<td
width=
"85%"
>
<td
>
<table
id=
"scheduletable"
summary=
"range"
>
<table
id=
"scheduletable"
summary=
"range"
>
<tbody>
<tbody>
<tr>
<tr>
<td
align=
"center"
class=
"listbg
"
width=
"35%"
>
<?=
gettext
(
"Day(s)"
);
?>
</td>
<td
align=
"center
"
width=
"35%"
>
<?=
gettext
(
"Day(s)"
);
?>
</td>
<td
align=
"center"
class=
"listbg
"
width=
"12%"
>
<?=
gettext
(
"Start Time"
);
?>
</td>
<td
align=
"center
"
width=
"12%"
>
<?=
gettext
(
"Start Time"
);
?>
</td>
<td
align=
"center"
class=
"listbg
"
width=
"11%"
>
<?=
gettext
(
"Stop Time"
);
?>
</td>
<td
align=
"center
"
width=
"11%"
>
<?=
gettext
(
"Stop Time"
);
?>
</td>
<td
align=
"center"
class=
"listbg
"
width=
"42%"
>
<?=
gettext
(
"Description"
);
?>
</td>
<td
align=
"center
"
width=
"42%"
>
<?=
gettext
(
"Description"
);
?>
</td>
</tr>
</tr>
<?php
<?php
if
(
$getSchedule
){
if
(
isset
(
$pconfig
[
'timerange'
])
){
$counter
=
0
;
$counter
=
0
;
foreach
(
$pconfig
[
'timerange'
]
as
$timerange
)
{
foreach
(
$pconfig
[
'timerange'
]
as
$timerange
)
{
$tempFriendlyTime
=
""
;
$tempFriendlyTime
=
""
;
$tempID
=
""
;
$tempID
=
""
;
...
@@ -1068,7 +1021,6 @@ EOD;
...
@@ -1068,7 +1021,6 @@ EOD;
$dayFriendly
=
""
;
$dayFriendly
=
""
;
$tempFriendlyTime
=
""
;
$tempFriendlyTime
=
""
;
$timedescr
=
$timerange
[
'rangedescr'
];
$timedescr
=
$timerange
[
'rangedescr'
];
//get hours
//get hours
$temptimerange
=
$timerange
[
'hour'
];
$temptimerange
=
$timerange
[
'hour'
];
$temptimeseparator
=
strrpos
(
$temptimerange
,
"-"
);
$temptimeseparator
=
strrpos
(
$temptimerange
,
"-"
);
...
@@ -1083,7 +1035,7 @@ EOD;
...
@@ -1083,7 +1035,7 @@ EOD;
$firstPrint
=
false
;
$firstPrint
=
false
;
$firstprint2
=
false
;
$firstprint2
=
false
;
if
(
$timerange
[
'month'
]
){
if
(
!
empty
(
$timerange
[
'month'
])
){
$tempmontharray
=
explode
(
","
,
$timerange
[
'month'
]);
$tempmontharray
=
explode
(
","
,
$timerange
[
'month'
]);
$tempdayarray
=
explode
(
","
,
$timerange
[
'day'
]);
$tempdayarray
=
explode
(
","
,
$timerange
[
'day'
]);
$arraycounter
=
0
;
$arraycounter
=
0
;
...
@@ -1097,16 +1049,12 @@ EOD;
...
@@ -1097,16 +1049,12 @@ EOD;
}
}
$weeknumber
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$month
),
date
(
$day
),
date
(
"Y"
)));
$weeknumber
=
date
(
"W"
,
mktime
(
0
,
0
,
0
,
date
(
$month
),
date
(
$day
),
date
(
"Y"
)));
$weeknumber
=
ltrim
(
$weeknumber
,
"0"
);
$weeknumber
=
ltrim
(
$weeknumber
,
"0"
);
if
(
$firstPrint
)
{
if
(
$firstPrint
)
{
$tempID
.=
","
;
$tempID
.=
","
;
}
}
$tempID
.=
"w"
.
$weeknumber
.
"p"
.
$daypos
.
"-m"
.
$month
.
"d"
.
$day
;
$tempID
.=
"w"
.
$weeknumber
.
"p"
.
$daypos
.
"-m"
.
$month
.
"d"
.
$day
;
$firstPrint
=
true
;
$firstPrint
=
true
;
if
(
!
$firstDayFound
)
{
if
(
!
$firstDayFound
)
{
$firstDay
=
$day
;
$firstDay
=
$day
;
$firstmonth
=
$month
;
$firstmonth
=
$month
;
$firstDayFound
=
true
;
$firstDayFound
=
true
;
...
@@ -1116,26 +1064,24 @@ EOD;
...
@@ -1116,26 +1064,24 @@ EOD;
$nextDay
=
$tempdayarray
[
$arraycounter
+
1
];
$nextDay
=
$tempdayarray
[
$arraycounter
+
1
];
$currentDay
++
;
$currentDay
++
;
if
((
$currentDay
!=
$nextDay
)
||
(
$tempmontharray
[
$arraycounter
]
!=
$tempmontharray
[
$arraycounter
+
1
])){
if
((
$currentDay
!=
$nextDay
)
||
(
$tempmontharray
[
$arraycounter
]
!=
$tempmontharray
[
$arraycounter
+
1
])){
if
(
$firstprint2
)
if
(
$firstprint2
)
{
$tempFriendlyTime
.=
", "
;
$tempFriendlyTime
.=
", "
;
}
$currentDay
--
;
$currentDay
--
;
if
(
$currentDay
!=
$firstDay
)
if
(
$currentDay
!=
$firstDay
)
{
$tempFriendlyTime
.=
$monthArray
[
$firstmonth
-
1
]
.
" "
.
$firstDay
.
" - "
.
$currentDay
;
$tempFriendlyTime
.=
$monthArray
[
$firstmonth
-
1
]
.
" "
.
$firstDay
.
" - "
.
$currentDay
;
else
}
else
{
$tempFriendlyTime
.=
$monthArray
[
$month
-
1
]
.
" "
.
$day
;
$tempFriendlyTime
.=
$monthArray
[
$month
-
1
]
.
" "
.
$day
;
}
$firstDayFound
=
false
;
$firstDayFound
=
false
;
$firstprint2
=
true
;
$firstprint2
=
true
;
}
}
$arraycounter
++
;
$arraycounter
++
;
}
}
}
else
{
}
else
{
$dayFriendly
=
$timerange
[
'position'
];
$dayFriendly
=
$timerange
[
'position'
];
$tempID
=
$dayFriendly
;
$tempID
=
$dayFriendly
;
}
}
$tempTime
=
$tempID
.
"||"
.
$starttime
.
"-"
.
$stoptime
.
"||"
.
$timedescr
;
$tempTime
=
$tempID
.
"||"
.
$starttime
.
"-"
.
$stoptime
.
"||"
.
$timedescr
;
//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
...
@@ -1147,11 +1093,10 @@ EOD;
...
@@ -1147,11 +1093,10 @@ EOD;
$firstDay
=
""
;
$firstDay
=
""
;
$nextDay
=
""
;
$nextDay
=
""
;
$i
=
0
;
$i
=
0
;
if
(
!
$timerange
[
'month'
])
{
if
(
empty
(
$timerange
[
'month'
]))
{
foreach
(
$tempFriendlyDayArray
as
$day
){
foreach
(
$tempFriendlyDayArray
as
$day
){
if
(
$day
!=
""
){
if
(
$day
!=
""
){
if
(
!
$firstDayFound
)
if
(
!
$firstDayFound
)
{
{
$firstDay
=
$tempFriendlyDayArray
[
$i
];
$firstDay
=
$tempFriendlyDayArray
[
$i
];
$firstDayFound
=
true
;
$firstDayFound
=
true
;
}
}
...
@@ -1160,13 +1105,15 @@ EOD;
...
@@ -1160,13 +1105,15 @@ EOD;
$nextDay
=
$tempFriendlyDayArray
[
$i
+
1
];
$nextDay
=
$tempFriendlyDayArray
[
$i
+
1
];
$currentDay
++
;
$currentDay
++
;
if
(
$currentDay
!=
$nextDay
){
if
(
$currentDay
!=
$nextDay
){
if
(
$firstprint
)
if
(
$firstprint
){
$tempFriendlyTime
.=
", "
;
$tempFriendlyTime
.=
", "
;
}
$currentDay
--
;
$currentDay
--
;
if
(
$currentDay
!=
$firstDay
)
if
(
$currentDay
!=
$firstDay
)
{
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
]
.
" - "
.
$dayArray
[
$currentDay
-
1
];
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
]
.
" - "
.
$dayArray
[
$currentDay
-
1
];
else
}
else
{
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
];
$tempFriendlyTime
.=
$dayArray
[
$firstDay
-
1
];
}
$firstDayFound
=
false
;
$firstDayFound
=
false
;
$firstprint
=
true
;
$firstprint
=
true
;
}
}
...
@@ -1174,31 +1121,28 @@ EOD;
...
@@ -1174,31 +1121,28 @@ EOD;
}
}
}
}
}
}
?>
?>
<tr>
<tr>
<td>
<td>
<span
class=
"vexpl"
>
<?php
echo
$tempFriendlyTime
;
?>
</span>
<span>
<?=
$tempFriendlyTime
;
?>
</span>
</td>
</td>
<td>
<td>
<input
type=
'text'
readonly=
'readonly'
class=
'vexpl'
name=
'starttime
<?php
echo
$counter
;
?>
'
id=
'starttime
<?php
echo
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?php
echo
$starttime
;
?>
'
/>
<input
type=
'text'
readonly=
'readonly'
name=
'starttime
<?=
$counter
;
?>
'
id=
'starttime
<?=
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?=
$starttime
;
?>
'
/>
</td>
</td>
<td>
<td>
<input
type=
'text'
readonly=
'readonly'
class=
'vexpl'
name=
'stoptime
<?php
echo
$counter
;
?>
'
id=
'stoptime
<?php
echo
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?php
echo
$stoptime
;
?>
'
/>
<input
type=
'text'
readonly=
'readonly'
name=
'stoptime
<?=
$counter
;
?>
'
id=
'stoptime
<?=
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?=
$stoptime
;
?>
'
/>
</td>
</td>
<td>
<td>
<input
type=
'text'
readonly=
'readonly'
class=
'vexpl'
name=
'timedescr
<?php
echo
$counter
;
?>
'
id=
'timedescr
<?php
echo
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?php
echo
$timedescr
;
?>
'
/>
<input
type=
'text'
readonly=
'readonly'
name=
'timedescr
<?=
$counter
;
?>
'
id=
'timedescr
<?=
$counter
;
?>
'
style=
' word-wrap:break-word; width:100%; border:0px solid;'
value=
'
<?=
$timedescr
;
?>
'
/>
</td>
</td>
<td>
<td>
<a
onclick=
'editRow("
<?php
echo
$tempTime
;
?>
",this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-edit
"
></span></a>
<a
onclick=
'editRow("
<?=
$tempTime
;
?>
",this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-pencil
"
></span></a>
</td>
</td>
<td>
<td>
<a
onclick=
'removeRow(this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-remove"
></span></a>
<a
onclick=
'removeRow(this); return false;'
href=
'#'
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-remove"
></span></a>
</td>
</td>
<td>
<td>
<input
type=
'hidden'
id=
'schedule
<?php
echo
$counter
;
?>
'
name=
'schedule
<?php
echo
$counter
;
?>
'
value=
'
<?php
echo
$tempID
;
?>
'
/>
<input
type=
'hidden'
id=
'schedule
<?=
$counter
;
?>
'
name=
'schedule
<?=
$counter
;
?>
'
value=
'
<?=
$tempID
;
?>
'
/>
</td>
</td>
</tr>
</tr>
<?php
<?php
...
@@ -1212,12 +1156,12 @@ EOD;
...
@@ -1212,12 +1156,12 @@ EOD;
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"15%"
valign=
"top"
>
</td>
<td
>
</td>
<td
width=
"85%"
>
<td
>
<input
id=
"submit"
name=
"submit"
type=
"submit"
onclick=
"return checkForRanges();"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
<input
id=
"submit"
name=
"submit"
type=
"submit"
onclick=
"return checkForRanges();"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
<input
type=
"button"
class=
"btn btn-default"
value=
"
<?=
gettext
(
"Cancel"
);
?>
"
onclick=
"window.location.href='
<?=
$referer
;
?>
'"
/>
<input
type=
"button"
class=
"btn btn-default"
value=
"
<?=
gettext
(
"Cancel"
);
?>
"
onclick=
"window.location.href='
<?=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/firewall_schedule.php'
)
;
?>
'"
/>
<?php
if
(
isset
(
$id
)
&&
$a_schedules
[
$id
]
)
:
?>
<?php
if
(
isset
(
$id
)
)
:
?>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
htmlspecialchars
(
$id
)
;
?>
"
/>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$id
;
?>
"
/>
<?php
endif
;
?>
<?php
endif
;
?>
</td>
</td>
</tr>
</tr>
...
@@ -1226,7 +1170,6 @@ EOD;
...
@@ -1226,7 +1170,6 @@ EOD;
</div>
</div>
</form>
</form>
</div>
</div>
</div>
</section>
</section>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment