r71984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71983‎ | r71984 | r71985 >
Date:22:03, 30 August 2010
Author:yaron
Status:deferred
Tags:
Comment:
Fixed escaping in preg_match() call
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -379,7 +379,7 @@
380380 // even if there are more
381381 if ( $found_instance ) {
382382 $matches = array();
383 - $search_pattern = '/{{' . $search_template_str . '\s*[\|}]/i';
 383+ $search_pattern = '/{{' . $preg_match_template_str . '\s*[\|}]/i';
384384 $content_str = str_replace( '_', ' ', $existing_page_content );
385385 preg_match($search_pattern, $content_str, $matches, PREG_OFFSET_CAPTURE);
386386 // is this check necessary?
Index: trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js
@@ -134,7 +134,12 @@
135135
136136 if (aj2.readyState != 4) return;
137137
138 - htm = aj2.responseText.replace(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'"').replace(/&amp;/g,'&').replace(/&apos;/g,"'");
 138+ htm = aj2.responseText.replace(/&gt;/g,'>')
 139+ .replace(/&lt;/g,'<')
 140+ .replace(/&quot;/g,'"')
 141+ .replace(/&amp;/g,'&')
 142+ .replace(/&apos;/g,"'")
 143+ .replace("</body>", "<span id='SF_PREVIEW_EOD'/></body>");
139144
140145 ifr = document.createElement('iframe');
141146 ifr.onload="alert('load')";
@@ -164,18 +169,18 @@
165170
166171 doc.open();
167172 doc.write(htm);
168 - doc.close();
 173+ doc.close();
169174
170175 interval=setInterval(function(){
171176
 177+ if ( ! doc.getElementById("SF_PREVIEW_EOD") ) return;
 178+
172179 var visible = null;
173180
174181 visible = doc.getElementById("wikiPreview");
175182
176 - if (!visible) return;
 183+ clearInterval(interval);
177184
178 - clearInterval(interval);
179 -
180185 var currentfr=document.getElementById('ifrPreview');
181186
182187 if (currentfr && !window.opera){
@@ -214,9 +219,11 @@
215220
216221 visible = visible.parentNode;
217222 }
218 -
219 - currentfr.style.height = " " + doc.body.scrollHeight + "px";
220223
 224+ doc.getElementById('content').style.background = "none white";
 225+
 226+ currentfr.style.height = " " + vish + "px";
 227+
221228 window.scrollTo(currentfr.offsetLeft, currentfr.offsetTop);
222229 document.body.style.cursor = '';
223230

Status & tagging log