From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/specials/SpecialPrefixindex.php | 42 +++++++++++++++++--------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'includes/specials/SpecialPrefixindex.php') diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 28be4daf..495f15f7 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -38,23 +38,26 @@ class SpecialPrefixindex extends SpecialAllpages { * @param $par String: becomes "FOO" when called like Special:Prefixindex/FOO (default null) */ function execute( $par ) { - global $wgRequest, $wgOut, $wgContLang; + global $wgContLang; $this->setHeaders(); $this->outputHeader(); - $wgOut->addModuleStyles( 'mediawiki.special' ); + + $out = $this->getOutput(); + $out->addModuleStyles( 'mediawiki.special' ); # GET values - $from = $wgRequest->getVal( 'from', '' ); - $prefix = $wgRequest->getVal( 'prefix', '' ); - $ns = $wgRequest->getIntOrNull( 'namespace' ); + $request = $this->getRequest(); + $from = $request->getVal( 'from', '' ); + $prefix = $request->getVal( 'prefix', '' ); + $ns = $request->getIntOrNull( 'namespace' ); $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN). $namespaces = $wgContLang->getNamespaces(); - $wgOut->setPagetitle( + $out->setPageTitle( ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) - ? wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) - : wfMsg( 'prefixindex' ) + ? $this->msg( 'prefixindex-namespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) + : $this->msg( 'prefixindex' ) ); $showme = ''; @@ -62,8 +65,9 @@ class SpecialPrefixindex extends SpecialAllpages { $showme = $par; } elseif( $prefix != '' ) { $showme = $prefix; - } elseif( $from != '' ) { + } elseif( $from != '' && $ns === null ) { // For back-compat with Special:Allpages + // Don't do this if namespace is passed, so paging works when doing NS views. $showme = $from; } @@ -71,7 +75,7 @@ class SpecialPrefixindex extends SpecialAllpages { if ( $this->including() || $showme != '' || $ns !== null ) { $this->showPrefixChunk( $namespace, $showme, $from ); } else { - $wgOut->addHTML( $this->namespacePrefixForm( $namespace, null ) ); + $out->addHTML( $this->namespacePrefixForm( $namespace, null ) ); } } @@ -82,11 +86,10 @@ class SpecialPrefixindex extends SpecialAllpages { */ function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { global $wgScript; - $t = $this->getTitle(); $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); - $out .= Html::hidden( 'title', $t->getPrefixedText() ); + $out .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ); $out .= Xml::openElement( 'fieldset' ); $out .= Xml::element( 'legend', null, wfMsg( 'allpages' ) ); $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'allpages' ) ); @@ -120,11 +123,11 @@ class SpecialPrefixindex extends SpecialAllpages { * @param $from String: list all pages from this name (default FALSE) */ function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) { - global $wgOut, $wgContLang, $wgLang; - - $sk = $this->getSkin(); + global $wgContLang; - if (!isset($from)) $from = $prefix; + if ( $from === null ) { + $from = $prefix; + } $fromList = $this->getNamespaceKeyAndText($namespace, $from); $prefixList = $this->getNamespaceKeyAndText($namespace, $prefix); @@ -169,7 +172,7 @@ class SpecialPrefixindex extends SpecialAllpages { $t = Title::makeTitle( $s->page_namespace, $s->page_title ); if( $t ) { $link = ($s->page_is_redirect ? '
' : '' ) . - $sk->linkKnown( + Linker::linkKnown( $t, htmlspecialchars( $t->getText() ) ) . @@ -214,10 +217,11 @@ class SpecialPrefixindex extends SpecialAllpages { 'prefix' => $prefix ); - if( $namespace ) { + if( $namespace || ($prefix == '')) { + // Keep the namespace even if it's 0 for empty prefixes. + // This tells us we're not just a holdover from old links. $query['namespace'] = $namespace; } - $nextLink = Linker::linkKnown( $self, wfMsgHtml( 'nextpage', str_replace( '_',' ', htmlspecialchars( $s->page_title ) ) ), -- cgit v1.2.3-54-g00ecf