aboutsummaryrefslogtreecommitdiffstats
path: root/includes/SpecialSpecialpages.php
blob: 98587a7a15cb26d9b76fa2874d934f4e7be89303 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
 *
 */

/**
 *
 */
function wfSpecialSpecialpages() {
	global $wgLang, $wgOut, $wgUser;
	
	$wgOut->setRobotpolicy( "index,nofollow" );
	$sk = $wgUser->getSkin();	
	
	# Get listable pages
	$pages = SpecialPage::getPages();

	# all users special pages
	wfSpecialSpecialpages_gen($pages[""],"spheading",$sk);

	# sysops only special pages
	if ( $wgUser->isSysop() ) {
		wfSpecialSpecialpages_gen($pages["sysop"],"sysopspheading",$sk);
	}

	# developers only special pages
	if ( $wgUser->isDeveloper() ) {
		wfSpecialSpecialpages_gen($pages["developer"],"developerspheading",$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>" );
	foreach ( $pages as $name => $page ) {
		if( !$page->isListed() ) {
			continue;
		}
		$link = $sk->makeKnownLinkObj( $page->getTitle(), $page->getDescription() );
		$wgOut->addHTML( "<li>{$link}</li>\n" );
	}
	$wgOut->addHTML( "</ul>\n" );
}

?>