Diff for /loncom/auth/londatecheck.pm between versions 1.3 and 1.9

version 1.3, 2004/06/28 16:26:55 version 1.9, 2005/04/25 21:21:17
Line 26 Line 26
   
 use strict;  use strict;
 package Apache::londatecheck;  package Apache::londatecheck;
 use Apache::lonnet();  use Apache::lonnet;
   use Apache::lonlocal;
 use Apache::Constants qw(:common :http :methods);  use Apache::Constants qw(:common :http :methods);
   
 sub content_date_check {  sub content_date_check {
     my $symb=$ENV{'request.symb'};      my $symb=$env{'request.symb'};
     my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb);      my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb);
     my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb);      my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb);
     if ( (defined($open)  && $open  ne '' && time < $open) ||      if ( (defined($open)  && $open  ne '' && time < $open) ) {
  (defined($close) && $close ne '' && time > $close)) {   return ('CLOSED',$open,$close,
  return ('CLOSED',$open,$close);   &mt("This resource currently isn't open. ".
       "It will be available at [_1].",
       &Apache::lonlocal::locallocaltime($open)));
       }
       if ( (defined($close) && $close ne '' && time > $close) ) {
    return ('CLOSED',$open,$close,
    &mt("This resource is no longer available to be viewed."));
     }      }
     return ('OPEN',$open,$close);      return ('OPEN',$open,$close);
 }  }
   
 sub handler {  sub handler {
     my ($r)=@_;      my ($r)=@_;
     my ($status)=&content_date_check();      if (&Apache::lonnet::allowed('bre',$r->uri) eq 'F') {
    return DECLINED;
       }
       my ($status,$open,$close,$msg)=&content_date_check();
     if ($status ne 'OPEN') {      if ($status ne 'OPEN') {
  $r->set_handlers('PerlHandler'=>undef);   $r->set_handlers('PerlHandler'=>undef);
  &Apache::loncommon::content_type($r,'text/html');   &Apache::loncommon::content_type($r,'text/html');
  $r->send_http_header;   $r->send_http_header;
  return OK if $r->header_only;   return OK if $r->header_only;
  $r->print('<html><head><title>Go Away!</title>');   $r->print('<html><head><title>'.&mt("Not Open").'</title>');
  my $addentries=' onLoad="'.&Apache::lonmenu::loadevents().   my $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
     '" onUnload="'.&Apache::lonmenu::unloadevents().'"';      '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
  $r->print(&Apache::lonmenu::registerurl(1));   $r->print(&Apache::lonmenu::registerurl(1));
  $r->print('</head>'.   $r->print('</head>'.
   &Apache::loncommon::bodytag('Go Away!','',$addentries,'','',    &Apache::loncommon::bodytag('','',$addentries,'','',
       undef));        undef));
   
    $r->print($msg);
  $r->print('</body></html>');   $r->print('</body></html>');
  $r->print("Go Away!");   return OK;
     }      }
     return OK;      return DECLINED;
 }  }
 1;  1;

Removed from v.1.3  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.