From 7e0bda47274bbdf65ddde21214a3e1dd223fc747 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 11 May 2005 04:06:36 +0000 Subject: [PATCH] * $wgSpecialPageRedirects changed to hold title objects, needed to be able to redirect to other things than other specialpages * $wgSpecialPageRedirects now handles Special:My(?:page|talk|contributions --- includes/SpecialPage.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 3c7609b7c6..45020a8c85 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -19,7 +19,7 @@ /** * */ -global $wgSpecialPages, $wgSpecialPageRedirects; +global $wgSpecialPages, $wgSpecialPageRedirects, $wgUser; /** * @access private @@ -34,10 +34,6 @@ $wgSpecialPages = array( 'Preferences' => new SpecialPage( 'Preferences' ), 'Watchlist' => new SpecialPage( 'Watchlist' ), - 'Mytalk' => new UnlistedSpecialPage( 'Mytalk'), - 'Mycontributions' => new UnlistedSpecialPage( 'Mycontributions'), - 'Mypage' => new UnlistedSpecialPage( 'Mypage'), - 'Recentchanges' => new SpecialPage( 'Recentchanges' ), 'Upload' => new SpecialPage( 'Upload' ), 'Imagelist' => new SpecialPage( 'Imagelist' ), @@ -80,14 +76,18 @@ $wgSpecialPages = array( ); /** - * Sometimes the functionality of a specialpage is merged into the - * functionality of another or its simply renamed, this allows us to redirect - * the request to the proper place. + * Redirect Special:$key to somewhere else. * * @access private */ $wgSpecialPageRedirects = array( - 'Listadmins' => 'Listusers' + # 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' ), ); global $wgUseValidation ; @@ -179,10 +179,9 @@ class SpecialPage } /** - * * @static - * @param string $nam - * @return mixed string if the redirect exists, otherwise NULL + * @param string $name + * @return mixed Title object if the redirect exists, otherwise NULL */ function &getRedirect( $name ) { global $wgSpecialPageRedirects; @@ -236,8 +235,7 @@ class SpecialPage if ( is_null( $page ) ) { $redir =& SpecialPage::getRedirect( $name ); if ( isset( $redir ) ) { - $t = Title::makeTitle( NS_SPECIAL, "Listusers" ); - $wgOut->redirect ($t->getFullURL()); + $wgOut->redirect ($redir->getFullURL()); } else { $wgOut->setArticleRelated( false ); $wgOut->setRobotpolicy( "noindex,follow" ); -- 2.20.1