Project

General

Profile

Download (40.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	firewall_rules.php
5
	part of pfSense (http://www.pfsense.com)
6
        Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
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:	filter
35
*/
36

    
37
##|+PRIV
38
##|*IDENT=page-firewall-rules
39
##|*NAME=Firewall: Rules page
40
##|*DESCR=Allow access to the 'Firewall: Rules' page.
41
##|*MATCH=firewall_rules.php*
42
##|-PRIV
43

    
44
$statusurl = "status_filter_reload.php";
45
$logurl = "diag_logs_filter.php";
46

    
47
require("guiconfig.inc");
48
require_once("functions.inc");
49
require_once("filter.inc");
50
require_once("shaper.inc");
51

    
52
$pgtitle = array(gettext("Firewall"),gettext("Rules"));
53

    
54
function delete_nat_association($id) {
55
	global $config;
56

    
57
	if (!$id || !is_array($config['nat']['rule']))
58
		return;
59

    
60
	$a_nat = &$config['nat']['rule'];
61

    
62
	foreach ($a_nat as &$natent)
63
		if ($natent['associated-rule-id'] == $id)
64
			$natent['associated-rule-id'] = '';
65
}
66

    
67
if (!is_array($config['filter']['rule'])) {
68
	$config['filter']['rule'] = array();
69
}
70
filter_rules_sort();
71
$a_filter = &$config['filter']['rule'];
72

    
73
$if = $_GET['if'];
74
if ($_POST['if'])
75
	$if = $_POST['if'];
76

    
77
$ifdescs = get_configured_interface_with_descr();
78

    
79
// Drag and drop reordering
80
if($_REQUEST['dragdroporder']) {
81
	// First create a new ruleset array and tmp arrays
82
	$a_filter_before = array();
83
	$a_filter_order = array();
84
	$a_filter_order_tmp = array();
85
	$a_filter_after = array();
86
	$found = false;
87
	$drag_order = $_REQUEST['dragtable'];
88
	// Next traverse through rules building a new order for interface
89
	for ($i = 0; isset($a_filter[$i]); $i++) {
90
		if(( $_REQUEST['if'] == "FloatingRules" && isset($a_filter[$i]['floating']) ) || ( $a_filter[$i]['interface'] == $_REQUEST['if'] && !isset($a_filter[$i]['floating']) )) {
91
			$a_filter_order_tmp[] = $a_filter[$i];
92
			$found = true;
93
		} else if (!$found)
94
			$a_filter_before[] = $a_filter[$i];
95
		else
96
			$a_filter_after[] = $a_filter[$i];
97
	}
98
	// Reorder rules with the posted order
99
	for ($i = 0; $i<count($drag_order); $i++)
100
		$a_filter_order[] = $a_filter_order_tmp[$drag_order[$i]];
101
	// In case $drag_order didn't account for some rules, make sure we don't lose them
102
	if(count($a_filter_order) < count($a_filter_order_tmp)) {
103
		for ($i = 0; $i<count($a_filter_order_tmp); $i++)
104
			if(!in_array($i, $drag_order))
105
				$a_filter_order[] = $a_filter_order_tmp[$i];
106
	}
107
	// Overwrite filter rules with newly created items
108
	$config['filter']['rule'] = array_merge($a_filter_before, $a_filter_order, $a_filter_after);
109
	// Write configuration
110
	$config = write_config("Drag and drop firewall rules ordering update.");
111
	// Redirect back to page
112
	mark_subsystem_dirty('filter');
113
	$undo = array();
114
	foreach($_REQUEST['dragtable'] as $dt) 
115
		$undo[] = "";
116
	$counter = 0;
117
	foreach($_REQUEST['dragtable'] as $dt) {
118
		$undo[$dt] = $counter;
119
		$counter++;
120
	}
121
	foreach($undo as $dt) 
122
		$undotxt .= "&dragtable[]={$dt}";
123
	Header("Location: firewall_rules.php?if=" . $_REQUEST['if'] . "&undodrag=true" . $undotxt);
124
	exit;
125
}
126

    
127
$icmptypes = array(
128
	"" => gettext("any"),
129
	"echoreq" => gettext("Echo request"),
130
	"echorep" => gettext("Echo reply"),
131
	"unreach" => gettext("Destination unreachable"),
132
	"squench" => gettext("Source quench"),
133
	"redir" => gettext("Redirect"),
134
	"althost" => gettext("Alternate Host"),
135
	"routeradv" => gettext("Router advertisement"),
136
	"routersol" => gettext("Router solicitation"),
137
	"timex" => gettext("Time exceeded"),
138
	"paramprob" => gettext("Invalid IP header"),
139
	"timereq" => gettext("Timestamp"),
140
	"timerep" => gettext("Timestamp reply"),
141
	"inforeq" => gettext("Information request"),
142
	"inforep" => gettext("Information reply"),
143
	"maskreq" => gettext("Address mask request"),
144
	"maskrep" => gettext("Address mask reply")
145
);
146

    
147
/* add group interfaces */
148
if (is_array($config['ifgroups']['ifgroupentry']))
149
	foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
150
		if (have_ruleint_access($ifgen['ifname']))
151
			$iflist[$ifgen['ifname']] = $ifgen['ifname'];
152

    
153
foreach ($ifdescs as $ifent => $ifdesc)
154
	if(have_ruleint_access($ifent)) 
155
		$iflist[$ifent] = $ifdesc;
156

    
157
if ($config['l2tp']['mode'] == "server")
158
        if(have_ruleint_access("l2tp"))
159
                $iflist['l2tp'] = "L2TP VPN";
160

    
161
if ($config['pptpd']['mode'] == "server")
162
	if(have_ruleint_access("pptp")) 
163
		$iflist['pptp'] = "PPTP VPN";
164

    
165
if (is_array($config['pppoes']['pppoe'])) {
166
	foreach ($config['pppoes']['pppoe'] as $pppoes)
167
		if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe"))
168
			$iflist['pppoe'] = "PPPoE Server";
169
}
170

    
171
/* add ipsec interfaces */
172
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
173
	if(have_ruleint_access("enc0")) 
174
		$iflist["enc0"] = "IPsec";
175

    
176
/* add openvpn/tun interfaces */
177
if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
178
   	$iflist["openvpn"] = "OpenVPN";
179

    
180
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/interfaces_override");
181

    
182
if (!$if || !isset($iflist[$if])) {
183
	if ("any" == $if)
184
                $if = "FloatingRules";
185
        else if ("FloatingRules" != $if) {
186
		if (isset($iflist['wan']))
187
			$if = "wan";
188
		else
189
			$if = "FloatingRules";
190
	}
191
}
192

    
193
if ($_POST) {
194

    
195
	$pconfig = $_POST;
196

    
197
	if ($_POST['apply']) {
198
		$retval = 0;
199
		$retval = filter_configure();
200

    
201
		clear_subsystem_dirty('filter');
202

    
203
		pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply");
204

    
205
		$savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br/>You can also %s monitor %s the reload progress"),"<a href='status_filter_reload.php'>","</a>");
206
	}
207
}
208

    
209
if ($_GET['act'] == "del") {
210
	if ($a_filter[$_GET['id']]) {
211
		if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
212
			delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
213
		}
214
		unset($a_filter[$_GET['id']]);
215
		write_config();
216
		mark_subsystem_dirty('filter');
217
		header("Location: firewall_rules.php?if={$if}");
218
		exit;
219
	}
220
}
221

    
222
// Handle save msg if defined
223
if($_REQUEST['savemsg']) 
224
	$savemsg = htmlentities($_REQUEST['savemsg']);
225

    
226
if (isset($_POST['del_x'])) {
227
	/* delete selected rules */
228
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
229
		foreach ($_POST['rule'] as $rulei) {
230
			delete_nat_association($a_filter[$rulei]['associated-rule-id']);
231
			unset($a_filter[$rulei]);
232
		}
233
		write_config();
234
		mark_subsystem_dirty('filter');
235
		header("Location: firewall_rules.php?if={$if}");
236
		exit;
237
	}
238
} else if ($_GET['act'] == "toggle") {
239
	if ($a_filter[$_GET['id']]) {
240
                if(isset($a_filter[$_GET['id']]['disabled']))
241
                        unset($a_filter[$_GET['id']]['disabled']);
242
                else
243
                        $a_filter[$_GET['id']]['disabled'] = true;
244
		write_config();
245
		mark_subsystem_dirty('filter');
246
		header("Location: firewall_rules.php?if={$if}");
247
		exit;
248
	}
249
} else {
250
	/* yuck - IE won't send value attributes for image buttons, while Mozilla does -
251
	   so we use .x/.y to fine move button clicks instead... */
252
	unset($movebtn);
253
	foreach ($_POST as $pn => $pd) {
254
		if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
255
			$movebtn = $matches[1];
256
			break;
257
		}
258
	}
