/[BackupPC]/trunk/cgi-bin/BackupPC_Admin
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/cgi-bin/BackupPC_Admin

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (show annotations)
Thu Jun 23 17:23:14 2005 UTC (18 years, 10 months ago) by dpavlin
File size: 4017 byte(s)
some changes from Ivan.

1 #!/bin/perl
2 #============================================================= -*-perl-*-w
3 #
4 # BackupPC_Admin: Apache/CGI interface for BackupPC.
5 #
6 # DESCRIPTION
7 # BackupPC_Admin provides a flexible web interface for BackupPC.
8 # It is a CGI script that runs under Apache.
9 #
10 # It requires that Apache pass in $ENV{SCRIPT_NAME} and
11 # $ENV{REMOTE_USER}. The latter requires .ht_access style
12 # authentication. Replace the code below if you are using some other
13 # type of authentication, and have a different way of getting the
14 # user name.
15 #
16 # Also, this script needs to run as the BackupPC user. To accomplish
17 # this the script is typically installed as setuid to the BackupPC user,
18 # or it can run under mod_perl with httpd running as the BackupPC user.
19 #
20 # AUTHOR
21 # Craig Barratt <cbarratt@users.sourceforge.net>
22 #
23 # COPYRIGHT
24 # Copyright (C) 2001-2003 Craig Barratt
25 #
26 # This program is free software; you can redistribute it and/or modify
27 # it under the terms of the GNU General Public License as published by
28 # the Free Software Foundation; either version 2 of the License, or
29 # (at your option) any later version.
30 #
31 # This program is distributed in the hope that it will be useful,
32 # but WITHOUT ANY WARRANTY; without even the implied warranty of
33 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 # GNU General Public License for more details.
35 #
36 # You should have received a copy of the GNU General Public License
37 # along with this program; if not, write to the Free Software
38 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 #
40 #========================================================================
41 #
42 # Version 2.1.0, released 20 Jun 2004.
43 #
44 # See http://backuppc.sourceforge.net.
45 #
46 #========================================================================
47
48 use strict;
49 no utf8;
50 use CGI;
51 use CGI::Carp qw(fatalsToBrowser);
52 use lib "__INSTALLDIR__/lib";
53
54 use BackupPC::Lib;
55 use BackupPC::CGI::Lib qw(:all);
56
57 BackupPC::CGI::Lib::NewRequest;
58
59 my %ActionDispatch = (
60 "summary" => "Summary",
61 "search" => "SearchArchives",
62 "burn" => "BurnMedia",
63 $Lang->{Start_Incr_Backup} => "StartStopBackup",
64 $Lang->{Start_Full_Backup} => "StartStopBackup",
65 $Lang->{Stop_Dequeue_Backup} => "StartStopBackup",
66 $Lang->{Stop_Dequeue_Archive} => "StartStopBackup",
67 "queue" => "Queue",
68 "view" => "View",
69 "LOGlist" => "LOGlist",
70 "emailSummary" => "EmailSummary",
71 "browse" => "Browse",
72 "dirHistory" => "DirHistory",
73 $Lang->{Restore} => "Restore",
74 "RestoreFile" => "RestoreFile",
75 "hostInfo" => "HostInfo",
76 "generalInfo" => "GeneralInfo",
77 "restoreInfo" => "RestoreInfo",
78 "archiveInfo" => "ArchiveInfo",
79 $Lang->{Start_Archive} => "Archive",
80 "Archive" => "Archive",
81 "Reload" => "ReloadServer",
82 "startServer" => "StartServer",
83 "Stop" => "StopServer",
84 "adminOpts" => "AdminOptions"
85 );
86
87 #
88 # Set default actions, then call sub handler
89 #
90 $In{action} ||= "hostInfo" if ( defined($In{host}) );
91 $In{action} = "generalInfo" if ( !defined($ActionDispatch{$In{action}}) );
92 my $action = $ActionDispatch{$In{action}};
93
94 #
95 # For some reason under mod_perl, the use lib above is unreliable,
96 # and sometimes the module below cannot be found. Explicitly push
97 # the directory onto INC if it is missing. This is an ugly hack;
98 # need to figure out what's really going on...
99 #
100 my $installDir = '__INSTALLDIR__/lib';
101 push(@INC, $installDir) if ( !grep($_ eq $installDir, @INC) );
102
103 #
104 # Load the relevant action script and run it
105 #
106 require "BackupPC/CGI/$action.pm"
107 if ( !defined($BackupPC::CGI::{"${action}::"}) );
108 $BackupPC::CGI::{"${action}::"}{action}();

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26