#!/usr/local/bin/perl # list_dns.cgi # Display the DNS client configuration require './net-lib.pl'; $access{'dns'} || &error($text{'dns_ecannot'}); &ui_print_header(undef, $text{'dns_title'}, ""); $dns = &get_dns_config(); print "
\n"; print "\n"; print "\n"; print "
$text{'dns_options'}
\n"; print "\n"; printf "\n", &get_hostname(); $order = &order_input($dns); if ($order) { print "\n"; print "\n"; } # Find hostname in /etc/hosts @hosts = &list_hosts(); foreach $h (@hosts) { foreach $n (@{$h->{'hosts'}}) { $found++ if ($n eq &get_hostname()); } } if ($found) { print "\n"; print "\n"; } # Check if hostname is set from DHCP # XXX not done yet #$dhost = defined(&get_dhcp_hostname) ? &get_dhcp_hostname() : -1; #if ($dhost != -1) { # print "\n"; # print "\n"; # } print "\n"; if (@{$dns->{'name'}} > 1) { for ($j=1; $j<@{$dns->{'name'}}; $j++) { print "\n"; } } print "\n"; print "
$text{'dns_hostname'}$text{'dns_order'}$order
", "$text{'dns_hoststoo'}
",&ui_checkbox("dhcp", 1, $text{'dns_dhcp'}, $dhost), # "
"; print "$dns->{'name'}[0] " if $dns->{'name'}; print "$text{'dns_servers'} \n"; print "{'name'}[0]\">\n" if $dns->{'name'}; for($i=0; $i<$max_dns_servers || $i<@{$dns->{'nameserver'}}+1; $i++) { printf "
\n", $dns->{'nameserver'}->[$i]; } print "
"; print "$dns->{'name'}[$j] "; print "$text{'dns_servers'} \n"; print "{'name'}[$j]\">\n"; for ($i=0; $i<$max_dns_servers; $i++) { printf "
\n", $dns->{"nameserver$j"}->[$i]; } print "
$text{'dns_search'} \n"; printf " $text{'dns_none'}\n", $dns->{'domain'} ? "" : "checked"; printf " $text{'dns_listed'}\n", $dns->{'domain'} ? "checked" : ""; print "
\n"; print "\n" if ($access{'dns'} == 2); print "
\n"; &ui_print_footer("", $text{'index_return'});