Project

General

Profile

Download (36 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 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 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 90ba56ad Scott Ullrich
/* add group interfaces */
79
if (is_array($config['ifgroups']['ifgroupentry']))
80
	foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
81
		if (have_ruleint_access($ifgen['ifname']))
82
			$iflist[$ifgen['ifname']] = $ifgen['ifname'];
83
84 aef4dc74 Ermal Luçi
foreach ($ifdescs as $ifent => $ifdesc)
85 56dda8e0 Renato Botelho
	if(have_ruleint_access($ifent))
86 aef4dc74 Ermal Luçi
		$iflist[$ifent] = $ifdesc;
87 88bcd1d2 Scott Dale
88 617f8d25 Ermal Lu?i
if ($config['l2tp']['mode'] == "server")
89 56dda8e0 Renato Botelho
	if(have_ruleint_access("l2tp"))
90
		$iflist['l2tp'] = "L2TP VPN";
91 617f8d25 Ermal Lu?i
92 07bd3f83 Scott Ullrich
if ($config['pptpd']['mode'] == "server")
93 56dda8e0 Renato Botelho
	if(have_ruleint_access("pptp"))
94 d81c2ad1 Scott Ullrich
		$iflist['pptp'] = "PPTP VPN";
95 50e0d2a1 Scott Ullrich
96 b0899ee4 Ermal
if (is_array($config['pppoes']['pppoe'])) {
97
	foreach ($config['pppoes']['pppoe'] as $pppoes)
98
		if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe"))
99
			$iflist['pppoe'] = "PPPoE Server";
100
}
101 0c554ff6 Scott Ullrich
102 88bcd1d2 Scott Dale
/* add ipsec interfaces */
103 c6dfd289 jim-p
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
104 56dda8e0 Renato Botelho
	if(have_ruleint_access("enc0"))
105 0f266b2e Chris Buechler
		$iflist["enc0"] = "IPsec";
106 07bd3f83 Scott Ullrich
107 bfb60ac8 Ermal Luçi
/* add openvpn/tun interfaces */
108 d799787e Matthew Grooms
if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
109 56dda8e0 Renato Botelho
	$iflist["openvpn"] = "OpenVPN";
110 bfb60ac8 Ermal Luçi
111 4a6cf823 Scott Ullrich
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/interfaces_override");
112
113 92125c97 Ermal Luçi
if (!$if || !isset($iflist[$if])) {
114
	if ("any" == $if)
115 56dda8e0 Renato Botelho
		$if = "FloatingRules";
116
	else if ("FloatingRules" != $if) {
117 0416d9a0 Darren Embry
		if (isset($iflist['wan']))
118
			$if = "wan";
119
		else
120
			$if = "FloatingRules";
121
	}
122 92125c97 Ermal Luçi
}
123 07bd3f83 Scott Ullrich
124 5b237745 Scott Ullrich
if ($_POST) {
125
126
	$pconfig = $_POST;
127
128
	if ($_POST['apply']) {
129 37e2071c Scott Ullrich
		$retval = 0;
130 9a7e416c Scott Ullrich
		$retval = filter_configure();
131
132 a368a026 Ermal Lu?i
		clear_subsystem_dirty('filter');
133 a985eac2 Scott Ullrich
134 1a700ea6 Scott Ullrich
		pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply");
135
136 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>");
137 5b237745 Scott Ullrich
	}
138
}
139
140 d97c50cd Bill Marquette
if ($_GET['act'] == "del") {
141 673d29c0 Renato Botelho
	if ($a_filter[$_GET['id']]) {
142
		if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
143 00c82782 Renato Botelho
			delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
144 673d29c0 Renato Botelho
		}
145
		unset($a_filter[$_GET['id']]);
146 3a343d73 jim-p
		if (write_config())
147 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
148 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
149 673d29c0 Renato Botelho
		exit;
150
	}
151 d97c50cd Bill Marquette
}
152
153 32c58070 Scott Ullrich
// Handle save msg if defined
154 56dda8e0 Renato Botelho
if($_REQUEST['savemsg'])
155 32c58070 Scott Ullrich
	$savemsg = htmlentities($_REQUEST['savemsg']);
