Projet

Général

Profil

Télécharger (39,3 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / firewall_rules.php @ 7e736f38

1
<?php
2
/* $Id$ */
3
/*
4
	firewall_rules.php
5
	part of pfSense (https://www.pfsense.org)
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
require("guiconfig.inc");
45
require_once("functions.inc");
46
require_once("filter.inc");
47
require_once("shaper.inc");
48

    
49
$pgtitle = array(gettext("Firewall"),gettext("Rules"));
50
$shortcut_section = "firewall";
51

    
52
function delete_nat_association($id) {
53
	global $config;
54

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

    
58
	$a_nat = &$config['nat']['rule'];
59

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

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

    
71
$if = $_GET['if'];
72
if ($_POST['if'])
73
	$if = $_POST['if'];
74

    
75
$ifdescs = get_configured_interface_with_descr();
76

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

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

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

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

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

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

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

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

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

    
178
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/interfaces_override");
179

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

    
191
if ($_POST) {
192

    
193
	$pconfig = $_POST;
194

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

    
199
		clear_subsystem_dirty('filter');
200

    
201
		pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply");
202

    
203
		$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>");
204
	}
205
}
206

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

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

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

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

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

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

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

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

    
294
include("head.inc");
295
?>
296
<link type="text/css" rel="stylesheet" href="/javascript/chosen/chosen.css" />
297
</head>
298

    
299
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
300
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
301
<?php include("fbegin.inc"); ?>
302
<form action="firewall_rules.php" method="post">
303

    
304
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js"></script>
305
<?php if ($savemsg) print_info_box($savemsg); ?>
306
<?php if (is_subsystem_dirty('filter')): ?><p>
307
<?php
308
if($_REQUEST['undodrag']) {
309
	foreach($_REQUEST['dragtable'] as $dt)
310
		$dragtable .= "&dragtable[]={$dt}";
311
	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}");
312
} else {
313
	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."));
314
}
315
?>
316
<br/>
317
<?php endif; ?>
318
<div id="loading" style="visibity:hidden">
319
	<img src="/themes/<?=$g['theme']?>/images/misc/loader.gif" alt="loader" /> Loading, please wait...
320
	<p>&nbsp;</p>
321
</div>
322
<?php
323
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_table");
324
?>
325
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall rules">
326
	<tr><td class="tabnavtbl">
327
	<?php
328
	/* active tabs */
329
	$tab_array = array();
330
	if ("FloatingRules" == $if)
331
		$active = true;
332
	else
333
		$active = false;
334
	$tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules");
335
	$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
336
		if ($ifent == $if)
337
			$active = true;
338
		else
339
			$active = false;
340
		$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
341
	}
342
	display_top_tabs($tab_array);
343
	?>
344
	</td></tr>
345
	<tr><td>
346
		<div id="mainarea">
347
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
348
			<?php
349
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr");
350
			?>
351
			<thead>
352
			<tr id="frheader">
353
			<td width="3%" class="list">&nbsp;</td>
354
			<td width="5%" class="list">&nbsp;</td>
355
			<td width="3%" class="listhdrr"><?=gettext("ID");?></td>
356
			<?php
357
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tablehead");
358
			?>
359
			<td width="6%" class="listhdrr"><?=gettext("Proto");?></td>
360
			<td width="12%" class="listhdrr"><?=gettext("Source");?></td>
361
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
362
			<td width="12%" class="listhdrr"><?=gettext("Destination");?></td>
363
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
364
			<td width="5%" class="listhdrr"><?=gettext("Gateway");?></td>
365
			<td width="8%" class="listhdrr"><?=gettext("Queue");?></td>
366
			<td width="5%" class="listhdrr"><?=gettext("Schedule");?></td>
367
			<?php
368
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_desc_tablehead");
369
			?>
370
			<td width="19%" class="listhdr"><?=gettext("Description");?></td>
371
			<td width="10%" class="list">
372
				<table border="0" cellspacing="0" cellpadding="1" summary="delete selected rules">
