Project

General

Profile

Download (35 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
	$a_filter_unorder = array();
83
	$a_filter_order = array();
84
	$a_filter_order_tmp = array();
85
	// Pointer to id of item being reordered
86
	$found = 0;
87
	$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
		if($a_filter[$i]['interface'] <> $_REQUEST['if']) 
91
			$a_filter_unorder[] = $a_filter[$i];
92
		else 
93
			$a_filter_order_tmp[] = $a_filter[$i];
94
	}
95
	// Reorder rules with the posted order
96
	for ($i = 0; $i<count($drag_order); $i++) 
97
		$a_filter_order[] = $a_filter_order_tmp[$drag_order[$i]];
98
	unset($config['filter']['rule']);
99
	// Overwrite filter rules with newly created items
100
	$config['filter']['rule'] = $a_filter_order;
101
	foreach($a_filter_unorder as $aa) 
102
		$config['filter']['rule'][] = $aa;
103
	// Write configuration
104
	$config = write_config("Drag and drop firewall rules ordering update.");
105
	// Redirect back to page
106 68cbabcb Scott Ullrich
	mark_subsystem_dirty('filter');
107 619f2dbd Scott Ullrich
	$undo = array();
108
	foreach($_REQUEST['dragtable'] as $dt) 
109
		$undo[] = "";
110
	$counter = 0;
111
	foreach($_REQUEST['dragtable'] as $dt) {
112
		$undo[$dt] = $counter;
113
		$counter++;
114
	}
115
	foreach($undo as $dt) 
116
		$undotxt .= "&dragtable[]={$dt}";
117
	Header("Location: firewall_rules.php?if=" . $_REQUEST['if'] . "&undodrag=true" . $undotxt);
118 32c58070 Scott Ullrich
	exit;
119
}
120
121 90ba56ad Scott Ullrich
/* add group interfaces */
122
if (is_array($config['ifgroups']['ifgroupentry']))
123
	foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
124
		if (have_ruleint_access($ifgen['ifname']))
125
			$iflist[$ifgen['ifname']] = $ifgen['ifname'];
126
127 aef4dc74 Ermal Luçi
foreach ($ifdescs as $ifent => $ifdesc)
128
	if(have_ruleint_access($ifent)) 
129
		$iflist[$ifent] = $ifdesc;
130 88bcd1d2 Scott Dale
131 617f8d25 Ermal Lu?i
if ($config['l2tp']['mode'] == "server")
132
        if(have_ruleint_access("l2tp"))
133
                $iflist['l2tp'] = "L2TP VPN";
134
135 07bd3f83 Scott Ullrich
if ($config['pptpd']['mode'] == "server")
136 d81c2ad1 Scott Ullrich
	if(have_ruleint_access("pptp")) 
137
		$iflist['pptp'] = "PPTP VPN";
138 50e0d2a1 Scott Ullrich
139 0e1e0183 Scott Ullrich
if ($config['pppoe']['mode'] == "server")
140 d81c2ad1 Scott Ullrich
	if(have_ruleint_access("pppoe")) 
141
		$iflist['pppoe'] = "PPPoE VPN";
142 0c554ff6 Scott Ullrich
143 88bcd1d2 Scott Dale
/* add ipsec interfaces */
144 d81c2ad1 Scott Ullrich
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable']))
145
	if(have_ruleint_access("enc0")) 
146 0f266b2e Chris Buechler
		$iflist["enc0"] = "IPsec";
147 07bd3f83 Scott Ullrich
148 bfb60ac8 Ermal Luçi
/* add openvpn/tun interfaces */
149 d799787e Matthew Grooms
if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
150
   	$iflist["openvpn"] = "OpenVPN";
151 bfb60ac8 Ermal Luçi
152 92125c97 Ermal Luçi
if (!$if || !isset($iflist[$if])) {
153
	if ("any" == $if)
154 15160475 Ermal Luçi
                $if = "FloatingRules";
155 92125c97 Ermal Luçi
        else if ("FloatingRules" != $if)
156
                $if = "wan";
157
}
158 07bd3f83 Scott Ullrich
159 5b237745 Scott Ullrich
if ($_POST) {
160
161
	$pconfig = $_POST;
162
163
	if ($_POST['apply']) {
164 37e2071c Scott Ullrich
		$retval = 0;
165 9a7e416c Scott Ullrich
		$retval = filter_configure();
166
167 a368a026 Ermal Lu?i
		clear_subsystem_dirty('filter');
168 a985eac2 Scott Ullrich
169 d281f557 Vinicius Coque
		$savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background. You can also %s monitor %s the reload progress"),"<a href='status_filter_reload.php'>","</a>");
170 5b237745 Scott Ullrich
	}
171
}
172
173 d97c50cd Bill Marquette
if ($_GET['act'] == "del") {
174 673d29c0 Renato Botelho
	if ($a_filter[$_GET['id']]) {
175
		if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
176 00c82782 Renato Botelho
			delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
177 673d29c0 Renato Botelho
		}
178
		unset($a_filter[$_GET['id']]);
179
		write_config();
180 a368a026 Ermal Lu?i
		mark_subsystem_dirty('filter');
181 673d29c0 Renato Botelho
		header("Location: firewall_rules.php?if={$if}");
182
		exit;
183
	}