156
157 07bd3f83 Scott Ullrich
if (isset($_POST['del_x'])) {
158
	/* delete selected rules */
159
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
160
		foreach ($_POST['rule'] as $rulei) {
161 00c82782 Renato Botelho
			delete_nat_association($a_filter[$rulei]['associated-rule-id']);
162 07bd3f83 Scott Ullrich
			unset($a_filter[$rulei]);
163
		}
164 3a343d73 jim-p
		if (write_config())
165 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
166 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
167 5b237745 Scott Ullrich
		exit;
168
	}
169 07bd3f83 Scott Ullrich
} else if ($_GET['act'] == "toggle") {
170
	if ($a_filter[$_GET['id']]) {
171 56dda8e0 Renato Botelho
		if(isset($a_filter[$_GET['id']]['disabled']))
172
			unset($a_filter[$_GET['id']]['disabled']);
173
		else
174
			$a_filter[$_GET['id']]['disabled'] = true;
175 3a343d73 jim-p
		if (write_config())
176 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
177 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
178 5b237745 Scott Ullrich
		exit;
179
	}
180 07bd3f83 Scott Ullrich
} else {
181 b2ffe419 Scott Ullrich
	/* yuck - IE won't send value attributes for image buttons, while Mozilla does -
182 37e2071c Scott Ullrich
	   so we use .x/.y to fine move button clicks instead... */
183 07bd3f83 Scott Ullrich
	unset($movebtn);
184
	foreach ($_POST as $pn => $pd) {
185
		if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
186
			$movebtn = $matches[1];
187
			break;
188
		}
189 5b237745 Scott Ullrich
	}
190 07bd3f83 Scott Ullrich
	/* move selected rules before this rule */
191
	if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
192
		$a_filter_new = array();
193 b2ffe419 Scott Ullrich
194 07bd3f83 Scott Ullrich
		/* copy all rules < $movebtn and not selected */
195
		for ($i = 0; $i < $movebtn; $i++) {
196
			if (!in_array($i, $_POST['rule']))
197
				$a_filter_new[] = $a_filter[$i];
198
		}
199 b2ffe419 Scott Ullrich
200 07bd3f83 Scott Ullrich
		/* copy all selected rules */
201
		for ($i = 0; $i < count($a_filter); $i++) {
202
			if ($i == $movebtn)
203
				continue;
204
			if (in_array($i, $_POST['rule']))
205
				$a_filter_new[] = $a_filter[$i];
206
		}
207 b2ffe419 Scott Ullrich
208 07bd3f83 Scott Ullrich
		/* copy $movebtn rule */
209
		if ($movebtn < count($a_filter))
210
			$a_filter_new[] = $a_filter[$movebtn];
211 b2ffe419 Scott Ullrich
212 07bd3f83 Scott Ullrich
		/* copy all rules > $movebtn and not selected */
213
		for ($i = $movebtn+1; $i < count($a_filter); $i++) {
214
			if (!in_array($i, $_POST['rule']))
215
				$a_filter_new[] = $a_filter[$i];
216
		}
217 b2ffe419 Scott Ullrich
218 07bd3f83 Scott Ullrich
		$a_filter = $a_filter_new;
219 3a343d73 jim-p
		if (write_config())
220 bec92ab9 jim-p
			mark_subsystem_dirty('filter');
221 e653b6e1 jim-p
		header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
222 5b237745 Scott Ullrich
		exit;
223
	}
224
}
225 3a54b6ca Scott Dale
$closehead = false;
226 5b237745 Scott Ullrich
227 9a25487b Scott Ullrich
include("head.inc");
228 5b237745 Scott Ullrich
?>
229 44605bc8 Colin Fleming
<link type="text/css" rel="stylesheet" href="/javascript/chosen/chosen.css" />
230 3a54b6ca Scott Dale
</head>
231
232 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
233 6134cc8f Vinicius Coque
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
234 5b237745 Scott Ullrich
<?php include("fbegin.inc"); ?>
235
<form action="firewall_rules.php" method="post">
236 6dc83d52 Scott Ullrich
237 07130afe ayvis
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
238 5b237745 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
239 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('filter')): ?><p>
240 c678ca65 jim-p
<?php	print_info_box_np(gettext("The firewall rule configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."), "apply", "", true); ?>
241 8cd558b6 ayvis
<br />
242 5b237745 Scott Ullrich
<?php endif; ?>
243 3a4ca65e Scott Ullrich
<?php
244
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_table");
245
?>
246 44605bc8 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall rules">
247 56dda8e0 Renato Botelho
	<tr><td class="tabnavtbl">
248
	<?php
249 0366b748 Scott Ullrich
	/* active tabs */