259
	/* move selected rules before this rule */
260
	if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
261
		$a_filter_new = array();
262

    
263
		/* copy all rules < $movebtn and not selected */
264
		for ($i = 0; $i < $movebtn; $i++) {
265
			if (!in_array($i, $_POST['rule']))
266
				$a_filter_new[] = $a_filter[$i];
267
		}
268

    
269
		/* copy all selected rules */
270
		for ($i = 0; $i < count($a_filter); $i++) {
271
			if ($i == $movebtn)
272
				continue;
273
			if (in_array($i, $_POST['rule']))
274
				$a_filter_new[] = $a_filter[$i];
275
		}
276

    
277
		/* copy $movebtn rule */
278
		if ($movebtn < count($a_filter))
279
			$a_filter_new[] = $a_filter[$movebtn];
280

    
281
		/* copy all rules > $movebtn and not selected */
282
		for ($i = $movebtn+1; $i < count($a_filter); $i++) {
283
			if (!in_array($i, $_POST['rule']))
284
				$a_filter_new[] = $a_filter[$i];
285
		}
286

    
287
		$a_filter = $a_filter_new;
288
		write_config();
289
		mark_subsystem_dirty('filter');
290
		header("Location: firewall_rules.php?if={$if}");
291
		exit;
292
	}
