version 1.6, 2006/04/10 17:46:04
|
version 1.8, 2006/09/19 21:36:31
|
Line 53 use strict;
|
Line 53 use strict;
|
use warnings FATAL=>'all'; |
use warnings FATAL=>'all'; |
no warnings 'uninitialized'; |
no warnings 'uninitialized'; |
|
|
|
use lib '/home/httpd/lib/perl/'; |
use CGI(); |
use CGI(); |
use CGI::Cookie(); |
use CGI::Cookie(); |
use Fcntl qw(:flock); |
use Fcntl qw(:flock); |
|
use LONCAPA; |
use LONCAPA::Configuration(); |
use LONCAPA::Configuration(); |
|
use GDBM_File; |
|
|
my $lonidsdir; |
my $lonidsdir; |
|
|
Line 141 Returns: undef
|
Line 144 Returns: undef
|
############################################# |
############################################# |
sub transfer_profile_to_env { |
sub transfer_profile_to_env { |
my ($handle)=@_; |
my ($handle)=@_; |
my @profile; |
if (tie(my %disk_env,'GDBM_File',"$lonidsdir/$handle.id",&GDBM_READER(), |
{ |
0640)) { |
open(IDFILE, "<$lonidsdir/$handle.id"); |
%Apache::lonnet::env = %disk_env; |
flock(IDFILE,LOCK_SH); |
untie(%disk_env); |
@profile=<IDFILE>; |
|
close(IDFILE); |
|
} |
|
foreach my $envrow (@profile) { |
|
chomp($envrow); |
|
my ($envname,$envvalue)=split(/=/,$envrow,2); |
|
$envname = &unescape($envname); |
|
$envvalue = &unescape($envvalue); |
|
$Apache::lonnet::env{$envname} = $envvalue; |
|
} |
} |
$Apache::lonnet::env{'user.environment'} = "$lonidsdir/$handle.id"; |
$Apache::lonnet::env{'user.environment'} = "$lonidsdir/$handle.id"; |
return undef; |
return undef; |
Line 162 sub transfer_profile_to_env {
|
Line 156 sub transfer_profile_to_env {
|
############################################# |
############################################# |
############################################# |
############################################# |
|
|
sub escape { |
|
my $str=shift; |
|
$str =~ s/(\W)/"%".unpack('H2',$1)/eg; |
|
return $str; |
|
} |
|
|
|
# ----------------------------------------------------- Un-Escape Special Chars |
|
|
|
sub unescape { |
|
my $str=shift; |
|
$str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
return $str; |
|
} |
|
|
|
|
|
=pod |
=pod |
|
|