250
	$tab_array = array();
251 56dda8e0 Renato Botelho
	if ("FloatingRules" == $if)
252
		$active = true;
253
	else
254
		$active = false;
255
	$tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules");
256 0366b748 Scott Ullrich
	$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
257
		if ($ifent == $if)
258
			$active = true;
259
		else
260
			$active = false;
261
		$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
262
	}
263
	display_top_tabs($tab_array);
264 56dda8e0 Renato Botelho
	?>
265
	</td></tr>
266
	<tr><td>
267
		<div id="mainarea">
268 44605bc8 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
269 56dda8e0 Renato Botelho
			<?php
270
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr");
271
			?>
272 1db196b2 Scott Ullrich
			<tr id="frheader">
273
			<td width="3%" class="list">&nbsp;</td>
274
			<td width="5%" class="list">&nbsp;</td>
275 5fec5fe4 Scott Ullrich
			<td width="3%" class="listhdrr"><?=gettext("ID");?></td>
276 56dda8e0 Renato Botelho
			<?php
277 1db196b2 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tablehead");
278 56dda8e0 Renato Botelho
			?>
279 1db196b2 Scott Ullrich
			<td width="6%" class="listhdrr"><?=gettext("Proto");?></td>
280
			<td width="12%" class="listhdrr"><?=gettext("Source");?></td>
281
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
282
			<td width="12%" class="listhdrr"><?=gettext("Destination");?></td>
283
			<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
284
			<td width="5%" class="listhdrr"><?=gettext("Gateway");?></td>
285
			<td width="8%" class="listhdrr"><?=gettext("Queue");?></td>
286
			<td width="5%" class="listhdrr"><?=gettext("Schedule");?></td>
287 56dda8e0 Renato Botelho
			<?php
288 10995178 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_desc_tablehead");
289 56dda8e0 Renato Botelho
			?>
290 1db196b2 Scott Ullrich
			<td width="19%" class="listhdr"><?=gettext("Description");?></td>
291
			<td width="10%" class="list">
292 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="delete selected rules">
293 56dda8e0 Renato Botelho
					<tr>
294
					<?php
295
						$nrules = 0;
296
						for ($i = 0; isset($a_filter[$i]); $i++) {
297
							$filterent = $a_filter[$i];
298
							if ($filterent['interface'] != $if && !isset($filterent['floating']))
299
								continue;
300
							if (isset($filterent['floating']) && "FloatingRules" != $if)
301
								continue;
302
							$nrules++;
303
						}
304
					?>
305
					<td>
306
					<?php if ($nrules == 0): ?>
307 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: ?>
308
						<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?');?>')" />
309 56dda8e0 Renato Botelho
					<?php endif; ?>
310
					</td>
311 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>
312 56dda8e0 Renato Botelho
					</tr>
313
				</table>
314
			</td>
315
			</tr>
316
			<?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.
317
				if (!isset($config['system']['webgui']['noantilockout']) &&
318
					(((count($config['interfaces']) > 1) && ($if == 'lan'))
319
					|| ((count($config['interfaces']) == 1) && ($if == 'wan')))):
320
321 8cd558b6 ayvis
					$alports = implode('<br />', filter_get_antilockout_ports(true));
322 56dda8e0 Renato Botelho
			?>
323
			<tr valign="top" id="antilockout">
324 03976254 jim-p
			<td class="list">&nbsp;</td>
325 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>
326 4e8854c6 Charlie Root
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
327 56dda8e0 Renato Botelho
			<?php
328 5fec5fe4 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout");
329 56dda8e0 Renato Botelho
			?>
330 03976254 jim-p
			<td class="listr" style="background-color: #E0E0E0">*</td>
331
			<td class="listr" style="background-color: #E0E0E0">*</td>
332
			<td class="listr" style="background-color: #E0E0E0">*</td>
333
			<td class="listr" style="background-color: #E0E0E0"><?=$iflist[$if];?> Address</td>
334 31f0ef21 jim-p
			<td class="listr" style="background-color: #E0E0E0"><?= $alports ?></td>
335 03976254 jim-p
			<td class="listr" style="background-color: #E0E0E0">*</td>
336
			<td class="listr" style="background-color: #E0E0E0">*</td>
337 4e8854c6 Charlie Root
			<td class="listr" style="background-color: #E0E0E0">&nbsp;</td>
338 03976254 jim-p
			<td class="listbg"><?=gettext("Anti-Lockout Rule");?></td>
