<?php
+/**
+ * Base class for template-based skins
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
if ( ! defined( 'MEDIAWIKI' ) )
die( 1 );
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# http://www.gnu.org/copyleft/gpl.html
-
/**
* Wrapper object for MediaWiki's localization functions,
* to be passed to the template engine.
* @param $out OutputPage
*/
function setupSkinUserCss( OutputPage $out ){
- $out->addStyle( 'common/shared.css', 'screen' );
- $out->addStyle( 'common/commonPrint.css', 'print' );
+ $out->addModuleStyles( array( 'mediawiki.legacy.shared', 'mediawiki.legacy.commonPrint' ) );
}
/**
*/
function outputPage( OutputPage $out ) {
global $wgArticle, $wgUser, $wgLang, $wgContLang;
- global $wgScript, $wgStylePath, $wgContLanguageCode;
+ global $wgScript, $wgStylePath, $wgLanguageCode;
global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
$tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace );
$tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
$tpl->set( 'html5version', $wgHtml5Version );
- $tpl->set( 'headlinks', $out->getHeadLinks() );
+ $tpl->set( 'headlinks', $out->getHeadLinks( $this ) );
$tpl->set( 'csslinks', $out->buildCssLinks() );
if( $wgUseTrackbacks && $out->isArticleRelated() ) {
$tpl->setRef( 'scriptpath', $wgScriptPath );
$tpl->setRef( 'serverurl', $wgServer );
$tpl->setRef( 'logopath', $wgLogo );
- $tpl->setRef( 'lang', $wgContLanguageCode );
- $tpl->set( 'dir', $wgContLang->getDir() );
- $tpl->set( 'rtl', $wgContLang->isRTL() );
+
+ $lang = wfUILang();
+ $tpl->set( 'lang', $lang->getCode() );
+ $tpl->set( 'dir', $lang->getDir() );
+ $tpl->set( 'rtl', $lang->isRTL() );
+
$tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' );
$tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) );
$tpl->set( 'username', $wgUser->isAnon() ? null : $this->username );
if( $wgPageShowWatchingUsers ) {
$dbr = wfGetDB( DB_SLAVE );
- $watchlist = $dbr->tableName( 'watchlist' );
$res = $dbr->select( 'watchlist',
array( 'COUNT(*) AS n' ),
array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
$tpl->set( 'privacy', $this->privacyLink() );
$tpl->set( 'about', $this->aboutLink() );
+ $tpl->set( 'footerlinks', array(
+ 'info' => array(
+ 'lastmod',
+ 'viewcount',
+ 'numberofwatchingusers',
+ 'credits',
+ 'copyright',
+ ),
+ 'places' => array(
+ 'privacy',
+ 'about',
+ 'disclaimer',
+ ),
+ ) );
+
+ global $wgFooterIcons;
+ $tpl->set( 'footericons', $wgFooterIcons );
+ foreach ( $tpl->data["footericons"] as $footerIconsKey => &$footerIconsBlock ) {
+ if ( count($footerIconsBlock) > 0 ) {
+ foreach ( $footerIconsBlock as &$footerIcon ) {
+ if ( isset($footerIcon["src"]) ) {
+ if ( !isset($footerIcon["width"]) ) $footerIcon["width"] = 88;
+ if ( !isset($footerIcon["height"]) ) $footerIcon["height"] = 31;
+ }
+ }
+ } else {
+ unset($tpl->data["footericons"][$footerIconsKey]);
+ }
+ }
+
if ( $wgDebugComments ) {
$tpl->setRef( 'debug', $out->mDebugtext );
} else {
$tpl->set( 'reporttime', wfReportTime() );
$tpl->set( 'sitenotice', wfGetSiteNotice() );
- $tpl->set( 'bottomscripts', $this->bottomScripts() );
+ $tpl->set( 'bottomscripts', $this->bottomScripts( $out ) );
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
+ global $wgBetterDirectionality;
+ if ( $wgBetterDirectionality ) {
+ $realBodyAttribs = array( 'lang' => $wgLanguageCode, 'dir' => $wgContLang->getDir() );
+ $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
+ }
$out->mBodytext .= $printfooter . $this->generateDebugHTML();
$tpl->setRef( 'bodytext', $out->mBodytext );
$loginlink = $wgUser->isAllowed( 'createaccount' )
? 'nav-login-createaccount'
: 'login';
+
+ # anonlogin & login are the same
+ $login_url = array(
+ 'text' => wfMsg( $loginlink ),
+ 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
+ 'active' => $title->isSpecial( 'Userlogin' )
+ );
+ global $wgProto, $wgSecureLogin;
+ if( $wgProto === 'http' && $wgSecureLogin ) {
+ $title = SpecialPage::getTitleFor( 'Userlogin' );
+ $https_url = preg_replace( '/^http:/', 'https:', $title->getFullURL() );
+ $login_url['href'] = $https_url;
+ $login_url['class'] = 'link-https'; # FIXME class depends on skin
+ }
+
if( $this->showIPinHeader() ) {
$href = &$this->userpageUrlDetails['href'];
$personal_urls['anonuserpage'] = array(
'class' => $usertalkUrlDetails['exists'] ? false : 'new',
'active' => ( $pageurl == $href )
);
- $personal_urls['anonlogin'] = array(
- 'text' => wfMsg( $loginlink ),
- 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
- 'active' => $title->isSpecial( 'Userlogin' )
- );
+ $personal_urls['anonlogin'] = $login_url;
} else {
- $personal_urls['login'] = array(
- 'text' => wfMsg( $loginlink ),
- 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
- 'active' => $title->isSpecial( 'Userlogin' )
- );
+ $personal_urls['login'] = $login_url;
}
}
self::checkTitle( $title, $name );
return array(
'href' => $title->getLocalURL( $urlaction ),
- 'exists' => $title->getArticleID() != 0 ? true : false
+ 'exists' => $title->getArticleID() != 0,
);
}
self::checkTitle( $title, $name );
return array(
'href' => $title->getLocalURL( $urlaction ),
- 'exists' => $title->getArticleID() != 0 ? true : false
+ 'exists' => $title->getArticleID() != 0,
);
}
} else {
//article doesn't exist or is deleted
if( $wgUser->isAllowed( 'deletedhistory' ) && $wgUser->isAllowed( 'deletedtext' ) ) {
- if( $n = $this->mTitle->isDeleted() ) {
+ $n = $this->mTitle->isDeleted();
+ if( $n ) {
$undelTitle = SpecialPage::getTitleFor( 'Undelete' );
$content_actions['undelete'] = array(
'class' => false,
*/
function buildNavUrls() {
global $wgUseTrackbacks, $wgOut, $wgUser, $wgRequest;
- global $wgEnableUploads, $wgUploadNavigationUrl;
+ global $wgUploadNavigationUrl;
wfProfileIn( __METHOD__ );
}
if( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
- $parts = explode( '/', $this->mTitle->getText() );
- $rootUser = $parts[0];
+ $rootUser = strtok( $this->mTitle->getText(), '/' );
$id = User::idFromName( $rootUser );
$ip = User::isIP( $rootUser );
} else {