293
}
294
$closehead = false;
295

    
296
include("head.inc");
297

    
298
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
299
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
300
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
301
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
302
?>
303
<link rel="stylesheet" href="/javascript/chosen/chosen.css" />
304
</head>
305

    
306
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
307
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
308
<?php include("fbegin.inc"); ?>
309
<form action="firewall_rules.php" method="post">
310

    
311
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js">
312
</script>
313
<?php if ($savemsg) print_info_box($savemsg); ?>
314
<?php if (is_subsystem_dirty('filter')): ?><p>
315
<?php
316
if($_REQUEST['undodrag']) {
317
	foreach($_REQUEST['dragtable'] as $dt) 
318
		$dragtable .= "&dragtable[]={$dt}";
319
	print_info_box_np_undo(gettext("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect."), "apply" , gettext("Apply changes") , "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}");
320
} else {
321
	print_info_box_np(gettext("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect."));
322
}
323
?>
324
<br>
325
<?php endif; ?>
326
<div id="loading" style="visibity:hidden">
327
	<img src="/themes/<?=$g['theme']?>/images/misc/loader.gif"> Loading, please wait...
328
	<p/>&nbsp;
329
</div>
330
<?php
331
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_table");
332
?>
333
<table width="100%" border="0" cellpadding="0" cellspacing="0">
334
  <tr><td class="tabnavtbl">
335
  <?php
336
	/* active tabs */
337
	$tab_array = array();
338
       if ("FloatingRules" == $if)
339
                        $active = true;
340
                else
341
                        $active = false;
342
        $tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules");
343
	$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
344
		if ($ifent == $if)
345
			$active = true;
346
		else
347
			$active = false;
348
		$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
349
	}
350
	display_top_tabs($tab_array);
351
  ?>
352
  </td></tr>
353
  <tr>
354
    <td>
355
	<div id="mainarea">
356
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
357
<?php
358
		pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr");
359
?>
360
			<tr id="frheader">
361
			<td width="3%" class="list">&nbsp;</td>
362
			<td width="5%" class="list">&nbsp;</td>
363
			<td width="3%" class="listhdrr"><?=gettext("ID");?></td>
364
<?php
365
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tablehead");
366
?>
367
			<td width="6%" class="listhdrr"><?=gettext("Proto");?></td>
368
			<td width="12%" class="listhdrr"><?=gettext("Source");?></td>
369
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
370
			<td width="12%" class="listhdrr"><?=gettext("Destination");?></td>
371
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
372
			<td width="5%" class="listhdrr"><?=gettext("Gateway");?></td>
373
			<td width="8%" class="listhdrr"><?=gettext("Queue");?></td>
