version 1.149, 2001/08/16 11:25:03
|
version 1.150, 2001/08/16 16:57:31
|
Line 131 use Apache::File;
|
Line 131 use Apache::File;
|
use LWP::UserAgent(); |
use LWP::UserAgent(); |
use HTTP::Headers; |
use HTTP::Headers; |
use vars |
use vars |
qw(%perlvar %hostname %homecache %spareid %hostdom %libserv %pr %prp %fe %fd $readit %metacache %packagetab); |
qw(%perlvar %hostname %homecache %hostip %spareid %hostdom %libserv %pr %prp %fe %fd $readit %metacache %packagetab); |
use IO::Socket; |
use IO::Socket; |
use GDBM_File; |
use GDBM_File; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
Line 661 sub log {
|
Line 661 sub log {
|
|
|
# ----------------------------------------------------------- Check out an item |
# ----------------------------------------------------------- Check out an item |
|
|
|
|
sub checkout { |
sub checkout { |
my ($symb,$tuname,$tudom,$tcrsid)=@_; |
my ($symb,$tuname,$tudom,$tcrsid)=@_; |
my $now=time; |
my $now=time; |
Line 677 sub checkout {
|
Line 676 sub checkout {
|
$token=~s/^(\d+)\_.*\_(\d+)$/$1\*$2\*$lonhost/; |
$token=~s/^(\d+)\_.*\_(\d+)$/$1\*$2\*$lonhost/; |
$token=~tr/a-z/A-Z/; |
$token=~tr/a-z/A-Z/; |
|
|
my %infohash=('token' => $token, |
my %infohash=('outtoken' => $token, |
'checktime' => $now, |
'checkouttime' => $now, |
'remote' => $ENV{'REMOTE_ADDR'}); |
'outremote' => $ENV{'REMOTE_ADDR'}); |
|
|
unless (&cstore(\%infohash,$symb,$tcrsid,$tudom,$tuname) eq 'ok') { |
unless (&cstore(\%infohash,$symb,$tcrsid,$tudom,$tuname) eq 'ok') { |
return ''; |
return ''; |
Line 696 sub checkout {
|
Line 695 sub checkout {
|
|
|
sub checkin { |
sub checkin { |
my $token=shift; |
my $token=shift; |
|
my $now=time; |
|
my ($ta,$tb,$lonhost)=split(/\*/,$token); |
|
$lonhost=~tr/A-Z/a-z/; |
|
my $dtoken=$ta.'_'.$hostip{$lonhost}.'_'.$tb; |
|
$dtoken=~s/\W/\_/g; |
|
my ($tuname,$tudom,$tcrsid,$symb,$chtim,$rmaddr)= |
|
split(/\&/,&unescape(&reply('tmpget:'.$dtoken,$lonhost))); |
|
|
|
my %infohash=('intoken' => $token, |
|
'checkintime' => $now, |
|
'inremote' => $ENV{'REMOTE_ADDR'}); |
|
|
|
unless (&cstore(\%infohash,$symb,$tcrsid,$tudom,$tuname) eq 'ok') { |
|
return ''; |
|
} |
|
|
|
if (&log($tudom,$tuname,&homeserver($tuname,$tudom), |
|
&escape('Checkin - '.$token)) ne 'ok') { |
|
return ''; |
|
} |
|
|
|
return ($symb,$tuname,$tudom,$tcrsid); |
} |
} |
|
|
# --------------------------------------------- Set Expire Date for Spreadsheet |
# --------------------------------------------- Set Expire Date for Spreadsheet |
Line 2230 if ($readit ne 'done') {
|
Line 2251 if ($readit ne 'done') {
|
my ($id,$domain,$role,$name,$ip)=split(/:/,$configline); |
my ($id,$domain,$role,$name,$ip)=split(/:/,$configline); |
$hostname{$id}=$name; |
$hostname{$id}=$name; |
$hostdom{$id}=$domain; |
$hostdom{$id}=$domain; |
|
$hostip{$id}=$ip; |
if ($role eq 'library') { $libserv{$id}=$name; } |
if ($role eq 'library') { $libserv{$id}=$name; } |
} |
} |
} |
} |