2025-07-17 09:58:38 +04:00
< ? php
// Inclure la configuration
require_once 'includes/config.php' ;
2025-09-07 22:12:44 +04:00
// Vérifier si le mode compte à rebours est activé
if ( defined ( 'COUNTDOWN_ENABLED' ) && COUNTDOWN_ENABLED === true ) {
// Rediriger vers la page de compte à rebours
require_once 'countdown.php' ;
exit ;
}
2025-07-22 11:34:02 +04:00
// Inclure les fonctions de données structurées
require_once 'includes/structured-data.php' ;
2025-07-17 09:58:38 +04:00
// Appliquer les en-têtes de sécurité
setSecurityHeaders ();
?>
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>kaubuntu.re - Plateforme Multimédia</title>
2025-09-14 14:27:00 +04:00
<link rel="stylesheet" href="css/styles.css?v=<?php echo filemtime('css/styles.css'); ?>">
2025-09-14 13:49:57 +04:00
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
2025-09-14 14:27:00 +04:00
<link rel="stylesheet" href="css/mastodon-timeline.min.css?v=<?php echo filemtime('css/mastodon-timeline.min.css'); ?>">
2025-09-17 22:30:09 +04:00
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED): ?>
<link rel="stylesheet" href="css/wordpress-posts.css?v=<?php echo filemtime('css/wordpress-posts.css'); ?>">
<?php endif; ?>
2025-07-17 15:09:01 +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">
2025-07-17 20:10:05 +04:00
<meta name="theme-color" content="#FF0000">
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
<!-- PWA Meta Tags -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="kaubuntu.re">
<meta name="application-name" content="kaubuntu.re">
<meta name="msapplication-TileColor" content="#FF0000">
<meta name="msapplication-config" content="browserconfig.xml">
2025-07-24 08:36:46 +04:00
2025-07-21 14:28:41 +04:00
<!-- Open Graph Meta Tags -->
<meta property="og:title" content="kaubuntu.re - Plateforme Multimédia">
<meta property="og:description" content="Découvrez notre plateforme multimédia avec des vidéos, des shorts et des directs. Tendances, catégories et contenus exclusifs vous attendent.">
<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">
2025-07-24 08:36:46 +04:00
2025-07-21 14:28:41 +04:00
<!-- Twitter Card Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="kaubuntu.re - Plateforme Multimédia">
<meta name="twitter:description" content="Découvrez notre plateforme multimédia avec des vidéos, des shorts et des directs. Tendances, catégories et contenus exclusifs vous attendent.">
<meta name="twitter:image" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . '/img/logo.png'; ?>">
2025-07-24 08:36:46 +04:00
2025-07-22 11:34:02 +04:00
<!-- Données structurées JSON-LD pour le site web -->
<?php
$websiteJsonLd = generateWebSiteJsonLd();
outputJsonLd($websiteJsonLd);
2025-07-24 08:36:46 +04:00
2025-07-22 11:34:02 +04:00
// Générer les fils d'Ariane pour la page d'accueil
$breadcrumbs = [
['name' => 'Accueil', 'url' => getBaseUrl()]
];
$breadcrumbJsonLd = generateBreadcrumbJsonLd($breadcrumbs);
outputJsonLd($breadcrumbJsonLd);
?>
2025-07-24 08:36:46 +04:00
2025-07-22 12:57:49 +04:00
<!-- Script pour éviter le flash en mode sombre -->
<script>
(function() {
const savedTheme = localStorage.getItem('theme');
const systemPrefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const shouldUseDark = savedTheme === 'dark' || (!savedTheme && systemPrefersDark);
2025-07-24 08:36:46 +04:00
2025-07-22 12:57:49 +04:00
if (shouldUseDark) {
document.documentElement.setAttribute('data-theme', 'dark');
}
})();
</script>
2025-07-24 07:40:36 +04:00
<!-- ------ Script Plausible ------ -->
<!-- <script defer data-domain="<?php echo $_SERVER['HTTP_HOST'] ?>" src="https://plausible.io/js/script.hash.outbound-links.pageview-props.tagged-events.js"></script> -->
<!-- <script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script> -->
<!-- ------ Script Plausible ------ -->
2025-04-08 06:37:14 +04:00
</head>
<body>
2025-04-09 16:04:50 +04:00
<?php include 'includes/sidebar.php'; ?>
2025-04-08 06:51:33 +04:00
<!-- Contenu principal -->
2025-07-22 11:54:05 +04:00
<main class="main-content" id="main-content" role="main">
2025-04-09 16:04:50 +04:00
<?php include 'includes/header.php'; ?>
2025-04-08 08:22:02 +04:00
<!-- Hero and Mastodon container -->
<div class="hero-mastodon-wrapper">
<!-- Hero Banner -->
2025-07-22 11:54:05 +04:00
<section class="hero" aria-labelledby="live-section-title">
<h2 id="live-section-title" class="sr-only">Diffusion en direct</h2>
2025-07-17 15:09:01 +04:00
<?php
2026-01-14 16:51:44 +04:00
// Récupérer la vidéo à afficher selon le mode configuré
$displayData = getDisplayVideo();
$video = $displayData['video'];
$isLive = $displayData['isLive'];
$badge = $displayData['badge'];
$mode = $displayData['mode'];
2025-07-17 15:09:01 +04:00
2026-01-14 16:51:44 +04:00
if ($video) {
// Construire les paramètres de l'iframe selon le mode
$iframeParams = '';
if ($mode === 'auto' && $isLive) {
// Mode auto avec direct : autoplay + muted
$iframeParams = '?autoplay=1&muted=1';
}
// Mode static : pas d'autoplay (iframe params reste vide)
// Afficher la vidéo
2025-04-10 10:33:19 +04:00
?>
<div class="live-badge">
2026-01-14 16:51:44 +04:00
<?php if ($isLive): ?>
<i class="fas fa-circle"></i> <?php echo htmlspecialchars($badge); ?>
<?php else: ?>
<?php echo htmlspecialchars($badge); ?>
<?php endif; ?>
2025-04-08 08:22:02 +04:00
</div>
2025-04-10 10:33:19 +04:00
<div class="hero-video-container">
2025-07-17 15:09:01 +04:00
<iframe
2026-01-14 16:51:44 +04:00
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $video['id']; ?><?php echo $iframeParams; ?>"
2025-07-17 15:09:01 +04:00
frameborder="0"
2025-04-10 10:33:19 +04:00
allowfullscreen="allowfullscreen"
allow="autoplay; fullscreen"
2026-01-14 16:51:44 +04:00
title="<?php echo htmlspecialchars($video['title']); ?>"
aria-describedby="video-description">
2025-04-10 10:33:19 +04:00
</iframe>
2026-01-14 16:51:44 +04:00
<div id="video-description" class="sr-only">
Lecteur vidéo pour <?php echo htmlspecialchars($video['title']); ?> de <?php echo htmlspecialchars($video['channel']); ?>
2025-07-22 11:54:05 +04:00
</div>
2025-04-10 10:33:19 +04:00
</div>
<div class="hero-video-info">
2026-01-14 16:51:44 +04:00
<h2><?php echo htmlspecialchars($video['title']); ?></h2>
2025-04-10 10:33:19 +04:00
<div class="hero-channel-info">
2026-01-14 16:51:44 +04:00
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
2025-07-22 11:54:05 +04:00
<div class="channel-avatar-placeholder" role="img" aria-label="Avatar par défaut">
<i class="fas fa-user-circle" aria-hidden="true"></i>
2025-04-10 10:33:19 +04:00
</div>
<?php else: ?>
2026-01-14 16:51:44 +04:00
<img src="<?php echo $video['channelAvatar']; ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($video['channel']); ?>" class="channel-avatar">
2025-04-10 10:33:19 +04:00
<?php endif; ?>
2026-01-14 16:51:44 +04:00
<span class="channel-name"><?php echo htmlspecialchars($video['channel']); ?></span>
2025-04-10 10:33:19 +04:00
</div>
</div>
2025-07-17 15:09:01 +04:00
<?php
2025-04-10 10:33:19 +04:00
} else {
2025-10-08 17:00:40 +04:00
// Aucun direct en cours - vérifier s'il y a une annonce configurée
$showNextLiveAnnouncement = defined('NEXT_LIVE_ENABLED') && NEXT_LIVE_ENABLED === true;
if ($showNextLiveAnnouncement) {
// Afficher l'annonce du prochain live
2025-10-08 20:53:36 +04:00
// Définir l'image de fond si disponible
$bgImageStyle = '';
if (!empty(NEXT_LIVE_IMAGE) && file_exists(NEXT_LIVE_IMAGE)) {
$bgImageStyle = 'background-image: url(\'' . htmlspecialchars(NEXT_LIVE_IMAGE) . '\');';
}
2025-10-08 17:00:40 +04:00
?>
2025-10-08 20:53:36 +04:00
<div class="hero-next-live" style="<?php echo $bgImageStyle; ?>">
2025-10-08 17:00:40 +04:00
<?php if (!empty(NEXT_LIVE_IMAGE) && file_exists(NEXT_LIVE_IMAGE)): ?>
<div class="hero-next-live-image-container">
<img src="<?php echo htmlspecialchars(NEXT_LIVE_IMAGE); ?>"
alt="<?php echo htmlspecialchars(NEXT_LIVE_TITLE); ?>"
class="hero-next-live-image">
</div>
<?php endif; ?>
<div class="hero-next-live-content">
<i class="fas fa-calendar-alt"></i>
<?php
if (!empty(NEXT_LIVE_DATE)) {
2025-10-08 20:52:40 +04:00
$liveDate = new DateTime(NEXT_LIVE_DATE, new DateTimeZone(DEFAULT_TIMEZONE));
2025-10-08 17:00:40 +04:00
$dayFormatter = new IntlDateFormatter(
'fr_FR',
IntlDateFormatter::FULL,
IntlDateFormatter::NONE,
2025-10-08 20:52:40 +04:00
DEFAULT_TIMEZONE,
2025-10-08 17:00:40 +04:00
IntlDateFormatter::GREGORIAN,
'EEEE d MMMM'
);
$formattedDay = $dayFormatter->format($liveDate);
$formattedDay = ucfirst($formattedDay);
$dynamicTitle = NEXT_LIVE_TITLE . ' - ' . $formattedDay;
} else {
$dynamicTitle = NEXT_LIVE_TITLE;
}
?>
<h2><?php echo htmlspecialchars($dynamicTitle); ?></h2>
<?php
if (!empty(NEXT_LIVE_DATE)) {
$liveHour = $liveDate->format('H\hi');
$dynamicDescription = 'Rejoignez-nous à ' . $liveHour . '. ' . NEXT_LIVE_DESCRIPTION;
} else {
$dynamicDescription = NEXT_LIVE_DESCRIPTION;
}
?>
<p><?php echo nl2br(htmlspecialchars($dynamicDescription)); ?></p>
<?php if (!empty(NEXT_LIVE_DATE)): ?>
<div class="hero-next-live-datetime">
<p class="hero-next-live-date">
<i class="fas fa-clock"></i>
<?php
$formatter = new IntlDateFormatter(
'fr_FR',
IntlDateFormatter::FULL,
IntlDateFormatter::SHORT,
2025-10-08 20:52:40 +04:00
DEFAULT_TIMEZONE
2025-10-08 17:00:40 +04:00
);
echo $formatter->format($liveDate);
$offset = $liveDate->format('P');
echo ' <span class="utc-offset">(UTC' . $offset . ')</span>';
?>
</p>
<!-- Autres fuseaux horaires -->
<div class="hero-next-live-timezones">
<?php
// Ordre croissant : du plus en retard au plus en avance
$timezones = [
'Ma\'ohi Nui' => 'Pacific/Tahiti',
'Martinique / Guadeloupe' => 'America/Martinique',
'Guyane' => 'America/Cayenne',
'France' => 'Europe/Paris',
'Kanaky' => 'Pacific/Noumea'
];
foreach($timezones as $name => $timezone):
$liveDateLocal = clone $liveDate;
$liveDateLocal->setTimezone(new DateTimeZone($timezone));
$dayDiff = $liveDateLocal->format('j') - $liveDate->format('j');
$dayIndicator = '';
if ($dayDiff > 0) {
$dayIndicator = ' <span class="day-shift">+1j</span>';
} elseif ($dayDiff < 0) {
$dayIndicator = ' <span class="day-shift">-1j</span>';
}
?>
<span class="hero-timezone-item">
<strong><?php echo $name; ?> :</strong> <?php echo $liveDateLocal->format('H\hi'); ?><?php echo $dayIndicator; ?>
</span>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php
} else {
?>
<div class="hero-no-live">
<i class="fas fa-tv"></i>
<h2>Aucun direct en cours</h2>
<p>Revenez plus tard pour découvrir nos prochaines diffusions en direct.</p>
</div>
<?php
}
2025-04-10 10:33:19 +04:00
}
?>
2025-07-22 11:54:05 +04:00
</section>
2025-04-08 08:22:02 +04:00
2025-09-17 22:30:09 +04:00
<!-- Container pour Mastodon et WordPress côte à côte -->
<div class="timeline-wordpress-container">
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
</div>
2025-04-08 08:36:27 +04:00
</div>
2025-09-17 22:30:09 +04:00
<!-- Section Articles WordPress (desktop à droite, mobile en dessous) -->
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED && !empty(WORDPRESS_URL)): ?>
<div class="wordpress-section">
<div class="wordpress-container">
<div class="wordpress-header">
<i class="fas fa-newspaper"></i>
Articles <?php if (!empty(WORDPRESS_URL)): ?>
<a href="<?php echo htmlspecialchars(WORDPRESS_URL); ?>"
target="_blank"
rel="noopener noreferrer"
title="Visiter <?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>">
<?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>
</a>
<?php endif; ?>
</div>
<div class="wordpress-posts-list">
<?php
$wordpressPosts = getWordPressPosts();
if (empty($wordpressPosts)) {
echo '<div class="wordpress-no-posts">Aucun article disponible</div>';
} else {
foreach ($wordpressPosts as $post):
?>
<a href="<?php echo htmlspecialchars($post['link']); ?>"
class="wordpress-post-item"
target="_blank"
rel="noopener noreferrer"
title="<?php echo htmlspecialchars($post['title']); ?>">
<div class="wordpress-post-thumb">
<?php if (!empty($post['featured_image'])): ?>
<img src="<?php echo htmlspecialchars($post['featured_image']); ?>"
alt="<?php echo htmlspecialchars($post['title']); ?>"
loading="lazy">
<?php else: ?>
<i class="fas fa-file-alt"></i>
<?php endif; ?>
</div>
<div class="wordpress-post-info">
<h3 class="wordpress-post-title">
<?php echo htmlspecialchars($post['title']); ?>
</h3>
<div class="wordpress-post-meta">
<span><?php echo htmlspecialchars($post['date']); ?></span>
<?php if (!empty($post['author'])): ?>
<span>•</span>
<span><?php echo htmlspecialchars($post['author']); ?></span>
<?php endif; ?>
</div>
</div>
</a>
<?php
endforeach;
}
?>
</div>
</div>
2025-04-08 06:51:33 +04:00
</div>
2025-09-17 22:30:09 +04:00
<?php endif; ?>
2025-04-08 06:51:33 +04:00
</div>
</div>
2025-04-08 08:22:02 +04:00
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<!-- Hashtags en ligne -->
<div class="tags-section">
2025-07-17 15:09:01 +04:00
<?php
2025-04-10 13:53:33 +04:00
if (defined('POPULAR_TAGS') && !empty(POPULAR_TAGS)):
foreach (POPULAR_TAGS as $tag):
$encodedTag = urlencode('#' . $tag);
?>
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="tag">#<?php echo htmlspecialchars($tag); ?></a>
2025-07-17 15:09:01 +04:00
<?php
2025-04-10 13:53:33 +04:00
endforeach;
endif;
?>
2025-04-08 06:51:33 +04:00
</div>
2025-07-17 15:09:01 +04:00
2025-04-11 07:17:24 +04:00
<!-- Séparateur stylisé -->
<hr class="section-divider">
2025-07-17 15:09:01 +04:00
2025-09-17 22:30:09 +04:00
2025-04-08 06:51:33 +04:00
<!-- Section Shorts -->
2025-07-22 11:54:05 +04:00
<section class="video-section" aria-labelledby="shorts-heading">
2025-04-08 06:51:33 +04:00
<div class="section-header">
<div class="section-logo">
2025-07-22 11:54:05 +04:00
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
2025-04-08 06:51:33 +04:00
</div>
2025-07-22 11:54:05 +04:00
<h2 id="shorts-heading" class="section-title">Shorts</h2>
2025-04-08 06:51:33 +04:00
</div>
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<div class="carousel">
<div class="carousel-container">
2025-07-17 15:09:01 +04:00
<?php
2025-04-08 09:12:46 +04:00
// Récupérer les shorts depuis l'API PeerTube
$shorts = getShorts();
2025-07-17 15:09:01 +04:00
2025-04-08 09:12:46 +04:00
// Traiter le cas où aucun short n'est trouvé
if (empty($shorts)) {
echo '<div class="no-results">Aucun short disponible pour le moment</div>';
} else {
foreach ($shorts as $video):
2025-04-08 06:51:33 +04:00
?>
<div class="carousel-item">
2025-10-03 08:06:24 +04:00
<article class="video-card short-card" data-video-id="<?php echo $video['id']; ?>">
<div class="video-thumbnail short-thumbnail">
<img src="<?php echo $video['thumbnail']; ?>" alt="Miniature de la vidéo: <?php echo htmlspecialchars($video['title']); ?>">
<div class="video-duration" aria-label="Durée: <?php echo formatDuration($video['duration']); ?>">
<?php echo formatDuration($video['duration']); ?>
</div>
2025-10-03 08:20:11 +04:00
<div class="short-play-overlay" aria-hidden="true">
<i class="fas fa-play-circle"></i>
2025-10-03 08:06:24 +04:00
</div>
2025-10-03 08:20:11 +04:00
<div class="short-title-overlay">
<?php echo htmlspecialchars($video['title']); ?>
2025-10-03 08:06:24 +04:00
</div>
</div>
</article>
2025-04-08 06:51:33 +04:00
</div>
2025-07-17 15:09:01 +04:00
<?php
2025-04-08 09:12:46 +04:00
endforeach;
}
?>
2025-04-08 06:51:33 +04:00
</div>
2025-07-17 15:09:01 +04:00
2025-04-08 09:12:46 +04:00
<?php if (!empty($shorts) && count($shorts) > 1): ?>
2025-04-08 06:51:33 +04:00
<div class="carousel-controls">
2025-04-08 09:12:46 +04:00
<?php for ($i = 0; $i < count($shorts); $i++): ?>
<div class="carousel-dot <?php echo $i === 0 ? 'active' : ''; ?>"></div>
<?php endfor; ?>
2025-04-08 06:51:33 +04:00
</div>
2025-04-08 09:12:46 +04:00
<?php endif; ?>
2025-04-08 06:51:33 +04:00
</div>
2025-07-22 11:54:05 +04:00
</section>
2025-07-17 15:09:01 +04:00
2025-04-11 07:17:24 +04:00
<!-- Séparateur stylisé -->
<hr class="section-divider">
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<!-- Section Dernières vidéos -->
2026-01-15 19:38:55 +04:00
<section class="video-section" data-video-type="recent" aria-labelledby="recent-videos-heading">
2025-07-22 11:54:05 +04:00
<header class="section-header">
2025-04-08 06:51:33 +04:00
<div class="section-logo">
2025-07-22 11:54:05 +04:00
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
2025-04-08 06:51:33 +04:00
</div>
2025-07-22 11:54:05 +04:00
<h2 id="recent-videos-heading" class="section-title">Dernières vidéos</h2>
</header>
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<div class="video-grid">
<?php
2025-04-08 09:12:46 +04:00
// Récupérer les vidéos récentes depuis l'API PeerTube
$recentVideos = getRecentVideos();
2025-07-17 15:09:01 +04:00
2025-04-08 09:12:46 +04:00
// Traiter le cas où aucune vidéo n'est trouvée
if (empty($recentVideos)) {
echo '<div class="no-results">Aucune vidéo disponible pour le moment</div>';
} else {
foreach ($recentVideos as $video):
2025-04-08 06:51:33 +04:00
?>
2025-07-22 11:54:05 +04:00
<article class="video-card" data-video-id="<?php echo $video['id']; ?>">
2025-04-08 06:51:33 +04:00
<div class="video-thumbnail">
2025-07-22 11:54:05 +04:00
<img src="<?php echo $video['thumbnail']; ?>" alt="Miniature de la vidéo: <?php echo htmlspecialchars($video['title']); ?>">
<div class="video-play-icon" aria-hidden="true">
2025-04-08 06:51:33 +04:00
<i class="fas fa-play-circle"></i>
</div>
2025-07-22 11:54:05 +04:00
<div class="video-duration" aria-label="Durée: <?php echo formatDuration($video['duration']); ?>">
<?php echo formatDuration($video['duration']); ?>
</div>
2025-04-08 06:51:33 +04:00
</div>
<div class="video-info">
2025-07-22 11:54:05 +04:00
<h3 class="video-title"><?php echo htmlspecialchars($video['title']); ?></h3>
2025-04-09 08:40:03 +04:00
<div class="video-channel">
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== 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 $video['channel']; ?>" class="channel-avatar">
<?php endif; ?>
<span class="channel-name"><?php echo $video['channel']; ?></span>
</div>
2025-04-08 06:51:33 +04:00
<div class="video-metadata">
2025-04-08 10:49:46 +04:00
<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:51:33 +04:00
</div>
</div>
2025-07-22 11:54:05 +04:00
</article>
2025-07-17 15:09:01 +04:00
<?php
2025-04-08 09:12:46 +04:00
endforeach;
}
?>
2025-04-08 06:51:33 +04:00
</div>
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<button class="view-more">Voir plus</button>
2025-07-22 11:54:05 +04:00
</section>
2025-07-17 15:09:01 +04:00
2025-04-11 07:17:24 +04:00
<!-- Séparateur stylisé -->
<hr class="section-divider">
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<!-- Section Tendances -->
2026-01-15 19:38:55 +04:00
<section class="video-section" data-video-type="trending" aria-labelledby="trending-videos-heading">
2025-07-22 11:54:05 +04:00
<header class="section-header">
2025-04-08 06:51:33 +04:00
<div class="section-logo">
2025-07-22 11:54:05 +04:00
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
2025-04-08 06:51:33 +04:00
</div>
2025-07-22 11:54:05 +04:00
<h2 id="trending-videos-heading" class="section-title">Tendances</h2>
</header>
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<div class="video-grid">
<?php
2025-04-08 09:12:46 +04:00
// Récupérer les vidéos tendances depuis l'API PeerTube
$trendingVideos = getTrendingVideos();
2025-07-17 15:09:01 +04:00
2025-04-08 09:12:46 +04:00
// Traiter le cas où aucune vidéo n'est trouvée
if (empty($trendingVideos)) {
echo '<div class="no-results">Aucune vidéo disponible pour le moment</div>';
} else {
foreach ($trendingVideos as $video):
2025-04-08 06:51:33 +04:00
?>
2025-07-22 11:54:05 +04:00
<article class="video-card" data-video-id="<?php echo $video['id']; ?>">
2025-04-08 06:51:33 +04:00
<div class="video-thumbnail">
<img src="<?php echo $video['thumbnail']; ?>" alt="<?php echo $video['title']; ?>">
<div class="video-play-icon">
<i class="fas fa-play-circle"></i>
</div>
2025-04-08 09:12:46 +04:00
<div class="video-duration"><?php echo formatDuration($video['duration']); ?></div>
2025-04-08 06:51:33 +04:00
</div>
<div class="video-info">
<h3 class="video-title"><?php echo $video['title']; ?></h3>
2025-04-09 08:40:03 +04:00
<div class="video-channel">
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== 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 $video['channel']; ?>" class="channel-avatar">
<?php endif; ?>
<span class="channel-name"><?php echo $video['channel']; ?></span>
</div>
2025-04-08 06:51:33 +04:00
<div class="video-metadata">
2025-04-08 10:49:46 +04:00
<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:51:33 +04:00
</div>
2025-04-08 06:37:14 +04:00
</div>
2025-07-22 11:54:05 +04:00
</article>
2025-07-17 15:09:01 +04:00
<?php
2025-04-08 09:12:46 +04:00
endforeach;
}
?>
2025-04-08 06:51:33 +04:00
</div>
2025-07-17 15:09:01 +04:00
2025-04-08 06:51:33 +04:00
<button class="view-more">Voir plus</button>
2025-07-22 11:54:05 +04:00
</section>
2025-07-17 15:09:01 +04:00
2025-04-11 07:17:24 +04:00
<!-- Séparateur stylisé -->
<hr class="section-divider">
2025-07-17 15:09:01 +04:00
2025-04-08 15:36:33 +04:00
<!-- Sections par catégorie -->
<?php
// Récupérer les catégories avec leurs vidéos
$displayCategories = getDisplayCategories();
2025-07-17 15:09:01 +04:00
2025-04-08 15:36:33 +04:00
// Afficher chaque catégorie qui a des vidéos
foreach ($displayCategories as $category):
if (!empty($category['videos'])):
?>
<!-- Section Catégorie: <?php echo $category['name']; ?> -->
2025-07-22 11:54:05 +04:00
<section class="video-section" data-category-id="<?php echo $category['id']; ?>" aria-labelledby="category-heading-<?php echo $category['id']; ?>">
<header class="section-header">
2025-04-08 15:36:33 +04:00
<div class="section-logo">
2025-07-22 11:54:05 +04:00
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
2025-04-08 15:36:33 +04:00
</div>
2025-07-22 11:54:05 +04:00
<h2 id="category-heading-<?php echo $category['id']; ?>" class="section-title"><?php echo htmlspecialchars($category['name']); ?></h2>
</header>
2025-07-17 15:09:01 +04:00
2025-04-08 15:36:33 +04:00
<div class="video-grid">
<?php foreach ($category['videos'] as $video): ?>
2025-07-22 11:54:05 +04:00
<article class="video-card" data-video-id="<?php echo $video['id']; ?>">
2025-04-08 15:36:33 +04:00
<div class="video-thumbnail">
<img src="<?php echo $video['thumbnail']; ?>" alt="<?php echo $video['title']; ?>">
<div class="video-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<div class="video-duration"><?php echo formatDuration($video['duration']); ?></div>
</div>
<div class="video-info">
<h3 class="video-title"><?php echo $video['title']; ?></h3>
2025-04-09 08:40:03 +04:00
<div class="video-channel">
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== 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 $video['channel']; ?>" class="channel-avatar">
<?php endif; ?>
<span class="channel-name"><?php echo $video['channel']; ?></span>
</div>
2025-04-08 15:36:33 +04:00
<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>
2025-07-22 11:54:05 +04:00
</article>
2025-04-08 15:36:33 +04:00
<?php endforeach; ?>
</div>
2025-07-17 15:09:01 +04:00
2025-04-08 15:36:33 +04:00
<button class="view-more">Voir plus</button>
2025-07-22 11:54:05 +04:00
</section>
2025-07-17 15:09:01 +04:00
2025-04-11 07:17:24 +04:00
<!-- Séparateur stylisé -->
<hr class="section-divider">
2025-07-17 15:09:01 +04:00
<?php
2025-04-08 15:36:33 +04:00
endif;
endforeach;
?>
2025-07-17 15:09:01 +04:00
2025-04-10 14:39:27 +04:00
<!-- Section Flexbox pour Informations et Tendances Hashtags -->
2025-07-22 11:54:05 +04:00
<section class="info-tags-container">
2025-04-10 14:39:27 +04:00
<?php if (defined('MOVEMENT_DESCRIPTION') && !empty(MOVEMENT_DESCRIPTION)): ?>
<!-- Section Informations -->
2025-07-22 11:54:05 +04:00
<article class="info-section">
2025-04-10 14:39:27 +04:00
<h2 class="info-header"><?php echo MOVEMENT_DESCRIPTION; ?></h2>
2025-07-17 15:09:01 +04:00
2025-04-10 14:49:08 +04:00
<?php if (defined('MOVEMENT_IMAGE') && !empty(MOVEMENT_IMAGE)): ?>
2025-04-10 14:39:27 +04:00
<figure class="movement-figure">
2025-04-10 14:49:08 +04:00
<img src="<?php echo MOVEMENT_IMAGE; ?>" alt="<?php echo defined('MOVEMENT_IMAGE_ALT') ? MOVEMENT_IMAGE_ALT : ''; ?>" class="info-image">
<?php if (defined('MOVEMENT_CAPTION') && !empty(MOVEMENT_CAPTION)): ?>
2025-04-10 14:39:27 +04:00
<figcaption class="movement-caption">
2025-04-10 14:49:08 +04:00
<?php echo MOVEMENT_CAPTION; ?>
2025-04-10 14:39:27 +04:00
</figcaption>
2025-04-10 14:49:08 +04:00
<?php endif; ?>
2025-04-10 14:39:27 +04:00
</figure>
2025-04-10 14:49:08 +04:00
<?php endif; ?>
2025-07-22 11:54:05 +04:00
</article>
2025-04-10 14:39:27 +04:00
<?php endif; ?>
2025-07-17 15:09:01 +04:00
2025-04-10 14:39:27 +04:00
<!-- Section Tendances Hashtags -->
2025-07-22 11:54:05 +04:00
<aside class="tags-section-container" aria-labelledby="hashtags-heading">
<h2 id="hashtags-heading" class="section-title centered">Tendances</h2>
2025-07-17 15:09:01 +04:00
2025-04-10 14:39:27 +04:00
<div class="tags-section">
2025-07-17 15:09:01 +04:00
<?php
2025-04-10 14:39:27 +04:00
if (defined('POPULAR_TAGS') && !empty(POPULAR_TAGS)):
foreach (POPULAR_TAGS as $tag):
$encodedTag = urlencode('#' . $tag);
?>
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="tag">#<?php echo htmlspecialchars($tag); ?></a>
2025-07-17 15:09:01 +04:00
<?php
2025-04-10 14:39:27 +04:00
endforeach;
endif;
?>
</div>
2025-07-22 11:54:05 +04:00
</aside>
</section>
</main>
2025-04-09 17:07:10 +04:00
<?php include 'includes/footer.php'; ?>
2025-04-09 16:17:12 +04:00
<?php include 'includes/mobile-menu.php'; ?>
2026-01-15 19:38:55 +04:00
<script src="js/main.js?v=<?php echo filemtime('js/main.js'); ?>"></script>
2025-04-08 08:22:02 +04:00
<script src="js/mastodon-timeline.umd.js"></script>
2025-04-08 17:14:34 +04:00
<script src="js/mastodon-config.php"></script>
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
<!-- PWA Service Worker -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('Service Worker enregistré avec succès:', registration.scope);
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
// Écouter les mises à jour
registration.addEventListener('updatefound', function() {
const newWorker = registration.installing;
newWorker.addEventListener('statechange', function() {
if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
// Nouvelle version disponible
console.log('Nouvelle version disponible');
if (confirm('Une nouvelle version est disponible. Voulez-vous recharger la page ?')) {
window.location.reload();
}
}
});
});
})
.catch(function(err) {
console.log('Échec de l\'enregistrement du Service Worker:', err);
});
});
}
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
// Gestion de l'installation PWA
let deferredPrompt;
const installButton = document.getElementById('install-pwa');
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
window.addEventListener('beforeinstallprompt', function(e) {
e.preventDefault();
deferredPrompt = e;
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
// Afficher le bouton d'installation s'il existe
if (installButton) {
installButton.style.display = 'block';
installButton.addEventListener('click', function() {
deferredPrompt.prompt();
deferredPrompt.userChoice.then(function(choiceResult) {
if (choiceResult.outcome === 'accepted') {
console.log('PWA installée');
}
deferredPrompt = null;
installButton.style.display = 'none';
});
});
}
});
2025-07-24 08:36:46 +04:00
2025-07-17 20:10:05 +04:00
// Masquer le bouton après installation
window.addEventListener('appinstalled', function() {
console.log('PWA installée avec succès');
if (installButton) {
installButton.style.display = 'none';
}
});
</script>
2025-04-08 06:37:14 +04:00
</body>
2025-07-17 15:09:01 +04:00
</html>