From: Brion Vibber Date: Mon, 31 Dec 2007 22:42:47 +0000 (+0000) Subject: * (bug 12451) AJAX title normalization tweaks X-Git-Tag: 1.31.0-rc.0~50202 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=c8e0c4f78f03eb6ad51c24ae54a6892420392371;p=lhc%2Fweb%2Fwiklou.git * (bug 12451) AJAX title normalization tweaks --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7d565c769f..501305a980 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -273,6 +273,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 3097) Inconsistently usable titles containing HTML character entities are now forbidden. A run of cleanupTitles.php will fix up existing pages. * (bug 12446) Permissions check fix for undelete link +* (bug 12451) AJAX title normalization tweaks == Parser changes in 1.12 == diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index 69212f92ae..013771b0ab 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -74,14 +74,14 @@ function code2utf($num){ } function wfSajaxSearch( $term ) { - global $wgContLang, $wgOut, $wgUser; + global $wgContLang, $wgOut, $wgUser, $wgCapitalLinks; $limit = 16; $sk = $wgUser->getSkin(); $term = trim( $term ); - $term = str_replace( ' ', '_', $wgContLang->ucfirst( - $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ) - ) ); + $term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ); + if ( $wgCapitalLinks ) + $term = $wgContLang->ucfirst( $term ); $term_title = Title::newFromText( $term ); $r = $more = ''; @@ -97,7 +97,7 @@ function wfSajaxSearch( $term ) { $i = 0; while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) { - $nt = Title::newFromText( $row->page_title, $row->page_namespace ); + $nt = Title::makeTitle( $row->page_namespace, $row->page_title ); $r .= '
  • ' . $sk->makeKnownLinkObj( $nt ) . "
  • \n"; } if ( $i > $limit ) { @@ -116,7 +116,7 @@ function wfSajaxSearch( $term ) { foreach( $specialPages as $page ) { if( $wgContLang->uc( $page ) != $page && strpos( $page, $term_title->getText() ) === 0 ) { - $r .= '
  • ' . $sk->makeKnownLinkObj( Title::newFromText( $page, NS_SPECIAL ) ) . '
  • '; + $r .= '
  • ' . $sk->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, $page ) ) . '
  • '; } } @@ -125,7 +125,7 @@ function wfSajaxSearch( $term ) { $valid = (bool) $term_title; $term_url = urlencode( $term ); - $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : str_replace( '_', ' ', $term ) ); + $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : $term ); $subtitlemsg = ( $valid ? 'searchsubtitle' : 'searchsubtitleinvalid' ); $subtitle = wfMsgWikiHtml( $subtitlemsg, $term_diplay ); $html = '
    ' @@ -174,7 +174,7 @@ function wfAjaxWatch($pagename = "", $watch = "") { } $watch = 'w' === $watch; - $title = Title::newFromText($pagename); + $title = Title::newFromDBkey($pagename); if(!$title) { // Invalid title return '';