Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -1868,15 +1868,29 @@ |
1869 | 1869 | $fname = 'wfGetSiteNotice'; |
1870 | 1870 | wfProfileIn( $fname ); |
1871 | 1871 | $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 | + |
1873 | 1888 | $encNotice = Xml::escapeJsString($siteNotice); |
1874 | 1889 | $encClose = Xml::escapeJsString( wfMsg( 'sitenotice_close' ) ); |
1875 | 1890 | $id = intval( $wgMajorSiteNoticeID ) . "." . intval( wfMsgForContent( 'sitenotice_id' ) ); |
1876 | 1891 | |
1877 | 1892 | 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 |
1881 | 1895 | <script type="text/javascript" language="JavaScript"> |
1882 | 1896 | <!-- |
1883 | 1897 | var cookieName = "dismissSiteNotice="; |
— | — | @@ -1909,33 +1923,20 @@ |
1910 | 1924 | --> |
1911 | 1925 | </script> |
1912 | 1926 | 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 |
1919 | 1930 | <script type="text/javascript" language="JavaScript"> |
1920 | 1931 | <!-- |
1921 | 1932 | document.writeln("$encNotice"); |
1922 | 1933 | --> |
1923 | 1934 | </script> |
1924 | 1935 | 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 | | - } |
1938 | 1936 | } |
| 1937 | + if( !$siteNotice ) { |
| 1938 | + $siteNotice = wfGetCachedNotice( 'default' ); |
| 1939 | + } |
| 1940 | + } |
1939 | 1941 | |
1940 | 1942 | wfRunHooks( 'SiteNoticeAfter', array( &$siteNotice ) ); |
1941 | 1943 | wfProfileOut( $fname ); |