some bugfixes

This commit is contained in:
Roman 2024-05-04 16:40:37 +02:00
parent 4b6554b870
commit 653281bc2c
4 changed files with 15 additions and 10 deletions

@ -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);

@ -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,

@ -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 {

@ -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;