From: Ævar Arnfjörð Bjarmason Date: Wed, 11 May 2005 04:06:36 +0000 (+0000) Subject: * $wgSpecialPageRedirects changed to hold title objects, needed to be able to X-Git-Tag: 1.5.0alpha2~229 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=7e0bda47274bbdf65ddde21214a3e1dd223fc747;p=lhc%2Fweb%2Fwiklou.git * $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 --- 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" );