Revision 9970b06f
src/usr/local/pfSense/include/www/alias-utils.inc | ||
---|---|---|
56 | 56 |
function deleteAlias($id, $apply = false) { |
57 | 57 |
/* make sure rule is not being referenced by any nat or filter rules */ |
58 | 58 |
$delete_error = ""; |
59 |
if (!is_numericint($id)) { |
|
60 |
return $delete_error; |
|
61 |
} |
|
59 | 62 |
$is_alias_referenced = false; |
60 | 63 |
$referenced_by = array(); |
61 |
$alias_name = config_get_path('aliases/alias/' . $id . '/name');
|
|
64 |
$alias = config_get_path("aliases/alias/{$id}");
|
|
62 | 65 |
$section_fields = [ |
63 | 66 |
// Firewall rules |
64 | 67 |
'filter/rule' => [ |
... | ... | |
120 | 123 |
|
121 | 124 |
foreach ($section_fields as $section => $fields) { |
122 | 125 |
foreach ($fields as $field) { |
123 |
find_alias_reference_by_path($section, $field, $alias_name, $is_alias_referenced, $referenced_by);
|
|
126 |
find_alias_reference_by_path($section, $field, $alias['name'], $is_alias_referenced, $referenced_by);
|
|
124 | 127 |
} |
125 | 128 |
} |
126 | 129 |
|
127 | 130 |
if ($is_alias_referenced == true) { |
128 | 131 |
$delete_error = sprintf(gettext("Cannot delete alias. Currently in use by %s."), htmlspecialchars(implode(", ", $referenced_by))); |
129 | 132 |
} else { |
130 |
if (preg_match("/urltable/i", config_get_path('aliases/alias/' . $id . '/type'))) {
|
|
133 |
if (preg_match("/urltable/i", $alias['type'])) {
|
|
131 | 134 |
// this is a URL table type alias, delete its file as well |
132 |
unlink_if_exists("/var/db/aliastables/" . config_get_path('aliases/alias/' . $id . '/name') . ".txt");
|
|
135 |
unlink_if_exists("/var/db/aliastables/{$alias['name']}.txt");
|
|
133 | 136 |
} |
134 | 137 |
config_del_path('aliases/alias/' . $id); |
135 |
if (write_config(gettext("Deleted firewall alias " . config_get_path('aliases/alias/' . $id . '/name')))) {
|
|
138 |
if (write_config(gettext("Deleted firewall alias " . $alias['name']))) {
|
|
136 | 139 |
if (!$apply) { |
137 | 140 |
mark_subsystem_dirty('aliases'); |
138 | 141 |
} else { |
src/usr/local/www/firewall_nat.php | ||
---|---|---|
54 | 54 |
} else if ($_POST['apply'] && have_natpfruleint_access($natent['interface'])) { |
55 | 55 |
$retval = applyNATrules(); |
56 | 56 |
} else if (($_POST['act'] == "del" || isset($_POST['del_x'])) && have_natpfruleint_access($natent['interface'])) { |
57 |
if (config_get_path("nat/rule/{$_POST['id']}") || (is_array($_POST['rule']) && count($_POST['rule']))) {
|
|
57 |
if ((is_numericint($_POST['id']) && config_get_path("nat/rule/{$_POST['id']}")) || (is_array($_POST['rule']) && count($_POST['rule']))) {
|
|
58 | 58 |
deleteNATrule($_POST); |
59 | 59 |
} |
60 | 60 |
} elseif (($_POST['act'] == "toggle" || isset($_POST['toggle_x'])) && have_natpfruleint_access($natent['interface'])) { |
61 |
if (config_get_path("nat/rule/{$_POST['id']}") || (is_array($_POST['rule']) && count($_POST['rule']))) {
|
|
61 |
if ((is_numericint($_POST['id']) && config_get_path("nat/rule/{$_POST['id']}")) || (is_array($_POST['rule']) && count($_POST['rule']))) {
|
|
62 | 62 |
toggleNATrule($_POST); |
63 | 63 |
} |
64 | 64 |
} |
src/usr/local/www/firewall_nat_edit.php | ||
---|---|---|
471 | 471 |
|
472 | 472 |
$form->add($section); |
473 | 473 |
|
474 |
gen_created_updated_fields($form, config_get_path("nat/rule/{$id}/created"), config_get_path("nat/rule/{$id}/updated")); |
|
474 |
if (isset($id)) { |
|
475 |
gen_created_updated_fields($form, config_get_path("nat/rule/{$id}/created"), config_get_path("nat/rule/{$id}/updated")); |
|
476 |
} |
|
475 | 477 |
|
476 | 478 |
if (isset($id) && config_get_path("nat/rule/{$id}")) { |
477 | 479 |
$form->addGlobal(new Form_Input( |
src/usr/local/www/firewall_nat_npt.php | ||
---|---|---|
141 | 141 |
</td> |
142 | 142 |
<td> |
143 | 143 |
<?php |
144 |
$dst_arr = explode("/", $natent['destination']['network']); |
|
145 |
if (count($dst_arr) > 1) { |
|
146 |
$natent['destination']['network'] = $dst_arr[0]; |
|
147 |
} |
|
148 |
if (config_get_path("interfaces/{$natent['destination']['network']}/ipaddrv6") == 'track6') { |
|
149 |
$track6ip = get_interface_track6ip($natent['destination']['network']); |
|
150 |
$pdsubnet = gen_subnetv6($track6ip[0], $track6ip[1]); |
|
151 |
$dst = config_get_path("interfaces/{$natent['destination']['network']}/descr") . " ({$pdsubnet}/{$track6ip[1]})"; |
|
144 |
if (!empty($natent['destination']['network'])) { |
|
145 |
if (str_contains($natent['destination']['network'], '/')) { |
|
146 |
$dst_arr = explode("/", $natent['destination']['network']); |
|
147 |
$natent['destination']['network'] = $dst_arr[0]; |
|
148 |
} |
|
149 |
if (config_get_path("interfaces/{$natent['destination']['network']}/ipaddrv6") == 'track6') { |
|
150 |
$track6ip = get_interface_track6ip($natent['destination']['network']); |
|
151 |
$pdsubnet = gen_subnetv6($track6ip[0], $track6ip[1]); |
|
152 |
$dst = config_get_path("interfaces/{$natent['destination']['network']}/descr") . " ({$pdsubnet}/{$track6ip[1]})"; |
|
153 |
} |
|
152 | 154 |
} else { |
153 | 155 |
$dst = pprint_address($natent['destination']); |
154 | 156 |
} |
src/usr/local/www/firewall_nat_out_edit.php | ||
---|---|---|
284 | 284 |
|
285 | 285 |
$form->add($section); |
286 | 286 |
|
287 |
gen_created_updated_fields($form, config_get_path("nat/outbound/rule/{$id}/created"), config_get_path("nat/outbound/rule/{$id}/updated")); |
|
287 |
if (isset($id)) { |
|
288 |
gen_created_updated_fields($form, config_get_path("nat/outbound/rule/{$id}/created"), config_get_path("nat/outbound/rule/{$id}/updated")); |
|
289 |
} |
|
288 | 290 |
|
289 | 291 |
print($form); |
290 | 292 |
|
src/usr/local/www/firewall_rules_edit.php | ||
---|---|---|
1772 | 1772 |
|
1773 | 1773 |
$form->add($section); |
1774 | 1774 |
|
1775 |
gen_created_updated_fields($form, $a_filter[$id]['created'], $a_filter[$id]['updated'], $a_filter[$id]['tracker']); |
|
1775 |
if (is_numericint($a_filter[$id])) { |
|
1776 |
gen_created_updated_fields($form, $a_filter[$id]['created'], $a_filter[$id]['updated'], $a_filter[$id]['tracker']); |
|
1777 |
} |
|
1776 | 1778 |
|
1777 | 1779 |
echo $form; |
1778 | 1780 |
?> |
Also available in: Unified diff
Fix some config path warnings