X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FBrowse.pm;h=014ef9e74b1c7040c1cfaaa92dfd4f55aa21eba6;hp=7f89270e9bc5c69da113c3a9bca3b9ac9d195c9b;hb=37c0dca99997f39e8785a94801adf5fcdcb837ba;hpb=5b3e6091d542c2e7445d5dd511cdf6e20aec8b8d diff --git a/lib/BackupPC/CGI/Browse.pm b/lib/BackupPC/CGI/Browse.pm index 7f89270..014ef9e 100644 --- a/lib/BackupPC/CGI/Browse.pm +++ b/lib/BackupPC/CGI/Browse.pm @@ -10,7 +10,7 @@ # Craig Barratt # # 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 @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0alpha, released 23 Jan 2006. +# Version 3.2.0, released 31 Jul 2010. # # See http://backuppc.sourceforge.net. # @@ -37,6 +37,7 @@ package BackupPC::CGI::Browse; use strict; +use Encode qw/decode_utf8/; use BackupPC::CGI::Lib qw(:all); use BackupPC::View; use BackupPC::Attrib qw(:all); @@ -64,7 +65,7 @@ sub action # # default to the newest backup # - if ( !defined($In{num}) && defined(@Backups) ) { + if ( !defined($In{num}) && defined(@Backups) && @Backups > 0 ) { $i = @Backups - 1; $num = $Backups[$i]{num}; } @@ -79,7 +80,7 @@ sub action my $backupTime = timeStamp2($Backups[$i]{startTime}); my $backupAge = sprintf("%.1f", (time - $Backups[$i]{startTime}) / (24 * 3600)); - my $view = BackupPC::View->new($bpc, $host, \@Backups); + my $view = BackupPC::View->new($bpc, $host, \@Backups, {nlink => 1, only_increment => $In{only_increment}}); if ( $dir eq "" || $dir eq "." || $dir eq ".." ) { $attr = $view->dirAttrib($num, "", ""); @@ -106,6 +107,7 @@ sub action $attr = $view->dirAttrib($num, $share, $relDir); if ( !defined($attr) ) { + $relDir = decode_utf8($relDir); ErrorExit(eval("qq{$Lang->{Can_t_browse_bad_directory_name2}}")); } @@ -156,6 +158,7 @@ sub action } my $dirName = $f; $dirName =~ s/ / /g; + $dirName = decode_utf8($dirName); push(@DirStr, {needTick => 1, tdArgs => " class=\"$tdStyle\"", link => <{type}); my $modeStr = sprintf("0%o", $a->{mode} & 07777); $iconStr = < + EOF $attrStr .= <$typeStr @@ -215,6 +218,7 @@ EOF $attrStr .= " \n"; } (my $fDisp = "${EscHTML($f)}") =~ s/ / /g; + $fDisp = decode_utf8($fDisp); if ( $gotDir ) { $fileStr .= < @@ -251,7 +255,7 @@ EOF } } $share = $currDir; - my $dirDisplay = "$share/$dir"; + my $dirDisplay = decode_utf8("$share/$dir"); $dirDisplay =~ s{//+}{/}g; $dirDisplay =~ s{/+$}{}g; $dirDisplay = "/" if ( $dirDisplay eq "" ); @@ -297,6 +301,8 @@ EOF } $filledBackup .= eval("qq{$Lang->{Visit_this_directory_in_backup}}"); } + $dir = decode_utf8($dir); + $share = decode_utf8($share); my $content = eval("qq{$Lang->{Backup_browse_for__host}}"); Header(eval("qq{$Lang->{Browse_backup__num_for__host}}"), $content); Trailer();