Diff for /loncom/auth/lonacc.pm between versions 1.119 and 1.125

version 1.119, 2008/11/18 19:14:34 version 1.125, 2009/04/14 23:52:07
Line 87  store attempted access Line 87  store attempted access
   
 =back  =back
   
   =head1 NOTABLE SUBROUTINES
   
   =over
   
 =cut  =cut
   
   
Line 218  sub get_posted_cgi { Line 222  sub get_posted_cgi {
     $r->headers_in->unset('Content-length');      $r->headers_in->unset('Content-length');
 }  }
   
 #  =pod
 # Perform size checks for file uploads to essayresponse items in course context.  
 #  =item upload_size_allowed()
 # Add form.HWFILESIZE.$part_$id to %env with file size (MB)  
 # If file exceeds maximum allowed size, add form.HWFILETOOBIG.$part_$id to %env.   Perform size checks for file uploads to essayresponse items in course context.
 #  
    Add form.HWFILESIZE.$part_$id to %env with file size (MB)
    If file exceeds maximum allowed size, add form.HWFILETOOBIG.$part_$id to %env.
   
   =cut
     
 sub upload_size_allowed {  sub upload_size_allowed {
     my ($name,$size,$fname) = @_;      my ($name,$size,$fname) = @_;
     if ($name =~ /^HWFILE(\w+)$/) {      if ($name =~ /^HWFILE(\w+)$/) {
         my $ident = $1;          my $ident = $1;
         my $item = 'HWFILESIZE'.$ident;          my $item = 'HWFILESIZE'.$ident;
         &Apache::loncommon::add_to_env("form.$item",$size);          my $savesize = sprintf("%.6f",$size);
           &Apache::loncommon::add_to_env("form.$item",$savesize);
         my $maxsize= &Apache::lonnet::EXT("resource.$ident.maxfilesize");          my $maxsize= &Apache::lonnet::EXT("resource.$ident.maxfilesize");
         if (!$maxsize) {          if (!$maxsize) {
             $maxsize = 100.0;              $maxsize = 10.0; # FIXME This should become a domain configuration.
         }          }
         if ($size > $maxsize) {          if ($size > $maxsize) {
             my $warn = 'HWFILETOOBIG'.$ident;              my $warn = 'HWFILETOOBIG'.$ident;
Line 244  sub upload_size_allowed { Line 253  sub upload_size_allowed {
     return 'ok';      return 'ok';
 }  }
   
 # handle the case of the single sign on user, at this point $r->user   =pod
 # will be set and valid now need to find the loncapa user info and possibly  
 # balance them  =item sso_login()
 # returns OK if it was a SSO and user was handled  
 #         undef if not SSO or no means to hanle the user   handle the case of the single sign on user, at this point $r->user 
    will be set and valid now need to find the loncapa user info and possibly
    balance them
    returns OK if it was a SSO and user was handled
           undef if not SSO or no means to hanle the user
           
   =cut
   
 sub sso_login {  sub sso_login {
     my ($r,$handle) = @_;      my ($r,$handle) = @_;
Line 337  sub handler { Line 352  sub handler {
         return OK;          return OK;
     }      }
   
           if ($requrl =~ m{^/res/adm/pages/[^/]+\.(gif|png)$}) {
           return OK;
       }
   
     my $handle = &Apache::lonnet::check_for_valid_session($r);      my $handle = &Apache::lonnet::check_for_valid_session($r);
   
     my $result = &sso_login($r,$handle);      my $result = &sso_login($r,$handle);
Line 431  sub handler { Line 449  sub handler {
  if ($env{'request.course.id'}) {   if ($env{'request.course.id'}) {
     &Apache::lonnet::countacc($requrl);      &Apache::lonnet::countacc($requrl);
     $requrl=~/\.(\w+)$/;      $requrl=~/\.(\w+)$/;
               my $query=$r->args;
     if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||      if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||
  ($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$ )/x) ||   ($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$ )/x) ||
  ($requrl=~/^\/adm\/wrapper\//) ||   ($requrl=~/^\/adm\/wrapper\//) ||
Line 438  sub handler { Line 457  sub handler {
  ($requrl=~m|\.problem/smpedit$|) ||   ($requrl=~m|\.problem/smpedit$|) ||
  ($requrl=~/^\/public\/.*\/syllabus$/)) {   ($requrl=~/^\/public\/.*\/syllabus$/)) {
 # ------------------------------------- This is serious stuff, get symb and log  # ------------------------------------- This is serious stuff, get symb and log
  my $query=$r->args;  
  my $symb;   my $symb;
  if ($query) {   if ($query) {
     &Apache::loncommon::get_unprocessed_cgi($query,['symb']);      &Apache::loncommon::get_unprocessed_cgi($query,['symb']);
Line 485  sub handler { Line 503  sub handler {
 # ------------------------------------------------------- This is other content  # ------------------------------------------------------- This is other content
  &Apache::lonnet::courseacclog($requrl);       &Apache::lonnet::courseacclog($requrl);    
     }      }
               my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};;
               my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};;
               if ($requrl =~ m{^/+uploaded/\Q$cdom\E/\Q$cnum\E/docs/.+\.html?$}) {
                   if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
                       if ($query) {
                           &Apache::loncommon::get_unprocessed_cgi($query,['forceedit']);
                           if ($env{'form.forceedit'}) {
                               $env{'request.state'} = 'edit';
                           }
                       }
                   }
               }
  }   }
  return OK;   return OK;
     }      }
Line 522  sub handler { Line 552  sub handler {
   
 1;  1;
 __END__  __END__
   
   =pod
   
   =back
   
   =cut
   

Removed from v.1.119  
changed lines
  Added in v.1.125


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