version 1.3, 2006/12/05 02:55:56
|
version 1.4, 2007/10/02 01:10:16
|
Line 1
|
Line 1
|
|
|
# The LearningOnline Network |
# The LearningOnline Network |
# URL translation for encrypted filenames |
# URL translation for encrypted filenames |
# |
# |
Line 30 package Apache::lonencurl;
|
Line 31 package Apache::lonencurl;
|
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :remotehost); |
use Apache::Constants qw(:common :remotehost); |
use CGI::Cookie(); |
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonenc; |
use Apache::lonenc; |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
|
my $lonid=$cookies{'lonID'}; |
$env{'request.enc'}=1; |
my $cookie; |
|
if ($lonid) { |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my $handle=&LONCAPA::clean_handle($lonid->value); |
if ($handle ne '') { |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
$env{'request.enc'}=1; |
|
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { |
|
# Initialize Environment |
# Initialize Environment |
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); |
# Decrypt URL and redirect |
# Decrypt URL and redirect |
my $redirect=&Apache::lonenc::unencrypted($r->uri); |
my $redirect=&Apache::lonenc::unencrypted($r->uri); |
if ($r->args) { $redirect.='?'.$r->args; } |
if ($r->args) { $redirect.='?'.$r->args; } |
$r->internal_redirect($redirect); |
$r->internal_redirect($redirect); |
return OK; |
return OK; |
} |
|
} |
} |
return FORBIDDEN; |
return FORBIDDEN; |
} |
} |