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 'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ),
116 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) ,
117 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
118 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ),
119 'Contributions' => array( 'SpecialPage', 'Contributions' ),
120 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ),
121 'Whatlinkshere' => array( 'UnlistedSpecialPage', 'Whatlinkshere' ),
122 'Recentchangeslinked' => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ),
123 'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ),
124 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ),
125 'Resetpass' => array( 'UnlistedSpecialPage', 'Resetpass' ),
126 'Booksources' => 'SpecialBookSources',
127 'Categories' => array( 'SpecialPage', 'Categories' ),
128 'Export' => array( 'SpecialPage', 'Export' ),
129 'Version' => array( 'SpecialPage', 'Version' ),
130 'Allmessages' => array( 'SpecialPage', 'Allmessages' ),
131 'Log' => array( 'SpecialPage', 'Log' ),
132 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
133 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
134 'Import' => array( 'SpecialPage', 'Import', 'import' ),
135 'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
136 'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
137 'Userrights' => array( 'SpecialPage', 'Userrights', 'userrights' ),
138 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ),
139 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
140 'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
141 'Revisiondelete' => array( 'SpecialPage', 'Revisiondelete', 'deleterevision' ),
142 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ),
143 'Randomredirect' => array( 'SpecialPage', 'Randomredirect' ),
144 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
146 'Mypage' => array( 'SpecialMypage' ),
147 'Mytalk' => array( 'SpecialMytalk' ),
148 'Mycontributions' => array( 'SpecialMycontributions' ),
149 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
150 'MergeHistory' => array( 'SpecialPage', 'Mergehistory', 'mergehistory' ),
153 static public $mAliases;
154 static public $mListInitialised = false;
159 * Initialise the special page list
160 * This must be called before accessing SpecialPage::$mList
162 static function initList() {
163 global $wgSpecialPages;
164 global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
166 if ( self
::$mListInitialised ) {
169 wfProfileIn( __METHOD__
);
171 # Better to set this now, to avoid infinite recursion in carelessly written hooks
172 self
::$mListInitialised = true;
174 if( !$wgDisableCounters ) {
175 self
::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages' );
178 if( !$wgDisableInternalSearch ) {
179 self
::$mList['Search'] = array( 'SpecialPage', 'Search' );
182 if( $wgEmailAuthentication ) {
183 self
::$mList['Confirmemail'] = 'EmailConfirmation';
186 # Add extension special pages
187 self
::$mList = array_merge( self
::$mList, $wgSpecialPages );
190 # This hook can be used to remove undesired built-in special pages
191 wfRunHooks( 'SpecialPage_initList', array( &self
::$mList ) );
192 wfProfileOut( __METHOD__
);
195 static function initAliasList() {
196 if ( !is_null( self
::$mAliases ) ) {
201 $aliases = $wgContLang->getSpecialPageAliases();
202 $missingPages = self
::$mList;
203 self
::$mAliases = array();
204 foreach ( $aliases as $realName => $aliasList ) {
205 foreach ( $aliasList as $alias ) {
206 self
::$mAliases[$wgContLang->caseFold( $alias )] = $realName;
208 unset( $missingPages[$realName] );
210 foreach ( $missingPages as $name => $stuff ) {
211 self
::$mAliases[$wgContLang->caseFold( $name )] = $name;
216 * Given a special page alias, return the special page name.
217 * Returns false if there is no such alias.
219 static function resolveAlias( $alias ) {
222 if ( !self
::$mListInitialised ) self
::initList();
223 if ( is_null( self
::$mAliases ) ) self
::initAliasList();
224 $caseFoldedAlias = $wgContLang->caseFold( $alias );
225 if ( isset( self
::$mAliases[$caseFoldedAlias] ) ) {
226 return self
::$mAliases[$caseFoldedAlias];
233 * Given a special page name with a possible subpage, return an array
234 * where the first element is the special page name and the second is the
237 static function resolveAliasWithSubpage( $alias ) {
238 $bits = explode( '/', $alias, 2 );
239 $name = self
::resolveAlias( $bits[0] );
240 if( !isset( $bits[1] ) ) { // bug 2087
245 return array( $name, $par );
249 * Add a page to the list of valid special pages. This used to be the preferred
250 * method for adding special pages in extensions. It's now suggested that you add
251 * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
253 * @param mixed $page Must either be an array specifying a class name and
254 * constructor parameters, or an object. The object,
255 * when constructed, must have an execute() method which
256 * sends HTML to $wgOut.
259 static function addPage( &$page ) {
260 if ( !self
::$mListInitialised ) {
263 self
::$mList[$page->mName
] = $page;
267 * Remove a special page from the list
268 * Formerly used to disable expensive or dangerous special pages. The
269 * preferred method is now to add a SpecialPage_initList hook.
273 static function removePage( $name ) {
274 if ( !self
::$mListInitialised ) {
277 unset( self
::$mList[$name] );
281 * Check if a given name exist as a special page or as a special page alias
282 * @param $name string: name of a special page
283 * @return boolean: true if a special page exists with this name
285 static function exists( $name ) {
287 if ( !self
::$mListInitialised ) {
290 if( !self
::$mAliases ) {
291 self
::initAliasList();
294 # Remove special pages inline parameters:
295 $bits = explode( '/', $name );
296 $name = $wgContLang->caseFold($bits[0]);
299 array_key_exists( $name, self
::$mList )
300 or array_key_exists( $name, self
::$mAliases )
305 * Find the object with a given name and return it (or NULL)
307 * @param string $name
309 static function getPage( $name ) {
310 if ( !self
::$mListInitialised ) {
313 if ( array_key_exists( $name, self
::$mList ) ) {
314 $rec = self
::$mList[$name];
315 if ( is_string( $rec ) ) {
317 self
::$mList[$name] = new $className;
318 } elseif ( is_array( $rec ) ) {
319 $className = array_shift( $rec );
320 self
::$mList[$name] = wfCreateObject( $className, $rec );
322 return self
::$mList[$name];
329 * Get a special page with a given localised name, or NULL if there
330 * is no such special page.
332 static function getPageByAlias( $alias ) {
333 $realName = self
::resolveAlias( $alias );
335 return self
::getPage( $realName );
342 * Return categorised listable special pages for all users
345 static function getRegularPages() {
346 if ( !self
::$mListInitialised ) {
351 foreach ( self
::$mList as $name => $rec ) {
352 $page = self
::getPage( $name );
353 if ( $page->isListed() && $page->getRestriction() == '' ) {
354 $pages[$name] = $page;
361 * Return categorised listable special pages which are available
362 * for the current user, but not for everyone
365 static function getRestrictedPages() {
367 if ( !self
::$mListInitialised ) {
372 foreach ( self
::$mList as $name => $rec ) {
373 $page = self
::getPage( $name );
374 if ( $page->isListed() ) {
375 $restriction = $page->getRestriction();
376 if ( $restriction != '' && $wgUser->isAllowed( $restriction ) ) {
377 $pages[$name] = $page;
385 * Return categorised listable log pages which are available
386 * for the current user, but not for everyone
389 static function getRestrictedLogs() {
390 global $wgUser, $wgLogRestrictions, $wgLogNames;
394 if ( isset($wgLogRestrictions) ) {
395 foreach ( $wgLogRestrictions as $type => $restriction ) {
396 $page = SpecialPage
::getTitleFor( 'Log', $type );
397 if ( $restriction !='' && $restriction !='*' && $wgUser->isAllowed( $restriction ) ) {
398 $name = wfMsgHtml( $wgLogNames[$type] );
399 $pages[$name] = $page;
407 * Execute a special page path.
408 * The path may contain parameters, e.g. Special:Name/Params
409 * Extracts the special page name and call the execute method, passing the parameters
411 * Returns a title object if the page is redirected, false if there was no such special
412 * page, and true if it was successful.
414 * @param $title a title object
415 * @param $including output is being captured for use in {{special:whatever}}
417 static function executePath( &$title, $including = false ) {
418 global $wgOut, $wgTitle, $wgRequest;
419 wfProfileIn( __METHOD__
);
421 # FIXME: redirects broken due to this call
422 $bits = explode( '/', $title->getDBkey(), 2 );
424 if( !isset( $bits[1] ) ) { // bug 2087
429 $page = SpecialPage
::getPageByAlias( $name );
434 $wgOut->setArticleRelated( false );
435 $wgOut->setRobotpolicy( 'noindex,nofollow' );
436 $wgOut->setStatusCode( 404 );
437 $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
439 wfProfileOut( __METHOD__
);
445 $redirect = $page->getRedirect( $par );
447 $query = $page->getRedirectQuery();
448 $url = $redirect->getFullUrl( $query );
449 $wgOut->redirect( $url );
450 wfProfileOut( __METHOD__
);
455 # Redirect to canonical alias for GET commands
456 # Not for POST, we'd lose the post data, so it's best to just distribute
457 # the request. Such POST requests are possible for old extensions that
458 # generate self-links without being aware that their default name has
460 if ( !$including && $name != $page->getLocalName() && !$wgRequest->wasPosted() ) {
462 unset( $query['title'] );
463 $query = wfArrayToCGI( $query );
464 $title = $page->getTitle( $par );
465 $url = $title->getFullUrl( $query );
466 $wgOut->redirect( $url );
467 wfProfileOut( __METHOD__
);
471 if ( $including && !$page->includable() ) {
472 wfProfileOut( __METHOD__
);
474 } elseif ( !$including ) {
475 $wgTitle = $page->getTitle();
477 $page->including( $including );
479 // Execute special page
480 $profName = 'Special:' . $page->getName();
481 wfProfileIn( $profName );
482 $page->execute( $par );
483 wfProfileOut( $profName );
484 wfProfileOut( __METHOD__
);
489 * Just like executePath() except it returns the HTML instead of outputting it
490 * Returns false if there was no such special page, or a title object if it was
494 static function capturePath( &$title ) {
495 global $wgOut, $wgTitle;
497 $oldTitle = $wgTitle;
499 $wgOut = new OutputPage
;
501 $ret = SpecialPage
::executePath( $title, true );
502 if ( $ret === true ) {
503 $ret = $wgOut->getHTML();
505 $wgTitle = $oldTitle;
511 * Get the local name for a specified canonical name
513 static function getLocalNameFor( $name, $subpage = false ) {
515 $aliases = $wgContLang->getSpecialPageAliases();
516 if ( isset( $aliases[$name][0] ) ) {
517 $name = $aliases[$name][0];
519 if ( $subpage !== false && !is_null( $subpage ) ) {
520 $name = "$name/$subpage";
526 * Get a localised Title object for a specified special page name
528 static function getTitleFor( $name, $subpage = false ) {
529 $name = self
::getLocalNameFor( $name, $subpage );
531 return Title
::makeTitle( NS_SPECIAL
, $name );
533 throw new MWException( "Invalid special page name \"$name\"" );
538 * Get a localised Title object for a page name with a possibly unvalidated subpage
540 static function getSafeTitleFor( $name, $subpage = false ) {
541 $name = self
::getLocalNameFor( $name, $subpage );
543 return Title
::makeTitleSafe( NS_SPECIAL
, $name );
550 * Get a title for a given alias
551 * @return Title or null if there is no such alias
553 static function getTitleForAlias( $alias ) {
554 $name = self
::resolveAlias( $alias );
556 return self
::getTitleFor( $name );
563 * Default constructor for special pages
564 * Derivative classes should call this from their constructor
565 * Note that if the user does not have the required level, an error message will
566 * be displayed by the default execute() method, without the global function ever
569 * If you override execute(), you can recover the default behaviour with userCanExecute()
570 * and displayRestrictionError()
572 * @param string $name Name of the special page, as seen in links and URLs
573 * @param string $restriction User right required, e.g. "block" or "delete"
574 * @param boolean $listed Whether the page is listed in Special:Specialpages
575 * @param string $function Function called by execute(). By default it is constructed from $name
576 * @param string $file File which is included by execute(). It is also constructed from $name by default
578 function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
579 $this->mName
= $name;
580 $this->mRestriction
= $restriction;
581 $this->mListed
= $listed;
582 $this->mIncludable
= $includable;
583 if ( $function == false ) {
584 $this->mFunction
= 'wfSpecial'.$name;
586 $this->mFunction
= $function;
588 if ( $file === 'default' ) {
589 $this->mFile
= dirname(__FILE__
) . "/Special{$name}.php";
591 $this->mFile
= $file;
600 function getName() { return $this->mName
; }
601 function getRestriction() { return $this->mRestriction
; }
602 function getFile() { return $this->mFile
; }
603 function isListed() { return $this->mListed
; }
607 * Accessor and mutator
609 function name( $x = NULL ) { return wfSetVar( $this->mName
, $x ); }
610 function restrictions( $x = NULL) { return wfSetVar( $this->mRestrictions
, $x ); }
611 function listed( $x = NULL) { return wfSetVar( $this->mListed
, $x ); }
612 function func( $x = NULL) { return wfSetVar( $this->mFunction
, $x ); }
613 function file( $x = NULL) { return wfSetVar( $this->mFile
, $x ); }
614 function includable( $x = NULL ) { return wfSetVar( $this->mIncludable
, $x ); }
615 function including( $x = NULL ) { return wfSetVar( $this->mIncluding
, $x ); }
619 * Get the localised name of the special page
621 function getLocalName() {
622 if ( !isset( $this->mLocalName
) ) {
623 $this->mLocalName
= self
::getLocalNameFor( $this->mName
);
625 return $this->mLocalName
;
629 * Checks if the given user (identified by an object) can execute this
630 * special page (as defined by $mRestriction)
632 function userCanExecute( &$user ) {
633 return $user->isAllowed( $this->mRestriction
);
637 * Output an error message telling the user what access level they have to have
639 function displayRestrictionError() {
641 $wgOut->permissionRequired( $this->mRestriction
);
645 * Sets headers - this should be called from the execute() method of all derived classes!
647 function setHeaders() {
649 $wgOut->setArticleRelated( false );
650 $wgOut->setRobotPolicy( "noindex,nofollow" );
651 $wgOut->setPageTitle( $this->getDescription() );
655 * Default execute method
656 * Checks user permissions, calls the function given in mFunction
658 * This may be overridden by subclasses.
660 function execute( $par ) {
665 if ( $this->userCanExecute( $wgUser ) ) {
666 $func = $this->mFunction
;
667 // only load file if the function does not exist
668 if(!function_exists($func) and $this->mFile
) {
669 require_once( $this->mFile
);
671 # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage.
672 if ( wfRunHooks( 'SpecialPageExecuteBeforeHeader', array( &$this, &$par, &$func ) ) )
673 $this->outputHeader();
674 if ( ! wfRunHooks( 'SpecialPageExecuteBeforePage', array( &$this, &$par, &$func ) ) )
676 $func( $par, $this );
677 if ( ! wfRunHooks( 'SpecialPageExecuteAfterPage', array( &$this, &$par, &$func ) ) )
680 $this->displayRestrictionError();
684 function outputHeader() {
685 global $wgOut, $wgContLang;
687 $msg = $wgContLang->lc( $this->name() ) . '-summary';
688 $out = wfMsg( $msg );
689 if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() )
690 $wgOut->addWikiText( $out );
694 # Returns the name that goes in the <h1> in the special page itself, and also the name that
695 # will be listed in Special:Specialpages
697 # Derived classes can override this, but usually it is easier to keep the default behaviour.
698 # Messages can be added at run-time, see MessageCache.php
699 function getDescription() {
700 return wfMsg( strtolower( $this->mName
) );
704 * Get a self-referential title object
706 function getTitle( $subpage = false) {
707 return self
::getTitleFor( $this->mName
, $subpage );
711 * Set whether this page is listed in Special:Specialpages, at run-time
713 function setListed( $listed ) {
714 return wfSetVar( $this->mListed
, $listed );
718 * If the special page is a redirect, then get the Title object it redirects to.
721 function getRedirect( $subpage ) {
726 * Return part of the request string for a special redirect page
727 * This allows passing, e.g. action=history to Special:Mypage, etc.
731 function getRedirectQuery() {
734 foreach( $this->mAllowedRedirectParams
as $arg ) {
735 if( $val = $wgRequest->getVal( $arg, false ) )
736 $params[] = $arg . '=' . $val;
739 return count( $params ) ?
implode( '&', $params ) : false;
744 * Shortcut to construct a special page which is unlisted by default
745 * @addtogroup SpecialPage
747 class UnlistedSpecialPage
extends SpecialPage
749 function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
750 SpecialPage
::SpecialPage( $name, $restriction, false, $function, $file );
755 * Shortcut to construct an includable special page
756 * @addtogroup SpecialPage
758 class IncludableSpecialPage
extends SpecialPage
760 function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
761 SpecialPage
::SpecialPage( $name, $restriction, $listed, $function, $file, true );
766 * Shortcut to construct a special page alias.
767 * @addtogroup SpecialPage
769 class SpecialRedirectToSpecial
extends UnlistedSpecialPage
{
770 var $redirName, $redirSubpage;
772 function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) {
773 parent
::__construct( $name );
774 $this->redirName
= $redirName;
775 $this->redirSubpage
= $redirSubpage;
776 $this->mAllowedRedirectParams
= $redirectParams;
779 function getRedirect( $subpage ) {
780 if ( $this->redirSubpage
=== false ) {
781 return SpecialPage
::getTitleFor( $this->redirName
, $subpage );
783 return SpecialPage
::getTitleFor( $this->redirName
, $this->redirSubpage
);
788 /** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages
789 * are used to get user independant links pointing to the user page, talk
790 * page and list of contributions.
791 * This can let us cache a single copy of any generated content for all
796 * Shortcut to construct a special page pointing to current user user's page.
797 * @addtogroup SpecialPage
799 class SpecialMypage
extends UnlistedSpecialPage
{
800 function __construct() {
801 parent
::__construct( 'Mypage' );
802 $this->mAllowedRedirectParams
= array( 'action' );
805 function getRedirect( $subpage ) {
807 if ( strval( $subpage ) !== '' ) {
808 return Title
::makeTitle( NS_USER
, $wgUser->getName() . '/' . $subpage );
810 return Title
::makeTitle( NS_USER
, $wgUser->getName() );
816 * Shortcut to construct a special page pointing to current user talk page.
817 * @addtogroup SpecialPage
819 class SpecialMytalk
extends UnlistedSpecialPage
{
820 function __construct() {
821 parent
::__construct( 'Mytalk' );
822 $this->mAllowedRedirectParams
= array( 'action' );
825 function getRedirect( $subpage ) {
827 if ( strval( $subpage ) !== '' ) {
828 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() . '/' . $subpage );
830 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() );
836 * Shortcut to construct a special page pointing to current user contributions.
837 * @addtogroup SpecialPage
839 class SpecialMycontributions
extends UnlistedSpecialPage
{
840 function __construct() {
841 parent
::__construct( 'Mycontributions' );
844 function getRedirect( $subpage ) {
846 return SpecialPage
::getTitleFor( 'Contributions', $wgUser->getName() );