373
					<tr>
374
					<?php
375
						$nrules = 0;
376
						for ($i = 0; isset($a_filter[$i]); $i++) {
377
							$filterent = $a_filter[$i];
378
							if ($filterent['interface'] != $if && !isset($filterent['floating']))
379
								continue;
380
							if (isset($filterent['floating']) && "FloatingRules" != $if)
381
								continue;
382
							$nrules++;
383
						}
384
					?>
385
					<td>
386
					<?php if ($nrules == 0): ?>
387
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?gettext("delete selected rules"); ?>" border="0" alt="delete" /><?php else: ?>
388
						<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" />
389
					<?php endif; ?>
390
					</td>
391
					<td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&amp;after=-1"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0" alt="add" /></a></td>
392
					</tr>
393
				</table>
394
			</td>
395
			</tr>
396
			</thead>
397
			<tfoot>
398
<?php if ($nrules == 0): ?>
399
			<tr>
400
			<td class="listt"></td>
401
			<td class="listt"></td>
402
			<td class="listlr" colspan="10" align="center" valign="middle">
403
			<span class="gray">
404
	<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
405
				<?=gettext("No floating rules are currently defined."); ?><br/><br/>
406
	<?php else: ?>
407
				<?=gettext("No rules are currently defined for this interface"); ?><br/>
408
				<?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br/><br/>
409
	<?php endif; ?>
410
				<?=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="middle" alt="add" /></a><?=gettext(" button to add a new rule.");?></span>
411
			</td>
412
			</tr>
413
<?php endif; ?>
414
			<tr id="fr<?=$nrules;?>">
415
			<td class="list"></td>
416
			<td class="list"></td>
417
			<?php
418
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_belowtable");
419
			?>
420
			<td class="list">&nbsp;</td>
421
			<td class="list">&nbsp;</td>
422
			<td class="list">&nbsp;</td>
423
			<td class="list">&nbsp;</td>
424
			<td class="list">&nbsp;</td>
425
			<td class="list">&nbsp;</td>
426
			<td class="list">&nbsp;</td>
427
			<td class="list">&nbsp;</td>
428
			<td class="list">&nbsp;</td>
429
			<td class="list">&nbsp;</td>
430
			<td class="list">
431
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules">
432
					<tr>
433
					<td>
434
						<?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" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17" title="<?=gettext("move selected rules to end");?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" /><?php endif; ?></td>
435
					<td></td>
436
					</tr>
437
					<tr>
438
					<td>
439
<?php if ($nrules == 0): ?>
440
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0" alt="delete" /><?php else: ?>
441
						<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" />
442
<?php endif; ?>
443
					</td>
444
			                <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" alt="add" /></a></td>
445
					</tr>
446
				</table>
447
			</td>
448
			</tr>
449
			</tfoot>
450
			<?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.
451
				if (!isset($config['system']['webgui']['noantilockout']) &&
452
					(((count($config['interfaces']) > 1) && ($if == 'lan'))
453
					|| ((count($config['interfaces']) == 1) && ($if == 'wan')))):
454

    
455
					$alports = implode('<br/>', filter_get_antilockout_ports(true));
456
			?>
457
			<tbody>
458
			<tr valign="top" id="antilockout">
459
			<td class="list">&nbsp;</td>
460
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0" alt="pass" /></td>
461
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
462
			<?php
463
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout");
464
			?>
465
			<td class="listr" style="background-color: #E0E0E0">*</td>
466
			<td class="listr" style="background-color: #E0E0E0">*</td>
467
			<td class="listr" style="background-color: #E0E0E0">*</td>
468
			<td class="listr" style="background-color: #E0E0E0"><?=$iflist[$if];?> Address</td>
469
			<td class="listr" style="background-color: #E0E0E0"><?= $alports ?></td>
470
			<td class="listr" style="background-color: #E0E0E0">*</td>
471
			<td class="listr" style="background-color: #E0E0E0">*</td>
