[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm /localize lonlocal.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 28 Aug 2006 14:26:25 -0000


albertel		Mon Aug 28 10:26:25 2006 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
    /loncom/localize	lonlocal.pm 
  Log:
  - need to protect user title when being &mt() BUG#4985
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.363 loncom/homework/structuretags.pm:1.364
--- loncom/homework/structuretags.pm:1.363	Thu Aug 10 17:21:42 2006
+++ loncom/homework/structuretags.pm	Mon Aug 28 10:26:04 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.363 2006/08/10 21:21:42 albertel Exp $
+# $Id: structuretags.pm,v 1.364 2006/08/28 14:26:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -134,7 +134,7 @@
 	$body_args{'force_register'} = 1;
 	$body_args{'add_entries'}    = \%add_entries;	
     }
-
+    &Apache::lonlocal::mt_escape(\$name);
     my $page_start = &Apache::loncommon::start_page($name,$extra_head,
 						    \%body_args);
 
Index: loncom/localize/lonlocal.pm
diff -u loncom/localize/lonlocal.pm:1.40 loncom/localize/lonlocal.pm:1.41
--- loncom/localize/lonlocal.pm:1.40	Tue Jun 27 10:20:55 2006
+++ loncom/localize/lonlocal.pm	Mon Aug 28 10:26:25 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Localization routines
 #
-# $Id: lonlocal.pm,v 1.40 2006/06/27 14:20:55 albertel Exp $
+# $Id: lonlocal.pm,v 1.41 2006/08/28 14:26:25 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -345,6 +345,21 @@
     $$strptr=~s/MT\{([^\}]*)\}/&mt($1)/gse;
 }
 
+=pod 
+
+=item * mt_escape
+
+mt_escape takes a string reference and escape the [] in there so mt
+will leave them as is and not try to expand them
+
+=cut
+
+sub mt_escape {
+    my ($str_ref) = @_;
+    $$str_ref =~s/~/~~/g;
+    $$str_ref =~s/([\[\]])/~$1/g;
+}
+
 1;
 
 __END__