From aa745fe0822a2adbc43b8dc79015c41217f8f592 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 21 Aug 2015 07:56:22 +0000 Subject: [PATCH] (legacy) replace move item code in firewall_nat_out.php --- src/www/firewall_nat_out.php | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/www/firewall_nat_out.php b/src/www/firewall_nat_out.php index 6e337b2c5..e6b1285df 100644 --- a/src/www/firewall_nat_out.php +++ b/src/www/firewall_nat_out.php @@ -146,36 +146,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($id)) { $id = count($a_out); } - $a_out_new = array(); - /* copy all rules < $id and not selected */ - for ($i = 0; $i < $id; $i++) { - if (!in_array($i, $pconfig['rule'])) { - $a_out_new[] = $a_out[$i]; - } - } - - /* copy all selected rules */ - for ($i = 0; $i < count($a_out); $i++) { - if ($i == $id) { - continue; - } - if (in_array($i, $pconfig['rule'])) { - $a_out_new[] = $a_out[$i]; - } - } - - /* copy $id rule */ - if ($id < count($a_out)) { - $a_out_new[] = $a_out[$id]; - } - - /* copy all rules > $id and not selected */ - for ($i = $id+1; $i < count($a_out); $i++) { - if (!in_array($i, $pconfig['rule'])) { - $a_out_new[] = $a_out[$i]; - } - } - $a_out = $a_out_new; + $a_out = legacy_move_config_list_items($a_out, $id, $pconfig['rule']); if (write_config()) { mark_subsystem_dirty('natconf'); }