711 lines
36 KiB
PHP
711 lines
36 KiB
PHP
<?php
|
|
// Inclure la configuration
|
|
require_once 'includes/config.php';
|
|
|
|
// 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;
|
|
}
|
|
|
|
// Inclure les fonctions de données structurées
|
|
require_once 'includes/structured-data.php';
|
|
// Appliquer les en-têtes de sécurité
|
|
setSecurityHeaders();
|
|
?>
|
|
<!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>kaubuntu.re - Plateforme Multimédia</title>
|
|
<link rel="stylesheet" href="css/styles.css?v=<?php echo filemtime('css/styles.css'); ?>">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
|
|
<link rel="stylesheet" href="css/mastodon-timeline.min.css?v=<?php echo filemtime('css/mastodon-timeline.min.css'); ?>">
|
|
<?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; ?>
|
|
|
|
<!-- 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="#FF0000">
|
|
|
|
<!-- 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">
|
|
|
|
<!-- 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">
|
|
|
|
<!-- 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'; ?>">
|
|
|
|
<!-- Données structurées JSON-LD pour le site web -->
|
|
<?php
|
|
$websiteJsonLd = generateWebSiteJsonLd();
|
|
outputJsonLd($websiteJsonLd);
|
|
|
|
// Générer les fils d'Ariane pour la page d'accueil
|
|
$breadcrumbs = [
|
|
['name' => 'Accueil', 'url' => getBaseUrl()]
|
|
];
|
|
$breadcrumbJsonLd = generateBreadcrumbJsonLd($breadcrumbs);
|
|
outputJsonLd($breadcrumbJsonLd);
|
|
?>
|
|
|
|
<!-- 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);
|
|
|
|
if (shouldUseDark) {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<!-- ------ 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 ------ -->
|
|
|
|
</head>
|
|
<body>
|
|
<?php include 'includes/sidebar.php'; ?>
|
|
<!-- Contenu principal -->
|
|
<main class="main-content" id="main-content" role="main">
|
|
<?php include 'includes/header.php'; ?>
|
|
<!-- Hero and Mastodon container -->
|
|
<div class="hero-mastodon-wrapper">
|
|
<!-- Hero Banner -->
|
|
<section class="hero" aria-labelledby="live-section-title">
|
|
<h2 id="live-section-title" class="sr-only">Diffusion en direct</h2>
|
|
<?php
|
|
// 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'];
|
|
|
|
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
|
|
?>
|
|
<div class="live-badge">
|
|
<?php if ($isLive): ?>
|
|
<i class="fas fa-circle"></i> <?php echo htmlspecialchars($badge); ?>
|
|
<?php else: ?>
|
|
<?php echo htmlspecialchars($badge); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="hero-video-container">
|
|
<iframe
|
|
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $video['id']; ?><?php echo $iframeParams; ?>"
|
|
frameborder="0"
|
|
allowfullscreen="allowfullscreen"
|
|
allow="autoplay; fullscreen"
|
|
title="<?php echo htmlspecialchars($video['title']); ?>"
|
|
aria-describedby="video-description">
|
|
</iframe>
|
|
<div id="video-description" class="sr-only">
|
|
Lecteur vidéo pour <?php echo htmlspecialchars($video['title']); ?> de <?php echo htmlspecialchars($video['channel']); ?>
|
|
</div>
|
|
</div>
|
|
<div class="hero-video-info">
|
|
<h2><?php echo htmlspecialchars($video['title']); ?></h2>
|
|
<div class="hero-channel-info">
|
|
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
|
|
<div class="channel-avatar-placeholder" role="img" aria-label="Avatar par défaut">
|
|
<i class="fas fa-user-circle" aria-hidden="true"></i>
|
|
</div>
|
|
<?php else: ?>
|
|
<img src="<?php echo $video['channelAvatar']; ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($video['channel']); ?>" class="channel-avatar">
|
|
<?php endif; ?>
|
|
<span class="channel-name"><?php echo htmlspecialchars($video['channel']); ?></span>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
} else {
|
|
// 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
|
|
// 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) . '\');';
|
|
}
|
|
?>
|
|
<div class="hero-next-live" style="<?php echo $bgImageStyle; ?>">
|
|
<?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)) {
|
|
$liveDate = new DateTime(NEXT_LIVE_DATE, new DateTimeZone(DEFAULT_TIMEZONE));
|
|
$dayFormatter = new IntlDateFormatter(
|
|
'fr_FR',
|
|
IntlDateFormatter::FULL,
|
|
IntlDateFormatter::NONE,
|
|
DEFAULT_TIMEZONE,
|
|
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,
|
|
DEFAULT_TIMEZONE
|
|
);
|
|
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
|
|
}
|
|
}
|
|
?>
|
|
</section>
|
|
|
|
<!-- 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>
|
|
</div>
|
|
|
|
<!-- 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>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Hashtags en ligne -->
|
|
<div class="tags-section">
|
|
<?php
|
|
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>
|
|
<?php
|
|
endforeach;
|
|
endif;
|
|
?>
|
|
</div>
|
|
|
|
<!-- Séparateur stylisé -->
|
|
<hr class="section-divider">
|
|
|
|
|
|
<!-- Section Shorts -->
|
|
<section class="video-section" aria-labelledby="shorts-heading">
|
|
<div class="section-header">
|
|
<div class="section-logo">
|
|
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
|
|
</div>
|
|
<h2 id="shorts-heading" class="section-title">Shorts</h2>
|
|
</div>
|
|
|
|
<div class="carousel">
|
|
<div class="carousel-container">
|
|
<?php
|
|
// Récupérer les shorts depuis l'API PeerTube
|
|
$shorts = getShorts();
|
|
|
|
// 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):
|
|
?>
|
|
<div class="carousel-item">
|
|
<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>
|
|
<div class="short-play-overlay" aria-hidden="true">
|
|
<i class="fas fa-play-circle"></i>
|
|
</div>
|
|
<div class="short-title-overlay">
|
|
<?php echo htmlspecialchars($video['title']); ?>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</div>
|
|
<?php
|
|
endforeach;
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<?php if (!empty($shorts) && count($shorts) > 1): ?>
|
|
<div class="carousel-controls">
|
|
<?php for ($i = 0; $i < count($shorts); $i++): ?>
|
|
<div class="carousel-dot <?php echo $i === 0 ? 'active' : ''; ?>"></div>
|
|
<?php endfor; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Séparateur stylisé -->
|
|
<hr class="section-divider">
|
|
|
|
<!-- Section Dernières vidéos -->
|
|
<section class="video-section" aria-labelledby="recent-videos-heading">
|
|
<header class="section-header">
|
|
<div class="section-logo">
|
|
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
|
|
</div>
|
|
<h2 id="recent-videos-heading" class="section-title">Dernières vidéos</h2>
|
|
</header>
|
|
|
|
<div class="video-grid">
|
|
<?php
|
|
// Récupérer les vidéos récentes depuis l'API PeerTube
|
|
$recentVideos = getRecentVideos();
|
|
|
|
// 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):
|
|
?>
|
|
<article class="video-card" data-video-id="<?php echo $video['id']; ?>">
|
|
<div class="video-thumbnail">
|
|
<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">
|
|
<i class="fas fa-play-circle"></i>
|
|
</div>
|
|
<div class="video-duration" aria-label="Durée: <?php echo formatDuration($video['duration']); ?>">
|
|
<?php echo formatDuration($video['duration']); ?>
|
|
</div>
|
|
</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.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>
|
|
<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>
|
|
</article>
|
|
<?php
|
|
endforeach;
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<button class="view-more">Voir plus</button>
|
|
</section>
|
|
|
|
<!-- Séparateur stylisé -->
|
|
<hr class="section-divider">
|
|
|
|
<!-- Section Tendances -->
|
|
<section class="video-section" aria-labelledby="trending-videos-heading">
|
|
<header class="section-header">
|
|
<div class="section-logo">
|
|
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
|
|
</div>
|
|
<h2 id="trending-videos-heading" class="section-title">Tendances</h2>
|
|
</header>
|
|
|
|
<div class="video-grid">
|
|
<?php
|
|
// Récupérer les vidéos tendances depuis l'API PeerTube
|
|
$trendingVideos = getTrendingVideos();
|
|
|
|
// 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):
|
|
?>
|
|
<article class="video-card" data-video-id="<?php echo $video['id']; ?>">
|
|
<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>
|
|
<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>
|
|
<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>
|
|
</article>
|
|
<?php
|
|
endforeach;
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<button class="view-more">Voir plus</button>
|
|
</section>
|
|
|
|
<!-- Séparateur stylisé -->
|
|
<hr class="section-divider">
|
|
|
|
<!-- Sections par catégorie -->
|
|
<?php
|
|
// Récupérer les catégories avec leurs vidéos
|
|
$displayCategories = getDisplayCategories();
|
|
|
|
// Afficher chaque catégorie qui a des vidéos
|
|
foreach ($displayCategories as $category):
|
|
if (!empty($category['videos'])):
|
|
?>
|
|
<!-- Section Catégorie: <?php echo $category['name']; ?> -->
|
|
<section class="video-section" data-category-id="<?php echo $category['id']; ?>" aria-labelledby="category-heading-<?php echo $category['id']; ?>">
|
|
<header class="section-header">
|
|
<div class="section-logo">
|
|
<img src="img/logo.png" alt="Logo kaubuntu.re" aria-hidden="true">
|
|
</div>
|
|
<h2 id="category-heading-<?php echo $category['id']; ?>" class="section-title"><?php echo htmlspecialchars($category['name']); ?></h2>
|
|
</header>
|
|
|
|
<div class="video-grid">
|
|
<?php foreach ($category['videos'] as $video): ?>
|
|
<article class="video-card" data-video-id="<?php echo $video['id']; ?>">
|
|
<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>
|
|
<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>
|
|
<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>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<button class="view-more">Voir plus</button>
|
|
</section>
|
|
|
|
<!-- Séparateur stylisé -->
|
|
<hr class="section-divider">
|
|
|
|
<?php
|
|
endif;
|
|
endforeach;
|
|
?>
|
|
|
|
<!-- Section Flexbox pour Informations et Tendances Hashtags -->
|
|
<section class="info-tags-container">
|
|
<?php if (defined('MOVEMENT_DESCRIPTION') && !empty(MOVEMENT_DESCRIPTION)): ?>
|
|
<!-- Section Informations -->
|
|
<article class="info-section">
|
|
<h2 class="info-header"><?php echo MOVEMENT_DESCRIPTION; ?></h2>
|
|
|
|
<?php if (defined('MOVEMENT_IMAGE') && !empty(MOVEMENT_IMAGE)): ?>
|
|
<figure class="movement-figure">
|
|
<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)): ?>
|
|
<figcaption class="movement-caption">
|
|
<?php echo MOVEMENT_CAPTION; ?>
|
|
</figcaption>
|
|
<?php endif; ?>
|
|
</figure>
|
|
<?php endif; ?>
|
|
</article>
|
|
<?php endif; ?>
|
|
|
|
<!-- Section Tendances Hashtags -->
|
|
<aside class="tags-section-container" aria-labelledby="hashtags-heading">
|
|
<h2 id="hashtags-heading" class="section-title centered">Tendances</h2>
|
|
|
|
<div class="tags-section">
|
|
<?php
|
|
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>
|
|
<?php
|
|
endforeach;
|
|
endif;
|
|
?>
|
|
</div>
|
|
</aside>
|
|
</section>
|
|
</main>
|
|
<?php include 'includes/footer.php'; ?>
|
|
<?php include 'includes/mobile-menu.php'; ?>
|
|
<script src="js/main.js"></script>
|
|
<script src="js/mastodon-timeline.umd.js"></script>
|
|
<script src="js/mastodon-config.php"></script>
|
|
|
|
<!-- 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);
|
|
|
|
// É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);
|
|
});
|
|
});
|
|
}
|
|
|
|
// Gestion de l'installation PWA
|
|
let deferredPrompt;
|
|
const installButton = document.getElementById('install-pwa');
|
|
|
|
window.addEventListener('beforeinstallprompt', function(e) {
|
|
e.preventDefault();
|
|
deferredPrompt = e;
|
|
|
|
// 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';
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|
|
// 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>
|
|
</body>
|
|
</html>
|