MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/libexec/webmin/bind8/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/libexec/webmin/bind8/edit_master.cgi
#!/usr/bin/perl
# edit_master.cgi
# Display options and directives in an existing master zone

require './bind8-lib.pl';
&ReadParse();
if ($in{'zone'}) {
	$zone = &get_zone_name($in{'zone'}, 'any');
	$in{'index'} = $zone->{'index'};
	$in{'view'} = $zone->{'viewindex'};
	}
else {
	$zone = &get_zone_name($in{'index'}, $in{'view'});
	}
$dom = $zone->{'name'};
&can_edit_zone($zone) || &error($text{'master_ecannot'});
$desc = &ip6int_to_net(&arpa_to_ip($dom));
&ui_print_header($desc, $text{'master_title'}, "");

# Find the record types
if (!$config{'largezones'}) {
	@recs = grep { !$_->{'generate'} && !$_->{'defttl'} }
		     &read_zone_file($zone->{'file'}, $dom);
	}
if ($dom =~ /in-addr\.arpa/i || $dom =~ /\.$ipv6revzone/i) {
	@rcodes = &get_reverse_record_types();
	}
else {
	@rcodes = &get_forward_record_types();
	}
push(@rcodes, "ALL");
@rcodes = grep { &can_edit_type($_, \%access) } @rcodes;

if (!$config{'largezones'}) {
	# See what record type we have
	foreach $c (@rcodes) { $rnum{$c} = 0; }
	foreach $r (@recs) {
		$rnum{$r->{'type'}}++;
		$rnum{"ALL"}++ if ($r->{'type'} ne "SOA");
		if ($r->{'type'} eq "SOA") { $soa = $r; }
		}
	}
else {
	# Just assume that we have all types
	$soa = 1;
	}

if ($config{'show_list'}) {
	# display as list
	$mid = int((@rcodes+1)/2);
	@grid = ( );
	push(@grid, &types_table(@rcodes[0..$mid-1]));
	push(@grid, &types_table(@rcodes[$mid..$#rcodes]));
	print &ui_grid_table(\@grid, 2, 100, [ "width=50%", "width=50%" ]);
	}
else {
	# display as icons
	for($i=0; $i<@rcodes; $i++) {
		push(@rlinks, "edit_recs.cgi?index=$in{'index'}&".
			      "view=$in{'view'}&type=$rcodes[$i]");
		push(@rtitles, ($text{"type_$rcodes[$i]"} || $rcodes[$i]).
			       (defined(%rnum) ? " ($rnum{$rcodes[$i]})" : ""));
		push(@ricons, $is_extra{$rcodes[$i]} ?
				"images/extra.gif" : "images/$rcodes[$i].gif");
		}
	&icons_table(\@rlinks, \@rtitles, \@ricons);
	}

# links to forms editing text, soa and zone options
if ($access{'file'}) {
	push(@links, "edit_text.cgi?index=$in{'index'}&view=$in{'view'}");
	push(@titles, $text{'master_manual'});
	push(@images, "images/text.gif");
	}
if ($access{'params'}) {
	push(@links, "edit_soa.cgi?index=$in{'index'}&view=$in{'view'}");
	push(@titles, $text{'master_soa'});
	push(@images, "images/soa.gif");
	}
if ($access{'opts'}) {
	push(@links, "edit_options.cgi?index=$in{'index'}&view=$in{'view'}");
	push(@titles, $text{'master_options'});
	push(@images, "images/options.gif");
	}
if ($access{'findfree'}) {
	push(@links, "find_free.cgi?index=$in{'index'}&view=$in{'view'}");
	push(@titles, $text{'findfree_desc'});
	push(@images, "images/findfree.gif");
	}
if ($access{'gen'}) {
	push(@links, "list_gen.cgi?index=$in{'index'}&view=$in{'view'}");
	push(@titles, $text{'gen_title'});
	push(@images, "images/gen.gif");
	}
if ($access{'whois'} && &has_command($config{'whois_cmd'}) &&
    $dom !~ /in-addr\.arpa/i) {
	push(@links, "whois.cgi?index=$in{'index'}&view=$in{'view'}");
	push(@titles, $text{'master_whois'});
	push(@images, "images/whois.gif");
	}

if (@links) {
	print &ui_hr();
	&icons_table(\@links, \@titles, \@images);
	}

$apply = $access{'apply'} && &has_ndc();
if (!$access{'ro'} && ($access{'delete'} || $apply)) {
	print &ui_hr();
	print &ui_buttons_start();

	if ($access{'delete'}) {
		# Show button to delete zome
		print &ui_buttons_row(
			"delete_zone.cgi", $text{'master_del'},
			$text{'master_delmsg'}." ".
			($dom !~ /in-addr\.arpa/i &&
			 $dom !~ /\.$ipv6revzone/i ? $text{'master_delrev'}
						   : ""),
			&ui_hidden("index", $in{'index'}).
			&ui_hidden("view", $in{'view'})
			);
		}

	if ($apply) {
		# Show button to do an NDC reload
		print &ui_buttons_row(
			"restart_zone.cgi", $text{'master_apply'},
			$text{'master_applymsg2'},
			&ui_hidden("index", $in{'index'}).
			&ui_hidden("view", $in{'view'})
			);

		# Show button to freeze
		print &ui_buttons_row(
			"freeze_zone.cgi", $text{'master_freeze'},
			$text{'master_freezemsg2'},
			&ui_hidden("index", $in{'index'}).
			&ui_hidden("view", $in{'view'})
			);

		# Show button to un-freeze
		print &ui_buttons_row(
			"unfreeze_zone.cgi", $text{'master_unfreeze'},
			$text{'master_unfreezemsg2'},
			&ui_hidden("index", $in{'index'}).
			&ui_hidden("view", $in{'view'})
			);
		}

	# Show button to check records
	if (&supports_check_zone()) {
		print &ui_buttons_row(
			"check_zone.cgi", $text{'master_checkzone'},
			$text{'master_checkzonemsg'},
			&ui_hidden("index", $in{'index'}).
			&ui_hidden("view", $in{'view'})
			);
		}

	# Move zone button
	$conf = &get_config();
	print &move_zone_button($conf, $in{'view'}, $in{'index'});

	# Convert to slave zone
	if ($access{'slave'}) {
		print &ui_buttons_row("convert_master.cgi",
			$text{'master_convert'},
			$text{'master_convertdesc'},
			&ui_hidden("index", $in{'index'}).
			&ui_hidden("view", $in{'view'}));
		}

	print &ui_buttons_end();
	}

&ui_print_footer("", $text{'index_return'});

sub types_table
{
my $rv;
if ($_[0]) {
	$rv .= &ui_columns_start([
		$text{'master_type'},
		defined(%rnum) ? ( $text{'master_records'} ) : ( )
		], 100);
	for(my $i=0; $_[$i]; $i++) {
		local @cols = ( "<a href=\"edit_recs.cgi?".
		      "index=$in{'index'}&view=$in{'view'}&type=$_[$i]\">".
		      ($text{"recs_$_[$i]"} || $_[$i])."</a>" );
		if (defined(%rnum)) {
			push(@cols, $rnum{$_[$i]});
			}
		$rv .= &ui_columns_row(\@cols);
		}
	$rv .= &ui_columns_end();
	}
return $rv;
}


Anon7 - 2021