3 * SpecialPage: handling special pages and lists thereof.
5 * To add a special page in an extension, add to $wgSpecialPages either
6 * an object instance or an array containing the name and constructor
7 * parameters. The latter is preferred for performance reasons.
9 * The object instantiated must be either an instance of SpecialPage or a
10 * sub-class thereof. It must have an execute() method, which sends the HTML
11 * for the special page to $wgOut. The parent class has an execute() method
12 * which distributes the call to the historical global functions. Additionally,
13 * execute() also checks if the user has the necessary access privileges
14 * and bails out if not.
16 * To add a core special page, use the similar static list in
17 * SpecialPage::$mList. To remove a core static special page at runtime, use
18 * a SpecialPage_initList hook.
20 * @addtogroup SpecialPage
28 * Parent special page class, also static functions for handling the special
30 * @addtogroup SpecialPage
38 * The canonical name of this special page
39 * Also used for the default <h1> heading, @see getDescription()
43 * The local name of this special page
47 * Minimum user level required to access this page, or "" for anyone.
48 * Also used to categorise the pages in Special:Specialpages
52 * Listed in Special:Specialpages?
56 * Function name called by the default execute()
60 * File which needs to be included before the function above can be called
64 * Whether or not this special page is being included from an article
68 * Whether the special page can be included in an article
72 * Query parameters that can be passed through redirects
74 var $mAllowedRedirectParams = array();
76 static public $mList = array(
77 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects' ),
78 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects' ),
79 'Disambiguations' => array( 'SpecialPage', 'Disambiguations' ),
81 'Userlogin' => array( 'SpecialPage', 'Userlogin' ),
82 'Userlogout' => array( 'UnlistedSpecialPage', 'Userlogout' ),
83 'CreateAccount' => array( 'SpecialCreateAccount' ),
84 'Preferences' => array( 'SpecialPage', 'Preferences' ),
85 'Watchlist' => array( 'SpecialPage', 'Watchlist' ),
87 'Recentchanges' => array( 'IncludableSpecialPage', 'Recentchanges' ),
88 'Upload' => array( 'SpecialPage', 'Upload' ),
89 'Imagelist' => array( 'SpecialPage', 'Imagelist' ),
90 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
91 'Listusers' => array( 'SpecialPage', 'Listusers' ),
92 'Statistics' => array( 'SpecialPage', 'Statistics' ),
93 'Randompage' => 'Randompage',
94 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
95 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages' ),
96 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ),
97 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ),
98 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ),
99 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ),
100 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ),
101 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ),
102 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ),
103 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ),
104 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ),
105 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ),
106 'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ),
107 'Mostimages' => array( 'SpecialPage', 'Mostimages' ),
108 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ),
109 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
110 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
111 'Longpages' => array( 'SpecialPage', 'Longpages' ),
112 'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ),
113 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
114 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
115 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
116 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
117 'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ),
118 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) ,
119 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
120 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ),
121 'Contributions' => array( 'SpecialPage', 'Contributions' ),
122 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ),
123 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ),
124 'Recentchangeslinked' => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ),
125 'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ),
126 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ),
127 'Resetpass' => array( 'UnlistedSpecialPage', 'Resetpass' ),
128 'Booksources' => 'SpecialBookSources',
129 'Categories' => array( 'SpecialPage', 'Categories' ),
130 'Export' => array( 'SpecialPage', 'Export' ),
131 'Version' => array( 'SpecialPage', 'Version' ),
132 'Allmessages' => array( 'SpecialPage', 'Allmessages' ),
133 'Log' => array( 'SpecialPage', 'Log' ),
134 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
135 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
136 'Import' => array( 'SpecialPage', 'Import', 'import' ),
137 'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
138 'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
139 'Userrights' => 'UserrightsPage',
140 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ),
141 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
142 'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
143 'Revisiondelete' => array( 'UnlistedSpecialPage', 'Revisiondelete', 'deleterevision' ),
144 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ),
145 'Randomredirect' => 'SpecialRandomredirect',
146 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
148 'Mypage' => array( 'SpecialMypage' ),
149 'Mytalk' => array( 'SpecialMytalk' ),
150 'Mycontributions' => array( 'SpecialMycontributions' ),
151 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
152 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
153 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
156 static public $mAliases;
157 static public $mListInitialised = false;
162 * Initialise the special page list
163 * This must be called before accessing SpecialPage::$mList
165 static function initList() {
166 global $wgSpecialPages;
167 global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
169 if ( self
::$mListInitialised ) {
172 wfProfileIn( __METHOD__
);
174 # Better to set this now, to avoid infinite recursion in carelessly written hooks
175 self
::$mListInitialised = true;
177 if( !$wgDisableCounters ) {
178 self
::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages' );
181 if( !$wgDisableInternalSearch ) {
182 self
::$mList['Search'] = array( 'SpecialPage', 'Search' );
185 if( $wgEmailAuthentication ) {
186 self
::$mList['Confirmemail'] = 'EmailConfirmation';
189 # Add extension special pages
190 self
::$mList = array_merge( self
::$mList, $wgSpecialPages );
193 # This hook can be used to remove undesired built-in special pages
194 wfRunHooks( 'SpecialPage_initList', array( &self
::$mList ) );
195 wfProfileOut( __METHOD__
);
198 static function initAliasList() {
199 if ( !is_null( self
::$mAliases ) ) {
204 $aliases = $wgContLang->getSpecialPageAliases();
205 $missingPages = self
::$mList;
206 self
::$mAliases = array();
207 foreach ( $aliases as $realName => $aliasList ) {
208 foreach ( $aliasList as $alias ) {
209 self
::$mAliases[$wgContLang->caseFold( $alias )] = $realName;
211 unset( $missingPages[$realName] );
213 foreach ( $missingPages as $name => $stuff ) {
214 self
::$mAliases[$wgContLang->caseFold( $name )] = $name;
219 * Given a special page alias, return the special page name.
220 * Returns false if there is no such alias.
222 static function resolveAlias( $alias ) {
225 if ( !self
::$mListInitialised ) self
::initList();
226 if ( is_null( self
::$mAliases ) ) self
::initAliasList();
227 $caseFoldedAlias = $wgContLang->caseFold( $alias );
228 if ( isset( self
::$mAliases[$caseFoldedAlias] ) ) {
229 return self
::$mAliases[$caseFoldedAlias];
236 * Given a special page name with a possible subpage, return an array
237 * where the first element is the special page name and the second is the
240 static function resolveAliasWithSubpage( $alias ) {
241 $bits = explode( '/', $alias, 2 );
242 $name = self
::resolveAlias( $bits[0] );
243 if( !isset( $bits[1] ) ) { // bug 2087
248 return array( $name, $par );
252 * Add a page to the list of valid special pages. This used to be the preferred
253 * method for adding special pages in extensions. It's now suggested that you add
254 * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
256 * @param mixed $page Must either be an array specifying a class name and
257 * constructor parameters, or an object. The object,
258 * when constructed, must have an execute() method which
259 * sends HTML to $wgOut.
262 static function addPage( &$page ) {
263 if ( !self
::$mListInitialised ) {
266 self
::$mList[$page->mName
] = $page;
270 * Remove a special page from the list
271 * Formerly used to disable expensive or dangerous special pages. The
272 * preferred method is now to add a SpecialPage_initList hook.
276 static function removePage( $name ) {
277 if ( !self
::$mListInitialised ) {
280 unset( self
::$mList[$name] );
284 * Check if a given name exist as a special page or as a special page alias
285 * @param $name string: name of a special page
286 * @return boolean: true if a special page exists with this name
288 static function exists( $name ) {
290 if ( !self
::$mListInitialised ) {
293 if( !self
::$mAliases ) {
294 self
::initAliasList();
297 # Remove special pages inline parameters:
298 $bits = explode( '/', $name );
299 $name = $wgContLang->caseFold($bits[0]);
302 array_key_exists( $name, self
::$mList )
303 or array_key_exists( $name, self
::$mAliases )
308 * Find the object with a given name and return it (or NULL)
310 * @param string $name
312 static function getPage( $name ) {
313 if ( !self
::$mListInitialised ) {
316 if ( array_key_exists( $name, self
::$mList ) ) {
317 $rec = self
::$mList[$name];
318 if ( is_string( $rec ) ) {
320 self
::$mList[$name] = new $className;
321 } elseif ( is_array( $rec ) ) {
322 $className = array_shift( $rec );
323 self
::$mList[$name] = wfCreateObject( $className, $rec );
325 return self
::$mList[$name];
332 * Get a special page with a given localised name, or NULL if there
333 * is no such special page.
335 static function getPageByAlias( $alias ) {
336 $realName = self
::resolveAlias( $alias );
338 return self
::getPage( $realName );
345 * Return categorised listable special pages for all users
348 static function getRegularPages() {
349 if ( !self
::$mListInitialised ) {
354 foreach ( self
::$mList as $name => $rec ) {
355 $page = self
::getPage( $name );
356 if ( $page->isListed() && !$page->isRestricted() ) {
357 $pages[$name] = $page;
364 * Return categorised listable special pages which are available
365 * for the current user, but not for everyone
368 static function getRestrictedPages() {
370 if ( !self
::$mListInitialised ) {
375 foreach ( self
::$mList as $name => $rec ) {
376 $page = self
::getPage( $name );
379 and $page->isRestricted()
380 and $page->userCanExecute( $wgUser )
382 $pages[$name] = $page;
389 * Execute a special page path.
390 * The path may contain parameters, e.g. Special:Name/Params
391 * Extracts the special page name and call the execute method, passing the parameters
393 * Returns a title object if the page is redirected, false if there was no such special
394 * page, and true if it was successful.
396 * @param $title a title object
397 * @param $including output is being captured for use in {{special:whatever}}
399 static function executePath( &$title, $including = false ) {
400 global $wgOut, $wgTitle, $wgRequest;
401 wfProfileIn( __METHOD__
);
403 # FIXME: redirects broken due to this call
404 $bits = explode( '/', $title->getDBkey(), 2 );
406 if( !isset( $bits[1] ) ) { // bug 2087
411 $page = SpecialPage
::getPageByAlias( $name );
415 $wgOut->setArticleRelated( false );
416 $wgOut->setRobotpolicy( 'noindex,nofollow' );
417 $wgOut->setStatusCode( 404 );
418 $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
420 wfProfileOut( __METHOD__
);
426 $redirect = $page->getRedirect( $par );
428 $query = $page->getRedirectQuery();
429 $url = $redirect->getFullUrl( $query );
430 $wgOut->redirect( $url );
431 wfProfileOut( __METHOD__
);
436 # Redirect to canonical alias for GET commands
437 # Not for POST, we'd lose the post data, so it's best to just distribute
438 # the request. Such POST requests are possible for old extensions that
439 # generate self-links without being aware that their default name has
441 if ( !$including && $name != $page->getLocalName() && !$wgRequest->wasPosted() ) {
443 unset( $query['title'] );
444 $query = wfArrayToCGI( $query );
445 $title = $page->getTitle( $par );
446 $url = $title->getFullUrl( $query );
447 $wgOut->redirect( $url );
448 wfProfileOut( __METHOD__
);
452 if ( $including && !$page->includable() ) {
453 wfProfileOut( __METHOD__
);
455 } elseif ( !$including ) {
456 $wgTitle = $page->getTitle();
458 $page->including( $including );
460 // Execute special page
461 $profName = 'Special:' . $page->getName();
462 wfProfileIn( $profName );
463 $page->execute( $par );
464 wfProfileOut( $profName );
465 wfProfileOut( __METHOD__
);
470 * Just like executePath() except it returns the HTML instead of outputting it
471 * Returns false if there was no such special page, or a title object if it was
475 static function capturePath( &$title ) {
476 global $wgOut, $wgTitle;
478 $oldTitle = $wgTitle;
480 $wgOut = new OutputPage
;
482 $ret = SpecialPage
::executePath( $title, true );
483 if ( $ret === true ) {
484 $ret = $wgOut->getHTML();
486 $wgTitle = $oldTitle;
492 * Get the local name for a specified canonical name
495 * @param mixed $subpage Boolean false, or string
499 static function getLocalNameFor( $name, $subpage = false ) {
501 $aliases = $wgContLang->getSpecialPageAliases();
502 if ( isset( $aliases[$name][0] ) ) {
503 $name = $aliases[$name][0];
505 if ( $subpage !== false && !is_null( $subpage ) ) {
506 $name = "$name/$subpage";
512 * Get a localised Title object for a specified special page name
514 static function getTitleFor( $name, $subpage = false ) {
515 $name = self
::getLocalNameFor( $name, $subpage );
517 return Title
::makeTitle( NS_SPECIAL
, $name );
519 throw new MWException( "Invalid special page name \"$name\"" );
524 * Get a localised Title object for a page name with a possibly unvalidated subpage
526 static function getSafeTitleFor( $name, $subpage = false ) {
527 $name = self
::getLocalNameFor( $name, $subpage );
529 return Title
::makeTitleSafe( NS_SPECIAL
, $name );
536 * Get a title for a given alias
537 * @return Title or null if there is no such alias
539 static function getTitleForAlias( $alias ) {
540 $name = self
::resolveAlias( $alias );
542 return self
::getTitleFor( $name );
549 * Default constructor for special pages
550 * Derivative classes should call this from their constructor
551 * Note that if the user does not have the required level, an error message will
552 * be displayed by the default execute() method, without the global function ever
555 * If you override execute(), you can recover the default behaviour with userCanExecute()
556 * and displayRestrictionError()
558 * @param string $name Name of the special page, as seen in links and URLs
559 * @param string $restriction User right required, e.g. "block" or "delete"
560 * @param boolean $listed Whether the page is listed in Special:Specialpages
561 * @param string $function Function called by execute(). By default it is constructed from $name
562 * @param string $file File which is included by execute(). It is also constructed from $name by default
564 function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
565 $this->mName
= $name;
566 $this->mRestriction
= $restriction;
567 $this->mListed
= $listed;
568 $this->mIncludable
= $includable;
569 if ( $function == false ) {
570 $this->mFunction
= 'wfSpecial'.$name;
572 $this->mFunction
= $function;
574 if ( $file === 'default' ) {
575 $this->mFile
= dirname(__FILE__
) . "/Special{$name}.php";
577 $this->mFile
= $file;
586 function getName() { return $this->mName
; }
587 function getRestriction() { return $this->mRestriction
; }
588 function getFile() { return $this->mFile
; }
589 function isListed() { return $this->mListed
; }
593 * Accessor and mutator
595 function name( $x = NULL ) { return wfSetVar( $this->mName
, $x ); }
596 function restrictions( $x = NULL) { return wfSetVar( $this->mRestrictions
, $x ); }
597 function listed( $x = NULL) { return wfSetVar( $this->mListed
, $x ); }
598 function func( $x = NULL) { return wfSetVar( $this->mFunction
, $x ); }
599 function file( $x = NULL) { return wfSetVar( $this->mFile
, $x ); }
600 function includable( $x = NULL ) { return wfSetVar( $this->mIncludable
, $x ); }
601 function including( $x = NULL ) { return wfSetVar( $this->mIncluding
, $x ); }
605 * Get the localised name of the special page
607 function getLocalName() {
608 if ( !isset( $this->mLocalName
) ) {
609 $this->mLocalName
= self
::getLocalNameFor( $this->mName
);
611 return $this->mLocalName
;
615 * Can be overridden by subclasses with more complicated permissions
618 * @return bool Should the page be displayed with the restricted-access
621 public function isRestricted() {
622 return $this->mRestriction
!= '';
626 * Checks if the given user (identified by an object) can execute this
627 * special page (as defined by $mRestriction). Can be overridden by sub-
628 * classes with more complicated permissions schemes.
630 * @param User $user The user to check
631 * @return bool Does the user have permission to view the page?
633 public function userCanExecute( $user ) {
634 return $user->isAllowed( $this->mRestriction
);
638 * Output an error message telling the user what access level they have to have
640 function displayRestrictionError() {
642 $wgOut->permissionRequired( $this->mRestriction
);
646 * Sets headers - this should be called from the execute() method of all derived classes!
648 function setHeaders() {
650 $wgOut->setArticleRelated( false );
651 $wgOut->setRobotPolicy( "noindex,nofollow" );
652 $wgOut->setPageTitle( $this->getDescription() );
656 * Default execute method
657 * Checks user permissions, calls the function given in mFunction
659 * This may be overridden by subclasses.
661 function execute( $par ) {
666 if ( $this->userCanExecute( $wgUser ) ) {
667 $func = $this->mFunction
;
668 // only load file if the function does not exist
669 if(!is_callable($func) and $this->mFile
) {
670 require_once( $this->mFile
);
672 # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage.
673 if ( wfRunHooks( 'SpecialPageExecuteBeforeHeader', array( &$this, &$par, &$func ) ) )
674 $this->outputHeader();
675 if ( ! wfRunHooks( 'SpecialPageExecuteBeforePage', array( &$this, &$par, &$func ) ) )
677 call_user_func( $func, $par, $this );
678 if ( ! wfRunHooks( 'SpecialPageExecuteAfterPage', array( &$this, &$par, &$func ) ) )
681 $this->displayRestrictionError();
685 function outputHeader() {
686 global $wgOut, $wgContLang;
688 $msg = $wgContLang->lc( $this->name() ) . '-summary';
689 $out = wfMsg( $msg );
690 if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() )
691 $wgOut->addWikiText( $out );
695 # Returns the name that goes in the <h1> in the special page itself, and also the name that
696 # will be listed in Special:Specialpages
698 # Derived classes can override this, but usually it is easier to keep the default behaviour.
699 # Messages can be added at run-time, see MessageCache.php
700 function getDescription() {
701 return wfMsg( strtolower( $this->mName
) );
705 * Get a self-referential title object
707 function getTitle( $subpage = false) {
708 return self
::getTitleFor( $this->mName
, $subpage );
712 * Set whether this page is listed in Special:Specialpages, at run-time
714 function setListed( $listed ) {
715 return wfSetVar( $this->mListed
, $listed );
719 * If the special page is a redirect, then get the Title object it redirects to.
722 function getRedirect( $subpage ) {
727 * Return part of the request string for a special redirect page
728 * This allows passing, e.g. action=history to Special:Mypage, etc.
732 function getRedirectQuery() {
735 foreach( $this->mAllowedRedirectParams
as $arg ) {
736 if( $val = $wgRequest->getVal( $arg, false ) )
737 $params[] = $arg . '=' . $val;
740 return count( $params ) ?
implode( '&', $params ) : false;
745 * Shortcut to construct a special page which is unlisted by default
746 * @addtogroup SpecialPage
748 class UnlistedSpecialPage
extends SpecialPage
750 function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
751 SpecialPage
::SpecialPage( $name, $restriction, false, $function, $file );
756 * Shortcut to construct an includable special page
757 * @addtogroup SpecialPage
759 class IncludableSpecialPage
extends SpecialPage
761 function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
762 SpecialPage
::SpecialPage( $name, $restriction, $listed, $function, $file, true );
767 * Shortcut to construct a special page alias.
768 * @addtogroup SpecialPage
770 class SpecialRedirectToSpecial
extends UnlistedSpecialPage
{
771 var $redirName, $redirSubpage;
773 function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) {
774 parent
::__construct( $name );
775 $this->redirName
= $redirName;
776 $this->redirSubpage
= $redirSubpage;
777 $this->mAllowedRedirectParams
= $redirectParams;
780 function getRedirect( $subpage ) {
781 if ( $this->redirSubpage
=== false ) {
782 return SpecialPage
::getTitleFor( $this->redirName
, $subpage );
784 return SpecialPage
::getTitleFor( $this->redirName
, $this->redirSubpage
);
789 /** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages
790 * are used to get user independant links pointing to the user page, talk
791 * page and list of contributions.
792 * This can let us cache a single copy of any generated content for all
797 * Shortcut to construct a special page pointing to current user user's page.
798 * @addtogroup SpecialPage
800 class SpecialMypage
extends UnlistedSpecialPage
{
801 function __construct() {
802 parent
::__construct( 'Mypage' );
803 $this->mAllowedRedirectParams
= array( 'action' , 'preload' , 'editintro', 'section' );
806 function getRedirect( $subpage ) {
808 if ( strval( $subpage ) !== '' ) {
809 return Title
::makeTitle( NS_USER
, $wgUser->getName() . '/' . $subpage );
811 return Title
::makeTitle( NS_USER
, $wgUser->getName() );
817 * Shortcut to construct a special page pointing to current user talk page.
818 * @addtogroup SpecialPage
820 class SpecialMytalk
extends UnlistedSpecialPage
{
821 function __construct() {
822 parent
::__construct( 'Mytalk' );
823 $this->mAllowedRedirectParams
= array( 'action' , 'preload' , 'editintro', 'section' );
826 function getRedirect( $subpage ) {
828 if ( strval( $subpage ) !== '' ) {
829 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() . '/' . $subpage );
831 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() );
837 * Shortcut to construct a special page pointing to current user contributions.
838 * @addtogroup SpecialPage
840 class SpecialMycontributions
extends UnlistedSpecialPage
{
841 function __construct() {
842 parent
::__construct( 'Mycontributions' );
845 function getRedirect( $subpage ) {
847 return SpecialPage
::getTitleFor( 'Contributions', $wgUser->getName() );
851 * Shortcut to construct a special page pointing to create account form.
852 * @addtogroup SpecialPage
854 class SpecialCreateAccount
extends SpecialPage
{
855 function __construct() {
856 parent
::__construct( 'CreateAccount' );
857 $this->mAllowedRedirectParams
= array( 'uselang' );
860 function getRedirect() {
861 return SpecialPage
::getTitleFor( 'Userlogin', 'signup' );