339 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
340 44605bc8 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
341 03976254 jim-p
				<tr>
342 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>
343
					<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>
344 03976254 jim-p
				</tr>
345
				<tr>
346
					<td align="center" valign="middle"></td>
347 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>
348 03976254 jim-p
				</tr>
349
				</table>
350
			</td>
351
			</tr>
352
<?php endif; ?>
353
354 f1f60c92 Ermal Luçi
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
355 56dda8e0 Renato Botelho
			<tr valign="top" id="frrfc1918">
356
			<td class="list">&nbsp;</td>
357 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>
358 56dda8e0 Renato Botelho
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
359
			<td class="listr" style="background-color: #E0E0E0">*</td>
360
			<td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td>
361
			<td class="listr" style="background-color: #E0E0E0">*</td>
362
			<td class="listr" style="background-color: #E0E0E0">*</td>
363
			<td class="listr" style="background-color: #E0E0E0">*</td>
364
			<td class="listr" style="background-color: #E0E0E0">*</td>
365
			<td class="listr" style="background-color: #E0E0E0">*</td>
366
			<td class="listr" style="background-color: #E0E0E0">&nbsp;</td>
367
			<td class="listbg"><?=gettext("Block private networks");?></td>
368 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
369 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
370 d9eeccbd Scott Ullrich
					<tr>
371 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>
372
					<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>
373 d9eeccbd Scott Ullrich
					</tr>
374
					<tr>
375 56dda8e0 Renato Botelho
					<td align="center" valign="middle"></td>
376 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>
377 d9eeccbd Scott Ullrich
					</tr>
378 56dda8e0 Renato Botelho
				</table>
379
			</td>
380
			</tr>
381 c20c0f5a Scott Ullrich
<?php endif; ?>
382 f1f60c92 Ermal Luçi
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
383 56dda8e0 Renato Botelho
			<tr valign="top" id="frrfc1918">
384
			<td class="list">&nbsp;</td>
385 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>
386 56dda8e0 Renato Botelho
			<td class="listlr" style="background-color: #E0E0E0">&nbsp;</td>
387
			<td class="listr" style="background-color: #E0E0E0">*</td>
388
			<td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td>
389
			<td class="listr" style="background-color: #E0E0E0">*</td>
390
			<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">*</td>
394
			<td class="listr" style="background-color: #E0E0E0">*</td>
395
			<td class="listbg"><?=gettext("Block bogon networks");?></td>
396 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
397 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
398 c20c0f5a Scott Ullrich
					<tr>
399 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>
400
					<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>
401 c20c0f5a Scott Ullrich
					</tr>
402
					<tr>
403 56dda8e0 Renato Botelho
					<td align="center" valign="middle"></td>
404 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>
405 c20c0f5a Scott Ullrich
					</tr>
406 56dda8e0 Renato Botelho
				</table>
407
			</td>
408
			</tr>
409 c20c0f5a Scott Ullrich
<?php endif; ?>
410 c678ca65 jim-p
			<tbody>
411 56dda8e0 Renato Botelho
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
412
	pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start");
413
	$filterent = $a_filter[$i];
414
	if ($filterent['interface'] != $if && !isset($filterent['floating']))
415
		continue;
416
	if (isset($filterent['floating']) && "FloatingRules" != $if)
417
		continue;
418
	$isadvset = firewall_check_for_advanced_options($filterent);
419
	if($isadvset)
420 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\" />";
421 56dda8e0 Renato Botelho
	else
422
		$advanced_set = "";
423
?>
424
			<tr valign="top" id="fr<?=$nrules;?>">
425
			<td class="listt">
426 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;" />
427 56dda8e0 Renato Botelho
				<?php echo $advanced_set; ?>
428
			</td>
429
			<td class="listt" align="center">
430
			<?php
431
				if ($filterent['type'] == "block")
432
					$iconfn = "block";
433
				else if ($filterent['type'] == "reject")
434
					$iconfn = "reject";
435 c739be2c Colin Fleming
				else if ($filterent['type'] == "match")
436
					$iconfn = "match";
437 56dda8e0 Renato Botelho
				else
438
					$iconfn = "pass";
439
				if (isset($filterent['disabled'])) {
440
					$textss = "<span class=\"gray\">";
441
					$textse = "</span>";
442
					$iconfn .= "_d";
443
				} else {
444
					$textss = $textse = "";
445
				}
