--- loncom/lonnet/perl/lonnet.pm 2004/08/27 21:09:22 1.534 +++ loncom/lonnet/perl/lonnet.pm 2004/08/30 18:25:56 1.536 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.534 2004/08/27 21:09:22 albertel Exp $ +# $Id: lonnet.pm,v 1.536 2004/08/30 18:25:56 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3680,10 +3680,10 @@ sub revokecustomrole { } # ------------------------------------------------------------ Disk usage -sub diskusage{ +sub diskusage { my ($udom,$uname,$directoryRoot)=@_; $directoryRoot =~ s/\/$//; - my $listing=reply('du:'.$directoryRoot,homeserver($uname,$udom)) + my $listing=&reply('du:'.$directoryRoot,homeserver($uname,$udom)); return $listing; } @@ -5056,20 +5056,15 @@ sub filelocation { $location = $file; $location =~ s:/~(.*?)/(.*):/home/$1/public_html/$2:; } elsif ($file=~/^\/*uploaded/) { # is an uploaded file - if ($file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/(\/)?simplepage\/([^\/]+)$/) { - $location=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$4; - if (not -e $location) { - $file=~/^\/uploaded\/(.*)$/; - $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1; - } - } elsif ($file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) { - $location=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3; - if (not -e $location) { - $file=~/^\/uploaded\/(.*)$/; - $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1; - } + $file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/(\/)?(.*)$/; + my $home=&homeserver($2,$1); + my $allowed=0; + my @ids=¤t_machine_ids(); + foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } + if ($allowed) { + $location=&Apache::loncommon::propath($1,$2).'/userfiles/'.$4; } else { - $location=$file; + $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1.'/'.$2.'/'.$4; } } else { $file=~s/^\Q$perlvar{'lonDocRoot'}\E//;