--- loncom/interface/lontiny.pm 2025/02/07 21:42:42 1.8.2.8 +++ loncom/interface/lontiny.pm 2024/11/17 04:48:15 1.23 @@ -2,7 +2,7 @@ # Extract domain, courseID, and symb from a shortened URL, # and switch role to a role in designated course. # -# $Id: lontiny.pm,v 1.8.2.8 2025/02/07 21:42:42 raeburn Exp $ +# $Id: lontiny.pm,v 1.23 2024/11/17 04:48:15 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -102,16 +102,11 @@ sub handler { my $newlauncher = &launch_check($r->uri,$symb,$cdom,$cnum); my ($map,$resid,$url) = &Apache::lonnet::decode_symb($symb); if (&Apache::lonnet::is_on_map($url)) { - my ($realuri,$reinitresult,$reinitchecked); + my $realuri; if ((&Apache::lonnet::EXT('resource.0.hiddenresource',$symb) =~ /^yes$/i) && (!$env{'request.role.adv'})) { - my $loncaparev = $r->dir_config('lonVersion'); - ($reinitresult,my @reinit) = &Apache::loncommon::needs_coursereinit($loncaparev); - $reinitchecked = 1; - unless (($reinitresult eq 'main') || ($reinitresult eq 'both')) { - $env{'user.error.msg'}=$r->uri.':bre:1:1:Access to resource denied'; - return HTTP_NOT_ACCEPTABLE; - } + $env{'user.error.msg'}=$r->uri.':bre:1:1:Access to resource denied'; + return HTTP_NOT_ACCEPTABLE; } if ((&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i) && (!$env{'request.role.adv'})) { @@ -131,17 +126,13 @@ sub handler { $realuri .= '?symb='.$symb; } } - my $update; + my ($update,$reinitresult); # Check if course needs to be re-initialized if ($newlauncher) { $update = 1; - } elsif (($reinitresult eq 'main') || ($reinitresult eq 'both')) { - $update = 1; } else { - if (!$reinitchecked) { - my $loncaparev = $r->dir_config('lonVersion'); - ($reinitresult,my @reinit) = &Apache::loncommon::needs_coursereinit($loncaparev); - } + my $loncaparev = $r->dir_config('lonVersion'); + ($reinitresult,my @reinit) = &Apache::loncommon::needs_coursereinit($loncaparev); if (($reinitresult eq 'main') || ($reinitresult eq 'both')) { $update = 1; } elsif (!-e $env{'request.course.fn'}.'.db') { @@ -170,10 +161,6 @@ sub handler { $env{'user.error.msg'}=$r->uri.':bre:0:0:Course not initialized'; $env{'user.reinit'} = 1; return HTTP_NOT_ACCEPTABLE; - } elsif ((&Apache::lonnet::EXT('resource.0.hiddenresource',$symb) =~ /^yes$/i) && - (!$env{'request.role.adv'})) { - $env{'user.error.msg'}=$r->uri.':bre:1:1:Access to resource denied'; - return HTTP_NOT_ACCEPTABLE; } } if (($reinitresult eq 'both') || ($reinitresult eq 'supp')) {