Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <matt@piwik.org>2015-03-12 00:26:42 +0300
committerMatthieu Aubry <matt@piwik.org>2015-03-12 00:26:42 +0300
commitcdb6840bb254de2a1d770cde698079c1c9970322 (patch)
tree3f1f66638022942545cdec7df725de2ba4ba7016
parent9ff8200966b3b10a457f17b0ce926aa6c0b23954 (diff)
parente7e829dfaad4c87b5f45f320ebfdb967c888c122 (diff)
Merge pull request #7352 from ArnY/dntOptOut
Take DNT into account cf piwik/piwik#7317
-rw-r--r--plugins/CoreAdminHome/Controller.php8
-rw-r--r--plugins/CoreAdminHome/lang/en.json1
-rw-r--r--plugins/CoreAdminHome/templates/optOut.twig43
3 files changed, 31 insertions, 21 deletions
diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php
index 732639874a..eacbb60406 100644
--- a/plugins/CoreAdminHome/Controller.php
+++ b/plugins/CoreAdminHome/Controller.php
@@ -321,7 +321,10 @@ class Controller extends ControllerAdmin
public function optOut()
{
$trackVisits = !IgnoreCookie::isIgnoreCookieFound();
-
+
+ $dntChecker = new DoNotTrackHeaderChecker();
+ $dntFound = $dntChecker->isDoNotTrackFound();
+
$nonce = Common::getRequestVar('nonce', false);
$language = Common::getRequestVar('language', '');
if ($nonce !== false && Nonce::verifyNonce('Piwik_OptOut', $nonce)) {
@@ -330,6 +333,8 @@ class Controller extends ControllerAdmin
$trackVisits = !$trackVisits;
}
+
+
$lang = APILanguagesManager::getInstance()->isLanguageAvailable($language)
? $language
: LanguagesManager::getLanguageCodeForCurrentUser();
@@ -339,6 +344,7 @@ class Controller extends ControllerAdmin
// parameter is required)
$view = new View("@CoreAdminHome/optOut");
$view->setXFrameOptions('allow');
+ $view->dntFound = $dntFound;
$view->trackVisits = $trackVisits;
$view->nonce = Nonce::getNonce('Piwik_OptOut', 3600);
$view->language = $lang;
diff --git a/plugins/CoreAdminHome/lang/en.json b/plugins/CoreAdminHome/lang/en.json
index 42c0ae3960..9579bdd518 100644
--- a/plugins/CoreAdminHome/lang/en.json
+++ b/plugins/CoreAdminHome/lang/en.json
@@ -59,6 +59,7 @@
"MenuDevelopment": "Development",
"OptOutComplete": "Opt-out complete; your visits to this website will not be recorded by the Web Analytics tool.",
"OptOutCompleteBis": "Note that if you clear your cookies, delete the opt-out cookie, or if you change computers or Web browsers, you will need to perform the opt-out procedure again.",
+ "OptOutDntFound": "You are not being tracked since your browser is reporting that you do not want to. This is a setting of your browser so you won't be able to opt-in until you disable the 'Do Not Track' feature.",
"OptOutExplanation": "Piwik is dedicated to providing privacy on the Internet. To provide your visitors with the choice of opting-out of Piwik Web Analytics, you can add the following HTML code on one of your website page, for example in a Privacy Policy page.",
"OptOutExplanationBis": "This code will display an Iframe containing a link for your visitors to opt-out of Piwik by setting an opt-out cookie in their browsers. %s Click here%s to view the content that will be displayed by the iFrame.",
"OptOutForYourVisitors": "Piwik opt-out for your visitors",
diff --git a/plugins/CoreAdminHome/templates/optOut.twig b/plugins/CoreAdminHome/templates/optOut.twig
index e9af0948c1..5315747a48 100644
--- a/plugins/CoreAdminHome/templates/optOut.twig
+++ b/plugins/CoreAdminHome/templates/optOut.twig
@@ -4,31 +4,34 @@
<meta charset="utf-8">
</head>
<body>
-{% if not trackVisits %}
- {{ 'CoreAdminHome_OptOutComplete'|translate }}
- <br/>
- {{ 'CoreAdminHome_OptOutCompleteBis'|translate }}
+{% if dntFound %}
+ {{ 'CoreAdminHome_OptOutDntFound'|translate }}
{% else %}
- {{ 'CoreAdminHome_YouMayOptOut'|translate }}
- <br/>
- {{ 'CoreAdminHome_YouMayOptOutBis'|translate }}
-{% endif %}
-<br/><br/>
-
-<form method="post" action="?module=CoreAdminHome&amp;action=optOut{% if language %}&amp;language={{ language }}{% endif %}">
- <input type="hidden" name="nonce" value="{{ nonce }}" />
- <input type="hidden" name="fuzz" value="{{ "now"|date }}" />
- <input onclick="this.form.submit()" type="checkbox" id="trackVisits" name="trackVisits" {% if trackVisits %}checked="checked"{% endif %} />
- <label for="trackVisits"><strong>
+ {% if not trackVisits %}
+ {{ 'CoreAdminHome_OptOutComplete'|translate }}
+ <br/>
+ {{ 'CoreAdminHome_OptOutCompleteBis'|translate }}
+ {% else %}
+ {{ 'CoreAdminHome_YouMayOptOut'|translate }}
+ <br/>
+ {{ 'CoreAdminHome_YouMayOptOutBis'|translate }}
+ {% endif %}
+ <br/><br/>
+ <form method="post" action="?module=CoreAdminHome&amp;action=optOut{% if language %}&amp;language={{ language }}{% endif %}">
+ <input type="hidden" name="nonce" value="{{ nonce }}" />
+ <input type="hidden" name="fuzz" value="{{ "now"|date }}" />
+ <input onclick="this.form.submit()" type="checkbox" id="trackVisits" name="trackVisits" {% if trackVisits %}checked="checked"{% endif %} />
+ <label for="trackVisits"><strong>
{% if trackVisits %}
{{ 'CoreAdminHome_YouAreOptedIn'|translate }} {{ 'CoreAdminHome_ClickHereToOptOut'|translate }}
{% else %}
{{ 'CoreAdminHome_YouAreOptedOut'|translate }} {{ 'CoreAdminHome_ClickHereToOptIn'|translate }}
{% endif %}
- </strong></label>
- <noscript>
- <button type="submit">{{ 'General_Save'|translate }}</button>
- </noscript>
-</form>
+ </strong></label>
+ <noscript>
+ <button type="submit">{{ 'General_Save'|translate }}</button>
+ </noscript>
+ </form>
+{% endif %}
</body>
</html>