184 d97c50cd Bill Marquette
}
185
186 32c58070 Scott Ullrich
// Handle save msg if defined
187
if($_REQUEST['savemsg']) 
188
	$savemsg = htmlentities($_REQUEST['savemsg']);
189
190 07bd3f83 Scott Ullrich
if (isset($_POST['del_x'])) {
191
	/* delete selected rules */
192
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
193
		foreach ($_POST['rule'] as $rulei) {
194 00c82782 Renato Botelho
			delete_nat_association($a_filter[$rulei]['associated-rule-id']);
195 07bd3f83 Scott Ullrich
			unset($a_filter[$rulei]);
196
		}
197 5b237745 Scott Ullrich
		write_config();
198 a368a026 Ermal Lu?i
		mark_subsystem_dirty('filter');
199 07bd3f83 Scott Ullrich
		header("Location: firewall_rules.php?if={$if}");
200 5b237745 Scott Ullrich
		exit;
201
	}
202 07bd3f83 Scott Ullrich
} else if ($_GET['act'] == "toggle") {
203
	if ($a_filter[$_GET['id']]) {
204 f53b85a3 Scott Ullrich
                if(isset($a_filter[$_GET['id']]['disabled']))
205 734edbdf Bill Marquette
                        unset($a_filter[$_GET['id']]['disabled']);
206
                else
207
                        $a_filter[$_GET['id']]['disabled'] = true;
208 5b237745 Scott Ullrich
		write_config();
209 a368a026 Ermal Lu?i
		mark_subsystem_dirty('filter');
210 07bd3f83 Scott Ullrich
		header("Location: firewall_rules.php?if={$if}");
211 5b237745 Scott Ullrich
		exit;
212
	}
213 07bd3f83 Scott Ullrich
} else {
214 b2ffe419 Scott Ullrich
	/* yuck - IE won't send value attributes for image buttons, while Mozilla does -
215 37e2071c Scott Ullrich
	   so we use .x/.y to fine move button clicks instead... */
216 07bd3f83 Scott Ullrich
	unset($movebtn);
217
	foreach ($_POST as $pn => $pd) {
218
		if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
219
			$movebtn = $matches[1];
220
			break;
221
		}
222 5b237745 Scott Ullrich
	}
223 07bd3f83 Scott Ullrich
	/* move selected rules before this rule */
224
	if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
225
		$a_filter_new = array();
226 b2ffe419 Scott Ullrich
227 07bd3f83 Scott Ullrich
		/* copy all rules < $movebtn and not selected */
228
		for ($i = 0; $i < $movebtn; $i++) {
229
			if (!in_array($i, $_POST['rule']))
230
				$a_filter_new[] = $a_filter[$i];
231
		}
232 b2ffe419 Scott Ullrich
233 07bd3f83 Scott Ullrich
		/* copy all selected rules */
234
		for ($i = 0; $i < count($a_filter); $i++) {
235
			if ($i == $movebtn)
236
				continue;
237
			if (in_array($i, $_POST['rule']))
238
				$a_filter_new[] = $a_filter[$i];
239
		}
240 b2ffe419 Scott Ullrich
241 07bd3f83 Scott Ullrich
		/* copy $movebtn rule */
242
		if ($movebtn < count($a_filter))
243
			$a_filter_new[] = $a_filter[$movebtn];
244 b2ffe419 Scott Ullrich
245 07bd3f83 Scott Ullrich
		/* copy all rules > $movebtn and not selected */
246
		for ($i = $movebtn+1; $i < count($a_filter); $i++) {
247
			if (!in_array($i, $_POST['rule']))
248
				$a_filter_new[] = $a_filter[$i];
249
		}
