* Removing the if($wgMetaNamespace === FALSE) line, inherited from the parent.
[mediawiki.git] / includes / SpecialSpecialpages.php
blob78fb177a7e2daf5d43ae05394b6a01fe91da820b
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 function wfSpecialSpecialpages() {
12 global $wgLang, $wgOut, $wgUser, $wgAvailableRights;
14 $wgOut->setRobotpolicy( 'index,nofollow' );
15 $sk = $wgUser->getSkin();
17 # Get listable pages, in a 2-d array with the first dimension being user right
18 $pages = SpecialPage::getPages();
20 /** Pages available to all */
21 wfSpecialSpecialpages_gen($pages[''],'spheading',$sk);
23 /** Restricted special pages */
24 $rpages = array();
25 foreach($wgAvailableRights as $right) {
26 /** only show pages a user can access */
27 if( $wgUser->isAllowed($right) ) {
28 /** some rights might not have any special page associated */
29 if(isset($pages[$right])) {
30 $rpages = array_merge( $rpages, $pages[$right] );
34 wfSpecialSpecialpages_gen( $rpages, 'restrictedpheading', $sk );
37 /**
38 * sub function generating the list of pages
39 * @param $pages the list of pages
40 * @param $heading header to be used
41 * @param $sk skin object ???
43 function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
44 global $wgLang, $wgOut, $wgSortSpecialPages;
46 /** Put them into a sortable array */
47 $sortedPages = array();
48 foreach ( $pages as $name => $page ) {
49 if ( $page->isListed() ) {
50 $sortedPages[$page->getDescription()] = $page->getTitle();
54 /** Sort */
55 if ( $wgSortSpecialPages ) {
56 ksort( $sortedPages );
59 /** Now output the HTML */
60 $wgOut->addHTML( '<h2>' . wfMsg( $heading ) . "</h2>\n<ul>" );
61 foreach ( $sortedPages as $desc => $title ) {
62 $link = $sk->makeKnownLinkObj( $title, $desc );
63 $wgOut->addHTML( "<li>{$link}</li>\n" );
65 $wgOut->addHTML( "</ul>\n" );