diff options
author | Phil Davis <phil.davis@inf.org> | 2015-07-18 23:02:10 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-07-18 23:02:10 +0545 |
commit | 205178aa8277442587aae5db76ff5510ebdcc5c9 (patch) | |
tree | 5c2e4e3877db9188a786d22dc24df415280af13c /usr/local | |
parent | 9a01d22d4fb39e29fbda87f7980045603222a36a (diff) | |
download | pfsense-205178aa8277442587aae5db76ff5510ebdcc5c9.zip pfsense-205178aa8277442587aae5db76ff5510ebdcc5c9.tar.gz |
Switch logic of $disabled tests system_gateways
Diffstat (limited to 'usr/local')
-rw-r--r-- | usr/local/www/system_gateways.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php index c78b41a..850c5ba 100644 --- a/usr/local/www/system_gateways.php +++ b/usr/local/www/system_gateways.php @@ -90,10 +90,10 @@ function can_delete_disable_gateway_item($id, $disable = false) { foreach ($group['item'] as $item) { $items = explode("|", $item); if ($items[0] == $a_gateways[$id]['name']) { - if ($disable) { - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Gateway Group '%s'"), $a_gateways[$id]['name'], $group['name']); - } else { + if (!$disable) { $input_errors[] = sprintf(gettext("Gateway '%s' cannot be deleted because it is in use on Gateway Group '%s'"), $a_gateways[$id]['name'], $group['name']); + } else { + $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Gateway Group '%s'"), $a_gateways[$id]['name'], $group['name']); } } } @@ -103,15 +103,13 @@ function can_delete_disable_gateway_item($id, $disable = false) { if (is_array($config['staticroutes']['route'])) { foreach ($config['staticroutes']['route'] as $route) { if ($route['gateway'] == $a_gateways[$id]['name']) { - if ($disable) { - // The user wants to disable this gateway. - if (!isset($route['disabled'])) { - // But there is a static route that uses this gateway and is enabled (not disabled). - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Static Route '%s'"), $a_gateways[$id]['name'], $route['network']); - } - } else { + if (!$disable) { // The user wants to delete this gateway, but there is a static route (enabled or disabled) that refers to the gateway. $input_errors[] = sprintf(gettext("Gateway '%s' cannot be deleted because it is in use on Static Route '%s'"), $a_gateways[$id]['name'], $route['network']); + } else if (!isset($route['disabled'])) { + // The user wants to disable this gateway. + // But there is a static route that uses this gateway and is enabled (not disabled). + $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Static Route '%s'"), $a_gateways[$id]['name'], $route['network']); } } } |