Skip to content
Extraits de code Groupes Projets
Valider dafe1573 rédigé par robocoder's avatar robocoder
Parcourir les fichiers

refs #2048 - update DoNotTrack plugin to conform to core plugin style; update...

refs #2048 - update DoNotTrack plugin to conform to core plugin style; update DNT detection to only look at the 1st character per TPE working draft; enable by default in config

git-svn-id: http://dev.piwik.org/svn/trunk@6202 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 8f5d4285
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -350,6 +350,9 @@ page_maximum_length = 1024; ...@@ -350,6 +350,9 @@ page_maximum_length = 1024;
; For IPv4 addresses, valid values are 0..4; for IPv6 addresses, valid values are 0..16 ; For IPv4 addresses, valid values are 0..4; for IPv6 addresses, valid values are 0..16
ip_address_mask_length = 1 ip_address_mask_length = 1
; Ignore visits with X-Do-Not-Track or DNT header
do_not_track = 1
; DO NOT USE THIS SETTING ON PUBLICLY AVAILABLE PIWIK SERVER ; DO NOT USE THIS SETTING ON PUBLICLY AVAILABLE PIWIK SERVER
; !!! Security risk: if set to 0, it would allow anyone to push data to Piwik with custom dates in the past/future and with fake IPs !!! ; !!! Security risk: if set to 0, it would allow anyone to push data to Piwik with custom dates in the past/future and with fake IPs !!!
; When using the Tracking API, to override either the datetime and/or the visitor IP, ; When using the Tracking API, to override either the datetime and/or the visitor IP,
...@@ -478,6 +481,7 @@ Plugins[] = Live ...@@ -478,6 +481,7 @@ Plugins[] = Live
Plugins[] = CustomVariables Plugins[] = CustomVariables
Plugins[] = PrivacyManager Plugins[] = PrivacyManager
Plugins[] = ImageGraph Plugins[] = ImageGraph
Plugins[] = DoNotTrack
[PluginsInstalled] [PluginsInstalled]
PluginsInstalled[] = Login PluginsInstalled[] = Login
...@@ -489,3 +493,4 @@ PluginsInstalled[] = Installation ...@@ -489,3 +493,4 @@ PluginsInstalled[] = Installation
[Plugins_Tracker] [Plugins_Tracker]
Plugins_Tracker[] = Provider Plugins_Tracker[] = Provider
Plugins_Tracker[] = Goals Plugins_Tracker[] = Goals
Plugins_Tracker[] = DoNotTrack
<?php <?php
/** /**
* Piwik - Open source web analytics * Piwik - Open source web analytics
* *
* @link http://piwik.org * @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
* @version $Id$ * @version $Id$
* *
* @category Piwik_Plugins * @category Piwik_Plugins
* @package Piwik_DoNotTrack * @package Piwik_DoNotTrack
*/ */
...@@ -30,14 +30,14 @@ class Piwik_DoNotTrack extends Piwik_Plugin ...@@ -30,14 +30,14 @@ class Piwik_DoNotTrack extends Piwik_Plugin
{ {
return array( return array(
'description' => 'Ignore visits with X-Do-Not-Track or DNT header', 'description' => 'Ignore visits with X-Do-Not-Track or DNT header',
'author' => 'VIP Software Technologies Inc.', 'author' => 'Piwik',
'author_homepage' => 'http://activeanalytics.com/', 'author_homepage' => 'http://piwik.org/',
'version' => '0.3', 'version' => Piwik_Version::VERSION,
'translationAvailable' => false, 'translationAvailable' => false,
'TrackerPlugin' => true, 'TrackerPlugin' => true,
); );
} }
public function getListHooksRegistered() public function getListHooksRegistered()
{ {
return array( return array(
...@@ -47,16 +47,16 @@ class Piwik_DoNotTrack extends Piwik_Plugin ...@@ -47,16 +47,16 @@ class Piwik_DoNotTrack extends Piwik_Plugin
function checkHeader($notification) function checkHeader($notification)
{ {
$setting = @Piwik_Tracker_Config::getInstance()->Tracker['do_not_track']; $setting = @Piwik_Config::getInstance()->Tracker['do_not_track'];
if($setting === '1' && if($setting === '1' &&
((isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1') || ((isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1') ||
(isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] === '1'))) (isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1')))
{ {
$exclude =& $notification->getNotificationObject(); $exclude =& $notification->getNotificationObject();
$exclude = true; $exclude = true;
$trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie(); $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
$trackingCookie->delete(); $trackingCookie->delete();
} }
} }
} }
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter