Diff for /loncom/lontrans.pm between versions 1.3 and 1.14.10.1

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

Removed from v.1.3  
changed lines
  Added in v.1.14.10.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>