PageTemplate/Fixup

* only need to ask for consent if analytics is enabled
 * fixes #483
This commit is contained in:
Sarjuuk 2026-01-19 19:35:48 +01:00
parent 53374972ef
commit 15338dc503

View file

@ -467,13 +467,8 @@ class PageTemplate
// refresh vars that shouldn't be cached
private function update() : void
{
// analytics + consent
// not set or declined
if (empty($_COOKIE['consent']))
$this->hasAnalytics = false;
// not set
if (!isset($_COOKIE['consent']))
// not set, but should be
if (!isset($_COOKIE['consent']) && $this->hasAnalytics)
{
$this->addScript(SC_CSS_FILE, 'css/consent.css', SC_FLAG_NOCACHE);
$this->addScript(SC_JS_FILE, 'js/consent.js', SC_FLAG_NOCACHE);
@ -481,6 +476,11 @@ class PageTemplate
$this->consentFooter = true;
}
// analytics + consent
// not set or declined
if (empty($_COOKIE['consent']))
$this->hasAnalytics = false;
// js + css
$this->prepareScripts();