2025-04-08 06:37:14 +04:00
|
|
|
<?php
|
2025-04-10 12:07:56 +04:00
|
|
|
// Inclure la configuration
|
|
|
|
|
require_once 'includes/config.php';
|
|
|
|
|
|
2025-07-17 09:58:38 +04:00
|
|
|
// 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;
|
2025-04-08 06:37:14 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
// Récupérer les catégories disponibles
|
|
|
|
|
$allCategories = PEERTUBE_CATEGORIES;
|
2025-04-08 06:37:14 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
// 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];
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
// 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
|
2025-04-08 06:37:14 +04:00
|
|
|
} else {
|
2025-04-10 12:07:56 +04:00
|
|
|
// Si aucune catégorie valide n'est spécifiée, rediriger vers l'accueil
|
|
|
|
|
header('Location: index.php');
|
|
|
|
|
exit;
|
2025-04-08 06:37:14 +04:00
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="fr">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2025-07-17 09:58:38 +04:00
|
|
|
<meta name="csrf-token" content="<?php echo generateCSRFToken(); ?>">
|
2025-04-11 06:27:03 +04:00
|
|
|
<title><?php echo htmlspecialchars($categoryName); ?> - kaubuntu.re</title>
|
2025-04-08 06:37:14 +04:00
|
|
|
<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">
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-09 20:29:09 +04:00
|
|
|
<!-- 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">
|
2025-04-08 06:37:14 +04:00
|
|
|
</head>
|
|
|
|
|
<body>
|
2025-04-10 12:07:56 +04:00
|
|
|
<?php include 'includes/sidebar.php'; ?>
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
<!-- Contenu principal -->
|
|
|
|
|
<div class="main-content">
|
2025-04-08 06:37:14 +04:00
|
|
|
<?php include 'includes/header.php'; ?>
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
<!-- Section catégorie -->
|
|
|
|
|
<div class="video-section category-page" data-category-id="<?php echo $categoryId; ?>">
|
|
|
|
|
<div class="section-header">
|
|
|
|
|
<div class="section-logo">
|
2025-04-11 06:27:03 +04:00
|
|
|
<img src="img/logo.png" alt="kaubuntu.re">
|
2025-04-10 12:07:56 +04:00
|
|
|
</div>
|
|
|
|
|
<h2 class="section-title">Catégorie : <?php echo htmlspecialchars($categoryName); ?></h2>
|
|
|
|
|
</div>
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
<?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>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-10 12:07:56 +04:00
|
|
|
<span class="video-duration"><?php echo formatDuration($video['duration']); ?></span>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-10 12:07:56 +04:00
|
|
|
<div class="video-info">
|
|
|
|
|
<h3 class="video-title"><?php echo htmlspecialchars($video['title']); ?></h3>
|
2025-04-10 12:28:33 +04:00
|
|
|
<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>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-04-10 12:07:56 +04:00
|
|
|
</div>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
<?php if (count($videos) >= CATEGORY_VIDEOS_COUNT): ?>
|
|
|
|
|
<button class="view-more" data-page="1">Voir plus</button>
|
2025-04-08 06:37:14 +04:00
|
|
|
<?php endif; ?>
|
2025-04-10 12:07:56 +04:00
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-10 12:07:56 +04:00
|
|
|
<?php include 'includes/footer.php'; ?>
|
|
|
|
|
<?php include 'includes/mobile-menu.php'; ?>
|
2025-04-12 21:55:09 +04:00
|
|
|
|
2025-04-08 06:37:14 +04:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
|
|
|
|
<script src="js/main.js"></script>
|
2025-04-12 21:55:09 +04:00
|
|
|
<script src="js/categories.js"></script>
|
2025-04-08 06:37:14 +04:00
|
|
|
</body>
|
2025-04-12 21:55:09 +04:00
|
|
|
</html>
|