Project

General

Profile

Download (39.1 KB) Statistics
| Branch: | Tag: | Revision:
1 b2ffe419 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4 37e2071c Scott Ullrich
	firewall_rules.php
5 c7281770 Chris Buechler
	part of pfSense (https://www.pfsense.org)
6 56dda8e0 Renato Botelho
	Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
7 dd447bde Jim Thompson
        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
8 b2ffe419 Scott Ullrich
9 e4cabb75 Scott Ullrich
	originally part of m0n0wall (http://m0n0.ch/wall)
10
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
11 37e2071c Scott Ullrich
	All rights reserved.
12 b2ffe419 Scott Ullrich
13 37e2071c Scott Ullrich
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15 b2ffe419 Scott Ullrich
16 37e2071c Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18 b2ffe419 Scott Ullrich
19 37e2071c Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22 b2ffe419 Scott Ullrich
23 37e2071c Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33 5b237745 Scott Ullrich
*/
34 7ac5a4cb Scott Ullrich
/*
35
	pfSense_MODULE:	filter
36
*/
37 5b237745 Scott Ullrich
38 6b07c15a Matthew Grooms
##|+PRIV
39
##|*IDENT=page-firewall-rules
40
##|*NAME=Firewall: Rules page
41
##|*DESCR=Allow access to the 'Firewall: Rules' page.
42
##|*MATCH=firewall_rules.php*
43
##|-PRIV
44
45 5b237745 Scott Ullrich
require("guiconfig.inc");
46 7a927e67 Scott Ullrich
require_once("functions.inc");
47
require_once("filter.inc");
48
require_once("shaper.inc");
49 5b237745 Scott Ullrich
50 7a808e01 Carlos Eduardo Ramos
$pgtitle = array(gettext("Firewall"),gettext("Rules"));
51 b32dd0a6 jim-p
$shortcut_section = "firewall";
52 7a808e01 Carlos Eduardo Ramos
53 00c82782 Renato Botelho
function delete_nat_association($id) {
54
	global $config;
55
56
	if (!$id || !is_array($config['nat']['rule']))
57 673d29c0 Renato Botelho
		return;
58
59 00c82782 Renato Botelho
	$a_nat = &$config['nat']['rule'];
60
61
	foreach ($a_nat as &$natent)
62
		if ($natent['associated-rule-id'] == $id)
63
			$natent['associated-rule-id'] = '';
64 673d29c0 Renato Botelho
}
65
66 5b237745 Scott Ullrich
if (!is_array($config['filter']['rule'])) {
67
	$config['filter']['rule'] = array();
68
}
69
filter_rules_sort();
70
$a_filter = &$config['filter']['rule'];
71
72 07bd3f83 Scott Ullrich
$if = $_GET['if'];
73
if ($_POST['if'])
74
	$if = $_POST['if'];
75 b2ffe419 Scott Ullrich
76 cbe3ea96 Ermal Luçi
$ifdescs = get_configured_interface_with_descr();
77 07bd3f83 Scott Ullrich
78 32c58070 Scott Ullrich
// Drag and drop reordering
79
if($_REQUEST['dragdroporder']) {
80
	// First create a new ruleset array and tmp arrays
81 cb53651f Erik Fonnesbeck
	$a_filter_before = array();
82 32c58070 Scott Ullrich
	$a_filter_order = array();
83
	$a_filter_order_tmp = array();
84 cb53651f Erik Fonnesbeck
	$a_filter_after = array();
85
	$found = false;
86 32c58070 Scott Ullrich
	$drag_order = $_REQUEST['dragtable'];
87
	// Next traverse through rules building a new order for interface
88
	for ($i = 0; isset($a_filter[$i]); $i++) {
89 cb53651f Erik Fonnesbeck
		if(( $_REQUEST['if'] == "FloatingRules" && isset($a_filter[$i]['floating']) ) || ( $a_filter[$i]['interface'] == $_REQUEST['if'] && !isset($a_filter[$i]['floating']) )) {
90 32c58070 Scott Ullrich
			$a_filter_order_tmp[] = $a_filter[$i];
91 cb53651f Erik Fonnesbeck
			$found = true;
92
		} else if (!$found)
93
			$a_filter_before[] = $a_filter[$i];
94
		else
95
			$a_filter_after[] = $a_filter[$i];
96 32c58070 Scott Ullrich
	}
97
	// Reorder rules with the posted order
98 cb53651f Erik Fonnesbeck
	for ($i = 0; $i<count($drag_order); $i++)
99 32c58070 Scott Ullrich
		$a_filter_order[] = $a_filter_order_tmp[$drag_order[$i]];
100 cb53651f Erik Fonnesbeck
	// In case $drag_order didn't account for some rules, make sure we don't lose them
101
	if(count($a_filter_order) < count($a_filter_order_tmp)) {
102
		for ($i = 0; $i<count($a_filter_order_tmp); $i++)
103
			if(!in_array($i, $drag_order))
104
				$a_filter_order[] = $a_filter_order_tmp[$i];
105
	}
106 32c58070 Scott Ullrich
	// Overwrite filter rules with newly created items
107 cb53651f Erik Fonnesbeck
	$config['filter']['rule'] = array_merge($a_filter_before, $a_filter_order, $a_filter_after);
108 32c58070 Scott Ullrich
	// Write configuration
109 15e47776 Luiz Gustavo Costa
	$config = write_config(gettext("Drag and drop firewall rules ordering update."));
110 32c58070 Scott Ullrich
	// Redirect back to page
111 68cbabcb Scott Ullrich
	mark_subsystem_dirty('filter');
112 619f2dbd Scott Ullrich
	$undo = array();
113 56dda8e0 Renato Botelho
	foreach($_REQUEST['dragtable'] as $dt)
114 619f2dbd Scott Ullrich
		$undo[] = "";
115
	$counter = 0;
116
	foreach($_REQUEST['dragtable'] as $dt) {
117
		$undo[$dt] = $counter;
118
		$counter++;
119
	}
120 56dda8e0 Renato Botelho
	foreach($undo as $dt)
121 619f2dbd Scott Ullrich
		$undotxt .= "&dragtable[]={$dt}";
122 6f3d2063 Renato Botelho
	header("Location: firewall_rules.php?if=" . $_REQUEST['if'] . "&undodrag=true" . $undotxt);
123 32c58070 Scott Ullrich
	exit;
124
}
125
126 90ba56ad Scott Ullrich
/* add group interfaces */
127
if (is_array($config['ifgroups']['ifgroupentry']))
128
	foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
129
		if (have_ruleint_access($ifgen['ifname']))
130
			$iflist[$ifgen['ifname']] = $ifgen['ifname'];
131
132 aef4dc74 Ermal Luçi
foreach ($ifdescs as $ifent => $ifdesc)
133 56dda8e0 Renato Botelho
	if(have_ruleint_access($ifent))
134 aef4dc74 Ermal Luçi
		$iflist[$ifent] = $ifdesc;
135 88bcd1d2 Scott Dale
136 617f8d25 Ermal Lu?i
if ($config['l2tp']['mode'] == "server")
137 56dda8e0 Renato Botelho
	if(have_ruleint_access("l2tp"))
138
		$iflist['l2tp'] = "L2TP VPN";
139 617f8d25 Ermal Lu?i
140 07bd3f83 Scott Ullrich
if ($config['pptpd']['mode'] == "server")
141 56dda8e0 Renato Botelho
	if(have_ruleint_access("pptp"))
142 d81c2ad1 Scott Ullrich
		$iflist['pptp'] = "PPTP VPN";
143 50e0d2a1 Scott Ullrich
144 b0899ee4 Ermal
if (is_array($config['pppoes']['pppoe'])) {
145
	foreach ($config['pppoes']['pppoe'] as $pppoes)
146
		if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe"))
147
			$iflist['pppoe'] = "PPPoE Server";
148
}
149 0c554ff6 Scott Ullrich
150 88bcd1d2 Scott Dale
/* add ipsec interfaces */
151 c6dfd289 jim-p
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
152 56dda8e0 Renato Botelho
	if(have_ruleint_access("enc0"))
153 0f266b2e Chris Buechler
		$iflist["enc0"] = "IPsec";
154 07bd3f83 Scott Ullrich
155 bfb60ac8 Ermal Luçi
/* add openvpn/tun interfaces */
156 d799787e Matthew Grooms
if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
157 56dda8e0 Renato Botelho
	$iflist["openvpn"] = "OpenVPN";
158 bfb60ac8 Ermal Luçi
159 4a6cf823 Scott Ullrich
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/interfaces_override");
160
161 92125c97 Ermal Luçi
if (!$if || !isset($iflist[$if])) {
162
	if ("any" == $if)
163 56dda8e0 Renato Botelho
		$if = "FloatingRules";
164
	else if ("FloatingRules" != $if) {
165 0416d9a0 Darren Embry
		if (isset($iflist['wan']))
166
			$if = "wan";
167
		else
168
			$if = "FloatingRules";
169
	}
170 92125c97 Ermal Luçi
}
171 07bd3f83 Scott Ullrich
172 5b237745 Scott Ullrich
if ($_POST) {
173
174
	$pconfig = $_POST;
175
176
	if ($_POST['apply']) {
177 37e2071c Scott Ullrich
		$retval = 0;
178 9a7e416c Scott Ullrich
		$retval = filter_configure();
179
180 a368a026 Ermal Lu?i
		clear_subsystem_dirty('filter');
181 a985eac2 Scott Ullrich
182 1a700ea6 Scott Ullrich
		pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply");
183
184 8cd558b6 ayvis
		$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>");
185 5b237745 Scott Ullrich
	}
186
}
187
188 d97c50cd Bill Marquette
if ($_GET['act'] == "del") {
189 673d29c0 Renato Botelho
	if ($a_filter[$_GET['id']]) {
190
		if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
191 00c82782 Renato Botelho
			delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
192 673d29c0 Renato Botelho
		}
193
		unset($a_filter[$_GET['id']]);
194 3a343d73 jim-p
		if (write_config())
195 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
196 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
197 673d29c0 Renato Botelho
		exit;
198
	}
199 d97c50cd Bill Marquette
}
200
201 32c58070 Scott Ullrich
// Handle save msg if defined
202 56dda8e0 Renato Botelho
if($_REQUEST['savemsg'])
203 32c58070 Scott Ullrich
	$savemsg = htmlentities($_REQUEST['savemsg']);
204
205 07bd3f83 Scott Ullrich
if (isset($_POST['del_x'])) {
206
	/* delete selected rules */
207
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
208
		foreach ($_POST['rule'] as $rulei) {
209 00c82782 Renato Botelho
			delete_nat_association($a_filter[$rulei]['associated-rule-id']);
210 07bd3f83 Scott Ullrich
			unset($a_filter[$rulei]);
211
		}
212 3a343d73 jim-p
		if (write_config())
213 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
214 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
215 5b237745 Scott Ullrich
		exit;
216
	}
217 07bd3f83 Scott Ullrich
} else if ($_GET['act'] == "toggle") {
218
	if ($a_filter[$_GET['id']]) {
219 56dda8e0 Renato Botelho
		if(isset($a_filter[$_GET['id']]['disabled']))
220
			unset($a_filter[$_GET['id']]['disabled']);
221
		else
222
			$a_filter[$_GET['id']]['disabled'] = true;
223 3a343d73 jim-p
		if (write_config())
224 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
225 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
226 5b237745 Scott Ullrich
		exit;
227
	}
228 07bd3f83 Scott Ullrich
} else {
229 b2ffe419 Scott Ullrich
	/* yuck - IE won't send value attributes for image buttons, while Mozilla does -
230 37e2071c Scott Ullrich
	   so we use .x/.y to fine move button clicks instead... */
231 07bd3f83 Scott Ullrich
	unset($movebtn);
232
	foreach ($_POST as $pn => $pd) {
233
		if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
234
			$movebtn = $matches[1];
235
			break;
236
		}
237 5b237745 Scott Ullrich
	}
