r28536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28535‎ | r28536 | r28537 >
Date:10:06, 16 December 2007
Author:vasilievvv
Status:old
Tags:
Comment:
Fix output of wfSajaxSearch:
* Escape all messages
* Use pretty output for terms instead of urlencoded one
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/AjaxFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AjaxFunctions.php
@@ -79,6 +79,7 @@
8080
8181 $l = new Linker;
8282
 83+ $term = trim( $term );
8384 $term = str_replace( ' ', '_', $wgContLang->ucfirst(
8485 $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) )
8586 ) );
@@ -113,18 +114,19 @@
114115 $subtitlemsg = ( Title::newFromText($term) ? 'searchsubtitle' : 'searchsubtitleinvalid' );
115116 $subtitle = $wgOut->parse( wfMsg( $subtitlemsg, wfEscapeWikiText($term) ) ); #FIXME: parser is missing mTitle !
116117
117 - $term = urlencode( $term );
 118+ $term_url = urlencode( $term );
 119+ $term_diplay = htmlspecialchars( str_replace( '_', ' ', $term ) );
118120 $html = '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">'
119 - . wfMsg( 'hideresults' ) . '</a></div>'
120 - . '<h1 class="firstHeading">'.wfMsg('search')
 121+ . wfMsgHtml( 'hideresults' ) . '</a></div>'
 122+ . '<h1 class="firstHeading">'.wfMsgHtml('search')
121123 . '</h1><div id="contentSub">'. $subtitle . '</div><ul><li>'
122124 . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ),
123 - wfMsg( 'searchcontaining', $term ),
124 - "search=$term&fulltext=Search" )
 125+ wfMsgHtml( 'searchcontaining', $term_diplay ),
 126+ "search={$term_url}&fulltext=Search" )
125127 . '</li><li>' . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ),
126 - wfMsg( 'searchnamed', $term ) ,
127 - "search=$term&go=Go" )
128 - . "</li></ul><h2>" . wfMsg( 'articletitles', $term ) . "</h2>"
 128+ wfMsgHtml( 'searchnamed', $term_diplay ) ,
 129+ "search={$term_url}&go=Go" )
 130+ . "</li></ul><h2>" . wfMsgHtml( 'articletitles', $term_diplay ) . "</h2>"
129131 . '<ul>' .$r .'</ul>'.$more;
130132
131133 $response = new AjaxResponse( $html );
Index: trunk/phase3/RELEASE-NOTES
@@ -361,6 +361,7 @@
362362 now 500 / 5000, in line with other modules.
363363 * Added list=allcategories module
364364 * (bug 12321) API list=blocks reveals private data
 365+* Fix output of wfSajaxSearch
365366
366367 === Languages updated in 1.12 ===
367368

Status & tagging log