--- loncom/interface/londocs.pm 2023/01/18 22:38:46 1.484.2.93.2.5 +++ loncom/interface/londocs.pm 2023/01/19 03:27:48 1.484.2.93.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.93.2.5 2023/01/18 22:38:46 raeburn Exp $ +# $Id: londocs.pm,v 1.484.2.93.2.6 2023/01/19 03:27:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4145,30 +4145,10 @@ END $nomodal = 1; } } - if (&Apache::lonnet::symbverify($symb,$url)) { - $shownsymb = $symb; - if ($isexternal) { - $url =~ s/\#[^#]+$//; - if ($container eq 'page') { - $url = &Apache::lonnet::clutter($url); - } - } - unless ($env{'request.role.adv'}) { - if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) { - $url = ''; - } - if (&Apache::lonnet::EXT('resource.0.hiddenresource',$symb) =~ /^yes$/i) { - $url = ''; - $hiddenres = 1; - } - } - if ($url ne '') { - $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($shownsymb); - } - } elsif (!$env{'request.role.adv'}) { - my $checkencrypt; + my ($checkencrypt,$shownurl); + if (!$env{'request.role.adv'}) { if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) || - $isencrypted || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) { + ($isencrypted) || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) { $checkencrypt = 1; } elsif (ref($navmapref)) { unless (ref($$navmapref)) { @@ -4180,22 +4160,39 @@ END } } } - if ($checkencrypt) { - $shownsymb = &Apache::lonenc::encrypted($symb); - my $shownurl = &Apache::lonenc::encrypted($url); - if (&Apache::lonnet::symbverify($shownsymb,$shownurl)) { - $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb); - if ($env{'request.enc'} ne '') { - delete($env{'request.enc'}); - } - } else { - $url=''; - } + } + if ($checkencrypt) { + my $currenc = $env{'request.enc'}; + $env{'request.enc'} = 1; + $shownsymb = &Apache::lonenc::encrypted($symb); + $shownurl = &Apache::lonenc::encrypted($url); + if (&Apache::lonnet::symbverify($symb,$url)) { + $url = $shownurl; } else { - $url=''; + $url = ''; } - } else { - $url=''; + $env{'request.enc'} = $currenc; + } elsif (&Apache::lonnet::symbverify($symb,$url)) { + $shownsymb = $symb; + if ($isexternal) { + $url =~ s/\#[^#]+$//; + if ($container eq 'page') { + $url = &Apache::lonnet::clutter($url); + } + } + $shownurl = $url; + } + unless ($env{'request.role.adv'}) { + if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) { + $url = ''; + } + if (&Apache::lonnet::EXT('resource.0.hiddenresource',$symb) =~ /^yes$/i) { + $url = ''; + $hiddenres = 1; + } + } + if ($url ne '') { + $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb); } } } elsif ($supplementalflag) {