specials: Fix fatal MWNamespace exception on Special:Contributions
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 63b64ea..6e0e1c8 100644 (file)
@@ -152,6 +152,17 @@ class SpecialContributions extends IncludableSpecialPage {
                }
                $this->opts = ContribsPager::processDateFilter( $this->opts );
 
+               if ( $this->opts['namespace'] < NS_MAIN ) {
+                       $this->getOutput()->wrapWikiMsg(
+                               "<div class=\"mw-invalid-namespace-assoc error\">\n\$1\n</div>",
+                               [
+                                       'namespace-not-associated',
+                                       wfEscapeWikiText( $this->opts['namespace'] ),
+                               ] );
+                       $out->addHTML( $this->getForm() );
+                       return;
+               }
+
                $feedType = $request->getVal( 'feed' );
 
                $feedParams = [
@@ -607,7 +618,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                ''
                        ) . "\u{00A0}" .
                        Html::namespaceSelector(
-                               [ 'selected' => $this->opts['namespace'], 'all' => '' ],
+                               [ 'selected' => $this->opts['namespace'], 'all' => '', 'in-user-lang' => true ],
                                [
                                        'name' => 'namespace',
                                        'id' => 'namespace',
@@ -744,7 +755,9 @@ class SpecialContributions extends IncludableSpecialPage {
 
                $explain = $this->msg( 'sp-contributions-explain' );
                if ( !$explain->isBlank() ) {
-                       $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
+                       $form .= Html::rawElement(
+                               'p', [ 'id' => 'mw-sp-contributions-explain' ], $explain->parse()
+                       );
                }
 
                $form .= Xml::closeElement( 'form' );