diff options
Diffstat (limited to 'usr/local/www/firewall_rules_edit.php')
-rwxr-xr-x | usr/local/www/firewall_rules_edit.php | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 7430b0e..f2c3479 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -205,6 +205,7 @@ read_dummynet_config(); /* XXX: */ $dnqlist =& get_unique_dnqueue_list(); read_layer7_config(); $l7clist =& get_l7_unique_list(); +$a_gatewaygroups = return_gateway_groups_array(); if ($_POST) { unset($input_errors); @@ -216,7 +217,6 @@ if ($_POST) { } if (($_POST['ipprotocol'] <> "") && ($_POST['gateway'] <> "")) { - $a_gatewaygroups = return_gateway_groups_array(); if(is_array($config['gateways']['gateway_group'])) { foreach($config['gateways']['gateway_group'] as $gw_group) { if($gw_group['name'] == $_POST['gateway']) { @@ -1468,26 +1468,20 @@ $i--): ?> } else { $selected = ""; } - echo "<option value=\"{$gwname}\" {$selected}>{$gw['name']} - {$gw['gateway']}</option>\n"; + $gateway_addr_str = empty($gw['gateway']) ? "" : " - " . $gw[gateway]; + echo "<option value=\"{$gwname}\" {$selected}>{$gw['name']}{$gateway_addr_str}</option>\n"; } /* add gateway groups to the list */ - if (is_array($config['gateways']['gateway_group'])) { - foreach($config['gateways']['gateway_group'] as $gw_group) { - $af = explode("|", $gw_group['item'][0]); - if(($pconfig['ipprotocol'] == "inet46")) - continue; - if(($pconfig['ipprotocol'] == "inet6") && !is_ipaddrv6(lookup_gateway_ip_by_name($af[0]))) - continue; - if(($pconfig['ipprotocol'] == "inet") && !is_ipaddrv4(lookup_gateway_ip_by_name($af[0]))) - continue; - if($gw_group['name'] == "") - continue; - if($pconfig['gateway'] == $gw_group['name']) { - $selected = " selected=\"selected\""; - } else { - $selected = ""; + if (is_array($a_gatewaygroups)) { + foreach($a_gatewaygroups as $gwg_name => $gwg_data) { + if((empty($pconfig['ipprotocol'])) || ($pconfig['ipprotocol'] == $gwg_data['ipprotocol'])) { + if($pconfig['gateway'] == $gwg_name) { + $selected = " selected=\"selected\""; + } else { + $selected = ""; + } + echo "<option value=\"{$gwg_name}\" $selected>{$gwg_name}</option>\n"; } - echo "<option value=\"{$gw_group['name']}\" $selected>{$gw_group['name']}</option>\n"; } } ?> |