--- loncom/publisher/lonpublisher.pm 2004/01/04 00:28:22 1.160 +++ loncom/publisher/lonpublisher.pm 2004/03/31 05:24:00 1.165 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.160 2004/01/04 00:28:22 www Exp $ +# $Id: lonpublisher.pm,v 1.165 2004/03/31 05:24:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -204,7 +204,11 @@ sub metaeval { if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; } } # actually store - $metadatafields{$unikey}=$newentry; + if ( $entry eq 'rule' && exists($metadatafields{$unikey})) { + $metadatafields{$unikey}.=','.$newentry; + } else { + $metadatafields{$unikey}=$newentry; + } } } } @@ -916,11 +920,11 @@ sub publish { $allowstr.="\n".''; } $scrout.='
'; - unless ($thisdep=~/\*/) { + if ($thisdep!~/\*/ && $thisdep!~m|^/adm/|) { $scrout.=''; } $scrout.=''.$thisdep.''; - unless ($thisdep=~/\*/) { + if ($thisdep!~/\*/ && $thisdep!~m|^/adm/|) { $scrout.=''; if ( &Apache::lonnet::getfile($Apache::lonnet::perlvar{'lonDocRoot'}.'/'. @@ -941,11 +945,6 @@ sub publish { } $outstring=~s/\n*(\<\/[^\>]+\>)\s*$/$allowstr\n$1\n/s; -### FIXME: is this really what we want? -# I dont' think so, to will corrupt any UTF-8 resources at least, -# and any encoding other than ISO-8859-1 will probably break - #Encode any High ASCII characters - #$outstring=&HTML::Entities::encode($outstring,"\200-\377"); # ------------------------------------------------------------- Write modified. { @@ -1017,9 +1016,6 @@ sub publish { } } else { -# ------------------------------------------ See if anything new in file itself - - $allmeta=&parseformeta($source,$style); # ---------------------- Read previous metafile, remember parameters and stores $scrout.=&metaread($logfile,$source.'.meta'); @@ -1030,6 +1026,10 @@ sub publish { delete $metadatafields{$_}; } } +# ------------------------------------------ See if anything new in file itself + + $allmeta=&parseformeta($source,$style); + } @@ -1414,7 +1414,7 @@ sub phasetwo { print $mfh ' '.$_.'="'.$value.'"'; } print $mfh '>'. - &HTML::Entities::encode($metadatafields{$unikey}) + &HTML::Entities::encode($metadatafields{$unikey},'<>&"') .''; } } @@ -1835,12 +1835,14 @@ sub handler { return HTTP_NOT_ACCEPTABLE; } - unless (&Apache::lonnet::homeserver($cuname,$cudom) - eq $r->dir_config('lonHostID')) { + my $home=&Apache::lonnet::homeserver($cuname,$cudom); + my $allowed=0; + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $id (@ids) { if ($id eq $home) { $allowed = 1; } } + unless ($allowed) { $r->log_reason($cuname.' at '.$cudom. ' trying to publish file '.$ENV{'form.filename'}. - ' ('.$fn.') - not homeserver ('. - &Apache::lonnet::homeserver($cuname,$cudom).')', + ' ('.$fn.') - not homeserver ('.$home.')', $r->filename); return HTTP_NOT_ACCEPTABLE; }