diff --git a/core/core.js.php b/core/core.js.php
index 56a548dd..d54b0c71 100644
--- a/core/core.js.php
+++ b/core/core.js.php
@@ -223,17 +223,20 @@ core.start = function() {
var expires = "expires=" + e.toUTCString();
// Crée le cookie d'acceptation Google Analytics si l'ID a été saisie
- var analytics = "getData(['config', 'seo', 'analyticsId']);?>";
- // l'Id GA est défini dans la configuration, afficher la checkbox d'acceptation
- if( analytics.length > 0){
- // Traitement du retour de la checkbox
- if ($("#googleAnalytics").is(":checked")) {
- // L'URL du serveur faut TRUE
- document.cookie = "ZWII_COOKIE_GA_CONSENT=" + "" + ";" + domain + ";" + path + ";" + samesite + ";" + expires;
- } else {
- document.cookie = "ZWII_COOKIE_GA_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires;
- }
-
+ // Traitement du retour de la checkbox
+ if ($("#googleAnalytics").is(":checked")) {
+ // L'URL du serveur faut TRUE
+ document.cookie = "ZWII_COOKIE_GA_CONSENT=" + "" + ";" + domain + ";" + path + ";" + samesite + ";" + expires;
+ } else {
+ document.cookie = "ZWII_COOKIE_GA_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires;
+ }
+ // Traitement du retour de la checkbox
+ if ($("#googleTranslate").is(":checked")) {
+ // L'URL du serveur faut TRUE
+ document.cookie = "ZWII_COOKIE_GT_CONSENT=" + "" + ";" + domain + ";" + path + ";" + samesite + ";" + expires;
+ } else {
+ document.cookie = "ZWII_COOKIE_GT_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires;
+ document.cookie = "googtrans=fr/fr;" + domain + ";" + path + ";" + samesite + ";" + expires;
}
// Stocke le cookie d'acceptation
@@ -276,7 +279,7 @@ core.start = function() {
* Commande de gestion des cookies dans le footer
*/
- $("#footerLinkCookie").on("click", function() {
+ $(".footerShowCookieConsent").on("click", function() {
$("#cookieConsent").removeClass("displayNone");
});
diff --git a/core/core.php b/core/core.php
index 27e6f82b..bb921a62 100644
--- a/core/core.php
+++ b/core/core.php
@@ -256,6 +256,7 @@ class common {
if ( $this->getData(['config', 'i18n', 'enable']) === true
AND $this->getData(['config', 'i18n','scriptGoogle']) === true
AND $this->getData(['config', 'i18n','autoDetect']) === true
+ AND $this->getInput('ZWII_COOKIE_GT_CONSENT') === $_SERVER['PHP_SELF']
AND $this->getInput('ZWII_I18N_SITE') !== ''
AND !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) )
{
@@ -1187,15 +1188,15 @@ class common {
}
/**
- * Affiche le consentement aux cookies
+ * Affiche le consentement des cookies
*/
public function showCookies() {
- // Gestion des cookies intégrée
+ // Gestion des cookies interne active
if ($this->getData(['config', 'cookieConsent']) === true )
{
- // Détermine si le bloc doit être affiché selon la validité du cookie
- // L'URL du serveur faut TRUE
+ // Détermine si le bloc doit être affiché selon la validité du cookie : l'URL du serveur faut TRUE
+ // Pour éviter la propagation (à revoir avec Sylvain)
$item = '
getInput('ZWII_COOKIE_CONSENT') !== $_SERVER['PHP_SELF'] ? '>' : ' class="displayNone">';
// Bouton de fermeture
@@ -1207,17 +1208,26 @@ class common {
$item .= '
' . $this->getData(['locale', 'cookies', 'cookiesZwiiText']) . '
';
// Formulaire de réponse
$item .= '
';
- // mentions légales si la page est définie
+ // Mentions légales si une page est définie
$legalPage = $this->getData(['locale', 'legalPageId']);
if ($legalPage !== 'none') {
$item .= '
' . $this->getData(['locale', 'cookies', 'cookiesLinkMlText']) . '
';
@@ -1492,7 +1502,7 @@ class common {
$items .= '';
// Affichage du lien de connexion
if(
@@ -1753,8 +1763,9 @@ class common {
}
// Retourne les items du menu
echo '
' . $itemsRight;
- if ($this->getData(['config', 'i18n', 'enable']) === true) {
- echo $this->showi18n();
+ if ($this->getData(['config', 'i18n', 'enable']) === true
+ ) {
+ echo $this->showi18n();
}
echo '
';
}
@@ -2114,6 +2125,7 @@ class common {
OR (
$this->getData(['config', 'i18n','scriptGoogle']) === true
AND $this->getData(['config', 'i18n',$key]) === 'script'
+ AND $this->getInput('ZWII_COOKIE_GT_CONSENT') === $_SERVER['PHP_SELF']
)
) {
if (
@@ -2791,33 +2803,34 @@ class core extends common {
}
// Chargement de la bibliothèque googtrans
-
// Le script de traduction est sélectionné
if ($this->getData(['config', 'i18n', 'enable']) === true) {
+ // Trad auto
if ( $this->getData(['config', 'i18n','scriptGoogle']) === true
// et la traduction de la langue courante est automatique
- AND ( $this->getInput('ZWII_I18N_SCRIPT') !== ''
- // Ou traduction automatique
- OR $this->getData(['config', 'i18n','autoDetect']) === true
- )
- // Cas des pages d'administration
- // Pas connecté
- AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
- AND $this->getUrl(1) !== 'login'
- // Ou connecté avec option active
- OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
- AND $this->getData(['config', 'i18n','admin']) === true
- )
+ AND ( $this->getInput('ZWII_I18N_SCRIPT') !== ''
+ // Ou traduction automatique
+ OR $this->getData(['config', 'i18n','autoDetect']) === true
+ )
+ // Le cookie est accepté par le client
+ AND $this->getInput('ZWII_COOKIE_GT_CONSENT') === $_SERVER['PHP_SELF']
+ // Cas des pages d'administration
+ // Pas connecté
+ AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
+ AND $this->getUrl(1) !== 'login'
+ // Ou connecté avec option active
+ OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
+ AND $this->getData(['config', 'i18n','admin']) === true
+ )
- ) {
+ ) {
// Paramètre du script
setrawcookie("googtrans", '/fr/'. $this->getInput('ZWII_I18N_SCRIPT') , time() + 3600, helper::baseUrl());
// Chargement de la librairie
$this->addOutput([
'vendor' => array_merge($this->output['vendor'], ['i18n'])
]);
-
- }
+ }
}
// Erreurs
if($access === 'login') {
diff --git a/core/include/update.inc.php b/core/include/update.inc.php
index 04f161be..8a0aed33 100644
--- a/core/include/update.inc.php
+++ b/core/include/update.inc.php
@@ -707,6 +707,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) {
$this->setData(['locale', 'cookies', 'cookieTitleText', 'Gérer les cookies']);
$this->setData(['locale', 'cookies', 'cookieLinkMlText', 'Consulter les mentions légales']);
$this->setData(['locale', 'cookies', 'cookieCheckboxGaText', 'Autorisation des cookies Google Analytics']);
+ $this->setData(['locale', 'cookies', 'cookieCheckboxGtText', 'Autorisation des cookies Google Translate']);
$this->setData(['locale', 'cookies', 'cookiesButtonText', 'J\'ai compris']);
// Mise à jour
diff --git a/core/module/config/config.php b/core/module/config/config.php
index 9e5f58a6..b4f949e9 100644
--- a/core/module/config/config.php
+++ b/core/module/config/config.php
@@ -445,6 +445,7 @@ class config extends common {
'cookiesTitleText' => $this->getInput('localeCookiesTitleText', helper::FILTER_STRING_SHORT, $this->getData(['config', 'cookieConsent'])),
'cookiesLinkMlText' => $this->getInput('localeCookiesLinkMlText', helper::FILTER_STRING_SHORT, $this->getData(['config', 'cookieConsent'])),
'cookiesCheckboxGaText' => $this->getInput('localeCookiesCheckboxGaText', helper::FILTER_STRING_SHORT, $this->getData(['config', 'cookieConsent'])),
+ 'cookiesCheckboxGtText' => $this->getInput('localeCookiesCheckboxGtText', helper::FILTER_STRING_SHORT, $this->getData(['config', 'cookieConsent'])),
'cookiesFooterText' => $this->getInput('localeCookiesFooterText', helper::FILTER_STRING_SHORT, $this->getData(['config', 'cookieConsent'])),
'cookiesButtonText' =>$this->getInput('localeCookiesButtonText', helper::FILTER_STRING_SHORT, $this->getData(['config', 'cookieConsent']))
]
diff --git a/core/module/config/view/locale/locale.php b/core/module/config/view/locale/locale.php
index 5056975a..047ee134 100644
--- a/core/module/config/view/locale/locale.php
+++ b/core/module/config/view/locale/locale.php
@@ -200,19 +200,30 @@
'Saisissez le message pour les cookies déposés par Google Analytics, le consentement est requis.',
- 'label' => 'Cookies Google Analytics',
+ 'label' => 'Cookies Google Analytics et Translate',
'value' => $this->getData(['locale', 'cookies', 'cookiesGaText']),
'placeHolder' => 'Il utilise également des cookies permettant de réaliser des statistiques de visites pour améliorer votre expérience utilisateur, ces cookies déposés par Google Analytics ont besoin de votre consentement.'
]); ?>
-
- 'Saisissez le texte de la case à cocher Google Analytics.',
- 'label' => 'Checkbox Google Analytics',
- 'value' => $this->getData(['locale', 'cookies', 'cookiesCheckboxGaText']),
- 'placeHolder' => 'Autorisation des cookies Google Analytics'
- ]); ?>
+
+
+ 'Saisissez le texte de la case à cocher Google Analytics.',
+ 'label' => 'Checkbox Google Analytics',
+ 'value' => $this->getData(['locale', 'cookies', 'cookiesCheckboxGaText']),
+ 'placeHolder' => 'Autorisation des cookies Google Analytics'
+ ]); ?>
+
+
+ 'Saisissez le texte de la case à cocher Google Translate.',
+ 'label' => 'Checkbox Google Translate',
+ 'value' => $this->getData(['locale', 'cookies', 'cookiesCheckboxGtText']),
+ 'placeHolder' => 'Autorisation des cookies Google Translate'
+ ]); ?>
+
+
diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php
index 04ba053e..46d81f2d 100644
--- a/core/module/install/ressource/defaultdata.php
+++ b/core/module/install/ressource/defaultdata.php
@@ -80,6 +80,7 @@ class init extends common {
'cookiesTitleText' => 'Gérer les cookies',
'cookiesLinkMlText' => 'Consulter les mentions légales',
'cookiesCheckboxGaText' => 'Autorisation des cookies Google Analytics',
+ 'cookiesCheckboxGtText' => 'Autorisation des cookies Google Translate',
'cookiesFooterText' => 'Confidentialité',
'cookiesButtonText' => 'J\'ai compris'
]