feat: brouillons visibles uniquement par auteur + ribbon 45deg BROUILLON

This commit is contained in:
Cedric Abonnel
2026-05-08 22:53:43 +02:00
parent a36d7ede76
commit 201ae53e65
58 changed files with 99 additions and 65 deletions
+21 -1
View File
@@ -68,6 +68,18 @@ switch ($action) {
exit;
}
if (!$article['published']) {
$author = $article['author'] ?? '';
$currentEmail = currentUserEmail() ?? '';
$canView = ($author !== '' && $currentEmail === $author)
|| ($author === '' && isAdmin());
if (!$canView) {
http_response_code(404);
echo 'Article introuvable.';
exit;
}
}
$files = $articles->getFiles($article['uuid']);
// Résout les chemins de fichiers relatifs dans le contenu
@@ -157,7 +169,15 @@ switch ($action) {
case 'list':
default:
$posts = $articles->getAll();
$currentEmail = currentUserEmail() ?? '';
$posts = array_values(array_filter($articles->getAll(), static function (array $a) use ($currentEmail): bool {
if ($a['published']) {
return true;
}
$author = $a['author'] ?? '';
return ($author !== '' && $currentEmail === $author)
|| ($author === '' && isAdmin());
}));
include BASE_PATH . '/templates/post_list.php';
break;
}