r29132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29131‎ | r29132 | r29133 >
Date:22:42, 31 December 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 12451) AJAX title normalization tweaks
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/AjaxFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AjaxFunctions.php
@@ -74,14 +74,14 @@
7575 }
7676
7777 function wfSajaxSearch( $term ) {
78 - global $wgContLang, $wgOut, $wgUser;
 78+ global $wgContLang, $wgOut, $wgUser, $wgCapitalLinks;
7979 $limit = 16;
8080 $sk = $wgUser->getSkin();
8181
8282 $term = trim( $term );
83 - $term = str_replace( ' ', '_', $wgContLang->ucfirst(
84 - $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) )
85 - ) );
 83+ $term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) );
 84+ if ( $wgCapitalLinks )
 85+ $term = $wgContLang->ucfirst( $term );
8686 $term_title = Title::newFromText( $term );
8787
8888 $r = $more = '';
@@ -97,7 +97,7 @@
9898
9999 $i = 0;
100100 while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) {
101 - $nt = Title::newFromText( $row->page_title, $row->page_namespace );
 101+ $nt = Title::makeTitle( $row->page_namespace, $row->page_title );
102102 $r .= '<li>' . $sk->makeKnownLinkObj( $nt ) . "</li>\n";
103103 }
104104 if ( $i > $limit ) {
@@ -116,7 +116,7 @@
117117
118118 foreach( $specialPages as $page ) {
119119 if( $wgContLang->uc( $page ) != $page && strpos( $page, $term_title->getText() ) === 0 ) {
120 - $r .= '<li>' . $sk->makeKnownLinkObj( Title::newFromText( $page, NS_SPECIAL ) ) . '</li>';
 120+ $r .= '<li>' . $sk->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, $page ) ) . '</li>';
121121 }
122122 }
123123
@@ -125,7 +125,7 @@
126126
127127 $valid = (bool) $term_title;
128128 $term_url = urlencode( $term );
129 - $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : str_replace( '_', ' ', $term ) );
 129+ $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : $term );
130130 $subtitlemsg = ( $valid ? 'searchsubtitle' : 'searchsubtitleinvalid' );
131131 $subtitle = wfMsgWikiHtml( $subtitlemsg, $term_diplay );
132132 $html = '<div id="searchTargetHide"><a onclick="Searching_Hide_Results();">'
@@ -174,7 +174,7 @@
175175 }
176176 $watch = 'w' === $watch;
177177
178 - $title = Title::newFromText($pagename);
 178+ $title = Title::newFromDBkey($pagename);
179179 if(!$title) {
180180 // Invalid title
181181 return '<err#>';
Index: trunk/phase3/RELEASE-NOTES
@@ -273,6 +273,7 @@
274274 * (bug 3097) Inconsistently usable titles containing HTML character entities
275275 are now forbidden. A run of cleanupTitles.php will fix up existing pages.
276276 * (bug 12446) Permissions check fix for undelete link
 277+* (bug 12451) AJAX title normalization tweaks
277278
278279
279280 == Parser changes in 1.12 ==

Status & tagging log