--- rat/map.pm 2006/12/04 14:59:55 1.2 +++ rat/map.pm 2007/01/26 23:37:51 1.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # routines for modyfing .sequence and .page files # -# $Id: map.pm,v 1.2 2006/12/04 14:59:55 raeburn Exp $ +# $Id: map.pm,v 1.6 2007/01/26 23:37:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -29,6 +29,7 @@ package LONCAPA::map; use HTML::TokeParser; +use HTML::Entities(); use Apache::lonnet; use Apache::lonlocal; use File::Copy; @@ -439,7 +440,7 @@ sub qtescape { $str=~s/\&\#58\;/\:/g; $str=~s/\&\#39\;/\'/g; $str=~s/\&\#44\;/\,/g; - $str=~s/\"/\&\#34\;/g; + $str=~s/\&\#34\;/\"/g; return $str; } @@ -476,7 +477,7 @@ sub loadmap { if ($instr eq -2) { $errtext.='Map not loaded: An error occured while trying to load the map.'; } elsif ($instr eq '-1') { - $errtext.=&mt('Map not loaded: The file [_1] does not exist.',$fn); + # Map doesn't exist } elsif ($instr) { my $parser = HTML::TokeParser->new(\$instr); my $token; @@ -625,6 +626,8 @@ sub savemap { # --------------------------------------------------------------- Logical input if (($comp[$#comp] eq 'res') || ($comp[$#comp] eq 'zombie')) { $comp[0]=qtescape($comp[0]); + $comp[0] = &HTML::Entities::encode($comp[0],'&<>"'); + $comp[1]=qtescape($comp[1]); if ($comp[2] eq 'true') { if ($comp[1]!~/^http\:\/\//) { @@ -690,7 +693,7 @@ sub savemap { } } $outstr.="\n"; - if ($fn=~/^\/*uploaded\/(\w+)\/(\w+)\/(.*)$/) { + if ($fn=~m{^/*uploaded/($LONCAPA::domain_re)/($LONCAPA::courseid_re)/(.*)$}) { $env{'form.output'}=$outstr; my $result=&Apache::lonnet::finishuserfileupload($2,$1, 'output',$3);