/**
* Set the title
- * @param Title $t The title to use
+ * @param $t Title object to use
*/
public function setTitle( $t ) {
$this->mTitle = $t;
* Make a <script> tag containing global variables
* @param $skinName string Name of the skin
* The odd calling convention is for backwards compatibility
- * @TODO @FIXME Make this not depend on $wgTitle!
+ * @todo FIXME: Make this not depend on $wgTitle!
*/
static function makeGlobalVariablesScript( $skinName ) {
if ( is_array( $skinName ) ) {
'wgArticleId' => $wgTitle->getArticleId(),
'wgIsArticle' => $wgOut->isArticle(),
'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(),
- 'wgUserGroups' => $wgUser->isAnon() ? null : $wgUser->getEffectiveGroups(),
+ 'wgUserGroups' => $wgUser->getEffectiveGroups(),
'wgUserLanguage' => $wgLang->getCode(),
'wgContentLanguage' => $wgContLang->getCode(),
'wgBreakFrames' => $wgBreakFrames,
/**
* Split for easier subclassing in SkinSimple, SkinStandard and SkinCologneBlue
+ * Anything in here won't be generated if $wgAllowUserCssPrefs is false.
*/
protected function reallyGenerateUserStylesheet() {
global $wgUser;
$underline = $undopt ? 'underline' : 'none';
$s .= "a { text-decoration: $underline; }\n";
}
- if( $wgUser->getOption( 'highlightbroken' ) ) {
- $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
- } else {
+ if( !$wgUser->getOption( 'highlightbroken' ) ) {
$s .= <<<CSS
a.new, #quickbar a.new,
a.stub, #quickbar a.stub {
$out->addStyle( self::makeNSUrl( $this->getSkinName() . '.css', $query, NS_MEDIAWIKI ) );
}
- if( $wgUser->isLoggedIn() ) {
- // Ensure that logged-in users' generated CSS isn't clobbered
- // by anons' publicly cacheable generated CSS.
- $siteargs['smaxage'] = '0';
- $siteargs['ts'] = $wgUser->mTouched;
- }
- // Per-user styles based on preferences
- $siteargs['gen'] = 'css';
- if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) {
- $siteargs['useskin'] = $us;
+ global $wgAllowUserCssPrefs;
+ if( $wgAllowUserCssPrefs ){
+ if( $wgUser->isLoggedIn() ) {
+ // Ensure that logged-in users' generated CSS isn't clobbered
+ // by anons' publicly cacheable generated CSS.
+ $siteargs['smaxage'] = '0';
+ $siteargs['ts'] = $wgUser->mTouched;
+ }
+ // Per-user styles based on preferences
+ $siteargs['gen'] = 'css';
+ if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) {
+ $siteargs['useskin'] = $us;
+ }
+ $out->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) );
}
- $out->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) );
// Per-user custom style pages
if( $wgAllowUserCss && $wgUser->isLoggedIn() ) {
);
}
+ function uploadLink() {
+ global $wgUploadNavigationUrl;
+
+ if( $wgUploadNavigationUrl ) {
+ # Using an empty class attribute to avoid automatic setting of "external" class
+ return $this->makeExternalLink( $wgUploadNavigationUrl, wfMsgHtml( 'upload' ), false, null, array( 'class' => '') );
+ } else {
+ return $this->link(
+ SpecialPage::getTitleFor('Upload'),
+ wfMsgHtml( 'upload' ),
+ array(),
+ array(),
+ array( 'known', 'noclasses' )
+ );
+ }
+ }
+
/* these are used extensively in SkinTemplate, but also some other places */
static function makeMainPageUrl( $urlaction = '' ) {
$title = Title::newMainPage();
public function commonPrintStylesheet() {
return true;
}
+
+ /**
+ * Gets new talk page messages for the current user.
+ * @return MediaWiki message or if no new talk page messages, nothing
+ */
+ function getNewtalks() {
+ global $wgUser, $wgOut;
+ $newtalks = $wgUser->getNewMessageLinks();
+ $ntl = '';
+
+ if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
+ $userTitle = $this->mUser->getUserPage();
+ $userTalkTitle = $userTitle->getTalkPage();
+
+ if( !$userTalkTitle->equals( $this->mTitle ) ) {
+ $newMessagesLink = $this->link(
+ $userTalkTitle,
+ wfMsgHtml( 'newmessageslink' ),
+ array(),
+ array( 'redirect' => 'no' ),
+ array( 'known', 'noclasses' )
+ );
+
+ $newMessagesDiffLink = $this->link(
+ $userTalkTitle,
+ wfMsgHtml( 'newmessagesdifflink' ),
+ array(),
+ array( 'diff' => 'cur' ),
+ array( 'known', 'noclasses' )
+ );
+
+ $ntl = wfMsg(
+ 'youhavenewmessages',
+ $newMessagesLink,
+ $newMessagesDiffLink
+ );
+ # Disable Squid cache
+ $wgOut->setSquidMaxage( 0 );
+ }
+ } elseif( count( $newtalks ) ) {
+ // _>" " for BC <= 1.16
+ $sep = str_replace( '_', ' ', wfMsgHtml( 'newtalkseparator' ) );
+ $msgs = array();
+ foreach( $newtalks as $newtalk ) {
+ $msgs[] = Xml::element(
+ 'a',
+ array( 'href' => $newtalk['link'] ), $newtalk['wiki']
+ );
+ }
+ $parts = implode( $sep, $msgs );
+ $ntl = wfMsgHtml( 'youhavenewmessagesmulti', $parts );
+ $wgOut->setSquidMaxage( 0 );
+ }
+ return $ntl;
+ }
+
}