Project

General

Profile

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