* Rewrote showEXIFdata() to use addWikiText() instead of addHTML()
[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 /** 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();
51 }
52 }
53
54 /** Sort */
55 if ( $wgSortSpecialPages ) {
56 ksort( $sortedPages );
57 }
58
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" );
64 }
65 $wgOut->addHTML( "</ul>\n" );
66 }
67
68 ?>