--- loncom/publisher/loncfile.pm 2011/10/23 23:46:07 1.110 +++ loncom/publisher/loncfile.pm 2011/10/30 19:27:27 1.112 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.110 2011/10/23 23:46:07 www Exp $ +# $Id: loncfile.pm,v 1.112 2011/10/30 19:27:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -188,9 +188,9 @@ sub display { sub obsolete_unpub { my ($user,$domain,$construct)=@_; + my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; my $published=$construct; - $published=~ - s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//; + $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/}; if (-e $published) { if (&Apache::lonnet::metadata($published,'obsolete')) { return 1; @@ -271,8 +271,9 @@ sub exists { my ($user, $domain, $construct, $creating) = @_; $creating ||= 'file'; + my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; my $published=$construct; - $published=~s{^/home/httpd/html/priv/}{/home/httpd/html/res/}; + $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/}; my ($type,$result); if ( -d $construct ) { return ('error','

'.&mt('Error: destination for operation is an existing directory.').'

'); @@ -404,16 +405,10 @@ sub relativeDest { while ($newfilename=~m:/\.\./:) { $newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/.. } - if ($newfilename =~ m{^/home/($match_username)/(?:public\_html|priv)/}) { - my $otheruname = $1; - unless ($otheruname eq $uname) { - my ($authorname,$authordom)= - &Apache::loncacc::constructaccess($newfilename,$env{'request.role.domain'}); - unless (($authorname eq $otheruname) && ($authordom ne '')) { - my $otherdir = &display($newfilename); - $error = &mt('Access denied to [_1]',$otherdir); - } - } + my ($authorname,$authordom)=&Apache::loncacc::constructaccess($newfilename); + unless (($authorname) && ($authordom)) { + my $otherdir = &display($newfilename); + $error = &mt('Access denied to [_1]',$otherdir); } return ($newfilename,$error); } @@ -1445,8 +1440,7 @@ sub handler { my $uname; my $udom; - ($uname,$udom)= - &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain')); + ($uname,$udom)=&Apache::loncacc::constructaccess($fn); &Debug($r, "loncfile::handler constructaccess uname = $uname domain = $udom"); unless (($uname) && ($udom)) {