version 1.139, 2012/08/21 17:51:58
|
version 1.144, 2013/05/10 17:49:17
|
Line 105 use Apache::lonlocal;
|
Line 105 use Apache::lonlocal;
|
use Apache::restrictedaccess(); |
use Apache::restrictedaccess(); |
use Apache::blockedaccess(); |
use Apache::blockedaccess(); |
use Fcntl qw(:flock); |
use Fcntl qw(:flock); |
use LONCAPA; |
use LONCAPA qw(:DEFAULT :match); |
|
|
sub cleanup { |
sub cleanup { |
my ($r)=@_; |
my ($r)=@_; |
Line 275 sub sso_login {
|
Line 275 sub sso_login {
|
my ($r,$handle) = @_; |
my ($r,$handle) = @_; |
|
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
if (!($r->user |
if (($r->user eq '') || |
&& (!defined($env{'user.name'}) && !defined($env{'user.domain'})) |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
&& ($handle eq ''))) { |
&& ($handle ne ''))) { |
# not an SSO case or already logged in |
# not an SSO case or already logged in |
return undef; |
return undef; |
} |
} |
Line 396 sub handler {
|
Line 396 sub handler {
|
} |
} |
|
|
my ($is_balancer,$otherserver); |
my ($is_balancer,$otherserver); |
|
|
if ($handle eq '') { |
if ($handle eq '') { |
$r->log_reason("Cookie $handle not valid", $r->filename); |
unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) { |
|
$r->log_reason("Cookie $handle not valid", $r->filename); |
|
} |
} elsif ($handle ne '') { |
} elsif ($handle ne '') { |
|
|
# ------------------------------------------------------ Initialize Environment |
# ------------------------------------------------------ Initialize Environment |
Line 415 sub handler {
|
Line 417 sub handler {
|
if ($env{'user.name'} ne '' && $env{'user.domain'} ne '') { |
if ($env{'user.name'} ne '' && $env{'user.domain'} ne '') { |
# -------------------------------------------------------------- Resource State |
# -------------------------------------------------------------- Resource State |
|
|
|
my ($cdom,$cnum); |
|
if ($env{'request.course.id'}) { |
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
} |
if ($requrl=~/^\/+(res|uploaded)\//) { |
if ($requrl=~/^\/+(res|uploaded)\//) { |
$env{'request.state'} = "published"; |
$env{'request.state'} = "published"; |
} else { |
} else { |
Line 422 sub handler {
|
Line 429 sub handler {
|
} |
} |
$env{'request.filename'} = $r->filename; |
$env{'request.filename'} = $r->filename; |
$env{'request.noversionuri'} = &Apache::lonnet::deversion($requrl); |
$env{'request.noversionuri'} = &Apache::lonnet::deversion($requrl); |
|
my $suppext; |
if ($requrl =~ m{^/adm/wrapper/ext/}) { |
if ($requrl =~ m{^/adm/wrapper/ext/}) { |
my $query = $r->args; |
my $query = $r->args; |
if ($query) { |
if ($query) { |
Line 431 sub handler {
|
Line 439 sub handler {
|
unless ($name eq 'symb') { |
unless ($name eq 'symb') { |
$preserved .= $pair.'&'; |
$preserved .= $pair.'&'; |
} |
} |
|
if (($env{'request.course.id'}) && ($name eq 'folderpath')) { |
|
if ($value =~ /^supplemental/) { |
|
$suppext = 1; |
|
} |
|
} |
} |
} |
$preserved =~ s/\&$//; |
$preserved =~ s/\&$//; |
if ($preserved) { |
if ($preserved) { |
$env{'request.external.querystring'} = $preserved; |
$env{'request.external.querystring'} = $preserved; |
} |
} |
} |
} |
|
} elsif ($env{'request.course.id'} && |
|
(($requrl =~ m{^/adm/$match_domain/$match_username/aboutme$}) || |
|
($requrl =~ m{^/public/$cdom/$cnum/syllabus$}))) { |
|
my $query = $r->args; |
|
if ($query) { |
|
foreach my $pair (split(/&/,$query)) { |
|
my ($name, $value) = split(/=/,$pair); |
|
if ($name eq 'folderpath') { |
|
if ($value =~ /^supplemental/) { |
|
$suppext = 1; |
|
} |
|
} |
|
} |
|
} |
} |
} |
# -------------------------------------------------------- Load POST parameters |
# -------------------------------------------------------- Load POST parameters |
|
|
Line 543 sub handler {
|
Line 570 sub handler {
|
# ------------------------------------- This is serious stuff, get symb and log |
# ------------------------------------- This is serious stuff, get symb and log |
my $symb; |
my $symb; |
if ($query) { |
if ($query) { |
&Apache::loncommon::get_unprocessed_cgi($query,['symb']); |
&Apache::loncommon::get_unprocessed_cgi($query,['symb','folderpath']); |
} |
} |
if ($env{'form.symb'}) { |
if ($env{'form.symb'}) { |
$symb=&Apache::lonnet::symbclean($env{'form.symb'}); |
$symb=&Apache::lonnet::symbclean($env{'form.symb'}); |
Line 571 sub handler {
|
Line 598 sub handler {
|
if ($requrl=~m{^(/adm/.*/aboutme)/portfolio$}) { |
if ($requrl=~m{^(/adm/.*/aboutme)/portfolio$}) { |
$requrl = $1; |
$requrl = $1; |
} |
} |
$symb=&Apache::lonnet::symbread($requrl); |
unless ($suppext) { |
if (&Apache::lonnet::is_on_map($requrl) && $symb && |
$symb=&Apache::lonnet::symbread($requrl); |
!&Apache::lonnet::symbverify($symb,$requrl)) { |
if (&Apache::lonnet::is_on_map($requrl) && $symb && |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
!&Apache::lonnet::symbverify($symb,$requrl)) { |
$env{'user.error.msg'}= |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
"$requrl:bre:1:1:Invalid Access"; |
$env{'user.error.msg'}= |
return HTTP_NOT_ACCEPTABLE; |
"$requrl:bre:1:1:Invalid Access"; |
} |
return HTTP_NOT_ACCEPTABLE; |
if ($symb) { |
} |
my ($map,$mid,$murl)= |
if ($symb) { |
&Apache::lonnet::decode_symb($symb); |
my ($map,$mid,$murl)= |
&Apache::lonnet::symblist($map,$murl =>[$murl,$mid], |
&Apache::lonnet::decode_symb($symb); |
'last_known' =>[$murl,$mid]); |
&Apache::lonnet::symblist($map,$murl =>[$murl,$mid], |
|
'last_known' =>[$murl,$mid]); |
|
} |
} |
} |
} |
} |
$env{'request.symb'}=$symb; |
$env{'request.symb'}=$symb; |
Line 592 sub handler {
|
Line 621 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'};; |
if ($requrl =~ m{^/+uploaded/\Q$cdom\E/\Q$cnum\E/(docs|supplemental)/.+\.html?$}) { |
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 (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
if ($query) { |
if ($query) { |
&Apache::loncommon::get_unprocessed_cgi($query,['forceedit']); |
&Apache::loncommon::get_unprocessed_cgi($query,['forceedit']); |
Line 602 sub handler {
|
Line 629 sub handler {
|
$env{'request.state'} = 'edit'; |
$env{'request.state'} = 'edit'; |
} |
} |
} |
} |
|
} |
|
} elsif ($requrl =~ m{^/+uploaded/\Q$cdom\E/\Q$cnum\E/portfolio/syllabus/.+\.html?$}) { |
|
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
|
if ($query) { |
|
&Apache::loncommon::get_unprocessed_cgi($query,['forceedit','editmode']); |
|
if (($env{'form.forceedit'}) || ($env{'form.editmode'})) { |
|
$env{'request.state'} = 'edit'; |
|
} |
|
} |
} |
} |
} |
} |
} |
} |