238 07bd3f83 Scott Ullrich
	/* move selected rules before this rule */
239
	if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
240
		$a_filter_new = array();
241 b2ffe419 Scott Ullrich
242 07bd3f83 Scott Ullrich
		/* copy all rules < $movebtn and not selected */
243
		for ($i = 0; $i < $movebtn; $i++) {
244
			if (!in_array($i, $_POST['rule']))
245
				$a_filter_new[] = $a_filter[$i];
246
		}
247 b2ffe419 Scott Ullrich
248 07bd3f83 Scott Ullrich
		/* copy all selected rules */
249
		for ($i = 0; $i < count($a_filter); $i++) {
250
			if ($i == $movebtn)
251
				continue;
252
			if (in_array($i, $_POST['rule']))
253
				$a_filter_new[] = $a_filter[$i];
254
		}
255 b2ffe419 Scott Ullrich
256 07bd3f83 Scott Ullrich
		/* copy $movebtn rule */
257
		if ($movebtn < count($a_filter))
258
			$a_filter_new[] = $a_filter[$movebtn];
259 b2ffe419 Scott Ullrich
260 07bd3f83 Scott Ullrich
		/* copy all rules > $movebtn and not selected */
261
		for ($i = $movebtn+1; $i < count($a_filter); $i++) {
262
			if (!in_array($i, $_POST['rule']))
263
				$a_filter_new[] = $a_filter[$i];
264
		}
