r41706 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41705‎ | r41706 | r41707 >
Date:19:53, 5 October 2008
Author:skizzerz
Status:old (Comments)
Tags:
Comment:
* 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
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1868,15 +1868,29 @@
18691869 $fname = 'wfGetSiteNotice';
18701870 wfProfileIn( $fname );
18711871 $siteNotice = '';
1872 -
 1872+ $loggedIn = false;
 1873+
 1874+ if( $wgUser instanceOf User && $wgUser->isLoggedIn() ) {
 1875+ $loggedIn = true;
 1876+ $siteNotice = wfGetCachedNotice('sitenotice');
 1877+ if($siteNotice === false)
 1878+ return '';
 1879+ } else {
 1880+ $siteNotice = wfGetCachedNotice('anonnotice');
 1881+ if($siteNotice === false) {
 1882+ $siteNotice = wfGetCachedNotice('sitenotice');
 1883+ if($siteNotice === false)
 1884+ return '';
 1885+ }
 1886+ }
 1887+
18731888 $encNotice = Xml::escapeJsString($siteNotice);
18741889 $encClose = Xml::escapeJsString( wfMsg( 'sitenotice_close' ) );
18751890 $id = intval( $wgMajorSiteNoticeID ) . "." . intval( wfMsgForContent( 'sitenotice_id' ) );
18761891
18771892 if( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice ) ) ) {
1878 - if( is_object( $wgUser ) && $wgUser->isLoggedIn() ) {
1879 - $siteNotice = wfGetCachedNotice( 'sitenotice' );
1880 - $siteNotice .= <<<EOT
 1893+ if( $loggedIn ) {
 1894+ $siteNotice = <<<EOT
18811895 <script type="text/javascript" language="JavaScript">
18821896 <!--
18831897 var cookieName = "dismissSiteNotice=";
@@ -1909,33 +1923,20 @@
19101924 -->
19111925 </script>
19121926 EOT;
1913 - } else {
1914 - $anonNotice = wfGetCachedNotice( 'anonnotice' );
1915 - if( !$anonNotice ) {
1916 - $siteNotice = wfGetCachedNotice( 'sitenotice' );
1917 - // Don't allow anons to dismiss the site notice
1918 - $siteNotice .= <<<EOT
 1927+ } else {
 1928+ // Don't allow anons to dismiss the site notice
 1929+ $siteNotice = <<<EOT
19191930 <script type="text/javascript" language="JavaScript">
19201931 <!--
19211932 document.writeln("$encNotice");
19221933 -->
19231934 </script>
19241935 EOT;
1925 - } else {
1926 - $siteNotice = $anonNotice;
1927 - $siteNotice .= <<<EOT
1928 -<script type="text/javascript" language="JavaScript">
1929 -<!--
1930 -document.writeln("$encNotice");
1931 -</script>
1932 -EOT;
1933 - }
1934 - }
1935 - if( !$siteNotice ) {
1936 - $siteNotice = wfGetCachedNotice( 'default' );
1937 - }
19381936 }
 1937+ if( !$siteNotice ) {
 1938+ $siteNotice = wfGetCachedNotice( 'default' );
 1939+ }
 1940+ }
19391941
19401942 wfRunHooks( 'SiteNoticeAfter', array( &$siteNotice ) );
19411943 wfProfileOut( $fname );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r41679Merging DismissableSiteNotice extension into core.ashley23:46, 4 October 2008

Comments

#Comment by Tim Starling (talk | contribs)   04:49, 11 October 2008

Reverted in r41958.

Status & tagging log