# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2003 Craig Barratt
+# Copyright (C) 2003-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
#
#========================================================================
#
-# Version 2.1.0beta2, released 23 May 2004.
+# Version 3.2.0, released 31 Jul 2010.
#
# See http://backuppc.sourceforge.net.
#
} elsif ( $type eq "ArchiveErr" ) {
$file = "$TopDir/pc/$host/ArchiveLOG$ext";
$comment = $Lang->{Extracting_only_Errors};
- } elsif ( $host ne "" && $type eq "config" ) {
- $file = "$TopDir/pc/$host/config.pl";
- $file = "$TopDir/conf/$host.pl"
- if ( $host ne "config" && -f "$TopDir/conf/$host.pl"
- && !-f $file );
- } elsif ( $type eq "docs" ) {
- $file = "$BinDir/../doc/BackupPC.html";
} elsif ( $type eq "config" ) {
- $file = "$TopDir/conf/config.pl";
+ # Note: only works for Storage::Text
+ $file = $bpc->{storage}->ConfigPath($host);
} elsif ( $type eq "hosts" ) {
- $file = "$TopDir/conf/hosts";
+ # Note: only works for Storage::Text
+ $file = $bpc->ConfDir() . "/hosts";
$linkHosts = 1;
+ } elsif ( $type eq "docs" ) {
+ $file = $bpc->InstallDir() . "/doc/BackupPC.html";
} elsif ( $host ne "" ) {
- $file = "$TopDir/pc/$host/LOG$ext";
+ if ( !defined($In{num}) ) {
+ # get the latest LOG file
+ $file = ($bpc->sortedPCLogFiles($host))[0];
+ $file =~ s/\.z$//;
+ } else {
+ $file = "$TopDir/pc/$host/LOG$ext";
+ }
$linkHosts = 1;
} else {
- $file = "$TopDir/log/LOG$ext";
+ $file = "$LogDir/LOG$ext";
$linkHosts = 1;
}
if ( $type ne "docs" && !$Privileged ) {
}
my($contentPre, $contentSub, $contentPost);
$contentPre .= eval("qq{$Lang->{Log_File__file__comment}}");
- if ( defined($fh = BackupPC::FileZIO->open($file, 0, $compress)) ) {
+ if ( $file ne ""
+ && defined($fh = BackupPC::FileZIO->open($file, 0, $compress)) ) {
+
+ $fh->utf8(1);
my $mtimeStr = $bpc->timeStamp((stat($file))[9], 1);
$contentPre .= eval("qq{$Lang->{Contents_of_log_file}}");
last if ( $s eq "" );
$s =~ s/[\n\r]+//g;
$s = ${EscHTML($s)};
- $s =~ s/\b([\w-]+)\b/defined($Hosts->{$1})
+ $s =~ s/\b([\w-.]+)\b/defined($Hosts->{$1})
? ${HostLink($1)} : $1/eg;
$c .= $s . "\n";
}
$s =~ s[(\$Conf\{.*?\})][
my $c = $1;
my $s = lc($c);
- $s =~ s{(\W)}{sprintf("%%%02x", ord($1) )}gxe;
+ $s =~ s{(\W)}{_}g;
"<a href=\"?action=view&type=docs#item_$s\"><tt>$c</tt></a>"
]eg;
$c .= $s . "\n";
return $c;
};
#
- # Documentation a different header and no pre or post text,
+ # Documentation has a different header and no pre or post text,
# so just handle it here
#
Header($Lang->{BackupPC__Documentation}, "", 0, $contentSub);