#!/usr/local/bin/perl # edit_master.cgi # Display a form for editing a master domain require './dns-lib.pl'; &ReadParse(); $conf = &get_config(); $zconf = $conf->[$in{'index'}]; $dom = $zconf->{'values'}->[0]; %access = &get_module_acl(); &can_edit_zone(\%access, $dom) || &error("You are not allowed to edit this zone"); &header("Edit Master Zone", ""); print "
",&arpa_to_ip($dom),"
\n"; print "

\n"; @recs = &read_zone_file($zconf->{'values'}->[1], $dom); if ($dom =~ /in-addr.arpa/i) { @rcodes = ("PTR", "NS"); } else { @rcodes = ("A", "NS", "CNAME", "MX", "HINFO", "TXT", "WKS", "RP"); } foreach $c (@rcodes) { $rnum{$c} = 0; } foreach $r (@recs) { $rnum{$r->{'type'}}++; if ($r->{'type'} eq "SOA") { $soa = $r; } } if ($config{'show_list'}) { # display as list $mid = int((@rcodes+1)/2); print "
\n"; &types_table(@rcodes[0..$mid-1]); print "\n"; &types_table(@rcodes[$mid..$#rcodes]); print "
\n"; } else { # display as icons for($i=0; $i<@rcodes; $i++) { push(@rlinks, "edit_recs.cgi?index=$in{'index'}&type=$rcodes[$i]"); push(@rtitles, "$code_map{$rcodes[$i]} ($rnum{$rcodes[$i]})"); push(@ricons, "../bind8/images/$rcodes[$i].gif"); } &icons_table(\@rlinks, \@rtitles, \@ricons); } $file = &absolute_path($zconf->{'values'}->[1]); print "Manually edit ", "records file
\n"; # form for editing SOA record $v = $soa->{'values'}; print "


\n"; print "
\n"; print "{'file'}\">\n"; print "{'num'}\">\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Master Zone Parameters
\n"; print "\n"; print "\n"; $v->[1] =~ s/\./\@/; $v->[1] =~ s/\.$//; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Master server[0]\">Email address[1]\">
Refresh time[3]\"> secsTransfer retry time[4]\"> secs
Expiry time[5]\"> secsDefault time-to-live[6]\"> secs
\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "
\n"; print &ui_hr(); &footer("", "zone list"); sub types_table { if ($_[0]) { local($i); print "\n"; print "\n"; for($i=0; $_[$i]; $i++) { print "\n"; print "\n"; } print "
Type Records
$code_map{$_[$i]}", "$rnum{$_[$i]}
\n"; } }