split prefs-help-userdata to prefs-help-realname & prefs-help-email. Nds still need...
[lhc/web/wiklou.git] / includes / SpecialSpecialpages.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 function wfSpecialSpecialpages() {
12 global $wgLang, $wgOut, $wgUser, $wgAvailableRights;
13
14 $wgOut->setRobotpolicy( 'index,nofollow' );
15 $sk = $wgUser->getSkin();
16
17 # Get listable pages, in a 2-d array with the first dimension being user right
18 $pages = SpecialPage::getPages();
19
20 /** Pages available to all */
21 wfSpecialSpecialpages_gen($pages[''],'spheading',$sk);
22
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] );
31 }
32 }
33 }
34 wfSpecialSpecialpages_gen( $rpages, 'restrictedpheading', $sk );
35 }
36
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 ???
42 */
43 function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
44 global $wgLang, $wgOut, $wgSortSpecialPages;
45
46 if( count( $pages ) == 0 ) {
47 # Yeah, that was pointless. Thanks for coming.
48 return;
49 }
50
51 /** Put them into a sortable array */
52 $sortedPages = array();
53 foreach ( $pages as $name => $page ) {
54 if ( $page->isListed() ) {
55 $sortedPages[$page->getDescription()] = $page->getTitle();
56 }
57 }
58
59 /** Sort */
60 if ( $wgSortSpecialPages ) {
61 ksort( $sortedPages );
62 }
63
64 /** Now output the HTML */
65 $wgOut->addHTML( '<h2>' . wfMsg( $heading ) . "</h2>\n<ul>" );
66 foreach ( $sortedPages as $desc => $title ) {
67 $link = $sk->makeKnownLinkObj( $title, $desc );
68 $wgOut->addHTML( "<li>{$link}</li>\n" );
69 }
70 $wgOut->addHTML( "</ul>\n" );
71 }
72
73 ?>