374
			<td width="5%" class="listhdrr"><?=gettext("Schedule");?></td>
375
<?php
376
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_desc_tablehead");
377
?>
378
			<td width="19%" class="listhdr"><?=gettext("Description");?></td>
379
			<td width="10%" class="list">
380
			<table border="0" cellspacing="0" cellpadding="1">
381
			   <tr>
382
				<?php
383
					$nrules = 0;
384
					for ($i = 0; isset($a_filter[$i]); $i++) {
385
						$filterent = $a_filter[$i];
386
						if ($filterent['interface'] != $if && !isset($filterent['floating']))
387
							continue;
388
						if (isset($filterent['floating']) && "FloatingRules" != $if)
389
							continue;
390
						$nrules++;
391
					}
392
				?>
393
				<td>
394
				<?php if ($nrules == 0): ?>
395
				<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?gettext("delete selected rules"); ?>" border="0"><?php else: ?>
396
				<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')"><?php endif; ?>
397
				</td>
398
				<td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&after=-1"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td>
399
			   </tr>
400
			</table>
401
		  </td>
402
		</tr>
403
<?php   // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1.
404
	if (!isset($config['system']['webgui']['noantilockout']) &&
405
		(((count($config['interfaces']) > 1) && ($if == 'lan'))
406
		|| ((count($config['interfaces']) == 1) && ($if == 'wan')))):
407

    
408
		$guiport = "80";
409
		if (isset($config['system']['webgui']['port']) && $config['system']['webgui']['port'] <> "")
410
			$guiport = "{$config['system']['webgui']['port']}";
411
		if ($config['system']['webgui']['protocol'] == "https")
412
			$guiport .= "<br/>443";
413

    
414
		$sshport = "";
415
		if (isset($config['system']['enablesshd'])) {
416
			$sshport = ($config['system']['ssh']['port']) ? $config['system']['ssh']['port'] : 22;
417
		}
418
		$sshport = "{$sshport}<br/>";
419
?>
420
		<tr valign="top" id="antilockout">
421
			<td class="list">&nbsp;</td>
422
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0"></td>
423
			<td class="listlr" style="background-color: #E0E0E0"></td>
424
<?php
425
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout");
426
?>
427
			<td class="listr" style="background-color: #E0E0E0">*</td>
428
			<td class="listr" style="background-color: #E0E0E0">*</td>
429
			<td class="listr" style="background-color: #E0E0E0">*</td>
430
			<td class="listr" style="background-color: #E0E0E0"><?=$iflist[$if];?> Address</td>
431
			<td class="listr" style="background-color: #E0E0E0"><?= $sshport . $guiport ?></td>
432
			<td class="listr" style="background-color: #E0E0E0">*</td>
433
			<td class="listr" style="background-color: #E0E0E0">*</td>
434
			<td class="listr" style="background-color: #E0E0E0"></td>
435
			<td class="listbg"><?=gettext("Anti-Lockout Rule");?></td>
436
			<td valign="middle" nowrap class="list">
437
			<table border="0" cellspacing="0" cellpadding="1">
438
				<tr>
439
					<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td>
440
					<td><a href="system_advanced_admin.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td>
441
				</tr>
442
				<tr>
443
					<td align="center" valign="middle"></td>
444
					<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td>
445
				</tr>
446
				</table>
447
			</td>
448
			</tr>
449
<?php endif; ?>
450

    
451
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
452
                <tr valign="top" id="frrfc1918">
453
                  <td class="list">&nbsp;</td>
454
                  <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td>
455
                  <td class="listlr" style="background-color: #E0E0E0"></td>
456
                  <td class="listr" style="background-color: #E0E0E0">*</td>
457
                  <td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td>
458
                  <td class="listr" style="background-color: #E0E0E0">*</td>
459
                  <td class="listr" style="background-color: #E0E0E0">*</td>
460
                  <td class="listr" style="background-color: #E0E0E0">*</td>
461
                  <td class="listr" style="background-color: #E0E0E0">*</td>
462
		<td class="listr" style="background-color: #E0E0E0">*</td>
463
	 		 <td class="listr" style="background-color: #E0E0E0"></td>
464
                  <td class="listbg"><?=gettext("Block private networks");?></td>
465
                  <td valign="middle" nowrap class="list">