472
			<td class="listr" style="background-color: #E0E0E0">&nbsp;</td>
473
			<td class="listbg"><?=gettext("Anti-Lockout Rule");?></td>
474
			<td valign="middle" class="list nowrap">
475
			<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
476
				<tr>
477
					<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>" alt="move" /></td>
478
					<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" alt="edit" /></a></td>
479
				</tr>
480
				<tr>
481
					<td align="center" valign="middle"></td>
482
					<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" alt="add" /></td>
483
				</tr>
484
				</table>
485
			</td>
486
			</tr>
487
			</tbody>
488
<?php endif; ?>
489

    
490
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
491
			<tbody>
492
			<tr valign="top" id="block_priv_frrfc1918">
493
			<td class="list">&nbsp;</td>
494
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0" alt="block" /></td>
495
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
496
			<td class="listr" style="background-color: #E0E0E0">*</td>
497
			<td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td>
498
			<td class="listr" style="background-color: #E0E0E0">*</td>
499
			<td class="listr" style="background-color: #E0E0E0">*</td>
500
			<td class="listr" style="background-color: #E0E0E0">*</td>
501
			<td class="listr" style="background-color: #E0E0E0">*</td>
502
			<td class="listr" style="background-color: #E0E0E0">*</td>
503
			<td class="listr" style="background-color: #E0E0E0">&nbsp;</td>
504
			<td class="listbg"><?=gettext("Block private networks");?></td>
505
			<td valign="middle" class="list nowrap">
506
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
507
					<tr>
508
					<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>" alt="edit" /></td>
509
					<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" alt="edit" /></a></td>
510
					</tr>
511
					<tr>
512
					<td align="center" valign="middle"></td>
513
					<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" alt="add" /></td>
514
					</tr>
515
				</table>
516
			</td>
517
			</tr>
518
			</tbody>
519
<?php endif; ?>
520
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
521
			<tbody>
522
			<tr valign="top" id="block_bogons_frrfc1918">
523
			<td class="list">&nbsp;</td>
524
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0" alt="block" /></td>
525
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
526
			<td class="listr" style="background-color: #E0E0E0">*</td>
527
			<td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td>
528
			<td class="listr" style="background-color: #E0E0E0">*</td>
529
			<td class="listr" style="background-color: #E0E0E0">*</td>
530
			<td class="listr" style="background-color: #E0E0E0">*</td>
531
			<td class="listr" style="background-color: #E0E0E0">*</td>
532
			<td class="listr" style="background-color: #E0E0E0">*</td>
533
			<td class="listr" style="background-color: #E0E0E0">*</td>
534
			<td class="listbg"><?=gettext("Block bogon networks");?></td>
535
			<td valign="middle" class="list nowrap">
536
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
537
					<tr>
538
					<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>" alt="move" /></td>
539
					<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" alt=" edit" /></a></td>
540
					</tr>
541
					<tr>
542
					<td align="center" valign="middle"></td>
543
					<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" alt="add" /></td>
544
					</tr>
545
				</table>
546
			</td>
547
			</tr>
548
			</tbody>
549
<?php endif; ?>
550
			<tbody id="dragtable">
551
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
552
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start");
553
	$filterent = $a_filter[$i];
554
	if ($filterent['interface'] != $if && !isset($filterent['floating']))
555
		continue;
556
	if (isset($filterent['floating']) && "FloatingRules" != $if)
557
		continue;
558
	$isadvset = firewall_check_for_advanced_options($filterent);
559
	if($isadvset)
560
		$advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\" alt=\"avanced\" />";
561
	else
562
		$advanced_set = "";
563
?>
564
			<tr valign="top" id="fr<?=$nrules;?>">
565
			<td class="listt">
566
				<input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
567
				<?php echo $advanced_set; ?>
568
			</td>
569
			<td class="listt" align="center">
570
			<?php
571
				if ($filterent['type'] == "block")
572
					$iconfn = "block";
573
				else if ($filterent['type'] == "reject")
574
					$iconfn = "reject";
