Project

General

Profile

Download (39.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	firewall_schedule_edit.php
4
	Copyright (C) 2004 Scott Ullrich
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6
	All rights reserved.
7

    
8
	originally part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

    
12
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14

    
15
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17

    
18
	2. Redistributions in binary form must reproduce the above copyright
19
	   notice, this list of conditions and the following disclaimer in the
20
	   documentation and/or other materials provided with the distribution.
21

    
22
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
	POSSIBILITY OF SUCH DAMAGE.
32
*/
33
/*
34
	pfSense_MODULE:	schedules
35
*/
36

    
37
##|+PRIV
38
##|*IDENT=page-firewall-schedules-edit
39
##|*NAME=Firewall: Schedules: Edit page
40
##|*DESCR=Allow access to the 'Firewall: Schedules: Edit' page.
41
##|*MATCH=firewall_schedule_edit.php*
42
##|-PRIV
43

    
44
function schedulecmp($a, $b) {
45
	return strcmp($a['name'], $b['name']);
46
}
47

    
48
function schedule_sort(){
49
        global $g, $config;
50

    
51
        if (!is_array($config['schedules']['schedule']))
52
                return;
53

    
54
        usort($config['schedules']['schedule'], "schedulecmp");
55
}
56

    
57
require("guiconfig.inc");
58
require_once("functions.inc");
59
require_once("filter.inc");
60
require_once("shaper.inc");
61

    
62
$pgtitle = array(gettext("Firewall"),gettext("Schedules"),gettext("Edit"));
63

    
64
if (isset($_POST['referer'])) {
65
	$referer = $_POST['referer'];
66
} else {
67
	$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_schedule.php');
68
}
69

    
70
$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
71
$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'));
72

    
73
if (!is_array($config['schedules']['schedule']))
74
	$config['schedules']['schedule'] = array();
75

    
76
$a_schedules = &$config['schedules']['schedule'];
77

    
78
if (is_numericint($_GET['id']))
79
	$id = $_GET['id'];
80
if (isset($_POST['id']) && is_numericint($_POST['id']))
81
	$id = $_POST['id'];
82

    
83
if (isset($id) && $a_schedules[$id]) {
84
	$pconfig['name'] = $a_schedules[$id]['name'];
85
	$pconfig['descr'] = html_entity_decode($a_schedules[$id]['descr']);
86
	$pconfig['timerange'] = $a_schedules[$id]['timerange'];
87
	$pconfig['schedlabel'] = $a_schedules[$id]['schedlabel'];
88
	$getSchedule = true;
89
}
90

    
91
if ($_POST) {
92
	
93
	if(strtolower($_POST['name']) == "lan")
94
		$input_errors[] = gettext("Schedule may not be named LAN.");
95
	if(strtolower($_POST['name']) == "wan")
96
		$input_errors[] = gettext("Schedule may not be named WAN.");
97
	if(strtolower($_POST['name']) == "")
98
		$input_errors[] = gettext("Schedule name cannot be blank.");
99

    
100
	$x = is_validaliasname($_POST['name']);
101
	if (!isset($x)) {
102
		$input_errors[] = gettext("Reserved word used for schedule name.");
103
	} else {
104
		if (is_validaliasname($_POST['name']) == false)
105
			$input_errors[] = gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
106
	}
107
	
108
	/* check for name conflicts */
109
	foreach ($a_schedules as $schedule) {
110
		if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule))
111
			continue;
112

    
113
		if ($schedule['name'] == $_POST['name']) {
114
			$input_errors[] = gettext("A Schedule with this name already exists.");
115
			break;
116
		}
117
	}
118
	$schedule = array();
119
	
120
	$schedule['name'] = $_POST['name'];
121
	$schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');	
122
	
123
	$timerangeFound = false;
124
	for ($x=0; $x<99; $x++){
125
		if($_POST['schedule' . $x]) {
126
			if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['starttime' . $x])) {
127
				$input_errors[] = sprintf(gettext("Invalid start time - '%s'"), $_POST['starttime' . $x]);
128
				continue;
129
			}
130
			if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['stoptime' . $x])) {
131
				$input_errors[] = sprintf(gettext("Invalid stop time - '%s'"), $_POST['stoptime' . $x]);
132
				continue;
133
			}
134
			$timerangeFound = true;
135
			$timeparts = array();
136
			$firstprint = false;
137
			$timestr = $_POST['schedule' . $x];
138
			$timehourstr = $_POST['starttime' . $x];
139
			$timehourstr .= "-";
140
			$timehourstr .= $_POST['stoptime' . $x];
141
			$timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8'); 
142
			$dashpos = strpos($timestr, '-');
143
			if ($dashpos === false)
144
			{
145
				$timeparts['position'] = $timestr;
146
			}
147
			else
148
			{
149
				$tempindarray = array();
150
				$monthstr = "";
151
				$daystr = "";
152
				$tempindarray = explode(",", $timestr);
153
				foreach ($tempindarray as $currentselection)
154
				{
155
					if ($currentselection){
156
						if ($firstprint)
157
						{
158
							$monthstr .= ",";
159
							$daystr .= ",";						
160
						}
161
						$tempstr = "";
162
						$monthpos = strpos($currentselection, "m");
163
						$daypos = strpos($currentselection, "d");
164
						$monthstr .= substr($currentselection, $monthpos+1, $daypos-$monthpos-1);
165
						$daystr .=  substr($currentselection, $daypos+1);			
166
						$firstprint = true;
167
					}
168
				}
169
				$timeparts['month'] = $monthstr;
170
				$timeparts['day'] = $daystr;
171
			}			