265 b2ffe419 Scott Ullrich
266 07bd3f83 Scott Ullrich
		$a_filter = $a_filter_new;
267 3a343d73 jim-p
		if (write_config())
268 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
269 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
270 5b237745 Scott Ullrich
		exit;
271
	}
272
}
273 3a54b6ca Scott Dale
$closehead = false;
274 5b237745 Scott Ullrich
275 9a25487b Scott Ullrich
include("head.inc");
276 5b237745 Scott Ullrich
?>
277 44605bc8 Colin Fleming
<link type="text/css" rel="stylesheet" href="/javascript/chosen/chosen.css" />
278 3a54b6ca Scott Dale
</head>
279
280 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
281 6134cc8f Vinicius Coque
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
282 5b237745 Scott Ullrich
<?php include("fbegin.inc"); ?>
283
<form action="firewall_rules.php" method="post">
284 6dc83d52 Scott Ullrich
285 07130afe ayvis
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
286 5b237745 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
287 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('filter')): ?><p>
288 619f2dbd Scott Ullrich
<?php
289
if($_REQUEST['undodrag']) {
290 56dda8e0 Renato Botelho
	foreach($_REQUEST['dragtable'] as $dt)
291 619f2dbd Scott Ullrich
		$dragtable .= "&dragtable[]={$dt}";
292 8cd558b6 ayvis
	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}");
293 619f2dbd Scott Ullrich
} else {
294 8cd558b6 ayvis
	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."));
295 619f2dbd Scott Ullrich
}
296
?>
297 8cd558b6 ayvis
<br />
298 5b237745 Scott Ullrich
<?php endif; ?>
299 df222163 Scott Ullrich
<div id="loading" style="visibity:hidden">
300 15e47776 Luiz Gustavo Costa
    <img src="/themes/<?=$g['theme']?>/images/misc/loader.gif" alt="loader" /> <?php echo gettext("Loading, please wait..."); ?>
301 44605bc8 Colin Fleming
	<p>&nbsp;</p>
302 6dc83d52 Scott Ullrich
</div>
303 3a4ca65e Scott Ullrich
<?php
304
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_table");
305
?>
306 44605bc8 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall rules">
307 56dda8e0 Renato Botelho
	<tr><td class="tabnavtbl">
308
	<?php
309 0366b748 Scott Ullrich
	/* active tabs */
310
	$tab_array = array();
311 56dda8e0 Renato Botelho
	if ("FloatingRules" == $if)
312
		$active = true;
313
	else
314
		$active = false;
315
	$tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules");
316 0366b748 Scott Ullrich
	$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
317
		if ($ifent == $if)
318
			$active = true;
319
		else
320
			$active = false;
321
		$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
322
	}
323
	display_top_tabs($tab_array);
324 56dda8e0 Renato Botelho
	?>
325
	</td></tr>
326
	<tr><td>
327
		<div id="mainarea">
328 44605bc8 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
329 56dda8e0 Renato Botelho
			<?php
330
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr");
331
			?>
332 1db196b2 Scott Ullrich
			<tr id="frheader">
333
			<td width="3%" class="list">&nbsp;</td>
334
			<td width="5%" class="list">&nbsp;</td>
335 5fec5fe4 Scott Ullrich
			<td width="3%" class="listhdrr"><?=gettext("ID");?></td>
