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