2025-02-14 17:12:59 +01:00
|
|
|
<?php
|
|
|
|
require_once 'includes/config.php';
|
|
|
|
require_once 'includes/stories.php';
|
|
|
|
|
|
|
|
$config = Config::load();
|
|
|
|
$stories = Stories::getAll();
|
2025-02-15 22:45:41 +01:00
|
|
|
|
|
|
|
// Trier les romans par date de mise à jour (du plus récent au plus ancien)
|
|
|
|
usort($stories, function($a, $b) {
|
|
|
|
return strtotime($b['updated']) - strtotime($a['updated']);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Fonction pour vérifier si un roman est une nouvelle parution (moins d'une semaine)
|
|
|
|
function isNewRelease($story) {
|
|
|
|
$updateTime = strtotime($story['updated']);
|
|
|
|
$weekAgo = strtotime('-1 week');
|
|
|
|
return $updateTime > $weekAgo;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fonction pour formater la date en français
|
|
|
|
function formatDate($date) {
|
|
|
|
$timestamp = strtotime($date);
|
|
|
|
$months = [
|
|
|
|
'janvier', 'février', 'mars', 'avril', 'mai', 'juin',
|
|
|
|
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'
|
|
|
|
];
|
|
|
|
|
|
|
|
return sprintf(
|
|
|
|
"%d %s %d",
|
|
|
|
date('j', $timestamp),
|
|
|
|
$months[date('n', $timestamp) - 1],
|
|
|
|
date('Y', $timestamp)
|
|
|
|
);
|
|
|
|
}
|
2025-02-14 17:12:59 +01:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title><?= htmlspecialchars($config['site']['name']) ?></title>
|
2025-02-15 22:45:41 +01:00
|
|
|
|
2025-02-15 22:04:35 +01:00
|
|
|
<?php if (file_exists(__DIR__ . '/assets/images/site/favicon.png')): ?>
|
|
|
|
<link rel="icon" type="image/png" href="assets/images/site/favicon.png">
|
|
|
|
<?php endif; ?>
|
2025-02-15 22:45:41 +01:00
|
|
|
|
|
|
|
<link rel="stylesheet" href="assets/css/public.css">
|
|
|
|
|
|
|
|
<meta name="description" content="<?= htmlspecialchars($config['site']['description']) ?>">
|
2025-02-14 17:12:59 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
2025-02-15 22:45:41 +01:00
|
|
|
<div class="header-container">
|
|
|
|
<header class="site-header">
|
|
|
|
<?php if (!empty($config['site']['logo'])): ?>
|
|
|
|
<img src="<?= htmlspecialchars($config['site']['logo']) ?>"
|
|
|
|
alt="<?= htmlspecialchars($config['site']['name']) ?>"
|
|
|
|
class="site-logo">
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<div class="site-header-content">
|
|
|
|
<h1><?= htmlspecialchars($config['site']['name']) ?></h1>
|
|
|
|
<p><?= nl2br(htmlspecialchars($config['site']['description'])) ?></p>
|
|
|
|
</div>
|
2025-02-16 22:22:37 +01:00
|
|
|
|
|
|
|
<div class="header-actions">
|
|
|
|
<a href="about.php" class="about-button">À propos</a>
|
|
|
|
</div>
|
2025-02-15 22:45:41 +01:00
|
|
|
</header>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<main class="main-content">
|
|
|
|
<div class="novels-grid">
|
2025-02-14 17:12:59 +01:00
|
|
|
<?php foreach ($stories as $story): ?>
|
2025-02-15 22:45:41 +01:00
|
|
|
<a href="roman.php?id=<?= htmlspecialchars($story['id']) ?>" class="novel-card <?= isNewRelease($story) ? 'new-release' : '' ?>">
|
|
|
|
<img src="<?= htmlspecialchars($story['cover']) ?>"
|
|
|
|
alt="Couverture de <?= htmlspecialchars($story['title']) ?>"
|
|
|
|
class="novel-cover"
|
|
|
|
loading="lazy">
|
|
|
|
|
|
|
|
<div class="novel-info">
|
|
|
|
<h2><?= htmlspecialchars($story['title']) ?></h2>
|
|
|
|
<p>
|
|
|
|
<?= count($story['chapters'] ?? []) ?>
|
|
|
|
chapitre<?= count($story['chapters'] ?? []) > 1 ? 's' : '' ?>
|
|
|
|
</p>
|
|
|
|
<div class="novel-date">
|
|
|
|
Mis à jour le <?= formatDate($story['updated']) ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</a>
|
2025-02-14 17:12:59 +01:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
|
|
|
</main>
|
2025-02-16 21:52:54 +01:00
|
|
|
|
|
|
|
<button class="scroll-top" aria-label="Retour en haut de page">↑</button>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const scrollTopBtn = document.querySelector('.scroll-top');
|
|
|
|
|
|
|
|
// Afficher/masquer le bouton
|
|
|
|
window.addEventListener('scroll', function() {
|
|
|
|
if (window.pageYOffset > 300) {
|
|
|
|
scrollTopBtn.classList.add('visible');
|
|
|
|
} else {
|
|
|
|
scrollTopBtn.classList.remove('visible');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Action de retour en haut
|
|
|
|
scrollTopBtn.addEventListener('click', function() {
|
|
|
|
window.scrollTo({
|
|
|
|
top: 0,
|
|
|
|
behavior: 'smooth'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2025-02-14 17:12:59 +01:00
|
|
|
</body>
|
|
|
|
</html>
|