250 b2ffe419 Scott Ullrich
251 07bd3f83 Scott Ullrich
		$a_filter = $a_filter_new;
252 5b237745 Scott Ullrich
		write_config();
253 a368a026 Ermal Lu?i
		mark_subsystem_dirty('filter');
254 07bd3f83 Scott Ullrich
		header("Location: firewall_rules.php?if={$if}");
255 5b237745 Scott Ullrich
		exit;
256
	}
257
}
258 3a54b6ca Scott Dale
$closehead = false;
259 5b237745 Scott Ullrich
260 9a25487b Scott Ullrich
include("head.inc");
261
262 3a54b6ca Scott Dale
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
263
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
264
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
265
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
266 5b237745 Scott Ullrich
?>
267 3a54b6ca Scott Dale
</head>
268
269 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
270
<?php include("fbegin.inc"); ?>
271
<form action="firewall_rules.php" method="post">
272 6dc83d52 Scott Ullrich
273 625dcc40 Bill Marquette
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js">
274 fa65a62b Scott Ullrich
</script>
275 5b237745 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
276 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('filter')): ?><p>
277 619f2dbd Scott Ullrich
<?php
278
if($_REQUEST['undodrag']) {
279
	foreach($_REQUEST['dragtable'] as $dt) 
280
		$dragtable .= "&dragtable[]={$dt}";
281 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}");
282 619f2dbd Scott Ullrich
} else {
283 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."));
284 619f2dbd Scott Ullrich
}
285
?>
286
<br>
287 5b237745 Scott Ullrich
<?php endif; ?>
288 df222163 Scott Ullrich
<div id="loading" style="visibity:hidden">
289 6dc83d52 Scott Ullrich
	<img src="/themes/<?=$g['theme']?>/images/misc/loader.gif"> Loading, please wait...
290
	<p/>&nbsp;
291
</div>
292 07bd3f83 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
293 37e2071c Scott Ullrich
  <tr><td class="tabnavtbl">
294 0366b748 Scott Ullrich
  <?php
295
	/* active tabs */
296
	$tab_array = array();
297 92125c97 Ermal Luçi
       if ("FloatingRules" == $if)
298
                        $active = true;
299
                else
300
                        $active = false;
301 38f90dc8 Rafael Lucas
        $tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules");
302 0366b748 Scott Ullrich
	$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
303
		if ($ifent == $if)
304
			$active = true;
305
		else
306
			$active = false;
307
		$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
308
	}
309
	display_top_tabs($tab_array);
310
  ?>
311 07bd3f83 Scott Ullrich
  </td></tr>
312 b2ffe419 Scott Ullrich
  <tr>
313 d732f186 Bill Marquette
    <td>
314
	<div id="mainarea">
315
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
316 fa65a62b Scott Ullrich
                <tr id="frheader">
317 37e2071c Scott Ullrich
                  <td width="3%" class="list">&nbsp;</td>
318 5b237745 Scott Ullrich
                  <td width="5%" class="list">&nbsp;</td>
319 38f90dc8 Rafael Lucas
                  <td width="3%" class="listhdrr"><?=gettext("ID");?></td>
320
                  <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
                  <td width="19%" class="listhdr"><?=gettext("Description");?></td>
329 d415d821 Seth Mos
                  <td width="10%" class="list">
330
			<table border="0" cellspacing="0" cellpadding="1">
331
			   <tr>
332
				<?php
333
					$nrules = 0;
334
					for ($i = 0; isset($a_filter[$i]); $i++) {
335
						$filterent = $a_filter[$i];
336 92125c97 Ermal Luçi
						if ($filterent['interface'] != $if && !isset($filterent['floating']))
337 f1c49ff4 Scott Ullrich
							continue;
338
						if (isset($filterent['floating']) && "FloatingRules" != $if)
339 d415d821 Seth Mos
							continue;
340
						$nrules++;
341
					}
342
				?>
343
				<td>
344
				<?php if ($nrules == 0): ?>
345 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: ?>
346 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; ?>
347 d415d821 Seth Mos
				</td>
348 38f90dc8 Rafael Lucas
				<td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=$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>
349 d415d821 Seth Mos
			   </tr>
350
			</table>
351
		  </td>
352
		</tr>
353 f1f60c92 Ermal Luçi
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
354 d9eeccbd Scott Ullrich
                <tr valign="top" id="frrfc1918">
355 664742f7 Renato Botelho
                  <td class="list">&nbsp;</td>
356 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>
357 56a10568 Scott Ullrich
                  <td class="listlr" style="background-color: #E0E0E0"></td>
