version 1.9, 2004/07/02 07:58:01
|
version 1.14.10.1, 2020/03/05 22:02:32
|
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; |
use LONCAPA; |
|
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
# FIXME line remove when mod_perl fixes BUG#4948 |
|
$r->notes->set('error-notes' => ''); |
if ($r->uri=~m|^(/raw)?/uploaded/|) { |
if ($r->uri=~m|^(/raw)?/uploaded/|) { |
my $fn = $r->uri(); |
my $fn = $r->uri(); |
$fn=~s/^\/raw//; |
$fn=~s/^\/raw//; |
my (undef,undef,$udom,$uname,@ufile)=split(/\//,$fn); |
my (undef,undef,$udom,$uname,@ufile)=split(/\//,$fn); |
$ufile[-1]=~s/^[\~\.]+//; |
if (@ufile) { $ufile[-1]=~s/^[\~\.]+//; } |
my $chome=&Apache::lonnet::homeserver($uname,$udom); |
my $chome=&Apache::lonnet::homeserver($uname,$udom); |
my $allowed=0; |
my $allowed=0; |
my @ids=&Apache::lonnet::current_machine_ids(); |
my @ids=&Apache::lonnet::current_machine_ids(); |
foreach my $id (@ids) { if ($id eq $chome) { $allowed=1; } } |
foreach my $id (@ids) { if ($id eq $chome) { $allowed=1; } } |
if ($allowed) { |
if ($allowed) { |
$r->filename(&Apache::loncommon::propath($udom,$uname). |
$r->filename(&propath($udom,$uname). |
'/userfiles/'.(join('/',@ufile))); |
'/userfiles/'.(join('/',@ufile))); |
} |
} |
} elsif ($r->uri=~m|^/~|) { |
return OK; |
#internal authentication, needs fixup. |
} elsif ($r->uri =~ m{^\Q/adm/wrapper/ext/https:/\E[^/]}) { |
my $fn = $r->uri(); # non users do not get the full path request |
my $uri = $r->uri; |
# through SCRIPT_FILENAME |
$uri =~ s{^(\Q/adm/wrapper/ext/https:/\E)}{$1/}; |
$fn=~s|^/~(\w+)|/home/$1/public_html|; |
$r->uri($uri); |
$r->filename($fn); |
} |
} else { return DECLINED; } |
return DECLINED; |
return OK; |
|
} |
} |
|
|
1; |
1; |