mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
(legacy) replace move item code in firewall_nat.php
This commit is contained in:
parent
65f48828c8
commit
4f79ae6e9b
@ -122,36 +122,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!isset($id)) {
|
||||
$id = count($a_nat);
|
||||
}
|
||||
$a_nat_new = array();
|
||||
|
||||
/* copy all rules < $id and not selected */
|
||||
for ($i = 0; $i < $id; $i++) {
|
||||
if (!in_array($i, $pconfig['rule'])) {
|
||||
$a_nat_new[] = $a_nat[$i];
|
||||
}
|
||||
}
|
||||
|
||||
/* copy all selected rules */
|
||||
for ($i = 0; $i < count($a_nat); $i++) {
|
||||
if ($i == $id)
|
||||
continue;
|
||||
if (in_array($i, $pconfig['rule'])) {
|
||||
$a_nat_new[] = $a_nat[$i];
|
||||
}
|
||||
}
|
||||
|
||||
/* copy $id rule */
|
||||
if ($id < count($a_nat)) {
|
||||
$a_nat_new[] = $a_nat[$id];
|
||||
}
|
||||
|
||||
/* copy all rules > $id and not selected */
|
||||
for ($i = $id+1; $i < count($a_nat); $i++) {
|
||||
if (!in_array($i, $pconfig['rule'])) {
|
||||
$a_nat_new[] = $a_nat[$i];
|
||||
}
|
||||
}
|
||||
$a_nat = $a_nat_new;
|
||||
$a_nat = legacy_move_config_list_items($a_nat, $id, $pconfig['rule']);
|
||||
}
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user