📄 delete_view.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.### Delete an existing view and all its zones.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $conf = my $parent_conf = my $view_conf = my $view = '';my $zone = my $destination = my $type = my $file = '';my @zones = my @views = ();&ReadParse();$parent_conf = &get_config_parent();$conf = $parent_conf->{'members'};$view_conf = $conf->[$in{'index'}];%access = &get_module_acl();unless ($access{'views'}) { &terror('view_ecannot');}unless ($in{'confirm'}) { # # Ask the user if he/she is sure... # @zones = &find('zone', $view_conf->{'members'}); &header($text{'vdelete_title'}, ''); print '<hr>'; print '<center><p>', &text(@zones ? 'vdelete_mesg' : 'vdelete_mesg2', "<tt>$view_conf->{'value'}</tt>"), '<p>'; print "<form action=delete_view.cgi>\n"; print '<input type=hidden name=index value=', $in{'index'}, '>'; print '<input type=submit name=confirm value="', $text{'delete'}, '"><br>'; if (@zones) { print "<b>$text{'vdelete_newview'}</b>\n"; print '<input type=radio name=mode value=0> ', $text{'vdelete_delete'}; print '<input type=radio name=mode value=1 checked> ', "$text{'vdelete_root'}\n"; @views = &find('view', $conf); if (@views > 1) { print '<input type=radio name=mode value=2> ', $text{'vdelete_move'}; print '<select name=newview>'; foreach $view (@views) { if ($view->{'index'} != $in{'index'}) { printf "<option value=%d>%s\n", $view->{'index'}, $view->{'value'}; } } print '</select>'; } print '<br>'; } print '</form></center>'; print '<hr>'; &footer('', $text{'index_return'}); exit;}## Now deal with the zones in this view.#@zones = &find('zone', $view_conf->{'members'});if ($in{'mode'} == 1) { $destination = $parent_conf;}else { $destination = $conf->[$in{'newview'}];}&lock_file($config{'chroot'} . $destination->{'file'});foreach $zone (@zones) { $type = &find_value('type', $zone->{'members'}); next if (! $type || $type eq 'hint'); if ($in{'mode'} == 0) { # # Delete the records file. # $file = &find_value('file', $zone->{'members'}); if (defined($file)) { $file = $config{'chroot'} . &absolute_path($file); &lock_file($file); unlink $file, $file . '.jnl'; &unlock_file($file); } } else { &save_directive($destination, undef, [ $zone ], $in{'mode'} == 2 ? 1 : 0); }}&flush_file_lines();## Remove the view directive.#&lock_file($config{'chroot'} . $view_conf->{'file'});$type = &read_file_lines($config{'chroot'} . $view_conf->{'file'});splice(@$type, $view_conf->{'line'}, $view_conf->{'eline'} - $view_conf->{'line'} + 1);&flush_file_lines();&unlock_all_files();&webmin_log('delete', 'view', $view_conf->{'value'}, \%in);&redirect('');exit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -