version 1.47, 2003/09/16 18:15:43
|
version 1.64, 2005/04/07 06:56:20
|
Line 66 sub handler {
|
Line 66 sub handler {
|
|
|
# --------------------------------------------------------- Initialize Language |
# --------------------------------------------------------- Initialize Language |
|
|
&Apache::lonlocal::get_language_handle(); |
&Apache::lonlocal::get_language_handle($r); |
|
|
# -------------------------------------------------------------- Resource State |
# -------------------------------------------------------------- Resource State |
|
|
if ($requrl=~/^\/res\//) { |
if ($requrl=~/^\/+(res|uploaded)\//) { |
$ENV{'request.state'} = "published"; |
$env{'request.state'} = "published"; |
} else { |
} else { |
$ENV{'request.state'} = 'unknown'; |
$env{'request.state'} = 'unknown'; |
} |
} |
$ENV{'request.filename'} = $r->filename; |
$env{'request.filename'} = $r->filename; |
|
$env{'request.noversionuri'} = &Apache::lonnet::deversion($requrl); |
# -------------------------------------------------------- Load POST parameters |
# -------------------------------------------------------- Load POST parameters |
|
|
&Apache::loncommon::get_posted_cgi($r); |
&Apache::loncommon::get_posted_cgi($r); |
Line 86 sub handler {
|
Line 86 sub handler {
|
if ($requrl!~/^\/adm|public|prtspool\//) { |
if ($requrl!~/^\/adm|public|prtspool\//) { |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
if ($access eq '1') { |
if ($access eq '1') { |
$ENV{'user.error.msg'}="$requrl:bre:0:0:Choose Course"; |
$env{'user.error.msg'}="$requrl:bre:0:0:Choose Course"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
if (($access ne '2') && ($access ne 'F')) { |
if (($access ne '2') && ($access ne 'F')) { |
$ENV{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
} |
} |
if ($requrl =~ m|^/prtspool/|) { |
if ($requrl =~ m|^/prtspool/|) { |
my $start='/prtspool/'.$ENV{'user.name'}.'_'. |
my $start='/prtspool/'.$env{'user.name'}.'_'. |
$ENV{'user.domain'}; |
$env{'user.domain'}; |
if ($requrl !~ /^\Q$start\E/) { |
if ($requrl !~ /^\Q$start\E/) { |
$ENV{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
} |
} |
# ------------------------------------------------------------- This is allowed |
# ------------------------------------------------------------- This is allowed |
if ($ENV{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
&Apache::lonnet::countacc($requrl); |
&Apache::lonnet::countacc($requrl); |
$requrl=~/\.(\w+)$/; |
$requrl=~/\.(\w+)$/; |
if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$)/) || |
($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$)/) || |
($requrl=~/^\/adm\/wrapper\//) || |
($requrl=~/^\/adm\/wrapper\//) || |
|
($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 $query=$r->args; |
Line 116 sub handler {
|
Line 117 sub handler {
|
if ($query) { |
if ($query) { |
&Apache::loncommon::get_unprocessed_cgi($query,['symb']); |
&Apache::loncommon::get_unprocessed_cgi($query,['symb']); |
} |
} |
if ($ENV{'form.symb'}) { |
if ($env{'form.symb'}) { |
$symb=&Apache::lonnet::symbclean($ENV{'form.symb'}); |
$symb=&Apache::lonnet::symbclean($env{'form.symb'}); |
if (&Apache::lonnet::symbverify($symb,$requrl)) { |
if ($requrl =~ m|^/adm/wrapper/|) { |
my ($map,$mid,$murl)=split(/\_\_\_/,$symb); |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
&Apache::lonnet::symblist($map,$murl => $mid, |
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
'last_known' => $murl); |
'last_known' =>[$murl,$mid]); |
|
} elsif ((&Apache::lonnet::symbverify($symb,$requrl)) || |
|
(($requrl=~m|(.*)/smpedit$|) && |
|
&Apache::lonnet::symbverify($symb,$1))) { |
|
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
|
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
|
'last_known' =>[$murl,$mid]); |
} else { |
} else { |
$r->log_reason('Invalid symb for '.$requrl.': '. |
$r->log_reason('Invalid symb for '.$requrl.': '. |
$symb); |
$symb); |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"$requrl:bre:1:1:Invalid Access"; |
"$requrl:bre:1:1:Invalid Access"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
} else { |
} else { |
$symb=&Apache::lonnet::symbread($requrl); |
$symb=&Apache::lonnet::symbread($requrl); |
my ($map,$mid,$murl)=split(/\_\_\_/,$symb); |
if (&Apache::lonnet::is_on_map($requrl) && $symb && |
&Apache::lonnet::symblist($map,$murl => $mid, |
!&Apache::lonnet::symbverify($symb,$requrl)) { |
'last_known' => $murl); |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
|
$env{'user.error.msg'}= |
|
"$requrl:bre:1:1:Invalid Access"; |
|
return HTTP_NOT_ACCEPTABLE; |
|
} |
|
if ($symb) { |
|
my ($map,$mid,$murl)=split(/\_\_\_/,$symb); |
|
&Apache::lonnet::symblist($map,$murl =>[$murl,$mid], |
|
'last_known' =>[$murl,$mid]); |
|
} |
} |
} |
$ENV{'request.symb'}=$symb; |
$env{'request.symb'}=$symb; |
&Apache::lonnet::courseacclog($symb); |
&Apache::lonnet::courseacclog($symb); |
} else { |
} else { |
# ------------------------------------------------------- This is other content |
# ------------------------------------------------------- This is other content |
Line 152 sub handler {
|
Line 168 sub handler {
|
if ($requrl=~m|^/public/| |
if ($requrl=~m|^/public/| |
|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) { |
|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) { |
&Apache::lonnet::logthis('Granting public access: '.$requrl); |
&Apache::lonnet::logthis('Granting public access: '.$requrl); |
my $buffer; |
&Apache::loncommon::get_posted_cgi($r); |
$r->read($buffer,$r->header_in('Content-length'),0); |
$env{'user.name'}='public'; |
&Apache::loncommon::get_unprocessed_cgi($buffer); |
$env{'user.domain'}='public'; |
$ENV{'user.name'}='public'; |
$env{'request.state'} = "published"; |
$ENV{'user.domain'}='public'; |
$env{'request.publicaccess'} = 1; |
$ENV{'request.state'} = "published"; |
$env{'request.filename'} = $r->filename; |
$ENV{'request.publicaccess'} = 1; |
my ($httpbrowser, $clientbrowser, $clientversion, |
$ENV{'request.filename'} = $r->filename; |
$clientmathml, $clientunicode, $clientos) = |
|
&Apache::loncommon::decode_user_agent($r); |
|
$env{'browser.type'}=$clientbrowser; |
|
$env{'browser.version'}=$clientversion; |
|
$env{'browser.mathml'}=$clientmathml; |
|
$env{'browser.unicode'}=$clientunicode; |
|
$env{'browser.os'}=$clientos; |
|
|
return OK; |
return OK; |
} |
} |
# -------------------------------------------------------------- Not authorized |
# -------------------------------------------------------------- Not authorized |
$requrl=~/\.(\w+)$/; |
$requrl=~/\.(\w+)$/; |
if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) || |
# ($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) || |
($requrl=~m|^/prtspool/|)) { |
# ($requrl=~m|^/prtspool/|)) { |
# -------------------------- Store where they wanted to go and get login screen |
# -------------------------- Store where they wanted to go and get login screen |
$ENV{'request.querystring'}=$r->args; |
$env{'request.querystring'}=$r->args; |
$ENV{'request.firsturl'}=$requrl; |
$env{'request.firsturl'}=$requrl; |
return FORBIDDEN; |
return FORBIDDEN; |
} else { |
# } else { |
# --------------------------------------------------------------------- Goodbye |
# --------------------------------------------------------------------- Goodbye |
return HTTP_BAD_REQUEST; |
# return HTTP_BAD_REQUEST; |
} |
# } |
} |
} |
|
|
1; |
1; |