"Fossies" - the Fresh Open Source Software Archive

Member "BackupPC-4.4.0/lib/BackupPC/CGI/DeleteBackup.pm" (20 Jun 2020, 2715 Bytes) of package /linux/privat/BackupPC-4.4.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "DeleteBackup.pm" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 4.3.2_vs_4.4.0.

    1 #============================================================= -*-perl-*-
    2 #
    3 # BackupPC::CGI::DeleteBackup package
    4 #
    5 # DESCRIPTION
    6 #
    7 #   This module implements the DeleteBackup action for the CGI interface.
    8 #
    9 # AUTHORS
   10 #   Craig Barratt       <cbarratt@users.sourceforge.net>
   11 #   Alexander Moisseev  <moiseev@mezonplus.ru>
   12 #
   13 # COPYRIGHT
   14 #   Copyright (C) 2003-2020  Craig Barratt
   15 #   Copyright (C) 2017  Alexander Moisseev
   16 #
   17 #   This program is free software: you can redistribute it and/or modify
   18 #   it under the terms of the GNU General Public License as published by
   19 #   the Free Software Foundation, either version 3 of the License, or
   20 #   (at your option) any later version.
   21 #
   22 #   This program is distributed in the hope that it will be useful,
   23 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
   24 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   25 #   GNU General Public License for more details.
   26 #
   27 #   You should have received a copy of the GNU General Public License
   28 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   29 #
   30 #========================================================================
   31 #
   32 # Version 4.4.0, released 20 Jun 2020.
   33 #
   34 # See http://backuppc.github.io/backuppc
   35 #
   36 #========================================================================
   37 
   38 package BackupPC::CGI::DeleteBackup;
   39 
   40 use strict;
   41 use warnings;
   42 use BackupPC::CGI::Lib qw(:all);
   43 use Encode qw(decode_utf8);
   44 
   45 sub action
   46 {
   47     my($str, $reply);
   48     my $host = $In{host};
   49 
   50     my $Privileged = CheckPermission($host)
   51       && ($PrivAdmin || $Conf{CgiUserDeleteBackupEnable} > 0);
   52     $Privileged = 0 if ( $Conf{CgiUserDeleteBackupEnable} < 0 );
   53     if ( !$Privileged ) {
   54         ErrorExit(eval("qq{$Lang->{Only_privileged_users_can_delete_backups}}"));
   55     }
   56     if ( $In{num} !~ /^\d+$/ || $In{type} !~ /^\w*$/ || $In{nofill} !~ /^\d*$/ ) {
   57         ErrorExit("Backup number ${EscHTML($In{num})} for host ${EscHTML($host)} does not exist.");
   58     }
   59     my $num    = $In{num};
   60     my $filled = $In{nofill} ? $Lang->{An_unfilled} : $Lang->{A_filled};
   61     my $type   = $Lang->{$In{type}};
   62     ServerConnect();
   63     if ( $In{doit} ) {
   64         $str = eval("qq{$Lang->{Delete_requested_for_backup_of__host_by__User}}");
   65         $bpc->ServerMesg("log $str");
   66 
   67         $reply = $bpc->ServerMesg("delete $User ${EscURI($host)} $num -r");
   68 
   69         my $content = eval("qq{$Lang->{REPLY_FROM_SERVER}}");
   70         Header(eval("qq{$Lang->{BackupPC__Delete_Requested_for_a_backup_of__host}}"), $content);
   71     } else {
   72         my $content = eval("qq{$Lang->{Are_you_sure_delete}}");
   73         Header(eval("qq{$Lang->{BackupPC__Delete_Backup_Confirm__num_of__host}}"), $content);
   74     }
   75     Trailer();
   76 }
   77 
   78 1;