From 18e97c76b0e1f691f5c6be8aa7fedc61d8c07469 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 5 Feb 2020 14:27:06 +0000 Subject: [PATCH] dns.cgi: Do not show table header if no servers are configured Signed-off-by: Michael Tremer Signed-off-by: Arne Fitzenreiter --- html/cgi-bin/dns.cgi | 71 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index 4f3418a703..09fd50206d 100755 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -449,7 +449,7 @@ sub show_nameservers () { $dns_status_string .= " (" . $Lang::tr{'dns recursor mode'} . ")"; } -print < @@ -458,7 +458,36 @@ print < +END + + # Check the usage of ISP assigned nameservers is enabled. + my $id = 1; + + # Loop through the array which stores the files. + foreach my $file (@ISP_nameserver_files) { + # Grab the address of the nameserver. + my $address = &General::grab_address_from_file($file); + + # Check if we got an address. + if ($address) { + # Add the address to the hash of nameservers. + $dns_servers{$id} = [ "$address", "none", + ($settings{'USE_ISP_NAMESERVERS'} eq "on") ? "enabled" : "disabled", + "$Lang::tr{'dns isp assigned nameserver'}" ]; + + # Increase id by one. + $id++; + } + } + # Check some DNS servers have been configured. In this case + # the hash contains at least one key. + my $server_amount; + if (keys %dns_servers) { + # Sort the keys by their ID and store them in an array. + my @keys = sort { $a <=> $b } keys %dns_servers; + + print < @@ -479,51 +508,23 @@ print <$Lang::tr{'remark'} END - # Check if the status should be displayed. - if ($check_servers) { -print < $Lang::tr{'status'} END -; - } + } -print < $Lang::tr{'action'} END -; - - # Check the usage of ISP assigned nameservers is enabled. - my $id = 1; - - # Loop through the array which stores the files. - foreach my $file (@ISP_nameserver_files) { - # Grab the address of the nameserver. - my $address = &General::grab_address_from_file($file); - - # Check if we got an address. - if ($address) { - # Add the address to the hash of nameservers. - $dns_servers{$id} = [ "$address", "none", - ($settings{'USE_ISP_NAMESERVERS'} eq "on") ? "enabled" : "disabled", - "$Lang::tr{'dns isp assigned nameserver'}" ]; - - # Increase id by one. - $id++; - } - } - - # Check some DNS servers have been configured. In this case - # the hash contains at least one key. - my $server_amount; - if (keys %dns_servers) { - # Sort the keys by their ID and store them in an array. - my @keys = sort { $a <=> $b } keys %dns_servers; # Loop through all entries of the array/hash. foreach my $id (@keys) { -- 2.39.2