Project

General

Profile

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