446
			?>
447 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>
448 56dda8e0 Renato Botelho
			<?php
449
				if (isset($filterent['log'])):
450
					$iconfnlog = "log_s";
451
				if (isset($filterent['disabled']))
452
					$iconfnlog .= "_d";
453
			?>
454 8cd558b6 ayvis
			<br /><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0" alt="icon" />
455 56dda8e0 Renato Botelho
<?php endif; ?>
456
			</td>
457
			<?php
458
459 2a113ca9 Scott Dale
				//build Alias popup box
460 3a54b6ca Scott Dale
				$alias_src_span_begin = "";
461
				$alias_src_port_span_begin = "";
462
				$alias_dst_span_begin = "";
463
				$alias_dst_port_span_begin = "";
464 56dda8e0 Renato Botelho
465 2a9db752 Scott Dale
				$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
466 56dda8e0 Renato Botelho
467 2a9db752 Scott Dale
				$alias_src_span_begin = $alias_popup["src"];
468
				$alias_src_port_span_begin = $alias_popup["srcport"];
469
				$alias_dst_span_begin = $alias_popup["dst"];
470
				$alias_dst_port_span_begin = $alias_popup["dstport"];
471 56dda8e0 Renato Botelho
472 59167b10 Darren Embry
				$alias_src_span_end = $alias_popup["src_end"];
473
				$alias_src_port_span_end = $alias_popup["srcport_end"];
474
				$alias_dst_span_end = $alias_popup["dst_end"];
475
				$alias_dst_port_span_end = $alias_popup["dstport_end"];
476 56dda8e0 Renato Botelho
477 2a113ca9 Scott Dale
				//build Schedule popup box
478
				$a_schedules = &$config['schedules']['schedule'];
479
				$schedule_span_begin = "";
480
				$schedule_span_end = "";
481 d2aa8cd6 sullrich
				$sched_caption_escaped = "";
482 eace1363 Scott Dale
				$sched_content = "";
483 3b907eb1 Scott Dale
				$schedstatus = false;
484 38f90dc8 Rafael Lucas
				$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
485
				$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'));
