*Clean up deletion of revisions and remove some gaps
[lhc/web/wiklou.git] / includes / SpecialSpecialpages.php
1 <?php
2 /**
3 *
4 * @addtogroup SpecialPage
5 */
6
7 /**
8 *
9 */
10 function wfSpecialSpecialpages() {
11 global $wgOut, $wgUser, $wgMessageCache;
12
13 $wgMessageCache->loadAllMessages();
14
15 $wgOut->setRobotpolicy( 'index,nofollow' );
16 $sk = $wgUser->getSkin();
17
18 /** Pages available to all */
19 wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk, false );
20
21 /** Restricted special pages */
22 wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk, false );
23
24 /** Restricted logs */
25 wfSpecialSpecialpages_gen( SpecialPage::getRestrictedLogs(), 'restrictedlheading', $sk, true );
26 }
27
28 /**
29 * sub function generating the list of pages
30 * @param $pages the list of pages
31 * @param $heading header to be used
32 * @param $sk skin object ???
33 * @param $islog, is this for a list of log types?
34 */
35 function wfSpecialSpecialpages_gen( $pages, $heading, $sk, $islog=false ) {
36 global $wgOut, $wgUser, $wgSortSpecialPages;
37
38 if( count( $pages ) == 0 ) {
39 # Yeah, that was pointless. Thanks for coming.
40 return;
41 }
42
43 /** Put them into a sortable array */
44 $sortedPages = array();
45 if( $islog ) {
46 $sortedPages = $pages;
47 } else {
48 foreach ( $pages as $page ) {
49 if ( $page->isListed() ) {
50 $sortedPages[$page->getDescription()] = $page->getTitle();
51 }
52 }
53 }
54
55 /** Sort */
56 if ( $wgSortSpecialPages ) {
57 ksort( $sortedPages );
58 }
59
60 /** Now output the HTML */
61 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
62 foreach ( $sortedPages as $desc => $title ) {
63 $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
64 $wgOut->addHTML( "<li>{$link}</li>\n" );
65 }
66 $wgOut->addHTML( "</ul>\n" );
67 }
68
69