575
				else
576
					$iconfn = "pass";
577
				if (isset($filterent['disabled'])) {
578
					$textss = "<span class=\"gray\">";
579
					$textse = "</span>";
580
					$iconfn .= "_d";
581
				} else {
582
					$textss = $textse = "";
583
				}
584
			?>
585
				<a href="?if=<?=htmlspecialchars($if);?>&amp;act=toggle&amp;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");?>" alt="icon" /></a>
586
			<?php
587
				if (isset($filterent['log'])):
588
					$iconfnlog = "log_s";
589
				if (isset($filterent['disabled']))
590
					$iconfnlog .= "_d";
591
			?>
592
			<br/><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0" alt="icon" />
593
<?php endif; ?>
594
			</td>
595
			<?php
596

    
597
				//build Alias popup box
598
				$alias_src_span_begin = "";
599
				$alias_src_port_span_begin = "";
600
				$alias_dst_span_begin = "";
601
				$alias_dst_port_span_begin = "";
602

    
603
				$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
604

    
605
				$alias_src_span_begin = $alias_popup["src"];
606
				$alias_src_port_span_begin = $alias_popup["srcport"];
607
				$alias_dst_span_begin = $alias_popup["dst"];
608
				$alias_dst_port_span_begin = $alias_popup["dstport"];
609

    
610
				$alias_src_span_end = $alias_popup["src_end"];
611
				$alias_src_port_span_end = $alias_popup["srcport_end"];
612
				$alias_dst_span_end = $alias_popup["dst_end"];
613
				$alias_dst_port_span_end = $alias_popup["dstport_end"];
614

    
615
				//build Schedule popup box
616
				$a_schedules = &$config['schedules']['schedule'];
617
				$schedule_span_begin = "";
618
				$schedule_span_end = "";
619
				$sched_caption_escaped = "";
620
				$sched_content = "";
621
				$schedstatus = false;
622
				$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
623
				$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'));
624
				if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])) {
625
					foreach ($a_schedules as $schedule)
626
					{
627
						if ($schedule['name'] == $filterent['sched'] ){
628
							$schedstatus = filter_get_time_based_rule_status($schedule);
629

    
630
							foreach($schedule['timerange'] as $timerange) {
631
								$tempFriendlyTime = "";
632
								$tempID = "";
633
								$firstprint = false;
634
								if ($timerange){
635
									$dayFriendly = "";
636
									$tempFriendlyTime = "";
637

    
638
									//get hours
639
									$temptimerange = $timerange['hour'];
640
									$temptimeseparator = strrpos($temptimerange, "-");
641

    
642
									$starttime = substr ($temptimerange, 0, $temptimeseparator);
643
									$stoptime = substr ($temptimerange, $temptimeseparator+1);
644

    
645
									if ($timerange['month']){
646
										$tempmontharray = explode(",", $timerange['month']);
647
										$tempdayarray = explode(",",$timerange['day']);
648
										$arraycounter = 0;
649
										$firstDayFound = false;
650
										$firstPrint = false;
651
										foreach ($tempmontharray as $monthtmp){
652
											$month = $tempmontharray[$arraycounter];
653
											$day = $tempdayarray[$arraycounter];
654

    
655
											if (!$firstDayFound)
656
											{
657
												$firstDay = $day;
658
												$firstmonth = $month;
659
												$firstDayFound = true;
660
											}
661

    
662
											$currentDay = $day;
663
											$nextDay = $tempdayarray[$arraycounter+1];
664
											$currentDay++;
665
											if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
666
												if ($firstPrint)
667
													$dayFriendly .= ", ";
668
												$currentDay--;
669
												if ($currentDay != $firstDay)
670
													$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
671
												else
672
													$dayFriendly .=  $monthArray[$month-1] . " " . $day;
673
												$firstDayFound = false;
674
												$firstPrint = true;
675
											}
676
											$arraycounter++;
677
										}
678
									}
679
									else
680
									{
681
										$tempdayFriendly = $timerange['position'];
682
										$firstDayFound = false;
683
										$tempFriendlyDayArray = explode(",", $tempdayFriendly);
684
										$currentDay = "";
685
										$firstDay = "";
686
										$nextDay = "";
687
										$counter = 0;
688
										foreach ($tempFriendlyDayArray as $day){
689
											if ($day != ""){
690
												if (!$firstDayFound)
691
												{
692
													$firstDay = $tempFriendlyDayArray[$counter];
693
													$firstDayFound = true;
694
												}
695
												$currentDay =$tempFriendlyDayArray[$counter];
696
												//get next day
697
												$nextDay = $tempFriendlyDayArray[$counter+1];
698
												$currentDay++;
699
												if ($currentDay != $nextDay){
700
													if ($firstprint)
701
														$dayFriendly .= ", ";
702
													$currentDay--;
703
													if ($currentDay != $firstDay)
704
														$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
705
													else
706
														$dayFriendly .= $dayArray[$firstDay-1];
707
													$firstDayFound = false;
708
													$firstprint = true;
709
												}
710
												$counter++;
711
											}
712
										}
713
									}
714
									$timeFriendly = $starttime . " - " . $stoptime;
715
									$description = $timerange['rangedescr'];
716
									$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br/>";
717
								}
718
							}
719
							$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
720
							$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>";
721
							$schedule_span_end = "</u></span>";
722
						}
723
					}
