r51191 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51190‎ | r51191 | r51192 >
Date:10:52, 30 May 2009
Author:thomasv
Status:ok
Tags:
Comment:
per Tim's comment, escaping text bound for innerHTML
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -14,30 +14,36 @@
1515 if(self.proofreadPageViewURL) {
1616 b[0].innerHTML = b[0].innerHTML
1717 + '<li id="ca-image">'
18 - + '<a href="'+proofreadPageViewURL+'">'
19 - + proofreadPageMessageImage+'</a></li>';
 18+ + '<a href="' + escapeQuotesHTML(proofreadPageViewURL) + '">'
 19+ + escapeQuotesHTML(proofreadPageMessageImage) + '</a></li>';
2020 }
2121
2222 if(self.proofreadPageIndexURL){
2323 b[0].innerHTML = b[0].innerHTML
2424 + '<li id="ca-index">'
25 - + '<a href="'+proofreadPageIndexURL+'" title="'+proofreadPageMessageIndex+'">'
26 - + '<img src="'+wgScriptPath+'/extensions/ProofreadPage/uparrow.png" alt="'+proofreadPageMessageIndex+'" width="15" height="15" /></a></li>';
 25+ + '<a href="' + escapeQuotesHTML(proofreadPageIndexURL)
 26+ + '" title="' + escapeQuotesHTML(proofreadPageMessageIndex) + '">'
 27+ + '<img src="' + wgScriptPath + '/extensions/ProofreadPage/uparrow.png" alt="'
 28+ + escapeQuotesHTML(proofreadPageMessageIndex) + '" width="15" height="15" /></a></li>';
2729 }
2830
2931 if(self.proofreadPageNextURL){
3032 b[0].innerHTML =
3133 '<li id="ca-next">'
32 - + '<a href="'+self.proofreadPageNextURL+'" title="'+proofreadPageMessageNextPage+'">'
33 - + '<img src="'+wgScriptPath+'/extensions/ProofreadPage/rightarrow.png" alt="'+proofreadPageMessageNextPage+'" width="15" height="15" /></a></li>'
 34+ + '<a href="' + escapeQuotesHTML(self.proofreadPageNextURL)
 35+ + '" title="' + escapeQuotesHTML(proofreadPageMessageNextPage) + '">'
 36+ + '<img src="' + wgScriptPath + '/extensions/ProofreadPage/rightarrow.png" alt="'
 37+ + escapeQuotesHTML(proofreadPageMessageNextPage) + '" width="15" height="15" /></a></li>'
3438 + b[0].innerHTML ;
3539 }
3640
3741 if(self.proofreadPagePrevURL){
3842 b[0].innerHTML =
3943 '<li id="ca-prev">'
40 - + '<a href="'+self.proofreadPagePrevURL+'" title="'+proofreadPageMessagePrevPage+'">'
41 - + '<img src="'+wgScriptPath+'/extensions/ProofreadPage/leftarrow.png" alt="'+proofreadPageMessagePrevPage+'" width="15" height="15" /></a></li>'
 44+ + '<a href="' + escapeQuotesHTML(self.proofreadPagePrevURL)
 45+ + '" title="' + escapeQuotesHTML(proofreadPageMessagePrevPage) + '">'
 46+ + '<img src="' + wgScriptPath + '/extensions/ProofreadPage/leftarrow.png" alt="'
 47+ + escapeQuotesHTML(proofreadPageMessagePrevPage) + '" width="15" height="15" /></a></li>'
4248 + b[0].innerHTML ;
4349 }
4450 }
@@ -143,12 +149,12 @@
144150 pageFooter = pageFooter.split("&").join("&amp;")
145151
146152 container.innerHTML = ''
147 - +'<div id="prp_header" style="display:none">'+proofreadPageMessageHeader+'<br/>'
148 - +'<textarea name="headerTextbox" rows="2" cols="80">'+pageHeader+'</textarea>'
149 - +'<br/>'+proofreadPageMessagePageBody+'<br/></div>'
150 - +'<textarea name="wpTextbox1" id="wpTextbox1" rows="40" cols="80">'+pageBody+'</textarea>'
151 - +'<div id="prp_footer" style="display:none">'+proofreadPageMessageFooter+'<br/>'
152 - +'<textarea name="footerTextbox" rows="2" cols="80">'+pageFooter+'</textarea></div>';
 153+ + '<div id="prp_header" style="display:none">' + escapeQuotesHTML(proofreadPageMessageHeader) + '<br/>'
 154+ + '<textarea name="headerTextbox" rows="2" cols="80">' + pageHeader + '</textarea>'
 155+ + '<br/>' + escapeQuotesHTML(proofreadPageMessagePageBody) + '<br/></div>'
 156+ + '<textarea name="wpTextbox1" id="wpTextbox1" rows="40" cols="80">'+pageBody+'</textarea>'
 157+ + '<div id="prp_footer" style="display:none">' + escapeQuotesHTML(proofreadPageMessageFooter) + '<br/>'
 158+ + '<textarea name="footerTextbox" rows="2" cols="80">'+pageFooter+'</textarea></div>';
153159
154160
155161 var saveButton = document.getElementById("wpSave");
@@ -601,7 +607,11 @@
602608 img_w = 0; //prevent the container from being resized when the image is downloaded.
603609 self.container_css = "background:#000000; overflow:auto; width:100%; height:"+self.DisplayHeight+"px;";
604610 }
605 - image_container.innerHTML = "<img id=\"ProofReadImage\" src=\""+proofreadPageViewURL+"\" width=\""+img_w+"\" />";
 611+ image_container.innerHTML =
 612+ "<img id=\"ProofReadImage\" src=\""
 613+ + escapeQuotesHTML(proofreadPageViewURL)
 614+ + "\" width=\""+img_w+"\" />";
 615+
606616 image_container.style.cssText = self.container_css;
607617 document.getElementById("wpTextbox1").style.cssText = "height:"+(self.DisplayHeight-7)+"px";
608618 pr_zoom(0);
@@ -847,7 +857,7 @@
848858 +'<span class="quality1"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,1)"> </span>'
849859 +'<span class="quality3"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,3)"> </span>'
850860 +'<span class="quality4"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,4)"> </span>';
851 - f.innerHTML = f.innerHTML + '&nbsp;'+proofreadPageMessageStatus;
 861+ f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML(proofreadPageMessageStatus);
852862 ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling);
853863
854864 var show4 = false;

Status & tagging log