336 56dda8e0 Renato Botelho
			<?php
337 1db196b2 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tablehead");
338 56dda8e0 Renato Botelho
			?>
339 1db196b2 Scott Ullrich
			<td width="6%" class="listhdrr"><?=gettext("Proto");?></td>
340
			<td width="12%" class="listhdrr"><?=gettext("Source");?></td>
341
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
342
			<td width="12%" class="listhdrr"><?=gettext("Destination");?></td>
343
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
344
			<td width="5%" class="listhdrr"><?=gettext("Gateway");?></td>
345
			<td width="8%" class="listhdrr"><?=gettext("Queue");?></td>
346
			<td width="5%" class="listhdrr"><?=gettext("Schedule");?></td>
347 56dda8e0 Renato Botelho
			<?php
348 10995178 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_desc_tablehead");
349 56dda8e0 Renato Botelho
			?>
350 1db196b2 Scott Ullrich
			<td width="19%" class="listhdr"><?=gettext("Description");?></td>
351
			<td width="10%" class="list">
352 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="delete selected rules">
353 56dda8e0 Renato Botelho
					<tr>
354
					<?php
355
						$nrules = 0;
356
						for ($i = 0; isset($a_filter[$i]); $i++) {
357
							$filterent = $a_filter[$i];
358
							if ($filterent['interface'] != $if && !isset($filterent['floating']))
359
								continue;
360
							if (isset($filterent['floating']) && "FloatingRules" != $if)
361
								continue;
362
							$nrules++;
363
						}
364
					?>
365
					<td>
366
					<?php if ($nrules == 0): ?>
367 f4245bbc Colin Fleming
						<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: ?>
368
						<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?');?>')" />
369 56dda8e0 Renato Botelho
					<?php endif; ?>
370
					</td>
371 f4245bbc Colin Fleming
					<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>
372 56dda8e0 Renato Botelho
					</tr>
373
				</table>
374
			</td>
375
			</tr>
376
			<?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.
377
				if (!isset($config['system']['webgui']['noantilockout']) &&
378
					(((count($config['interfaces']) > 1) && ($if == 'lan'))
379
					|| ((count($config['interfaces']) == 1) && ($if == 'wan')))):
380
381 8cd558b6 ayvis
					$alports = implode('<br />', filter_get_antilockout_ports(true));
382 56dda8e0 Renato Botelho
			?>
383
			<tr valign="top" id="antilockout">
384 03976254 jim-p
			<td class="list">&nbsp;</td>
385 f4245bbc Colin Fleming
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0" alt="pass" /></td>
386 4e8854c6 Charlie Root
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
387 56dda8e0 Renato Botelho
			<?php
388 5fec5fe4 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout");
389 56dda8e0 Renato Botelho
			?>
390 03976254 jim-p
			<td class="listr" style="background-color: #E0E0E0">*</td>
391
			<td class="listr" style="background-color: #E0E0E0">*</td>
392
			<td class="listr" style="background-color: #E0E0E0">*</td>
393
			<td class="listr" style="background-color: #E0E0E0"><?=$iflist[$if];?> Address</td>
394 31f0ef21 jim-p
			<td class="listr" style="background-color: #E0E0E0"><?= $alports ?></td>
395 03976254 jim-p
			<td class="listr" style="background-color: #E0E0E0">*</td>
396
			<td class="listr" style="background-color: #E0E0E0">*</td>
397 4e8854c6 Charlie Root
			<td class="listr" style="background-color: #E0E0E0">&nbsp;</td>
398 03976254 jim-p
			<td class="listbg"><?=gettext("Anti-Lockout Rule");?></td>
399 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
400 44605bc8 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
401 03976254 jim-p
				<tr>
402 f4245bbc Colin Fleming
					<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>
403
					<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>
404 03976254 jim-p
				</tr>
405
				<tr>
406
					<td align="center" valign="middle"></td>
407 f4245bbc Colin Fleming
					<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>
408 03976254 jim-p
				</tr>
409
				</table>
410
			</td>
411
			</tr>
412
<?php endif; ?>
413
414 f1f60c92 Ermal Luçi
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
415 56dda8e0 Renato Botelho
			<tr valign="top" id="frrfc1918">
416
			<td class="list">&nbsp;</td>
417 fd35c8c1 Colin Fleming
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0" alt="block" /></td>
418 56dda8e0 Renato Botelho
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
419
			<td class="listr" style="background-color: #E0E0E0">*</td>
420
			<td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td>
421
			<td class="listr" style="background-color: #E0E0E0">*</td>
422
			<td class="listr" style="background-color: #E0E0E0">*</td>
423
			<td class="listr" style="background-color: #E0E0E0">*</td>
424
			<td class="listr" style="background-color: #E0E0E0">*</td>
425
			<td class="listr" style="background-color: #E0E0E0">*</td>
426
			<td class="listr" style="background-color: #E0E0E0">&nbsp;</td>
427
			<td class="listbg"><?=gettext("Block private networks");?></td>
428 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
429 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
430 d9eeccbd Scott Ullrich
					<tr>
431 f4245bbc Colin Fleming
					<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>
432
					<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>
433 d9eeccbd Scott Ullrich
					</tr>
434
					<tr>
435 56dda8e0 Renato Botelho
					<td align="center" valign="middle"></td>
436 f4245bbc Colin Fleming
					<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>
437 d9eeccbd Scott Ullrich
					</tr>
438 56dda8e0 Renato Botelho
				</table>
439
			</td>
440
			</tr>
441 c20c0f5a Scott Ullrich
<?php endif; ?>
442 f1f60c92 Ermal Luçi
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
443 56dda8e0 Renato Botelho
			<tr valign="top" id="frrfc1918">
