Refactor about.php

- Hardcode source code URL and credits in about template, remove from DB/admin interface; only contacts remains editable
- Merge apropos editables into one À propos section, remove charte, add editable source code URL
This commit is contained in:
Pontoporeia
2026-05-07 18:44:30 +02:00
parent 24d68dda59
commit e0c748d8e7
15 changed files with 259 additions and 250 deletions

View File

@@ -2239,31 +2239,21 @@ class Database
return null;
}
$value = $row['value'];
if ($key === 'erg_url') {
return $value;
}
$decoded = json_decode($value, true);
$decoded = json_decode($row['value'], true);
return is_array($decoded) ? $decoded : null;
}
/**
* Save an apropos content value by key.
* @param string $key
* @param mixed $value array for contacts/credits, string for erg_url
* Save an apropos content value by key (contacts JSON).
*/
public function saveAproposContent(string $key, $value): void
public function saveAproposContent(string $key, array $value): void
{
$stmt = $this->pdo->prepare('SELECT id FROM apropos_contents WHERE key = ?');
$stmt->execute([$key]);
if (!$stmt->fetch()) {
throw new Exception("Apropos key not found: $key");
}
$storedValue = is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : (string)$value;
$storedValue = json_encode($value, JSON_UNESCAPED_UNICODE);
$stmt = $this->pdo->prepare(
'UPDATE apropos_contents SET value = ?, updated_at = CURRENT_TIMESTAMP WHERE key = ?'
'INSERT INTO apropos_contents (key, value, updated_at) VALUES (?, ?, CURRENT_TIMESTAMP)
ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = CURRENT_TIMESTAMP'
);
$stmt->execute([$storedValue, $key]);
$stmt->execute([$key, $storedValue]);
}
/**