X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSpecialPage.php;h=3932964df197ed831f755aec674112a5a478145f;hb=3ccc99dec18a49561d49dd42c10625ecdc61df85;hp=4767626b7e86c4a27b51be25af8b60ebee05ea26;hpb=8ecd17b7e1195199f89fc8331bbc4128eac059f0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 4767626b7e..3932964df1 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -17,8 +17,7 @@ * SpecialPage::$mList. To remove a core static special page at runtime, use * a SpecialPage_initList hook. * - * @package MediaWiki - * @subpackage SpecialPage + * @addtogroup SpecialPage */ /** @@ -27,8 +26,8 @@ /** * Parent special page class, also static functions for handling the special - * page list - * @package MediaWiki + * page list. + * @addtogroup SpecialPage */ class SpecialPage { @@ -95,27 +94,31 @@ class SpecialPage 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages' ), 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ), 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ), + 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ), 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ), 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ), 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ), 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ), 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ), 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ), + 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ), 'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ), 'Mostimages' => array( 'SpecialPage', 'Mostimages' ), 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ), + 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ), 'Shortpages' => array( 'SpecialPage', 'Shortpages' ), 'Longpages' => array( 'SpecialPage', 'Longpages' ), 'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ), 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ), 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ), + 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ), 'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ), 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) , 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ), 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ), - 'Contributions' => array( 'UnlistedSpecialPage', 'Contributions' ), + 'Contributions' => array( 'SpecialPage', 'Contributions' ), 'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ), - 'Whatlinkshere' => array( 'UnlistedSpecialPage', 'Whatlinkshere' ), + 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ), 'Recentchangeslinked' => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ), 'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ), 'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ), @@ -135,10 +138,10 @@ class SpecialPage 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ), 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ), 'Listredirects' => array( 'SpecialPage', 'Listredirects' ), - 'Listinterwikis' => array( 'SpecialPage', 'Listinterwikis' ), 'Revisiondelete' => array( 'SpecialPage', 'Revisiondelete', 'deleterevision' ), 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ), 'Randomredirect' => array( 'SpecialPage', 'Randomredirect' ), + 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ), 'Mypage' => array( 'SpecialMypage' ), 'Mytalk' => array( 'SpecialMytalk' ), @@ -176,7 +179,7 @@ class SpecialPage } if( $wgEmailAuthentication ) { - self::$mList['Confirmemail'] = array( 'UnlistedSpecialPage', 'Confirmemail' ); + self::$mList['Confirmemail'] = 'EmailConfirmation'; } # Add extension special pages @@ -273,6 +276,30 @@ class SpecialPage unset( self::$mList[$name] ); } + /** + * Check if a given name exist as a special page or as a special page alias + * @param $name string: name of a special page + * @return boolean: true if a special page exists with this name + */ + static function exists( $name ) { + global $wgContLang; + if ( !self::$mListInitialised ) { + self::initList(); + } + if( !self::$mAliases ) { + self::initAliasList(); + } + + # Remove special pages inline parameters: + $bits = explode( '/', $name ); + $name = $wgContLang->caseFold($bits[0]); + + return + array_key_exists( $name, self::$mList ) + or array_key_exists( $name, self::$mAliases ) + ; + } + /** * Find the object with a given name and return it (or NULL) * @static @@ -536,7 +563,7 @@ class SpecialPage $this->mFunction = $function; } if ( $file === 'default' ) { - $this->mFile = "Special{$name}.php"; + $this->mFile = dirname(__FILE__) . "/Special{$name}.php"; } else { $this->mFile = $file; } @@ -692,7 +719,7 @@ class SpecialPage /** * Shortcut to construct a special page which is unlisted by default - * @package MediaWiki + * @addtogroup SpecialPage */ class UnlistedSpecialPage extends SpecialPage { @@ -703,7 +730,7 @@ class UnlistedSpecialPage extends SpecialPage /** * Shortcut to construct an includable special page - * @package MediaWiki + * @addtogroup SpecialPage */ class IncludableSpecialPage extends SpecialPage { @@ -712,6 +739,10 @@ class IncludableSpecialPage extends SpecialPage } } +/** + * Shortcut to construct a special page alias. + * @addtogroup SpecialPage + */ class SpecialRedirectToSpecial extends UnlistedSpecialPage { var $redirName, $redirSubpage; @@ -731,10 +762,21 @@ class SpecialRedirectToSpecial extends UnlistedSpecialPage { } } +/** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages + * are used to get user independant links pointing to the user page, talk + * page and list of contributions. + * This can let us cache a single copy of any generated content for all + * users. + */ + +/** + * Shortcut to construct a special page pointing to current user user's page. + * @addtogroup SpecialPage + */ class SpecialMypage extends UnlistedSpecialPage { function __construct() { parent::__construct( 'Mypage' ); - $this->mAllowedRedirectParams = array( 'action' ); + $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro' ); } function getRedirect( $subpage ) { @@ -747,10 +789,14 @@ class SpecialMypage extends UnlistedSpecialPage { } } +/** + * Shortcut to construct a special page pointing to current user talk page. + * @addtogroup SpecialPage + */ class SpecialMytalk extends UnlistedSpecialPage { function __construct() { parent::__construct( 'Mytalk' ); - $this->mAllowedRedirectParams = array( 'action' ); + $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro' ); } function getRedirect( $subpage ) { @@ -763,6 +809,10 @@ class SpecialMytalk extends UnlistedSpecialPage { } } +/** + * Shortcut to construct a special page pointing to current user contributions. + * @addtogroup SpecialPage + */ class SpecialMycontributions extends UnlistedSpecialPage { function __construct() { parent::__construct( 'Mycontributions' ); @@ -773,5 +823,3 @@ class SpecialMycontributions extends UnlistedSpecialPage { return SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() ); } } - -?>