r109550 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109549‎ | r109550 | r109551 >
Date:16:55, 19 January 2012
Author:reedy
Status:ok
Tags:
Comment:
Add some escaping to r109547, 109548, 109549

Improve RELEASE-NOTES-1.19 also
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)
  • /trunk/phase3/includes/media/Generic.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMIMEsearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -227,8 +227,8 @@
228228 * (bug 25800) mw.config wgAction should contain the actually performed action instead
229229 of whatever the query value contains.
230230 * (bug 4438) Add CSS hook for current WikiPage action.
231 -* (bug 33703) Common border-bottom color for <abbr> should inherit default (text) color
232 -* (bug 33819) Display filesize on Special:NewFiles in appropriate unit.
 231+* (bug 33703) Common border-bottom color for <abbr> should inherit default (text) color.
 232+* (bug 33819) Display file sizes in appropriate units.
233233
234234 === API changes in 1.19 ===
235235 * Made action=edit less likely to return "unknownerror", by returning the actual error
Index: trunk/phase3/includes/specials/SpecialMIMEsearch.php
@@ -95,7 +95,7 @@
9696
9797 $download = Linker::makeMediaLinkObj( $nt, wfMsgHtml( 'download' ) );
9898 $lang = $this->getLanguage();
99 - $bytes = $fileSize = $lang->formatSize( $result->img_size );
 99+ $bytes = htmlspecialchars( $lang->formatSize( $result->img_size ) );
100100 $dimensions = htmlspecialchars( wfMsg( 'widthheight',
101101 $lang->formatNum( $result->img_width ),
102102 $lang->formatNum( $result->img_height )
Index: trunk/phase3/includes/media/Generic.php
@@ -405,7 +405,7 @@
406406 */
407407 function getShortDesc( $file ) {
408408 global $wgLang;
409 - return $wgLang->formatSize( $file->getSize() );
 409+ return htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
410410 }
411411
412412 /**
@@ -414,7 +414,7 @@
415415 */
416416 function getLongDesc( $file ) {
417417 global $wgLang;
418 - return wfMessage( 'file-info', $wgLang->formatSize( $file->getSize() ),
 418+ return wfMessage( 'file-info', htmlspecialchars( $wgLang->formatSize( $file->getSize() ) ),
419419 $file->getMimeType() )->parse();
420420 }
421421
@@ -710,7 +710,7 @@
711711 */
712712 function getShortDesc( $file ) {
713713 global $wgLang;
714 - $nbytes = $wgLang->formatSize( $file->getSize() );
 714+ $nbytes = htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
715715 $widthheight = wfMessage( 'widthheight' )->numParams( $file->getWidth(), $file->getHeight() )->escaped();
716716
717717 return "$widthheight ($nbytes)";
@@ -723,13 +723,14 @@
724724 function getLongDesc( $file ) {
725725 global $wgLang;
726726 $pages = $file->pageCount();
 727+ $size = htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
727728 if ( $pages === false || $pages <= 1 ) {
728729 $msg = wfMessage( 'file-info-size' )->numParams( $file->getWidth(),
729 - $file->getHeight() )->params( $wgLang->formatSize( $file->getSize() ),
 730+ $file->getHeight() )->params( $size,
730731 $file->getMimeType() )->parse();
731732 } else {
732733 $msg = wfMessage( 'file-info-size-pages' )->numParams( $file->getWidth(),
733 - $file->getHeight() )->params( $wgLang->formatSize( $file->getSize() ),
 734+ $file->getHeight() )->params( $size,
734735 $file->getMimeType() )->numParams( $pages )->parse();
735736 }
736737 return $msg;
Index: trunk/phase3/includes/ImageGallery.php
@@ -314,7 +314,7 @@
315315
316316 if( $this->mShowBytes ) {
317317 if( $img ) {
318 - $fileSize = $wgLang->formatSize( $img->getSize() );
 318+ $fileSize = htmlspecialchars( $wgLang->formatSize( $img->getSize() ) );
319319 } else {
320320 $fileSize = wfMsgHtml( 'filemissing' );
321321 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r109561Remove extra space, ping r109550nikerabbit19:11, 19 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109547* (bug 33819) Display filesize on Special:NewFiles in appropriate unit.reedy16:37, 19 January 2012
r109548Like r109547, display file size in appropriate units on mimesearchreedy16:41, 19 January 2012
r109549* (bug 33819) Display filesize on Special:NewFiles in appropriate unit....reedy16:44, 19 January 2012

Status & tagging log