mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-27 00:59:18 +02:00
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:
@@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user