Commit 5b7398fa authored by Ad Schellevis's avatar Ad Schellevis

(legacy) replace move item code in firewall_nat_1to1.php

parent 4f79ae6e
...@@ -72,42 +72,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -72,42 +72,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($id)) { if (!isset($id)) {
$id = count($a_1to1); $id = count($a_1to1);
} }
$a_1to1_new = array(); $a_1to1 = legacy_move_config_list_items($a_1to1, $id, $pconfig['rule']);
/* copy all rules < $id and not selected */
for ($i = 0; $i < $id; $i++) {
if (!in_array($i, $pconfig['rule'])) {
$a_1to1_new[] = $a_1to1[$i];
}
}
/* copy all selected rules */
for ($i = 0; $i < count($a_1to1); $i++) {
if ($i == $id)
continue;
if (in_array($i, $pconfig['rule'])) {
$a_1to1_new[] = $a_1to1[$i];
}
}
/* copy $id rule */
if ($id < count($a_1to1)) {
$a_1to1_new[] = $a_1to1[$id];
}
/* copy all rules > $id and not selected */
for ($i = $id+1; $i < count($a_1to1); $i++) {
if (!in_array($i, $pconfig['rule'])) {
$a_1to1_new[] = $a_1to1[$i];
}
}
$a_1to1 = $a_1to1_new;
}
if (write_config()) { if (write_config()) {
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
} }
header("Location: firewall_nat_1to1.php"); header("Location: firewall_nat_1to1.php");
exit; exit;
}
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'toggle' && isset($id)) { } elseif (isset($pconfig['action']) && $pconfig['action'] == 'toggle' && isset($id)) {
// toggle item // toggle item
if(isset($a_1to1[$id]['disabled'])) { if(isset($a_1to1[$id]['disabled'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment