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