X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=cgi-bin%2FBackupPC_Admin;h=e7216822e242b511af71376edff9a11d6a6f0091;hp=8dc2091b774b8f4b3466057d01e3113c609c16ae;hb=9cf3998c4ef71332dea96ff3115daf8b9f722acb;hpb=a7e968ce327855f2ba2624ca8517069a936c9b5b diff --git a/cgi-bin/BackupPC_Admin b/cgi-bin/BackupPC_Admin index 8dc2091..e721682 100755 --- a/cgi-bin/BackupPC_Admin +++ b/cgi-bin/BackupPC_Admin @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/usr/bin/perl #============================================================= -*-perl-*-w # # BackupPC_Admin: Apache/CGI interface for BackupPC. @@ -21,7 +21,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2003 Craig Barratt +# Copyright (C) 2001-2009 Craig Barratt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.1.0_CVS, released 3 Jul 2003. +# Version 3.2.0beta0, released 5 April 2009. # # See http://backuppc.sourceforge.net. # @@ -58,38 +58,52 @@ BackupPC::CGI::Lib::NewRequest; my %ActionDispatch = ( "summary" => "Summary", - $Lang->{Start_Incr_Backup} => "StartStopBackup", - $Lang->{Start_Full_Backup} => "StartStopBackup", - $Lang->{Stop_Dequeue_Backup} => "StartStopBackup", - $Lang->{Stop_Dequeue_Archive} => "StartStopBackup", + "Start_Incr_Backup" => "StartStopBackup", + "Start_Full_Backup" => "StartStopBackup", + "Stop_Dequeue_Backup" => "StartStopBackup", + "Stop_Dequeue_Archive" => "StartStopBackup", "queue" => "Queue", "view" => "View", "LOGlist" => "LOGlist", "emailSummary" => "EmailSummary", "browse" => "Browse", "dirHistory" => "DirHistory", - $Lang->{Restore} => "Restore", + "Restore" => "Restore", "RestoreFile" => "RestoreFile", "hostInfo" => "HostInfo", "generalInfo" => "GeneralInfo", "restoreInfo" => "RestoreInfo", "archiveInfo" => "ArchiveInfo", - $Lang->{Start_Archive} => "Archive", + "Start_Archive" => "Archive", "Archive" => "Archive", "Reload" => "ReloadServer", "startServer" => "StartServer", "Stop" => "StopServer", "adminOpts" => "AdminOptions", + "editConfig" => "EditConfig", + "rss" => "RSS", ); # # Set default actions, then call sub handler # -$In{action} ||= "hostInfo" if ( defined($In{host}) ); -## rk default non admin users to pc summary for their hosts -$In{action} = "summary" if ( !defined($ActionDispatch{$In{action}}) && !CheckPermission()); -$In{action} = "generalInfo" if ( !defined($ActionDispatch{$In{action}}) ); -my $action = $ActionDispatch{$In{action}}; +if ( !defined($ActionDispatch{$In{action}}) ) { + $In{action} = defined($In{host}) ? "hostInfo" : "generalInfo"; +} +my $action = $ActionDispatch{$In{action}}; + +# +# For some reason under mod_perl, the use lib above is unreliable, +# and sometimes the module below cannot be found. Explicitly push +# the directory onto INC if it is missing. This is an ugly hack; +# need to figure out what's really going on... +# +my $installDir = '/usr/local/BackupPC/lib'; +push(@INC, $installDir) if ( !grep($_ eq $installDir, @INC) ); + +# +# Load the relevant action script and run it +# require "BackupPC/CGI/$action.pm" if ( !defined($BackupPC::CGI::{"${action}::"}) ); $BackupPC::CGI::{"${action}::"}{action}();