Postgres: make sure ar_len is added when updating, alpha stuff in updaters.inc
[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;
12
13 $wgOut->setRobotpolicy( 'index,nofollow' );
14 $sk = $wgUser->getSkin();
15
16 /** Pages available to all */
17 wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk, false );
18
19 /** Restricted special pages */
20 wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk, true );
21 }
22
23 /**
24 * sub function generating the list of pages
25 * @param $pages the list of pages
26 * @param $heading header to be used
27 * @param $sk skin object ???
28 * @param $restricted, restricted pages or not
29 */
30 function wfSpecialSpecialpages_gen($pages,$heading,$sk,$restricted) {
31 global $wgOut, $wgUser, $wgSortSpecialPages, $wgLogRestrictions, $wgLogNames;
32
33 if( count( $pages ) == 0 ) {
34 # Yeah, that was pointless. Thanks for coming.
35 return;
36 }
37
38 /** Put them into a sortable array */
39 $sortedPages = array();
40 foreach ( $pages as $page ) {
41 if ( $page->isListed() ) {
42 $sortedPages[$page->getDescription()] = $page->getTitle();
43 }
44 }
45
46 # Add private logs
47 if ( $restricted && isset($wgLogRestrictions) ) {
48 foreach ( $wgLogRestrictions as $type => $restriction ) {
49 $page = SpecialPage::getTitleFor( 'Log', $type );
50 if ( $restriction != '' && $wgUser->isAllowed( $restriction ) ) {
51 $name = wfMsgHtml( $wgLogNames[$type] );
52 $sortedPages[$name] = $page;
53 }
54 }
55 }
56
57 /** Sort */
58 if ( $wgSortSpecialPages ) {
59 ksort( $sortedPages );
60 }
61
62 /** Now output the HTML */
63 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
64 foreach ( $sortedPages as $desc => $title ) {
65 $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
66 $wgOut->addHTML( "<li>{$link}</li>\n" );
67 }
68 $wgOut->addHTML( "</ul>\n" );
69 }
70
71 ?>