Diff for /loncom/auth/blockedaccess.pm between versions 1.4 and 1.5

version 1.4, 2012/03/31 23:10:47 version 1.5, 2020/09/28 00:10:27
Line 29 Line 29
 package Apache::blockedaccess;  package Apache::blockedaccess;
   
 use strict;  use strict;
 use Apache::Constants qw(:common :http REDIRECT);  use Apache::Constants qw(:common);
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonlocal;  use Apache::lonlocal;
   use HTML::Entities();
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
Line 41  sub handler { Line 42  sub handler {
     return OK if $r->header_only;      return OK if $r->header_only;
   
     &Apache::lonlocal::get_language_handle($r);      &Apache::lonlocal::get_language_handle($r);
     my $origurl = $r->uri;      my $origurl = &Apache::lonnet::deversion($r->uri);
     my ($blocked,$blocktext);      my ($blocked,$blocktext);
   
     if (&Apache::lonnet::is_portfolio_url($origurl)) {      if (&Apache::lonnet::is_portfolio_url($origurl)) {
Line 53  sub handler { Line 54  sub handler {
         if ($env{'request.course.id'}) {          if ($env{'request.course.id'}) {
             my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};              my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
             my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
               my $symb = $env{'request.symb'};
             ($blocked,$blocktext) =              ($blocked,$blocktext) =
                 &Apache::loncommon::blocking_status('docs',$cnum,$cdom,$origurl);                  &Apache::loncommon::blocking_status('docs',$cnum,$cdom,$origurl,1,$symb,'blockedaccess');
         }          }
     }      }
     if ($blocked) {      if ($blocked) {
         $r->print(&Apache::loncommon::start_page('Access Temporarily Blocked'));          $r->print(&Apache::loncommon::start_page('Access Temporarily Blocked'));
         $r->print($blocktext);          $r->print($blocktext);
       } elsif ($origurl eq '/adm/blockedaccess') {
           $r->print(&Apache::loncommon::start_page('Access Blocking Information'));
           $r->print('<p class="LC_warning">'.&mt('Could not determine which page had access blocked.').'</p>');
     } else {      } else {
         my $server = &Apache::lonnet::absolute_url();          $r->print(&Apache::loncommon::start_page('Access Blocking Information'));
         $r->header_out(Location => $server.$origurl);          my $link;
         return REDIRECT;          if ($origurl ne '') {
               my $showurl = &Apache::lonenc::check_encrypt($origurl);
               $link = &Apache::lonnet::absolute_url().$showurl;
               if ($r->args ne '') {
                   $link .= '?'.$r->args;
               }
           }
           $r->print('<p class="LC_info">'.
                     &mt('The page you are trying to reach was reported as having access blocked, but the reason is not available.').
                     '</p>');
           if ($link) {
               $r->print('<p><a href="'.&HTML::Entities::encode($link,'\'"<>&').'">'.&mt('Try again?').'</a></p>');
           }
     }      }
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
     return OK;      return OK;

Removed from v.1.4  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>