444
			<td class="list">&nbsp;</td>
445 f4245bbc Colin Fleming
			<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0" alt="block" /></td>
446 56dda8e0 Renato Botelho
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
447
			<td class="listr" style="background-color: #E0E0E0">*</td>
448
			<td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td>
449
			<td class="listr" style="background-color: #E0E0E0">*</td>
450
			<td class="listr" style="background-color: #E0E0E0">*</td>
451
			<td class="listr" style="background-color: #E0E0E0">*</td>
452
			<td class="listr" style="background-color: #E0E0E0">*</td>
453
			<td class="listr" style="background-color: #E0E0E0">*</td>
454
			<td class="listr" style="background-color: #E0E0E0">*</td>
455
			<td class="listbg"><?=gettext("Block bogon networks");?></td>
456 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
457 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
458 c20c0f5a Scott Ullrich
					<tr>
459 f4245bbc Colin Fleming
					<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>
460
					<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>
461 c20c0f5a Scott Ullrich
					</tr>
462
					<tr>
463 56dda8e0 Renato Botelho
					<td align="center" valign="middle"></td>
464 f4245bbc Colin Fleming
					<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>
465 c20c0f5a Scott Ullrich
					</tr>
466 56dda8e0 Renato Botelho
				</table>
467
			</td>
468
			</tr>
469 c20c0f5a Scott Ullrich
<?php endif; ?>
470 f4245bbc Colin Fleming
			<tbody id="dragtable">
471 56dda8e0 Renato Botelho
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
472
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start");
473
	$filterent = $a_filter[$i];
474
	if ($filterent['interface'] != $if && !isset($filterent['floating']))
475
		continue;
476
	if (isset($filterent['floating']) && "FloatingRules" != $if)
477
		continue;
478
	$isadvset = firewall_check_for_advanced_options($filterent);
479
	if($isadvset)
480 f4245bbc Colin Fleming
		$advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\" alt=\"avanced\" />";
481 56dda8e0 Renato Botelho
	else
482
		$advanced_set = "";
483
?>
484
			<tr valign="top" id="fr<?=$nrules;?>">
485
			<td class="listt">
486 f4245bbc Colin Fleming
				<input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
487 56dda8e0 Renato Botelho
				<?php echo $advanced_set; ?>
488
			</td>
489
			<td class="listt" align="center">
490
			<?php
491
				if ($filterent['type'] == "block")
492
					$iconfn = "block";
493
				else if ($filterent['type'] == "reject")
494
					$iconfn = "reject";
495 c739be2c Colin Fleming
				else if ($filterent['type'] == "match")
496
					$iconfn = "match";
497 56dda8e0 Renato Botelho
				else
498
					$iconfn = "pass";
499
				if (isset($filterent['disabled'])) {
500
					$textss = "<span class=\"gray\">";
501
					$textse = "</span>";
502
					$iconfn .= "_d";
503
				} else {
504
					$textss = $textse = "";
505
				}
506
			?>
507 f4245bbc Colin Fleming
				<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>
508 56dda8e0 Renato Botelho
			<?php
509
				if (isset($filterent['log'])):
510
					$iconfnlog = "log_s";
511
				if (isset($filterent['disabled']))
512
					$iconfnlog .= "_d";
513
			?>
514 8cd558b6 ayvis
			<br /><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0" alt="icon" />
515 56dda8e0 Renato Botelho
<?php endif; ?>
516
			</td>
517
			<?php
518
519 2a113ca9 Scott Dale
				//build Alias popup box
520 3a54b6ca Scott Dale
				$alias_src_span_begin = "";
521
				$alias_src_port_span_begin = "";
522
				$alias_dst_span_begin = "";
523
				$alias_dst_port_span_begin = "";
524 56dda8e0 Renato Botelho
525 2a9db752 Scott Dale
				$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
526 56dda8e0 Renato Botelho
527 2a9db752 Scott Dale
				$alias_src_span_begin = $alias_popup["src"];
528
				$alias_src_port_span_begin = $alias_popup["srcport"];
529
				$alias_dst_span_begin = $alias_popup["dst"];
530
				$alias_dst_port_span_begin = $alias_popup["dstport"];
531 56dda8e0 Renato Botelho
532 59167b10 Darren Embry
				$alias_src_span_end = $alias_popup["src_end"];
533
				$alias_src_port_span_end = $alias_popup["srcport_end"];
534
				$alias_dst_span_end = $alias_popup["dst_end"];
535
				$alias_dst_port_span_end = $alias_popup["dstport_end"];
536 56dda8e0 Renato Botelho
537 2a113ca9 Scott Dale
				//build Schedule popup box
538
				$a_schedules = &$config['schedules']['schedule'];
539
				$schedule_span_begin = "";
540
				$schedule_span_end = "";
541 d2aa8cd6 sullrich
				$sched_caption_escaped = "";
542 eace1363 Scott Dale
				$sched_content = "";
543 3b907eb1 Scott Dale
				$schedstatus = false;
544 38f90dc8 Rafael Lucas
				$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
545
				$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'));
