Diff for /rat/map.pm between versions 1.5 and 1.8

version 1.5, 2007/01/16 21:18:08 version 1.8, 2007/08/02 01:47:42
Line 245  sub attemptread { Line 245  sub attemptread {
 # ------------------------------------- Revive zombie idx or get unused number  # ------------------------------------- Revive zombie idx or get unused number
   
 sub getresidx {  sub getresidx {
     my $url=shift;      my ($url,$residx)= @_;
     my $max=1+($#resources>$#zombies?$#resources:$#zombies);      my $max=1+($#resources>$#zombies?$#resources:$#zombies);
     unless ($url) { return $max; }      unless ($url) { return $max; }
     for (my $i=0; $i<=$#zombies; $i++) {      for (my $i=0; $i<=$#zombies; $i++) {
  my ($title,$src,$ext,$type)=split(/\:/,$zombies[$i]);   my ($title,$src,$ext,$type)=split(/\:/,$zombies[$i]);
  if ($src eq $url) {   if ($src eq $url) {
     undef($zombies[$i]);      if ($residx) {
     return $i;   if ($i == $residx) {
       undef($zombies[$i]);
       return $i;
    }
       } else {
    undef($zombies[$i]);
    return $i;
       }
  }   }
     }      }
     return $max;      return $max;
Line 277  sub pastetarget { Line 284  sub pastetarget {
     my @insertorder=();      my @insertorder=();
     foreach (@which) {      foreach (@which) {
         if (defined($_)) {          if (defined($_)) {
     my ($name,$url)=split(/\=/,$_);      my ($name,$url,$residx)=split(/\=/,$_);
             $name=&unescape($name);              $name=&unescape($name);
             $url=&unescape($url);              $url=&unescape($url);
             if ($url) {              if ($url) {
  my $idx=&getresidx($url);   my $idx=&getresidx($url,$residx);
  $insertorder[$#insertorder+1]=$idx;   $insertorder[$#insertorder+1]=$idx;
  my $ext='false';   my $ext='false';
  if ($url=~/^http\:\/\//) { $ext='true'; }   if ($url=~/^http\:\/\//) { $ext='true'; }
Line 440  sub qtescape { Line 447  sub qtescape {
     $str=~s/\&\#58\;/\:/g;      $str=~s/\&\#58\;/\:/g;
     $str=~s/\&\#39\;/\'/g;      $str=~s/\&\#39\;/\'/g;
     $str=~s/\&\#44\;/\,/g;      $str=~s/\&\#44\;/\,/g;
     $str=~s/\"/\&\#34\;/g;      $str=~s/\&\#34\;/\"/g;
     return $str;      return $str;
 }  }
   
Line 626  sub savemap { Line 633  sub savemap {
 # --------------------------------------------------------------- Logical input  # --------------------------------------------------------------- Logical input
  if (($comp[$#comp] eq 'res') || ($comp[$#comp] eq 'zombie')) {   if (($comp[$#comp] eq 'res') || ($comp[$#comp] eq 'zombie')) {
     $comp[0]=qtescape($comp[0]);      $comp[0]=qtescape($comp[0]);
       $comp[0] = &HTML::Entities::encode($comp[0],'&<>"');
       
     $comp[1]=qtescape($comp[1]);      $comp[1]=qtescape($comp[1]);
     if ($comp[2] eq 'true') {      if ($comp[2] eq 'true') {
  if ($comp[1]!~/^http\:\/\//) {   if ($comp[1]!~/^http\:\/\//) {
Line 644  sub savemap { Line 653  sub savemap {
  $outstr.=' type="'.$comp[3].'"';   $outstr.=' type="'.$comp[3].'"';
     }      }
     if ($comp[0] ne '') {      if ($comp[0] ne '') {
  $outstr.=' title="'.&HTML::Entities::encode($comp[0]).'"';   $outstr.=' title="'.$comp[0].'"';
     }      }
     $outstr.=" />\n";      $outstr.=" />\n";
  } elsif ($comp[$#comp] eq 'cond') {   } elsif ($comp[$#comp] eq 'cond') {

Removed from v.1.5  
changed lines
  Added in v.1.8


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