172
			$timeparts['hour'] = $timehourstr;
173
			$timeparts['rangedescr'] = $timedescrstr;
174
			$schedule['timerange'][$x] = $timeparts;
175
		}
176
	}
177
	
178
	if (!$timerangeFound)
179
		$input_errors[] = gettext("The schedule must have at least one time range configured.");
180
		
181
	if (!$input_errors) {		
182
		
183
		if (!empty($pconfig['schedlabel']))
184
			$schedule['schedlabel'] = $pconfig['schedlabel'];
185
		else
186
			$schedule['schedlabel'] = uniqid();
187

    
188
		if (isset($id) && $a_schedules[$id]){
189
			$a_schedules[$id] = $schedule;
190
		}
191
		else{
192
			$a_schedules[] = $schedule;
193
		}
194
		schedule_sort();
195
		if (write_config())
196
			filter_configure();
197

    
198
		header("Location: firewall_schedule.php");
199
		exit;
200
		
201
	}
202
	//we received input errors, copy data to prevent retype
203
	else
204
	{
205
		if (!$_POST['schedule0'])
206
			$getSchedule = false;
207
		else
208
			$getSchedule = true;
209
		$pconfig['name'] = $schedule['name'];
210
		$pconfig['descr'] = $schedule['descr'];
211
		$pconfig['timerange'] = $schedule['timerange'];
212
	}	
213

    
214
}
215
include("head.inc");
216

    
217
/* put your custom HTML head content here        */
218
/* using some of the $pfSenseHead function calls */
219
$jscriptstr = <<<EOD
220
<script type="text/javascript">
221
//<![CDATA[
222
var daysSelected = "";
223
var month_array = ['January','February','March','April','May','June','July','August','September','October','November','December'];
224
var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun'];
225
var schCounter = 0;
226

    
227
function rgb2hex(rgb) {
228
	var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
229
	if (parts == null)
230
		return;
231
	function hex(x) {
232
		return ("0" + parseInt(x).toString(16)).slice(-2);
233
	}
234
	return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase();
235
}
236

    
237
function repeatExistingDays(){
238
	var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
239
	
240
	var dayarray = daysSelected.split(",");
241
	for (i=0; i<=dayarray.length; i++){
242
		tempstr = dayarray[i];
243
		tempstrdaypos = tempstr.search("p");
244
		week = tempstr.substring(1,tempstrdaypos);
245
		week = parseInt(week);
246
		dashpos = tempstr.search("-");		
247
		daypos = tempstr.substring(tempstrdaypos+1, dashpos);
248
		daypos = parseInt(daypos);
249
		
250
		daydone = dayposdone.search(daypos);
251
		tempstr = 'w' + week + 'p' + daypos;
252
		daycell = eval('document.getElementById(tempstr)');
253
		if (daydone == "-1"){
254
			if (rgb2hex(daycell.style.backgroundColor) == "#F08080")  // lightcoral
255
				daytogglerepeating(week,daypos,true);
256
			else
257
				daytogglerepeating(week,daypos,false);
258
			dayposdone += daypos + ",";
259
		}
260
	}	
261
}
262

    
263
function daytogglerepeating(week,daypos,bExists){
264
	var tempstr, daycell, dayoriginal = "";
265
	for (j=1; j<=53; j++)
266
	{						
267
		tempstr = 'w' + j + 'p' + daypos;
268
		daycell = eval('document.getElementById(tempstr)');
269
		dayoriginalpos =  daysSelected.indexOf(tempstr);
270
		
271
		//if bExists set to true, means cell is already select it
272
		//unselect it and remove original day from daysSelected string		
273
	
274
		if (daycell != null)
275
		{
276
			if (bExists){	
277
				daycell.style.backgroundColor = "#FFFFFF";  // white
278
			}
279
			else
280
			{
281
				daycell.style.backgroundColor = "#F08080";  // lightcoral		
282
			}	
283
	
284
			if (dayoriginalpos != "-1")
285
			{						
286
				dayoriginalend = daysSelected.indexOf(',', dayoriginalpos);
287
				tempstr = daysSelected.substring(dayoriginalpos, dayoriginalend+1);
288
				daysSelected = daysSelected.replace(tempstr, "");
289
				
290
			}				
291
		}			
292
	}	
293
}
294

    
295
function daytoggle(id) {
296
	var runrepeat, tempstr = "";
297
	var bFoundValid = false;
298
	
299
	iddashpos = id.search("-");
300
	var tempstrdaypos = id.search("p");
301
	var week = id.substring(1,tempstrdaypos);
302
	week = parseInt(week);
303
	
304
	if (iddashpos == "-1")
305
	{
306
		idmod = id;
307
		runrepeat = true;
308
		var daypos = id.substr(tempstrdaypos+1);	
309
	}
310
	else
311
	{		
312
		idmod = id.substring(0,iddashpos);
313
		var daypos = id.substring(tempstrdaypos+1,iddashpos);
314
	}
315
	
316
	daypos = parseInt(daypos);
317
	
318
	while (!bFoundValid){
319
		var daycell = document.getElementById(idmod);		
320
	
321
		if (daycell != null){
322
			if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){  // red
323
				daycell.style.backgroundColor = "#FFFFFF";  // white
324
				str = id + ",";
325
				daysSelected = daysSelected.replace(str, "");
326
			}
327
			else if (rgb2hex(daycell.style.backgroundColor) == "#F08080")  // lightcoral
328
			{
329
				daytogglerepeating(week,daypos,true);
330
			}
331
			else //color is white cell
332
			{
333
				if (!runrepeat)
334
				{
335
					daycell.style.backgroundColor = "#FF0000";  // red
336
				}
337
				else
338
				{
339
					daycell.style.backgroundColor = "#F08080";  // lightcoral
340
					daytogglerepeating(week,daypos,false);								
341
				}
342
				daysSelected += id + ",";
343
			}
344
			bFoundValid = true;
345
		}
346
		else
347
		{
348
			//we found an invalid cell when column was clicked, move up to the next week
349
			week++;
350
			tempstr = "w" + week + "p" + daypos;
351
			idmod = tempstr;			
352
		}
353
	}
