fixup database timestamps
[lhc/web/wiklou.git] / includes / SkinWikimediaWiki.php
1 <?php
2 # Tentative to make a skin for wikimedia.org
3 # $Id$
4
5 require_once( 'Skin.php' );
6 require_once( 'SkinPHPTal.php' );
7
8 $wgExtraSkins['wikimediawiki'] = 'Wikimediawiki';
9
10 class SkinWikimediawiki extends SkinMonoBook {
11 function initPage( &$out ) {
12 SkinPHPTal::initPage( $out );
13 $this->skinname = "wikimediawiki";
14 $this->template = "xhtml_slim_wikimediawiki";
15 }
16
17 # build array of common navigation links
18 function buildNavUrls () {
19 global $wgTitle, $wgUser, $wgRequest;
20 global $wgSiteSupportPage;
21
22 $action = $wgRequest->getText( 'action' );
23 $oldid = $wgRequest->getVal( 'oldid' );
24 $diff = $wgRequest->getVal( 'diff' );
25 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
26 $nav_urls = array();
27 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
28 $nav_urls['randompage'] = (wfMsg('randompage') != '-') ? array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage'))) : false;
29 $nav_urls['recentchanges'] = (wfMsg('recentchanges') != '-') ? array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges'))) : false;
30 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.urlencode( $this->thispage ))));
31 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false;
32 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false;
33 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.urlencode( $this->thispage ))));
34 $nav_urls['bugreports'] = (wfMsg('bugreports') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage'))) : false;
35 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
36 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
37 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
38 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
39
40
41 # Specific for mediawiki.org menu
42 $nav_urls['aboutmediawiki'] = (wfMsg('aboutmediawiki') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('aboutmediawiki-url'))) : false;
43 $nav_urls['projects'] = (wfMsg('projects') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('projects-url'))) : false;
44 $nav_urls['membership'] = (wfMsg('membership') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('membership-url'))) : false;
45 $nav_urls['pressroom'] = (wfMsg('pressroom') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('pressroom-url'))) : false;
46 $nav_urls['software'] = (wfMsg('software') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('software-url'))) : false;
47 $nav_urls['localchapters'] = (wfMsg('localchapters') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('localchapters-url'))) : false;
48 $nav_urls['contactus'] = (wfMsg('contactus') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('contactus-url'))) : false;
49
50 if( $wgTitle->getNamespace() == NS_USER || $wgTitle->getNamespace() == NS_USER_TALK ) {
51 $id = User::idFromName($wgTitle->getText());
52 $ip = User::isIP($wgTitle->getText());
53 } else {
54 $id = 0;
55 $ip = false;
56 }
57
58 if ( 0 != $wgUser->getID() ) { # show only to signed in users
59 if($id) {
60 # can only email non-anons
61 $nav_urls['emailuser'] = array(
62 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
63 );
64 # only non-anons have contrib list
65 $nav_urls['contributions'] = array(
66 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
67 );
68 }
69 }
70
71
72 return $nav_urls;
73 }
74 }
75
76
77 ?>