Merge "Addition of SearchAfterNoDirectMatch hook"
[lhc/web/wiklou.git] / includes / specials / SpecialShortpages.php
index 8622b92..5a4e8f0 100644 (file)
@@ -40,10 +40,11 @@ class ShortPagesPage extends QueryPage {
        function getQueryInfo() {
                return array (
                        'tables' => array ( 'page' ),
-                       'fields' => array ( 'page_namespace AS namespace',
-                                       'page_title AS title',
-                                       'page_len AS value' ),
-                       'conds' => array ( 'page_namespace' => NS_MAIN,
+                       'fields' => array ( 'namespace' => 'page_namespace',
+                                       'title' => 'page_title',
+                                       'value' => 'page_len' ),
+                       'conds' => array ( 'page_namespace' =>
+                                       MWNamespace::getContentNamespaces(),
                                        'page_is_redirect' => 0 ),
                        'options' => array ( 'USE INDEX' => 'page_redirect_namespace_len' )
                );
@@ -81,7 +82,11 @@ class ShortPagesPage extends QueryPage {
        function formatResult( $skin, $result ) {
                $dm = $this->getLanguage()->getDirMark();
 
-               $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 ) );
+               }
 
                $hlink = Linker::linkKnown(
                        $title,