354
}
355

    
356
function update_month(){
357
	var indexNum = document.forms[0].monthsel.selectedIndex;
358
	var selected = document.forms[0].monthsel.options[indexNum].text;
359

    
360
	for (i=0; i<=11; i++){
361
		option = document.forms[0].monthsel.options[i].text;
362
		document.popupMonthLayer = eval('document.getElementById (option)');
363
		
364
		if(selected == option) {
365
			document.popupMonthLayer.style.display="block";
366
		}
367
		else
368
			document.popupMonthLayer.style.display="none";
369
	}
370
}
371

    
372
function checkForRanges(){
373
	if (daysSelected != "")
374
	{
375
		alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range.");
376
		return false;
377
	}
378
	else
379
	{
380
		return true;
381
	}
382
}
383

    
384
function processEntries(){
385
	var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = "";
386
	var passedValidiation = true;
387
	
388
	//get time specified
389
	starttimehour = parseInt(document.getElementById("starttimehour").value);
390
	starttimemin = parseInt(document.getElementById("starttimemin").value);
391
	stoptimehour = parseInt(document.getElementById("stoptimehour").value);
392
	stoptimemin = parseInt(document.getElementById("stoptimemin").value);
393

    
394

    
395
	//do time checks	
396
	if (starttimehour > stoptimehour)
397
	{
398
		errors = "Error: Start Hour cannot be greater than Stop Hour.";
399
		passedValidiation = false;
400
		
401
	}
402
	else if (starttimehour == stoptimehour)
403
	{
404
		if (starttimemin > stoptimemin){
405
			errors = "Error: Start Minute cannot be greater than Stop Minute.";
406
			passedValidiation = false;
407
		}
408
	}	
409
		
410
	if (passedValidiation){
411
		addTimeRange();
412
	}
413
	else {
414
		if (errors != "")
415
			alert(errors);
416
	}
417
}
418

    
419
function addTimeRange(){
420
	var tempdayarray = daysSelected.split(",");
421
	var tempstr, tempFriendlyDay, starttimehour, starttimemin, stoptimehour, nrtempFriendlyTime, rtempFriendlyTime, nrtempID, rtempID = "";
422
	var stoptimemin, timeRange, tempstrdaypos, week, daypos, day, month, dashpos, nrtempTime, rtempTime, monthstr, daystr = "";
423
	rtempFriendlyTime = "";
424
	nrtempFriendlyTime = "";
425
	nrtempID = "";
426
	rtempID = "";
427
	nrtempTime = "";
428
	rtempTime = "";
429
	tempdayarray.sort();	
430
	rtempFriendlyDay = "";
431
	monthstr = "";
432
	daystr = "";
433
	
434
	//check for existing entries
435
	var findCurrentCounter;
436
	for (u=0; u<99; u++){
437
		findCurrentCounter = document.getElementById("schedule" + u);
438
		if (!findCurrentCounter)
439
		{
440
			schCounter = u;
441
			break;
442
		}
443
	}
444
		
445
	if (daysSelected != ""){
446
		//get days selected
447
		for (i=0; i<tempdayarray.length; i++)
448
		{
449
			tempstr = tempdayarray[i];
450
			if (tempstr != "")
451
			{			
452
				tempstrdaypos = tempstr.search("p");
453
				week = tempstr.substring(1,tempstrdaypos);
454
				week = parseInt(week);
455
				dashpos = tempstr.search("-");			
456
				
457
				if (dashpos != "-1")
458
				{	
459
					var nonrepeatingfound = true;
460
					daypos = tempstr.substring(tempstrdaypos+1, dashpos);
461
					daypos = parseInt(daypos);	
462
					monthpos = tempstr.search("m");	
463
					tempstrdaypos = tempstr.search("d");
464
					month = tempstr.substring(monthpos+1, tempstrdaypos);
465
					month = parseInt(month);
466
					day = tempstr.substring(tempstrdaypos+1);
467
					day = parseInt(day);
468
					monthstr += month + ",";
469
					daystr += day + ",";
470
					nrtempID += tempstr + ",";
471
				}
472
				else
473
				{	
474
					var repeatingfound = true;
475
					daypos = tempstr.substr(tempstrdaypos+1);
476
					daypos = parseInt(daypos);	
477
					rtempFriendlyDay += daypos + ",";
478
					rtempID += daypos + ",";					
479
				}		
480
			}				
481
		}	
482
		
483
		//code below spits out friendly look format for nonrepeating schedules
484
		var foundEnd = false;
485
		var firstDayFound = false;
486
		var firstprint = false;
487
		var tempFriendlyMonthArray = monthstr.split(",");
488
		var tempFriendlyDayArray = daystr.split(",");
489
		var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = "";
490
		for (k=0; k<tempFriendlyMonthArray.length; k++){
491
			tempstr = tempFriendlyMonthArray[k];
492
			if (tempstr != ""){
493
				if (!firstDayFound)
494
				{
495
					firstDay = tempFriendlyDayArray[k];
496
					firstDay = parseInt(firstDay);
497
					firstMonth = tempFriendlyMonthArray[k];
498
					firstMonth = parseInt(firstMonth);
499
					firstDayFound = true;
500
				}
501
				currentDay = tempFriendlyDayArray[k];
502
				currentDay = parseInt(currentDay);
503
				//get next day
504
				nextDay = tempFriendlyDayArray[k+1];
505
				nextDay = parseInt(nextDay);
506
				//get next month
507
				
508
				currentDay++;						
509
				if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){
510
					if (firstprint)
511
						nrtempFriendlyTime += ", ";
512
					currentDay--;
513
					if (currentDay != firstDay)
514
						nrtempFriendlyTime += month_array[firstMonth-1] + " " + firstDay + "-" + currentDay;
515
					else
516
						nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay; 
517
					firstDayFound = false;	
518
					firstprint = true;			
519
				}
520
			}			
521
		}		
522
		
523
		//code below spits out friendly look format for repeating schedules
524
		foundEnd = false;
525
		firstDayFound = false;
526
		firstprint = false;
527
		tempFriendlyDayArray = rtempFriendlyDay.split(",");
528
		tempFriendlyDayArray.sort();
529
		currentDay, firstDay, nextDay = "";
530
		for (k=0; k<tempFriendlyDayArray.length; k++){
531
			tempstr = tempFriendlyDayArray[k];
532
			if (tempstr != ""){
533
				if (!firstDayFound)
534
				{
535
					firstDay = tempFriendlyDayArray[k];
536
					firstDay = parseInt(firstDay);
537
					firstDayFound = true;
538
				}
539
				currentDay = tempFriendlyDayArray[k];
540
				currentDay = parseInt(currentDay);
541
				//get next day
542
				nextDay = tempFriendlyDayArray[k+1];
543
				nextDay = parseInt(nextDay);
544
				currentDay++;					
545
				if (currentDay != nextDay){
546
					if (firstprint)
547
						rtempFriendlyTime += ", ";
548
					currentDay--;
549
					if (currentDay != firstDay)
550
						rtempFriendlyTime += day_array[firstDay-1] + " - " + day_array[currentDay-1];
551
					else
552
						rtempFriendlyTime += day_array[firstDay-1];
553
					firstDayFound = false;	
554
					firstprint = true;			
555
				}
556
			}
557
		}			
558
		
559
		//sort the tempID
560
		var tempsortArray = rtempID.split(",");
561
		var isFirstdone = false;
562
		tempsortArray.sort();
563
		//clear tempID
564
		rtempID = "";
565
		for (t=0; t<tempsortArray.length; t++)
566
		{
567
			if (tempsortArray[t] != ""){
568
				if (!isFirstdone){
569
					rtempID += tempsortArray[t];
570
					isFirstdone = true;
571
				}
572
				else
573
					rtempID += "," + tempsortArray[t];
574
			}
575
		} 
576
		
577
		 
578
		//get time specified
579
		starttimehour =  document.getElementById("starttimehour").value
580
		starttimemin = document.getElementById("starttimemin").value;
581
		stoptimehour = document.getElementById("stoptimehour").value;
582
		stoptimemin = document.getElementById("stoptimemin").value;
583
		
584
		timeRange = "||" + starttimehour + ":";
585
		timeRange += starttimemin + "-";
586
		timeRange += stoptimehour + ":";	
587
		timeRange += stoptimemin;		
588
				
589
		//get description for time range
590
		var tempdescr = document.getElementById("timerangedescr").value		
591
		
592
		if (nonrepeatingfound){
593
			nrtempTime += nrtempID;
594
			//add time ranges
595
			nrtempTime += timeRange;			
596
			//add description
597
			nrtempTime += "||" + tempdescr;
598
			insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID);
599
		}
