Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -59,12 +59,17 @@ |
60 | 60 | // Source for live counter information |
61 | 61 | $wgNoticeCounterSource = "http://donate.wikimedia.org/counter.php"; |
62 | 62 | |
| 63 | +// Domain to set global cookies for. |
| 64 | +// Example: '.wikipedia.org' |
| 65 | +// This setting is currently shared with CentralAuth extension. |
| 66 | +$wgCentralAuthCookieDomain = ''; |
| 67 | + |
63 | 68 | $wgExtensionFunctions[] = 'efCentralNoticeSetup'; |
64 | 69 | |
65 | 70 | $wgExtensionCredits['other'][] = array( |
66 | 71 | 'path' => __FILE__, |
67 | 72 | 'name' => 'CentralNotice', |
68 | | - 'author' => 'Brion Vibber', |
| 73 | + 'author' => 'Brion Vibber, Ryan Kaldari', |
69 | 74 | 'url' => 'http://www.mediawiki.org/wiki/Extension:CentralNotice', |
70 | 75 | 'descriptionmsg' => 'centralnotice-desc', |
71 | 76 | ); |
Index: trunk/extensions/CentralNotice/SpecialHideBanners.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | function execute( $par ) { |
17 | 17 | global $wgRequest, $wgOut; |
18 | 18 | |
19 | | - $this->setGlobalCookie(); |
| 19 | + $this->setHideCookie(); |
20 | 20 | |
21 | 21 | $wgOut->disable(); |
22 | 22 | wfResetOutputBuffers(); |
— | — | @@ -26,8 +26,10 @@ |
27 | 27 | readfile( dirname( __FILE__ ) . '/1x1.png' ); |
28 | 28 | } |
29 | 29 | |
30 | | - function setGlobalCookie() { |
31 | | - $exp = time() + 86400 * 14; // cookie expires after 2 weeks |
32 | | - setcookie( 'hidesnmessage', '0', $exp, '/' ); |
| 30 | + function setHideCookie() { |
| 31 | + global $wgCentralAuthCookieDomain, $wgCookieSecure, $wgCookieHttpOnly; |
| 32 | + $exp = time() + 86400 * 14; // Cookie expires after 2 weeks |
| 33 | + // Hide banners for this domain |
| 34 | + setcookie( 'hidesnmessage', '1', $exp, '/', $wgCentralAuthCookieDomain, $wgCookieSecure, $wgCookieHttpOnly ); |
33 | 35 | } |
34 | 36 | } |