📄 conf_misc.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 any miscellaneous options.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $conf = my $options = my $members = '';my $option = my $value = my $unit = '';%access = &get_module_acl();unless ($access{'defaults'}) { &terror('misc_ecannot');}&ReadParse();$conf = &get_config();$options = &find('options', $conf);$members = (defined($options)) ? $options->{'members'} : [ ];&header($text{'misc_title'}, '');print '<hr>';print '<form action=save_misc.cgi>';print '<table border width=100%>';print "<tr $tb><td><b>$text{'misc_header'}</b></td></tr>\n";print "<tr $cb><td><table width=100%>\n";print '<tr><td><i>', $text{'misc_dns_title'}, '</i></td></tr>';print '<tr><td></td></tr>' x 2;print '<tr>';print &choice_input($text{'misc_recursion'}, 'recursion', $members, 0, $text{'default'}, undef, $text{'yes'}, 'yes', $text{'no'}, 'no');print &choice_input($text{'misc_min_responses'}, 'minimal-responses', $members, 0, $text{'default'}, undef, $text{'yes'}, 'yes', $text{'no'}, 'no');print "</tr>\n";print '<tr>';print &addr_match_input($text{'misc_recursion_allow'}, 'allow-recursion', $members);print "</tr>\n";print '<tr>';print &addr_match_input($text{'zonedef_query'}, 'allow-query', $members);print &addr_match_input($text{'misc_blackhole'}, 'blackhole', $members);print '</tr>';print '<tr><td colspan=4><hr></td></tr>';print '<tr><td><i>', $text{'misc_named_title'}, '</i></td></tr>';print '<tr><td></td></tr>' x 2;print '<tr>';print &opt_input($text{'misc_version'}, 'version', $members, $text{'default'}, 40);print "</tr>\n";print '<tr>';print &opt_input($text{'misc_random'}, 'random-device', $members, $text{'default'}, 40, &file_chooser_button('random_device'));print "</tr>\n";print '<tr>';print &choice_input($text{'misc_zone_stats'}, 'zone-statistics', $members, 0, $text{'default'}, undef, $text{'yes'}, 'yes', $text{'no'}, 'no');print "</tr>\n";$option = &find('max-cache-ttl', $members);&get_opt_value(1, 0);print '<tr><td><b>', $text{'misc_cache_ttl'}, '</b></td> ';printf '<td colspan=3><input type=radio name=max_cache_def value=1 %s> %s ', &checked(! defined($option)), $text{'default'};printf '<input type=radio name=max_cache_def value=0 %s> ', &checked(defined($option));printf '<input name=max_cache_ttl size=10 value="%s">', $value;&time_unit_choice('max_cache_unit', $unit);print '</td></tr>';$option = &find('max-ncache-ttl', $members);&get_opt_value(1, 0);print '<tr><td><b>', $text{'misc_ncache_ttl'}, '</b></td> ';printf '<td colspan=3><input type=radio name=max_ncache_def value=1 %s> %s ', &checked(! defined($option)), $text{'default'};printf '<input type=radio name=max_ncache_def value=0 %s> ', &checked(defined($option));printf '<input name=max_ncache_ttl size=10 value="%s">', $value;&time_unit_choice('max_ncache_unit', $unit);print '</td></tr>';print '<tr><td colspan=4><hr></td></tr>';print '<tr><td><i>', $text{'misc_periodic_title'}, '</i></td></tr>';print '<tr><td></td></tr>' x 2;$option = &find('cleaning-interval', $members);&get_opt_value(1, 1);print '<tr><td><b>', $text{'misc_clean'}, '</b></td> ';printf '<td colspan=3><input type=radio name=clean_def value=1 %s> %s ', &checked(! defined($option)), $text{'default'};printf '<input type=radio name=clean_def value=-1 %s> %s ', &checked(defined($option) && ! $value), $text{'slave_none'};printf '<input type=radio name=clean_def value=0 %s> ', &checked(defined($option) && $value);printf '<input name=clean_mins size=10 value="%s">', ($value) ? $value : '';&time_unit_choice('clean_unit', $unit);print '</td></tr>';$option = &find('interface-interval', $members);&get_opt_value(1, 1);print '<tr><td><b>', $text{'misc_iface'}, '</b></td> ';printf '<td colspan=3><input type=radio name=iface_def value=1 %s> %s ', &checked(! defined($option)), $text{'default'};printf '<input type=radio name=iface_def value=-1 %s> %s ', &checked(defined($option) && ! $value), $text{'slave_none'};printf '<input type=radio name=iface_def value=0 %s> ', &checked(defined($option) && $value);printf '<input name=iface_mins size=10 value="%s">', ($value) ? $value : '';&time_unit_choice('iface_unit', $unit);print '</td></tr>';$option = &find('statistics-interval', $members);&get_opt_value(1, 1);print '<tr><td><b>', $text{'misc_stats'}, '</b></td> ';printf '<td colspan=3><input type=radio name=stats_def value=1 %s> %s ', &checked(! defined($option)), $text{'default'};printf '<input type=radio disabled name=stats_def value=-1 %s> %s ', &checked(defined($option) && ! $value), $text{'slave_none'};printf '<input type=radio disabled name=stats_def value=0 %s> ', &checked(defined($option) && $value);printf '<input name=stats_mins size=10 value="%s">', ($value) ? $value : '';&time_unit_choice('stats_unit', $unit);print '</td></tr>';$option = &find('heartbeat-interval', $members);&get_opt_value(1, 1);print '<tr><td><b>', $text{'misc_heart'}, '</b></td> ';printf '<td colspan=3><input type=radio name=heart_def value=1 %s> %s ', &checked(! defined($option)), $text{'default'};printf '<input type=radio name=heart_def value=-1 %s> %s ', &checked(defined($option) && ! $value), $text{'slave_none'};printf '<input type=radio name=heart_def value=0 %s> ', &checked(defined($option) && $value);printf '<input name=heart_mins size=10 value="%s">', ($value) ? $value : '';&time_unit_choice('heart_unit', $unit);print '</td></tr>';print '<tr><td colspan=4><hr></td></tr>';print '<tr><td><i>', $text{'misc_resources_title'}, '</i></td></tr>';print '<tr><td></td></tr>' x 2;$option = &find('coresize', $members);&get_opt_value(0, 0);print '<tr><td><b>', $text{'misc_core'}, '</b></td> ';printf '<td colspan=3><input type=radio name=core_def value=1 %s> %s ', &checked(! defined($option) || $value eq 'default'), $text{'default'};printf '<input type=radio name=core_def value=-1 %s> %s ', &checked($value eq 'unlimited'), $text{'logging_ver2'};printf '<input type=radio name=core_def value=0 %s> ', &checked(defined($option) && $value ne 'default' && $value ne 'unlimited');printf '<input name=core_size size=10 value="%s">', ($value eq 'default' || $value eq 'unlimited') ? '' : $value;&size_unit_choice('core_unit', $unit);print '</td></tr>';$option = &find('datasize', $members);&get_opt_value(0, 0);print '<tr><td><b>', $text{'misc_data'}, '</b></td> ';printf '<td colspan=3><input type=radio name=data_def value=1 %s> %s ', &checked(! defined($option) || $value eq 'default'), $text{'default'};printf '<input type=radio name=data_def value=-1 %s> %s ', &checked($value eq 'unlimited'), $text{'logging_ver2'};printf '<input type=radio name=data_def value=0 %s> ', &checked(defined($option) && $value ne 'default' && $value ne 'unlimited');printf '<input name=data_size size=10 value="%s">', ($value eq 'default' || $value eq 'unlimited') ? '' : $value;&size_unit_choice('data_unit', $unit);print '</td></tr>';$option = &find('stacksize', $members);&get_opt_value(0, 0);print '<tr><td><b>', $text{'misc_stack'}, '</b></td> ';printf '<td colspan=3><input type=radio name=stack_def value=1 %s> %s ', &checked(! defined($option) || $value eq 'default'), $text{'default'};printf '<input type=radio name=stack_def value=-1 %s> %s ', &checked($value eq 'unlimited'), $text{'logging_ver2'};printf '<input type=radio name=stack_def value=0 %s> ', &checked(defined($option) && $value ne 'default' && $value ne 'unlimited');printf '<input name=stack_size size=10 value="%s">', ($value eq 'default' || $value eq 'unlimited') ? '' : $value;&size_unit_choice('stack_unit', $unit);print '</td></tr>';$option = &find('max-cache-size', $members);&get_opt_value(0, 0);print '<tr><td><b>', $text{'misc_cache'}, '</b></td> ';printf '<td colspan=3><input type=radio name=cache_size_def value=1 %s> %s ', &checked(! defined($option) || $value eq 'default'), $text{'default'};printf '<input type=radio name=cache_size_def value=-1 %s> %s ', &checked($value eq 'unlimited'), $text{'logging_ver2'};printf '<input type=radio name=cache_size_def value=0 %s> ', &checked(defined($option) && $value ne 'default' && $value ne 'unlimited');printf '<input name=cache_size size=10 value="%s">', ($value eq 'default' || $value eq 'unlimited') ? '' : $value;&size_unit_choice('cache_size_unit', $unit);print '</td></tr>';$option = &find('files', $members);$value = (defined($option)) ? lc($option->{'value'}) : '';$value = $text{'invalid'} if ($value && (($value ne 'default' && $value ne 'unlimited' && $value =~ /\D/o) || $value == 0));print '<tr><td><b>', $text{'misc_files'}, '</b></td> ';printf '<td colspan=3><input type=radio name=files_def value=1 %s> %s ', &checked(! defined($option) || $value eq 'default'), $text{'default'};printf '<input type=radio name=files_def value=-1 %s> %s ', &checked($value eq 'unlimited'), $text{'logging_ver2'};printf '<input type=radio name=files_def value=0 %s> ', &checked(defined($option) && $value ne 'default' && $value ne 'unlimited');printf '<input name=files_size size=10 value="%s">', ($value eq 'default' || $value eq 'unlimited') ? '' : $value;print '</td></tr>';print '</table></td></tr></table>';print '<input type=submit value="', $text{'save'}, '"></form>';print '<hr>';&footer('', $text{'index_return'});exit;## get_opt_value(time_or_size, mins)#sub get_opt_value { $value = $unit = ''; if (defined($option)) { $option = $option->{'value'}; if ($_[0]) { # A time option. $option .= 'm' if ($_[1]); ($value, $unit) = &get_time($config{'display_ttl_secs'}, $option); $value = $text{'invalid'} unless ($value || $_[1]); } else { # A size option. $option = lc($option); if ($option eq 'default' || $option eq 'unlimited') { $value = $option; } else { if ($option =~ /^(\d+)([kmg]?)$/o) { if ($1 > 0) { $value = $1; if ($2) { $unit = $2 . 'B'; } else { $unit = 'Bytes'; } } } $value = $text{'invalid'} unless ($value); } } } return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -