mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Switch logic of $disabled tests system_gateways
This commit is contained in:
parent
9a01d22d4f
commit
205178aa82
@ -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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user