implémentation des albums matures P2

deuxième partie, gère les albums matures dans l'affichage des albums
This commit is contained in:
Esenjin 2024-12-30 23:49:09 +01:00
parent eec3643f19
commit b83414d3f4
2 changed files with 48 additions and 3 deletions

View File

@ -33,7 +33,8 @@ foreach (new DirectoryIterator($currentPath) as $item) {
'description' => $info['description'], 'description' => $info['description'],
'images' => $images, 'images' => $images,
'hasSubfolders' => hasSubfolders($albumPath), 'hasSubfolders' => hasSubfolders($albumPath),
'hasImages' => hasImages($albumPath) 'hasImages' => hasImages($albumPath),
'mature_content' => $info['mature_content']
]; ];
} }
} }
@ -43,7 +44,8 @@ $parentPath = dirname($currentPath);
if (!isSecurePath($parentPath)) { if (!isSecurePath($parentPath)) {
$parentPath = null; $parentPath = null;
} }
?><!DOCTYPE html> ?>
<!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
@ -69,7 +71,8 @@ if (!isSecurePath($parentPath)) {
<div class="albums-grid"> <div class="albums-grid">
<?php foreach ($albums as $album): ?> <?php foreach ($albums as $album): ?>
<a href="<?php echo $album['hasSubfolders'] ? 'albums.php' : 'galeries.php'; ?>?path=<?php echo urlencode($album['path']); ?>" <a href="<?php echo $album['hasSubfolders'] ? 'albums.php' : 'galeries.php'; ?>?path=<?php echo urlencode($album['path']); ?>"
class="album-card"> class="album-card<?php echo $album['mature_content'] ? ' album-card-mature' : ''; ?>"
<?php if ($album['mature_content']): ?>data-mature-warning="Contenu réservé aux plus de 18 ans"<?php endif; ?>>
<div class="album-images"> <div class="album-images">
<?php if (empty($album['images'])): ?> <?php if (empty($album['images'])): ?>
<div class="empty-album"></div> <div class="empty-album"></div>
@ -84,6 +87,9 @@ if (!isSecurePath($parentPath)) {
</div> </div>
<div class="album-info"> <div class="album-info">
<h2><?php echo htmlspecialchars($album['title']); ?></h2> <h2><?php echo htmlspecialchars($album['title']); ?></h2>
<?php if (!empty($album['description'])): ?>
<p><?php echo nl2br(htmlspecialchars($album['description'])); ?></p>
<?php endif; ?>
</div> </div>
</a> </a>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -105,6 +105,45 @@ body {
overflow-y: auto; overflow-y: auto;
} }
/* Styles pour le contenu mature */
.album-card-mature .album-images {
filter: blur(10px);
transition: filter 0.3s ease;
}
.album-card-mature::before {
content: attr(data-mature-warning);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(220, 53, 69, 0.9);
color: white;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
z-index: 2;
white-space: nowrap;
opacity: 1;
transition: opacity 0.3s ease;
}
.album-card-mature::after {
content: "🔞";
position: absolute;
top: 1rem;
right: 1rem;
font-size: 1.5rem;
z-index: 2;
}
.album-card-mature:hover .album-images {
filter: blur(0);
}
.album-card-mature:hover::before {
opacity: 0;
}
.album-info { .album-info {
max-width: 1800px; max-width: 1800px;
margin: 0 auto; margin: 0 auto;