PageTemplate/Consent

* fix showing consent overlay when cookie is already set
This commit is contained in:
Sarjuuk 2026-01-09 17:22:37 +01:00
parent a17d4a5528
commit face95c1dd

View file

@ -470,16 +470,18 @@ class PageTemplate
private function update() : void
{
// analytics + consent
if ($this->hasAnalytics && !isset($_COOKIE['consent']))
// not set or declined
if (empty($_COOKIE['consent']))
$this->hasAnalytics = false;
// not set
if (!isset($_COOKIE['consent']))
{
$this->addScript(SC_CSS_FILE, 'css/consent.css', SC_FLAG_NOCACHE);
$this->addScript(SC_JS_FILE, 'js/consent.js', SC_FLAG_NOCACHE);
$this->consentFooter = true;
$this->hasAnalytics = false;
}
else if ($this->hasAnalytics && !$_COOKIE['consent'])
$this->hasAnalytics = false;
// js + css
$this->prepareScripts();