version 1.5, 2003/03/26 00:03:21
|
version 1.7, 2004/03/31 17:02:51
|
Line 32 use strict;
|
Line 32 use strict;
|
use Apache::Constants qw(:common :remotehost); |
use Apache::Constants qw(:common :remotehost); |
use Apache::lonnet(); |
use Apache::lonnet(); |
use Apache::File(); |
use Apache::File(); |
|
use Apache::loncommon; |
sub propath { |
use LONCAPA::Configuration; |
my ($udom,$uname)=@_; |
|
$udom=~s/\W//g; |
|
$uname=~s/\W//g; |
|
my $subdir=$uname.'__'; |
|
$subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/; |
|
my $proname="$Apache::lonnet::perlvar{'lonUsersDir'}/$udom/$subdir/$uname"; |
|
return $proname; |
|
} |
|
|
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
if ($r->uri=~m|^/uploaded/|) { |
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf'); |
my (undef,undef,$udom,$uname,$ufile)=split(/\//,$r->uri); |
if ($r->uri=~m|^(/raw)?/uploaded/|) { |
$ufile=~s/^[\~\.]+//; |
my $fn = $r->uri(); |
$r->filename(&propath($udom,$uname).'/userfiles/'.$ufile); |
$fn=~s/^\/raw//; |
|
my (undef,undef,$udom,$uname,@ufile)=split(/\//,$fn); |
|
$ufile[-1]=~s/^[\~\.]+//; |
|
my $chome=&Apache::lonnet::homeserver($uname,$udom); |
|
if ($chome eq $$configvars{'lonHostID'}) { |
|
$r->filename(&Apache::loncommon::propath($udom,$uname). |
|
'/userfiles/'.(join('/',@ufile))); |
|
} |
} elsif ($r->uri=~m|^/~|) { |
} elsif ($r->uri=~m|^/~|) { |
#internal authentication, needs fixup. |
#internal authentication, needs fixup. |
my $fn = $r->uri(); # non users do not get the full path request |
my $fn = $r->uri(); # non users do not get the full path request |