546 b6ab9bd2 Ermal
				if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])) {
547 8ce97a08 Scott Dale
					foreach ($a_schedules as $schedule)
548
					{
549
						if ($schedule['name'] == $filterent['sched'] ){
550 60120e37 Ermal Lu?i
							$schedstatus = filter_get_time_based_rule_status($schedule);
551 56dda8e0 Renato Botelho
552 8ce97a08 Scott Dale
							foreach($schedule['timerange'] as $timerange) {
553
								$tempFriendlyTime = "";
554
								$tempID = "";
555
								$firstprint = false;
556
								if ($timerange){
557
									$dayFriendly = "";
558 56dda8e0 Renato Botelho
									$tempFriendlyTime = "";
559
560 8ce97a08 Scott Dale
									//get hours
561
									$temptimerange = $timerange['hour'];
562
									$temptimeseparator = strrpos($temptimerange, "-");
563 56dda8e0 Renato Botelho
564
									$starttime = substr ($temptimerange, 0, $temptimeseparator);
565
									$stoptime = substr ($temptimerange, $temptimeseparator+1);
566
567 8ce97a08 Scott Dale
									if ($timerange['month']){
568
										$tempmontharray = explode(",", $timerange['month']);
569
										$tempdayarray = explode(",",$timerange['day']);
570
										$arraycounter = 0;
571
										$firstDayFound = false;
572
										$firstPrint = false;
573
										foreach ($tempmontharray as $monthtmp){
574
											$month = $tempmontharray[$arraycounter];
575
											$day = $tempdayarray[$arraycounter];
576 56dda8e0 Renato Botelho
577 2a113ca9 Scott Dale
											if (!$firstDayFound)
578
											{
579 8ce97a08 Scott Dale
												$firstDay = $day;
580
												$firstmonth = $month;
581 2a113ca9 Scott Dale
												$firstDayFound = true;
582
											}
583 56dda8e0 Renato Botelho
584 8ce97a08 Scott Dale
											$currentDay = $day;
585
											$nextDay = $tempdayarray[$arraycounter+1];
586
											$currentDay++;
587
											if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
588
												if ($firstPrint)
589 2a113ca9 Scott Dale
													$dayFriendly .= ", ";
590
												$currentDay--;
591
												if ($currentDay != $firstDay)
592 8ce97a08 Scott Dale
													$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
593 2a113ca9 Scott Dale
												else
594 8ce97a08 Scott Dale
													$dayFriendly .=  $monthArray[$month-1] . " " . $day;
595 56dda8e0 Renato Botelho
												$firstDayFound = false;
596 8ce97a08 Scott Dale
												$firstPrint = true;
597 56dda8e0 Renato Botelho
											}
598
											$arraycounter++;
599 2a113ca9 Scott Dale
										}
600
									}
601 8ce97a08 Scott Dale
									else
602
									{
603
										$tempdayFriendly = $timerange['position'];
604
										$firstDayFound = false;
605 56dda8e0 Renato Botelho
										$tempFriendlyDayArray = explode(",", $tempdayFriendly);
606 8ce97a08 Scott Dale
										$currentDay = "";
607
										$firstDay = "";
608
										$nextDay = "";
609 56dda8e0 Renato Botelho
										$counter = 0;
610 8ce97a08 Scott Dale
										foreach ($tempFriendlyDayArray as $day){
611
											if ($day != ""){
612
												if (!$firstDayFound)
613
												{
614
													$firstDay = $tempFriendlyDayArray[$counter];
615
													$firstDayFound = true;
616
												}
617
												$currentDay =$tempFriendlyDayArray[$counter];
618
												//get next day
619
												$nextDay = $tempFriendlyDayArray[$counter+1];
620 56dda8e0 Renato Botelho
												$currentDay++;
621 8ce97a08 Scott Dale
												if ($currentDay != $nextDay){
622
													if ($firstprint)
623
														$dayFriendly .= ", ";
624
													$currentDay--;
625
													if ($currentDay != $firstDay)
626
														$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
627
													else
628
														$dayFriendly .= $dayArray[$firstDay-1];
629 56dda8e0 Renato Botelho
													$firstDayFound = false;
630
													$firstprint = true;
631 8ce97a08 Scott Dale
												}
632
												$counter++;
633
											}
634
										}
635 56dda8e0 Renato Botelho
									}
636 8ce97a08 Scott Dale
									$timeFriendly = $starttime . " - " . $stoptime;
637
									$description = $timerange['rangedescr'];
638 8cd558b6 ayvis
									$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br />";
639 8ce97a08 Scott Dale
								}
640 2a113ca9 Scott Dale
							}
641 d2aa8cd6 sullrich
							$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
642 59167b10 Darren Embry
							$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>";
643
							$schedule_span_end = "</u></span>";
644 2a113ca9 Scott Dale
						}
645
					}
646
				}
647 6fecc73b Scott Dale
				$printicon = false;
648 616dd997 Scott Dale
				$alttext = "";
649
				$image = "";
650 56dda8e0 Renato Botelho
				if (!isset($filterent['disabled'])) {
651
					if ($schedstatus) {
652
						if ($iconfn == "block" || $iconfn == "reject") {
653
							$image = "icon_block";
654
							$alttext = gettext("Traffic matching this rule is currently being denied");
655
						} else {
656
							$image = "icon_pass";
657
							$alttext = gettext("Traffic matching this rule is currently being allowed");
658
						}
659
						$printicon = true;
660
					} else if ($filterent['sched']) {
661
						if ($iconfn == "block" || $iconfn == "reject")
662
							$image = "icon_block_d";
663
						else
664
							$image = "icon_block";
665
						$alttext = gettext("This rule is not currently active because its period has expired");
666
						$printicon = true;
667
					}
668 616dd997 Scott Dale
				}
669 56dda8e0 Renato Botelho
			?>
670 f4245bbc Colin Fleming
			<td class="listlr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
671 56dda8e0 Renato Botelho
				<?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']."&nbsp;"; else echo "&nbsp;"; ?><?=$textse;?>
672
			</td>
673
			<?php
