00001 <?php
00030 class SpecialPage
00031 {
00039 var $mName;
00043 var $mLocalName;
00048 var $mRestriction;
00052 var $mListed;
00056 var $mFunction;
00060 var $mFile;
00064 var $mIncluding;
00068 var $mIncludable;
00072 var $mAllowedRedirectParams = array();
00082 static public $mList = array(
00083 # Maintenance Reports
00084 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects' ),
00085 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
00086 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects' ),
00087 'Longpages' => array( 'SpecialPage', 'Longpages' ),
00088 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
00089 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
00090 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
00091 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
00092 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
00093 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
00094 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
00095 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ),
00096 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ),
00097 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages' ),
00098 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ),
00099 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ),
00100 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ),
00101 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ),
00102 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
00103 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ),
00104 'Wantedfiles' => array( 'SpecialPage', 'Wantedfiles' ),
00105 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ),
00106 'Wantedtemplates' => array( 'SpecialPage', 'Wantedtemplates' ),
00107
00108 # List of pages
00109 'Allpages' => 'SpecialAllpages',
00110 'Prefixindex' => 'SpecialPrefixindex',
00111 'Categories' => array( 'SpecialPage', 'Categories' ),
00112 'Disambiguations' => array( 'SpecialPage', 'Disambiguations' ),
00113 'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
00114
00115 # Login/create account
00116 'Userlogin' => array( 'SpecialPage', 'Userlogin' ),
00117 'CreateAccount' => array( 'SpecialRedirectToSpecial', 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) ),
00118
00119 # Users and rights
00120 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
00121 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
00122 'Resetpass' => 'SpecialResetpass',
00123 'DeletedContributions' => 'DeletedContributionsPage',
00124 'Preferences' => array( 'SpecialPage', 'Preferences' ),
00125 'Contributions' => 'SpecialContributions',
00126 'Listgrouprights' => 'SpecialListGroupRights',
00127 'Listusers' => array( 'SpecialPage', 'Listusers' ),
00128 'Userrights' => 'UserrightsPage',
00129
00130 # Recent changes and logs
00131 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
00132 'Log' => array( 'SpecialPage', 'Log' ),
00133 'Watchlist' => array( 'SpecialPage', 'Watchlist' ),
00134 'Newpages' => 'SpecialNewpages',
00135 'Recentchanges' => 'SpecialRecentchanges',
00136 'Recentchangeslinked' => 'SpecialRecentchangeslinked',
00137 'Tags' => 'SpecialTags',
00138
00139 # Media reports and uploads
00140 'Listfiles' => array( 'SpecialPage', 'Listfiles' ),
00141 'Filepath' => array( 'SpecialPage', 'Filepath' ),
00142 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ),
00143 'FileDuplicateSearch' => array( 'SpecialPage', 'FileDuplicateSearch' ),
00144 'Upload' => array( 'SpecialPage', 'Upload' ),
00145
00146 # Wiki data and tools
00147 'Statistics' => 'SpecialStatistics',
00148 'Allmessages' => array( 'SpecialPage', 'Allmessages' ),
00149 'Version' => 'SpecialVersion',
00150 'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
00151 'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
00152
00153 # Redirecting special pages
00154 'LinkSearch' => array( 'SpecialPage', 'LinkSearch' ),
00155 'Randompage' => 'Randompage',
00156 'Randomredirect' => 'SpecialRandomredirect',
00157
00158 # High use pages
00159 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ),
00160 'Mostimages' => array( 'SpecialPage', 'Mostimages' ),
00161 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ),
00162 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ),
00163 'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ),
00164 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ),
00165
00166 # Page tools
00167 'Export' => 'SpecialExport',
00168 'Import' => 'SpecialImport',
00169 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
00170 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ),
00171 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
00172
00173 # Other
00174 'Booksources' => 'SpecialBookSources',
00175
00176 # Unlisted / redirects
00177 'Blankpage' => array( 'UnlistedSpecialPage', 'Blankpage' ),
00178 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ),
00179 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ),
00180 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
00181 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
00182 'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ),
00183 'Mycontributions' => array( 'SpecialMycontributions' ),
00184 'Mypage' => array( 'SpecialMypage' ),
00185 'Mytalk' => array( 'SpecialMytalk' ),
00186 'Revisiondelete' => 'SpecialRevisionDelete',
00187 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ),
00188 'Userlogout' => array( 'UnlistedSpecialPage', 'Userlogout' ),
00189 );
00190
00191 static public $mAliases;
00192 static public $mListInitialised = false;
00193
00200 static function initList() {
00201 global $wgSpecialPages;
00202 global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
00203
00204 if ( self::$mListInitialised ) {
00205 return;
00206 }
00207 wfProfileIn( __METHOD__ );
00208
00209 # Better to set this now, to avoid infinite recursion in carelessly written hooks
00210 self::$mListInitialised = true;
00211
00212 if( !$wgDisableCounters ) {
00213 self::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages' );
00214 }
00215
00216 if( !$wgDisableInternalSearch ) {
00217 self::$mList['Search'] = array( 'SpecialPage', 'Search' );
00218 }
00219
00220 if( $wgEmailAuthentication ) {
00221 self::$mList['Confirmemail'] = 'EmailConfirmation';
00222 self::$mList['Invalidateemail'] = 'EmailInvalidation';
00223 }
00224
00225 # Add extension special pages
00226 self::$mList = array_merge( self::$mList, $wgSpecialPages );
00227
00228 # Run hooks
00229 # This hook can be used to remove undesired built-in special pages
00230 wfRunHooks( 'SpecialPage_initList', array( &self::$mList ) );
00231 wfProfileOut( __METHOD__ );
00232 }
00233
00234 static function initAliasList() {
00235 if ( !is_null( self::$mAliases ) ) {
00236 return;
00237 }
00238
00239 global $wgContLang;
00240 $aliases = $wgContLang->getSpecialPageAliases();
00241 $missingPages = self::$mList;
00242 self::$mAliases = array();
00243 foreach ( $aliases as $realName => $aliasList ) {
00244 foreach ( $aliasList as $alias ) {
00245 self::$mAliases[$wgContLang->caseFold( $alias )] = $realName;
00246 }
00247 unset( $missingPages[$realName] );
00248 }
00249 foreach ( $missingPages as $name => $stuff ) {
00250 self::$mAliases[$wgContLang->caseFold( $name )] = $name;
00251 }
00252 }
00253
00258 static function resolveAlias( $alias ) {
00259 global $wgContLang;
00260
00261 if ( !self::$mListInitialised ) self::initList();
00262 if ( is_null( self::$mAliases ) ) self::initAliasList();
00263 $caseFoldedAlias = $wgContLang->caseFold( $alias );
00264 if ( isset( self::$mAliases[$caseFoldedAlias] ) ) {
00265 return self::$mAliases[$caseFoldedAlias];
00266 } else {
00267 return false;
00268 }
00269 }
00270
00276 static function resolveAliasWithSubpage( $alias ) {
00277 $bits = explode( '/', $alias, 2 );
00278 $name = self::resolveAlias( $bits[0] );
00279 if( !isset( $bits[1] ) ) {
00280 $par = NULL;
00281 } else {
00282 $par = $bits[1];
00283 }
00284 return array( $name, $par );
00285 }
00286
00295 static function addPage( &$page ) {
00296 if ( !self::$mListInitialised ) {
00297 self::initList();
00298 }
00299 self::$mList[$page->mName] = $page;
00300 }
00301
00309 static function setGroup( $page, $group ) {
00310 global $wgSpecialPageGroups;
00311 $name = is_object($page) ? $page->mName : $page;
00312 $wgSpecialPageGroups[$name] = $group;
00313 }
00314
00321 static function getGroup( &$page ) {
00322 global $wgSpecialPageGroups;
00323 static $specialPageGroupsCache = array();
00324 if( isset($specialPageGroupsCache[$page->mName]) ) {
00325 return $specialPageGroupsCache[$page->mName];
00326 }
00327 $group = wfMsg('specialpages-specialpagegroup-'.strtolower($page->mName));
00328 if( $group == ''
00329 || wfEmptyMsg('specialpages-specialpagegroup-'.strtolower($page->mName), $group ) ) {
00330 $group = isset($wgSpecialPageGroups[$page->mName])
00331 ? $wgSpecialPageGroups[$page->mName]
00332 : '-';
00333 }
00334 if( $group == '-' ) $group = 'other';
00335 $specialPageGroupsCache[$page->mName] = $group;
00336 return $group;
00337 }
00338
00346 static function removePage( $name ) {
00347 if ( !self::$mListInitialised ) {
00348 self::initList();
00349 }
00350 unset( self::$mList[$name] );
00351 }
00352
00358 static function exists( $name ) {
00359 global $wgContLang;
00360 if ( !self::$mListInitialised ) {
00361 self::initList();
00362 }
00363 if( !self::$mAliases ) {
00364 self::initAliasList();
00365 }
00366
00367 # Remove special pages inline parameters:
00368 $bits = explode( '/', $name );
00369 $name = $wgContLang->caseFold($bits[0]);
00370
00371 return
00372 array_key_exists( $name, self::$mList )
00373 or array_key_exists( $name, self::$mAliases )
00374 ;
00375 }
00376
00382 static function getPage( $name ) {
00383 if ( !self::$mListInitialised ) {
00384 self::initList();
00385 }
00386 if ( array_key_exists( $name, self::$mList ) ) {
00387 $rec = self::$mList[$name];
00388 if ( is_string( $rec ) ) {
00389 $className = $rec;
00390 self::$mList[$name] = new $className;
00391 } elseif ( is_array( $rec ) ) {
00392 $className = array_shift( $rec );
00393 self::$mList[$name] = wfCreateObject( $className, $rec );
00394 }
00395 return self::$mList[$name];
00396 } else {
00397 return NULL;
00398 }
00399 }
00400
00405 static function getPageByAlias( $alias ) {
00406 $realName = self::resolveAlias( $alias );
00407 if ( $realName ) {
00408 return self::getPage( $realName );
00409 } else {
00410 return NULL;
00411 }
00412 }
00413
00419 static function getUsablePages() {
00420 global $wgUser;
00421 if ( !self::$mListInitialised ) {
00422 self::initList();
00423 }
00424 $pages = array();
00425
00426 foreach ( self::$mList as $name => $rec ) {
00427 $page = self::getPage( $name );
00428 if ( $page->isListed()
00429 && (
00430 !$page->isRestricted()
00431 || $page->userCanExecute( $wgUser )
00432 )
00433 ) {
00434 $pages[$name] = $page;
00435 }
00436 }
00437 return $pages;
00438 }
00439
00444 static function getRegularPages() {
00445 if ( !self::$mListInitialised ) {
00446 self::initList();
00447 }
00448 $pages = array();
00449
00450 foreach ( self::$mList as $name => $rec ) {
00451 $page = self::getPage( $name );
00452 if ( $page->isListed() && !$page->isRestricted() ) {
00453 $pages[$name] = $page;
00454 }
00455 }
00456 return $pages;
00457 }
00458
00464 static function getRestrictedPages() {
00465 global $wgUser;
00466 if( !self::$mListInitialised ) {
00467 self::initList();
00468 }
00469 $pages = array();
00470
00471 foreach( self::$mList as $name => $rec ) {
00472 $page = self::getPage( $name );
00473 if(
00474 $page->isListed()
00475 && $page->isRestricted()
00476 && $page->userCanExecute( $wgUser )
00477 ) {
00478 $pages[$name] = $page;
00479 }
00480 }
00481 return $pages;
00482 }
00483
00495 static function executePath( &$title, $including = false ) {
00496 global $wgOut, $wgTitle, $wgRequest;
00497 wfProfileIn( __METHOD__ );
00498
00499 # FIXME: redirects broken due to this call
00500 $bits = explode( '/', $title->getDBkey(), 2 );
00501 $name = $bits[0];
00502 if( !isset( $bits[1] ) ) {
00503 $par = NULL;
00504 } else {
00505 $par = $bits[1];
00506 }
00507 $page = SpecialPage::getPageByAlias( $name );
00508 # Nonexistent?
00509 if ( !$page ) {
00510 if ( !$including ) {
00511 $wgOut->setArticleRelated( false );
00512 $wgOut->setRobotPolicy( 'noindex,nofollow' );
00513 $wgOut->setStatusCode( 404 );
00514 $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
00515 }
00516 wfProfileOut( __METHOD__ );
00517 return false;
00518 }
00519
00520 # Check for redirect
00521 if ( !$including ) {
00522 $redirect = $page->getRedirect( $par );
00523 if ( $redirect ) {
00524 $query = $page->getRedirectQuery();
00525 $url = $redirect->getFullUrl( $query );
00526 $wgOut->redirect( $url );
00527 wfProfileOut( __METHOD__ );
00528 return $redirect;
00529 }
00530 }
00531
00532 # Redirect to canonical alias for GET commands
00533 # Not for POST, we'd lose the post data, so it's best to just distribute
00534 # the request. Such POST requests are possible for old extensions that
00535 # generate self-links without being aware that their default name has
00536 # changed.
00537 if ( !$including && $name != $page->getLocalName() && !$wgRequest->wasPosted() ) {
00538 $query = $_GET;
00539 unset( $query['title'] );
00540 $query = wfArrayToCGI( $query );
00541 $title = $page->getTitle( $par );
00542 $url = $title->getFullUrl( $query );
00543 $wgOut->redirect( $url );
00544 wfProfileOut( __METHOD__ );
00545 return $redirect;
00546 }
00547
00548 if ( $including && !$page->includable() ) {
00549 wfProfileOut( __METHOD__ );
00550 return false;
00551 } elseif ( !$including ) {
00552 $wgTitle = $page->getTitle();
00553 }
00554 $page->including( $including );
00555
00556
00557 $profName = 'Special:' . $page->getName();
00558 wfProfileIn( $profName );
00559 $page->execute( $par );
00560 wfProfileOut( $profName );
00561 wfProfileOut( __METHOD__ );
00562 return true;
00563 }
00564
00571 static function capturePath( &$title ) {
00572 global $wgOut, $wgTitle;
00573
00574 $oldTitle = $wgTitle;
00575 $oldOut = $wgOut;
00576 $wgOut = new OutputPage;
00577
00578 $ret = SpecialPage::executePath( $title, true );
00579 if ( $ret === true ) {
00580 $ret = $wgOut->getHTML();
00581 }
00582 $wgTitle = $oldTitle;
00583 $wgOut = $oldOut;
00584 return $ret;
00585 }
00586
00595 static function getLocalNameFor( $name, $subpage = false ) {
00596 global $wgContLang;
00597 $aliases = $wgContLang->getSpecialPageAliases();
00598 if ( isset( $aliases[$name][0] ) ) {
00599 $name = $aliases[$name][0];
00600 }
00601 if ( $subpage !== false && !is_null( $subpage ) ) {
00602 $name = "$name/$subpage";
00603 }
00604 return ucfirst( $name );
00605 }
00606
00610 static function getTitleFor( $name, $subpage = false ) {
00611 $name = self::getLocalNameFor( $name, $subpage );
00612 if ( $name ) {
00613 return Title::makeTitle( NS_SPECIAL, $name );
00614 } else {
00615 throw new MWException( "Invalid special page name \"$name\"" );
00616 }
00617 }
00618
00622 static function getSafeTitleFor( $name, $subpage = false ) {
00623 $name = self::getLocalNameFor( $name, $subpage );
00624 if ( $name ) {
00625 return Title::makeTitleSafe( NS_SPECIAL, $name );
00626 } else {
00627 return null;
00628 }
00629 }
00630
00635 static function getTitleForAlias( $alias ) {
00636 $name = self::resolveAlias( $alias );
00637 if ( $name ) {
00638 return self::getTitleFor( $name );
00639 } else {
00640 return null;
00641 }
00642 }
00643
00660 function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
00661 $this->mName = $name;
00662 $this->mRestriction = $restriction;
00663 $this->mListed = $listed;
00664 $this->mIncludable = $includable;
00665 if ( $function == false ) {
00666 $this->mFunction = 'wfSpecial'.$name;
00667 } else {
00668 $this->mFunction = $function;
00669 }
00670 if ( $file === 'default' ) {
00671 $this->mFile = dirname(__FILE__) . "/specials/Special$name.php";
00672 } else {
00673 $this->mFile = $file;
00674 }
00675 }
00676
00682 function getName() { return $this->mName; }
00683 function getRestriction() { return $this->mRestriction; }
00684 function getFile() { return $this->mFile; }
00685 function isListed() { return $this->mListed; }
00691 function name( $x = NULL ) { return wfSetVar( $this->mName, $x ); }
00692 function restrictions( $x = NULL) { return wfSetVar( $this->mRestrictions, $x ); }
00693 function listed( $x = NULL) { return wfSetVar( $this->mListed, $x ); }
00694 function func( $x = NULL) { return wfSetVar( $this->mFunction, $x ); }
00695 function file( $x = NULL) { return wfSetVar( $this->mFile, $x ); }
00696 function includable( $x = NULL ) { return wfSetVar( $this->mIncludable, $x ); }
00697 function including( $x = NULL ) { return wfSetVar( $this->mIncluding, $x ); }
00703 function getLocalName() {
00704 if ( !isset( $this->mLocalName ) ) {
00705 $this->mLocalName = self::getLocalNameFor( $this->mName );
00706 }
00707 return $this->mLocalName;
00708 }
00709
00717 public function isRestricted() {
00718 global $wgGroupPermissions;
00719
00720 return $this->mRestriction != '' && empty($wgGroupPermissions['*'][$this->mRestriction]);
00721 }
00722
00731 public function userCanExecute( $user ) {
00732 return $user->isAllowed( $this->mRestriction );
00733 }
00734
00738 function displayRestrictionError() {
00739 global $wgOut;
00740 $wgOut->permissionRequired( $this->mRestriction );
00741 }
00742
00746 function setHeaders() {
00747 global $wgOut;
00748 $wgOut->setArticleRelated( false );
00749 $wgOut->setRobotPolicy( "noindex,nofollow" );
00750 $wgOut->setPageTitle( $this->getDescription() );
00751 }
00752
00759 function execute( $par ) {
00760 global $wgUser;
00761
00762 $this->setHeaders();
00763
00764 if ( $this->userCanExecute( $wgUser ) ) {
00765 $func = $this->mFunction;
00766
00767 if(!is_callable($func) and $this->mFile) {
00768 require_once( $this->mFile );
00769 }
00770 $this->outputHeader();
00771 call_user_func( $func, $par, $this );
00772 } else {
00773 $this->displayRestrictionError();
00774 }
00775 }
00776
00785 function outputHeader( $summaryMessageKey = '' ) {
00786 global $wgOut, $wgContLang;
00787
00788 if( $summaryMessageKey == '' ) {
00789 $msg = $wgContLang->lc( $this->name() ) . '-summary';
00790 } else {
00791 $msg = $summaryMessageKey;
00792 }
00793 $out = wfMsgNoTrans( $msg );
00794 if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() ) {
00795 $wgOut->wrapWikiMsg( "<div class='mw-specialpage-summary'>\n$1</div>", $msg );
00796 }
00797
00798 }
00799
00800 # Returns the name that goes in the <h1> in the special page itself, and also the name that
00801 # will be listed in Special:Specialpages
00802 #
00803 # Derived classes can override this, but usually it is easier to keep the default behaviour.
00804 # Messages can be added at run-time, see MessageCache.php
00805 function getDescription() {
00806 return wfMsg( strtolower( $this->mName ) );
00807 }
00808
00812 function getTitle( $subpage = false) {
00813 return self::getTitleFor( $this->mName, $subpage );
00814 }
00815
00819 function setListed( $listed ) {
00820 return wfSetVar( $this->mListed, $listed );
00821 }
00822
00827 function getRedirect( $subpage ) {
00828 return false;
00829 }
00830
00837 function getRedirectQuery() {
00838 global $wgRequest;
00839 $params = array();
00840 foreach( $this->mAllowedRedirectParams as $arg ) {
00841 if( $val = $wgRequest->getVal( $arg, false ) )
00842 $params[] = $arg . '=' . $val;
00843 }
00844
00845 return count( $params ) ? implode( '&', $params ) : false;
00846 }
00847 }
00848
00853 class UnlistedSpecialPage extends SpecialPage
00854 {
00855 function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
00856 SpecialPage::SpecialPage( $name, $restriction, false, $function, $file );
00857 }
00858 }
00859
00864 class IncludableSpecialPage extends SpecialPage
00865 {
00866 function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
00867 SpecialPage::SpecialPage( $name, $restriction, $listed, $function, $file, true );
00868 }
00869 }
00870
00875 class SpecialRedirectToSpecial extends UnlistedSpecialPage {
00876 var $redirName, $redirSubpage;
00877
00878 function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) {
00879 parent::__construct( $name );
00880 $this->redirName = $redirName;
00881 $this->redirSubpage = $redirSubpage;
00882 $this->mAllowedRedirectParams = $redirectParams;
00883 }
00884
00885 function getRedirect( $subpage ) {
00886 if ( $this->redirSubpage === false ) {
00887 return SpecialPage::getTitleFor( $this->redirName, $subpage );
00888 } else {
00889 return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
00890 }
00891 }
00892 }
00893
00905 class SpecialMypage extends UnlistedSpecialPage {
00906 function __construct() {
00907 parent::__construct( 'Mypage' );
00908 $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro', 'section' );
00909 }
00910
00911 function getRedirect( $subpage ) {
00912 global $wgUser;
00913 if ( strval( $subpage ) !== '' ) {
00914 return Title::makeTitle( NS_USER, $wgUser->getName() . '/' . $subpage );
00915 } else {
00916 return Title::makeTitle( NS_USER, $wgUser->getName() );
00917 }
00918 }
00919 }
00920
00925 class SpecialMytalk extends UnlistedSpecialPage {
00926 function __construct() {
00927 parent::__construct( 'Mytalk' );
00928 $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro', 'section' );
00929 }
00930
00931 function getRedirect( $subpage ) {
00932 global $wgUser;
00933 if ( strval( $subpage ) !== '' ) {
00934 return Title::makeTitle( NS_USER_TALK, $wgUser->getName() . '/' . $subpage );
00935 } else {
00936 return Title::makeTitle( NS_USER_TALK, $wgUser->getName() );
00937 }
00938 }
00939 }
00940
00945 class SpecialMycontributions extends UnlistedSpecialPage {
00946 function __construct() {
00947 parent::__construct( 'Mycontributions' );
00948 }
00949
00950 function getRedirect( $subpage ) {
00951 global $wgUser;
00952 return SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() );
00953 }
00954 }