version 1.36, 2000/10/05 19:27:23
|
version 1.37, 2000/10/06 21:00:05
|
Line 59
|
Line 59
|
# 08/22,08/28,08/31,09/01,09/02,09/04,09/05,09/25,09/28,09/30 Gerd Kortemeyer |
# 08/22,08/28,08/31,09/01,09/02,09/04,09/05,09/25,09/28,09/30 Gerd Kortemeyer |
# 10/04 Gerd Kortemeyer |
# 10/04 Gerd Kortemeyer |
# 10/04 Guy Albertelli |
# 10/04 Guy Albertelli |
|
# 10/06 Gerd Kortemeyer |
|
|
package Apache::lonnet; |
package Apache::lonnet; |
|
|
Line 428 sub log {
|
Line 428 sub log {
|
sub store { |
sub store { |
my %storehash=@_; |
my %storehash=@_; |
my $symb; |
my $symb; |
unless ($symb=escape(&symbread())) { return ''; } |
unless ($symb=escape(&symbread($ENV{'request.filename'}))) { return ''; } |
my $namespace; |
my $namespace; |
unless ($namespace=$ENV{'request.course.id'}) { return ''; } |
unless ($namespace=$ENV{'request.course.id'}) { return ''; } |
my $namevalue=''; |
my $namevalue=''; |
Line 445 sub store {
|
Line 445 sub store {
|
|
|
sub restore { |
sub restore { |
my $symb; |
my $symb; |
unless ($symb=escape(&symbread())) { return ''; } |
unless ($symb=escape(&symbread($ENV{'request.filename'}))) { return ''; } |
my $namespace; |
my $namespace; |
unless ($namespace=$ENV{'request.course.id'}) { return ''; } |
unless ($namespace=$ENV{'request.course.id'}) { return ''; } |
my $answer=reply( |
my $answer=reply( |
Line 1016 sub symblist {
|
Line 1016 sub symblist {
|
# ------------------------------------------------------ Return symb list entry |
# ------------------------------------------------------ Return symb list entry |
|
|
sub symbread { |
sub symbread { |
|
my $thisfn=declutter(shift); |
my %hash; |
my %hash; |
my $syval; |
my %bighash; |
|
my $syval=''; |
if (($ENV{'request.course.fn'}) && ($ENV{'request.filename'})) { |
if (($ENV{'request.course.fn'}) && ($ENV{'request.filename'})) { |
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db', |
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db', |
&GDBM_READER,0640)) { |
&GDBM_READER,0640)) { |
my $thisfn=declutter($ENV{'request.filename'}); |
|
$syval=$hash{$thisfn}; |
$syval=$hash{$thisfn}; |
if (untie(%hash)) { |
untie(%hash); |
unless ($syval=~/\_\d+$/) { |
|
unless ($ENV{'form.request.prefix'}=~/\.(\d+)\_$/) { |
|
return ''; |
|
} |
|
$syval.=$1; |
|
} |
|
$syval.='___'.$thisfn; |
|
return $syval; |
|
} |
|
} |
} |
|
# ---------------------------------------------------------- There was an entry |
|
if ($syval) { |
|
unless ($syval=~/\_\d+$/) { |
|
unless ($ENV{'form.request.prefix'}=~/\.(\d+)\_$/) { |
|
return ''; |
|
} |
|
$syval.=$1; |
|
} |
|
} else { |
|
# ------------------------------------------------------- Was not in symb table |
|
if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', |
|
&GDBM_READER,0640)) { |
|
# ---------------------------------------------- Get ID(s) for current resource |
|
my $ids=$bighash{'ids_/res/'.$thisfn}; |
|
if ($ids) { |
|
# ------------------------------------------------------------------- Has ID(s) |
|
my @possibilities=split(/\,/,$ids); |
|
if ($#possibilities==1) { |
|
my ($mapid,$resid)=split(/\./,$ids); |
|
$syval=declutter($bighash{'map_id_'.$mapid}).'___'.$resid; |
|
} else { |
|
$syval=''; |
|
} |
|
} |
|
untie(%bighash) |
|
} |
|
} |
|
return $syval.'___'.$thisfn; |
} |
} |
return ''; |
return ''; |
} |
} |
Line 1054 sub numval {
|
Line 1074 sub numval {
|
|
|
sub rndseed { |
sub rndseed { |
my $symb; |
my $symb; |
unless ($symb=&symbread()) { return ''; } |
unless ($symb=&symbread($ENV{'request.filename'})) { return ''; } |
my $symbchck=unpack("%32C*",$symb); |
my $symbchck=unpack("%32C*",$symb); |
my $symbseed=numval($symb)%$symbchck; |
my $symbseed=numval($symb)%$symbchck; |
my $namechck=unpack("%32C*",$ENV{'user.name'}); |
my $namechck=unpack("%32C*",$ENV{'user.name'}); |
Line 1071 sub rndseed {
|
Line 1091 sub rndseed {
|
# returns either the contents of the file or a -1 |
# returns either the contents of the file or a -1 |
sub getfile { |
sub getfile { |
my $file=shift; |
my $file=shift; |
if (! -e $file ) { |
&repcopy($file); |
&subscribe($file); |
|
&repcopy($file); |
|
} |
|
if (! -e $file ) { return -1; }; |
if (! -e $file ) { return -1; }; |
my $fh=Apache::File->new($file); |
my $fh=Apache::File->new($file); |
my $a=''; |
my $a=''; |