revert r106095, fix apparently not this simple
[lhc/web/wiklou.git] / includes / specials / SpecialPrefixindex.php
index 3b64ee9..3252365 100644 (file)
@@ -54,10 +54,10 @@ class SpecialPrefixindex extends SpecialAllpages {
                $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN).
 
                $namespaces = $wgContLang->getNamespaces();
-               $out->setPagetitle(
+               $out->setPageTitle(
                        ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) )
-                               ? wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) )
-                               : wfMsg( 'prefixindex' )
+                               ? $this->msg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) )
+                               : $this->msg( 'prefixindex' )
                );
 
                $showme = '';
@@ -65,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;
                }
 
@@ -197,6 +198,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                        }
                }
 
+               $footer = '';
                if ( $this->including() ) {
                        $out2 = '';
                } else {
@@ -207,7 +209,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                                        <td>' .
                                                $nsForm .
                                        '</td>
-                                       <td id="mw-prefixindex-nav-form">';
+                                       <td id="mw-prefixindex-nav-form" class="mw-prefixindex-nav">';
 
                        if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                $query = array(
@@ -215,24 +217,26 @@ 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;
                                }
-
-                               $out2 = $this->getLang()->pipeList( array(
-                                       $out2,
-                                       Linker::linkKnown(
+                               $nextLink = Linker::linkKnown(
                                                $self,
                                                wfMsgHtml( 'nextpage', str_replace( '_',' ', htmlspecialchars( $s->page_title ) ) ),
                                                array(),
                                                $query
-                                       )
-                               ) );
+                                       );
+                               $out2 .= $nextLink;
+
+                               $footer = "\n" . Html::element( "hr" )
+                                       . Html::rawElement( "div", array( "class" => "mw-prefixindex-nav" ), $nextLink );
                        }
                        $out2 .= "</td></tr>" .
                                Xml::closeElement( 'table' );
                }
 
-               $this->getOutput()->addHTML( $out2 . $out );
+               $this->getOutput()->addHTML( $out2 . $out . $footer );
        }
 }