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.
21 * @ingroup SpecialPage
22 * @defgroup SpecialPage SpecialPage
26 * Parent special page class, also static functions for handling the special
28 * @ingroup SpecialPage
35 * The canonical name of this special page
36 * Also used for the default <h1> heading, @see getDescription()
40 * The local name of this special page
44 * Minimum user level required to access this page, or "" for anyone.
45 * Also used to categorise the pages in Special:Specialpages
49 * Listed in Special:Specialpages?
53 * Function name called by the default execute()
57 * File which needs to be included before the function above can be called
61 * Whether or not this special page is being included from an article
65 * Whether the special page can be included in an article
69 * Query parameters that can be passed through redirects
71 var $mAllowedRedirectParams = array();
73 * Query parameteres added by redirects
75 var $mAddedRedirectParams = array();
77 * Current request context
83 * List of special page names to the subclass of SpecialPage which handles them.
85 static public $mList = array(
87 'BrokenRedirects' => 'BrokenRedirectsPage',
88 'Deadendpages' => 'DeadendpagesPage',
89 'DoubleRedirects' => 'DoubleRedirectsPage',
90 'Longpages' => 'LongpagesPage',
91 'Ancientpages' => 'AncientpagesPage',
92 'Lonelypages' => 'LonelypagesPage',
93 'Fewestrevisions' => 'FewestrevisionsPage',
94 'Withoutinterwiki' => 'WithoutinterwikiPage',
95 'Protectedpages' => 'SpecialProtectedpages',
96 'Protectedtitles' => 'SpecialProtectedtitles',
97 'Shortpages' => 'ShortpagesPage',
98 'Uncategorizedcategories' => 'UncategorizedcategoriesPage',
99 'Uncategorizedimages' => 'UncategorizedimagesPage',
100 'Uncategorizedpages' => 'UncategorizedpagesPage',
101 'Uncategorizedtemplates' => 'UncategorizedtemplatesPage',
102 'Unusedcategories' => 'UnusedcategoriesPage',
103 'Unusedimages' => 'UnusedimagesPage',
104 'Unusedtemplates' => 'UnusedtemplatesPage',
105 'Unwatchedpages' => 'UnwatchedpagesPage',
106 'Wantedcategories' => 'WantedcategoriesPage',
107 'Wantedfiles' => 'WantedfilesPage',
108 'Wantedpages' => 'WantedpagesPage',
109 'Wantedtemplates' => 'WantedtemplatesPage',
112 'Allpages' => 'SpecialAllpages',
113 'Prefixindex' => 'SpecialPrefixindex',
114 'Categories' => 'SpecialCategories',
115 'Disambiguations' => 'DisambiguationsPage',
116 'Listredirects' => 'ListredirectsPage',
118 # Login/create account
119 'Userlogin' => 'LoginForm',
120 'CreateAccount' => 'SpecialCreateAccount',
123 'Block' => 'SpecialBlock',
124 'Unblock' => 'SpecialUnblock',
125 'BlockList' => 'SpecialBlockList',
126 'Resetpass' => 'SpecialResetpass',
127 'DeletedContributions' => 'DeletedContributionsPage',
128 'Preferences' => 'SpecialPreferences',
129 'Contributions' => 'SpecialContributions',
130 'Listgrouprights' => 'SpecialListGroupRights',
131 'Listusers' => 'SpecialListUsers' ,
132 'Listadmins' => 'SpecialListAdmins',
133 'Listbots' => 'SpecialListBots',
134 'Activeusers' => 'SpecialActiveUsers',
135 'Userrights' => 'UserrightsPage',
136 'EditWatchlist' => 'SpecialEditWatchlist',
138 # Recent changes and logs
139 'Newimages' => 'SpecialNewFiles',
140 'Log' => 'SpecialLog',
141 'Watchlist' => 'SpecialWatchlist',
142 'Newpages' => 'SpecialNewpages',
143 'Recentchanges' => 'SpecialRecentchanges',
144 'Recentchangeslinked' => 'SpecialRecentchangeslinked',
145 'Tags' => 'SpecialTags',
147 # Media reports and uploads
148 'Listfiles' => 'SpecialListFiles',
149 'Filepath' => 'SpecialFilepath',
150 'MIMEsearch' => 'MIMEsearchPage',
151 'FileDuplicateSearch' => 'FileDuplicateSearchPage',
152 'Upload' => 'SpecialUpload',
153 'UploadStash' => 'SpecialUploadStash',
155 # Wiki data and tools
156 'Statistics' => 'SpecialStatistics',
157 'Allmessages' => 'SpecialAllmessages',
158 'Version' => 'SpecialVersion',
159 'Lockdb' => 'SpecialLockdb',
160 'Unlockdb' => 'SpecialUnlockdb',
162 # Redirecting special pages
163 'LinkSearch' => 'LinkSearchPage',
164 'Randompage' => 'Randompage',
165 'Randomredirect' => 'SpecialRandomredirect',
168 'Mostlinkedcategories' => 'MostlinkedCategoriesPage',
169 'Mostimages' => 'MostimagesPage',
170 'Mostlinked' => 'MostlinkedPage',
171 'Mostlinkedtemplates' => 'MostlinkedTemplatesPage',
172 'Mostcategories' => 'MostcategoriesPage',
173 'Mostrevisions' => 'MostrevisionsPage',
176 'ComparePages' => 'SpecialComparePages',
177 'Export' => 'SpecialExport',
178 'Import' => 'SpecialImport',
179 'Undelete' => 'SpecialUndelete',
180 'Whatlinkshere' => 'SpecialWhatlinkshere',
181 'MergeHistory' => 'SpecialMergeHistory',
184 'Booksources' => 'SpecialBookSources',
186 # Unlisted / redirects
187 'Blankpage' => 'SpecialBlankpage',
188 'Blockme' => 'SpecialBlockme',
189 'Emailuser' => 'SpecialEmailUser',
190 'Movepage' => 'MovePageForm',
191 'Mycontributions' => 'SpecialMycontributions',
192 'Mypage' => 'SpecialMypage',
193 'Mytalk' => 'SpecialMytalk',
194 'Myuploads' => 'SpecialMyuploads',
195 'PermanentLink' => 'SpecialPermanentLink',
196 'Revisiondelete' => 'SpecialRevisionDelete',
197 'Specialpages' => 'SpecialSpecialpages',
198 'Userlogout' => 'SpecialUserlogout',
201 static public $mAliases;
202 static public $mListInitialised = false;
205 * Initialise the special page list
206 * This must be called before accessing SpecialPage::$mList
207 * @deprecated since 1.18
209 static function initList() {
214 * @deprecated since 1.18
216 static function initAliasList() {
221 * Given a special page alias, return the special page name.
222 * Returns false if there is no such alias.
224 * @param $alias String
225 * @return String or false
226 * @deprecated since 1.18 call SpecialPageFactory method directly
228 static function resolveAlias( $alias ) {
229 list( $name, /*...*/ ) = SpecialPageFactory
::resolveAlias( $alias );
234 * Given a special page name with a possible subpage, return an array
235 * where the first element is the special page name and the second is the
238 * @param $alias String
240 * @deprecated since 1.18 call SpecialPageFactory method directly
242 static function resolveAliasWithSubpage( $alias ) {
243 return SpecialPageFactory
::resolveAlias( $alias );
247 * Add a page to the list of valid special pages. This used to be the preferred
248 * method for adding special pages in extensions. It's now suggested that you add
249 * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
251 * @param $page SpecialPage
252 * @deprecated in 1.7, warnings in 1.17, might be removed in 1.20
254 static function addPage( &$page ) {
255 wfDeprecated( __METHOD__
);
256 SpecialPageFactory
::getList()->{$page->mName
} = $page;
260 * Add a page to a certain display group for Special:SpecialPages
262 * @param $page Mixed: SpecialPage or string
263 * @param $group String
264 * @deprecated since 1.18 call SpecialPageFactory method directly
266 static function setGroup( $page, $group ) {
267 return SpecialPageFactory
::setGroup( $page, $group );
271 * Add a page to a certain display group for Special:SpecialPages
273 * @param $page SpecialPage
274 * @deprecated since 1.18 call SpecialPageFactory method directly
276 static function getGroup( &$page ) {
277 return SpecialPageFactory
::getGroup( $page );
281 * Remove a special page from the list
282 * Formerly used to disable expensive or dangerous special pages. The
283 * preferred method is now to add a SpecialPage_initList hook.
284 * @deprecated since 1.18
286 static function removePage( $name ) {
287 unset( SpecialPageFactory
::getList()->$name );
291 * Check if a given name exist as a special page or as a special page alias
293 * @param $name String: name of a special page
294 * @return Boolean: true if a special page exists with this name
295 * @deprecated since 1.18 call SpecialPageFactory method directly
297 static function exists( $name ) {
298 return SpecialPageFactory
::exists( $name );
302 * Find the object with a given name and return it (or NULL)
304 * @param $name String
305 * @return SpecialPage object or null if the page doesn't exist
306 * @deprecated since 1.18 call SpecialPageFactory method directly
308 static function getPage( $name ) {
309 return SpecialPageFactory
::getPage( $name );
313 * Get a special page with a given localised name, or NULL if there
314 * is no such special page.
316 * @return SpecialPage object or null if the page doesn't exist
317 * @deprecated since 1.18 call SpecialPageFactory method directly
319 static function getPageByAlias( $alias ) {
320 return SpecialPageFactory
::getPage( $alias );
324 * Return categorised listable special pages which are available
325 * for the current user, and everyone.
327 * @return Associative array mapping page's name to its SpecialPage object
328 * @deprecated since 1.18 call SpecialPageFactory method directly
330 static function getUsablePages() {
331 return SpecialPageFactory
::getUsablePages();
335 * Return categorised listable special pages for all users
337 * @return Associative array mapping page's name to its SpecialPage object
338 * @deprecated since 1.18 call SpecialPageFactory method directly
340 static function getRegularPages() {
341 return SpecialPageFactory
::getRegularPages();
345 * Return categorised listable special pages which are available
346 * for the current user, but not for everyone
348 * @return Associative array mapping page's name to its SpecialPage object
349 * @deprecated since 1.18 call SpecialPageFactory method directly
351 static function getRestrictedPages() {
352 return SpecialPageFactory
::getRestrictedPages();
356 * Execute a special page path.
357 * The path may contain parameters, e.g. Special:Name/Params
358 * Extracts the special page name and call the execute method, passing the parameters
360 * Returns a title object if the page is redirected, false if there was no such special
361 * page, and true if it was successful.
363 * @param $title Title object
364 * @param $context RequestContext
365 * @param $including Bool output is being captured for use in {{special:whatever}}
366 * @deprecated since 1.18 call SpecialPageFactory method directly
368 public static function executePath( &$title, RequestContext
&$context, $including = false ) {
369 return SpecialPageFactory
::executePath( $title, $context, $including );
373 * Just like executePath() except it returns the HTML instead of outputting it
374 * Returns false if there was no such special page, or a title object if it was
377 * @return String: HTML fragment
378 * @deprecated since 1.18 call SpecialPageFactory method directly
380 static function capturePath( &$title ) {
381 return SpecialPageFactory
::capturePath( $title );
385 * Get the local name for a specified canonical name
387 * @param $name String
388 * @param $subpage Mixed: boolean false, or string
391 * @deprecated since 1.18 call SpecialPageFactory method directly
393 static function getLocalNameFor( $name, $subpage = false ) {
394 return SpecialPageFactory
::getLocalNameFor( $name, $subpage );
398 * Get a localised Title object for a specified special page name
400 * @return Title object
402 public static function getTitleFor( $name, $subpage = false ) {
403 $name = SpecialPageFactory
::getLocalNameFor( $name, $subpage );
405 return Title
::makeTitle( NS_SPECIAL
, $name );
407 throw new MWException( "Invalid special page name \"$name\"" );
412 * Get a localised Title object for a page name with a possibly unvalidated subpage
414 * @return Title object or null if the page doesn't exist
416 public static function getSafeTitleFor( $name, $subpage = false ) {
417 $name = SpecialPageFactory
::getLocalNameFor( $name, $subpage );
419 return Title
::makeTitleSafe( NS_SPECIAL
, $name );
426 * Get a title for a given alias
428 * @return Title or null if there is no such alias
429 * @deprecated since 1.18 call SpecialPageFactory method directly
431 static function getTitleForAlias( $alias ) {
432 return SpecialPageFactory
::getTitleForAlias( $alias );
436 * Default constructor for special pages
437 * Derivative classes should call this from their constructor
438 * Note that if the user does not have the required level, an error message will
439 * be displayed by the default execute() method, without the global function ever
442 * If you override execute(), you can recover the default behaviour with userCanExecute()
443 * and displayRestrictionError()
445 * @param $name String: name of the special page, as seen in links and URLs
446 * @param $restriction String: user right required, e.g. "block" or "delete"
447 * @param $listed Boolean: whether the page is listed in Special:Specialpages
448 * @param $function Callback: function called by execute(). By default it is constructed from $name
449 * @param $file String: file which is included by execute(). It is also constructed from $name by default
450 * @param $includable Boolean: whether the page can be included in normal pages
452 public function __construct( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
453 $this->init( $name, $restriction, $listed, $function, $file, $includable );
457 * Do the real work for the constructor, mainly so __call() can intercept
458 * calls to SpecialPage()
459 * @see __construct() for param docs
461 private function init( $name, $restriction, $listed, $function, $file, $includable ) {
462 $this->mName
= $name;
463 $this->mRestriction
= $restriction;
464 $this->mListed
= $listed;
465 $this->mIncludable
= $includable;
467 $this->mFunction
= 'wfSpecial'.$name;
469 $this->mFunction
= $function;
471 if ( $file === 'default' ) {
472 $this->mFile
= dirname(__FILE__
) . "/specials/Special$name.php";
474 $this->mFile
= $file;
479 * Use PHP's magic __call handler to get calls to the old PHP4 constructor
480 * because PHP E_STRICT yells at you for having __construct() and SpecialPage()
482 * @param $fName String Name of called method
483 * @param $a Array Arguments to the method
484 * @deprecated since 1.17, call parent::__construct()
486 public function __call( $fName, $a ) {
487 // Sometimes $fName is SpecialPage, sometimes it's specialpage. <3 PHP
488 if( strtolower( $fName ) == 'specialpage' ) {
489 // Deprecated messages now, remove in 1.19 or 1.20?
490 wfDeprecated( __METHOD__
);
492 $name = isset( $a[0] ) ?
$a[0] : '';
493 $restriction = isset( $a[1] ) ?
$a[1] : '';
494 $listed = isset( $a[2] ) ?
$a[2] : true;
495 $function = isset( $a[3] ) ?
$a[3] : false;
496 $file = isset( $a[4] ) ?
$a[4] : 'default';
497 $includable = isset( $a[5] ) ?
$a[5] : false;
498 $this->init( $name, $restriction, $listed, $function, $file, $includable );
500 $className = get_class( $this );
501 throw new MWException( "Call to undefined method $className::$fName" );
510 function getName() { return $this->mName
; }
511 function getRestriction() { return $this->mRestriction
; }
512 function getFile() { return $this->mFile
; }
513 function isListed() { return $this->mListed
; }
517 * Accessor and mutator
519 function name( $x = null ) { return wfSetVar( $this->mName
, $x ); }
520 function restrictions( $x = null) {
521 # Use the one below this
522 wfDeprecated( __METHOD__
);
523 return wfSetVar( $this->mRestriction
, $x );
525 function restriction( $x = null) { return wfSetVar( $this->mRestriction
, $x ); }
526 function listed( $x = null) { return wfSetVar( $this->mListed
, $x ); }
527 function func( $x = null) { return wfSetVar( $this->mFunction
, $x ); }
528 function file( $x = null) { return wfSetVar( $this->mFile
, $x ); }
529 function includable( $x = null ) { return wfSetVar( $this->mIncludable
, $x ); }
530 function including( $x = null ) { return wfSetVar( $this->mIncluding
, $x ); }
534 * Get the localised name of the special page
536 function getLocalName() {
537 if ( !isset( $this->mLocalName
) ) {
538 $this->mLocalName
= SpecialPageFactory
::getLocalNameFor( $this->mName
);
540 return $this->mLocalName
;
544 * Is this page expensive (for some definition of expensive)?
545 * Expensive pages are disabled or cached in miser mode. Originally used
546 * (and still overridden) by QueryPage and subclasses, moved here so that
547 * Special:SpecialPages can safely call it for all special pages.
551 public function isExpensive() {
556 * Can be overridden by subclasses with more complicated permissions
559 * @return Boolean: should the page be displayed with the restricted-access
562 public function isRestricted() {
563 global $wgGroupPermissions;
564 // DWIM: If all anons can do something, then it is not restricted
565 return $this->mRestriction
!= '' && empty($wgGroupPermissions['*'][$this->mRestriction
]);
569 * Checks if the given user (identified by an object) can execute this
570 * special page (as defined by $mRestriction). Can be overridden by sub-
571 * classes with more complicated permissions schemes.
573 * @param $user User: the user to check
574 * @return Boolean: does the user have permission to view the page?
576 public function userCanExecute( $user ) {
577 return $user->isAllowed( $this->mRestriction
);
581 * Output an error message telling the user what access level they have to have
583 function displayRestrictionError() {
584 throw new PermissionsError( $this->mRestriction
);
588 * Sets headers - this should be called from the execute() method of all derived classes!
590 function setHeaders() {
591 $out = $this->getOutput();
592 $out->setArticleRelated( false );
593 $out->setRobotPolicy( "noindex,nofollow" );
594 $out->setPageTitle( $this->getDescription() );
598 * Default execute method
599 * Checks user permissions, calls the function given in mFunction
601 * This may be overridden by subclasses.
603 function execute( $par ) {
606 if ( $this->userCanExecute( $this->getUser() ) ) {
607 $func = $this->mFunction
;
608 // only load file if the function does not exist
609 if(!is_callable($func) and $this->mFile
) {
610 require_once( $this->mFile
);
612 $this->outputHeader();
613 call_user_func( $func, $par, $this );
615 $this->displayRestrictionError();
620 * Outputs a summary message on top of special pages
621 * Per default the message key is the canonical name of the special page
622 * May be overriden, i.e. by extensions to stick with the naming conventions
623 * for message keys: 'extensionname-xxx'
625 * @param $summaryMessageKey String: message key of the summary
627 function outputHeader( $summaryMessageKey = '' ) {
630 if( $summaryMessageKey == '' ) {
631 $msg = $wgContLang->lc( $this->name() ) . '-summary';
633 $msg = $summaryMessageKey;
635 if ( !wfMessage( $msg )->isBlank() and ! $this->including() ) {
636 $this->getOutput()->wrapWikiMsg( "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
642 * Returns the name that goes in the \<h1\> in the special page itself, and
643 * also the name that will be listed in Special:Specialpages
645 * Derived classes can override this, but usually it is easier to keep the
646 * default behaviour. Messages can be added at run-time, see
651 function getDescription() {
652 return wfMsg( strtolower( $this->mName
) );
656 * Get a self-referential title object
658 * @return Title object
660 function getTitle( $subpage = false ) {
661 return self
::getTitleFor( $this->mName
, $subpage );
665 * Set whether this page is listed in Special:Specialpages, at run-time
669 function setListed( $listed ) {
670 return wfSetVar( $this->mListed
, $listed );
674 * If the special page is a redirect, then get the Title object it redirects to.
677 * @return Title|false
679 function getRedirect( $subpage ) {
684 * Return part of the request string for a special redirect page
685 * This allows passing, e.g. action=history to Special:Mypage, etc.
689 function getRedirectQuery() {
692 foreach( $this->mAllowedRedirectParams
as $arg ) {
693 if( $this->getContext()->request
->getVal( $arg, null ) !== null ){
694 $params[$arg] = $this->getContext()->request
->getVal( $arg );
698 foreach( $this->mAddedRedirectParams
as $arg => $val ) {
699 $params[$arg] = $val;
702 return count( $params )
708 * Sets the context this SpecialPage is executed in
710 * @param $context RequestContext
713 public function setContext( $context ) {
714 $this->mContext
= $context;
718 * Gets the context this SpecialPage is executed in
720 * @return RequestContext
723 public function getContext() {
724 if ( $this->mContext
instanceof RequestContext
) {
725 return $this->mContext
;
727 wfDebug( __METHOD__
. " called and \$mContext is null. Return RequestContext::getMain(); for sanity\n" );
728 return RequestContext
::getMain();
733 * Get the WebRequest being used for this instance
738 public function getRequest() {
739 return $this->getContext()->getRequest();
743 * Get the OutputPage being used for this instance
748 public function getOutput() {
749 return $this->getContext()->getOutput();
753 * Shortcut to get the skin being used for this instance
758 public function getUser() {
759 return $this->getContext()->getUser();
763 * Shortcut to get the skin being used for this instance
768 public function getSkin() {
769 return $this->getContext()->getSkin();
773 * Return the full title, including $par
778 public function getFullTitle() {
779 return $this->getContext()->getTitle();
783 * Wrapper around wfMessage that sets the current context. Currently this
788 public function msg( /* $args */ ) {
789 return call_user_func_array( 'wfMessage', func_get_args() )->title( $this->getFullTitle() );
794 * Shortcut to construct a special page which is unlisted by default
795 * @ingroup SpecialPage
797 class UnlistedSpecialPage
extends SpecialPage
799 function __construct( $name, $restriction = '', $function = false, $file = 'default' ) {
800 parent
::__construct( $name, $restriction, false, $function, $file );
805 * Shortcut to construct an includable special page
806 * @ingroup SpecialPage
808 class IncludableSpecialPage
extends SpecialPage
810 function __construct( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
811 parent
::__construct( $name, $restriction, $listed, $function, $file, true );
816 * Shortcut to construct a special page alias.
817 * @ingroup SpecialPage
819 abstract class SpecialRedirectToSpecial
extends UnlistedSpecialPage
{
820 var $redirName, $redirSubpage;
822 function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) {
823 parent
::__construct( $name );
824 $this->redirName
= $redirName;
825 $this->redirSubpage
= $redirSubpage;
826 $this->mAllowedRedirectParams
= $allowedRedirectParams;
827 $this->mAddedRedirectParams
= $addedRedirectParams;
830 function getRedirect( $subpage ) {
831 if ( $this->redirSubpage
=== false ) {
832 return SpecialPageFactory
::getTitleFor( $this->redirName
, $subpage );
834 return SpecialPageFactory
::getTitleFor( $this->redirName
, $this->redirSubpage
);
840 * ListAdmins --> ListUsers/admin
842 class SpecialListAdmins
extends SpecialRedirectToSpecial
{
843 function __construct(){
844 parent
::__construct( 'ListAdmins', 'ListUsers', 'sysop' );
849 * ListBots --> ListUsers/admin
851 class SpecialListBots
extends SpecialRedirectToSpecial
{
852 function __construct(){
853 parent
::__construct( 'ListAdmins', 'ListUsers', 'bot' );
858 * CreateAccount --> UserLogin/signup
859 * FIXME: this (and the rest of the login frontend) needs to die a horrible painful death
861 class SpecialCreateAccount
extends SpecialRedirectToSpecial
{
862 function __construct(){
863 parent
::__construct( 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) );
867 * SpecialMypage, SpecialMytalk and SpecialMycontributions special pages
868 * are used to get user independant links pointing to the user page, talk
869 * page and list of contributions.
870 * This can let us cache a single copy of any generated content for all
875 * Shortcut to construct a special page pointing to current user user's page.
876 * @ingroup SpecialPage
878 class SpecialMypage
extends UnlistedSpecialPage
{
879 function __construct() {
880 parent
::__construct( 'Mypage' );
881 $this->mAllowedRedirectParams
= array( 'action' , 'preload' , 'editintro',
882 'section', 'oldid', 'diff', 'dir' );
885 function getRedirect( $subpage ) {
887 if ( strval( $subpage ) !== '' ) {
888 return Title
::makeTitle( NS_USER
, $wgUser->getName() . '/' . $subpage );
890 return Title
::makeTitle( NS_USER
, $wgUser->getName() );
896 * Shortcut to construct a special page pointing to current user talk page.
897 * @ingroup SpecialPage
899 class SpecialMytalk
extends UnlistedSpecialPage
{
900 function __construct() {
901 parent
::__construct( 'Mytalk' );
902 $this->mAllowedRedirectParams
= array( 'action' , 'preload' , 'editintro',
903 'section', 'oldid', 'diff', 'dir' );
906 function getRedirect( $subpage ) {
908 if ( strval( $subpage ) !== '' ) {
909 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() . '/' . $subpage );
911 return Title
::makeTitle( NS_USER_TALK
, $wgUser->getName() );
917 * Shortcut to construct a special page pointing to current user contributions.
918 * @ingroup SpecialPage
920 class SpecialMycontributions
extends UnlistedSpecialPage
{
921 function __construct() {
922 parent
::__construct( 'Mycontributions' );
923 $this->mAllowedRedirectParams
= array( 'limit', 'namespace', 'tagfilter',
924 'offset', 'dir', 'year', 'month', 'feed' );
927 function getRedirect( $subpage ) {
929 return SpecialPageFactory
::getTitleFor( 'Contributions', $wgUser->getName() );
934 * Redirect to Special:Listfiles?user=$wgUser
936 class SpecialMyuploads
extends UnlistedSpecialPage
{
937 function __construct() {
938 parent
::__construct( 'Myuploads' );
939 $this->mAllowedRedirectParams
= array( 'limit' );
942 function getRedirect( $subpage ) {
944 return SpecialPageFactory
::getTitleFor( 'Listfiles', $wgUser->getName() );
949 * Redirect from Special:PermanentLink/### to index.php?oldid=###
951 class SpecialPermanentLink
extends UnlistedSpecialPage
{
952 function __construct() {
953 parent
::__construct( 'PermanentLink' );
954 $this->mAllowedRedirectParams
= array();
957 function getRedirect( $subpage ) {
958 $subpage = intval( $subpage );
959 $this->mAddedRedirectParams
['oldid'] = $subpage;