'RdfMetaData' => 'includes/Metadata.php',
'ReadOnlyError' => 'includes/Exception.php',
'RecentChange' => 'includes/RecentChange.php',
+ 'RedirectSpecialPage' => 'includes/SpecialPage.php',
'RegexlikeReplacer' => 'includes/StringUtils.php',
'ReplacementArray' => 'includes/StringUtils.php',
'Replacer' => 'includes/StringUtils.php',
'Skin' => 'includes/Skin.php',
'SkinLegacy' => 'includes/SkinLegacy.php',
'SkinTemplate' => 'includes/SkinTemplate.php',
+ 'SpecialCreateAccount' => 'includes/SpecialPage.php',
+ 'SpecialListAdmins' => 'includes/SpecialPage.php',
+ 'SpecialListBots' => 'includes/SpecialPage.php',
'SpecialMycontributions' => 'includes/SpecialPage.php',
'SpecialMypage' => 'includes/SpecialPage.php',
'SpecialMytalk' => 'includes/SpecialPage.php',
* @param $user User: the user to check
* @return Boolean: does the user have permission to view the page?
*/
- public function userCanExecute( $user ) {
+ public function userCanExecute( User $user ) {
return $user->isAllowed( $this->mRestriction );
}
* Shortcut to construct a special page alias.
* @ingroup SpecialPage
*/
-abstract class SpecialRedirectToSpecial extends UnlistedSpecialPage {
+abstract class RedirectSpecialPage extends UnlistedSpecialPage {
// Query parameters that can be passed through redirects
- private $mAllowedRedirectParams = array();
+ protected $mAllowedRedirectParams = array();
// Query parameteres added by redirects
- private $mAddedRedirectParams = array();
-
- var $redirName, $redirSubpage;
-
- function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) {
- parent::__construct( $name );
- $this->redirName = $redirName;
- $this->redirSubpage = $redirSubpage;
- $this->mAllowedRedirectParams = $allowedRedirectParams;
- $this->mAddedRedirectParams = $addedRedirectParams;
+ protected $mAddedRedirectParams = array();
+
+ public function execute( $par ){
+ $redirect = $this->getRedirect( $par );
+ $query = $this->getRedirectQuery();
+ if ( $redirect instanceof Title ) {
+ $url = $redirect->getFullUrl( $query );
+ $this->getContext()->output->redirect( $url );
+ wfProfileOut( __METHOD__ );
+ return $redirect;
+ } elseif ( $redirect === true ) {
+ global $wgScript;
+ $url = $wgScript . '?' . wfArrayToCGI( $query );
+ $this->getContext()->output->redirect( $url );
+ wfProfileOut( __METHOD__ );
+ return $redirect;
+ } else {
+ $class = __CLASS__;
+ throw new MWException( "RedirectSpecialPage $class doesn't redirect!" );
+ }
}
/**
*
* @return Title|false
*/
- public function getRedirect( $subpage ) {
- if ( $this->redirSubpage === false ) {
- return SpecialPage::getTitleFor( $this->redirName, $subpage );
- } else {
- return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
- }
- }
+ abstract public function getRedirect( $par );
/**
* Return part of the request string for a special redirect page
}
}
+abstract class SpecialRedirectToSpecial extends RedirectSpecialPage {
+
+ var $redirName, $redirSubpage;
+
+ function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) {
+ parent::__construct( $name );
+ $this->redirName = $redirName;
+ $this->redirSubpage = $redirSubpage;
+ $this->mAllowedRedirectParams = $allowedRedirectParams;
+ $this->mAddedRedirectParams = $addedRedirectParams;
+ }
+
+ public function getRedirect( $subpage ) {
+ if ( $this->redirSubpage === false ) {
+ return SpecialPage::getTitleFor( $this->redirName, $subpage );
+ } else {
+ return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
+ }
+ }
+}
+
/**
* ListAdmins --> ListUsers/admin
*/
* Shortcut to construct a special page pointing to current user user's page.
* @ingroup SpecialPage
*/
-class SpecialMypage extends UnlistedSpecialPage {
+class SpecialMypage extends RedirectSpecialPage {
function __construct() {
parent::__construct( 'Mypage' );
$this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
* Shortcut to construct a special page pointing to current user talk page.
* @ingroup SpecialPage
*/
-class SpecialMytalk extends UnlistedSpecialPage {
+class SpecialMytalk extends RedirectSpecialPage {
function __construct() {
parent::__construct( 'Mytalk' );
$this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
* Shortcut to construct a special page pointing to current user contributions.
* @ingroup SpecialPage
*/
-class SpecialMycontributions extends UnlistedSpecialPage {
+class SpecialMycontributions extends RedirectSpecialPage {
function __construct() {
parent::__construct( 'Mycontributions' );
$this->mAllowedRedirectParams = array( 'limit', 'namespace', 'tagfilter',
/**
* Redirect to Special:Listfiles?user=$wgUser
*/
-class SpecialMyuploads extends UnlistedSpecialPage {
+class SpecialMyuploads extends RedirectSpecialPage {
function __construct() {
parent::__construct( 'Myuploads' );
$this->mAllowedRedirectParams = array( 'limit' );
/**
* Redirect from Special:PermanentLink/### to index.php?oldid=###
*/
-class SpecialPermanentLink extends UnlistedSpecialPage {
+class SpecialPermanentLink extends RedirectSpecialPage {
function __construct() {
parent::__construct( 'PermanentLink' );
$this->mAllowedRedirectParams = array();