Unconditional inclusion for SpecialPage.php, needed for {{special:whatever}}. Fixed...
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 28 May 2005 11:49:40 +0000 (11:49 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 28 May 2005 11:49:40 +0000 (11:49 +0000)
includes/Setup.php
includes/SpecialPage.php
index.php

index 657dce7..f410371 100644 (file)
@@ -70,6 +70,7 @@ require_once( 'HistoryBlob.php' );
 require_once( 'ProxyTools.php' );
 require_once( 'ObjectCache.php' );
 require_once( 'WikiError.php' );
+require_once( 'SpecialPage.php' );
 
 if ( $wgUseDynamicDates ) {
        require_once( 'DateFormatter.php' );
index abfbcb9..301b9dd 100644 (file)
@@ -19,7 +19,7 @@
 /**
  *
  */
-global $wgSpecialPages, $wgSpecialPageRedirects, $wgUser;
+global $wgSpecialPages, $wgUser;
 
 /**
  * @access private
@@ -75,24 +75,6 @@ $wgSpecialPages = array(
        'Groups'                => new SpecialPage( 'Groups' ),
 );
 
-/**
- * Redirect Special:$key to somewhere else.
- *
- * @access private
- */
-$wgSpecialPageRedirects = array(
-       # My*
-       'Mypage' => Title::makeTitle( NS_USER, $wgUser->getName() ),
-       'Mytalk' => Title::makeTitle( NS_USER_TALK, $wgUser->getName() ),
-       'Mycontributions' => Title::makeTitle( NS_SPECIAL, 'Contributions/' . $wgUser->getName() ),
-
-       # Deprecated specialpages
-       'Listadmins' => Title::makeTitle( NS_SPECIAL, 'Listusers' ),
-
-       # Redirects
-       'Randompage' => Title::makeTitle( NS_SPECIAL, 'Random' ),
-);
-
 global $wgUseValidation ;
 if ( $wgUseValidation )
        $wgSpecialPages['Validate'] = new SpecialPage( 'Validate' );
@@ -198,11 +180,19 @@ class SpecialPage
         * @return mixed Title object if the redirect exists, otherwise NULL
         */
        function &getRedirect( $name ) {
-               global $wgSpecialPageRedirects;
-               if ( array_key_exists( $name, $wgSpecialPageRedirects ) ) {
-                       return $wgSpecialPageRedirects[$name];
-               } else {
-                       return NULL;
+               switch ( $name ) {
+                       case 'Mypage':
+                               return Title::makeTitle( NS_USER, $wgUser->getName() );
+                       case 'Mytalk':
+                               return Title::makeTitle( NS_USER_TALK, $wgUser->getName() );
+                       case 'Mycontributions':
+                               return Title::makeTitle( NS_SPECIAL, 'Contributions/' . $wgUser->getName() );
+                       case 'Listadmins':
+                               return Title::makeTitle( NS_SPECIAL, 'Listusers' );
+                       case 'Randompage':
+                               return Title::makeTitle( NS_SPECIAL, 'Random' );
+                       default:
+                               return NULL;
                }
        }
 
@@ -251,18 +241,22 @@ class SpecialPage
 
                $page =& SpecialPage::getPage( $name );
                if ( is_null( $page ) ) {
-                       $redir =& SpecialPage::getRedirect( $name );
-                       if ( isset( $redir ) ) {
-                               if ( isset( $par ) ) 
-                                       $wgOut->redirect( $redir->getFullURL() . '/' . $par );
-                               else
-                                       $wgOut->redirect( $redir->getFullURL() );
-                               $retVal = $redir;
+                       if ( $including ) {
+                               return false;
                        } else {
-                               $wgOut->setArticleRelated( false );
-                               $wgOut->setRobotpolicy( "noindex,follow" );
-                               $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
-                               $retVal = false;
+                               $redir =& SpecialPage::getRedirect( $name );
+                               if ( isset( $redir ) ) {
+                                       if ( isset( $par ) ) 
+                                               $wgOut->redirect( $redir->getFullURL() . '/' . $par );
+                                       else
+                                               $wgOut->redirect( $redir->getFullURL() );
+                                       $retVal = $redir;
+                               } else {
+                                       $wgOut->setArticleRelated( false );
+                                       $wgOut->setRobotpolicy( "noindex,follow" );
+                                       $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
+                                       $retVal = false;
+                               }
                        }
                } else {
                        if ( $including && !$page->includable() ) {
index 2dade97..8f6fc3b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -134,7 +134,6 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        $wgOut->redirect( $wgTitle->getFullURL(), '301');
 } else if ( NS_SPECIAL == $wgTitle->getNamespace() ) {
        # actions that need to be made when we have a special pages
-       require_once( 'includes/SpecialPage.php' );
        SpecialPage::executePath( $wgTitle );
 } else {
        if ( NS_MEDIA == $wgTitle->getNamespace() ) {