358
                  <td class="listr" style="background-color: #E0E0E0">*</td>
359
                  <td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td>
360
                  <td class="listr" style="background-color: #E0E0E0">*</td>
361
                  <td class="listr" style="background-color: #E0E0E0">*</td>
362
                  <td class="listr" style="background-color: #E0E0E0">*</td>
363
                  <td class="listr" style="background-color: #E0E0E0">*</td>
364
		<td class="listr" style="background-color: #E0E0E0">*</td>
365
	 		 <td class="listr" style="background-color: #E0E0E0"></td>
366 38f90dc8 Rafael Lucas
                  <td class="listbg"><?=gettext("Block private networks");?></td>
367 d9eeccbd Scott Ullrich
                  <td valign="middle" nowrap class="list">
368
				    <table border="0" cellspacing="0" cellpadding="1">
369
					<tr>
370 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>
371
					  <td><a href="interfaces.php?if=<?=$if?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td>
372 d9eeccbd Scott Ullrich
					</tr>
373
					<tr>
374
					  <td align="center" valign="middle"></td>
375 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>
376 d9eeccbd Scott Ullrich
					</tr>
377
					</table>
378
				  </td>
379
				</tr>
380 c20c0f5a Scott Ullrich
<?php endif; ?>
381 f1f60c92 Ermal Luçi
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
382 c20c0f5a Scott Ullrich
                <tr valign="top" id="frrfc1918">
383 664742f7 Renato Botelho
                  <td class="list">&nbsp;</td>
384 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>
385 56a10568 Scott Ullrich
                  <td class="listlr" style="background-color: #E0E0E0"></td>
386
                  <td class="listr" style="background-color: #E0E0E0">*</td>
387
                  <td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td>
388
                  <td class="listr" style="background-color: #E0E0E0">*</td>
389
                  <td class="listr" style="background-color: #E0E0E0">*</td>
390
                  <td class="listr" style="background-color: #E0E0E0">*</td>
391
				  <td class="listr" style="background-color: #E0E0E0">*</td>
392
				   <td class="listr" style="background-color: #E0E0E0">*</td>
393
		  <td class="listr" style="background-color: #E0E0E0">*</td>
394 38f90dc8 Rafael Lucas
                  <td class="listbg"><?=gettext("Block bogon networks");?></td>
395 c20c0f5a Scott Ullrich
                  <td valign="middle" nowrap class="list">
396
				    <table border="0" cellspacing="0" cellpadding="1">
397
					<tr>
398 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>
399
					  <td><a href="interfaces.php?if=<?=$if?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0"></a></td>
400 c20c0f5a Scott Ullrich
					</tr>
401
					<tr>
402
					  <td align="center" valign="middle"></td>
403 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>
404 c20c0f5a Scott Ullrich
					</tr>
405
					</table>
406
				  </td>
407
				</tr>
408
<?php endif; ?>
409 32c58070 Scott Ullrich
				<tbody id="dragtable" width="100%">
410 07bd3f83 Scott Ullrich
				<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
411
					$filterent = $a_filter[$i];
412 92125c97 Ermal Luçi
					if ($filterent['interface'] != $if && !isset($filterent['floating']))
413 f1c49ff4 Scott Ullrich
						continue;
414
					if (isset($filterent['floating']) && "FloatingRules" != $if)
415
						continue;
416 8e0c3760 Ermal
					$isadvset = firewall_check_for_advanced_options($filterent);
417 f1c49ff4 Scott Ullrich
					if($isadvset)
418 e36c52f4 Erik Fonnesbeck
						$advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\">";
419 f1c49ff4 Scott Ullrich
					else 
420
						$advanced_set = ""
421 07bd3f83 Scott Ullrich
				?>
422 37e2071c Scott Ullrich
                <tr valign="top" id="fr<?=$nrules;?>">
423 f1c49ff4 Scott Ullrich
                  <td class="listt">
424
					<input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;">
425
					<?php echo $advanced_set; ?>
426
				  </td>
427 37e2071c Scott Ullrich
                  <td class="listt" align="center">
428 5b237745 Scott Ullrich
				  <?php if ($filterent['type'] == "block")
429
				  			$iconfn = "block";
430
						else if ($filterent['type'] == "reject") {
431 e91baab8 Chris Buechler
							$iconfn = "reject";
432 5b237745 Scott Ullrich
						} else
433
							$iconfn = "pass";
