version 1.318.2.4, 2006/02/09 23:41:22
|
version 1.321, 2006/02/21 18:43:37
|
Line 2915 sub dump_profile_database {
|
Line 2915 sub dump_profile_database {
|
while (my ($key,$value) = each(%$hashref)) { |
while (my ($key,$value) = each(%$hashref)) { |
my ($v,$symb,$param) = split(/:/,$key); |
my ($v,$symb,$param) = split(/:/,$key); |
next if ($v eq 'version' || $symb eq 'keys'); |
next if ($v eq 'version' || $symb eq 'keys'); |
# making old style store entries '$ver:$symb:$key = $value' |
next if (exists($data{$symb}) && |
# look like new '$ver:$symb = "$key=$value"' |
exists($data{$symb}->{$param}) && |
if (defined($param)) { $value = $param.'='.$value; } |
$data{$symb}->{'v.'.$param} > $v); |
foreach my $pair (split(/\&/,$value)) { |
$data{$symb}->{$param}=$value; |
my ($param,$value)=split(/=/,$pair); |
$data{$symb}->{'v.'.$param}=$v; |
next if (exists($data{$symb}) && |
|
exists($data{$symb}->{$param}) && |
|
$data{$symb}->{'v.'.$param} > $v); |
|
$data{$symb}->{$param}=$value; |
|
$data{$symb}->{'v.'.$param}=$v; |
|
} |
|
} |
} |
if (&untie_user_hash($hashref)) { |
if (&untie_user_hash($hashref)) { |
while (my ($symb,$param_hash) = each(%data)) { |
while (my ($symb,$param_hash) = each(%data)) { |
Line 3074 sub store_handler {
|
Line 3068 sub store_handler {
|
my $version=$hashref->{"version:$rid"}; |
my $version=$hashref->{"version:$rid"}; |
my $allkeys=''; |
my $allkeys=''; |
foreach my $pair (@pairs) { |
foreach my $pair (@pairs) { |
my ($key)=split(/=/,$pair); |
my ($key,$value)=split(/=/,$pair); |
$allkeys.=$key.':'; |
$allkeys.=$key.':'; |
|
$hashref->{"$version:$rid:$key"}=$value; |
} |
} |
$hashref->{"$version:$rid"}=$what."\×tamp=$now"; |
$hashref->{"$version:$rid:timestamp"}=$now; |
$allkeys.='timestamp'; |
$allkeys.='timestamp'; |
$hashref->{"$version:keys:$rid"}=$allkeys; |
$hashref->{"$version:keys:$rid"}=$allkeys; |
if (&untie_user_hash($hashref)) { |
if (&untie_user_hash($hashref)) { |
Line 3143 sub restore_handler {
|
Line 3138 sub restore_handler {
|
my @keys=split(/:/,$vkeys); |
my @keys=split(/:/,$vkeys); |
my $key; |
my $key; |
$qresult.="$scope:keys=$vkeys&"; |
$qresult.="$scope:keys=$vkeys&"; |
if (exists($hashref->{"$scope:$rid"})) { |
foreach $key (@keys) { |
my $what=$hashref->{"$scope:$rid"}; |
$qresult.="$scope:$key=".$hashref->{"$scope:$rid:$key"}."&"; |
foreach my $pair (split(/\&/,$hashref->{"$scope:$rid"})) { |
} |
my ($key,$value)=split(/=/,$pair); |
|
$qresult.="$scope:".$pair."&"; |
|
} |
|
} else { |
|
foreach $key (@keys) { |
|
$qresult.="$scope:$key=".$hashref->{"$scope:$rid:$key"}."&"; |
|
} |
|
} |
|
} |
} |
if (&untie_user_hash($hashref)) { |
if (&untie_user_hash($hashref)) { |
$qresult=~s/\&$//; |
$qresult=~s/\&$//; |
Line 4361 sub photo_permission_handler {
|
Line 4348 sub photo_permission_handler {
|
my $userinput = "$cmd:$tail"; |
my $userinput = "$cmd:$tail"; |
my $cdom = $tail; |
my $cdom = $tail; |
my ($perm_reqd,$conditions); |
my ($perm_reqd,$conditions); |
my $outcome = &localenroll::photo_permission($cdom,\$perm_reqd, |
my $outcome; |
\$conditions); |
eval { |
&Reply($client, &escape($outcome.':'.$perm_reqd.':'. $conditions)."\n", |
local($SIG{__DIE__})='DEFAULT'; |
$userinput); |
$outcome = &localenroll::photo_permission($cdom,\$perm_reqd, |
|
\$conditions); |
|
}; |
|
if (!$@) { |
|
&Reply($client, &escape($outcome.':'.$perm_reqd.':'. $conditions)."\n", |
|
$userinput); |
|
} else { |
|
&Failure($client,"unknown_cmd\n",$userinput); |
|
} |
|
return 1; |
} |
} |
®ister_handler("autophotopermission",\&photo_permission_handler,0,1,0); |
®ister_handler("autophotopermission",\&photo_permission_handler,0,1,0); |
|
|
Line 4389 sub photo_check_handler {
|
Line 4385 sub photo_check_handler {
|
my $result = &localstudentphoto::fetch($udom,$uname,$pid,\$response); |
my $result = &localstudentphoto::fetch($udom,$uname,$pid,\$response); |
$result .= ':'.$response; |
$result .= ':'.$response; |
&Reply($client, &escape($result)."\n",$userinput); |
&Reply($client, &escape($result)."\n",$userinput); |
|
return 1; |
} |
} |
®ister_handler("autophotocheck",\&photo_check_handler,0,1,0); |
®ister_handler("autophotocheck",\&photo_check_handler,0,1,0); |
|
|
Line 4402 sub photo_choice_handler {
|
Line 4399 sub photo_choice_handler {
|
my ($cmd, $tail, $client) = @_; |
my ($cmd, $tail, $client) = @_; |
my $userinput = "$cmd:$tail"; |
my $userinput = "$cmd:$tail"; |
my $cdom = &unescape($tail); |
my $cdom = &unescape($tail); |
my ($update,$comment) = &localenroll::manager_photo_update($cdom); |
my ($update,$comment); |
&Reply($client,&escape($update).':'.&escape($comment)."\n",$userinput); |
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
($update,$comment) = &localenroll::manager_photo_update($cdom); |
|
}; |
|
if (!$@) { |
|
&Reply($client,&escape($update).':'.&escape($comment)."\n",$userinput); |
|
} else { |
|
&Failure($client,"unknown_cmd\n",$userinput); |
|
} |
|
return 1; |
} |
} |
®ister_handler("autophotochoice",\&photo_choice_handler,0,1,0); |
®ister_handler("autophotochoice",\&photo_choice_handler,0,1,0); |
|
|
Line 4436 sub student_photo_handler {
|
Line 4442 sub student_photo_handler {
|
&mkpath($path); |
&mkpath($path); |
my $file; |
my $file; |
if ($type eq 'thumbnail') { |
if ($type eq 'thumbnail') { |
$file=&localstudentphoto::fetch_thumbnail($domain,$uname); |
eval { |
|
local($SIG{__DIE__})='DEFAULT'; |
|
$file=&localstudentphoto::fetch_thumbnail($domain,$uname); |
|
}; |
} else { |
} else { |
$file=&localstudentphoto::fetch($domain,$uname); |
$file=&localstudentphoto::fetch($domain,$uname); |
} |
} |
Line 5159 sub sub_sql_reply {
|
Line 5168 sub sub_sql_reply {
|
Type => SOCK_STREAM, |
Type => SOCK_STREAM, |
Timeout => 10) |
Timeout => 10) |
or return "con_lost"; |
or return "con_lost"; |
print $sclient "$cmd\n"; |
print $sclient "$cmd:$currentdomainid\n"; |
my $answer=<$sclient>; |
my $answer=<$sclient>; |
chomp($answer); |
chomp($answer); |
if (!$answer) { $answer="con_lost"; } |
if (!$answer) { $answer="con_lost"; } |
Line 5494 sub is_author {
|
Line 5503 sub is_author {
|
|
|
# Author role should show up as a key /domain/_au |
# Author role should show up as a key /domain/_au |
|
|
my $key = "/$domain/_au"; |
my $key = "/$domain/_au"; |
my $value = $hashref->{$key}; |
my $value; |
|
if (defined($hashref)) { |
|
$value = $hashref->{$key}; |
|
} |
|
|
if(defined($value)) { |
if(defined($value)) { |
&Debug("$user @ $domain is an author"); |
&Debug("$user @ $domain is an author"); |