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