600
		
601
		if (repeatingfound){
602
			rtempTime += rtempID;
603
			//add time ranges
604
			rtempTime += timeRange;
605
			//add description
606
			rtempTime += "||" + tempdescr;
607
			insertElements(rtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, rtempTime, rtempID);
608
		}
609
		
610
	}
611
	else
612
	{
613
		//no days were selected, alert user
614
		alert ("You must select at least 1 day before adding time");
615
	}
616
}
617

    
618
function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID){
619
	
620
		//add it to the schedule list
621
		d = document;
622
		tbody = d.getElementById("scheduletable").getElementsByTagName("tbody").item(0);
623
		tr = d.createElement("tr");
624
		td = d.createElement("td");
625
		td.innerHTML= "<span class='vexpl'>" + tempFriendlyTime + "<\/span>";
626
		tr.appendChild(td);	
627
			
628
		td = d.createElement("td");
629
		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 + "' />";
630
		tr.appendChild(td);
631
		
632
		td = d.createElement("td");
633
		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 + "' />";
634
		tr.appendChild(td);
635
		
636
		td = d.createElement("td");
637
		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 + "' />";
638
		tr.appendChild(td);
639
		
640
		td = d.createElement("td");
641
		td.innerHTML = "<a onclick='editRow(\"" + tempTime + "\",this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_e.gif' alt='edit' /></\a>";
642
		tr.appendChild(td);
643
			
644
		td = d.createElement("td");
645
		td.innerHTML = "<a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/" + theme + "/images/icons/icon_x.gif' alt='remove' /></\a>";
646
		tr.appendChild(td);
647
		
648
		td = d.createElement("td");		
649
		td.innerHTML="<input type='hidden' id='schedule" + schCounter + "' name='schedule" + schCounter + "' value='" + tempID + "' />";		
650
		tr.appendChild(td);
651
		tbody.appendChild(tr);
652
		
653
		schCounter++;
654
		
655
		//reset calendar and time and descr
656
		clearCalendar();
657
		clearTime();
658
		clearDescr();
659
}
660

    
661

    
662
function clearCalendar(){
663
	var tempstr, daycell = "";
664
	//clear days selected
665
	daysSelected = "";
666
	//loop through all 52 weeks
667
	for (j=1; j<=53; j++)
668
	{
669
		//loop through all 7 days
670
		for (k=1; k<8; k++){
671
			tempstr = 'w' + j + 'p' + k;
672
			daycell = eval('document.getElementById(tempstr)');
673
			if (daycell != null){
674
				daycell.style.backgroundColor = "#FFFFFF";  // white	
675
			}	
676
		}
677
	}	
678
}
679

    
680
function clearTime(){
681
	document.getElementById("starttimehour").value = "0";
682
	document.getElementById("starttimemin").value = "00";
683
	document.getElementById("stoptimehour").value = "23";
684
	document.getElementById("stoptimemin").value = "59";
685
}
686

    
687
function clearDescr(){
688
	document.getElementById("timerangedescr").value = "";
689
}
690

    
691
function editRow(incTime, el) {
692
	var check = checkForRanges();
693
	
694
	if (check){  
695
		
696
		//reset calendar and time
697
		clearCalendar();
698
		clearTime();
699
		
700
		var starttimehour, descr, days, tempstr, starttimemin, hours, stoptimehour, stoptimemin = ""; 
701
		
702
		tempArray = incTime.split ("||");
703
		
704
		days = tempArray[0];
705
		hours = tempArray[1];
706
		descr = tempArray[2];
707
		
708
		var tempdayArray = days.split(",");
709
		var temphourArray = hours.split("-");
710
		tempstr = temphourArray[0];
711
		var temphourArray2 = tempstr.split(":");
712
	
713
		document.getElementById("starttimehour").value = temphourArray2[0];
714
		document.getElementById("starttimemin").value = temphourArray2[1];	
715
		
716
		tempstr = temphourArray[1];
717
		temphourArray2 = tempstr.split(":");
718
		
719
		document.getElementById("stoptimehour").value = temphourArray2[0];
720
		document.getElementById("stoptimemin").value = temphourArray2[1];
721
		
722
		document.getElementById("timerangedescr").value = descr;
723
	
724
		//toggle the appropriate days
725
		for (i=0; i<tempdayArray.length; i++)
726
		{
727
			if (tempdayArray[i]){
728
				var tempweekstr = tempdayArray[i];
729
				dashpos = tempweekstr.search("-");			
730
						
731
				if (dashpos == "-1")
732
				{
733
					tempstr = "w2p" + tempdayArray[i];
734
				}
735
				else
736
				{
737
					tempstr = tempdayArray[i];
738
				}
739
				daytoggle(tempstr);
740
			}
741
		}
742
		removeRownoprompt(el);
743
	}
744
}
745

    
746
function removeRownoprompt(el) {
747
    var cel;
748
    while (el && el.nodeName.toLowerCase() != "tr")
749
	    el = el.parentNode;
750

    
751
    if (el && el.parentNode) {
752
	cel = el.getElementsByTagName("td").item(0);
753
	el.parentNode.removeChild(el);
754
    }
755
}
756

    
757

    
758
function removeRow(el) {
759
	var check = confirm ("Do you really want to delete this time range?");
760
	if (check){
761
	    var cel;
762
	    while (el && el.nodeName.toLowerCase() != "tr")
763
		    el = el.parentNode;
764
	
765
	    if (el && el.parentNode) {
766
		cel = el.getElementsByTagName("td").item(0);
767
		el.parentNode.removeChild(el);
768
	    }
769
	}
770
}
771
//]]>
772
</script>
773
EOD;
774
?>
775

    
776
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
777

    
778

    
779
<?php include("fbegin.inc");	echo $jscriptstr; ?>
780
<?php if ($input_errors) print_input_errors($input_errors); ?>
781
<div id="inputerrors"></div>
782

    
783
<form action="firewall_schedule_edit.php" method="post" name="iform" id="iform">
784
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall schedule">
785
		<tr>