466
				    <table border="0" cellspacing="0" cellpadding="1">
467
					<tr>
468
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td>
469
					  <td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td>
470
					</tr>
471
					<tr>
472
					  <td align="center" valign="middle"></td>
473
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td>
474
					</tr>
475
					</table>
476
				  </td>
477
				</tr>
478
<?php endif; ?>
479
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
480
                <tr valign="top" id="frrfc1918">
481
                  <td class="list">&nbsp;</td>
482
                  <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td>
483
                  <td class="listlr" style="background-color: #E0E0E0"></td>
484
                  <td class="listr" style="background-color: #E0E0E0">*</td>
485
                  <td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td>
486
                  <td class="listr" style="background-color: #E0E0E0">*</td>
487
                  <td class="listr" style="background-color: #E0E0E0">*</td>
488
                  <td class="listr" style="background-color: #E0E0E0">*</td>
489
				  <td class="listr" style="background-color: #E0E0E0">*</td>
490
				   <td class="listr" style="background-color: #E0E0E0">*</td>
491
		  <td class="listr" style="background-color: #E0E0E0">*</td>
492
                  <td class="listbg"><?=gettext("Block bogon networks");?></td>
493
                  <td valign="middle" nowrap class="list">
494
				    <table border="0" cellspacing="0" cellpadding="1">
495
					<tr>
496
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>"></td>
497
					  <td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td>
498
					</tr>
499
					<tr>
500
					  <td align="center" valign="middle"></td>
501
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0"></td>
502
					</tr>
503
					</table>
504
				  </td>
505
				</tr>
506
<?php endif; ?>
507
				<tbody id="dragtable" width="100%">
508
				<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
509
					pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start");
510
					$filterent = $a_filter[$i];
511
					if ($filterent['interface'] != $if && !isset($filterent['floating']))
512
						continue;
513
					if (isset($filterent['floating']) && "FloatingRules" != $if)
514
						continue;
515
					$isadvset = firewall_check_for_advanced_options($filterent);
516
					if($isadvset)
517
						$advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\">";
518
					else 
519
						$advanced_set = "";
520
				?>
521
                <tr valign="top" id="fr<?=$nrules;?>">
522
                  <td class="listt">
523
					<input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;">
524
					<?php echo $advanced_set; ?>
525
				  </td>
526
                  <td class="listt" align="center">
527
				  <?php if ($filterent['type'] == "block")
528
				  			$iconfn = "block";
529
						else if ($filterent['type'] == "reject") {
530
							$iconfn = "reject";
531
						} else
532
							$iconfn = "pass";
533
						if (isset($filterent['disabled'])) {
534
							$textss = "<span class=\"gray\">";
535
							$textse = "</span>";
536
							$iconfn .= "_d";
537
						} else {
538
							$textss = $textse = "";
539
						}
540
				  ?>
541
				  <a href="?if=<?=htmlspecialchars($if);?>&act=toggle&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="<?=gettext("click to toggle enabled/disabled status");?>"></a>
542
				  <?php if (isset($filterent['log'])):
543
							$iconfnlog = "log_s";
544
						if (isset($filterent['disabled']))
545
							$iconfnlog .= "_d";
546
				  	?>
547
				  <br><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0">
548
				  <?php endif; ?>
549
				  </td>
550
				<?php
551
				
552
				//build Alias popup box
553
				$span_end = "";
554
				$alias_src_span_begin = "";
555
				$alias_src_port_span_begin = "";
556
				$alias_dst_span_begin = "";
557
				$alias_dst_port_span_begin = "";
558
				
559
				$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
560
				$span_end = "</U></span>";
561
					
562
				$alias_src_span_begin = $alias_popup["src"];
563
				 									
564
				$alias_src_port_span_begin = $alias_popup["srcport"];
565
													
566
				$alias_dst_span_begin = $alias_popup["dst"];
567
														
568
				$alias_dst_port_span_begin = $alias_popup["dstport"];
569
					
570
				//build Schedule popup box
571
				$a_schedules = &$config['schedules']['schedule'];
572
				$schedule_span_begin = "";
573
				$schedule_span_end = "";
574
				$sched_caption_escaped = "";
575
				$sched_content = "";
576
				$schedstatus = false;
577
				$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
578
				$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'));
