00001 <?php
00030 class SpecialPage {
00038 var $mName;
00042 var $mLocalName;
00047 var $mRestriction;
00051 var $mListed;
00055 var $mFunction;
00059 var $mFile;
00063 var $mIncluding;
00067 var $mIncludable;
00071 var $mAllowedRedirectParams = array();
00081 static public $mList = array(
00082 # Maintenance Reports
00083 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects' ),
00084 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
00085 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects' ),
00086 'Longpages' => array( 'SpecialPage', 'Longpages' ),
00087 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
00088 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
00089 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
00090 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
00091 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
00092 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
00093 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
00094 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ),
00095 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ),
00096 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages' ),
00097 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ),
00098 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ),
00099 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ),
00100 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ),
00101 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
00102 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ),
00103 'Wantedfiles' => array( 'SpecialPage', 'Wantedfiles' ),
00104 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ),
00105 'Wantedtemplates' => array( 'SpecialPage', 'Wantedtemplates' ),
00106
00107 # List of pages
00108 'Allpages' => 'SpecialAllpages',
00109 'Prefixindex' => 'SpecialPrefixindex',
00110 'Categories' => array( 'SpecialPage', 'Categories' ),
00111 'Disambiguations' => array( 'SpecialPage', 'Disambiguations' ),
00112 'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
00113
00114 # Login/create account
00115 'Userlogin' => array( 'SpecialPage', 'Userlogin' ),
00116 'CreateAccount' => array( 'SpecialRedirectToSpecial', 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) ),
00117
00118 # Users and rights
00119 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
00120 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
00121 'Resetpass' => 'SpecialResetpass',
00122 'DeletedContributions' => 'DeletedContributionsPage',
00123 'Preferences' => 'SpecialPreferences',
00124 'Contributions' => 'SpecialContributions',
00125 'Listgrouprights' => 'SpecialListGroupRights',
00126 'Listusers' => array( 'SpecialPage', 'Listusers' ),
00127 'Activeusers' => 'SpecialActiveUsers',
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' => 'SpecialUpload',
00145
00146 # Wiki data and tools
00147 'Statistics' => 'SpecialStatistics',
00148 'Allmessages' => 'SpecialAllmessages',
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' => 'SpecialWhatlinkshere',
00171 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
00172
00173 # Other
00174 'Booksources' => 'SpecialBookSources',
00175
00176 # Unlisted / redirects
00177 'Blankpage' => 'SpecialBlankpage',
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 $wgOut->setTitle( $title );
00578
00579 $ret = SpecialPage::executePath( $title, true );
00580 if ( $ret === true ) {
00581 $ret = $wgOut->getHTML();
00582 }
00583 $wgTitle = $oldTitle;
00584 $wgOut = $oldOut;
00585 return $ret;
00586 }
00587
00596 static function getLocalNameFor( $name, $subpage = false ) {
00597 global $wgContLang;
00598 $aliases = $wgContLang->getSpecialPageAliases();
00599 if ( isset( $aliases[$name][0] ) ) {
00600 $name = $aliases[$name][0];
00601 } else {
00602
00603 $found = false;
00604 foreach ( $aliases as $n => $values ) {
00605 if ( strcasecmp( $name, $n ) === 0 ) {
00606 wfWarn( "Found alias defined for $n when searching for special page aliases
00607 for $name. Case mismatch?" );
00608 $name = $values[0];
00609 $found = true;
00610 break;
00611 }
00612 }
00613 if ( !$found ) wfWarn( "Did not find alias for special page '$name'.
00614 Perhaps no page aliases are defined for it?" );
00615 }
00616 if ( $subpage !== false && !is_null( $subpage ) ) {
00617 $name = "$name/$subpage";
00618 }
00619 return $wgContLang->ucfirst( $name );
00620 }
00621
00625 static function getTitleFor( $name, $subpage = false ) {
00626 $name = self::getLocalNameFor( $name, $subpage );
00627 if ( $name ) {
00628 return Title::makeTitle( NS_SPECIAL, $name );
00629 } else {
00630 throw new MWException( "Invalid special page name \"$name\"" );
00631 }
00632 }
00633
00637 static function getSafeTitleFor( $name, $subpage = false ) {
00638 $name = self::getLocalNameFor( $name, $subpage );
00639 if ( $name ) {
00640 return Title::makeTitleSafe( NS_SPECIAL, $name );
00641 } else {
00642 return null;
00643 }
00644 }
00645
00650 static function getTitleForAlias( $alias ) {
00651 $name = self::resolveAlias( $alias );
00652 if ( $name ) {
00653 return self::getTitleFor( $name );
00654 } else {
00655 return null;
00656 }
00657 }
00658
00675 function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
00676 $this->mName = $name;
00677 $this->mRestriction = $restriction;
00678 $this->mListed = $listed;
00679 $this->mIncludable = $includable;
00680 if ( $function == false ) {
00681 $this->mFunction = 'wfSpecial'.$name;
00682 } else {
00683 $this->mFunction = $function;
00684 }
00685 if ( $file === 'default' ) {
00686 $this->mFile = dirname(__FILE__) . "/specials/Special$name.php";
00687 } else {
00688 $this->mFile = $file;
00689 }
00690 }
00691
00697 function getName() { return $this->mName; }
00698 function getRestriction() { return $this->mRestriction; }
00699 function getFile() { return $this->mFile; }
00700 function isListed() { return $this->mListed; }
00706 function name( $x = null ) { return wfSetVar( $this->mName, $x ); }
00707 function restrictions( $x = null) {
00708 # Use the one below this
00709 wfDeprecated( __METHOD__ );
00710 return wfSetVar( $this->mRestriction, $x );
00711 }
00712 function restriction( $x = null) { return wfSetVar( $this->mRestriction, $x ); }
00713 function listed( $x = null) { return wfSetVar( $this->mListed, $x ); }
00714 function func( $x = null) { return wfSetVar( $this->mFunction, $x ); }
00715 function file( $x = null) { return wfSetVar( $this->mFile, $x ); }
00716 function includable( $x = null ) { return wfSetVar( $this->mIncludable, $x ); }
00717 function including( $x = null ) { return wfSetVar( $this->mIncluding, $x ); }
00723 function getLocalName() {
00724 if ( !isset( $this->mLocalName ) ) {
00725 $this->mLocalName = self::getLocalNameFor( $this->mName );
00726 }
00727 return $this->mLocalName;
00728 }
00729
00737 public function isRestricted() {
00738 global $wgGroupPermissions;
00739
00740 return $this->mRestriction != '' && empty($wgGroupPermissions['*'][$this->mRestriction]);
00741 }
00742
00751 public function userCanExecute( $user ) {
00752 return $user->isAllowed( $this->mRestriction );
00753 }
00754
00758 function displayRestrictionError() {
00759 global $wgOut;
00760 $wgOut->permissionRequired( $this->mRestriction );
00761 }
00762
00766 function setHeaders() {
00767 global $wgOut;
00768 $wgOut->setArticleRelated( false );
00769 $wgOut->setRobotPolicy( "noindex,nofollow" );
00770 $wgOut->setPageTitle( $this->getDescription() );
00771 }
00772
00779 function execute( $par ) {
00780 global $wgUser;
00781
00782 $this->setHeaders();
00783
00784 if ( $this->userCanExecute( $wgUser ) ) {
00785 $func = $this->mFunction;
00786
00787 if(!is_callable($func) and $this->mFile) {
00788 require_once( $this->mFile );
00789 }
00790 $this->outputHeader();
00791 call_user_func( $func, $par, $this );
00792 } else {
00793 $this->displayRestrictionError();
00794 }
00795 }
00796
00805 function outputHeader( $summaryMessageKey = '' ) {
00806 global $wgOut, $wgContLang;
00807
00808 if( $summaryMessageKey == '' ) {
00809 $msg = $wgContLang->lc( $this->name() ) . '-summary';
00810 } else {
00811 $msg = $summaryMessageKey;
00812 }
00813 $out = wfMsgNoTrans( $msg );
00814 if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() ) {
00815 $wgOut->wrapWikiMsg( "<div class='mw-specialpage-summary'>\n$1</div>", $msg );
00816 }
00817
00818 }
00819
00820 # Returns the name that goes in the <h1> in the special page itself, and also the name that
00821 # will be listed in Special:Specialpages
00822 #
00823 # Derived classes can override this, but usually it is easier to keep the default behaviour.
00824 # Messages can be added at run-time, see MessageCache.php
00825 function getDescription() {
00826 return wfMsg( strtolower( $this->mName ) );
00827 }
00828
00832 function getTitle( $subpage = false ) {
00833 return self::getTitleFor( $this->mName, $subpage );
00834 }
00835
00839 function setListed( $listed ) {
00840 return wfSetVar( $this->mListed, $listed );
00841 }
00842
00847 function getRedirect( $subpage ) {
00848 return false;
00849 }
00850
00857 function getRedirectQuery() {
00858 global $wgRequest;
00859 $params = array();
00860 foreach( $this->mAllowedRedirectParams as $arg ) {
00861 if( ( $val = $wgRequest->getVal( $arg, null ) ) !== null )
00862 $params[] = $arg . '=' . $val;
00863 }
00864
00865 return count( $params ) ? implode( '&', $params ) : false;
00866 }
00867 }
00868
00873 class UnlistedSpecialPage extends SpecialPage
00874 {
00875 function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
00876 SpecialPage::SpecialPage( $name, $restriction, false, $function, $file );
00877 }
00878 }
00879
00884 class IncludableSpecialPage extends SpecialPage
00885 {
00886 function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
00887 SpecialPage::SpecialPage( $name, $restriction, $listed, $function, $file, true );
00888 }
00889 }
00890
00895 class SpecialRedirectToSpecial extends UnlistedSpecialPage {
00896 var $redirName, $redirSubpage;
00897
00898 function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) {
00899 parent::__construct( $name );
00900 $this->redirName = $redirName;
00901 $this->redirSubpage = $redirSubpage;
00902 $this->mAllowedRedirectParams = $redirectParams;
00903 }
00904
00905 function getRedirect( $subpage ) {
00906 if ( $this->redirSubpage === false ) {
00907 return SpecialPage::getTitleFor( $this->redirName, $subpage );
00908 } else {
00909 return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
00910 }
00911 }
00912 }
00913
00925 class SpecialMypage extends UnlistedSpecialPage {
00926 function __construct() {
00927 parent::__construct( 'Mypage' );
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, $wgUser->getName() . '/' . $subpage );
00935 } else {
00936 return Title::makeTitle( NS_USER, $wgUser->getName() );
00937 }
00938 }
00939 }
00940
00945 class SpecialMytalk extends UnlistedSpecialPage {
00946 function __construct() {
00947 parent::__construct( 'Mytalk' );
00948 $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro', 'section' );
00949 }
00950
00951 function getRedirect( $subpage ) {
00952 global $wgUser;
00953 if ( strval( $subpage ) !== '' ) {
00954 return Title::makeTitle( NS_USER_TALK, $wgUser->getName() . '/' . $subpage );
00955 } else {
00956 return Title::makeTitle( NS_USER_TALK, $wgUser->getName() );
00957 }
00958 }
00959 }
00960
00965 class SpecialMycontributions extends UnlistedSpecialPage {
00966 function __construct() {
00967 parent::__construct( 'Mycontributions' );
00968 $this->mAllowedRedirectParams = array( 'limit', 'namespace', 'tagfilter',
00969 'offset', 'dir', 'year', 'month', 'feed' );
00970 }
00971
00972 function getRedirect( $subpage ) {
00973 global $wgUser;
00974 return SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() );
00975 }
00976 }