--- loncom/lond 2005/10/11 21:29:36 1.299 +++ loncom/lond 2006/01/21 08:26:52 1.306 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.299 2005/10/11 21:29:36 raeburn Exp $ +# $Id: lond,v 1.306 2006/01/21 08:26:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -59,7 +59,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.299 $'; #' stupid emacs +my $VERSION='$Revision: 1.306 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -1422,7 +1422,7 @@ sub ls_handler { open(FILE, $ulsdir.'/'.$ulsfn.".meta"); my @obsolete=; foreach my $obsolete (@obsolete) { - if($obsolete =~ m|()(on)|) { $obs = 1; } + if($obsolete =~ m/()(on|1)/) { $obs = 1; } if($obsolete =~ m|()(default)|) { $rights = 1; } } } @@ -1490,7 +1490,7 @@ sub ls2_handler { open(FILE, $ulsdir.'/'.$ulsfn.".meta"); my @obsolete=; foreach my $obsolete (@obsolete) { - if($obsolete =~ m|()(on)|) { $obs = 1; } + if($obsolete =~ m/()(on|1)/) { $obs = 1; } if($obsolete =~ m|()(default)|) { $rights = 1; } @@ -1978,6 +1978,7 @@ sub update_resource_handler { new Cache::Memcached({'servers'=>['127.0.0.1:11211']}); my $url=$fname; $url=~s-^/home/httpd/html--; + $url=~s-\.meta$--; my $id=&escape('meta:'.$url); $memcache->delete($id); } @@ -2894,22 +2895,39 @@ sub dump_with_regexp { my $userinput = "$cmd:$tail"; - my ($udom,$uname,$namespace,$regexp)=split(/:/,$tail); + my ($udom,$uname,$namespace,$regexp,$range)=split(/:/,$tail); if (defined($regexp)) { $regexp=&unescape($regexp); } else { $regexp='.'; } + my ($start,$end); + if (defined($range)) { + if ($range =~/^(\d+)\-(\d+)$/) { + ($start,$end) = ($1,$2); + } elsif ($range =~/^(\d+)$/) { + ($start,$end) = (0,$1); + } else { + undef($range); + } + } my $hashref = &tie_user_hash($udom, $uname, $namespace, &GDBM_READER()); if ($hashref) { my $qresult=''; + my $count=0; while (my ($key,$value) = each(%$hashref)) { if ($regexp eq '.') { + $count++; + if (defined($range) && $count >= $end) { last; } + if (defined($range) && $count < $start) { next; } $qresult.=$key.'='.$value.'&'; } else { my $unescapeKey = &unescape($key); if (eval('$unescapeKey=~/$regexp/')) { + $count++; + if (defined($range) && $count >= $end) { last; } + if (defined($range) && $count < $start) { next; } $qresult.="$key=$value&"; } } @@ -3586,11 +3604,7 @@ sub dump_dcmail_handler { } if (defined($sendersfilter)) { $sendersfilter=&unescape($sendersfilter); - if ($sendersfilter =~ /\&/) { - @senders = split(/\&/,$sendersfilter); - } else { - $senders[0] = $sendersfilter; - } + @senders = map { &unescape($_) } split(/\&/,$sendersfilter); } my $qresult=''; @@ -3598,11 +3612,9 @@ sub dump_dcmail_handler { if ($hashref) { while (my ($key,$value) = each(%$hashref)) { my $match = 1; - my ($timestamp,$subj,$uname,$udom) = split(/:/,&unescape($key),5); - $timestamp = &unescape($timestamp); + my ($timestamp,$subj,$uname,$udom) = + split(/:/,&unescape(&unescape($key)),5); # yes, twice really $subj = &unescape($subj); - $uname = &unescape($uname); - $udom = &unescape($udom); unless ($startfilter eq '.' || !defined($startfilter)) { if ($timestamp < $startfilter) { $match = 0; @@ -3721,11 +3733,7 @@ sub dump_domainroles_handler { } if (defined($rolesfilter)) { $rolesfilter=&unescape($rolesfilter); - if ($rolesfilter =~ /\&/) { - @roles = split(/\&/,$rolesfilter); - } else { - $roles[0] = $rolesfilter; - } + @roles = split(/\&/,$rolesfilter); } my $hashref = &tie_domain_hash($udom, "nohist_domainroles", &GDBM_WRCREAT());