version 1.209, 2002/04/26 18:49:09
|
version 1.213, 2002/05/07 19:16:15
|
Line 1139 sub store {
|
Line 1139 sub store {
|
|
|
if ($stuname) { $home=&homeserver($stuname,$domain); } |
if ($stuname) { $home=&homeserver($stuname,$domain); } |
|
|
|
$symb=&symbclean($symb); |
if (!$symb) { unless ($symb=&symbread()) { return ''; } } |
if (!$symb) { unless ($symb=&symbread()) { return ''; } } |
|
|
&devalidate($symb); |
&devalidate($symb); |
Line 1169 sub cstore {
|
Line 1170 sub cstore {
|
|
|
if ($stuname) { $home=&homeserver($stuname,$domain); } |
if ($stuname) { $home=&homeserver($stuname,$domain); } |
|
|
|
$symb=&symbclean($symb); |
if (!$symb) { unless ($symb=&symbread()) { return ''; } } |
if (!$symb) { unless ($symb=&symbread()) { return ''; } } |
|
|
&devalidate($symb); |
&devalidate($symb); |
Line 1204 sub restore {
|
Line 1206 sub restore {
|
if (!$symb) { |
if (!$symb) { |
unless ($symb=escape(&symbread())) { return ''; } |
unless ($symb=escape(&symbread())) { return ''; } |
} else { |
} else { |
$symb=&escape($symb); |
$symb=&escape(&symbclean($symb)); |
} |
} |
if (!$namespace) { |
if (!$namespace) { |
unless ($namespace=$ENV{'request.course.id'}) { |
unless ($namespace=$ENV{'request.course.id'}) { |
Line 2517 sub symblist {
|
Line 2519 sub symblist {
|
return 'error'; |
return 'error'; |
} |
} |
|
|
|
# --------------------------------------------------------------- Verify a symb |
|
|
|
sub symbverify { |
|
my ($symb,$thisfn)=@_; |
|
$thisfn=&declutter($thisfn); |
|
|
|
# &logthis("Symb verify: $symb $thisfn"); |
|
|
|
my ($map,$resid,$url)=split(/\_\_\_/,$symb); |
|
unless (&symbclean($url) eq &symbclean($thisfn)) { return 0; } |
|
|
|
return 1; |
|
|
|
my %bighash; |
|
my $okay=0; |
|
if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db', |
|
&GDBM_READER,0640)) { |
|
|
|
untie(%bighash); |
|
} |
|
return $okay; |
|
} |
|
|
|
# --------------------------------------------------------------- Clean-up symb |
|
|
|
sub symbclean { |
|
my $symb=shift; |
|
|
|
# &logthis("Symb in: $symb"); |
|
|
|
# remove version from map |
|
$symb=~s/\.(\d+)\.(\w+)\_\_\_/\.$2\_\_\_/; |
|
# remove version from URL |
|
$symb=~s/\.(\d+)\.(\w+)$/\.$2/; |
|
|
|
# &logthis("Symb out: $symb"); |
|
|
|
return $symb; |
|
} |
|
|
# ------------------------------------------------------ Return symb list entry |
# ------------------------------------------------------ Return symb list entry |
|
|
sub symbread { |
sub symbread { |
my $thisfn=shift; |
my $thisfn=shift; |
unless ($thisfn) { |
unless ($thisfn) { |
if ($ENV{'request.symb'}) { return $ENV{'request.symb'}; } |
if ($ENV{'request.symb'}) { return &symbclean($ENV{'request.symb'}); } |
$thisfn=$ENV{'request.filename'}; |
$thisfn=$ENV{'request.filename'}; |
} |
} |
$thisfn=declutter($thisfn); |
$thisfn=declutter($thisfn); |
Line 2581 sub symbread {
|
Line 2623 sub symbread {
|
} |
} |
} |
} |
if ($syval) { |
if ($syval) { |
return $syval.'___'.$thisfn; |
return &symbclean($syval.'___'.$thisfn); |
} |
} |
} |
} |
&appenv('request.ambiguous' => $thisfn); |
&appenv('request.ambiguous' => $thisfn); |