724
				}
725
				$printicon = false;
726
				$alttext = "";
727
				$image = "";
728
				if (!isset($filterent['disabled'])) {
729
					if ($schedstatus) {
730
						if ($iconfn == "block" || $iconfn == "reject") {
731
							$image = "icon_block";
732
							$alttext = gettext("Traffic matching this rule is currently being denied");
733
						} else {
734
							$image = "icon_pass";
735
							$alttext = gettext("Traffic matching this rule is currently being allowed");
736
						}
737
						$printicon = true;
738
					} else if ($filterent['sched']) {
739
						if ($iconfn == "block" || $iconfn == "reject")
740
							$image = "icon_block_d";
741
						else
742
							$image = "icon_block";
743
						$alttext = gettext("This rule is not currently active because its period has expired");
744
						$printicon = true;
745
					}
746
				}
747
			?>
748
			<td class="listlr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
749
				<?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']."&nbsp;"; else echo "&nbsp;"; ?><?=$textse;?>
750
			</td>
751
			<?php
752
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr");
753
			?>
754
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
755
			<?=$textss;?>
756
			<?php
757
				if (isset($filterent['ipprotocol'])) {
758
					switch($filterent['ipprotocol']) {
759
						case "inet":
760
							echo "IPv4 ";
761
							break;
762
						case "inet6":
763
							echo "IPv6 ";
764
							break;
765
						case "inet46":
766
							echo "IPv4+6 ";
767
							break;
768
					}
769
				} else {
770
					echo "IPv4 ";
771
				}
772
				if (isset($filterent['protocol'])) {
773
					echo strtoupper($filterent['protocol']);
774
					if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
775
						echo ' <span style="cursor: help;" title="ICMP type: ' . $icmptypes[$filterent['icmptype']] . '"><u>';
776
						echo $filterent['icmptype'];
777
						echo '</u></span>';
778
					}
779
				} else echo "*";
780
			?>
781
			<?=$textse;?>
782
			</td>
783
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
784
				<?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
785
			</td>
786
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
787
				<?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?>
788
			</td>
789
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
790
				<?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
791
			</td>
792
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
793
				<?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
794
			</td>
795
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
796
				<?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else  echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
797
			</td>
798
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
799
			<?=$textss;?>
800
			<?php
801
				if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
802
					$desc = $filterent['ackqueue'] ;
803
					echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&amp;action=show\">{$desc}</a>";
804
					$desc = $filterent['defaultqueue'];
805
					echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
806
				} else if (isset($filterent['defaultqueue'])) {
807
					$desc = $filterent['defaultqueue'];
808
					echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
809
				} else
