diff options
-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']); } } } |