version 1.65, 2005/04/22 20:55:40
|
version 1.70, 2005/11/29 21:12:03
|
Line 44 sub handler {
|
Line 44 sub handler {
|
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
my $lonid=$cookies{'lonID'}; |
my $lonid=$cookies{'lonID'}; |
my $cookie; |
my $cookie; |
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
|
|
my $handle; |
if ($lonid) { |
if ($lonid) { |
my $handle=$lonid->value; |
$handle=$lonid->value; |
$handle=~s/\W//g; |
$handle=~s/\W//g; |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
} |
|
|
|
if ($r->user |
|
&& (!$lonid || !-e "$lonidsdir/$handle.id" || $handle eq '') ) { |
|
my $domain = $r->dir_config('lonDefDomain'); |
|
my $home=&Apache::lonnet::homeserver($r->user,$domain); |
|
if ($home !~ /(con_lost|no_such_host)/) { |
|
$handle=&Apache::lonauth::success($r,$r->user,$domain, |
|
$home,'noredirect'); |
|
$r->header_out('Set-cookie',"lonID=$handle; path=/"); |
|
} |
|
} |
|
|
|
if ($r->dir_config("lonBalancer") eq 'yes') { |
|
$r->set_handlers('PerlResponseHandler'=> |
|
[\&Apache::switchserver::handler]); |
|
} |
|
|
|
if ($handle ne '') { |
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { |
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { |
|
|
# ------------------------------------------------------ Initialize Environment |
# ------------------------------------------------------ Initialize Environment |
Line 92 sub handler {
|
Line 113 sub handler {
|
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
} |
} |
|
if ($env{'user.name'} eq 'public' && |
|
$env{'user.domain'} eq 'public' && |
|
$requrl !~ m{^/+(res|public)/} && |
|
$requrl !~ m{^/+adm/(help|logout|randomlabel\.png)}) { |
|
$env{'request.querystring'}=$r->args; |
|
$env{'request.firsturl'}=$requrl; |
|
return FORBIDDEN; |
|
} |
# ------------------------------------------------------------- This is allowed |
# ------------------------------------------------------------- This is allowed |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
&Apache::lonnet::countacc($requrl); |
&Apache::lonnet::countacc($requrl); |
Line 159 sub handler {
|
Line 188 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 $cookie= |
|
&Apache::lonauth::success($r,'public','public','public'); |
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$cookie); |
&Apache::loncommon::get_posted_cgi($r); |
&Apache::loncommon::get_posted_cgi($r); |
$env{'user.name'}='public'; |
|
$env{'user.domain'}='public'; |
|
$env{'request.state'} = "published"; |
$env{'request.state'} = "published"; |
$env{'request.publicaccess'} = 1; |
$env{'request.publicaccess'} = 1; |
$env{'request.filename'} = $r->filename; |
$env{'request.filename'} = $r->filename; |
my ($httpbrowser, $clientbrowser, $clientversion, |
|
$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; |
|
|
|
|
$r->header_out('Set-cookie',"lonID=$cookie; path=/"); |
return OK; |
return OK; |
} |
} |
|
if ($requrl=~m|^/+adm/+help/+|) { |
|
return OK; |
|
} |
# -------------------------------------------------------------- Not authorized |
# -------------------------------------------------------------- Not authorized |
$requrl=~/\.(\w+)$/; |
$requrl=~/\.(\w+)$/; |
# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |