À propos: contacts flexibles, liens sidebar éditables, grille contacts admin, et bouton supprimer

- Contacts: on peut laisser vide le nom OU le rôle (plus besoin des deux)
- Sidebar: les liens « site de l'erg » et « code source » sont éditables depuis /admin/contenus-edit.php?slug=about
- Admin: les champs Nom/Email/Lien des contacts s'affichent en grille 3 colonnes
- Admin: icône corbeille (admin-icon-btn--delete) pour supprimer un contact, avec réindexation automatique
- Database::getAproposContent() gère maintenant les valeurs string (URLs) en plus des arrays
- Database::saveAproposContent() accepte array|string
This commit is contained in:
Pontoporeia
2026-06-10 00:16:22 +02:00
parent a1a9a316ca
commit 312d9eab0e
10 changed files with 214 additions and 62 deletions
+20 -5
View File
@@ -2732,8 +2732,8 @@ class Database
/**
* Get an apropos content value by key.
* @param string $key 'contacts', 'credits', or 'erg_url'
* @return array|string|null JSON-decoded array for contacts/credits, string for erg_url
* @param string $key 'contacts', 'credits', 'erg_site_url', 'source_code_url'
* @return array|string|null JSON-decoded value (array for contacts, string for URLs)
*/
public function getAproposContent(string $key)
{
@@ -2745,13 +2745,28 @@ class Database
}
$decoded = json_decode($row['value'], true);
return is_array($decoded) ? $decoded : null;
if (is_array($decoded)) {
return $decoded;
}
if (is_string($decoded)) {
return $decoded;
}
// Legacy: raw URL strings stored before JSON encoding was enforced
if (is_string($row['value']) && $row['value'] !== '') {
$trimmed = trim($row['value']);
if (filter_var($trimmed, FILTER_VALIDATE_URL)) {
return $trimmed;
}
}
return null;
}
/**
* Save an apropos content value by key (contacts JSON).
* Save an apropos content value by key.
* @param string $key
* @param array|string $value Array for structured data (contacts), string for URLs
*/
public function saveAproposContent(string $key, array $value): void
public function saveAproposContent(string $key, $value): void
{
$storedValue = json_encode($value, JSON_UNESCAPED_UNICODE);
$stmt = $this->pdo->prepare(