Check validity of fetched titles and show a descriptive messages when an invalid...
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 25 May 2012 17:34:43 +0000 (19:34 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 25 May 2012 18:17:47 +0000 (20:17 +0200)
Change-Id: I87471c4c5de5e66969b1ef8e4addc3a19c4c3b3d

includes/specials/SpecialPopularpages.php

index 803f03e..9f84804 100644 (file)
@@ -56,7 +56,13 @@ class PopularPagesPage extends QueryPage {
         */
        function formatResult( $skin, $result ) {
                global $wgContLang;
-               $title = Title::makeTitle( $result->namespace, $result->title );
+
+               $title = Title::makeTitleSafe( $result->namespace, $result->title );
+               if( !$title ) {
+                       return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
+                               Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
+               }
+
                $link = Linker::linkKnown(
                        $title,
                        htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )