version 1.7, 2004/03/31 17:02:51
|
version 1.12, 2006/08/17 20:22:11
|
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 lib '/home/httpd/lib/perl'; |
use LONCAPA::Configuration; |
use LONCAPA; |
|
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf'); |
# 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); |
if ($chome eq $$configvars{'lonHostID'}) { |
my $allowed=0; |
$r->filename(&Apache::loncommon::propath($udom,$uname). |
my @ids=&Apache::lonnet::current_machine_ids(); |
|
foreach my $id (@ids) { if ($id eq $chome) { $allowed=1; } } |
|
if ($allowed) { |
|
$r->filename(&propath($udom,$uname). |
'/userfiles/'.(join('/',@ufile))); |
'/userfiles/'.(join('/',@ufile))); |
} |
} |
} elsif ($r->uri=~m|^/~|) { |
} elsif ($r->uri=~m|^/~|) { |