434
						if (isset($filterent['disabled'])) {
435
							$textss = "<span class=\"gray\">";
436
							$textse = "</span>";
437
							$iconfn .= "_d";
438
						} else {
439
							$textss = $textse = "";
440
						}
441
				  ?>
442 7a808e01 Carlos Eduardo Ramos
				  <a href="?if=<?=$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>
443 5b237745 Scott Ullrich
				  <?php if (isset($filterent['log'])):
444 6fecc73b Scott Dale
							$iconfnlog = "log_s";
445 5b237745 Scott Ullrich
						if (isset($filterent['disabled']))
446 6fecc73b Scott Dale
							$iconfnlog .= "_d";
447 5b237745 Scott Ullrich
				  	?>
448 6fecc73b Scott Dale
				  <br><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0">
449 5b237745 Scott Ullrich
				  <?php endif; ?>
450
				  </td>
451 3a54b6ca Scott Dale
				<?php
452 2a9db752 Scott Dale
				
453 2a113ca9 Scott Dale
				//build Alias popup box
454 3a54b6ca Scott Dale
				$span_end = "";
455
				$alias_src_span_begin = "";
456
				$alias_src_port_span_begin = "";
457
				$alias_dst_span_begin = "";
458
				$alias_dst_port_span_begin = "";
459
				
460 2a9db752 Scott Dale
				$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
461
				$span_end = "</U></span>";
462 3a54b6ca Scott Dale
					
463 2a9db752 Scott Dale
				$alias_src_span_begin = $alias_popup["src"];
464
				 									
465
				$alias_src_port_span_begin = $alias_popup["srcport"];
466
													
467
				$alias_dst_span_begin = $alias_popup["dst"];
468
														
469
				$alias_dst_port_span_begin = $alias_popup["dstport"];
470 3a54b6ca Scott Dale
					
471 2a113ca9 Scott Dale
				//build Schedule popup box
472
				$a_schedules = &$config['schedules']['schedule'];
473
				$schedule_span_begin = "";
474
				$schedule_span_end = "";
475 d2aa8cd6 sullrich
				$sched_caption_escaped = "";
476 eace1363 Scott Dale
				$sched_content = "";
477 3b907eb1 Scott Dale
				$schedstatus = false;
478 38f90dc8 Rafael Lucas
				$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
479
				$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'));
480 8ce97a08 Scott Dale
				if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])){
481
					foreach ($a_schedules as $schedule)
482
					{
483
						if ($schedule['name'] == $filterent['sched'] ){
484 60120e37 Ermal Lu?i
							$schedstatus = filter_get_time_based_rule_status($schedule);
485 8ce97a08 Scott Dale
							
486
							foreach($schedule['timerange'] as $timerange) {
487
								$tempFriendlyTime = "";
488
								$tempID = "";
489
								$firstprint = false;
490
								if ($timerange){
491
									$dayFriendly = "";
492
									$tempFriendlyTime = "";							
493
										
494
									//get hours
495
									$temptimerange = $timerange['hour'];
496
									$temptimeseparator = strrpos($temptimerange, "-");
497 2a113ca9 Scott Dale
									
498 8ce97a08 Scott Dale
									$starttime = substr ($temptimerange, 0, $temptimeseparator); 
499
									$stoptime = substr ($temptimerange, $temptimeseparator+1); 
500 2a113ca9 Scott Dale
										
501 8ce97a08 Scott Dale
									if ($timerange['month']){
502
										$tempmontharray = explode(",", $timerange['month']);
503
										$tempdayarray = explode(",",$timerange['day']);
504
										$arraycounter = 0;
505
										$firstDayFound = false;
506
										$firstPrint = false;
507
										foreach ($tempmontharray as $monthtmp){
508
											$month = $tempmontharray[$arraycounter];
509
											$day = $tempdayarray[$arraycounter];
510 2a113ca9 Scott Dale
											
511
											if (!$firstDayFound)
512
											{
513 8ce97a08 Scott Dale
												$firstDay = $day;
514
												$firstmonth = $month;
515 2a113ca9 Scott Dale
												$firstDayFound = true;
516
											}
517 8ce97a08 Scott Dale
												
518
											$currentDay = $day;
519
											$nextDay = $tempdayarray[$arraycounter+1];
520
											$currentDay++;
521
											if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
522
												if ($firstPrint)
523 2a113ca9 Scott Dale
													$dayFriendly .= ", ";
524
												$currentDay--;
525
												if ($currentDay != $firstDay)
526 8ce97a08 Scott Dale
													$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
527 2a113ca9 Scott Dale
												else
528 8ce97a08 Scott Dale
													$dayFriendly .=  $monthArray[$month-1] . " " . $day;
529 2a113ca9 Scott Dale
												$firstDayFound = false;	
530 8ce97a08 Scott Dale
												$firstPrint = true;
531
											}													
532
											$arraycounter++;	
533 2a113ca9 Scott Dale
										}
534
									}
535 8ce97a08 Scott Dale
									else
536
									{
537
										$tempdayFriendly = $timerange['position'];
538
										$firstDayFound = false;
539
										$tempFriendlyDayArray = explode(",", $tempdayFriendly);								
540
										$currentDay = "";
541
										$firstDay = "";
542
										$nextDay = "";
543
										$counter = 0;													
544
										foreach ($tempFriendlyDayArray as $day){
545
											if ($day != ""){
546
												if (!$firstDayFound)
547
												{
548
													$firstDay = $tempFriendlyDayArray[$counter];
549
													$firstDayFound = true;
550
												}
551
												$currentDay =$tempFriendlyDayArray[$counter];
552
												//get next day
553
												$nextDay = $tempFriendlyDayArray[$counter+1];
554
												$currentDay++;					
555
												if ($currentDay != $nextDay){
556
													if ($firstprint)
557
														$dayFriendly .= ", ";
558
													$currentDay--;
559
													if ($currentDay != $firstDay)
560
														$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
561
													else
562
														$dayFriendly .= $dayArray[$firstDay-1];
563
													$firstDayFound = false;	
564
													$firstprint = true;			
565
												}
566
												$counter++;
567
											}
568
										}
569
									}		
570
									$timeFriendly = $starttime . " - " . $stoptime;
571
									$description = $timerange['rangedescr'];
572
									$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>";
573
								}
574 2a113ca9 Scott Dale
							}
575 d2aa8cd6 sullrich
							$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
576
							$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>";
577 8ce97a08 Scott Dale
							$schedule_span_end = "</U></span>";
578 2a113ca9 Scott Dale
						}
579
					}
