--- loncom/publisher/lonpublisher.pm 2000/12/08 23:36:37 1.14 +++ loncom/publisher/lonpublisher.pm 2000/12/23 15:53:26 1.15 @@ -5,7 +5,7 @@ # # 05/29/00,05/30,10/11 Gerd Kortemeyer) # -# 11/28,11/29,11/30,12/01,12/02,12/04 Gerd Kortemeyer +# 11/28,11/29,11/30,12/01,12/02,12/04,12/23 Gerd Kortemeyer package Apache::lonpublisher; @@ -618,6 +618,7 @@ sub handler { return OK; } +unless ($ENV{'form.pubdir'}) { # -------------------------------------------------------------- Check filename my $fn=$ENV{'form.filename'}; @@ -711,7 +712,8 @@ unless ($ENV{'form.phase'} eq 'two') { $r->send_http_header; $r->print('LON-CAPA Publishing'); - $r->print(''); + $r->print( + ''); my $thisfn=$fn; # ------------------------------------------------------------- Individual file @@ -745,7 +747,56 @@ unless ($ENV{'form.phase'} eq 'two') { } $r->print(''); +} else { + + my $fn=$ENV{'form.filename'}; + + $fn=~s/\/[^\/]+$//; + my $thisprefix=$fn; + $thisprefix=~s/\/\~/\/priv\//; + + $fn=~s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/; + + unless ($fn) { + $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}. + ' trying to publish empty directory', $r->filename); + return HTTP_NOT_FOUND; + } + +# ----------------------------------------------------------- Start page output + $r->content_type('text/html'); + $r->send_http_header; + + $r->print('LON-CAPA Publishing Directory'); + $r->print( + ''); + + my $thisdisfn=$fn; + $thisdisfn=~s/^\/home\/$ENV{'user.name'}\/public_html\///; + + $r->print('

Publishing directory '.$thisdisfn.'

'); + my $i=0; + $r->print(''); + + $r->print(''); + +} return OK; }