From: Brion Vibber Date: Mon, 1 Mar 2004 01:32:11 +0000 (+0000) Subject: Add escaping necessary to deal with tips and example text that contain apostrophes... X-Git-Tag: 1.3.0beta1~894 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=38b72bb4a150b4e71199ff7991ab8c09bacc09f1;p=lhc%2Fweb%2Fwiklou.git Add escaping necessary to deal with tips and example text that contain apostrophes and such (needed for French etc) --- diff --git a/includes/Skin.php b/includes/Skin.php index 9e457845ad..a163ad044d 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2340,17 +2340,17 @@ class Skin { $image=$wgUploadPath."/".$tool["image"]; $open=$tool["open"]; $close=$tool["close"]; - $sample=$tool["sample"]; + $sample = addslashes( $tool["sample"] ); // Note that we use the tip both for the ALT tag and the TITLE tag of the image. // Older browsers show a "speedtip" type message only for ALT. // Ideally these should be different, realistically they // probably don't need to be. - $tip=$tool["tip"]; + $tip = addslashes( $tool["tip"] ); $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n"; } - $toolbar.="addInfobox('".addslashes(wfMsg("infobox"))."');\n"; + $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "');\n"; $toolbar.="document.writeln(\"\");\n"; return $toolbar; } diff --git a/stylesheets/wikibits.js b/stylesheets/wikibits.js index 237b85cbc9..155e0609d2 100644 --- a/stylesheets/wikibits.js +++ b/stylesheets/wikibits.js @@ -101,9 +101,10 @@ function addInfobox(infoText) { && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1) && (clientPC.indexOf('khtml')==-1) && (clientPC.indexOf('gecko')==-1)); if(!document.selection && !is_nav) { + infoText=escapeQuotesHTML(infoText); document.write("
"+ - "
"); + ""); } } @@ -111,11 +112,19 @@ function addInfobox(infoText) { function escapeQuotes(text) { var re=new RegExp("'","g"); text=text.replace(re,"\\'"); + re=new RegExp('"',"g"); + text=text.replace(re,'"'); re=new RegExp("\\n","g"); text=text.replace(re,"\\n"); return text; } +function escapeQuotesHTML(text) { + var re=new RegExp('"',"g"); + text=text.replace(re,"""); + return text; +} + // apply tagOpen/tagClose to selection in textarea, // use sampleText instead of selection if there is none // copied and adapted from phpBB