r80143 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80142‎ | r80143 | r80144 >
Date:00:38, 13 January 2011
Author:kaldari
Status:deferred
Tags:
Comment:
adding more cookie params
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialHideBanners.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -59,12 +59,17 @@
6060 // Source for live counter information
6161 $wgNoticeCounterSource = "http://donate.wikimedia.org/counter.php";
6262
 63+// Domain to set global cookies for.
 64+// Example: '.wikipedia.org'
 65+// This setting is currently shared with CentralAuth extension.
 66+$wgCentralAuthCookieDomain = '';
 67+
6368 $wgExtensionFunctions[] = 'efCentralNoticeSetup';
6469
6570 $wgExtensionCredits['other'][] = array(
6671 'path' => __FILE__,
6772 'name' => 'CentralNotice',
68 - 'author' => 'Brion Vibber',
 73+ 'author' => 'Brion Vibber, Ryan Kaldari',
6974 'url' => 'http://www.mediawiki.org/wiki/Extension:CentralNotice',
7075 'descriptionmsg' => 'centralnotice-desc',
7176 );
Index: trunk/extensions/CentralNotice/SpecialHideBanners.php
@@ -15,7 +15,7 @@
1616 function execute( $par ) {
1717 global $wgRequest, $wgOut;
1818
19 - $this->setGlobalCookie();
 19+ $this->setHideCookie();
2020
2121 $wgOut->disable();
2222 wfResetOutputBuffers();
@@ -26,8 +26,10 @@
2727 readfile( dirname( __FILE__ ) . '/1x1.png' );
2828 }
2929
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 );
3335 }
3436 }

Status & tagging log