diff --git a/public/assets/css/style.css b/public/assets/css/style.css index 684c3dd..2a6cc62 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -207,14 +207,14 @@ a:hover { border-color: var(--vl-border) !important; } -/* ─── Ribbon brouillon ───────────────────── */ -.draft-ribbon { +/* ─── Ribbons (brouillon / avant-première) ── */ +.draft-ribbon, +.premiere-ribbon { position: absolute; top: 26px; right: -34px; width: 130px; text-align: center; - background: #f59e0b; color: #fff; font-size: 0.6rem; font-weight: 700; @@ -227,6 +227,9 @@ a:hover { box-shadow: 0 1px 3px rgba(0,0,0,.18); } +.draft-ribbon { background: #f59e0b; } +.premiere-ribbon { background: #6366f1; } + /* ─── Buttons ─────────────────────────────── */ .btn { font-weight: 500; diff --git a/public/index.php b/public/index.php index 0a43ad7..90af0d6 100644 --- a/public/index.php +++ b/public/index.php @@ -69,7 +69,7 @@ switch ($action) { } if (!$article['published']) { - $author = $article['author'] ?? ''; + $author = $article['author'] ?? ''; $currentEmail = currentUserEmail() ?? ''; $canView = ($author !== '' && $currentEmail === $author) || ($author === '' && isAdmin()); @@ -80,6 +80,13 @@ switch ($action) { } } + // Avant-première : publié mais date future → contenu verrouillé + if ($article['published'] && strtotime((string)($article['published_at'] ?? '')) > time()) { + http_response_code(404); + echo 'Article introuvable.'; + exit; + } + $files = $articles->getFiles($article['uuid']); // Résout les chemins de fichiers relatifs dans le contenu diff --git a/templates/post_list.php b/templates/post_list.php index c8d2141..5c7b044 100644 --- a/templates/post_list.php +++ b/templates/post_list.php @@ -17,33 +17,50 @@ ob_start();
$post): ?> text($post['content']); - $preview = mb_strimwidth(strip_tags($html), 0, 120, '…'); - $gradient = $coverGradients[$i % count($coverGradients)]; - $postUrl = '/post/' . rawurlencode($post['slug']); + $html = $Parsedown->text($post['content']); + $preview = mb_strimwidth(strip_tags($html), 0, 120, '…'); + $gradient = $coverGradients[$i % count($coverGradients)]; + $postUrl = '/post/' . rawurlencode($post['slug']); + $isDraft = !$post['published']; + $isAvantPremiere = $post['published'] && strtotime((string)($post['published_at'] ?? '')) > time(); + $isLocked = $isAvantPremiere; ?>