<?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
-function wfSpecialSpecialpages()
-{
- global $wgLang, $wgOut, $wgUser, $wgSpecialPages;
+/**
+ *
+ */
+function wfSpecialSpecialpages() {
+ global $wgLang, $wgOut, $wgUser, $wgAvailableRights;
- $wgOut->setRobotpolicy( "index,nofollow" );
+ $wgOut->setRobotpolicy( 'index,nofollow' );
$sk = $wgUser->getSkin();
+
+ # Get listable pages
+ $pages = SpecialPage::getPages();
- # Categorise special pages
-
- $pages = array(
- "" => array(),
- "sysop" => array(),
- "developer" => array()
- );
+ /** pages available to all */
+ wfSpecialSpecialpages_gen($pages[''],'spheading',$sk);
- foreach ( $wgSpecialPages as $page ) {
- $pages[$page->getRestriction()][$page->getName()] = $page;
+ /** show pages splitted by user rights */
+ 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])) {
+ wfSpecialSpecialpages_gen($pages[$right], $right.'pheading', $sk);
+ }
+ }
+
}
-
+/** FIXME : spheading, sysopspheading, developerspheading need to be removed
+from language files [av] */
+/**
# all users special pages
- wfSpecialSpecialpages_gen($pages[""],"spheading",$sk);
+ wfSpecialSpecialpages_gen($pages[''],'spheading',$sk);
# sysops only special pages
if ( $wgUser->isSysop() ) {
- wfSpecialSpecialpages_gen($pages["sysop"],"sysopspheading",$sk);
+ wfSpecialSpecialpages_gen($pages['sysop'],'sysopspheading',$sk);
}
# developers only special pages
if ( $wgUser->isDeveloper() ) {
- wfSpecialSpecialpages_gen($pages["developer"],"developerspheading",$sk);
+ wfSpecialSpecialpages_gen($pages['developer'],'developerspheading',$sk);
}
+*/
}
-# sub function generating the list of pages
-# $pages : the list of pages
-# $heading : header to be used
-# $sk : skin object ???
-
-function wfSpecialSpecialpages_gen($pages,$heading,$sk)
-{
+/**
+ * sub function generating the list of pages
+ * @param $pages the list of pages
+ * @param $heading header to be used
+ * @param $sk skin object ???
+ */
+function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
global $wgLang, $wgOut, $wgAllowSysopQueries;
- $wgOut->addHTML( "<h2>" . wfMsg( $heading ) . "</h2>\n<ul>" );
+ $wgOut->addHTML( '<h2>' . wfMsg( $heading ) . "</h2>\n<ul>" );
foreach ( $pages as $name => $page ) {
if( !$page->isListed() ) {
continue;