579
				if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])) {
580
					foreach ($a_schedules as $schedule)
581
					{
582
						if ($schedule['name'] == $filterent['sched'] ){
583
							$schedstatus = filter_get_time_based_rule_status($schedule);
584
							
585
							foreach($schedule['timerange'] as $timerange) {
586
								$tempFriendlyTime = "";
587
								$tempID = "";
588
								$firstprint = false;
589
								if ($timerange){
590
									$dayFriendly = "";
591
									$tempFriendlyTime = "";							
592
										
593
									//get hours
594
									$temptimerange = $timerange['hour'];
595
									$temptimeseparator = strrpos($temptimerange, "-");
596
									
597
									$starttime = substr ($temptimerange, 0, $temptimeseparator); 
598
									$stoptime = substr ($temptimerange, $temptimeseparator+1); 
599
										
600
									if ($timerange['month']){
601
										$tempmontharray = explode(",", $timerange['month']);
602
										$tempdayarray = explode(",",$timerange['day']);
603
										$arraycounter = 0;
604
										$firstDayFound = false;
605
										$firstPrint = false;
606
										foreach ($tempmontharray as $monthtmp){
607
											$month = $tempmontharray[$arraycounter];
608
											$day = $tempdayarray[$arraycounter];
609
											
610
											if (!$firstDayFound)
611
											{
612
												$firstDay = $day;
613
												$firstmonth = $month;
614
												$firstDayFound = true;
615
											}
616
												
617
											$currentDay = $day;
618
											$nextDay = $tempdayarray[$arraycounter+1];
619
											$currentDay++;
620
											if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
621
												if ($firstPrint)
622
													$dayFriendly .= ", ";
623
												$currentDay--;
624
												if ($currentDay != $firstDay)
625
													$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
626
												else
627
													$dayFriendly .=  $monthArray[$month-1] . " " . $day;
628
												$firstDayFound = false;	
629
												$firstPrint = true;
630
											}													
631
											$arraycounter++;	
632
										}
633
									}
634
									else
635
									{
636
										$tempdayFriendly = $timerange['position'];
637
										$firstDayFound = false;
638
										$tempFriendlyDayArray = explode(",", $tempdayFriendly);								
639
										$currentDay = "";
640
										$firstDay = "";
641
										$nextDay = "";
642
										$counter = 0;													
643
										foreach ($tempFriendlyDayArray as $day){
644
											if ($day != ""){
645
												if (!$firstDayFound)
646
												{
647
													$firstDay = $tempFriendlyDayArray[$counter];
648
													$firstDayFound = true;
649
												}
650
												$currentDay =$tempFriendlyDayArray[$counter];
651
												//get next day
652
												$nextDay = $tempFriendlyDayArray[$counter+1];
653
												$currentDay++;					
654
												if ($currentDay != $nextDay){
655
													if ($firstprint)
656
														$dayFriendly .= ", ";
657
													$currentDay--;
658
													if ($currentDay != $firstDay)
659
														$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
660
													else
661
														$dayFriendly .= $dayArray[$firstDay-1];
662
													$firstDayFound = false;	
663
													$firstprint = true;			
664
												}
665
												$counter++;
666
											}
667
										}
668
									}		
669
									$timeFriendly = $starttime . " - " . $stoptime;
670
									$description = $timerange['rangedescr'];
671
									$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>";
672
								}
673
							}
674
							$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
675
							$schedule_span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>{$sched_caption_escaped}</h1><p>{$sched_content}</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>";
676
							$schedule_span_end = "</U></span>";
677
						}
678
					}
679
				}
680
				$printicon = false;
681
				$alttext = "";
682
				$image = "";
683
				if (!isset($filterent['disabled'])){
684
					 if ($schedstatus) 
685
					 { 
686
					 	if ($iconfn == "block" || $iconfn == "reject")
687
					 	{
688
					 		$image = "icon_block";
689
					 		$alttext = gettext("Traffic matching this rule is currently being denied");
690
					 	}
691
					 	else
692
					 	{
693
					 		$image = "icon_pass";
694
					 		$alttext = gettext("Traffic matching this rule is currently being allowed");
695
					 	}
696
					 	$printicon = true;
697
					  }
698
					  else if ($filterent['sched'])
699
					  { 
700
					 	if ($iconfn == "block" || $iconfn == "reject")
701
					 		$image = "icon_block_d";
702
					 	else
703
					 		$image = "icon_block";
704
					 	$alttext = gettext("This rule is not currently active because its period has expired");
705
					 	$printicon = true;				  	
706
					  }
707
				}
