From 318baca5f6658f52c0b895fdb8f42bc276e26a6d Mon Sep 17 00:00:00 2001 From: gnhb Date: Sat, 2 Oct 2010 12:27:16 +0700 Subject: Update code to actually accomplish the intended behavior of NOT reloading the interface if not necessary when a GW record is saved. --- usr/local/www/system_gateways_edit.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'usr/local/www/system_gateways_edit.php') diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index d1fcd30..a790db9 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -197,7 +197,6 @@ if ($_POST) { if (!$input_errors) { if (!(($_POST['weight'] && $_POST['weight'] > 1) || $_POST['latencylow'] || $_POST['latencyhigh'] || $_POST['losslow'] || $_POST['losshigh'] || $_POST['down'] || - ($_POST['defaultgw'] && !$pconfig['defaultgw']) || (!$_POST['defaultgw'] && $pconfig['defaultgw']) || (empty($_POST['monitor']) || (!empty($_POST['gateway']) && $_POST['gateway'] != "dynamic")) || (empty($_POST['monitor']) || (!empty($_POST['monitor']) && $_POST['monitor'] != "dynamic")))) { if (isset($id) && $a_gateway_item[$id]) @@ -226,11 +225,15 @@ if ($_POST) { $gateway['monitor'] = $_POST['monitor']; if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") { + $reloadif = true; $i = 0; - foreach($a_gateway_item as $gw) { + foreach($a_gateway_item as $gw_item_id => $gw) { unset($config['gateways']['gateway_item'][$i]['defaultgw']); - if ($gw['interface'] != $_POST['interface']) - $reloadif = true; + /* if true $gw is the *saved* gateway config data and + * we don't need to reload if this GW interface didn't change AND this GW was already default */ + if (isset($id) && $gw_item_id == $id) + if ($gw['interface'] == $_POST['interface'] && isset($gw['defaultgw']) ) + $reloadif = false; $i++; } $gateway['defaultgw'] = true; -- cgit v1.1