diff options
-rwxr-xr-x | usr/local/www/firewall_rules_edit.php | 56 | ||||
-rwxr-xr-x | usr/local/www/firewall_virtual_ip_edit.php | 12 | ||||
-rwxr-xr-x | usr/local/www/guiconfig.inc | 5 |
3 files changed, 30 insertions, 43 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 348529e..59ee4c5 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -493,20 +493,12 @@ include("head.inc"); <select name="interface" class="formselect"> <?php endif; + $ifdescs = get_configured_interface_with_descr(); + + foreach ($ifdescs as $if => $ifdesc) + if(have_ruleint_access($if)) + $interfaces[$if] = $ifdesc; - $interfaces = array(); - if($config['interfaces']['lan']) { - /* only add LAN if it exists */ - if(have_ruleint_access("lan")) - $interfaces['lan'] = "LAN"; - } - if(have_ruleint_access("wan")) - $interfaces['wan'] = "WAN"; - - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) - if(have_ruleint_access("opt{$i}")) - $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr']; - if ($config['pptpd']['mode'] == "server") if(have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; @@ -635,14 +627,15 @@ include("head.inc"); <option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option> <?php endif; ?> <?php - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): ?> - <?php if(have_ruleint_access("opt{$i}")): ?> - <option value="opt<?=$i;?>" <?php if ($pconfig['src'] == "opt" . $i) { echo "selected"; } ?>><?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> subnet</option> - <option value="opt<?=$i;?>ip"<?php if ($pconfig['src'] == "opt" . $i . "ip") { echo "selected"; } ?>> - <?=$config['interfaces']['opt' . $i]['descr']?> address + $ifdisp = get_configured_interface_with_descr(); + foreach ($ifdisp as $if => $ifdesc): ?> + <?php if(have_ruleint_access($if)): ?> + <option value="<?=$if;?>" <?php if ($pconfig['src'] == $if) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option> + <option value="<?=$if;?>ip"<?php if ($pconfig['src'] == $if . "ip") { echo "selected"; } ?>> + <?=$ifdesc?> address </option> <?php endif; ?> -<?php endfor; ?> +<?php endforeach; ?> </select> </td> </tr> @@ -762,14 +755,15 @@ include("head.inc"); <option value="pppoe" <?php if ($pconfig['dst'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option> <?php endif; ?> -<?php for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): ?> - <?php if(have_ruleint_access("opt{$i}")): ?> - <option value="opt<?=$i;?>" <?php if ($pconfig['dst'] == "opt" . $i) { echo "selected"; } ?>><?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> subnet</option> - <option value="opt<?=$i;?>ip"<?php if ($pconfig['dst'] == "opt" . $i . "ip") { echo "selected"; } ?>> - <?=$config['interfaces']['opt' . $i]['descr']?> address + +<?php foreach ($ifdisp as $if => $ifdesc): ?> + <?php if(have_ruleint_access($if)): ?> + <option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option> + <option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo "selected"; } ?>> + <?=$ifdesc;?> address </option> <?php endif; ?> -<?php endfor; ?> +<?php endforeach; ?> </select> </td> </tr> @@ -996,16 +990,16 @@ on another rule.")?> } } } - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { - if($config['interfaces']['opt' . $i]['ipaddr'] == "dhcp") { - $descr = $config['interfaces']['opt' . $i]['descr']; - if ($pconfig['gateway'] == "opt{$i}") { + $iflist = get_configured_interface_with_descr(); + foreach ($iflist as $if => $ifdesc) { + if($config['interfaces'][$if]['ipaddr'] == "dhcp") { + if ($pconfig['gateway'] == $if) { $selected = " SELECTED"; } else { $selected = ""; } - if($descr <> "") - echo "<option value=\"opt{$i}\" {$selected}>OPT{$i} - {$descr}</option>\n"; + if($ifdesc <> "") + echo "<option value=\"{$if}\" {$selected}>".strtoupper($if)." - {$ifdesc}</option>\n"; } } ?> diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 1d5036a..a48afc2 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -128,9 +128,7 @@ if ($_POST) { $can_post = true; $found = false; $subnet_ip = return_first_two_octets($_POST['subnet']); - $iflist = array("lan", "wan"); - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) - $iflist['opt' . $i] = 'opt' . $i; + $iflist = get_configured_interface_list(false, true); foreach($iflist as $if) { $ww_subnet_ip = $config['interfaces'][$if]['ipaddr']; $ww_subnet_bits = $config['interfaces'][$if]['subnet']; @@ -335,13 +333,7 @@ function typesel_change() { <td width="78%" class="vtable"> <select name="interface" class="formselect"> <?php - if($config['interfaces']['lan']) - $interfaces = array('wan' => 'WAN', 'lan' => 'LAN'); - else - $interfaces = array('wan' => 'WAN'); - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { - $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr']; - } + $interfaces = get_configured_interface_with_descr(false, true); foreach ($interfaces as $iface => $ifacename): ?> <option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>> <?=htmlspecialchars($ifacename);?> diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 4e55472..1b97572 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -145,8 +145,9 @@ $wkports = array(3389 => "MS RDP", $specialnets = array("wanip" => "WAN address", "lanip" => "LAN address", "lan" => "LAN net", "pptp" => "PPTP clients"); -for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { - $specialnets['opt' . $i] = $config['interfaces']['opt' . $i]['descr'] . " net"; +$spiflist = get_configured_interface_with_descr(true, true); +foreach ($spiflist as $if => $ifdesc) { + $specialnets[$if] = $ifdesc . " net"; } $medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex", |