/[BackupPC]/upstream/2.1.0/lib/BackupPC/CGI/LOGlist.pm
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 /upstream/2.1.0/lib/BackupPC/CGI/LOGlist.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Jun 22 19:12:04 2005 UTC (18 years, 10 months ago) by dpavlin
File size: 2543 byte(s)
import of version 2.1.0

1 #============================================================= -*-perl-*-
2 #
3 # BackupPC::CGI::LOGlist package
4 #
5 # DESCRIPTION
6 #
7 # This module implements the LOGlist action for the CGI interface.
8 #
9 # AUTHOR
10 # Craig Barratt <cbarratt@users.sourceforge.net>
11 #
12 # COPYRIGHT
13 # Copyright (C) 2003 Craig Barratt
14 #
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #
29 #========================================================================
30 #
31 # Version 2.1.0, released 20 Jun 2004.
32 #
33 # See http://backuppc.sourceforge.net.
34 #
35 #========================================================================
36
37 package BackupPC::CGI::LOGlist;
38
39 use strict;
40 use BackupPC::CGI::Lib qw(:all);
41
42 sub action
43 {
44 my $Privileged = CheckPermission($In{host});
45
46 if ( !$Privileged ) {
47 ErrorExit($Lang->{Only_privileged_users_can_view_log_files});
48 }
49 my $host = $In{host};
50 my($url0, $hdr, $root, $str);
51 if ( $host ne "" ) {
52 $root = "$TopDir/pc/$host/LOG";
53 $url0 = "&host=${EscURI($host)}";
54 $hdr = "for host $host";
55 } else {
56 $root = "$TopDir/log/LOG";
57 $url0 = "";
58 $hdr = "";
59 }
60 for ( my $i = -1 ; ; $i++ ) {
61 my $url1 = "";
62 my $file = $root;
63 if ( $i >= 0 ) {
64 $file .= ".$i";
65 $url1 = "&num=$i";
66 }
67 $file .= ".z" if ( !-f $file && -f "$file.z" );
68 last if ( !-f $file );
69 my $mtimeStr = $bpc->timeStamp((stat($file))[9], 1);
70 my $size = (stat($file))[7];
71 $str .= <<EOF;
72 <tr><td> <a href="$MyURL?action=view&type=LOG$url0$url1"><tt>$file</tt></a> </td>
73 <td align="right"> $size </td>
74 <td> $mtimeStr </td></tr>
75 EOF
76 }
77 my $content = eval("qq{$Lang->{Log_File_History__hdr}}");
78 Header($Lang->{BackupPC__Log_File_History},
79 $content, !-f "$TopDir/pc/$host/backups");
80 Trailer();
81 }
82
83 1;

  ViewVC Help
Powered by ViewVC 1.1.26