From 934240efeb45a567968df27d0ced84ed007d41c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Wed, 10 Sep 2008 09:27:17 +0000 Subject: [PATCH] * Correctly show dhcp tabs for the service * Do not display tabs for the interface not elligible for running a dhcp service. --- usr/local/www/services_dhcp.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 5a2f29ab8d..12391efea6 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -53,16 +53,10 @@ if($config['installedpackages']['olsrd']) { } } -$ifdescrs = get_configured_interface_with_descr(); +if (!$_GET['if']) + $savemsg = "The DHCP Server can only be enabled on interfaces configured with static IP addresses.

The interfaces not configured with static ip will not be shown.

"; -foreach ($ifdescrs as $ifname => $ifdesc) { - $oc = $config['interfaces'][$ifname]; - - if (!is_ipaddr($oc['ipaddr']) && !$is_olsr_enabled) - $singleif_nostaticip = true; - else if ($oc['if']) - $iflist[$ifname] = $ifdesc; -} +$iflist = get_configured_interface_with_descr(); /* set the starting interface */ if($config['interfaces']['lan']) { @@ -379,13 +373,6 @@ function show_netboot_config() { echo ""; exit; } - if ($singleif_nostaticip) { - echo "The DHCP Server can only be enabled on interfaces configured with static IP addresses. Your interface is not configured with a static IP."; - include("fend.inc"); - echo ""; - echo ""; - exit; - } ?>

You must apply the changes in order for them to take effect.");?>
@@ -398,11 +385,22 @@ function show_netboot_config() { $tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) { + $oc = $config['interfaces'][$ifent]; + if (!is_ipaddr($oc['ipaddr'])) + continue; if ($ifent == $if) $active = true; else $active = false; $tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}"); + $tabscounter++; + } + if ($tabscounter == 0) { + echo ""; + include("fend.inc"); + echo ""; + echo ""; + exit; } display_top_tabs($tab_array); ?>