From 653281bc2c2ae681d2fcfa08bbb70e2d42f1fff4 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 4 May 2024 16:40:37 +0200 Subject: [PATCH] some bugfixes --- Core/Elements/Document.class.php | 9 +-------- Core/Elements/TemplateView.class.php | 4 +++- Core/Elements/View.class.php | 7 ++++++- .../DatabaseEntity/Controller/DatabaseEntityHandler.php | 5 +++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Core/Elements/Document.class.php b/Core/Elements/Document.class.php index 4f4abfc..f6711ad 100644 --- a/Core/Elements/Document.class.php +++ b/Core/Elements/Document.class.php @@ -91,23 +91,16 @@ abstract class Document { public function sendHeaders(): void { if ($this->cspEnabled) { - $frameSrc = []; - $captchaProvider = $this->getSettings()->getCaptchaProvider(); if ($captchaProvider instanceof GoogleRecaptchaProvider) { - $frameSrc[] = "https://www.google.com/recaptcha/"; - $frameSrc[] = "https://recaptcha.google.com/recaptcha/"; $this->cspWhitelist[] = "https://www.google.com/recaptcha/"; $this->cspWhitelist[] = "https://www.gstatic.com/recaptcha/"; } else if ($captchaProvider instanceof HCaptchaProvider) { - $frameSrc[] = "https://hcaptcha.com"; - $frameSrc[] = "https://*.hcaptcha.com"; $this->cspWhitelist[] = "https://hcaptcha.com"; $this->cspWhitelist[] = "https://*.hcaptcha.com"; } $cspWhiteList = implode(" ", $this->cspWhitelist); - $frameSrc = implode(" ", $frameSrc); $csp = [ "default-src $cspWhiteList 'self'", "object-src 'none'", @@ -116,7 +109,7 @@ abstract class Document { "img-src 'self' 'unsafe-inline' data: https:;", "script-src $cspWhiteList 'nonce-$this->cspNonce'", "frame-ancestors 'self'", - "frame-src $frameSrc 'self'", + "frame-src $cspWhiteList 'self'", ]; $compiledCSP = implode("; ", $csp); diff --git a/Core/Elements/TemplateView.class.php b/Core/Elements/TemplateView.class.php index fce9eee..03d60b5 100644 --- a/Core/Elements/TemplateView.class.php +++ b/Core/Elements/TemplateView.class.php @@ -16,7 +16,9 @@ abstract class TemplateView extends View { return []; } - public function loadParameters(array &$parameters) { + public function loadParameters(array &$parameters): void { + + $this->loadView(); $siteParameters = [ "title" => $this->title, diff --git a/Core/Elements/View.class.php b/Core/Elements/View.class.php index 4c8948c..b6edb98 100644 --- a/Core/Elements/View.class.php +++ b/Core/Elements/View.class.php @@ -42,7 +42,12 @@ abstract class View extends StaticView { } // Virtual Methods - public function loadView() { } + public function loadView(): void { + $language = $this->getContext()->getLanguage(); + foreach ($this->langModules as $module) { + $language->loadModule($module); + } + } public function getCode(): string { diff --git a/Core/Objects/DatabaseEntity/Controller/DatabaseEntityHandler.php b/Core/Objects/DatabaseEntity/Controller/DatabaseEntityHandler.php index 707a421..94b7cfe 100644 --- a/Core/Objects/DatabaseEntity/Controller/DatabaseEntityHandler.php +++ b/Core/Objects/DatabaseEntity/Controller/DatabaseEntityHandler.php @@ -783,6 +783,11 @@ class DatabaseEntityHandler implements Persistable { private function prepareRow(DatabaseEntity $entity, string $action, ?array $properties = null): bool|array { $row = []; + + if ($entity->getId() !== null) { + $row["id"] = $entity->getId(); + } + foreach ($this->columns as $propertyName => $column) { if ($properties !== null && !in_array($propertyName, $properties)) { continue;