From patchwork Wed Feb 5 14:27:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 2760 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 48CP604cFKz3xY8 for ; Wed, 5 Feb 2020 14:27:20 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 48CP5y6JLZz6ZP; Wed, 5 Feb 2020 14:27:18 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 48CP5y443vz2yjS; Wed, 5 Feb 2020 14:27:18 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 48CP5w4qYBz2yRQ for ; Wed, 5 Feb 2020 14:27:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 48CP5v0l1yz2cJ; Wed, 5 Feb 2020 14:27:15 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1580912835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pmYwo/JpZJmsrkVvz4sKX6tUFiFrWyvpU1BT8m2UvTM=; b=+qnbftqOZl3oWyBtTwNb2zmwhRxJIonxEGxT977yOKeaDmcnJsZ4s5qW5qZSHzGJra1G8W g4DXkOcUYjFLqsAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1580912835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pmYwo/JpZJmsrkVvz4sKX6tUFiFrWyvpU1BT8m2UvTM=; b=D7Mtk4NxlSL9i8JP6D9Gl/ewXOFIVPtKipNzrz8jQOrccuYcEIF2H4c/Z3kDrihfAQMrin Tr5SlodeFGbvkORmuSkZrUVbVlbTCaDSkpKxOC3lgddMJAS1FFddCwOFeulV5I5ec+W+nJ QJZCoP/qDD/NhlyCui9ZgH/69WbvnnP5pyjk+l3pPkQpzhtsfi7a0lOrj0JpIcJ1WVY/G2 QtCN68wbkWGTr+FdVN0qw+HGKiaqJXbd5ip3LWC4DEeG2Le88zXUiluGvVKxk8j3+vhovK ltbGcwh71HceCBMcgOPozVH669ASp+zyW3KZ5AxvI71FsYBmKTbYvgwQF1YY+w== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 1/3] dns.cgi: Do not show table header if no servers are configured Date: Wed, 5 Feb 2020 14:27:06 +0000 Message-Id: <20200205142708.22129-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Michael Tremer --- 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 4f3418a70..09fd50206 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) {