X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FView.pm;h=172e0e19e7c10714bfdea5f7bc7890c80aeb59a7;hp=5efa6a22ffe2a806a195bd52bc8d184b849757ba;hb=617af75f7419e95a9c3ea05b05cf21957acc331c;hpb=5b3e6091d542c2e7445d5dd511cdf6e20aec8b8d diff --git a/lib/BackupPC/CGI/View.pm b/lib/BackupPC/CGI/View.pm index 5efa6a2..172e0e1 100644 --- a/lib/BackupPC/CGI/View.pm +++ b/lib/BackupPC/CGI/View.pm @@ -78,20 +78,22 @@ sub action } 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 = "$BinDir/../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]; + } else { + $file = "$TopDir/pc/$host/LOG$ext"; + } $linkHosts = 1; } else { $file = "$LogDir/LOG$ext"; @@ -106,7 +108,10 @@ sub action } 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}}");