1 |
b2ffe419
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* firewall_rules.php
|
4 |
9da2cf1c
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
|
|
* Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
|
7 |
|
|
* All rights reserved.
|
8 |
fd9ebcd5
|
Stephen Beaver
|
*
|
9 |
c5d81585
|
Renato Botelho
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
10 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
* All rights reserved.
|
12 |
fd9ebcd5
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14 |
|
|
* you may not use this file except in compliance with the License.
|
15 |
|
|
* You may obtain a copy of the License at
|
16 |
fd9ebcd5
|
Stephen Beaver
|
*
|
17 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18 |
fd9ebcd5
|
Stephen Beaver
|
*
|
19 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
20 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 |
|
|
* See the License for the specific language governing permissions and
|
23 |
|
|
* limitations under the License.
|
24 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
25 |
5b237745
|
Scott Ullrich
|
|
26 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
27 |
|
|
##|*IDENT=page-firewall-rules
|
28 |
5230f468
|
jim-p
|
##|*NAME=Firewall: Rules
|
29 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Firewall: Rules' page.
|
30 |
|
|
##|*MATCH=firewall_rules.php*
|
31 |
|
|
##|-PRIV
|
32 |
|
|
|
33 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
34 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
35 |
|
|
require_once("filter.inc");
|
36 |
179ab6b3
|
Luiz Otavio O Souza
|
require_once("ipsec.inc");
|
37 |
7a927e67
|
Scott Ullrich
|
require_once("shaper.inc");
|
38 |
5b237745
|
Scott Ullrich
|
|
39 |
a7893b72
|
Stephen Beaver
|
$XmoveTitle = gettext("Move checked rules above this one. Shift+Click to move checked rules below.");
|
40 |
|
|
$ShXmoveTitle = gettext("Move checked rules below this one. Release shift to move checked rules above.");
|
41 |
d830a7f4
|
Stephen Beaver
|
|
42 |
6c07db48
|
Phil Davis
|
$pgtitle = array(gettext("Firewall"), gettext("Rules"));
|
43 |
b32dd0a6
|
jim-p
|
$shortcut_section = "firewall";
|
44 |
7a808e01
|
Carlos Eduardo Ramos
|
|
45 |
cc2cff0b
|
Luiz Otavio O Souza
|
function get_pf_rules($rules, $tracker) {
|
46 |
|
|
|
47 |
|
|
if ($rules == NULL || !is_array($rules))
|
48 |
|
|
return (NULL);
|
49 |
|
|
|
50 |
|
|
$arr = array();
|
51 |
227c1181
|
NOYB
|
foreach ($rules as $rule) {
|
52 |
|
|
if ($rule['tracker'] === $tracker) {
|
53 |
|
|
$arr[] = $rule;
|
54 |
|
|
}
|
55 |
cc2cff0b
|
Luiz Otavio O Souza
|
}
|
56 |
|
|
|
57 |
|
|
if (count($arr) == 0)
|
58 |
|
|
return (NULL);
|
59 |
|
|
|
60 |
|
|
return ($arr);
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
function print_states($tracker) {
|
64 |
|
|
global $rulescnt;
|
65 |
|
|
|
66 |
|
|
$rulesid = "";
|
67 |
|
|
$bytes = 0;
|
68 |
|
|
$states = 0;
|
69 |
|
|
$packets = 0;
|
70 |
|
|
$evaluations = 0;
|
71 |
|
|
$stcreations = 0;
|
72 |
|
|
$rules = get_pf_rules($rulescnt, $tracker);
|
73 |
227c1181
|
NOYB
|
if (is_array($rules)) {
|
74 |
|
|
foreach ($rules as $rule) {
|
75 |
|
|
$bytes += $rule['bytes'];
|
76 |
|
|
$states += $rule['states'];
|
77 |
|
|
$packets += $rule['packets'];
|
78 |
|
|
$evaluations += $rule['evaluations'];
|
79 |
|
|
$stcreations += $rule['state creations'];
|
80 |
|
|
if (strlen($rulesid) > 0) {
|
81 |
|
|
$rulesid .= ",";
|
82 |
|
|
}
|
83 |
|
|
$rulesid .= "{$rule['id']}";
|
84 |
|
|
}
|
85 |
cc2cff0b
|
Luiz Otavio O Souza
|
}
|
86 |
227c1181
|
NOYB
|
|
87 |
cc2cff0b
|
Luiz Otavio O Souza
|
printf("<a href=\"diag_dump_states.php?ruleid=%s\" data-toggle=\"popover\" data-trigger=\"hover focus\" title=\"%s\" ",
|
88 |
|
|
$rulesid, gettext("States details"));
|
89 |
|
|
printf("data-content=\"evaluations: %s<br>packets: %s<br>bytes: %s<br>states: %s<br>state creations: %s\" data-html=\"true\">",
|
90 |
|
|
format_number($evaluations), format_number($packets), format_bytes($bytes),
|
91 |
|
|
format_number($states), format_number($stcreations));
|
92 |
|
|
printf("%d/%s</a><br>", format_number($states), format_bytes($bytes));
|
93 |
|
|
}
|
94 |
|
|
|
95 |
00c82782
|
Renato Botelho
|
function delete_nat_association($id) {
|
96 |
|
|
global $config;
|
97 |
|
|
|
98 |
603d3c16
|
Phil Davis
|
if (!$id || !is_array($config['nat']['rule'])) {
|
99 |
673d29c0
|
Renato Botelho
|
return;
|
100 |
603d3c16
|
Phil Davis
|
}
|
101 |
673d29c0
|
Renato Botelho
|
|
102 |
00c82782
|
Renato Botelho
|
$a_nat = &$config['nat']['rule'];
|
103 |
|
|
|
104 |
603d3c16
|
Phil Davis
|
foreach ($a_nat as &$natent) {
|
105 |
|
|
if ($natent['associated-rule-id'] == $id) {
|
106 |
00c82782
|
Renato Botelho
|
$natent['associated-rule-id'] = '';
|
107 |
603d3c16
|
Phil Davis
|
}
|
108 |
|
|
}
|
109 |
673d29c0
|
Renato Botelho
|
}
|
110 |
|
|
|
111 |
5b237745
|
Scott Ullrich
|
if (!is_array($config['filter']['rule'])) {
|
112 |
|
|
$config['filter']['rule'] = array();
|
113 |
|
|
}
|
114 |
c821a6cd
|
Stephen Beaver
|
|
115 |
5b237745
|
Scott Ullrich
|
filter_rules_sort();
|
116 |
|
|
$a_filter = &$config['filter']['rule'];
|
117 |
|
|
|
118 |
07bd3f83
|
Scott Ullrich
|
$if = $_GET['if'];
|
119 |
824329d2
|
Stephen Beaver
|
|
120 |
603d3c16
|
Phil Davis
|
if ($_POST['if']) {
|
121 |
07bd3f83
|
Scott Ullrich
|
$if = $_POST['if'];
|
122 |
603d3c16
|
Phil Davis
|
}
|
123 |
b2ffe419
|
Scott Ullrich
|
|
124 |
cbe3ea96
|
Ermal Luçi
|
$ifdescs = get_configured_interface_with_descr();
|
125 |
07bd3f83
|
Scott Ullrich
|
|
126 |
90ba56ad
|
Scott Ullrich
|
/* add group interfaces */
|
127 |
603d3c16
|
Phil Davis
|
if (is_array($config['ifgroups']['ifgroupentry'])) {
|
128 |
|
|
foreach ($config['ifgroups']['ifgroupentry'] as $ifgen) {
|
129 |
|
|
if (have_ruleint_access($ifgen['ifname'])) {
|
130 |
90ba56ad
|
Scott Ullrich
|
$iflist[$ifgen['ifname']] = $ifgen['ifname'];
|
131 |
603d3c16
|
Phil Davis
|
}
|
132 |
|
|
}
|
133 |
|
|
}
|
134 |
90ba56ad
|
Scott Ullrich
|
|
135 |
603d3c16
|
Phil Davis
|
foreach ($ifdescs as $ifent => $ifdesc) {
|
136 |
|
|
if (have_ruleint_access($ifent)) {
|
137 |
aef4dc74
|
Ermal Luçi
|
$iflist[$ifent] = $ifdesc;
|
138 |
603d3c16
|
Phil Davis
|
}
|
139 |
|
|
}
|
140 |
88bcd1d2
|
Scott Dale
|
|
141 |
603d3c16
|
Phil Davis
|
if ($config['l2tp']['mode'] == "server") {
|
142 |
|
|
if (have_ruleint_access("l2tp")) {
|
143 |
d62e733b
|
Phil Davis
|
$iflist['l2tp'] = gettext("L2TP VPN");
|
144 |
603d3c16
|
Phil Davis
|
}
|
145 |
|
|
}
|
146 |
617f8d25
|
Ermal Lu?i
|
|
147 |
b0899ee4
|
Ermal
|
if (is_array($config['pppoes']['pppoe'])) {
|
148 |
603d3c16
|
Phil Davis
|
foreach ($config['pppoes']['pppoe'] as $pppoes) {
|
149 |
|
|
if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe")) {
|
150 |
d62e733b
|
Phil Davis
|
$iflist['pppoe'] = gettext("PPPoE Server");
|
151 |
603d3c16
|
Phil Davis
|
}
|
152 |
|
|
}
|
153 |
b0899ee4
|
Ermal
|
}
|
154 |
0c554ff6
|
Scott Ullrich
|
|
155 |
88bcd1d2
|
Scott Dale
|
/* add ipsec interfaces */
|
156 |
67c2baf1
|
Phil Davis
|
if (ipsec_enabled() && have_ruleint_access("enc0")) {
|
157 |
d62e733b
|
Phil Davis
|
$iflist["enc0"] = gettext("IPsec");
|
158 |
67c2baf1
|
Phil Davis
|
}
|
159 |
07bd3f83
|
Scott Ullrich
|
|
160 |
bfb60ac8
|
Ermal Luçi
|
/* add openvpn/tun interfaces */
|
161 |
6c07db48
|
Phil Davis
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
|
162 |
d62e733b
|
Phil Davis
|
$iflist["openvpn"] = gettext("OpenVPN");
|
163 |
603d3c16
|
Phil Davis
|
}
|
164 |
bfb60ac8
|
Ermal Luçi
|
|
165 |
92125c97
|
Ermal Luçi
|
if (!$if || !isset($iflist[$if])) {
|
166 |
603d3c16
|
Phil Davis
|
if ("any" == $if) {
|
167 |
56dda8e0
|
Renato Botelho
|
$if = "FloatingRules";
|
168 |
603d3c16
|
Phil Davis
|
} else if ("FloatingRules" != $if) {
|
169 |
|
|
if (isset($iflist['wan'])) {
|
170 |
0416d9a0
|
Darren Embry
|
$if = "wan";
|
171 |
603d3c16
|
Phil Davis
|
} else {
|
172 |
0416d9a0
|
Darren Embry
|
$if = "FloatingRules";
|
173 |
603d3c16
|
Phil Davis
|
}
|
174 |
0416d9a0
|
Darren Embry
|
}
|
175 |
92125c97
|
Ermal Luçi
|
}
|
176 |
07bd3f83
|
Scott Ullrich
|
|
177 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
178 |
|
|
$pconfig = $_POST;
|
179 |
|
|
|
180 |
|
|
if ($_POST['apply']) {
|
181 |
37e2071c
|
Scott Ullrich
|
$retval = 0;
|
182 |
9a7e416c
|
Scott Ullrich
|
$retval = filter_configure();
|
183 |
|
|
|
184 |
a368a026
|
Ermal Lu?i
|
clear_subsystem_dirty('filter');
|
185 |
a985eac2
|
Scott Ullrich
|
|
186 |
317b2852
|
NOYB
|
$savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />%s Monitor %s the reload progress."),
|
187 |
824329d2
|
Stephen Beaver
|
"<a href='status_filter_reload.php'>", "</a>");
|
188 |
5b237745
|
Scott Ullrich
|
}
|
189 |
|
|
}
|
190 |
|
|
|
191 |
d97c50cd
|
Bill Marquette
|
if ($_GET['act'] == "del") {
|
192 |
673d29c0
|
Renato Botelho
|
if ($a_filter[$_GET['id']]) {
|
193 |
|
|
if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
|
194 |
00c82782
|
Renato Botelho
|
delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
|
195 |
673d29c0
|
Renato Botelho
|
}
|
196 |
|
|
unset($a_filter[$_GET['id']]);
|
197 |
a4eef0c7
|
Stephen Beaver
|
|
198 |
|
|
// Update the separators
|
199 |
e1e1ab07
|
Stephen Beaver
|
$a_separators = &$config['filter']['separator'][strtolower($if)];
|
200 |
a4f41878
|
NOYB
|
$ridx = ifridx($if, $_GET['id']); // get rule index within interface
|
201 |
|
|
$mvnrows = -1;
|
202 |
|
|
move_separators($a_separators, $ridx, $mvnrows);
|
203 |
a4eef0c7
|
Stephen Beaver
|
|
204 |
603d3c16
|
Phil Davis
|
if (write_config()) {
|
205 |
bec92ab9
|
jim-p
|
mark_subsystem_dirty('filter');
|
206 |
603d3c16
|
Phil Davis
|
}
|
207 |
6cb366de
|
Stephen Beaver
|
|
208 |
e653b6e1
|
jim-p
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
209 |
673d29c0
|
Renato Botelho
|
exit;
|
210 |
|
|
}
|
211 |
d97c50cd
|
Bill Marquette
|
}
|
212 |
|
|
|
213 |
32c58070
|
Scott Ullrich
|
// Handle save msg if defined
|
214 |
603d3c16
|
Phil Davis
|
if ($_REQUEST['savemsg']) {
|
215 |
32c58070
|
Scott Ullrich
|
$savemsg = htmlentities($_REQUEST['savemsg']);
|
216 |
603d3c16
|
Phil Davis
|
}
|
217 |
32c58070
|
Scott Ullrich
|
|
218 |
6cb366de
|
Stephen Beaver
|
if (isset($_POST['del_x'])) {
|
219 |
|
|
/* delete selected rules */
|
220 |
|
|
$deleted = false;
|
221 |
|
|
|
222 |
|
|
if (is_array($_POST['rule']) && count($_POST['rule'])) {
|
223 |
e1e1ab07
|
Stephen Beaver
|
$a_separators = &$config['filter']['separator'][strtolower($if)];
|
224 |
a4eef0c7
|
Stephen Beaver
|
|
225 |
6cb366de
|
Stephen Beaver
|
foreach ($_POST['rule'] as $rulei) {
|
226 |
|
|
delete_nat_association($a_filter[$rulei]['associated-rule-id']);
|
227 |
|
|
unset($a_filter[$rulei]);
|
228 |
|
|
$deleted = true;
|
229 |
a4eef0c7
|
Stephen Beaver
|
|
230 |
|
|
// Update the separators
|
231 |
a4f41878
|
NOYB
|
$ridx = ifridx($if, $rulei); // get rule index within interface
|
232 |
|
|
$mvnrows = -1;
|
233 |
|
|
move_separators($a_separators, $ridx, $mvnrows);
|
234 |
6cb366de
|
Stephen Beaver
|
}
|
235 |
|
|
|
236 |
67c2baf1
|
Phil Davis
|
if ($deleted) {
|
237 |
6cb366de
|
Stephen Beaver
|
if (write_config()) {
|
238 |
|
|
mark_subsystem_dirty('filter');
|
239 |
|
|
}
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
243 |
|
|
exit;
|
244 |
|
|
}
|
245 |
|
|
} else if ($_GET['act'] == "toggle") {
|
246 |
07bd3f83
|
Scott Ullrich
|
if ($a_filter[$_GET['id']]) {
|
247 |
603d3c16
|
Phil Davis
|
if (isset($a_filter[$_GET['id']]['disabled'])) {
|
248 |
56dda8e0
|
Renato Botelho
|
unset($a_filter[$_GET['id']]['disabled']);
|
249 |
603d3c16
|
Phil Davis
|
} else {
|
250 |
56dda8e0
|
Renato Botelho
|
$a_filter[$_GET['id']]['disabled'] = true;
|
251 |
603d3c16
|
Phil Davis
|
}
|
252 |
|
|
if (write_config()) {
|
253 |
bec92ab9
|
jim-p
|
mark_subsystem_dirty('filter');
|
254 |
603d3c16
|
Phil Davis
|
}
|
255 |
6cb366de
|
Stephen Beaver
|
|
256 |
e653b6e1
|
jim-p
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
257 |
5b237745
|
Scott Ullrich
|
exit;
|
258 |
|
|
}
|
259 |
67c2baf1
|
Phil Davis
|
} else if ($_POST['order-store']) {
|
260 |
7d8552fc
|
Stephen Beaver
|
|
261 |
ea5665c7
|
Sjon Hortensius
|
/* update rule order, POST[rule] is an array of ordered IDs */
|
262 |
|
|
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
|
263 |
07bd3f83
|
Scott Ullrich
|
$a_filter_new = array();
|
264 |
b2ffe419
|
Scott Ullrich
|
|
265 |
acd05d2b
|
NOYB
|
// Include the rules of other interfaces listed in config before this (the selected) interface.
|
266 |
|
|
foreach ($a_filter as $filteri_before => $filterent) {
|
267 |
|
|
if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
|
268 |
|
|
break;
|
269 |
|
|
} else {
|
270 |
|
|
$a_filter_new[] = $filterent;
|
271 |
|
|
}
|
272 |
fdb83ce0
|
NOYB
|
}
|
273 |
|
|
|
274 |
acd05d2b
|
NOYB
|
// Include the rules of this (the selected) interface.
|
275 |
|
|
// If a rule is not in POST[rule], it has been deleted by the user
|
276 |
67c2baf1
|
Phil Davis
|
foreach ($_POST['rule'] as $id) {
|
277 |
ea5665c7
|
Sjon Hortensius
|
$a_filter_new[] = $a_filter[$id];
|
278 |
67c2baf1
|
Phil Davis
|
}
|
279 |
b2ffe419
|
Scott Ullrich
|
|
280 |
acd05d2b
|
NOYB
|
// Include the rules of other interfaces listed in config after this (the selected) interface.
|
281 |
|
|
foreach ($a_filter as $filteri_after => $filterent) {
|
282 |
|
|
if ($filteri_before > $filteri_after) {
|
283 |
|
|
continue;
|
284 |
|
|
}
|
285 |
|
|
if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
|
286 |
|
|
continue;
|
287 |
|
|
} else {
|
288 |
|
|
$a_filter_new[] = $filterent;
|
289 |
fdb83ce0
|
NOYB
|
}
|
290 |
|
|
}
|
291 |
|
|
|
292 |
07bd3f83
|
Scott Ullrich
|
$a_filter = $a_filter_new;
|
293 |
c64c9278
|
Stephen Beaver
|
|
294 |
a361a19b
|
Stephen Beaver
|
$config['filter']['separator'][strtolower($if)] = "";
|
295 |
c64c9278
|
Stephen Beaver
|
|
296 |
|
|
if ($_POST['separator']) {
|
297 |
|
|
$idx = 0;
|
298 |
|
|
foreach ($_POST['separator'] as $separator) {
|
299 |
a361a19b
|
Stephen Beaver
|
$config['filter']['separator'][strtolower($separator['if'])]['sep' . $idx++] = $separator;
|
300 |
c64c9278
|
Stephen Beaver
|
}
|
301 |
|
|
}
|
302 |
|
|
|
303 |
603d3c16
|
Phil Davis
|
if (write_config()) {
|
304 |
bec92ab9
|
jim-p
|
mark_subsystem_dirty('filter');
|
305 |
603d3c16
|
Phil Davis
|
}
|
306 |
6cb366de
|
Stephen Beaver
|
|
307 |
e653b6e1
|
jim-p
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
308 |
5b237745
|
Scott Ullrich
|
exit;
|
309 |
|
|
}
|
310 |
|
|
}
|
311 |
|
|
|
312 |
df95836a
|
Stephen Beaver
|
$tab_array = array(array(gettext("Floating"), ("FloatingRules" == $if), "firewall_rules.php?if=FloatingRules"));
|
313 |
|
|
|
314 |
67c2baf1
|
Phil Davis
|
foreach ($iflist as $ifent => $ifname) {
|
315 |
df95836a
|
Stephen Beaver
|
$tab_array[] = array($ifname, ($ifent == $if), "firewall_rules.php?if={$ifent}");
|
316 |
67c2baf1
|
Phil Davis
|
}
|
317 |
df95836a
|
Stephen Beaver
|
|
318 |
|
|
foreach ($tab_array as $dtab) {
|
319 |
67c2baf1
|
Phil Davis
|
if ($dtab[1]) {
|
320 |
df95836a
|
Stephen Beaver
|
$bctab = $dtab[0];
|
321 |
|
|
break;
|
322 |
|
|
}
|
323 |
|
|
}
|
324 |
|
|
|
325 |
|
|
$pgtitle = array(gettext("Firewall"), gettext("Rules"), $bctab);
|
326 |
|
|
$shortcut_section = "firewall";
|
327 |
|
|
|
328 |
9a25487b
|
Scott Ullrich
|
include("head.inc");
|
329 |
3b2c83b8
|
Sjon Hortensius
|
$nrules = 0;
|
330 |
|
|
|
331 |
67c2baf1
|
Phil Davis
|
if ($savemsg) {
|
332 |
42a6bcbd
|
Stephen Beaver
|
print_info_box($savemsg, 'success');
|
333 |
67c2baf1
|
Phil Davis
|
}
|
334 |
42a6bcbd
|
Stephen Beaver
|
|
335 |
67c2baf1
|
Phil Davis
|
if (is_subsystem_dirty('filter')) {
|
336 |
317b2852
|
NOYB
|
print_apply_box(gettext("The firewall rule configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
|
337 |
67c2baf1
|
Phil Davis
|
}
|
338 |
3b2c83b8
|
Sjon Hortensius
|
|
339 |
|
|
display_top_tabs($tab_array);
|
340 |
ea5665c7
|
Sjon Hortensius
|
|
341 |
a2c5280d
|
Stephen Beaver
|
$showantilockout = false;
|
342 |
|
|
$showprivate = false;
|
343 |
|
|
$showblockbogons = false;
|
344 |
|
|
|
345 |
|
|
if (!isset($config['system']['webgui']['noantilockout']) &&
|
346 |
|
|
(((count($config['interfaces']) > 1) && ($if == 'lan')) ||
|
347 |
|
|
((count($config['interfaces']) == 1) && ($if == 'wan')))) {
|
348 |
|
|
$showantilockout = true;
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
if (isset($config['interfaces'][$if]['blockpriv'])) {
|
352 |
|
|
$showprivate = true;
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
if (isset($config['interfaces'][$if]['blockbogons'])) {
|
356 |
|
|
$showblockbogons = true;
|
357 |
|
|
}
|
358 |
|
|
|
359 |
cc2cff0b
|
Luiz Otavio O Souza
|
/* Load the counter data of each pf rule. */
|
360 |
|
|
$rulescnt = pfSense_get_pf_rules();
|
361 |
b13a8425
|
Stephen Beaver
|
|
362 |
c54a42ea
|
Renato Botelho
|
// Update this if you add or remove columns!
|
363 |
10ae204f
|
Stephen Beaver
|
$columns_in_table = 13;
|
364 |
|
|
|
365 |
cc2cff0b
|
Luiz Otavio O Souza
|
?>
|
366 |
c821a6cd
|
Stephen Beaver
|
<form method="post">
|
367 |
|
|
<div class="panel panel-default">
|
368 |
3d7a8696
|
k-paulius
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Rules (Drag to Change Order)")?></h2></div>
|
369 |
c821a6cd
|
Stephen Beaver
|
<div id="mainarea" class="table-responsive panel-body">
|
370 |
576437f5
|
Stephen Beaver
|
<table id="ruletable" class="table table-hover table-striped table-condensed">
|
371 |
c821a6cd
|
Stephen Beaver
|
<thead>
|
372 |
|
|
<tr>
|
373 |
6cb366de
|
Stephen Beaver
|
<th><!-- checkbox --></th>
|
374 |
c821a6cd
|
Stephen Beaver
|
<th><!-- status icons --></th>
|
375 |
cc2cff0b
|
Luiz Otavio O Souza
|
<th><?=gettext("States")?></th>
|
376 |
66c62a1a
|
NewEraCracker
|
<th><?=gettext("Protocol")?></th>
|
377 |
f25dac2d
|
Stephen Beaver
|
<th><?=gettext("Source")?></th>
|
378 |
|
|
<th><?=gettext("Port")?></th>
|
379 |
|
|
<th><?=gettext("Destination")?></th>
|
380 |
|
|
<th><?=gettext("Port")?></th>
|
381 |
|
|
<th><?=gettext("Gateway")?></th>
|
382 |
|
|
<th><?=gettext("Queue")?></th>
|
383 |
|
|
<th><?=gettext("Schedule")?></th>
|
384 |
|
|
<th><?=gettext("Description")?></th>
|
385 |
|
|
<th><?=gettext("Actions")?></th>
|
386 |
c821a6cd
|
Stephen Beaver
|
</tr>
|
387 |
|
|
</thead>
|
388 |
a2c5280d
|
Stephen Beaver
|
|
389 |
|
|
<?php if ($showblockbogons || $showantilockout || $showprivate) :
|
390 |
|
|
?>
|
391 |
c821a6cd
|
Stephen Beaver
|
<tbody>
|
392 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
393 |
ea5665c7
|
Sjon Hortensius
|
// Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1.
|
394 |
a2c5280d
|
Stephen Beaver
|
if ($showantilockout):
|
395 |
|
|
$alports = implode('<br />', filter_get_antilockout_ports(true));
|
396 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
397 |
b54ae90f
|
Jared Dillard
|
<tr id="antilockout">
|
398 |
6cb366de
|
Stephen Beaver
|
<td></td>
|
399 |
29620ab5
|
Jared Dillard
|
<td title="<?=gettext("traffic is passed")?>"><i class="fa fa-check text-success"></i></td>
|
400 |
2af731f8
|
NewEraCracker
|
<td><?php print_states(intval(ANTILOCKOUT_TRACKER)); ?></td>
|
401 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
402 |
|
|
<td>*</td>
|
403 |
|
|
<td>*</td>
|
404 |
|
|
<td><?=$iflist[$if];?> Address</td>
|
405 |
|
|
<td><?=$alports?></td>
|
406 |
|
|
<td>*</td>
|
407 |
|
|
<td>*</td>
|
408 |
|
|
<td></td>
|
409 |
b54ae90f
|
Jared Dillard
|
<td><?=gettext("Anti-Lockout Rule");?></td>
|
410 |
c821a6cd
|
Stephen Beaver
|
<td>
|
411 |
45e849c1
|
Jared Dillard
|
<a href="system_advanced_admin.php" title="<?=gettext("Settings");?>"><i class="fa fa-cog"></i></a>
|
412 |
c821a6cd
|
Stephen Beaver
|
</td>
|
413 |
|
|
</tr>
|
414 |
a2c5280d
|
Stephen Beaver
|
<?php endif;?>
|
415 |
|
|
<?php if ($showprivate): ?>
|
416 |
f72e8ee1
|
NOYB
|
<tr id="private">
|
417 |
6cb366de
|
Stephen Beaver
|
<td></td>
|
418 |
29620ab5
|
Jared Dillard
|
<td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times text-danger"></i></td>
|
419 |
2af731f8
|
NewEraCracker
|
<td><?php print_states(intval(RFC1918_TRACKER)); ?></td>
|
420 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
421 |
|
|
<td><?=gettext("RFC 1918 networks");?></td>
|
422 |
|
|
<td>*</td>
|
423 |
|
|
<td>*</td>
|
424 |
|
|
<td>*</td>
|
425 |
|
|
<td>*</td>
|
426 |
|
|
<td>*</td>
|
427 |
|
|
<td></td>
|
428 |
b54ae90f
|
Jared Dillard
|
<td><?=gettext("Block private networks");?></td>
|
429 |
c821a6cd
|
Stephen Beaver
|
<td>
|
430 |
45e849c1
|
Jared Dillard
|
<a href="interfaces.php?if=<?=htmlspecialchars($if)?>" title="<?=gettext("Settings");?>"><i class="fa fa-cog"></i></a>
|
431 |
c821a6cd
|
Stephen Beaver
|
</td>
|
432 |
|
|
</tr>
|
433 |
a2c5280d
|
Stephen Beaver
|
<?php endif;?>
|
434 |
|
|
<?php if ($showblockbogons): ?>
|
435 |
f72e8ee1
|
NOYB
|
<tr id="bogons">
|
436 |
0c61e497
|
Stephen Beaver
|
<td></td>
|
437 |
29620ab5
|
Jared Dillard
|
<td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times text-danger"></i></td>
|
438 |
2af731f8
|
NewEraCracker
|
<td><?php print_states(intval(BOGONS_TRACKER)); ?></td>
|
439 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
440 |
0c61e497
|
Stephen Beaver
|
<td><?=sprintf(gettext("Reserved%sNot assigned by IANA"), "<br />");?></td>
|
441 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
442 |
|
|
<td>*</td>
|
443 |
|
|
<td>*</td>
|
444 |
|
|
<td>*</td>
|
445 |
|
|
<td>*</td>
|
446 |
ea548271
|
Phil Davis
|
<td></td>
|
447 |
b54ae90f
|
Jared Dillard
|
<td><?=gettext("Block bogon networks");?></td>
|
448 |
c821a6cd
|
Stephen Beaver
|
<td>
|
449 |
45e849c1
|
Jared Dillard
|
<a href="interfaces.php?if=<?=htmlspecialchars($if)?>" title="<?=gettext("Settings");?>"><i class="fa fa-cog"></i></a>
|
450 |
c821a6cd
|
Stephen Beaver
|
</td>
|
451 |
|
|
</tr>
|
452 |
a2c5280d
|
Stephen Beaver
|
<?php endif;?>
|
453 |
c821a6cd
|
Stephen Beaver
|
</tbody>
|
454 |
a2c5280d
|
Stephen Beaver
|
<?php endif;?>
|
455 |
c821a6cd
|
Stephen Beaver
|
<tbody class="user-entries">
|
456 |
6cb366de
|
Stephen Beaver
|
<?php
|
457 |
|
|
$nrules = 0;
|
458 |
ccc62f13
|
NOYB
|
$separators = $config['filter']['separator'][strtolower($if)];
|
459 |
a361a19b
|
Stephen Beaver
|
|
460 |
36bf13fd
|
NOYB
|
// Get a list of separator rows and use it to call the display separator function only for rows which there are separator(s).
|
461 |
|
|
// More efficient than looping through the list of separators on every row.
|
462 |
|
|
$seprows = separator_rows($separators);
|
463 |
a361a19b
|
Stephen Beaver
|
|
464 |
227c1181
|
NOYB
|
foreach ($a_filter as $filteri => $filterent):
|
465 |
|
|
|
466 |
fdb83ce0
|
NOYB
|
if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
|
467 |
36bf13fd
|
NOYB
|
|
468 |
|
|
// Display separator(s) for section beginning at rule n
|
469 |
|
|
if ($seprows[$nrules]) {
|
470 |
|
|
display_separator($separators, $nrules, $columns_in_table);
|
471 |
|
|
}
|
472 |
56dda8e0
|
Renato Botelho
|
?>
|
473 |
f2066870
|
NOYB
|
<tr id="fr<?=$nrules;?>" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$filteri;?>';" <?=(isset($filterent['disabled']) ? ' class="disabled"' : '')?>>
|
474 |
a42399ac
|
Colin Fleming
|
<td>
|
475 |
f2066870
|
NOYB
|
<input type="checkbox" id="frc<?=$nrules;?>" onClick="fr_toggle(<?=$nrules;?>)" name="rule[]" value="<?=$filteri;?>"/>
|
476 |
6cb366de
|
Stephen Beaver
|
</td>
|
477 |
|
|
|
478 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
479 |
d08aeac1
|
Phil Davis
|
if ($filterent['type'] == "block") {
|
480 |
29620ab5
|
Jared Dillard
|
$iconfn = "times text-danger";
|
481 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is blocked");
|
482 |
|
|
} else if ($filterent['type'] == "reject") {
|
483 |
29620ab5
|
Jared Dillard
|
$iconfn = "hand-stop-o text-warning";
|
484 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is rejected");
|
485 |
|
|
} else if ($filterent['type'] == "match") {
|
486 |
3b2c83b8
|
Sjon Hortensius
|
$iconfn = "filter";
|
487 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is matched");
|
488 |
|
|
} else {
|
489 |
29620ab5
|
Jared Dillard
|
$iconfn = "check text-success";
|
490 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is passed");
|
491 |
|
|
}
|
492 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
493 |
d08aeac1
|
Phil Davis
|
<td title="<?=$title_text?>">
|
494 |
f2066870
|
NOYB
|
<a href="?if=<?=htmlspecialchars($if);?>&act=toggle&id=<?=$filteri;?>">
|
495 |
d4cb4cf3
|
Stephen Beaver
|
<i class="fa fa-<?=$iconfn?>" title="<?=gettext("click to toggle enabled/disabled status");?>"></i>
|
496 |
|
|
</a>
|
497 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
498 |
e2461a2f
|
Stephen Beaver
|
if ($filterent['quick'] == 'yes') {
|
499 |
b04d849d
|
Stephen Beaver
|
print '<i class="fa fa-forward text-success" title="'. gettext(""Quick" rule. Applied immediately on match.") .'" style="cursor: pointer;"></i>';
|
500 |
e2461a2f
|
Stephen Beaver
|
}
|
501 |
|
|
|
502 |
3b2c83b8
|
Sjon Hortensius
|
$isadvset = firewall_check_for_advanced_options($filterent);
|
503 |
67c2baf1
|
Phil Davis
|
if ($isadvset) {
|
504 |
7ea65674
|
Jared Dillard
|
print '<i class="fa fa-cog" title="'. gettext("advanced setting") .': '. $isadvset .'"></i>';
|
505 |
67c2baf1
|
Phil Davis
|
}
|
506 |
3b2c83b8
|
Sjon Hortensius
|
|
507 |
67c2baf1
|
Phil Davis
|
if (isset($filterent['log'])) {
|
508 |
e2461a2f
|
Stephen Beaver
|
print '<i class="fa fa-tasks" title="'. gettext("traffic is logged") .'" style="cursor: pointer;"></i>';
|
509 |
67c2baf1
|
Phil Davis
|
}
|
510 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
511 |
d08aeac1
|
Phil Davis
|
</td>
|
512 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
513 |
|
|
$alias = rule_columns_with_alias(
|
514 |
|
|
$filterent['source']['address'],
|
515 |
|
|
pprint_port($filterent['source']['port']),
|
516 |
|
|
$filterent['destination']['address'],
|
517 |
|
|
pprint_port($filterent['destination']['port'])
|
518 |
|
|
);
|
519 |
|
|
|
520 |
|
|
//build Schedule popup box
|
521 |
|
|
$a_schedules = &$config['schedules']['schedule'];
|
522 |
|
|
$schedule_span_begin = "";
|
523 |
|
|
$schedule_span_end = "";
|
524 |
|
|
$sched_caption_escaped = "";
|
525 |
|
|
$sched_content = "";
|
526 |
|
|
$schedstatus = false;
|
527 |
e6f34d22
|
Phil Davis
|
$dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
|
528 |
|
|
$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'));
|
529 |
ea5665c7
|
Sjon Hortensius
|
if ($config['schedules']['schedule'] != "" && is_array($config['schedules']['schedule'])) {
|
530 |
bdfea2e7
|
Stephen Beaver
|
$idx = 0;
|
531 |
67c2baf1
|
Phil Davis
|
foreach ($a_schedules as $schedule) {
|
532 |
e6f34d22
|
Phil Davis
|
if ($schedule['name'] == $filterent['sched']) {
|
533 |
3b2c83b8
|
Sjon Hortensius
|
$schedstatus = filter_get_time_based_rule_status($schedule);
|
534 |
|
|
|
535 |
e6f34d22
|
Phil Davis
|
foreach ($schedule['timerange'] as $timerange) {
|
536 |
3b2c83b8
|
Sjon Hortensius
|
$tempFriendlyTime = "";
|
537 |
|
|
$tempID = "";
|
538 |
|
|
$firstprint = false;
|
539 |
e6f34d22
|
Phil Davis
|
if ($timerange) {
|
540 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly = "";
|
541 |
|
|
$tempFriendlyTime = "";
|
542 |
|
|
|
543 |
|
|
//get hours
|
544 |
|
|
$temptimerange = $timerange['hour'];
|
545 |
|
|
$temptimeseparator = strrpos($temptimerange, "-");
|
546 |
|
|
|
547 |
|
|
$starttime = substr ($temptimerange, 0, $temptimeseparator);
|
548 |
|
|
$stoptime = substr ($temptimerange, $temptimeseparator+1);
|
549 |
|
|
|
550 |
e6f34d22
|
Phil Davis
|
if ($timerange['month']) {
|
551 |
3b2c83b8
|
Sjon Hortensius
|
$tempmontharray = explode(",", $timerange['month']);
|
552 |
e6f34d22
|
Phil Davis
|
$tempdayarray = explode(",", $timerange['day']);
|
553 |
3b2c83b8
|
Sjon Hortensius
|
$arraycounter = 0;
|
554 |
|
|
$firstDayFound = false;
|
555 |
|
|
$firstPrint = false;
|
556 |
e6f34d22
|
Phil Davis
|
foreach ($tempmontharray as $monthtmp) {
|
557 |
3b2c83b8
|
Sjon Hortensius
|
$month = $tempmontharray[$arraycounter];
|
558 |
|
|
$day = $tempdayarray[$arraycounter];
|
559 |
|
|
|
560 |
67c2baf1
|
Phil Davis
|
if (!$firstDayFound) {
|
561 |
3b2c83b8
|
Sjon Hortensius
|
$firstDay = $day;
|
562 |
|
|
$firstmonth = $month;
|
563 |
|
|
$firstDayFound = true;
|
564 |
|
|
}
|
565 |
|
|
|
566 |
|
|
$currentDay = $day;
|
567 |
|
|
$nextDay = $tempdayarray[$arraycounter+1];
|
568 |
|
|
$currentDay++;
|
569 |
e6f34d22
|
Phil Davis
|
if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
|
570 |
67c2baf1
|
Phil Davis
|
if ($firstPrint) {
|
571 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= ", ";
|
572 |
67c2baf1
|
Phil Davis
|
}
|
573 |
3b2c83b8
|
Sjon Hortensius
|
$currentDay--;
|
574 |
67c2baf1
|
Phil Davis
|
if ($currentDay != $firstDay) {
|
575 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
|
576 |
67c2baf1
|
Phil Davis
|
} else {
|
577 |
c821a6cd
|
Stephen Beaver
|
$dayFriendly .= $monthArray[$month-1] . " " . $day;
|
578 |
67c2baf1
|
Phil Davis
|
}
|
579 |
8ce97a08
|
Scott Dale
|
$firstDayFound = false;
|
580 |
3b2c83b8
|
Sjon Hortensius
|
$firstPrint = true;
|
581 |
|
|
}
|
582 |
|
|
$arraycounter++;
|
583 |
|
|
}
|
584 |
67c2baf1
|
Phil Davis
|
} else {
|
585 |
3b2c83b8
|
Sjon Hortensius
|
$tempdayFriendly = $timerange['position'];
|
586 |
|
|
$firstDayFound = false;
|
587 |
|
|
$tempFriendlyDayArray = explode(",", $tempdayFriendly);
|
588 |
|
|
$currentDay = "";
|
589 |
|
|
$firstDay = "";
|
590 |
|
|
$nextDay = "";
|
591 |
|
|
$counter = 0;
|
592 |
e6f34d22
|
Phil Davis
|
foreach ($tempFriendlyDayArray as $day) {
|
593 |
|
|
if ($day != "") {
|
594 |
67c2baf1
|
Phil Davis
|
if (!$firstDayFound) {
|
595 |
3b2c83b8
|
Sjon Hortensius
|
$firstDay = $tempFriendlyDayArray[$counter];
|
596 |
|
|
$firstDayFound = true;
|
597 |
8ce97a08
|
Scott Dale
|
}
|
598 |
3b2c83b8
|
Sjon Hortensius
|
$currentDay =$tempFriendlyDayArray[$counter];
|
599 |
|
|
//get next day
|
600 |
|
|
$nextDay = $tempFriendlyDayArray[$counter+1];
|
601 |
|
|
$currentDay++;
|
602 |
e6f34d22
|
Phil Davis
|
if ($currentDay != $nextDay) {
|
603 |
67c2baf1
|
Phil Davis
|
if ($firstprint) {
|
604 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= ", ";
|
605 |
67c2baf1
|
Phil Davis
|
}
|
606 |
3b2c83b8
|
Sjon Hortensius
|
$currentDay--;
|
607 |
67c2baf1
|
Phil Davis
|
if ($currentDay != $firstDay) {
|
608 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
|
609 |
67c2baf1
|
Phil Davis
|
} else {
|
610 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= $dayArray[$firstDay-1];
|
611 |
67c2baf1
|
Phil Davis
|
}
|
612 |
3b2c83b8
|
Sjon Hortensius
|
$firstDayFound = false;
|
613 |
|
|
$firstprint = true;
|
614 |
|
|
}
|
615 |
|
|
$counter++;
|
616 |
56dda8e0
|
Renato Botelho
|
}
|
617 |
8ce97a08
|
Scott Dale
|
}
|
618 |
2a113ca9
|
Scott Dale
|
}
|
619 |
3b2c83b8
|
Sjon Hortensius
|
$timeFriendly = $starttime . " - " . $stoptime;
|
620 |
|
|
$description = $timerange['rangedescr'];
|
621 |
|
|
$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br />";
|
622 |
56dda8e0
|
Renato Botelho
|
}
|
623 |
|
|
}
|
624 |
ea5665c7
|
Sjon Hortensius
|
#FIXME
|
625 |
3b2c83b8
|
Sjon Hortensius
|
$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
|
626 |
bdfea2e7
|
Stephen Beaver
|
$schedule_span_begin = '<a href="/firewall_schedule_edit.php?id=' . $idx . '" data-toggle="popover" data-trigger="hover focus" title="' . $schedule['name'] . '" data-content="' .
|
627 |
c64c9278
|
Stephen Beaver
|
$sched_caption_escaped . '" data-html="true">';
|
628 |
a42399ac
|
Colin Fleming
|
$schedule_span_end = "</a>";
|
629 |
616dd997
|
Scott Dale
|
}
|
630 |
92da593a
|
Chris Buechler
|
$idx++;
|
631 |
3b2c83b8
|
Sjon Hortensius
|
}
|
632 |
|
|
}
|
633 |
|
|
$printicon = false;
|
634 |
|
|
$alttext = "";
|
635 |
|
|
$image = "";
|
636 |
|
|
if (!isset($filterent['disabled'])) {
|
637 |
|
|
if ($schedstatus) {
|
638 |
5db29ca7
|
Phil Davis
|
if ($filterent['type'] == "block" || $filterent['type'] == "reject") {
|
639 |
7ea65674
|
Jared Dillard
|
$image = "times-circle";
|
640 |
bdfea2e7
|
Stephen Beaver
|
$dispcolor = "text-danger";
|
641 |
3b2c83b8
|
Sjon Hortensius
|
$alttext = gettext("Traffic matching this rule is currently being denied");
|
642 |
56dda8e0
|
Renato Botelho
|
} else {
|
643 |
7ea65674
|
Jared Dillard
|
$image = "play-circle";
|
644 |
bdfea2e7
|
Stephen Beaver
|
$dispcolor = "text-success";
|
645 |
3b2c83b8
|
Sjon Hortensius
|
$alttext = gettext("Traffic matching this rule is currently being allowed");
|
646 |
be81b340
|
Erik Fonnesbeck
|
}
|
647 |
3b2c83b8
|
Sjon Hortensius
|
$printicon = true;
|
648 |
|
|
} else if ($filterent['sched']) {
|
649 |
5db29ca7
|
Phil Davis
|
if ($filterent['type'] == "block" || $filterent['type'] == "reject") {
|
650 |
7ea65674
|
Jared Dillard
|
$image = "times-circle";
|
651 |
67c2baf1
|
Phil Davis
|
} else {
|
652 |
5db29ca7
|
Phil Davis
|
$image = "play-circle";
|
653 |
67c2baf1
|
Phil Davis
|
}
|
654 |
3b2c83b8
|
Sjon Hortensius
|
$alttext = gettext("This rule is not currently active because its period has expired");
|
655 |
5db29ca7
|
Phil Davis
|
$dispcolor = "text-warning";
|
656 |
3b2c83b8
|
Sjon Hortensius
|
$printicon = true;
|
657 |
|
|
}
|
658 |
|
|
}
|
659 |
|
|
?>
|
660 |
2af731f8
|
NewEraCracker
|
<td><?php print_states(intval($filterent['tracker'])); ?></td>
|
661 |
ea5665c7
|
Sjon Hortensius
|
<td>
|
662 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
663 |
|
|
if (isset($filterent['ipprotocol'])) {
|
664 |
e6f34d22
|
Phil Davis
|
switch ($filterent['ipprotocol']) {
|
665 |
3b2c83b8
|
Sjon Hortensius
|
case "inet":
|
666 |
|
|
echo "IPv4 ";
|
667 |
|
|
break;
|
668 |
|
|
case "inet6":
|
669 |
|
|
echo "IPv6 ";
|
670 |
|
|
break;
|
671 |
|
|
case "inet46":
|
672 |
|
|
echo "IPv4+6 ";
|
673 |
|
|
break;
|
674 |
|
|
}
|
675 |
|
|
} else {
|
676 |
|
|
echo "IPv4 ";
|
677 |
|
|
}
|
678 |
|
|
|
679 |
|
|
if (isset($filterent['protocol'])) {
|
680 |
|
|
echo strtoupper($filterent['protocol']);
|
681 |
|
|
|
682 |
|
|
if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
|
683 |
d62e733b
|
Phil Davis
|
echo ' <span style="cursor: help;" title="' . gettext('ICMP type') . ': ' .
|
684 |
e6f34d22
|
Phil Davis
|
($filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']]) .
|
685 |
3b2c83b8
|
Sjon Hortensius
|
'"><u>';
|
686 |
|
|
echo $filterent['icmptype'];
|
687 |
|
|
echo '</u></span>';
|
688 |
|
|
}
|
689 |
|
|
} else echo "*";
|
690 |
e83aaa50
|
Stephen Beaver
|
|
691 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
692 |
c821a6cd
|
Stephen Beaver
|
</td>
|
693 |
|
|
<td>
|
694 |
|
|
<?php if (isset($alias['src'])): ?>
|
695 |
d62e733b
|
Phil Davis
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['src']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['src'])?>" data-html="true">
|
696 |
ece727a7
|
NOYB
|
<?=str_replace('_', ' ', htmlspecialchars(pprint_address($filterent['source'])))?>
|
697 |
a42399ac
|
Colin Fleming
|
</a>
|
698 |
|
|
<?php else: ?>
|
699 |
|
|
<?=htmlspecialchars(pprint_address($filterent['source']))?>
|
700 |
c821a6cd
|
Stephen Beaver
|
<?php endif; ?>
|
701 |
|
|
</td>
|
702 |
|
|
<td>
|
703 |
|
|
<?php if (isset($alias['srcport'])): ?>
|
704 |
d62e733b
|
Phil Davis
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['srcport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['srcport'])?>" data-html="true">
|
705 |
ece727a7
|
NOYB
|
<?=str_replace('_', ' ', htmlspecialchars(pprint_port($filterent['source']['port'])))?>
|
706 |
a42399ac
|
Colin Fleming
|
</a>
|
707 |
|
|
<?php else: ?>
|
708 |
|
|
<?=htmlspecialchars(pprint_port($filterent['source']['port']))?>
|
709 |
c821a6cd
|
Stephen Beaver
|
<?php endif; ?>
|
710 |
|
|
</td>
|
711 |
|
|
<td>
|
712 |
|
|
<?php if (isset($alias['dst'])): ?>
|
713 |
d62e733b
|
Phil Davis
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['dst']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['dst'])?>" data-html="true">
|
714 |
ece727a7
|
NOYB
|
<?=str_replace('_', ' ', htmlspecialchars(pprint_address($filterent['destination'])))?>
|
715 |
a42399ac
|
Colin Fleming
|
</a>
|
716 |
2af731f8
|
NewEraCracker
|
<?php else: ?>
|
717 |
a42399ac
|
Colin Fleming
|
<?=htmlspecialchars(pprint_address($filterent['destination']))?>
|
718 |
c821a6cd
|
Stephen Beaver
|
<?php endif; ?>
|
719 |
|
|
</td>
|
720 |
|
|
<td>
|
721 |
|
|
<?php if (isset($alias['dstport'])): ?>
|
722 |
d62e733b
|
Phil Davis
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true">
|
723 |
ece727a7
|
NOYB
|
<?=str_replace('_', ' ', htmlspecialchars(pprint_port($filterent['destination']['port'])))?>
|
724 |
a42399ac
|
Colin Fleming
|
</a>
|
725 |
|
|
<?php else: ?>
|
726 |
|
|
<?=htmlspecialchars(pprint_port($filterent['destination']['port']))?>
|
727 |
c821a6cd
|
Stephen Beaver
|
<?php endif; ?>
|
728 |
|
|
</td>
|
729 |
|
|
<td>
|
730 |
|
|
<?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])):?>
|
731 |
ece727a7
|
NOYB
|
<?=str_replace('_', ' ', htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']))?>
|
732 |
c821a6cd
|
Stephen Beaver
|
<?php else: ?>
|
733 |
|
|
<?=htmlspecialchars(pprint_port($filterent['gateway']))?>
|
734 |
|
|
<?php endif; ?>
|
735 |
|
|
</td>
|
736 |
|
|
<td>
|
737 |
|
|
<?php
|
738 |
|
|
if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
|
739 |
ece727a7
|
NOYB
|
$desc = str_replace('_', ' ', $filterent['ackqueue']);
|
740 |
c821a6cd
|
Stephen Beaver
|
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>";
|
741 |
ece727a7
|
NOYB
|
$desc = str_replace('_', ' ', $filterent['defaultqueue']);
|
742 |
c821a6cd
|
Stephen Beaver
|
echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
|
743 |
|
|
} else if (isset($filterent['defaultqueue'])) {
|
744 |
ece727a7
|
NOYB
|
$desc = str_replace('_', ' ', $filterent['defaultqueue']);
|
745 |
c821a6cd
|
Stephen Beaver
|
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
|
746 |
67c2baf1
|
Phil Davis
|
} else {
|
747 |
c821a6cd
|
Stephen Beaver
|
echo gettext("none");
|
748 |
67c2baf1
|
Phil Davis
|
}
|
749 |
c821a6cd
|
Stephen Beaver
|
?>
|
750 |
|
|
</td>
|
751 |
|
|
<td>
|
752 |
995df6c3
|
Stephen Beaver
|
<?php if ($printicon) { ?>
|
753 |
a42399ac
|
Colin Fleming
|
<i class="fa fa-<?=$image?> <?=$dispcolor?>" title="<?=$alttext;?>"></i>
|
754 |
995df6c3
|
Stephen Beaver
|
<?php } ?>
|
755 |
ece727a7
|
NOYB
|
<?=$schedule_span_begin;?><?=str_replace('_', ' ', htmlspecialchars($filterent['sched']));?> <?=$schedule_span_end;?>
|
756 |
c821a6cd
|
Stephen Beaver
|
</td>
|
757 |
b54ae90f
|
Jared Dillard
|
<td>
|
758 |
c821a6cd
|
Stephen Beaver
|
<?=htmlspecialchars($filterent['descr']);?>
|
759 |
|
|
</td>
|
760 |
45e849c1
|
Jared Dillard
|
<td class="action-icons">
|
761 |
f25dac2d
|
Stephen Beaver
|
<!-- <?=(isset($filterent['disabled']) ? 'enable' : 'disable')?> -->
|
762 |
d830a7f4
|
Stephen Beaver
|
<a class="fa fa-anchor icon-pointer" id="Xmove_<?=$filteri?>" title="<?=$XmoveTitle?>"></a>
|
763 |
f2066870
|
NOYB
|
<a href="firewall_rules_edit.php?id=<?=$filteri;?>" class="fa fa-pencil" title="<?=gettext('Edit')?>"></a>
|
764 |
|
|
<a href="firewall_rules_edit.php?dup=<?=$filteri;?>" class="fa fa-clone" title="<?=gettext('Copy')?>"></a>
|
765 |
f25dac2d
|
Stephen Beaver
|
<?php if (isset($filterent['disabled'])) {
|
766 |
|
|
?>
|
767 |
f2066870
|
NOYB
|
<a href="?act=toggle&if=<?=htmlspecialchars($if);?>&id=<?=$filteri;?>" class="fa fa-check-square-o" title="<?=gettext('Enable')?>"></a>
|
768 |
f25dac2d
|
Stephen Beaver
|
<?php } else {
|
769 |
|
|
?>
|
770 |
f2066870
|
NOYB
|
<a href="?act=toggle&if=<?=htmlspecialchars($if);?>&id=<?=$filteri;?>" class="fa fa-ban" title="<?=gettext('Disable')?>"></a>
|
771 |
f25dac2d
|
Stephen Beaver
|
<?php }
|
772 |
|
|
?>
|
773 |
f2066870
|
NOYB
|
<a href="?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$filteri;?>" class="fa fa-trash" title="<?=gettext('Delete this rule')?>"></a>
|
774 |
c821a6cd
|
Stephen Beaver
|
</td>
|
775 |
|
|
</tr>
|
776 |
|
|
<?php
|
777 |
6cb366de
|
Stephen Beaver
|
$nrules++;
|
778 |
fdb83ce0
|
NOYB
|
}
|
779 |
227c1181
|
NOYB
|
endforeach;
|
780 |
36bf13fd
|
NOYB
|
|
781 |
|
|
// There can be separator(s) after the last rule listed.
|
782 |
|
|
if ($seprows[$nrules]) {
|
783 |
|
|
display_separator($separators, $nrules, $columns_in_table);
|
784 |
|
|
}
|
785 |
c821a6cd
|
Stephen Beaver
|
?>
|
786 |
|
|
</tbody>
|
787 |
|
|
</table>
|
788 |
|
|
</div>
|
789 |
|
|
</div>
|
790 |
3b2c83b8
|
Sjon Hortensius
|
|
791 |
|
|
<?php if ($nrules == 0): ?>
|
792 |
|
|
<div class="alert alert-warning" role="alert">
|
793 |
06966500
|
Sander van Leeuwen
|
<p>
|
794 |
3b2c83b8
|
Sjon Hortensius
|
<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
|
795 |
|
|
<?=gettext("No floating rules are currently defined.");?>
|
796 |
|
|
<?php else: ?>
|
797 |
|
|
<?=gettext("No rules are currently defined for this interface");?><br />
|
798 |
317b2852
|
NOYB
|
<?=gettext("All incoming connections on this interface will be blocked until pass rules are added.");?>
|
799 |
3b2c83b8
|
Sjon Hortensius
|
<?php endif;?>
|
800 |
06966500
|
Sander van Leeuwen
|
<?=gettext("Click the button to add a new rule.");?>
|
801 |
|
|
</p>
|
802 |
3b2c83b8
|
Sjon Hortensius
|
</div>
|
803 |
|
|
<?php endif;?>
|
804 |
|
|
|
805 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
806 |
270de3df
|
Stephen Beaver
|
<a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&after=-1" role="button" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the top of the list')?>">
|
807 |
|
|
<i class="fa fa-level-up icon-embed-btn"></i>
|
808 |
09415b9e
|
Stephen Beaver
|
<?=gettext("Add");?>
|
809 |
c821a6cd
|
Stephen Beaver
|
</a>
|
810 |
270de3df
|
Stephen Beaver
|
<a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>" role="button" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the end of the list')?>">
|
811 |
|
|
<i class="fa fa-level-down icon-embed-btn"></i>
|
812 |
|
|
<?=gettext("Add");?>
|
813 |
|
|
</a>
|
814 |
|
|
<button name="del_x" type="submit" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected rules"); ?>" title="<?=gettext('Delete selected rules')?>">
|
815 |
9d5a20cf
|
heper
|
<i class="fa fa-trash icon-embed-btn"></i>
|
816 |
09415b9e
|
Stephen Beaver
|
<?=gettext("Delete"); ?>
|
817 |
|
|
</button>
|
818 |
c4b60a9a
|
Colin Fleming
|
<button type="submit" id="order-store" name="order-store" class="btn btn-sm btn-primary" value="store changes" disabled title="<?=gettext('Save rule order')?>">
|
819 |
9d5a20cf
|
heper
|
<i class="fa fa-save icon-embed-btn"></i>
|
820 |
09415b9e
|
Stephen Beaver
|
<?=gettext("Save")?>
|
821 |
|
|
</button>
|
822 |
576437f5
|
Stephen Beaver
|
<button type="submit" id="addsep" name="addsep" class="btn btn-sm btn-warning" title="<?=gettext('Add separator')?>">
|
823 |
|
|
<i class="fa fa-plus icon-embed-btn"></i>
|
824 |
|
|
<?=gettext("Separator")?>
|
825 |
|
|
</button>
|
826 |
c821a6cd
|
Stephen Beaver
|
</nav>
|
827 |
|
|
</form>
|
828 |
|
|
|
829 |
35681930
|
Stephen Beaver
|
<div class="infoblock">
|
830 |
c97a3f34
|
Phil Davis
|
<div class="alert alert-info clearfix" role="alert"><div class="pull-left">
|
831 |
270de3df
|
Stephen Beaver
|
<dl class="dl-horizontal responsive">
|
832 |
|
|
<!-- Legend -->
|
833 |
|
|
<dt><?=gettext('Legend')?></dt> <dd></dd>
|
834 |
29620ab5
|
Jared Dillard
|
<dt><i class="fa fa-check text-success"></i></dt> <dd><?=gettext("Pass");?></dd>
|
835 |
1b7379f9
|
Jared Dillard
|
<dt><i class="fa fa-filter"></i></dt> <dd><?=gettext("Match");?></dd>
|
836 |
29620ab5
|
Jared Dillard
|
<dt><i class="fa fa-times text-danger"></i></dt> <dd><?=gettext("Block");?></dd>
|
837 |
|
|
<dt><i class="fa fa-hand-stop-o text-warning"></i></dt> <dd><?=gettext("Reject");?></dd>
|
838 |
1b7379f9
|
Jared Dillard
|
<dt><i class="fa fa-tasks"></i></dt> <dd> <?=gettext("Log");?></dd>
|
839 |
7ea65674
|
Jared Dillard
|
<dt><i class="fa fa-cog"></i></dt> <dd> <?=gettext("Advanced filter");?></dd>
|
840 |
cafd2aa0
|
Stephen Beaver
|
<dt><i class="fa fa-forward text-success"></i></dt><dd> <?=gettext(""Quick" rule. Applied immediately on match.")?></dd>
|
841 |
270de3df
|
Stephen Beaver
|
</dl>
|
842 |
|
|
|
843 |
824329d2
|
Stephen Beaver
|
<?php
|
844 |
67c2baf1
|
Phil Davis
|
if ("FloatingRules" != $if) {
|
845 |
270de3df
|
Stephen Beaver
|
print(gettext("Rules are evaluated on a first-match basis (i.e. " .
|
846 |
09415b9e
|
Stephen Beaver
|
"the action of the first rule to match a packet will be executed). ") . '<br />' .
|
847 |
9e97598a
|
NOYB
|
gettext("This means that if block rules are used, it is important to pay attention " .
|
848 |
09415b9e
|
Stephen Beaver
|
"to the rule order. Everything that isn't explicitly passed is blocked " .
|
849 |
270de3df
|
Stephen Beaver
|
"by default. "));
|
850 |
67c2baf1
|
Phil Davis
|
} else {
|
851 |
270de3df
|
Stephen Beaver
|
print(gettext("Floating rules are evaluated on a first-match basis (i.e. " .
|
852 |
09415b9e
|
Stephen Beaver
|
"the action of the first rule to match a packet will be executed) only " .
|
853 |
04fd7017
|
Stephen Beaver
|
"if the 'quick' option is checked on a rule. Otherwise they will only match if no " .
|
854 |
09415b9e
|
Stephen Beaver
|
"other rules match. Pay close attention to the rule order and options " .
|
855 |
270de3df
|
Stephen Beaver
|
"chosen. If no rule here matches, the per-interface or default rules are used. "));
|
856 |
67c2baf1
|
Phil Davis
|
}
|
857 |
d830a7f4
|
Stephen Beaver
|
|
858 |
|
|
printf(gettext("%sClick the anchor icon %s to move checked rules before the clicked row. Hold down " .
|
859 |
1fd8a552
|
NOYB
|
"the shift key and click to move the rules after the clicked row."), '<br /><br />', '<i class="fa fa-anchor"></i>')
|
860 |
824329d2
|
Stephen Beaver
|
?>
|
861 |
270de3df
|
Stephen Beaver
|
</div>
|
862 |
ab6b1f47
|
NOYB
|
</div>
|
863 |
09415b9e
|
Stephen Beaver
|
</div>
|
864 |
2f4323b5
|
Stephen Beaver
|
|
865 |
8fd9052f
|
Colin Fleming
|
<script type="text/javascript">
|
866 |
|
|
//<![CDATA[
|
867 |
7d8552fc
|
Stephen Beaver
|
|
868 |
2af731f8
|
NewEraCracker
|
//Need to create some variables here so that jquery/pfSenseHelpers.js can read them
|
869 |
7d8552fc
|
Stephen Beaver
|
iface = "<?=strtolower($if)?>";
|
870 |
|
|
cncltxt = '<?=gettext("Cancel")?>';
|
871 |
|
|
svtxt = '<?=gettext("Save")?>';
|
872 |
|
|
svbtnplaceholder = '<?=gettext("Enter a description, Save, then drag to final location.")?>';
|
873 |
|
|
configsection = "filter";
|
874 |
|
|
|
875 |
ea5665c7
|
Sjon Hortensius
|
events.push(function() {
|
876 |
2f4323b5
|
Stephen Beaver
|
|
877 |
3f597adb
|
Stephen Beaver
|
// "Move to here" (anchor) action
|
878 |
|
|
$('[id^=Xmove_]').click(function (event) {
|
879 |
|
|
|
880 |
f1d5b8ef
|
Phil Davis
|
// Prevent click from toggling row
|
881 |
3f597adb
|
Stephen Beaver
|
event.stopImmediatePropagation();
|
882 |
|
|
|
883 |
f1d5b8ef
|
Phil Davis
|
// Save the target rule position
|
884 |
3f597adb
|
Stephen Beaver
|
var anchor_row = $(this).parents("tr:first");
|
885 |
|
|
|
886 |
d830a7f4
|
Stephen Beaver
|
if (event.shiftKey) {
|
887 |
|
|
$($('#ruletable > tbody > tr').get().reverse()).each(function() {
|
888 |
|
|
ruleid = this.id.slice(2);
|
889 |
3f597adb
|
Stephen Beaver
|
|
890 |
d830a7f4
|
Stephen Beaver
|
if (ruleid && !isNaN(ruleid)) {
|
891 |
|
|
if ($('#frc' + ruleid).prop('checked')) {
|
892 |
|
|
// Move the selected rows, un-select them and add highlight class
|
893 |
|
|
$(this).insertAfter(anchor_row);
|
894 |
|
|
fr_toggle(ruleid, "fr");
|
895 |
|
|
$('#fr' + ruleid).addClass("highlight");
|
896 |
|
|
}
|
897 |
3f597adb
|
Stephen Beaver
|
}
|
898 |
d830a7f4
|
Stephen Beaver
|
});
|
899 |
|
|
} else {
|
900 |
|
|
$('#ruletable > tbody > tr').each(function() {
|
901 |
|
|
ruleid = this.id.slice(2);
|
902 |
|
|
|
903 |
|
|
if (ruleid && !isNaN(ruleid)) {
|
904 |
|
|
if ($('#frc' + ruleid).prop('checked')) {
|
905 |
|
|
// Move the selected rows, un-select them and add highlight class
|
906 |
|
|
$(this).insertBefore(anchor_row);
|
907 |
|
|
fr_toggle(ruleid, "fr");
|
908 |
|
|
$('#fr' + ruleid).addClass("highlight");
|
909 |
|
|
}
|
910 |
|
|
}
|
911 |
|
|
});
|
912 |
|
|
}
|
913 |
3f597adb
|
Stephen Beaver
|
|
914 |
f1d5b8ef
|
Phil Davis
|
// Temporarily set background color so user can more easily see the moved rules, then fade
|
915 |
4dbdb358
|
Stephen Beaver
|
$('.highlight').effect("highlight", {color: "#739b4b;"}, 4000);
|
916 |
|
|
$('#ruletable tr').removeClass("highlight");
|
917 |
3f597adb
|
Stephen Beaver
|
$('#order-store').removeAttr('disabled');
|
918 |
|
|
reindex_rules($(anchor_row).parent('tbody'));
|
919 |
|
|
dirty = true;
|
920 |
a7893b72
|
Stephen Beaver
|
}).mouseover(function(e) {
|
921 |
c6a8ddf8
|
Stephen Beaver
|
var ruleselected = false;
|
922 |
|
|
|
923 |
995454f3
|
Stephen Beaver
|
$(this).css("cursor", "default");
|
924 |
|
|
|
925 |
c6a8ddf8
|
Stephen Beaver
|
// Are any rules currently selected?
|
926 |
|
|
$('[id^=frc]').each(function () {
|
927 |
|
|
if ($(this).prop("checked")) {
|
928 |
|
|
ruleselected = true;
|
929 |
|
|
}
|
930 |
|
|
});
|
931 |
|
|
|
932 |
|
|
// If so, change the icon to show the insetion point
|
933 |
|
|
if (ruleselected) {
|
934 |
|
|
if (e.shiftKey) {
|
935 |
|
|
$(this).removeClass().addClass("fa fa-lg fa-arrow-down text-danger");
|
936 |
|
|
} else {
|
937 |
|
|
$(this).removeClass().addClass("fa fa-lg fa-arrow-up text-danger");
|
938 |
|
|
}
|
939 |
a7893b72
|
Stephen Beaver
|
}
|
940 |
|
|
}).mouseout(function(e) {
|
941 |
995454f3
|
Stephen Beaver
|
$(this).removeClass().addClass("fa fa-anchor");
|
942 |
3f597adb
|
Stephen Beaver
|
});
|
943 |
|
|
|
944 |
85d49326
|
Stephen Beaver
|
// Make rules sortable. Hiding the table before applying sortable, then showing it again is
|
945 |
511053ad
|
Stephen Beaver
|
// a work-around for very slow sorting on FireFox
|
946 |
|
|
$('table tbody.user-entries').hide();
|
947 |
|
|
|
948 |
ea5665c7
|
Sjon Hortensius
|
$('table tbody.user-entries').sortable({
|
949 |
|
|
cursor: 'grabbing',
|
950 |
|
|
update: function(event, ui) {
|
951 |
|
|
$('#order-store').removeAttr('disabled');
|
952 |
1f73ccba
|
Stephen Beaver
|
reindex_rules(ui.item.parent('tbody'));
|
953 |
5d7b915d
|
Stephen Beaver
|
dirty = true;
|
954 |
ea5665c7
|
Sjon Hortensius
|
}
|
955 |
|
|
});
|
956 |
|
|
|
957 |
511053ad
|
Stephen Beaver
|
$('table tbody.user-entries').show();
|
958 |
|
|
|
959 |
6cb366de
|
Stephen Beaver
|
// Check all of the rule checkboxes so that their values are posted
|
960 |
|
|
$('#order-store').click(function () {
|
961 |
301e4aa0
|
Stephen Beaver
|
$('[id^=frc]').prop('checked', true);
|
962 |
|
|
|
963 |
|
|
// Save the separator bar configuration
|
964 |
|
|
save_separators();
|
965 |
5d7b915d
|
Stephen Beaver
|
|
966 |
|
|
// Suppress the "Do you really want to leave the page" message
|
967 |
|
|
saving = true;
|
968 |
6cb366de
|
Stephen Beaver
|
});
|
969 |
576437f5
|
Stephen Beaver
|
|
970 |
f1d5b8ef
|
Phil Davis
|
// Provide a warning message if the user tries to change page before saving
|
971 |
5d7b915d
|
Stephen Beaver
|
$(window).bind('beforeunload', function(){
|
972 |
|
|
if ((!saving && dirty) || newSeperator) {
|
973 |
317b2852
|
NOYB
|
return ("<?=gettext('One or more rules have been moved but have not yet been saved')?>");
|
974 |
5d7b915d
|
Stephen Beaver
|
} else {
|
975 |
|
|
return undefined;
|
976 |
|
|
}
|
977 |
|
|
});
|
978 |
d830a7f4
|
Stephen Beaver
|
|
979 |
|
|
$(document).on('keyup keydown', function(e){
|
980 |
|
|
if (e.shiftKey) {
|
981 |
|
|
$('[id^=Xmove_]').attr("title", "<?=$ShXmoveTitle?>");
|
982 |
|
|
} else {
|
983 |
|
|
$('[id^=Xmove_]').attr("title", "<?=$XmoveTitle?>");
|
984 |
|
|
}
|
985 |
|
|
});
|
986 |
65a0e193
|
Stephen Beaver
|
});
|
987 |
8fd9052f
|
Colin Fleming
|
//]]>
|
988 |
ea5665c7
|
Sjon Hortensius
|
</script>
|
989 |
824329d2
|
Stephen Beaver
|
|
990 |
c9d46a8e
|
Renato Botelho
|
<?php include("foot.inc");?>
|