580
				}
581 6fecc73b Scott Dale
				$printicon = false;
582 616dd997 Scott Dale
				$alttext = "";
583
				$image = "";
584
				if (!isset($filterent['disabled'])){
585
					 if ($schedstatus) 
586
					 { 
587
					 	if ($iconfn == "block" || $iconfn == "reject")
588
					 	{
589 5b552ac7 Scott Dale
					 		$image = "icon_block";
590 38f90dc8 Rafael Lucas
					 		$alttext = gettext("Traffic matching this rule is currently being denied");
591 616dd997 Scott Dale
					 	}
592
					 	else
593
					 	{
594 5b552ac7 Scott Dale
					 		$image = "icon_pass";
595 38f90dc8 Rafael Lucas
					 		$alttext = gettext("Traffic matching this rule is currently being allowed");
596 616dd997 Scott Dale
					 	}
597
					 	$printicon = true;
598
					  }
599
					  else if ($filterent['sched'])
600
					  { 
601
					 	if ($iconfn == "block" || $iconfn == "reject")
602 5b552ac7 Scott Dale
					 		$image = "icon_block_d";
603 616dd997 Scott Dale
					 	else
604 5b552ac7 Scott Dale
					 		$image = "icon_block";
605 38f90dc8 Rafael Lucas
					 	$alttext = gettext("This rule is not currently active because its period has expired");
606 616dd997 Scott Dale
					 	$printicon = true;				  	
607
					  }
608
				}
609 3a54b6ca Scott Dale
				?>
610 98e29097 Bill Marquette
                  <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
611 b9e28d57 unknown
                    <?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']; else echo ""; ?><?=$textse;?>
612
                  </td>
613
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
614 5b237745 Scott Ullrich
                    <?=$textss;?><?php if (isset($filterent['protocol'])) echo strtoupper($filterent['protocol']); else echo "*"; ?><?=$textse;?>
615
                  </td>
616 98e29097 Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
617 3a54b6ca Scott Dale
				    <?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
618 5b237745 Scott Ullrich
                  </td>
619 98e29097 Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
620 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;?>
621 5b237745 Scott Ullrich
                  </td>
622 98e29097 Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
623 3a54b6ca Scott Dale
				    <?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
624 5b237745 Scott Ullrich
                  </td>
625 3a54b6ca Scott Dale
	              <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
626
                    <?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
627 5b237745 Scott Ullrich
                  </td>
628 b504c2f8 Scott Ullrich
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
629 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;?>
630 b504c2f8 Scott Ullrich
                  </td>
631 32c58070 Scott Ullrich
				  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><?=$textss;?>
632 197bfe96 Ermal Luçi
                          <?php
633
							if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
634
								$desc = $filterent['ackqueue'] ;
635
							    echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>";
636
								$desc = $filterent['defaultqueue'];
637
							    echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
638
							} else if (isset($filterent['defaultqueue'])) {
639
								$desc = $filterent['defaultqueue'];
640
							    echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; }
641 7a808e01 Carlos Eduardo Ramos
							else echo gettext("none");
642 197bfe96 Ermal Luçi
						  ?><?=$textse;?>
643
                        </td>
644 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">
645 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;?>
646 7738faa8 Scott Ullrich
                  </td>
647 c2a6f323 Scott Ullrich
                  <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" class="descr">
648 07bd3f83 Scott Ullrich
                    <?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
649 5b237745 Scott Ullrich
                  </td>
650
                  <td valign="middle" nowrap class="list">
651 07bd3f83 Scott Ullrich
				    <table border="0" cellspacing="0" cellpadding="1">
652
					<tr>
653 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>
654
					  <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>
655 07bd3f83 Scott Ullrich
					</tr>
656
					<tr>
657 7a808e01 Carlos Eduardo Ramos
					  <td align="center" valign="middle"><a href="firewall_rules.php?act=del&if=<?=$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>
658
					  <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>
659 07bd3f83 Scott Ullrich
					</tr>
660
					</table>
661 5b237745 Scott Ullrich
				  </td>
662
				</tr>
663 07bd3f83 Scott Ullrich
			  <?php $nrules++; endfor; ?>
664 32c58070 Scott Ullrich
			  </tbody>
665 07bd3f83 Scott Ullrich
			  <?php if ($nrules == 0): ?>
666 37e2071c Scott Ullrich
              <td class="listt"></td>
667 07bd3f83 Scott Ullrich
			  <td class="listt"></td>
668 d5a1008d Scott Ullrich
			  <td class="listlr" colspan="10" align="center" valign="middle">
669 07bd3f83 Scott Ullrich
			  <span class="gray">
670 8b6827a4 Carlos Eduardo Ramos
			  <?=gettext("No rules are currently defined for this interface"); ?><br>
671
			  <?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br><br>
672 754ad306 Carlos Eduardo Ramos
			  <?=gettext("Click the"); ?> <a href="firewall_rules_edit.php?if=<?=$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>
673 07bd3f83 Scott Ullrich
			  </td>
674
			  <?php endif; ?>
675 37e2071c Scott Ullrich
                <tr id="fr<?=$nrules;?>">
676
                  <td class="list"></td>
677
                  <td class="list"></td>
678
                  <td class="list">&nbsp;</td>
679
                  <td class="list">&nbsp;</td>
680
                  <td class="list">&nbsp;</td>
681 b9e28d57 unknown
                  <td class="list">&nbsp;</td>
682 1c7e3ec6 Bill Marquette
		  <td class="list">&nbsp;</td>
683
		  <td class="list">&nbsp;</td>
684
                  <td class="list">&nbsp;</td>
685 37e2071c Scott Ullrich
                  <td class="list">&nbsp;</td>
686
                  <td class="list">&nbsp;</td>
687
                  <td class="list">&nbsp;</td>
688 07bd3f83 Scott Ullrich
                  <td class="list">
689
				    <table border="0" cellspacing="0" cellpadding="1">
690
					<tr>
691
				      <td>
692 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>
693 37e2071c Scott Ullrich
					  <td></td>
694 07bd3f83 Scott Ullrich
				    </tr>
695
					<tr>
696 3086d0f8 Scott Ullrich
					  <td>
697
					  <?php if ($nrules == 0): ?>
698 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: ?>
699 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; ?>
700 3086d0f8 Scott Ullrich
					  </td>
701 38f90dc8 Rafael Lucas
			                  <td><a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0"></a></td>
702 07bd3f83 Scott Ullrich
					</tr>
703
				    </table>
704
				  </td>
705 5b237745 Scott Ullrich
				</tr>
706
              </table>
707 d732f186 Bill Marquette
	      <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
708 b2ffe419 Scott Ullrich
                <tr>
709 677c0869 Erik Kristensen
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11"></td>
710 38f90dc8 Rafael Lucas
                  <td><?=gettext("pass");?></td>
711 5b237745 Scott Ullrich
                  <td width="14"></td>