786
			<td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule information");?></td>
787
		</tr>	
788
        <tr>
789
          <td>
790
			  <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
791
               	<tr>
792
				  <td width="15%" valign="top" class="vncellreq"><?=gettext("Schedule Name");?></td>
793
				  <td width="85%" class="vtable">
794
				  <?php if(is_schedule_inuse($pconfig['name']) == true): ?>
795
				  			<input name="name" type="hidden" id="name" size="40"  value="<?=htmlspecialchars($pconfig['name']);?>" />
796
						  <?php echo $pconfig['name']; ?>
797
						      <p>
798
						        <span class="vexpl"><?=gettext("NOTE: This schedule is in use so the name may not be modified!");?></span>
799
						      </p>
800
				<?php else: ?>
801
				  <input name="name" type="text" id="name" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['name']);?>" /><br />
802
				      	<span class="vexpl">
803
     					   <?=gettext("The name of the alias may only consist of the characters a-z, A-Z and 0-9");?>
804
      					</span>
805
      			<?php endif; ?>   					
806
				  </td>
807
				</tr>
808
				<tr>
809
					<td width="15%" valign="top" class="vncell"><?=gettext("Description");?></td>
810
					<td width="85%" class="vtable"><input name="descr" type="text" id="descr" size="40" maxlength="40" class="formfld unknown" value="<?=htmlspecialchars($pconfig['descr']);?>" /><br />
