$chapter) { if (($chapter['draft'] ?? false) && !Auth::check()) { continue; } if ($chapter['id'] === $chapterId) { $currentChapter = $chapter; $currentIndex = $index; break; } } if (!$currentChapter) { header('Location: roman.php?id=' . urlencode($storyId)); exit; } // Récupération des chapitres précédent et suivant $visibleChapters = array_filter($story['chapters'], function($ch) { return !($ch['draft'] ?? false) || Auth::check(); }); $visibleChapters = array_values($visibleChapters); $currentVisibleIndex = array_search($currentChapter, $visibleChapters); $prevChapter = $currentVisibleIndex > 0 ? $visibleChapters[$currentVisibleIndex - 1] : null; $nextChapter = $currentVisibleIndex < count($visibleChapters) - 1 ? $visibleChapters[$currentVisibleIndex + 1] : null; $config = Config::load(); ?> <?= htmlspecialchars($currentChapter['title']) ?> - <?= htmlspecialchars($story['title']) ?> - <?= htmlspecialchars($config['site']['name']) ?>

← Retour à l'accueil | ← Retour au roman