DeleteBackup.pm (BackupPC-4.3.2) | : | DeleteBackup.pm (BackupPC-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
# | # | |||
# Version 4.3.2, released 17 Feb 2020. | # Version 4.4.0, released 20 Jun 2020. | |||
# | # | |||
# See http://backuppc.github.io/backuppc | # See http://backuppc.github.io/backuppc | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
package BackupPC::CGI::DeleteBackup; | package BackupPC::CGI::DeleteBackup; | |||
use strict; | use strict; | |||
use warnings; | use warnings; | |||
use BackupPC::CGI::Lib qw(:all); | use BackupPC::CGI::Lib qw(:all); | |||
use Encode qw(decode_utf8); | use Encode qw(decode_utf8); | |||
sub action { | sub action | |||
my ( $str, $reply ); | { | |||
my($str, $reply); | ||||
my $host = $In{host}; | my $host = $In{host}; | |||
my $Privileged = CheckPermission($host) | my $Privileged = CheckPermission($host) | |||
&& ($PrivAdmin || $Conf{CgiUserDeleteBackupEnable} > 0); | && ($PrivAdmin || $Conf{CgiUserDeleteBackupEnable} > 0); | |||
$Privileged = 0 if ( $Conf{CgiUserDeleteBackupEnable} < 0 ); | $Privileged = 0 if ( $Conf{CgiUserDeleteBackupEnable} < 0 ); | |||
if ( !$Privileged ) { | if ( !$Privileged ) { | |||
ErrorExit( eval("qq{$Lang->{Only_privileged_users_can_delete_backups}}") ); | ErrorExit(eval("qq{$Lang->{Only_privileged_users_can_delete_backups}}")) ; | |||
} | } | |||
if ( $In{num} !~ /^\d+$/ || $In{type} !~ /^\w*$/ || $In{nofill} !~ /^\d*$/ ) { | if ( $In{num} !~ /^\d+$/ || $In{type} !~ /^\w*$/ || $In{nofill} !~ /^\d*$/ ) { | |||
ErrorExit("Backup number ${EscHTML($In{num})} for host ${EscHTML($host)} does not exist."); | ErrorExit("Backup number ${EscHTML($In{num})} for host ${EscHTML($host)} does not exist."); | |||
} | } | |||
my $num = $In{num}; | my $num = $In{num}; | |||
my $filled = $In{nofill} ? $Lang->{An_unfilled} : $Lang->{A_filled}; | my $filled = $In{nofill} ? $Lang->{An_unfilled} : $Lang->{A_filled}; | |||
my $type = $Lang->{$In{type}}; | my $type = $Lang->{$In{type}}; | |||
ServerConnect(); | ServerConnect(); | |||
if ( $In{doit} ) { | if ( $In{doit} ) { | |||
$str = eval("qq{$Lang->{Delete_requested_for_backup_of__host_by__User} }"); | $str = eval("qq{$Lang->{Delete_requested_for_backup_of__host_by__User}}" ); | |||
$bpc->ServerMesg("log $str"); | $bpc->ServerMesg("log $str"); | |||
$reply = $bpc->ServerMesg("delete $User ${EscURI($host)} $num -r"); | $reply = $bpc->ServerMesg("delete $User ${EscURI($host)} $num -r"); | |||
my $content = eval("qq{$Lang->{REPLY_FROM_SERVER}}"); | my $content = eval("qq{$Lang->{REPLY_FROM_SERVER}}"); | |||
Header( eval("qq{$Lang->{BackupPC__Delete_Requested_for_a_backup_of__hos | Header(eval("qq{$Lang->{BackupPC__Delete_Requested_for_a_backup_of__host | |||
t}}"), $content ); | }}"), $content); | |||
} | } else { | |||
else { | ||||
my $content = eval("qq{$Lang->{Are_you_sure_delete}}"); | my $content = eval("qq{$Lang->{Are_you_sure_delete}}"); | |||
Header( eval("qq{$Lang->{BackupPC__Delete_Backup_Confirm__num_of__host}} "), $content ); | Header(eval("qq{$Lang->{BackupPC__Delete_Backup_Confirm__num_of__host}}" ), $content); | |||
} | } | |||
Trailer(); | Trailer(); | |||
} | } | |||
1; | 1; | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added |