712 677c0869 Erik Kristensen
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11"></td>
713 38f90dc8 Rafael Lucas
                  <td><?=gettext("block");?></td>
714 5b237745 Scott Ullrich
                  <td width="14"></td>
715 677c0869 Erik Kristensen
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11"></td>
716 38f90dc8 Rafael Lucas
                  <td><?=gettext("reject");?></td>
717 5b237745 Scott Ullrich
                  <td width="14"></td>
718 677c0869 Erik Kristensen
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11"></td>
719 38f90dc8 Rafael Lucas
                  <td><?=gettext("log");?></td>
720 5b237745 Scott Ullrich
                </tr>
721 b2ffe419 Scott Ullrich
                <tr>
722 677c0869 Erik Kristensen
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11"></td>
723 38f90dc8 Rafael Lucas
                  <td nowrap><?=gettext("pass (disabled)");?></td>
724 d732f186 Bill Marquette
                  <td>&nbsp;</td>
725 677c0869 Erik Kristensen
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11"></td>
726 38f90dc8 Rafael Lucas
                  <td nowrap><?=gettext("block (disabled)");?></td>
727 d732f186 Bill Marquette
                  <td>&nbsp;</td>
728 677c0869 Erik Kristensen
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11"></td>
729 38f90dc8 Rafael Lucas
                  <td nowrap><?=gettext("reject (disabled)");?></td>
730 d732f186 Bill Marquette
                  <td>&nbsp;</td>
731 677c0869 Erik Kristensen
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11"></td>
732 38f90dc8 Rafael Lucas
                  <td nowrap><?=gettext("log (disabled)");?></td>
733 5b237745 Scott Ullrich
                </tr>
734 d732f186 Bill Marquette
		<tr>
735 05860c07 Scott Ullrich
		  <td colspan="10">
736 c662cc9d Scott Ullrich
  &nbsp;<p/>
737
  <strong>
738 45a06eeb Renato Botelho
	<span class="red"><?=gettext("Hint:");?></span>
739 c662cc9d Scott Ullrich
  </strong><br>
740
	<ul>
741 74aff49c Renato Botelho
  <li><?=gettext("Rules are evaluated on a first-match basis (i.e. " .
742
  "the action of the first rule to match a packet will be executed). " .
743
  "This means that if you use block rules, you'll have to pay attention " .
744
  "to the rule order. Everything that isn't explicitly passed is blocked " .
745
  "by default. ");?>
746 c662cc9d Scott Ullrich
</li>
747
<li>
748 74aff49c Renato Botelho
  <?=gettext("You may drag and drop rules using your mouse to reorder the rule ordering.");?>
749 c662cc9d Scott Ullrich
</li>
750
</ul>
751 d732f186 Bill Marquette
		 </td>
752
	        </tr>
753
              </table>
754
	</div>
755
    </td>
756
  </tr>
757
</table>
758 37e2071c Scott Ullrich
  <input type="hidden" name="if" value="<?=$if;?>">
759 32c58070 Scott Ullrich
  <script type="text/javascript">
760 7abaeb1f Scott Ullrich
	var number_of_rules = <?=$nrules?>;
761 32c58070 Scott Ullrich
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?>
762
	Sortable.create("dragtable", { 
763
		tag:"tr", 
764
		format:"fr([0-9999999])",
765
		containment:["dragtable"], 
766 7abaeb1f Scott Ullrich
		onChange:function(affected) {
767
			document.body.style.cursor = 'move';
768 32c58070 Scott Ullrich
		},
769 7abaeb1f Scott Ullrich
		onUpdate:function(container) { 
770
			document.body.style.cursor = 'move';
771 32c58070 Scott Ullrich
			updateOrder(Sortable.serialize('dragtable', 'tr'));
772
		} 
773
	});
774
<?php endfor; ?>
775
	function updateOrder(order) {
776 12c54789 Scott Ullrich
		if(document.getElementById("redboxtable"))
777
			$('redboxtable').hide();
778 6dc83d52 Scott Ullrich
		$('loading').show();
779 32c58070 Scott Ullrich
		document.body.style.cursor = 'wait';
780
		document.location = 'firewall_rules.php?if=<?=$if?>&dragdroporder=true&' + Sortable.serialize('dragtable', 'tr');
781
		return;
782
	}
783 6dc83d52 Scott Ullrich
	$('loading').hide();
784 32c58070 Scott Ullrich
  </script>
785 07bd3f83 Scott Ullrich
</form>
786 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
787 af4aa061 Scott Ullrich
</body>
788
</html>