486 b6ab9bd2 Ermal
				if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])) {
487 8ce97a08 Scott Dale
					foreach ($a_schedules as $schedule)
488
					{
489
						if ($schedule['name'] == $filterent['sched'] ){
490 60120e37 Ermal Lu?i
							$schedstatus = filter_get_time_based_rule_status($schedule);
491 56dda8e0 Renato Botelho
492 8ce97a08 Scott Dale
							foreach($schedule['timerange'] as $timerange) {
493
								$tempFriendlyTime = "";
494
								$tempID = "";
495
								$firstprint = false;
496
								if ($timerange){
497
									$dayFriendly = "";
498 56dda8e0 Renato Botelho
									$tempFriendlyTime = "";
499
500 8ce97a08 Scott Dale
									//get hours
501
									$temptimerange = $timerange['hour'];
502
									$temptimeseparator = strrpos($temptimerange, "-");
503 56dda8e0 Renato Botelho
504
									$starttime = substr ($temptimerange, 0, $temptimeseparator);
505
									$stoptime = substr ($temptimerange, $temptimeseparator+1);
506
507 8ce97a08 Scott Dale
									if ($timerange['month']){
508
										$tempmontharray = explode(",", $timerange['month']);
509
										$tempdayarray = explode(",",$timerange['day']);
510
										$arraycounter = 0;
511
										$firstDayFound = false;
512
										$firstPrint = false;
513
										foreach ($tempmontharray as $monthtmp){
514
											$month = $tempmontharray[$arraycounter];
515
											$day = $tempdayarray[$arraycounter];
516 56dda8e0 Renato Botelho
517 2a113ca9 Scott Dale
											if (!$firstDayFound)
518
											{
519 8ce97a08 Scott Dale
												$firstDay = $day;
520
												$firstmonth = $month;
521 2a113ca9 Scott Dale
												$firstDayFound = true;
522
											}
523 56dda8e0 Renato Botelho
524 8ce97a08 Scott Dale
											$currentDay = $day;
525
											$nextDay = $tempdayarray[$arraycounter+1];
526
											$currentDay++;
527
											if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
528
												if ($firstPrint)
529 2a113ca9 Scott Dale
													$dayFriendly .= ", ";
530
												$currentDay--;
531
												if ($currentDay != $firstDay)
532 8ce97a08 Scott Dale
													$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
533 2a113ca9 Scott Dale
												else
534 8ce97a08 Scott Dale
													$dayFriendly .=  $monthArray[$month-1] . " " . $day;
535 56dda8e0 Renato Botelho
												$firstDayFound = false;
536 8ce97a08 Scott Dale
												$firstPrint = true;
537 56dda8e0 Renato Botelho
											}
538
											$arraycounter++;
539 2a113ca9 Scott Dale
										}
540
									}
541 8ce97a08 Scott Dale
									else
542
									{
543
										$tempdayFriendly = $timerange['position'];
544
										$firstDayFound = false;
545 56dda8e0 Renato Botelho
										$tempFriendlyDayArray = explode(",", $tempdayFriendly);
546 8ce97a08 Scott Dale
										$currentDay = "";
547
										$firstDay = "";
548
										$nextDay = "";
549 56dda8e0 Renato Botelho
										$counter = 0;
550 8ce97a08 Scott Dale
										foreach ($tempFriendlyDayArray as $day){
551
											if ($day != ""){
552
												if (!$firstDayFound)
553
												{
554
													$firstDay = $tempFriendlyDayArray[$counter];
555
													$firstDayFound = true;
556
												}
557
												$currentDay =$tempFriendlyDayArray[$counter];
558
												//get next day
559
												$nextDay = $tempFriendlyDayArray[$counter+1];
560 56dda8e0 Renato Botelho
												$currentDay++;
561 8ce97a08 Scott Dale
												if ($currentDay != $nextDay){
562
													if ($firstprint)
563
														$dayFriendly .= ", ";
564
													$currentDay--;
565
													if ($currentDay != $firstDay)
566
														$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
567
													else
568
														$dayFriendly .= $dayArray[$firstDay-1];
569 56dda8e0 Renato Botelho
													$firstDayFound = false;
570
													$firstprint = true;
571 8ce97a08 Scott Dale
												}
572
												$counter++;
573
											}
574
										}
575 56dda8e0 Renato Botelho
									}
576 8ce97a08 Scott Dale
									$timeFriendly = $starttime . " - " . $stoptime;
577
									$description = $timerange['rangedescr'];
578 8cd558b6 ayvis
									$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br />";
579 8ce97a08 Scott Dale
								}
580 2a113ca9 Scott Dale
							}
581 d2aa8cd6 sullrich
							$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
582 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>";
583
							$schedule_span_end = "</u></span>";
584 2a113ca9 Scott Dale
						}
585
					}
586
				}
587 6fecc73b Scott Dale
				$printicon = false;
588 616dd997 Scott Dale
				$alttext = "";
589
				$image = "";
590 56dda8e0 Renato Botelho
				if (!isset($filterent['disabled'])) {
591
					if ($schedstatus) {
592
						if ($iconfn == "block" || $iconfn == "reject") {
593
							$image = "icon_block";
594
							$alttext = gettext("Traffic matching this rule is currently being denied");
595
						} else {
596
							$image = "icon_pass";
597
							$alttext = gettext("Traffic matching this rule is currently being allowed");
598
						}
599
						$printicon = true;
600
					} else if ($filterent['sched']) {
601
						if ($iconfn == "block" || $iconfn == "reject")
602
							$image = "icon_block_d";
603
						else
604
							$image = "icon_block";
605
						$alttext = gettext("This rule is not currently active because its period has expired");
606
						$printicon = true;
607
					}
608 616dd997 Scott Dale
				}
609 56dda8e0 Renato Botelho
			?>
610 f4245bbc Colin Fleming
			<td class="listlr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
611 56dda8e0 Renato Botelho
				<?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']."&nbsp;"; else echo "&nbsp;"; ?><?=$textse;?>
612
			</td>
613
			<?php
614 5fec5fe4 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr");
615 56dda8e0 Renato Botelho
			?>
616 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
617 56dda8e0 Renato Botelho
			<?=$textss;?>
618
			<?php
619
				if (isset($filterent['ipprotocol'])) {
620
					switch($filterent['ipprotocol']) {
621
						case "inet":
622
							echo "IPv4 ";
623
							break;
624
						case "inet6":
625
							echo "IPv6 ";
626
							break;
627
						case "inet46":
628
							echo "IPv4+6 ";
629
							break;
630
					}
631
				} else {
632
					echo "IPv4 ";
633 be81b340 Erik Fonnesbeck
				}
