--- loncom/publisher/lonpubdir.pm 2001/04/03 10:48:08 1.2 +++ loncom/publisher/lonpubdir.pm 2001/08/20 20:13:40 1.14 @@ -10,7 +10,7 @@ # 03/23 Guy Albertelli # 03/24,03/29 Gerd Kortemeyer) # -# 03/31,04/03 Gerd Kortemeyer +# 03/31,04/03,05/09,06/23,08/18,08/20 Gerd Kortemeyer package Apache::lonpubdir; @@ -18,6 +18,8 @@ use strict; use Apache::File; use File::Copy; use Apache::Constants qw(:common :http :methods); +use Apache::loncacc; +use Apache::lonnet; sub handler { @@ -33,7 +35,22 @@ sub handler { } else { $fn=$r->filename(); } + + my $uname; + my $udom; + + ($uname,$udom)= + &Apache::loncacc::constructaccess( + $fn,$r->dir_config('lonDefDomain')); + unless (($uname) && ($udom)) { + $r->log_reason($uname.' at '.$udom. + ' trying to publish file '.$ENV{'form.filename'}. + ' ('.$fn.') - not authorized', + $r->filename); + return HTTP_NOT_ACCEPTABLE; + } + $fn=~s/\/$//; unless ($fn) { $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}. @@ -43,8 +60,6 @@ sub handler { # ----------------------------------------------------------- Start page output - my $uname=$ENV{'user.name'}; - my $udom=$ENV{'user.domain'}; $r->content_type('text/html'); $r->send_http_header; @@ -57,7 +72,13 @@ sub handler { my $thisdisfn=$fn; $thisdisfn=~s/^\/home\/$uname\/public_html//; - $r->print('
Filename | Modified | Status | |
---|---|---|---|
Filename | Modified | Status | |
'.$filename. - ' | '.localtime($cmtime).' | '.$status.' | '.localtime($cmtime).' | '.$status.' | '. + ''. + 'Publish | '); } elsif ($cmode&$dirptr) { - $r->print('
'.$filename. - ' | '.localtime($cmtime).' | ||
'.$disfilename. + ' | '.localtime($cmtime).' |