Fix #913 : Nostalgia skin no more using isSysop() and isDeveloper()
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 1 Feb 2005 00:35:28 +0000 (00:35 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 1 Feb 2005 00:35:28 +0000 (00:35 +0000)
includes/Skin.php

index 1b60a94..33b4a7e 100644 (file)
@@ -869,26 +869,29 @@ class Skin extends Linker {
         * @TODO crash bug913. Need to be rewrote completly.
         */
        function specialPagesList() {
-               global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript;
+               global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights;
                require_once('SpecialPage.php');
                $a = array();
                $pages = SpecialPage::getPages();
 
+               // special pages without access restriction
                foreach ( $pages[''] as $name => $page ) {
                        $a[$name] = $page->getDescription();
                }
-               if ( $wgUser->isSysop() )
-               {
-                       foreach ( $pages['sysop'] as $name => $page ) {
-                               $a[$name] = $page->getDescription();
-                       }
-               }
-               if ( $wgUser->isDeveloper() )
-               {
-                       foreach ( $pages['developer'] as $name => $page ) {
-                               $a[$name] = $page->getDescription() ;
+
+               // 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();
+                                       }
+                               }
                        }
                }
+               
                $go = wfMsg( 'go' );
                $sp = wfMsg( 'specialpages' );
                $spp = $wgContLang->specialPage( 'Specialpages' );
@@ -898,6 +901,7 @@ class Skin extends Linker {
                $s .= "<select name=\"wpDropdown\">\n";
                $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
 
+               
                foreach ( $a as $name => $desc ) {
                        $p = $wgContLang->specialPage( $name );
                        $s .= "<option value=\"{$p}\">{$desc}</option>\n";