131 lines
6.4 KiB
PHP
131 lines
6.4 KiB
PHP
<?php
|
|
// Inclure la configuration
|
|
require_once 'includes/config.php';
|
|
|
|
// Appliquer les en-têtes de sécurité
|
|
setSecurityHeaders();
|
|
|
|
// Récupération et validation de l'ID de catégorie
|
|
$categoryId = isset($_GET['id']) ? $_GET['id'] : null;
|
|
$categoryId = $categoryId ? validateCategoryId($categoryId) : null;
|
|
|
|
// Récupérer les catégories disponibles
|
|
$allCategories = PEERTUBE_CATEGORIES;
|
|
|
|
// Récupérer les vidéos de la catégorie si un ID est fourni
|
|
if ($categoryId && isset($allCategories[$categoryId])) {
|
|
// Récupérer le nom de la catégorie
|
|
$categoryName = $allCategories[$categoryId];
|
|
|
|
// Récupérer les vidéos de cette catégorie via l'API PeerTube
|
|
$videos = getVideosByCategory($categoryId, CATEGORY_VIDEOS_COUNT); // Récupérer le nombre défini dans la config
|
|
} else {
|
|
// Si aucune catégorie valide n'est spécifiée, rediriger vers l'accueil
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="csrf-token" content="<?php echo generateCSRFToken(); ?>">
|
|
<title><?php echo htmlspecialchars($categoryName); ?> - kaubuntu.re</title>
|
|
<link rel="stylesheet" href="css/styles.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
|
|
<!-- Favicons -->
|
|
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
|
|
<link rel="manifest" href="site.webmanifest">
|
|
<link rel="icon" type="image/x-icon" href="img/favicon.ico">
|
|
<meta name="theme-color" content="#ffffff">
|
|
|
|
<!-- Open Graph Meta Tags -->
|
|
<meta property="og:title" content="Catégorie : <?php echo htmlspecialchars($categoryName); ?> - kaubuntu.re">
|
|
<meta property="og:description" content="Découvrez toutes les vidéos de la catégorie <?php echo htmlspecialchars($categoryName); ?> sur kaubuntu.re. Contenu multimédia de qualité et exclusif.">
|
|
<meta property="og:image" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . '/img/logo.png'; ?>">
|
|
<meta property="og:url" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:site_name" content="kaubuntu.re">
|
|
<meta property="og:locale" content="fr_FR">
|
|
|
|
<!-- Twitter Card Meta Tags -->
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content="Catégorie : <?php echo htmlspecialchars($categoryName); ?> - kaubuntu.re">
|
|
<meta name="twitter:description" content="Découvrez toutes les vidéos de la catégorie <?php echo htmlspecialchars($categoryName); ?> sur kaubuntu.re. Contenu multimédia de qualité et exclusif.">
|
|
<meta name="twitter:image" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . '/img/logo.png'; ?>">
|
|
</head>
|
|
<body>
|
|
<?php include 'includes/sidebar.php'; ?>
|
|
|
|
<!-- Contenu principal -->
|
|
<div class="main-content">
|
|
<?php include 'includes/header.php'; ?>
|
|
|
|
<!-- Section catégorie -->
|
|
<div class="video-section category-page" data-category-id="<?php echo $categoryId; ?>">
|
|
<div class="section-header">
|
|
<div class="section-logo">
|
|
<img src="img/logo.png" alt="kaubuntu.re">
|
|
</div>
|
|
<h2 class="section-title">Catégorie : <?php echo htmlspecialchars($categoryName); ?></h2>
|
|
</div>
|
|
|
|
<?php if (empty($videos)): ?>
|
|
<div class="no-videos-message">
|
|
<i class="fas fa-video-slash"></i>
|
|
<h3>Aucune vidéo dans cette catégorie</h3>
|
|
<p>Il n'y a pas encore de vidéos dans la catégorie "<?php echo htmlspecialchars($categoryName); ?>".</p>
|
|
<a href="index.php" class="btn-primary">Retour à l'accueil</a>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="video-grid category-videos">
|
|
<?php foreach ($videos as $video): ?>
|
|
<div class="video-card" data-video-id="<?php echo $video['id']; ?>">
|
|
<div class="video-thumbnail">
|
|
<img src="<?php echo $video['thumbnail']; ?>" alt="<?php echo htmlspecialchars($video['title']); ?>">
|
|
<div class="video-play-icon">
|
|
<i class="fas fa-play-circle"></i>
|
|
</div>
|
|
<span class="video-duration"><?php echo formatDuration($video['duration']); ?></span>
|
|
</div>
|
|
<div class="video-info">
|
|
<h3 class="video-title"><?php echo htmlspecialchars($video['title']); ?></h3>
|
|
<div class="video-channel">
|
|
<?php if (strpos($video['channelAvatar'], 'default-avatar') !== false || empty($video['channelAvatar'])): ?>
|
|
<div class="channel-avatar-placeholder">
|
|
<i class="fas fa-user-circle"></i>
|
|
</div>
|
|
<?php else: ?>
|
|
<img src="<?php echo $video['channelAvatar']; ?>" alt="<?php echo htmlspecialchars($video['channel']); ?>" class="channel-avatar">
|
|
<?php endif; ?>
|
|
<span class="channel-name"><?php echo htmlspecialchars($video['channel']); ?></span>
|
|
</div>
|
|
<div class="video-metadata">
|
|
<span class="video-views"><i class="fas fa-eye"></i> <?php echo formatViewCount($video['views']); ?> vues</span>
|
|
<span class="video-date"><i class="far fa-calendar-alt"></i> <?php echo formatDate($video['date']); ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<?php if (count($videos) >= CATEGORY_VIDEOS_COUNT): ?>
|
|
<button class="view-more" data-page="1">Voir plus</button>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'includes/footer.php'; ?>
|
|
<?php include 'includes/mobile-menu.php'; ?>
|
|
|
|
<script src="js/main.js"></script>
|
|
<script src="js/categories.js"></script>
|
|
</body>
|
|
</html>
|