674 5fec5fe4 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr");
675 56dda8e0 Renato Botelho
			?>
676 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
677 56dda8e0 Renato Botelho
			<?=$textss;?>
678
			<?php
679
				if (isset($filterent['ipprotocol'])) {
680
					switch($filterent['ipprotocol']) {
681
						case "inet":
682
							echo "IPv4 ";
683
							break;
684
						case "inet6":
685
							echo "IPv6 ";
686
							break;
687
						case "inet46":
688
							echo "IPv4+6 ";
689
							break;
690
					}
691
				} else {
692
					echo "IPv4 ";
693 be81b340 Erik Fonnesbeck
				}
694 56dda8e0 Renato Botelho
				if (isset($filterent['protocol'])) {
695
					echo strtoupper($filterent['protocol']);
696
					if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
697 d3bf4a41 Renato Botelho
						echo ' <span style="cursor: help;" title="ICMP type: ' .
698
							( $filterent['ipprotocol'] == "inet6" ?  $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']] ) .
699
							'"><u>';
700 56dda8e0 Renato Botelho
						echo $filterent['icmptype'];
701
						echo '</u></span>';
702
					}
703
				} else echo "*";
704
			?>
705
			<?=$textse;?>
706
			</td>
707 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
708 56dda8e0 Renato Botelho
				<?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
709
			</td>
710 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
711 56dda8e0 Renato Botelho
				<?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?>
712
			</td>
713 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
714 56dda8e0 Renato Botelho
				<?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
715
			</td>
716 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
717 56dda8e0 Renato Botelho
				<?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
718
			</td>
719 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
720 56dda8e0 Renato Botelho
				<?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else  echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
721
			</td>
722 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
723 56dda8e0 Renato Botelho
			<?=$textss;?>
724
			<?php
725
				if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
726
					$desc = $filterent['ackqueue'] ;
727 f4245bbc Colin Fleming
					echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&amp;action=show\">{$desc}</a>";
728 56dda8e0 Renato Botelho
					$desc = $filterent['defaultqueue'];
729 f4245bbc Colin Fleming
					echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
730 56dda8e0 Renato Botelho
				} else if (isset($filterent['defaultqueue'])) {
731
					$desc = $filterent['defaultqueue'];
732 f4245bbc Colin Fleming
					echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
733 56dda8e0 Renato Botelho
				} else
734
					echo gettext("none");
735
			?>
736
			<?=$textse;?>
737
			</td>
738 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black">
739 44605bc8 Colin Fleming
				<?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;?>
740 f4245bbc Colin Fleming
			</font></td>
741 56dda8e0 Renato Botelho
			<?php
742 1db196b2 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_descr_tr");
743 56dda8e0 Renato Botelho
			?>
744 f4245bbc Colin Fleming
			<td class="listbg descr" onclick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
745 56dda8e0 Renato Botelho
				<?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
746
			</td>
747 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
748 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move before">
749 07bd3f83 Scott Ullrich
					<tr>
750 f4245bbc Colin Fleming
					<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>
751
					<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>
752 07bd3f83 Scott Ullrich
					</tr>
753
					<tr>
754 f4245bbc Colin Fleming
					<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>
755
					<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>
756 07bd3f83 Scott Ullrich
					</tr>
757 56dda8e0 Renato Botelho
				</table>
758
			</td>
759
			</tr>
760
			<?php $nrules++; endfor; ?>
761 f4245bbc Colin Fleming
			  <tr><td></td></tr></tbody>
762 56dda8e0 Renato Botelho
<?php if ($nrules == 0): ?>
763 f4245bbc Colin Fleming
			<tr>
764 56dda8e0 Renato Botelho
			<td class="listt"></td>
765
			<td class="listt"></td>
766
			<td class="listlr" colspan="10" align="center" valign="middle">
767
			<span class="gray">
768
	<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
769 8cd558b6 ayvis
				<?=gettext("No floating rules are currently defined."); ?><br /><br />
770 56dda8e0 Renato Botelho
	<?php else: ?>
771 8cd558b6 ayvis
				<?=gettext("No rules are currently defined for this interface"); ?><br />
772
				<?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br /><br />
773 56dda8e0 Renato Botelho
	<?php endif; ?>
774 f4245bbc Colin Fleming
				<?=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>
775 56dda8e0 Renato Botelho
			</td>
776 f4245bbc Colin Fleming
			</tr>
777 56dda8e0 Renato Botelho
<?php endif; ?>
778
			<tr id="fr<?=$nrules;?>">
779
			<td class="list"></td>
780
			<td class="list"></td>
781
			<?php
782 8c5bf3d7 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_belowtable");
783 56dda8e0 Renato Botelho
			?>
784
			<td class="list">&nbsp;</td>
785
			<td class="list">&nbsp;</td>
786
			<td class="list">&nbsp;</td>
787
			<td class="list">&nbsp;</td>
788
			<td class="list">&nbsp;</td>
789
			<td class="list">&nbsp;</td>
790
			<td class="list">&nbsp;</td>
791
			<td class="list">&nbsp;</td>
792
			<td class="list">&nbsp;</td>
793
			<td class="list">&nbsp;</td>
794
			<td class="list">
795 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules">
796 07bd3f83 Scott Ullrich
					<tr>
797 56dda8e0 Renato Botelho
					<td>
798 f4245bbc Colin Fleming
						<?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>
799 56dda8e0 Renato Botelho
					<td></td>
800 07bd3f83 Scott Ullrich
					</tr>
801 56dda8e0 Renato Botelho
					<tr>
802
					<td>
