Project

General

Profile

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