708
				?>
709
                  <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
710
                    <?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']; else echo ""; ?><?=$textse;?>
711
                  </td>
712
<?php
713
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr");
714
?>
715
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
716
                    <?=$textss;?><?php
717
			if (isset($filterent['ipprotocol'])) {
718
				switch($filterent['ipprotocol']) {
719
					case "inet":
720
						echo "IPv4 ";
721
						break;
722
					case "inet6":
723
						echo "IPv6 ";
724
						break;
725
				}
726
			} else {
727
				echo "IPv4 ";
728
			}
729
			if (isset($filterent['protocol'])) {
730
				echo strtoupper($filterent['protocol']);
731
				if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
732
					echo ' <span style="cursor: help;" title="ICMP type: ' . $icmptypes[$filterent['icmptype']] . '"><u>';
733
					echo $filterent['icmptype'];
734
					echo '</u></span>';
735
				}
736
			} else echo "*";
737
                    ?><?=$textse;?>
738
                  </td>
739
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
740
				    <?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
741
                  </td>
742
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
743
                    <?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?>
744
                  </td>
745
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
746
				    <?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
747
                  </td>
748
	              <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
749
                    <?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
750
                  </td>
751
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
752
                    <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else  echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
753
                  </td>
754
				  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><?=$textss;?>
755
                          <?php
756
							if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
757
								$desc = $filterent['ackqueue'] ;
758
							    echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>";
759
								$desc = $filterent['defaultqueue'];
760
							    echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
761
							} else if (isset($filterent['defaultqueue'])) {
762
								$desc = $filterent['defaultqueue'];
763
							    echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; }
764
							else echo gettext("none");
765
						  ?><?=$textse;?>
766
                        </td>
767
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black">
768
                    <?php if ($printicon) { ?><img src="./themes/<?= $g['theme']; ?>/images/icons/<?php echo $image; ?>.gif" title="<?php echo $alttext;?>" border="0"><?php } ?>&nbsp;<?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?><?php echo $schedule_span_end; ?><?=$textse;?>
769
                  </td>
770
<?php
771
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_descr_tr");
772
?>
773
                  <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" class="descr">
774
                    <?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
775
                  </td>
776
                  <td valign="middle" nowrap class="list">
777
				    <table border="0" cellspacing="0" cellpadding="1">
778
					<tr>
779
					  <td><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule"); ?>" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"></td>
780
					  <td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule"); ?>" width="17" height="17" border="0"></a></td>
781
					</tr>
782
					<tr>
783
					  <td align="center" valign="middle"><a href="firewall_rules.php?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule"); ?>" onclick="return confirm('Do you really want to delete this rule?')"></a></td>
784
					  <td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new rule based on this one"); ?>" width="17" height="17" border="0"></a></td>
785
					</tr>
786
					</table>
787
				  </td>
788
				</tr>
789
			  <?php $nrules++; endfor; ?>
790
			  </tbody>
791
			  <?php if ($nrules == 0): ?>
792
              <td class="listt"></td>
793
			  <td class="listt"></td>
794
			  <td class="listlr" colspan="10" align="center" valign="middle">
795
			  <span class="gray">
796
			<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
797
			  <?=gettext("No floating rules are currently defined."); ?><br/><br/>
798
			<?php else: ?>
799
			  <?=gettext("No rules are currently defined for this interface"); ?><br/>
800
			  <?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br/><br/>
801
			<?php endif; ?>
802
			  <?=gettext("Click the"); ?> <a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" border="0" width="17" height="17" align="absmiddle"></a><?=gettext(" button to add a new rule.");?></span>
803
			  </td>
804
			  <?php endif; ?>
805
                <tr id="fr<?=$nrules;?>">
806
                  <td class="list"></td>
807
                  <td class="list"></td>
808
<?php
809
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_belowtable");
810
?>
811
                  <td class="list">&nbsp;</td>
812
                  <td class="list">&nbsp;</td>
813
                  <td class="list">&nbsp;</td>
814
                  <td class="list">&nbsp;</td>
815
		  <td class="list">&nbsp;</td>
