--- loncom/lonnet/perl/lonnet.pm 2004/08/27 21:39:54 1.535 +++ 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.535 2004/08/27 21:39:54 albertel Exp $ +# $Id: lonnet.pm,v 1.536 2004/08/30 18:25:56 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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//;