📄 copy_group.cgi
字号:
#!/usr/local/bin/perl# copy_group.cgi# Copy some group's quota to a number of othersrequire './quota-lib.pl';&ReadParse();$whatfailed = "Failed to copy quotas";$access{'filesys'} eq "*" || &error("You cannot copy quotas");&can_edit_group($in{'group'}) || &error("You are not allowed to copy the quotas of this group");if ($in{'dest'} == 0) { # Copy to all groups setgrent(); while(@ginfo = getgrent()) { push(@copyto, $ginfo[0]); } endgrent(); }elsif ($in{'dest'} == 1) { # Copy to selected groups @copyto = split(/\s+/, $in{'groups'}); }elsif ($in{'dest'} == 2) { # Copy to groups containing users foreach $u (split(/\s+/, $in{'users'})) { @uinfo = getpwnam($u); @ginfo = getgrgid($uinfo[3]); push(@copyto, $ginfo[0]); $user{$u}++; } setgrent(); while(@ginfo = getgrent()) { foreach $m (split(/\s+/, $ginfo[3])) { if ($user{$m}) { push(@copyto, $ginfo[0]); last; } } } endgrent(); }@copyto = &unique(@copyto);@copyto = grep { $_ ne $in{'group'} } @copyto;if (!@copyto) { &error("No groups to copy to"); }foreach $c (@copyto) { &can_edit_group($c) || &error("You are not allowed to copy quotas to '$c'"); }# Do the copy©_group_quota($in{'group'}, @copyto);&redirect("group_filesys.cgi?group=$in{'group'}");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -