⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit_zone.cgi

📁 BIND 9 dynamic DNS webmin module. This module supports both static and dynamic zones, and IPv4 and I
💻 CGI
字号:
#! /usr/bin/perl##    B9DDNS - BIND 9 dynamic DNS webmin module.#    Copyright (C) 2003 John Horne. <john.horne@plymouth.ac.uk>#    Copyright (C) 2004 John Horne. <john.horne@plymouth.ac.uk>##    This program is free software; you can redistribute it and/or modify#    it under the terms of the GNU General Public License as published by#    the Free Software Foundation; either version 2 of the License, or#    (at your option) any later version.##    This program is distributed in the hope that it will be useful,#    but WITHOUT ANY WARRANTY; without even the implied warranty of#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#    GNU General Public License for more details.##    You should have received a copy of the GNU General Public License#    along with this program; if not, write to the Free Software#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.### Display the records, options and directives available for a zone.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $dynamic_zone = my $named_status = my $code = my $rec = my $mid = 0;my $reverse = my $master = my $slave = my $stub = my $hint = my $forward = 0;my $slave_upd = 0;my $conf = my $zone = my $zone_conf = my $view = my $origin = '';my $file = my $real_file = my $zone_hdr = my $disabled = my $type = '';my $link = my $rtype = my $hide_recs = my $show_recs = '';my @recs = my @rcodes = ();my @links = my @titles = my @icons = ();my @rlinks = my @rtitles = my @ricons = ();my %rnum = ();&ReadParse();$conf = &get_config();if ($in{'view'}) {	$view = $conf->[$in{'view'}];	$conf = $view->{'members'};}$zone = $conf->[$in{'index'}];$zone_conf = $zone->{'members'};$origin = lc($zone->{'value'});$origin .= '.' unless ($origin =~ /\.$/o);%access = &get_module_acl();unless (&can_edit_zone(\%access, $zone, $view)) {	&terror('master_ecannot');}$type = $in{'type'};if ($in{'clear'}) {	$in{'use_value'} = 0;	$hide_recs = $show_recs = '';}else {	&trim($in{'hide'});	$hide_recs = $in{'hide'};	&trim($in{'show'});	$show_recs = $in{'show'};}$dynamic_zone = &dynamic_zone($zone, 1);if ($type eq 'master') {	$master++;}elsif ($type eq 'slave') {	$slave++;	$slave_upd++ if ($dynamic_zone == 1);}elsif ($type eq 'stub') {	$stub++;}elsif ($type eq 'forward') {	$forward++;}elsif ($type eq 'hint') {	$hint++;}$reverse++ if ($origin =~ /\.(in-addr|ip6)\.arpa\.$/o);$file = &find_value('file', $zone_conf);$real_file = $config{'chroot'} . &absolute_path($file) if (defined($file));if ($reverse && ($master || $slave)) {	@rcodes = ('PTR', 'NS', 'CNAME', 'DNAME', 'HINFO', 'TXT', 'RP', 'LOC', 'ALL');}elsif ($master || $slave) {	@rcodes = ('A', 'AAAA', 'NS', 'CNAME', 'DNAME', 'MX', 'HINFO', 'TXT',		   'WKS', 'RP', 'LOC', 'SRV', 'KEY', 'ALL');}elsif ($stub || $hint) {	@rcodes = ('A', 'AAAA', 'NS', 'ALL');}if (@rcodes) {	foreach $code (@rcodes) {		$rnum{$code} = 0;	}#	@recs = grep { ! $_->{'generate'} } &get_zone($zone, $file, $origin, undef, $type);	@recs = &get_zone($zone, $file, $origin, undef, $type);	foreach $rec (@recs) {		$rnum{'ALL'}++;		$rnum{$rec->{'type'}}++;	}}$zone_hdr = &zone_header($dynamic_zone, $origin, $text{ucfirst($type)});&header($text{"${type}_title"}, '', undef, 0, 0, 0, undef, undef, undef, $zone_hdr);$zone_hdr = $origin;unless ($config{'display_fqdn'}) {	$zone_hdr = &convert_fqdn(-1, $zone_hdr, '.', 1);}$zone_hdr = $text{'Root'} if ($zone_hdr eq '.');print '<center><font size=+2>', $zone_hdr, "</font></center><hr><p>\n";$named_status = &named_running();if (@rcodes) {	&seen_no_recs($file, $named_status, $type) unless (@recs || $hint);	if (($config{'record_filter'} > 0 &&			 $config{'record_filter'} <= ($#recs + 1)) && ! $hint) {		&show_filter();	}	if ($config{'show_list'}) {		$mid = int((@rcodes + 1) / 2);		print "<table width=100%><tr><td width=50% valign=top>\n";		&types_table(@rcodes[0 .. $mid - 1]);		print "</td><td width=50% valign=top>\n";		&types_table(@rcodes[$mid .. $#rcodes]);		print "</td></tr></table>\n";	}	else {		$link = "edit_recs.cgi?index=$in{'index'}&view=$in{'view'}&file=${file}&ztype=${type}";		$link .= '&hide=' . &urlize($hide_recs) if ($hide_recs);		$link .= '&show=' . &urlize($show_recs) if ($show_recs);		$link .= '&use_value=1' if ($in{'use_value'});		for ($rec = 0; $rec < @rcodes; $rec++) {			$rtype = $rcodes[$rec];			push(@rlinks, $link . "&type=$rtype");			push(@rtitles, $text{"type_$rtype"} . " ($rnum{$rtype})");			push(@ricons, "images/${rtype}.gif");		}		&icons_table(\@rlinks, \@rtitles, \@ricons);	}}## Create links to icons for changing zone options etc.#$link = "index=$in{'index'}&view=$in{'view'}&dynamic=$dynamic_zone";push(@links, ($access{'file'} && defined($file) && -e $real_file) ?		"edit_text.cgi?${link}&type=${type}&file=${file}" : '');push(@titles, $text{'master_manual'});push(@icons, 'images/text.gif');push(@links, ($access{'params'} &&	      (($dynamic_zone && $named_status == 1) || ! $dynamic_zone) &&	      ($master || $slave_upd)) ?		"edit_soa.cgi?${link}&type=${type}" : '');push(@titles, $text{'master_soa'});push(@icons, 'images/soa.gif');push(@links, ($access{'opts'}) ?		"edit_${type}_options.cgi?${link}&file=${file}" : '');push(@titles, $text{'master_options'});push(@icons, 'images/options.gif');push(@links, ($access{'findfree'} && ($master || $slave_upd)) ?		"find_free.cgi?index=$in{'index'}&view=$in{'view'}" : '');push(@titles, $text{'findfree_desc'});push(@icons, 'images/findfree.gif');push(@links, ($access{'gen'} && $master && defined($file) && (! $dynamic_zone ||	      ($named_status <= 0 && $access{'dyn_as_static'})) &&	      $origin !~ /\.ip6\.arpa\.$/o) ?		"list_gen.cgi?${link}&type=${type}&file=${file}" : '');push(@titles, $text{'gen_title'});push(@icons, 'images/gen.gif');print '<hr>' unless ($forward);&icons_table(\@links, \@titles, \@icons, 5);$disabled = ($access{'delete'} && ! $access{'ro'}) ? '' : 'disabled';print '<hr><table width=100%>';print '<form action=delete_zone.cgi>';print '<input type=hidden name=index value="', $in{'index'}, '">';print '<input type=hidden name=view value="', $in{'view'}, '">';print '<input type=hidden name=type value="', $type, '">';print '<input type=hidden name=file value="', $file, '">';print '<tr><td>';print "<input type=submit $disabled value=\"&nbsp;", $text{'master_del'},      '&nbsp;&nbsp;">';print '</td><td valign=center>', $text{'master_delmsg'};print "</td></tr></form>\n";$disabled = ($access{'apply'} && ! $access{'ro'} && $named_status == 1) ? '' : 'disabled';print '<form action=rndc_cmd.cgi>';print '<input type=hidden name=index value="', $in{'index'}, '">';print '<input type=hidden name=view value="', $in{'view'}, '">';print '<input type=hidden name=type value="', $type, '">';print '<input type=hidden name=cmd value="';if ($in{'new_zone'} || $dynamic_zone) {	print 'reconfig';}else {	print ($in{'cmd'} ? $in{'cmd'} : 'reload');}print '">';print '<tr><td><br>';print "<input type=submit $disabled value=\"", $text{'master_apply'}, '">';print '</td><td valign=center><br>', (($master && ! $dynamic_zone) || $hint) ?		$text{'master_apply_stat_msg'} : $text{'master_apply_dyn_msg'};print "</td></tr></form></table><hr>\n";&footer('', $text{'index_return'});exit;## types_table(&rec_types, &rec_count)#sub types_table {	my $i = 0;	my $url2 = "&file=$file&ztype=$type\">";	my $url = "<tr $cb><td><table width=100%><tr $cb><td>" .		  '<a href="edit_recs.cgi?index=' .		  "$in{'index'}&view=$in{'view'}";	$url .= '&hide=' . &urlize($hide_recs) if ($hide_recs);	$url .= '&show=' . &urlize($show_recs) if ($show_recs);	$url .= '&use_value=1' if ($in{'use_value'});	$url .= '&type=';	if ($_[0]) {		print '<table border width=100%>';		print "<tr $tb><td><b>$text{'master_type'}</b></td>",		      "<td><b>$text{'master_records'}</b></td></tr>\n";		for ($i = 0; defined($_[$i]); $i++) {			$rtype = $_[$i];			print $url, $rtype, $url2, $text{"recs_$rtype"},			      '</a></td><td align=right>';			print '(', $rtype, ')&nbsp;&nbsp;' if ($rtype ne 'ALL');			print '</td></table></td><td>', $rnum{$rtype},			      "</td></tr>\n";		}		print "</table>\n";	}	return;}sub show_filter {	print '<table width=100%><tr><td>';	print "<table border width=100%><tr $tb><td><b>",		$text{'edit_record_filters'}, "</b></td></tr>\n";	print '<form action="edit_zone.cgi">';	print '<input type=hidden name=index value="', $in{'index'}, '">';	print '<input type=hidden name=view value="', $in{'view'}, '">' if ($in{'view'});	print "<input type=hidden name=type value=$type>";	print "<tr $cb><td><table width=100%><tr><td><table width=100%>\n";	print '<tr><td width=50% align=center><b>', $text{'edit_hide_records'},		' &nbsp;</b>';	print '<input name=hide size=34 value="', $hide_recs, '"></td>';	print '<td width=50% align=center><b>', $text{'edit_show_records'},		' &nbsp;</b>';	print '<input name=show size=34 value="', $show_recs, '"></td></tr></table></td></tr>';	print '<tr><td><table width=100%>';	print '<tr><td width=50% align=center>';	printf '<input type=checkbox name=use_value value=1 %s> %s</td>',			&checked($in{'use_value'}), $text{'edit_use_value'};	print '<td width=25% align=right><input type=submit name=clear value="',		$text{'edit_clear_filters'}, '">&nbsp;</td>';	print '<td width=25% align=left>&nbsp;<input type=submit value="',		$text{'edit_set_filters'}, '"></td></tr>';	print '</table></td></tr>';	print '</table></td></tr></form></table>';	print "</td></tr></table><br>\n";	return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -