Lectures/about.php

161 lines
6.8 KiB
PHP
Raw Permalink Normal View History

2025-02-16 22:22:37 +01:00
<?php
require_once 'includes/config.php';
2025-02-16 22:34:33 +01:00
require_once 'includes/Stats.php';
2025-02-16 22:22:37 +01:00
$config = Config::load();
$about = $config['about'] ?? [
'title' => 'À propos',
'content' => '',
'background' => ''
];
2025-02-16 22:34:33 +01:00
// Charger les statistiques
$stats = new Stats();
$siteStats = $stats->getStats();
2025-02-16 22:22:37 +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($about['title']) ?> - <?= htmlspecialchars($config['site']['name']) ?></title>
<?php if (file_exists(__DIR__ . '/assets/images/site/favicon.png')): ?>
<link rel="icon" type="image/png" href="assets/images/site/favicon.png">
<?php endif; ?>
<link rel="stylesheet" href="assets/css/public.css">
<link rel="stylesheet" href="assets/css/content.css">
</head>
<body>
<!-- En-tête avec image de fond -->
<header class="novel-header">
<?php if (!empty($about['background'])): ?>
<div class="novel-header-background" style="background-image: url('<?= htmlspecialchars($about['background']) ?>');"></div>
<?php endif; ?>
<h1><?= htmlspecialchars($about['title']) ?></h1>
</header>
<!-- Contenu principal -->
<div class="about-content">
<div class="about-description">
<?= $about['content'] = Config::fixImagePaths($about['content']); ?>
2025-02-16 22:22:37 +01:00
</div>
2025-02-16 22:34:33 +01:00
<aside class="sidebar">
<!-- Liens personnalisés -->
<?php if (!empty($about['links'])): ?>
<section class="sidebar-section links-section">
<h2>Liens</h2>
<ul class="custom-links-list">
<?php foreach ($about['links'] as $link): ?>
<li>
<a href="<?= htmlspecialchars($link['url']) ?>"
<?= !empty($link['target']) ? 'target="' . htmlspecialchars($link['target']) . '"' : '' ?>>
<?= htmlspecialchars($link['title']) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
2025-02-16 22:34:33 +01:00
<!-- Statistiques -->
<section class="sidebar-section stats-section">
<h2>Statistiques</h2>
<ul class="stats-list">
<!-- Nombre total de romans -->
<li class="stats-item">
<div class="stats-label">Romans publiés</div>
<div class="stats-value"><?= Stats::formatNumber($siteStats['total_stories']) ?></div>
</li>
2025-02-16 22:34:33 +01:00
<!-- Nombre total de chapitres -->
<li class="stats-item">
<div class="stats-label">Chapitres écrits</div>
<div class="stats-value"><?= Stats::formatNumber($siteStats['total_chapters']) ?></div>
<div class="stats-detail">
Moyenne de <?= $siteStats['avg_chapters_per_story'] ?> chapitres par roman
</div>
</li>
2025-02-16 22:34:33 +01:00
<!-- Nombre total de mots -->
<li class="stats-item">
<div class="stats-label">Mots écrits</div>
<div class="stats-value"><?= Stats::formatNumber($siteStats['total_words']) ?></div>
<div class="stats-detail">
Moyenne de <?= Stats::formatNumber($siteStats['avg_words_per_chapter']) ?> mots par chapitre
</div>
</li>
2025-02-16 22:34:33 +01:00
<!-- Roman avec le plus de chapitres -->
<?php if ($siteStats['most_chapters']['story']): ?>
<li class="stats-item">
<div class="stats-label">Plus long roman</div>
<div class="stats-value"><?= Stats::formatNumber($siteStats['most_chapters']['count']) ?> chapitres</div>
<div class="stats-detail">
<a href="roman.php?id=<?= htmlspecialchars($siteStats['most_chapters']['story']['id']) ?>">
<?= htmlspecialchars($siteStats['most_chapters']['story']['title']) ?>
</a>
</div>
</li>
<?php endif; ?>
2025-02-16 22:34:33 +01:00
<!-- Plus long chapitre -->
<?php if ($siteStats['longest_chapter']['story']): ?>
<li class="stats-item">
<div class="stats-label">Plus long chapitre</div>
<div class="stats-value"><?= Stats::formatNumber($siteStats['longest_chapter']['words']) ?> mots</div>
<div class="stats-detail">
<a href="roman.php?id=<?= htmlspecialchars($siteStats['longest_chapter']['story']['id']) ?>">
<?= htmlspecialchars($siteStats['longest_chapter']['story']['title']) ?>
</a>
</div>
</li>
<?php endif; ?>
<!-- Dernière mise à jour -->
<?php if ($siteStats['latest_update']['story']): ?>
<li class="stats-item">
<div class="stats-label">Dernière mise à jour</div>
<div class="stats-value"><?= Stats::formatDate($siteStats['latest_update']['date']) ?></div>
<div class="stats-detail">
<a href="roman.php?id=<?= htmlspecialchars($siteStats['latest_update']['story']['id']) ?>">
<?= htmlspecialchars($siteStats['latest_update']['story']['title']) ?>
</a>
</div>
</li>
<?php endif; ?>
</ul>
</section>
2025-02-16 22:34:33 +01:00
</aside>
2025-02-16 22:22:37 +01:00
</div>
<div class="back-to-home">
<a href="index.php">&larr; Retour à l'accueil</a>
</div>
<button class="scroll-top" aria-label="Retour en haut de page"></button>
<script>
document.addEventListener('DOMContentLoaded', function() {
const scrollTopBtn = document.querySelector('.scroll-top');
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
scrollTopBtn.classList.add('visible');
} else {
scrollTopBtn.classList.remove('visible');
}
});
scrollTopBtn.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
});
</script>
</body>
</html>