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 'Preferences' => array( 'SpecialPage', 'Preferences' ),
84 'Watchlist' => array( 'SpecialPage', 'Watchlist' ),
86 'Recentchanges' => array( 'IncludableSpecialPage', 'Recentchanges' ),
87 'Upload' => array( 'SpecialPage', 'Upload' ),
88 'Imagelist' => array( 'SpecialPage', 'Imagelist' ),
89 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
90 'Listusers' => array( 'SpecialPage', 'Listusers' ),
91 'Statistics' => array( 'SpecialPage', 'Statistics' ),
92 'Randompage' => array( 'SpecialPage', 'Randompage' ),
93 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
94 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages' ),
95 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ),
96 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ),
97 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ),
98 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ),
99 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ),
100 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ),
101 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ),
102 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ),
103 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ),
104 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ),
105 'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ),
106 'Mostimages' => array( 'SpecialPage', 'Mostimages' ),
107 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ),
108 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
109 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
110 'Longpages' => array( 'SpecialPage', 'Longpages' ),
111 'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ),
112 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
113 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
114 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
115 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
116 'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ),
117 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) ,
118 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
119 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ),
120 'Contributions' => array( 'SpecialPage', 'Contributions' ),
121 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ),
122 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ),
123 'Recentchangeslinked' => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ),
124 'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ),
125 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ),
126 'Resetpass' => array( 'UnlistedSpecialPage', 'Resetpass' ),
127 'Booksources' => 'SpecialBookSources',
128 'Categories' => array( 'SpecialPage', 'Categories' ),
129 'Export' => array( 'SpecialPage', 'Export' ),
130 'Version' => array( 'SpecialPage', 'Version' ),
131 'Allmessages' => array( 'SpecialPage', 'Allmessages' ),
132 'Log' => array( 'SpecialPage', 'Log' ),
133 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
134 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
135 'Import' => array( 'SpecialPage', 'Import', 'import' ),
136 'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
137 'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
138 'Userrights' => array( 'SpecialPage', 'Userrights' ),
139 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ),
140 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
141 'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
142 'Revisiondelete' => array( 'UnlistedSpecialPage', 'Revisiondelete', 'deleterevision' ),
143 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ),
144 'Randomredirect' => array( 'SpecialPage', 'Randomredirect' ),
145 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
147 'Mypage' => array( 'SpecialMypage' ),
148 'Mytalk' => array( 'SpecialMytalk' ),
149 'Mycontributions' => array( 'SpecialMycontributions' ),
150 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
151 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
152 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
155 static public $mAliases;
156 static public $mListInitialised = false;
161 * Initialise the special page list
162 * This must be called before accessing SpecialPage::$mList
164 static function initList() {
165 global $wgSpecialPages;
166 global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
168 if ( self
::$mListInitialised ) {
171 wfProfileIn( __METHOD__
);
173 # Better to set this now, to avoid infinite recursion in carelessly written hooks
174 self
::$mListInitialised = true;
176 if( !$wgDisableCounters ) {
177 self
::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages' );
180 if( !$wgDisableInternalSearch ) {
181 self
::$mList['Search'] = array( 'SpecialPage', 'Search' );
184 if( $wgEmailAuthentication ) {
185 self
::$mList['Confirmemail'] = 'EmailConfirmation';
188 # Add extension special pages
189 self
::$mList = array_merge( self
::$mList, $wgSpecialPages );
192 # This hook can be used to remove undesired built-in special pages
193 wfRunHooks( 'SpecialPage_initList', array( &self
::$mList ) );
194 wfProfileOut( __METHOD__
);
197 static function initAliasList() {
198 if ( !is_null( self
::$mAliases ) ) {
203 $aliases = $wgContLang->getSpecialPageAliases();
204 $missingPages = self
::$mList;
205 self
::$mAliases = array();
206 foreach ( $aliases as $realName => $aliasList ) {
207 foreach ( $aliasList as $alias ) {
208 self
::$mAliases[$wgContLang->caseFold( $alias )] = $realName;
210 unset( $missingPages[$realName] );
212 foreach ( $missingPages as $name => $stuff ) {
213 self
::$mAliases[$wgContLang->caseFold( $name )] = $name;
218 * Given a special page alias, return the special page name.
219 * Returns false if there is no such alias.
221 static function resolveAlias( $alias ) {
224 if ( !self
::$mListInitialised ) self
::initList();
225 if ( is_null( self
::$mAliases ) ) self
::initAliasList();
226 $caseFoldedAlias = $wgContLang->caseFold( $alias );
227 if ( isset( self
::$mAliases[$caseFoldedAlias] ) ) {
228 return self
::$mAliases[$caseFoldedAlias];
235 * Given a special page name with a possible subpage, return an array
236 * where the first element is the special page name and the second is the
239 static function resolveAliasWithSubpage( $alias ) {
240 $bits = explode( '/', $alias, 2 );
241 $name = self
::resolveAlias( $bits[0] );
242 if( !isset( $bits[1] ) ) { // bug 2087
247 return array( $name, $par );
251 * Add a page to the list of valid special pages. This used to be the preferred
252 * method for adding special pages in extensions. It's now suggested that you add
253 * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
255 * @param mixed $page Must either be an array specifying a class name and
256 * constructor parameters, or an object. The object,
257 * when constructed, must have an execute() method which
258 * sends HTML to $wgOut.
261 static function addPage( &$page ) {
262 if ( !self
::$mListInitialised ) {
265 self
::$mList[$page->mName
] = $page;
269 * Remove a special page from the list
270 * Formerly used to disable expensive or dangerous special pages. The
271 * preferred method is now to add a SpecialPage_initList hook.
275 static function removePage( $name ) {
276 if ( !self
::$mListInitialised ) {
279 unset( self
::$mList[$name] );
283 * Check if a given name exist as a special page or as a special page alias
284 * @param $name string: name of a special page
285 * @return boolean: true if a special page exists with this name
287 static function exists( $name ) {
289 if ( !self
::$mListInitialised ) {
292 if( !self
::$mAliases ) {
293 self
::initAliasList();
296 # Remove special pages inline parameters:
297 $bits = explode( '/', $name );
298 $name = $wgContLang->caseFold($bits[0]);
301 array_key_exists( $name, self
::$mList )
302 or array_key_exists( $name, self
::$mAliases )
307 * Find the object with a given name and return it (or NULL)
309 * @param string $name
311 static function getPage( $name ) {
312 if ( !self
::$mListInitialised ) {
315 if ( array_key_exists( $name, self
::$mList ) ) {
316 $rec = self
::$mList[$name];
317 if ( is_string( $rec ) ) {
319 self
::$mList[$name] = new $className;
320 } elseif ( is_array( $rec ) ) {
321 $className = array_shift( $rec );
322 self
::$mList[$name] = wfCreateObject( $className, $rec );
324 return self
::$mList[$name];
331 * Get a special page with a given localised name, or NULL if there
332 * is no such special page.
334 static function getPageByAlias( $alias ) {
335 $realName = self
::resolveAlias( $alias );
337 return self
::getPage( $realName );
344 * Return categorised listable special pages for all users
347 static function getRegularPages() {
348 if ( !self
::$mListInitialised ) {
353 foreach ( self
::$mList as $name => $rec ) {
354 $page = self
::getPage( $name );
355 if ( $page->isListed() && $page->getRestriction() == '' ) {
356 $pages[$name] = $page;
363 * Return categorised listable special pages which are available
364 * for the current user, but not for everyone
367 static function getRestrictedPages() {
369 if ( !self
::$mListInitialised ) {
374 foreach ( self
::$mList as $name => $rec ) {
375 $page = self
::getPage( $name );
376 if ( $page->isListed() ) {
377 $restriction = $page->getRestriction();
378 if ( $restriction != '' && $wgUser->isAllowed( $restriction ) ) {
379 $pages[$name] = $page;
387 * Execute a special page path.
388 * The path may contain parameters, e.g. Special:Name/Params
389 * Extracts the special page name and call the execute method, passing the parameters
391 * Returns a title object if the page is redirected, false if there was no such special
392 * page, and true if it was successful.
394 * @param $title a title object
395 * @param $including output is being captured for use in {{special:whatever}}
397 static function executePath( &$title, $including = false ) {
398 global $wgOut, $wgTitle, $wgRequest;
399 wfProfileIn( __METHOD__
);
401 # FIXME: redirects broken due to this call
402 $bits = explode( '/', $title->getDBkey(), 2 );
404 if( !isset( $bits[1] ) ) { // bug 2087
409 $page = SpecialPage
::getPageByAlias( $name );
414 $wgOut->setArticleRelated( false );
415 $wgOut->setRobotpolicy( 'noindex,nofollow' );
416 $wgOut->setStatusCode( 404 );
417 $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
419 wfProfileOut( __METHOD__
);
425 $redirect = $page->getRedirect( $par );
427 $query = $page->getRedirectQuery();
428 $url = $redirect->getFullUrl( $query );
429 $wgOut->redirect( $url );
430 wfProfileOut( __METHOD__
);
435 # Redirect to canonical alias for GET commands
436 # Not for POST, we'd lose the post data, so it's best to just distribute
437 # the request. Such POST requests are possible for old extensions that
438 # generate self-links without being aware that their default name has
440 if ( !$including && $name != $page->getLocalName() && !$wgRequest->wasPosted() ) {
442 unset( $query['title'] );
443 $query = wfArrayToCGI( $query );
444 $title = $page->getTitle( $par );
445 $url = $title->getFullUrl( $query );
446 $wgOut->redirect( $url );
447 wfProfileOut( __METHOD__
);
451 if ( $including && !$page->includable() ) {
452 wfProfileOut( __METHOD__
);
454 } elseif ( !$including ) {
455 $wgTitle = $page->getTitle();
457 $page->including( $including );
459 // Execute special page
460 $profName = 'Special:' . $page->getName();
461 wfProfileIn( $profName );
462 $page->execute( $par );
463 wfProfileOut( $profName );
464 wfProfileOut( __METHOD__
);
469 * Just like executePath() except it returns the HTML instead of outputting it
470 * Returns false if there was no such special page, or a title object if it was
474 static function capturePath( &$title ) {
475 global $wgOut, $wgTitle;
477 $oldTitle = $wgTitle;
479 $wgOut = new OutputPage
;
481 $ret = SpecialPage
::executePath( $title, true );
482 if ( $ret === true ) {
483 $ret = $wgOut->getHTML();
485 $wgTitle = $oldTitle;
491 * Get the local name for a specified canonical name
494 * @param mixed $subpage Boolean false, or string
498 static function getLocalNameFor( $name, $subpage = false ) {
500 $aliases = $wgContLang->getSpecialPageAliases();
501 if ( isset( $aliases[$name][0] ) ) {
502 $name = $aliases[$name][0];
504 if ( $subpage !== false && !is_null( $subpage ) ) {
505 $name = "$name/$subpage";
511 * Get a localised Title object for a specified special page name
513 static function getTitleFor( $name, $subpage = false ) {
514 $name = self
::getLocalNameFor( $name, $subpage );
516 return Title
::makeTitle( NS_SPECIAL
, $name );
518 throw new MWException( "Invalid special page name \"$name\"" );
523 * Get a localised Title object for a page name with a possibly unvalidated subpage
525 static function getSafeTitleFor( $name, $subpage = false ) {
526 $name = self
::getLocalNameFor( $name, $subpage );
528 return Title
::makeTitleSafe( NS_SPECIAL
, $name );
535 * Get a title for a given alias
536 * @return Title or null if there is no such alias
538 static function getTitleForAlias( $alias ) {
539 $name = self
::resolveAlias( $alias );
541 return self
::getTitleFor( $name );
548 * Default constructor for special pages
549 * Derivative classes should call this from their constructor
550 * Note that if the user does not have the required level, an error message will
551 * be displayed by the default execute() method, without the global function ever
554 * If you override execute(), you can recover the default behaviour with userCanExecute()
555 * and displayRestrictionError()
557 * @param string $name Name of the special page, as seen in links and URLs
558 * @param string $restriction User right required, e.g. "block" or "delete"
559 * @param boolean $listed Whether the page is listed in Special:Specialpages
560 * @param string $function Function called by execute(). By default it is constructed from $name
561 * @param string $file File which is included by execute(). It is also constructed from $name by default
563 function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
564 $this->mName
= $name;
565 $this->mRestriction
= $restriction;
566 $this->mListed
= $listed;
567 $this->mIncludable
= $includable;
568 if ( $function == false ) {
569 $this->mFunction
= 'wfSpecial'.$name;
571 $this->mFunction
= $function;
573 if ( $file === 'default' ) {
574 $this->mFile
= dirname(__FILE__
) . "/Special{$name}.php";
576 $this->mFile
= $file;
585 function getName() { return $this->mName
; }
586 function getRestriction() { return $this->mRestriction
; }
587 function getFile() { return $this->mFile
; }
588 function isListed() { return $this->mListed
; }
592 * Accessor and mutator
594 function name( $x = NULL ) { return wfSetVar( $this->mName
, $x ); }
595 function restrictions( $x = NULL) { return wfSetVar( $this->mRestrictions
, $x ); }
596 function listed( $x = NULL) { return wfSetVar( $this->mListed
, $x ); }
597 function func( $x = NULL) { return wfSetVar( $this->mFunction
, $x ); }
598 function file( $x = NULL) { return wfSetVar( $this->mFile
, $x ); }
599 function includable( $x = NULL ) { return wfSetVar( $this->mIncludable
, $x ); }
600 function including( $x = NULL ) { return wfSetVar( $this->mIncluding
, $x ); }
604 * Get the localised name of the special page
606 function getLocalName() {
607 if ( !isset( $this->mLocalName
) ) {
608 $this->mLocalName
= self
::getLocalNameFor( $this->mName
);
610 return $this->mLocalName
;
614 * Checks if the given user (identified by an object) can execute this
615 * special page (as defined by $mRestriction)
617 function userCanExecute( &$user ) {
618 return $user->isAllowed( $this->mRestriction
);
622 * Output an error message telling the user what access level they have to have
624 function displayRestrictionError() {
626 $wgOut->permissionRequired( $this->mRestriction
);
630 * Sets headers - this should be called from the execute() method of all derived classes!
632 function setHeaders() {
634 $wgOut->setArticleRelated( false );
635 $wgOut->setRobotPolicy( "noindex,nofollow" );
636 $wgOut->setPageTitle( $this->getDescription() );
640 * Default execute method
641 * Checks user permissions, calls the function given in mFunction
643 * This may be overridden by subclasses.
645 function execute( $par ) {
650 if ( $this->userCanExecute( $wgUser ) ) {
651 $func = $this->mFunction
;
652 // only load file if the function does not exist
653 if(!is_callable($func) and $this->mFile
) {
654 require_once( $this->mFile
);
656 # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage.
657 if ( wfRunHooks( 'SpecialPageExecuteBeforeHeader', array( &$this, &$par, &$func ) ) )
658 $this->outputHeader();
659 if ( ! wfRunHooks( 'SpecialPageExecuteBeforePage', array( &$this, &$par, &$func ) ) )
661 call_user_func( $func, $par, $this );
662 if ( ! wfRunHooks( 'SpecialPageExecuteAfterPage', array( &$this, &$par, &$func ) ) )
665 $this->displayRestrictionError();
669 function outputHeader() {
670 global $wgOut, $wgContLang;
672 $msg = $wgContLang->lc( $this->name() ) . '-summary';
673 $out = wfMsg( $msg );
674 if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() )
675 $wgOut->addWikiText( $out );
679 # Returns the name that goes in the <h1> in the special page itself, and also the name that
680 # will be listed in Special:Specialpages
682 # Derived classes can override this, but usually it is easier to keep the default behaviour.
683 # Messages can be added at run-time, see MessageCache.php
684 function getDescription() {
685 return wfMsg( strtolower( $this->mName
) );
689 * Get a self-referential title object
691 function getTitle( $subpage = false) {
692 return self
::getTitleFor( $this->mName
, $subpage );
696 * Set whether this page is listed in Special:Specialpages, at run-time
698 function setListed( $listed ) {
699 return wfSetVar( $this->mListed
, $listed );
703 * If the special page is a redirect, then get the Title object it redirects to.
706 function getRedirect( $subpage ) {
711 * Return part of the request string for a special redirect page
712 * This allows passing, e.g. action=history to Special:Mypage, etc.
716 function getRedirectQuery() {
719 foreach( $this->mAllowedRedirectParams
as $arg ) {
720 if( $val = $wgRequest->getVal( $arg, false ) )
721 $params[] = $arg . '=' . $val;
724 return count( $params ) ?
implode( '&', $params ) : false;
729 * Shortcut to construct a special page which is unlisted by default
730 * @addtogroup SpecialPage
732 class UnlistedSpecialPage
extends SpecialPage
734 function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
735 SpecialPage
::SpecialPage( $name, $restriction, false, $function, $file );
740 * Shortcut to construct an includable special page
741 * @addtogroup SpecialPage
743 class IncludableSpecialPage
extends SpecialPage
745 function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
746 SpecialPage
::SpecialPage( $name, $restriction, $listed, $function, $file, true );
751 * Shortcut to construct a special page alias.
752 * @addtogroup SpecialPage
754 class SpecialRedirectToSpecial
extends UnlistedSpecialPage
{
755 var $redirName, $redirSubpage;
757 function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) {
758 parent
::__construct( $name );
759 $this->redirName
= $redirName;
760 $this->redirSubpage
= $redirSubpage;
761 $this->mAllowedRedirectParams
= $redirectParams;
764 function getRedirect( $subpage ) {
765 if ( $this->redirSubpage
=== false ) {
766 return SpecialPage
::getTitleFor( $this->redirName
, $subpage );
768 return SpecialPage
::getTitleFor( $this->redirName
, $this->redirSubpage
);
773 /** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages
774 * are used to get user independant links pointing to the user page, talk
775 * page and list of contributions.
776 * This can let us cache a single copy of any generated content for all
781 * Shortcut to construct a special page pointing to current user user's page.
782 * @addtogroup SpecialPage
784 class SpecialMypage
extends UnlistedSpecialPage
{
785 function __construct() {
786 parent
::__construct( 'Mypage' );
787 $this->mAllowedRedirectParams
= array( 'action' , 'preload' , 'editintro' );
790 function getRedirect( $subpage ) {
792 if ( strval( $subpage ) !== '' ) {
793 return Title
::makeTitle( NS_USER
, $wgUser->getName() . '/' . $subpage );
795 return Title
::makeTitle( NS_USER
, $wgUser->getName() );
801 * Shortcut to construct a special page pointing to current user talk page.
802 * @addtogroup SpecialPage
804 class SpecialMytalk
extends UnlistedSpecialPage
{
805 function __construct() {
806 parent
::__construct( 'Mytalk' );
807 $this->mAllowedRedirectParams
= array( 'action' , 'preload' , 'editintro' );
810 function getRedirect( $subpage ) {
812 if ( strval( $subpage ) !== '' ) {
813 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() . '/' . $subpage );
815 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() );
821 * Shortcut to construct a special page pointing to current user contributions.
822 * @addtogroup SpecialPage
824 class SpecialMycontributions
extends UnlistedSpecialPage
{
825 function __construct() {
826 parent
::__construct( 'Mycontributions' );
829 function getRedirect( $subpage ) {
831 return SpecialPage
::getTitleFor( 'Contributions', $wgUser->getName() );