634 56dda8e0 Renato Botelho
				if (isset($filterent['protocol'])) {
635
					echo strtoupper($filterent['protocol']);
636
					if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
637 fcc96054 Renato Botelho
						echo ' <span style="cursor: help;" title="ICMP type: ' .
638
							( $filterent['ipprotocol'] == "inet6" ?  $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']] ) .
639
							'"><u>';
640 56dda8e0 Renato Botelho
						echo $filterent['icmptype'];
641
						echo '</u></span>';
642
					}
643
				} else echo "*";
644
			?>
645
			<?=$textse;?>
646
			</td>
647 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
648 56dda8e0 Renato Botelho
				<?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
649
			</td>
650 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
651 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;?>
652
			</td>
653 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
654 56dda8e0 Renato Botelho
				<?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
655
			</td>
656 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
657 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;?>
658
			</td>
659 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
660 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;?>
661
			</td>
662 f4245bbc Colin Fleming
			<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
663 56dda8e0 Renato Botelho
			<?=$textss;?>
664
			<?php
665
				if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
666
					$desc = $filterent['ackqueue'] ;
667 f4245bbc Colin Fleming
					echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&amp;action=show\">{$desc}</a>";
668 56dda8e0 Renato Botelho
					$desc = $filterent['defaultqueue'];
669 f4245bbc Colin Fleming
					echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
670 56dda8e0 Renato Botelho
				} else if (isset($filterent['defaultqueue'])) {
671
					$desc = $filterent['defaultqueue'];
672 f4245bbc Colin Fleming
					echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
673 56dda8e0 Renato Botelho
				} else
674
					echo gettext("none");
675
			?>
676
			<?=$textse;?>
677
			</td>
678 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">
679 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;?>
680 f4245bbc Colin Fleming
			</font></td>
681 56dda8e0 Renato Botelho
			<?php
682 1db196b2 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_descr_tr");
683 56dda8e0 Renato Botelho
			?>
684 f4245bbc Colin Fleming
			<td class="listbg descr" onclick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
685 56dda8e0 Renato Botelho
				<?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
686
			</td>
687 f4245bbc Colin Fleming
			<td valign="middle" class="list nowrap">
688 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move before">
689 07bd3f83 Scott Ullrich
					<tr>
690 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>
691
					<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>
692 07bd3f83 Scott Ullrich
					</tr>
693
					<tr>
694 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>
695
					<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>
696 07bd3f83 Scott Ullrich
					</tr>
697 56dda8e0 Renato Botelho
				</table>
698
			</td>
699
			</tr>
700
			<?php $nrules++; endfor; ?>
701 f4245bbc Colin Fleming
			  <tr><td></td></tr></tbody>
702 56dda8e0 Renato Botelho
<?php if ($nrules == 0): ?>
703 f4245bbc Colin Fleming
			<tr>
704 56dda8e0 Renato Botelho
			<td class="listt"></td>
705
			<td class="listt"></td>
706
			<td class="listlr" colspan="10" align="center" valign="middle">
707
			<span class="gray">
708
	<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
709 8cd558b6 ayvis
				<?=gettext("No floating rules are currently defined."); ?><br /><br />
710 56dda8e0 Renato Botelho
	<?php else: ?>
711 8cd558b6 ayvis
				<?=gettext("No rules are currently defined for this interface"); ?><br />
712
				<?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br /><br />
713 56dda8e0 Renato Botelho
	<?php endif; ?>
714 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>
715 56dda8e0 Renato Botelho
			</td>
716 f4245bbc Colin Fleming
			</tr>
717 56dda8e0 Renato Botelho
<?php endif; ?>
718
			<tr id="fr<?=$nrules;?>">
719
			<td class="list"></td>
720
			<td class="list"></td>
721
			<?php
722 8c5bf3d7 Scott Ullrich
				pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_belowtable");
723 56dda8e0 Renato Botelho
			?>
724
			<td class="list">&nbsp;</td>
725
			<td class="list">&nbsp;</td>
726
			<td class="list">&nbsp;</td>
727
			<td class="list">&nbsp;</td>
728
			<td class="list">&nbsp;</td>
729
			<td class="list">&nbsp;</td>
730
			<td class="list">&nbsp;</td>
731
			<td class="list">&nbsp;</td>
732
			<td class="list">&nbsp;</td>
733
			<td class="list">&nbsp;</td>
734
			<td class="list">