810
					echo gettext("none");
811
			?>
812
			<?=$textse;?>
813
			</td>
814
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black">
815
				<?php if ($printicon) { ?><img src="./themes/<?= $g['theme']; ?>/images/icons/<?php echo $image; ?>.gif" title="<?php echo $alttext;?>" border="0" alt="icon" /><?php } ?><?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?>&nbsp;<?php echo $schedule_span_end; ?><?=$textse;?>
816
			</font></td>
817
			<?php
818
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_descr_tr");
819
			?>
820
			<td class="listbg descr" onclick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
821
				<?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
822
			</td>
823
			<td valign="middle" class="list nowrap">
824
				<table border="0" cellspacing="0" cellpadding="1" summary="move before">
825
					<tr>
826
					<td><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17" title="<?=gettext("move selected rules before this rule"); ?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" /></td>
827
					<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" alt="edit" /></a></td>
828
					</tr>
829
					<tr>
830
					<td align="center" valign="middle"><a href="firewall_rules.php?act=del&amp;if=<?=htmlspecialchars($if);?>&amp;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?')" alt="delete" /></a></td>
831
					<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" alt="add" /></a></td>
832
					</tr>
833
				</table>
834
			</td>
835
			</tr>
836
			<?php $nrules++; endfor; ?>
837
			  <tr><td></td></tr></tbody>
838
		</table>
839
		<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="icons">
840
			<tr>
841
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" alt="pass" /></td>
842
				<td><?=gettext("pass");?></td>
843
				<td width="14"></td>
844
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" alt="block" /></td>
845
				<td><?=gettext("block");?></td>
846
				<td width="14"></td>
847
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11" alt="reject" /></td>
848
				<td><?=gettext("reject");?></td>
849
				<td width="14"></td>
850
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11" alt="log" /></td>
851
				<td><?=gettext("log");?></td>
852
			</tr>
853
			<tr>
854
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11" alt="pass disabled" /></td>
855
				<td class="nowrap"><?=gettext("pass (disabled)");?></td>
856
				<td>&nbsp;</td>
857
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11" alt="block disabled" /></td>
858
				<td class="nowrap"><?=gettext("block (disabled)");?></td>
859
				<td>&nbsp;</td>
860
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11" alt="reject disabled" /></td>
861
				<td class="nowrap"><?=gettext("reject (disabled)");?></td>
862
				<td>&nbsp;</td>
863
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11" alt="log disabled" /></td>
864
				<td class="nowrap"><?=gettext("log (disabled)");?></td>
865
			</tr>
866
			<tr>
867
				<td colspan="10">
868
					<p>&nbsp;</p>
869
					<strong>
870
						<span class="red"><?=gettext("Hint:");?></span>
871
					</strong><br/>
872
					<ul>
873
					<?php if ("FloatingRules" != $if): ?>
874
						<li><?=gettext("Rules are evaluated on a first-match basis (i.e. " .
875
						"the action of the first rule to match a packet will be executed). " .
876
						"This means that if you use block rules, you'll have to pay attention " .
877
						"to the rule order. Everything that isn't explicitly passed is blocked " .
878
						"by default. ");?>
879
						</li>
880
					<?php else: ?>
881
						<li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " .
882
						"the action of the first rule to match a packet will be executed) only " .
883
						"if the 'quick' option is checked on a rule. Otherwise they will only apply if no " .
884
						"other rules match. Pay close attention to the rule order and options " .
885
						"chosen. If no rule here matches, the per-interface or default rules are used. ");?>
886
						</li>
887
					<?php endif; ?>
888
					</ul>
889
				 </td>
890
			</tr>
891
		</table>
892
		</div>
893
	</td>
894
	</tr>
895
</table>
896
<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" />
897
<script type="text/javascript">
898
//<![CDATA[
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
//]]>
926
</script>
927
</form>
928
<?php include("fend.inc"); ?>
929
</body>
930
</html>
(69-69/246)