811
 						<span class="vexpl">
812
				        	<?=gettext("You may enter a description here for your reference (not parsed).");?>
813
				      	</span>
814
				  
815
					</td>
816
				</tr>
817
				<!-- tr>
818
				</tr -->
819
			    <tr>
820
				  <td width="15%" valign="top" class="vncellreq"><?=gettext("Month");?></td>
821
				  <td width="85%" class="vtable">
822
                    <select name="monthsel" class="formselect" id="monthsel" onchange="update_month();">
823
                    	<?php 
824
                    	$monthcounter = date("n");
825
                    	$monthlimit = $monthcounter + 12;
826
                    	$yearcounter = date("Y");
827
                    	for ($k=0; $k<12; $k++){?>	             
828
                    		<option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
829
                          <?php        	
830
                          if ($monthcounter == 12)
831
							{
832
								$monthcounter = 1;
833
								$yearcounter++;
834
							}
835
							else
836
							{
837
								$monthcounter++;
838
							}	
839
						} ?>      	
840
                    </select><br /><br />
841
            		<?php
842
            		$firstmonth = TRUE;
843
            		$monthcounter = date("n");
844
            		$yearcounter = date("Y");
845
            		for ($k=0; $k<12; $k++){
846
						$firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
847
						if ($firstdayofmonth == 0)
848
							$firstdayofmonth = 7;
849
							
850
						$daycounter = 1;
851
						//number of day in month
852
						$numberofdays = date("t", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
853
						$firstdayprinted = FALSE;
854
						$lasttr = FALSE;
855
						$positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc						
856
						?>	
857
	                        <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";?>">    	
858
		                   	<table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont" summary="month">
859
								<tr><td colspan="7" align="center" class="listbg"><b><?php echo date("F_Y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></b></td>
860
								</tr>
861
								<tr>	
862
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p1');"><u><b><?=gettext("Mon");?></b></u></td>
863
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p2');"><u><b><?=gettext("Tue");?></b></u></td>
864
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p3');"><u><b><?=gettext("Wed");?></b></u></td>
865
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p4');"><u><b><?=gettext("Thu");?></b></u></td>
866
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p5');"><u><b><?=gettext("Fri");?></b></u></td>
867
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p6');"><u><b><?=gettext("Sat");?></b></u></td>
868
									<td align="center" class="listhdrr" style="cursor: pointer;" onclick="daytoggle('w1p7');"><u><b><?=gettext("Sun");?></b></u></td>
869
								</tr>
870
								<?php			
871
								$firstmonth = FALSE;				
872
								while ($daycounter<=$numberofdays){
873
									$weekcounter =  date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
874
									$weekcounter = ltrim($weekcounter, "0");
875
									if ($positioncounter == 1)
876
									{
877
										echo "<tr>";
878
									}											
879
									if ($firstdayofmonth == $positioncounter){?>
880
										<td align="center" style="cursor: pointer;" class="listr" id="w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
881
										<?php echo $daycounter;
882
										$daycounter++;
883
										$firstdayprinted = TRUE;
884
										echo "</td>";
885
									}
886
									elseif ($firstdayprinted == TRUE && $daycounter <= $numberofdays){?>
887
										<td align="center" style="cursor: pointer;" class="listr" id="w<?=$weekcounter;?>p<?=$positioncounter;?>" onclick="daytoggle('w<?=$weekcounter;?>p<?=$positioncounter;?>-m<?=$monthcounter;?>d<?=$daycounter;?>');">
888
										<?php echo $daycounter;
889
										$daycounter++;
890
										echo "</td>";
891
									}
892
									else
893
									{
894
										echo "<td align=\"center\" class=\"listr\"></td>";
895
									}
896
									
897
									if ($positioncounter == 7 || $daycounter > $numberofdays){
898
										$positioncounter = 1;
899
										echo "</tr>";
900
									}
901
									else{
902
										$positioncounter++;
903
									}
904
								
905
								}//end while loop?>	
906
							</table>
907
							</div>
908
					<?php 
909
						
910
						if ($monthcounter == 12)
911
						{
912
							$monthcounter = 1;
913
							$yearcounter++;
914
						}
915
						else
916
						{
917
							$monthcounter++;
918
						}					
919
					} //end for loop
920
					?>
921
							<br />
922
					<?=gettext("Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday.");?>
923
	                 </td>
924
				</tr>
925
				<tr>
926
				  <td width="15%" valign="top" class="vncellreq"><?=gettext("Time");?></td>
927
				  <td width="85%" class="vtable">
928
				  	<table cellspacing="2" class="tabcont" summary="time">
929
				  		<tr>
930
				  			<td class="listhdrr" align="center"><?=gettext("Start Time");?></td><td></td><td class="listhdrr" align="center"><?=gettext("Stop Time");?></td>
931
				  		</tr>
932
				  		<tr>
933
				  			<td>
934
				  				<select name="starttimehour" class="formselect" id="starttimehour">
935
				  					<?php 
936
				  						for ($i=0; $i<24; $i++)
937
				  						{				  							
938
				  							echo "<option value=\"$i\">";
939
				  							echo $i;
940
				  							echo "</option>";
941
				  						}
942
				  					?>
943
				  				</select>&nbsp;<?=gettext("Hr"); ?>&nbsp;&nbsp;
944
				  				<select name="starttimemin" class="formselect" id="starttimemin">
945
				  					<option value="00">00</option>
946
				  					<option value="15">15</option>
947
				  					<option value="30">30</option>
948
				  					<option value="45">45</option>
949
				  					<option value="59">59</option>
950
				  				</select>&nbsp;<?=gettext("Min"); ?>
951
				  			</td>
952
				  			<td></td>
953
				  			<td>
954
				  				<select name="stoptimehour" class="formselect" id="stoptimehour">
955
				  				<?php 
956
				  						for ($i=0; $i<24; $i++)
957
				  						{
958
				  							if ($i==23)
959
				  								$selected = "selected=\"selected\"";
960
				  							else
961
				  								$selected = "";
962
				  								
963
				  							echo "<option value=\"$i\" $selected>";
964
				  							echo $i;
965
				  							echo "</option>";
966
				  						}
967
				  					?>
968
				  				</select>&nbsp;<?=gettext("Hr");?>&nbsp;&nbsp;
969
				  				<select name="stoptimemin" class="formselect" id="stoptimemin">
970
				  					<option value="00">00</option>
971
				  					<option value="15">15</option>
972
				  					<option value="30">30</option>
973
				  					<option value="45">45</option>
974
				  					<option value="59" selected="selected">59</option>
975
				  				</select>&nbsp;<?=gettext("Min");?>
976
				  			</td>
977
				  		</tr>
978
				  	</table><br />
979
                   <?=gettext("Select the time range for the day(s) selected on the Month(s) above. A full day is 0:00-23:59.")?>
980
					</td>
981
				</tr>
982
				<tr>
983
					<td width="15%" valign="top" class="vncell"><?=gettext("Time Range Description")?></td>
984
					<td width="85%" class="vtable"><input name="timerangedescr" type="text" class="formfld unknown" id="timerangedescr" size="40" maxlength="40" /><br />
985
 						<span class="vexpl">
986
				        	<?=gettext("You may enter a description here for your reference (not parsed).")?>
987
				      	</span>     
988
				      </td>					
989
				</tr>
990
				<tr>
991
				  <td width="22%" valign="top">&nbsp;</td>
992
				  <td width="78%">
993
				  	<input type="button" value="<?=gettext("Add Time");?>"  class="formbtn"  onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
994
				  	<input type="button" value="<?=gettext("Clear Selection");?>" class="formbtn" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
995
                    </td>
996
				</tr>
997
				<tr>
998
				  <td width="15%" valign="top" class="vtable"></td>
999
				  <td width="85%" class="vtable">
1000
                    </td>
1001
				</tr>
1002
				<tr>
1003
					<td colspan="2" valign="top" class="listtopic"><?=gettext("Schedule repeat");?></td>
1004
				</tr>	
1005
				<tr>
1006
					<td width="15%" valign="top" class="vncellreq"><?=gettext("Configured Ranges");?></td>
1007
					<td width="85%">
1008
						<table id="scheduletable" summary="range">
1009
							<tbody>
1010
								<tr>
1011
									<td align="center" class="listbg" width="35%"><?=gettext("Day(s)");?></td>
1012
									<td align="center" class="listbg" width="12%"><?=gettext("Start Time");?></td>
1013
									<td align="center" class="listbg" width="11%"><?=gettext("Stop Time");?></td>
1014
									<td align="center" class="listbg" width="42%"><?=gettext("Description");?></td>
1015
								</tr>
1016
								<?php
1017
								if ($getSchedule){
1018
									$counter = 0;
1019
																		
1020
									foreach($pconfig['timerange'] as $timerange) {
1021
										$tempFriendlyTime = "";
1022
										$tempID = "";
1023
										if ($timerange){
1024
											$dayFriendly = "";
1025
											$tempFriendlyTime = "";
1026
											$timedescr = $timerange['rangedescr'];			
1027
												
1028
											//get hours
1029
											$temptimerange = $timerange['hour'];
1030
											$temptimeseparator = strrpos($temptimerange, "-");
1031
											
1032
											$starttime = substr ($temptimerange, 0, $temptimeseparator); 
1033
											$stoptime = substr ($temptimerange, $temptimeseparator+1); 
1034
											$currentDay = "";
1035
											$firstDay = "";
1036
											$nextDay = "";
1037
											$foundEnd = false;
1038
											$firstDayFound = false;
1039
											$firstPrint = false;	
1040
											$firstprint2 = false;
1041
											
1042
											if ($timerange['month']){
1043
												$tempmontharray = explode(",", $timerange['month']);
1044
												$tempdayarray = explode(",",$timerange['day']);
1045
												$arraycounter = 0;
1046
												foreach ($tempmontharray as $monthtmp){
1047
													$month = $tempmontharray[$arraycounter];
1048
													$day = $tempdayarray[$arraycounter];
1049
													$daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y")));
1050
													//if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this.
1051
													if ($daypos == 0){
1052
														$daypos = 7;
1053
													}									
1054
													$weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y")));
1055
													$weeknumber = ltrim($weeknumber, "0");		
1056
																										
1057
													if ($firstPrint)
1058
													{
1059
														$tempID .= ",";
1060
													}
1061
													$tempID .= "w" . $weeknumber . "p" . $daypos . "-m" .  $month . "d" . $day;
1062
													$firstPrint = true;
1063
													
1064
													if (!$firstDayFound)
1065
													{
1066
														$firstDay = $day;
1067
														$firstmonth = $month;
1068
														$firstDayFound = true;
1069
													}
1070
														
1071
													$currentDay = $day;
1072
													$nextDay = $tempdayarray[$arraycounter+1];
1073
													$currentDay++;
1074
													if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
1075
														if ($firstprint2)
1076
															$tempFriendlyTime .= ", ";
1077
														$currentDay--;
1078
														if ($currentDay != $firstDay)
1079
															$tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
1080
														else
1081
															$tempFriendlyTime .=  $monthArray[$month-1] . " " . $day;
1082
														$firstDayFound = false;	
1083
														$firstprint2 = true;
1084
													}													
1085
													$arraycounter++;			
1086
												}																						
1087
												
1088
											}
1089
											else
1090
											{
1091
												$dayFriendly = $timerange['position'];
1092
												$tempID = $dayFriendly;
1093
											}											
1094
											
1095
											$tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr;
1096
									
1097
											//following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed
1098
											$foundEnd = false;
1099
											$firstDayFound = false;
1100
											$firstprint = false;
1101
											$tempFriendlyDayArray = explode(",", $dayFriendly);
1102
											$currentDay = "";
1103
											$firstDay = "";
1104
											$nextDay = "";
1105
											$i = 0;
1106
											if (!$timerange['month']){										
1107
												foreach ($tempFriendlyDayArray as $day){
1108
													if ($day != ""){
1109
														if (!$firstDayFound)
1110
														{
1111
															$firstDay = $tempFriendlyDayArray[$i];
1112
															$firstDayFound = true;
1113
														}
1114
														$currentDay =$tempFriendlyDayArray[$i];
1115
														//get next day
1116
														$nextDay = $tempFriendlyDayArray[$i+1];
1117
														$currentDay++;					
1118
														if ($currentDay != $nextDay){
1119
															if ($firstprint)
1120
																$tempFriendlyTime .= ", ";
1121
															$currentDay--;
1122
															if ($currentDay != $firstDay)
1123
																$tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
1124
															else
1125
																$tempFriendlyTime .= $dayArray[$firstDay-1];
1126
															$firstDayFound = false;	
1127
															$firstprint = true;			
1128
														}
1129
														$i++;
1130
													}
1131
												}		
1132
											}	
1133
												
1134
																																													
1135
									?>
1136
						          <tr>
1137
						          	<td>
1138
						          		<span class="vexpl"><?php echo $tempFriendlyTime; ?></span>
1139
						          	</td>
1140
									<td>
1141
						              <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; ?>' />
1142
							        </td>
1143
						            <td>
1144
						              <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; ?>' /> 
1145
							        </td>
1146
							        <td>
1147
							        	<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; ?>' />
1148
							        </td>
1149
							        <td>
1150
							        	<a onclick='editRow("<?php echo $tempTime; ?>",this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif' alt='edit' /></a>
1151
							        </td>
1152
							        <td>
1153
							        	<a onclick='removeRow(this); return false;' href='#'><img border='0' src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' alt='remove' /></a>
1154
							        </td>
1155
							        <td>
1156
							        	<input type='hidden' id='schedule<?php echo $counter; ?>' name='schedule<?php echo $counter; ?>' value='<?php echo $tempID; ?>' />
1157
							        </td>
1158
						          </tr>
1159
									<?php
1160
						        $counter++;
1161
									}//end if						
1162
						        } // end foreach	
1163
								}//end if							
1164
								?>
1165
							</tbody>	
1166
						</table>				
1167
					</td>
1168
				</tr>
1169
			 	<tr>
1170
				    <td width="15%" valign="top">&nbsp;</td>
1171
				    <td width="85%">
1172
				      <input id="submit" name="submit" type="submit" onclick="return checkForRanges();" class="formbtn" value="<?=gettext("Save"); ?>" />
1173
				      <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
1174
				      <input name="referer" type="hidden" value="<?=$referer;?>" />
1175
				      <?php if (isset($id) && $a_schedules[$id]): ?>
1176
				      <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
1177
				      <?php endif; ?>
1178
				    </td>
1179
			  	</tr>
1180
			 </table>
1181
		
1182
</td></tr></table></form>
1183
<?php include("fend.inc"); ?>
1184
</body>
1185
</html>
(74-74/252)