Handle hostnames with upper-case letters
[webmin.git] / bind8 / move_zone.cgi
1 #!/usr/local/bin/perl
2 # move_zone.cgi
3 # Move a zone to a different view
4
5 require './bind8-lib.pl';
6 &ReadParse();
7 $pconf = &get_config_parent();
8 $conf = $pconf->{'members'};
9 $nconf = $conf->[$in{'newview'}];
10 if ($in{'view'} ne '') {
11         $view = $conf->[$in{'view'}];
12         $conf = $view->{'members'};
13         }
14 $zconf = $conf->[$in{'index'}];
15 &can_edit_zone($zconf, $view) || &error($text{'master_ecannot'});
16 $in{'view'} ne $in{'newview'} || &error($text{'master_emove'});
17 &can_edit_view($nconf) || &error($text{'master_eviewcannot'});
18
19 # Delete from the view
20 &lock_file(&make_chroot($zconf->{'file'}));
21 &save_directive($pconf, [ $zconf ], [ ], 0);
22 &flush_file_lines();
23 &unlock_file(&make_chroot($zconf->{'file'}));
24
25 # Create in new view
26 &lock_file(&make_chroot($nconf->{'file'}));
27 &save_directive($nconf, undef, [ $zconf ], 1);
28 &flush_file_lines();
29 &unlock_file(&make_chroot($nconf->{'file'}));
30 &webmin_log("move", undef, $zconf->{'value'}, \%in);
31
32 &redirect("");
33