2024-12-30 20:17:09 +01:00
|
|
|
<?php
|
|
|
|
require_once 'fonctions.php';
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
// Récupérer le chemin actuel depuis l'URL
|
|
|
|
$currentPath = isset($_GET['path']) ? $_GET['path'] : './liste_albums';
|
|
|
|
$currentPath = realpath($currentPath);
|
|
|
|
|
|
|
|
// Vérification de sécurité
|
|
|
|
if (!isSecurePath($currentPath)) {
|
|
|
|
header('Location: index.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$albumInfo = getAlbumInfo($currentPath);
|
|
|
|
$images = [];
|
|
|
|
$baseUrl = getBaseUrl();
|
|
|
|
|
|
|
|
foreach (new DirectoryIterator($currentPath) as $file) {
|
|
|
|
if ($file->isDot()) continue;
|
|
|
|
if ($file->isFile()) {
|
|
|
|
$extension = strtolower($file->getExtension());
|
|
|
|
if (in_array($extension, ['jpg', 'jpeg', 'png', 'gif'])) {
|
|
|
|
$relativePath = str_replace('\\', '/', substr($file->getPathname(), strlen(realpath('./'))));
|
|
|
|
$url = $baseUrl . '/' . ltrim($relativePath, '/');
|
|
|
|
$images[] = $url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-01-03 15:16:07 +01:00
|
|
|
// Tri modifié pour mettre les images "top" en premier
|
2024-12-30 20:17:09 +01:00
|
|
|
usort($images, function($a, $b) {
|
2025-01-03 15:16:07 +01:00
|
|
|
$isTopA = strpos(basename($a), '--top--') !== false;
|
|
|
|
$isTopB = strpos(basename($b), '--top--') !== false;
|
|
|
|
|
|
|
|
if ($isTopA && !$isTopB) return -1; // a est top, pas b
|
|
|
|
if (!$isTopA && $isTopB) return 1; // b est top, pas a
|
|
|
|
|
|
|
|
// Si les deux sont top ou aucun n'est top, on garde le tri par date
|
|
|
|
$pathA = realpath('.') . str_replace(getBaseUrl(), '', $a);
|
|
|
|
$pathB = realpath('.') . str_replace(getBaseUrl(), '', $b);
|
|
|
|
return filectime($pathB) - filectime($pathA);
|
2024-12-30 20:17:09 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
$headerImage = !empty($images) ? $images[0] : null;
|
|
|
|
|
|
|
|
$parentPath = dirname($currentPath);
|
|
|
|
if (!isSecurePath($parentPath)) {
|
|
|
|
$parentPath = './liste_albums';
|
|
|
|
}
|
2025-01-06 14:06:25 +01:00
|
|
|
|
|
|
|
$config = getSiteConfig();
|
2024-12-30 23:59:17 +01:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
2024-12-30 20:17:09 +01:00
|
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2025-01-06 14:06:25 +01:00
|
|
|
<title><?php echo htmlspecialchars($albumInfo['title']); ?> - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
2024-12-30 20:17:09 +01:00
|
|
|
<link rel="icon" type="image/png" href="favicon.png">
|
|
|
|
<link rel="stylesheet" href="styles.css">
|
|
|
|
</head>
|
2024-12-30 23:59:17 +01:00
|
|
|
<body class="gallery-page<?php echo $albumInfo['mature_content'] ? ' gallery-page-mature content-blurred' : ''; ?>">
|
|
|
|
<?php if ($albumInfo['mature_content']): ?>
|
|
|
|
<div id="mature-warning" class="mature-overlay">
|
|
|
|
<div class="mature-content">
|
|
|
|
<div class="mature-icon">🔞</div>
|
2025-01-02 21:53:49 +01:00
|
|
|
<h2>Cet album contient du contenu réservé à un public averti.</h2>
|
2024-12-30 23:59:17 +01:00
|
|
|
<button onclick="acceptMatureContent()" class="mature-button">J'ai plus de 18 ans - Afficher le contenu</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
2024-12-30 20:17:09 +01:00
|
|
|
<a href="albums.php?path=<?php echo urlencode($parentPath); ?>" class="back-button">Retour</a>
|
|
|
|
|
|
|
|
<?php if ($headerImage): ?>
|
|
|
|
<div class="gallery-header">
|
|
|
|
<img src="<?php echo htmlspecialchars($headerImage); ?>" alt="Image principale" class="header-image">
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<div class="gallery-info">
|
|
|
|
<h1><?php echo htmlspecialchars($albumInfo['title']); ?></h1>
|
|
|
|
<?php if (!empty($albumInfo['description'])): ?>
|
|
|
|
<p><?php echo nl2br(htmlspecialchars($albumInfo['description'])); ?></p>
|
|
|
|
<?php endif; ?>
|
2024-12-30 23:59:17 +01:00
|
|
|
<?php if ($albumInfo['mature_content']): ?>
|
|
|
|
<div class="mature-badge">
|
|
|
|
<span class="mature-badge-icon">🔞</span>
|
|
|
|
Contenu réservé aux plus de 18 ans
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2025-01-03 14:33:31 +01:00
|
|
|
<?php if (!empty($albumInfo['more_info_url'])): ?>
|
|
|
|
<div class="more-info-button">
|
|
|
|
<a href="<?php echo htmlspecialchars($albumInfo['more_info_url']); ?>"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
class="action-button">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2">
|
|
|
|
<circle cx="12" cy="12" r="10"/>
|
|
|
|
<line x1="12" y1="16" x2="12" y2="12"/>
|
|
|
|
<line x1="12" y1="8" x2="12" y2="8"/>
|
|
|
|
</svg>
|
|
|
|
En savoir plus sur <?php echo htmlspecialchars($albumInfo['title']); ?>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2024-12-30 20:17:09 +01:00
|
|
|
</div>
|
|
|
|
|
2025-01-03 15:28:31 +01:00
|
|
|
<div class="gallery-grid">
|
|
|
|
<?php foreach($images as $image):
|
|
|
|
$isTop = strpos(basename($image), '--top--') !== false;
|
|
|
|
$size = getSecureImageSize(realpath('.') . str_replace(getBaseUrl(), '', $image));
|
|
|
|
$aspectRatio = $size ? $size['width'] / $size['height'] : 1;
|
|
|
|
$spanClass = '';
|
|
|
|
|
|
|
|
if ($aspectRatio > 1.7) {
|
|
|
|
$spanClass = 'gallery-item-wide';
|
|
|
|
} elseif ($aspectRatio < 0.7) {
|
|
|
|
$spanClass = 'gallery-item-tall';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="gallery-item <?php echo $isTop ? 'gallery-item-top' : ''; ?> <?php echo $spanClass; ?>">
|
|
|
|
<a href="partage.php?image=<?php echo urlencode($image); ?>" target="_blank">
|
|
|
|
<img src="<?php echo htmlspecialchars($image); ?>"
|
|
|
|
alt="Image de la galerie"
|
|
|
|
loading="lazy">
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<?php endforeach; ?>
|
2024-12-30 21:18:25 +01:00
|
|
|
</div>
|
2024-12-30 20:17:09 +01:00
|
|
|
|
|
|
|
<script>
|
2024-12-30 23:59:17 +01:00
|
|
|
// Gestion du contenu mature
|
|
|
|
function acceptMatureContent() {
|
2025-01-09 17:33:33 +01:00
|
|
|
document.body.classList.remove('gallery-page-mature');
|
|
|
|
document.body.classList.remove('content-blurred');
|
|
|
|
const warning = document.getElementById('mature-warning');
|
|
|
|
if (warning) {
|
|
|
|
warning.style.opacity = '0';
|
|
|
|
setTimeout(() => {
|
|
|
|
warning.style.display = 'none';
|
|
|
|
}, 300);
|
|
|
|
}
|
|
|
|
}
|
2024-12-30 20:17:09 +01:00
|
|
|
</script>
|
2025-01-06 16:54:32 +01:00
|
|
|
<button class="scroll-top" title="Retour en haut">↑</button>
|
|
|
|
<script>
|
|
|
|
const scrollBtn = document.querySelector('.scroll-top');
|
|
|
|
window.addEventListener('scroll', () => {
|
|
|
|
scrollBtn.style.display = window.scrollY > 500 ? 'flex' : 'none';
|
|
|
|
});
|
|
|
|
scrollBtn.addEventListener('click', () => {
|
|
|
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
|
|
});
|
|
|
|
</script>
|
2025-01-05 21:55:22 +01:00
|
|
|
<?php include 'footer.php'; ?>
|
2024-12-30 20:17:09 +01:00
|
|
|
</body>
|
|
|
|
</html>
|