From 2861a4862c3c39076a8f1151549f1001888aadd6 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Sun, 5 Oct 2008 19:53:49 +0000 Subject: [PATCH] * fixing bugs with DismissableSitenotice merge: ** [dismiss] link does not show up if sitenotice is blank ** [dismiss] link is in line with notice instead of under --- includes/GlobalFunctions.php | 49 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index b31bffe966..2402204e04 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1868,15 +1868,29 @@ function wfGetSiteNotice() { $fname = 'wfGetSiteNotice'; wfProfileIn( $fname ); $siteNotice = ''; - + $loggedIn = false; + + if( $wgUser instanceOf User && $wgUser->isLoggedIn() ) { + $loggedIn = true; + $siteNotice = wfGetCachedNotice('sitenotice'); + if($siteNotice === false) + return ''; + } else { + $siteNotice = wfGetCachedNotice('anonnotice'); + if($siteNotice === false) { + $siteNotice = wfGetCachedNotice('sitenotice'); + if($siteNotice === false) + return ''; + } + } + $encNotice = Xml::escapeJsString($siteNotice); $encClose = Xml::escapeJsString( wfMsg( 'sitenotice_close' ) ); $id = intval( $wgMajorSiteNoticeID ) . "." . intval( wfMsgForContent( 'sitenotice_id' ) ); if( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice ) ) ) { - if( is_object( $wgUser ) && $wgUser->isLoggedIn() ) { - $siteNotice = wfGetCachedNotice( 'sitenotice' ); - $siteNotice .= << EOT; - } else { - $anonNotice = wfGetCachedNotice( 'anonnotice' ); - if( !$anonNotice ) { - $siteNotice = wfGetCachedNotice( 'sitenotice' ); - // Don't allow anons to dismiss the site notice - $siteNotice .= << - - -EOT; - } else { - $siteNotice = $anonNotice; - $siteNotice .= << EOT; - } - } - if( !$siteNotice ) { - $siteNotice = wfGetCachedNotice( 'default' ); - } } + if( !$siteNotice ) { + $siteNotice = wfGetCachedNotice( 'default' ); + } + } wfRunHooks( 'SiteNoticeAfter', array( &$siteNotice ) ); wfProfileOut( $fname ); -- 2.20.1