735 44605bc8 Colin Fleming
				<table border="0" cellspacing="0" cellpadding="1" summary="move rules">
736 07bd3f83 Scott Ullrich
					<tr>
737 56dda8e0 Renato Botelho
					<td>
738 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>
739 56dda8e0 Renato Botelho
					<td></td>
740 07bd3f83 Scott Ullrich
					</tr>
741 56dda8e0 Renato Botelho
					<tr>
742
					<td>
743
<?php if ($nrules == 0): ?>
744 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: ?>
745
						<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?');?>')" />
746 a3381369 Colin Fleming
<?php endif; ?>
747 56dda8e0 Renato Botelho
					</td>
748 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>
749 56dda8e0 Renato Botelho
					</tr>
750
				</table>
751
			</td>
752
			</tr>
753
		</table>
754 44605bc8 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="icons">
755 56dda8e0 Renato Botelho
			<tr>
756 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" alt="pass" /></td>
757 c739be2c Colin Fleming
				<td width="100"><?=gettext("pass");?></td>
758
				<td width="14"></td>
759
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_match.gif" width="11" height="11" alt="match" /></td>
760
				<td width="100"><?=gettext("match");?></td>
761 56dda8e0 Renato Botelho
				<td width="14"></td>
762 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" alt="block" /></td>
763 c739be2c Colin Fleming
				<td width="100"><?=gettext("block");?></td>
764 56dda8e0 Renato Botelho
				<td width="14"></td>
765 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11" alt="reject" /></td>
766 c739be2c Colin Fleming
				<td width="100"><?=gettext("reject");?></td>
767 56dda8e0 Renato Botelho
				<td width="14"></td>
768 f4245bbc Colin Fleming
				<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11" alt="log" /></td>
769 c739be2c Colin Fleming
				<td width="100"><?=gettext("log");?></td>
770 56dda8e0 Renato Botelho
			</tr>
771
			<tr>
772 f4245bbc Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11" alt="pass disabled" /></td>
773
				<td class="nowrap"><?=gettext("pass (disabled)");?></td>
774 56dda8e0 Renato Botelho
				<td>&nbsp;</td>
775 c739be2c Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_match_d.gif" width="11" height="11" alt="match disabled" /></td>
776
				<td class="nowrap"><?=gettext("match (disabled)");?></td>
777
				<td>&nbsp;</td>
778 f4245bbc Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11" alt="block disabled" /></td>
779
				<td class="nowrap"><?=gettext("block (disabled)");?></td>
780 56dda8e0 Renato Botelho
				<td>&nbsp;</td>
781 f4245bbc Colin Fleming
				<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11" alt="reject disabled" /></td>
782
				<td class="nowrap"><?=gettext("reject (disabled)");?></td>
783 56dda8e0 Renato Botelho
				<td>&nbsp;</td>
784 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>
785
				<td class="nowrap"><?=gettext("log (disabled)");?></td>
786 56dda8e0 Renato Botelho
			</tr>
787
			<tr>
788
				<td colspan="10">
789 44605bc8 Colin Fleming
					<p>&nbsp;</p>
790 56dda8e0 Renato Botelho
					<strong>
791
						<span class="red"><?=gettext("Hint:");?></span>
792 8cd558b6 ayvis
					</strong><br />
793 56dda8e0 Renato Botelho
					<ul>
794
					<?php if ("FloatingRules" != $if): ?>
795
						<li><?=gettext("Rules are evaluated on a first-match basis (i.e. " .
796
						"the action of the first rule to match a packet will be executed). " .
797
						"This means that if you use block rules, you'll have to pay attention " .
798
						"to the rule order. Everything that isn't explicitly passed is blocked " .
799
						"by default. ");?>
800
						</li>
801
					<?php else: ?>
802
						<li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " .
803
						"the action of the first rule to match a packet will be executed) only " .
804
						"if the 'quick' option is checked on a rule. Otherwise they will only apply if no " .
805
						"other rules match. Pay close attention to the rule order and options " .
806
						"chosen. If no rule here matches, the per-interface or default rules are used. ");?>
807
						</li>
808
					<?php endif; ?>
809
					</ul>
810
				 </td>
811
			</tr>
812
		</table>
813
		</div>
814
	</td>
815
	</tr>
816 d732f186 Bill Marquette
</table>
817 f4245bbc Colin Fleming
<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" />
818 07bd3f83 Scott Ullrich
</form>
819 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
820 af4aa061 Scott Ullrich
</body>
821
</html>