803
<?php if ($nrules == 0): ?>
804 f4245bbc Colin Fleming
						<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: ?>
805
						<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?');?>')" />
806 a3381369 Colin Fleming
<?php endif; ?>
807 56dda8e0 Renato Botelho
					</td>
808 f4245bbc Colin Fleming
			                <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>
809 56dda8e0 Renato Botelho
					</tr>
810
				</table>
811
			</td>
812
			</tr>
813
		</table>
814 44605bc8 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="icons">
815 56dda8e0 Renato Botelho
			<tr>
816 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" alt="pass" /></td>
817 c739be2c Colin Fleming
				<td width="100"><?=gettext("pass");?></td>
818
				<td width="14"></td>
819
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_match.gif" width="11" height="11" alt="match" /></td>
820
				<td width="100"><?=gettext("match");?></td>
821 56dda8e0 Renato Botelho
				<td width="14"></td>
822 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" alt="block" /></td>
823 c739be2c Colin Fleming
				<td width="100"><?=gettext("block");?></td>
824 56dda8e0 Renato Botelho
				<td width="14"></td>
825 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11" alt="reject" /></td>
826 c739be2c Colin Fleming
				<td width="100"><?=gettext("reject");?></td>
827 56dda8e0 Renato Botelho
				<td width="14"></td>
828 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11" alt="log" /></td>
829 c739be2c Colin Fleming
				<td width="100"><?=gettext("log");?></td>
830 56dda8e0 Renato Botelho
			</tr>
831
			<tr>
832 f4245bbc Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11" alt="pass disabled" /></td>
833
				<td class="nowrap"><?=gettext("pass (disabled)");?></td>
834 56dda8e0 Renato Botelho
				<td>&nbsp;</td>
835 c739be2c Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_match_d.gif" width="11" height="11" alt="match disabled" /></td>
836
				<td class="nowrap"><?=gettext("match (disabled)");?></td>
837
				<td>&nbsp;</td>
838 f4245bbc Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11" alt="block disabled" /></td>
839
				<td class="nowrap"><?=gettext("block (disabled)");?></td>
840 56dda8e0 Renato Botelho
				<td>&nbsp;</td>
841 f4245bbc Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11" alt="reject disabled" /></td>
842
				<td class="nowrap"><?=gettext("reject (disabled)");?></td>
843 56dda8e0 Renato Botelho
				<td>&nbsp;</td>
844 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11" alt="log disabled" /></td>
845
				<td class="nowrap"><?=gettext("log (disabled)");?></td>
846 56dda8e0 Renato Botelho
			</tr>
847
			<tr>
848
				<td colspan="10">
849 44605bc8 Colin Fleming
					<p>&nbsp;</p>
850 56dda8e0 Renato Botelho
					<strong>
851
						<span class="red"><?=gettext("Hint:");?></span>
852 8cd558b6 ayvis
					</strong><br />
853 56dda8e0 Renato Botelho
					<ul>
854
					<?php if ("FloatingRules" != $if): ?>
855
						<li><?=gettext("Rules are evaluated on a first-match basis (i.e. " .
856
						"the action of the first rule to match a packet will be executed). " .
857
						"This means that if you use block rules, you'll have to pay attention " .
858
						"to the rule order. Everything that isn't explicitly passed is blocked " .
859
						"by default. ");?>
860
						</li>
861
					<?php else: ?>
862
						<li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " .
863
						"the action of the first rule to match a packet will be executed) only " .
864
						"if the 'quick' option is checked on a rule. Otherwise they will only apply if no " .
865
						"other rules match. Pay close attention to the rule order and options " .
866
						"chosen. If no rule here matches, the per-interface or default rules are used. ");?>
867
						</li>
868
					<?php endif; ?>
869
					</ul>
870
				 </td>
871
			</tr>
872
		</table>
873
		</div>
874
	</td>
875
	</tr>
876 d732f186 Bill Marquette
</table>
877 f4245bbc Colin Fleming
<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" />
878 56dda8e0 Renato Botelho
<script type="text/javascript">
879 f4245bbc Colin Fleming
//<![CDATA[
880 7abaeb1f Scott Ullrich
	var number_of_rules = <?=$nrules?>;
881 56dda8e0 Renato Botelho
	<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?>
882
	/*
883
		Sortable.create("dragtable", {
884
			tag:"tr",
885
			format:"fr([0-9999999])",
886
			containment:["dragtable"],
887
			onChange:function(affected) {
888
				document.body.style.cursor = 'move';
889
			},
890
			onUpdate:function(container) {
891
				document.body.style.cursor = 'move';
892
				updateOrder(Sortable.serialize('dragtable', 'tr'));
893
			}
894
		});
895
	*/
896
	<?php endfor; ?>
897 32c58070 Scott Ullrich
	function updateOrder(order) {
898 12c54789 Scott Ullrich
		if(document.getElementById("redboxtable"))
899 df39dd8a Vinicius Coque
			jQuery('#redboxtable').hide();
900
		jQuery('#loading').show();
901 32c58070 Scott Ullrich
		document.body.style.cursor = 'wait';
902 dd5bf424 Scott Ullrich
		document.location = 'firewall_rules.php?if=<?=htmlspecialchars($if);?>&dragdroporder=true&' + Sortable.serialize('dragtable', 'tr');
903 32c58070 Scott Ullrich
		return;
904
	}
905 df39dd8a Vinicius Coque
	jQuery('#loading').hide();
906 f4245bbc Colin Fleming
//]]>
907 56dda8e0 Renato Botelho
</script>
908 07bd3f83 Scott Ullrich
</form>
909 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
910 af4aa061 Scott Ullrich
</body>
911
</html>