/**#@-*/
/**
- * User rights management
- * a big array of string defining a right, that's how they are saved in the
- * database.
- * @todo Is this necessary?
+ * User rights list
+ * @deprecated
*/
$wgAvailableRights = array(
'block',
* @TODO crash bug913. Need to be rewrote completly.
*/
function specialPagesList() {
- global $wgUser, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights;
+ global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
require_once('SpecialPage.php');
$a = array();
$pages = SpecialPage::getPages();
}
// Other special pages that are restricted.
- // Copied from SpecialSpecialpages.php
- foreach($wgAvailableRights as $right) {
- if( $wgUser->isAllowed($right) ) {
- /** Add all pages for this right */
- if(isset($pages[$right])) {
- foreach($pages[$right] as $name => $page) {
- $a[$name] = $page->getDescription();
- }
- }
+ foreach ( $pages['restricted'] as $name => $page ) {
+ if( $wgUser->isAllowed( $page->getRestriction() ) ) {
+ $a[$name] = $page->getDescription();
}
}
foreach ( self::$mList as $name => $rec ) {
$page = self::getPage( $name );
if ( $page->isListed() ) {
- $pages[$page->getRestriction()][$page->getName()] = $page;
+ $restricted = $page->getRestriction() == '' ? '' : 'restricted';
+ $pages[$restricted][$page->getName()] = $page;
}
}
return $pages;
*
*/
function wfSpecialSpecialpages() {
- global $wgOut, $wgUser, $wgAvailableRights;
+ global $wgOut, $wgUser;
$wgOut->setRobotpolicy( 'index,nofollow' );
$sk = $wgUser->getSkin();
/** Restricted special pages */
$rpages = array();
- foreach($wgAvailableRights as $right) {
- /** only show pages a user can access */
- if( $wgUser->isAllowed($right) ) {
- /** some rights might not have any special page associated */
- if(isset($pages[$right])) {
- $rpages = array_merge( $rpages, $pages[$right] );
- }
+ foreach ( $pages['restricted'] as $name => $page ) {
+ if( $wgUser->isAllowed( $page->getRestriction() ) ) {
+ $rpages[$name] = $page;
}
}
wfSpecialSpecialpages_gen( $rpages, 'restrictedpheading', $sk );
/**
* Check if user is allowed to access a feature / make an action
- * @param string $action Action to be checked (see $wgAvailableRights in Defines.php for possible actions).
+ * @param string $action Action to be checked
* @return boolean True: action is allowed, False: action should not be allowed
*/
function isAllowed($action='') {