Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.247 and 1.251

version 1.247, 2002/06/27 16:03:55 version 1.251, 2002/07/04 15:56:17
Line 1741  sub allowed { Line 1741  sub allowed {
   
    if ($thisallowed=~/X/) {     if ($thisallowed=~/X/) {
       if ($ENV{'acc.randomout'}) {        if ($ENV{'acc.randomout'}) {
          my $symb=&symbread();           my $symb=&symbread($uri,1);
          if ($ENV{'acc.randomout'}=~/\&$symb\&/) { return ''; }           if (($symb) && ($ENV{'acc.randomout'}=~/\&$symb\&/)) { 
               return ''; 
            }
       }        }
       if (&condval($statecond)) {        if (&condval($statecond)) {
  return '2';   return '2';
Line 2269  sub courseresdata { Line 2271  sub courseresdata {
     my ($coursenum,$coursedomain,@which)=@_;      my ($coursenum,$coursedomain,@which)=@_;
     my $coursehom=&homeserver($coursenum,$coursedomain);      my $coursehom=&homeserver($coursenum,$coursedomain);
     my $hashid=$coursenum.':'.$coursedomain;      my $hashid=$coursenum.':'.$coursedomain;
     unless (defined($courseresdatacache{$hashid.'.time'})) {      my $dodump=0;
  unless (time-$courseresdatacache{$hashid.'.time'}<300) {      if (!defined($courseresdatacache{$hashid.'.time'})) {
            my $coursehom=&homeserver($coursenum,$coursedomain);   $dodump=1;
            if ($coursehom) {      } else {
               my $dumpreply=&reply('dump:'.$coursedomain.':'.$coursenum.   if (time-$courseresdatacache{$hashid.'.time'}>300) { $dodump=1; }
      ':resourcedata:.',$coursehom);  
       unless ($dumpreply=~/^error\:/) {  
          $courseresdatacache{$hashid.'.time'}=time;  
                  $courseresdatacache{$hashid}=$dumpreply;  
      }  
   }  
        }  
     }      }
    my @pairs=split(/\&/,$courseresdatacache{$hashid});      if ($dodump) {
    my %returnhash=();   my %dumpreply=&dump('resourcedata',$coursedomain,$coursenum);
    foreach (@pairs) {   my ($tmp) = keys(%dumpreply);
       my ($key,$value)=split(/=/,$_);   if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
       $returnhash{unescape($key)}=unescape($value);      $courseresdatacache{$hashid.'.time'}=time;
    }      $courseresdatacache{$hashid}=\%dumpreply;
     my $item;   }
    foreach $item (@which) {      }
        if ($returnhash{$item}) { return $returnhash{$item}; }      foreach my $item (@which) {
    }   if ($courseresdatacache{$hashid}->{$item}) {
    return '';      return $courseresdatacache{$hashid}->{$item};
    }
       }
       return '';
 }  }
   
 # --------------------------------------------------------- Value of a Variable  # --------------------------------------------------------- Value of a Variable
Line 2699  sub symbclean { Line 2697  sub symbclean {
 # ------------------------------------------------------ Return symb list entry  # ------------------------------------------------------ Return symb list entry
   
 sub symbread {  sub symbread {
     my $thisfn=shift;      my ($thisfn,$donotrecurse)=@_;
 # no filename provided? try from environment  # no filename provided? try from environment
     unless ($thisfn) {      unless ($thisfn) {
         if ($ENV{'request.symb'}) { return &symbclean($ENV{'request.symb'}); }          if ($ENV{'request.symb'}) { return &symbclean($ENV{'request.symb'}); }
Line 2748  sub symbread { Line 2746  sub symbread {
 # ----------------------------------------------- There is only one possibility  # ----------------------------------------------- There is only one possibility
      my ($mapid,$resid)=split(/\./,$ids);       my ($mapid,$resid)=split(/\./,$ids);
                      $syval=declutter($bighash{'map_id_'.$mapid}).'___'.$resid;                       $syval=declutter($bighash{'map_id_'.$mapid}).'___'.$resid;
                  } else {                   } elsif (!$donotrecurse) {
 # ------------------------------------------ There is more than one possibility  # ------------------------------------------ There is more than one possibility
                      my $realpossible=0;                       my $realpossible=0;
                      foreach (@possibilities) {                       foreach (@possibilities) {
Line 2763  sub symbread { Line 2761  sub symbread {
  }   }
                      }                       }
      if ($realpossible!=1) { $syval=''; }       if ($realpossible!=1) { $syval=''; }
                    } else {
                        $syval='';
                  }                   }
       }        }
               untie(%bighash)                untie(%bighash)

Removed from v.1.247  
changed lines
  Added in v.1.251


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>