816
		  <td class="list">&nbsp;</td>
817
                  <td class="list">&nbsp;</td>
818
                  <td class="list">&nbsp;</td>
819
                  <td class="list">&nbsp;</td>
820
                  <td class="list">&nbsp;</td>
821
                  <td class="list">
822
				    <table border="0" cellspacing="0" cellpadding="1">
823
					<tr>
824
				      <td>
825
					  <?php if ($nrules == 0): ?><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"><?php endif; ?></td>
826
					  <td></td>
827
				    </tr>
828
					<tr>
829
					  <td>
830
					  <?php if ($nrules == 0): ?>
831
					  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0"><?php else: ?>
832
					  <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')"><?php endif; ?>
833
					  </td>
834
			                  <td><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td>
835
					</tr>
836
				    </table>
837
				  </td>
838
				</tr>
839
              </table>
840
	      <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
841
                <tr>
842
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11"></td>
843
                  <td><?=gettext("pass");?></td>
844
                  <td width="14"></td>
845
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11"></td>
846
                  <td><?=gettext("block");?></td>
847
                  <td width="14"></td>
848
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11"></td>
849
                  <td><?=gettext("reject");?></td>
850
                  <td width="14"></td>
851
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11"></td>
852
                  <td><?=gettext("log");?></td>
853
                </tr>
854
                <tr>
855
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11"></td>
856
                  <td nowrap><?=gettext("pass (disabled)");?></td>
857
                  <td>&nbsp;</td>
858
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11"></td>
859
                  <td nowrap><?=gettext("block (disabled)");?></td>
860
                  <td>&nbsp;</td>
861
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11"></td>
862
                  <td nowrap><?=gettext("reject (disabled)");?></td>
863
                  <td>&nbsp;</td>
864
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11"></td>
865
                  <td nowrap><?=gettext("log (disabled)");?></td>
866
                </tr>
867
		<tr>
868
		  <td colspan="10">
869
  &nbsp;<p/>
870
  <strong>
871
	<span class="red"><?=gettext("Hint:");?></span>
872
  </strong><br>
873
	<ul>
874
<? if ("FloatingRules" != $if): ?>
875
	<li><?=gettext("Rules are evaluated on a first-match basis (i.e. " .
876
	"the action of the first rule to match a packet will be executed). " .
877
	"This means that if you use block rules, you'll have to pay attention " .
878
	"to the rule order. Everything that isn't explicitly passed is blocked " .
879
	"by default. ");?>
880
	</li>
881
<? else: ?>
882
	<li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " .
883
	"the action of the first rule to match a packet will be executed) only " .
884
	"if the 'quick' option is checked on a rule. Otherwise they will only apply if no " .
885
	"other rules match. Pay close attention to the rule order and options " .
886
	"chosen. If no rule here matches, the per-interface or default rules are used. ");?>
887
	</li>
888
<? endif; ?>
889
</ul>
890
		 </td>
891
	        </tr>
892
              </table>
893
	</div>
894
    </td>
895
  </tr>
896
</table>
897
  <input type="hidden" name="if" value="<?=htmlspecialchars($if);?>">
898
  <script type="text/javascript">
899
	var number_of_rules = <?=$nrules?>;
900
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?>
901
/*
902
	Sortable.create("dragtable", { 
903
		tag:"tr", 
904
		format:"fr([0-9999999])",
905
		containment:["dragtable"], 
906
		onChange:function(affected) {
907
			document.body.style.cursor = 'move';
908
		},
909
		onUpdate:function(container) { 
910
			document.body.style.cursor = 'move';
911
			updateOrder(Sortable.serialize('dragtable', 'tr'));
912
		} 
913
	});
914
*/
915
<?php endfor; ?>
916
	function updateOrder(order) {
917
		if(document.getElementById("redboxtable"))
918
			jQuery('#redboxtable').hide();
919
		jQuery('#loading').show();
920
		document.body.style.cursor = 'wait';
921
		document.location = 'firewall_rules.php?if=<?=htmlspecialchars($if);?>&dragdroporder=true&' + Sortable.serialize('dragtable', 'tr');
922
		return;
923
	}
924
	jQuery('#loading').hide();
925
  </script>
926
</form>
927
<?php include("fend.inc"); ?>
928
</body>
929
</html>
(68-68/247)