2025-04-08 06:37:14 +04:00
|
|
|
<?php
|
2025-04-08 09:34:19 +04:00
|
|
|
// Inclure la configuration
|
|
|
|
|
require_once 'includes/config.php';
|
2025-04-10 08:49:24 +04:00
|
|
|
// Inclure le convertisseur Markdown
|
|
|
|
|
require_once 'includes/lib/markdown.php';
|
2025-04-08 06:37:14 +04:00
|
|
|
|
2025-07-17 09:58:19 +04:00
|
|
|
// Appliquer les en-têtes de sécurité
|
|
|
|
|
setSecurityHeaders();
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
// Récupérer l'ID de la vidéo depuis l'URL
|
|
|
|
|
$videoId = isset($_GET['id']) ? $_GET['id'] : '';
|
2025-04-08 06:37:14 +04:00
|
|
|
|
2025-07-17 09:58:19 +04:00
|
|
|
// Valider l'ID de la vidéo
|
|
|
|
|
$videoId = validateVideoId($videoId);
|
|
|
|
|
if ($videoId === false) {
|
|
|
|
|
// Rediriger vers la page d'accueil si l'ID est invalide
|
2025-04-08 09:34:19 +04:00
|
|
|
header('Location: index.php');
|
|
|
|
|
exit;
|
2025-04-08 06:51:33 +04:00
|
|
|
}
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
// Récupérer les détails de la vidéo via l'API PeerTube
|
|
|
|
|
$videoData = callPeerTubeApi('videos/' . $videoId);
|
|
|
|
|
|
|
|
|
|
// Vérifier si la vidéo existe
|
|
|
|
|
if (empty($videoData) || isset($videoData['error'])) {
|
|
|
|
|
// Gérer l'erreur : vidéo non trouvée
|
|
|
|
|
$videoNotFound = true;
|
|
|
|
|
} else {
|
|
|
|
|
// Formater les données de la vidéo
|
|
|
|
|
$video = [
|
|
|
|
|
'id' => $videoData['uuid'],
|
|
|
|
|
'title' => $videoData['name'],
|
|
|
|
|
'url' => PEERTUBE_URL . '/videos/embed/' . $videoData['uuid'],
|
|
|
|
|
'description' => $videoData['description'] ?? '',
|
2025-04-10 08:28:09 +04:00
|
|
|
'truncatedDescription' => $videoData['truncatedDescription'] ?? '',
|
2025-04-08 09:34:19 +04:00
|
|
|
'channel' => $videoData['channel']['displayName'],
|
|
|
|
|
'channelId' => $videoData['channel']['id'],
|
|
|
|
|
'channelHandle' => $videoData['channel']['name'],
|
|
|
|
|
'views' => $videoData['views'],
|
|
|
|
|
'likes' => $videoData['likes'],
|
|
|
|
|
'date' => $videoData['publishedAt'],
|
2025-04-10 08:10:06 +04:00
|
|
|
'tags' => $videoData['tags'] ?? [],
|
|
|
|
|
'licence' => $videoData['licence'] ?? null
|
2025-04-08 09:34:19 +04:00
|
|
|
];
|
2025-04-08 06:51:33 +04:00
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
// Récupérer l'image de la chaîne
|
|
|
|
|
$channelAvatar = 'img/default-avatar.jpg';
|
2025-04-09 09:03:46 +04:00
|
|
|
if (isset($videoData['channel']['avatars'][0]['path'])) {
|
|
|
|
|
$channelAvatar = PEERTUBE_URL . $videoData['channel']['avatars'][0]['path'];
|
2025-04-08 06:37:14 +04:00
|
|
|
}
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
// Récupérer les vidéos suggérées (de la même chaîne)
|
|
|
|
|
$channelVideos = callPeerTubeApi('video-channels/' . $video['channelHandle'] . '/videos', [
|
|
|
|
|
'count' => 5,
|
|
|
|
|
'isLocal' => true
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$suggestedVideos = [];
|
|
|
|
|
|
|
|
|
|
if (!empty($channelVideos['data'])) {
|
|
|
|
|
foreach ($channelVideos['data'] as $suggVid) {
|
|
|
|
|
// Ne pas inclure la vidéo courante dans les suggestions
|
|
|
|
|
if ($suggVid['uuid'] !== $videoId) {
|
2025-04-09 09:03:46 +04:00
|
|
|
// Récupérer l'avatar de la chaîne
|
|
|
|
|
$suggAvatar = isset($suggVid['channel']['avatars'][0]['path'])
|
|
|
|
|
? PEERTUBE_URL . $suggVid['channel']['avatars'][0]['path']
|
|
|
|
|
: '';
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
$suggestedVideos[] = [
|
|
|
|
|
'id' => $suggVid['uuid'],
|
|
|
|
|
'title' => $suggVid['name'],
|
|
|
|
|
'thumbnail' => PEERTUBE_URL . $suggVid['thumbnailPath'],
|
|
|
|
|
'views' => $suggVid['views'],
|
|
|
|
|
'date' => $suggVid['publishedAt'],
|
|
|
|
|
'duration' => $suggVid['duration'],
|
2025-04-09 09:03:46 +04:00
|
|
|
'channel' => $suggVid['channel']['displayName'],
|
|
|
|
|
'channelAvatar' => $suggAvatar
|
2025-04-08 09:34:19 +04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Si pas assez de vidéos de la même chaîne, ajouter des vidéos tendances
|
|
|
|
|
if (count($suggestedVideos) < 5) {
|
|
|
|
|
$trendingVideos = getTrendingVideos(10);
|
|
|
|
|
|
|
|
|
|
foreach ($trendingVideos as $trendVid) {
|
|
|
|
|
if ($trendVid['id'] !== $videoId && count($suggestedVideos) < 5) {
|
|
|
|
|
// Vérifier que cette vidéo n'est pas déjà dans les suggestions
|
|
|
|
|
$found = false;
|
|
|
|
|
foreach ($suggestedVideos as $sv) {
|
|
|
|
|
if ($sv['id'] === $trendVid['id']) {
|
|
|
|
|
$found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$found) {
|
|
|
|
|
$suggestedVideos[] = $trendVid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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:19 +04:00
|
|
|
<title><?php echo !empty($video['title']) ? htmlspecialchars($video['title']) . ' - ' : ''; ?>kaubuntu.re</title>
|
2025-04-08 06:37:14 +04:00
|
|
|
<link rel="stylesheet" href="css/styles.css">
|
|
|
|
|
<link rel="stylesheet" href="css/video-page.css">
|
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
2025-04-09 14:28:41 +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-09 14:28:41 +04:00
|
|
|
<!-- Meta tags pour le partage sur les réseaux sociaux -->
|
2025-04-11 06:27:03 +04:00
|
|
|
<meta property="og:title" content="<?php echo !empty($video['title']) ? htmlspecialchars($video['title']) : 'Vidéo'; ?> - kaubuntu.re">
|
|
|
|
|
<meta property="og:description" content="<?php echo !empty($video['description']) ? htmlspecialchars(substr(strip_tags($video['description']), 0, 200)) . '...' : 'Regardez cette vidéo sur kaubuntu.re'; ?>">
|
2025-04-09 14:28:41 +04:00
|
|
|
<?php if (isset($videoData['thumbnailPath'])): ?>
|
|
|
|
|
<meta property="og:image" content="<?php echo PEERTUBE_URL . $videoData['thumbnailPath']; ?>">
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<meta property="og:url" content="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>">
|
|
|
|
|
<meta property="og:type" content="video.other">
|
2025-04-11 06:27:03 +04:00
|
|
|
<meta property="og:site_name" content="kaubuntu.re">
|
2025-04-09 14:28:41 +04:00
|
|
|
|
|
|
|
|
<!-- Meta tags pour Twitter -->
|
|
|
|
|
<meta name="twitter:card" content="summary_large_image">
|
2025-04-11 06:27:03 +04:00
|
|
|
<meta name="twitter:title" content="<?php echo !empty($video['title']) ? htmlspecialchars($video['title']) : 'Vidéo'; ?> - kaubuntu.re">
|
|
|
|
|
<meta name="twitter:description" content="<?php echo !empty($video['description']) ? htmlspecialchars(substr(strip_tags($video['description']), 0, 200)) . '...' : 'Regardez cette vidéo sur kaubuntu.re'; ?>">
|
2025-04-09 14:28:41 +04:00
|
|
|
<?php if (isset($videoData['thumbnailPath'])): ?>
|
|
|
|
|
<meta name="twitter:image" content="<?php echo PEERTUBE_URL . $videoData['thumbnailPath']; ?>">
|
|
|
|
|
<?php endif; ?>
|
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 -->
|
|
|
|
|
<div class="main-content">
|
2025-04-09 16:04:50 +04:00
|
|
|
<?php include 'includes/header.php'; ?>
|
2025-04-08 06:51:33 +04:00
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
<?php if (isset($videoNotFound)): ?>
|
|
|
|
|
<!-- Message d'erreur si la vidéo n'existe pas -->
|
|
|
|
|
<div class="error-message">
|
|
|
|
|
<i class="fas fa-exclamation-triangle"></i>
|
|
|
|
|
<h2>Vidéo non trouvée</h2>
|
|
|
|
|
<p>La vidéo que vous recherchez n'existe pas ou a été supprimée.</p>
|
|
|
|
|
<a href="index.php" class="btn-primary">Retour à l'accueil</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php else: ?>
|
2025-04-08 06:51:33 +04:00
|
|
|
<!-- Section vidéo -->
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="video-page">
|
|
|
|
|
<div class="video-player-container">
|
|
|
|
|
<div class="video-player">
|
2025-07-17 09:58:19 +04:00
|
|
|
<iframe src="<?php echo htmlspecialchars($video['url']); ?>?warningTitle='0'" frameborder="0" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" title="<?php echo htmlspecialchars($video['title']); ?>"></iframe>
|
2025-04-08 09:34:19 +04:00
|
|
|
</div>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="video-content">
|
|
|
|
|
<div class="video-primary-info">
|
2025-07-17 09:58:19 +04:00
|
|
|
<h1 class="video-title"><?php echo htmlspecialchars($video['title']); ?></h1>
|
2025-04-08 06:37:14 +04:00
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="video-info">
|
|
|
|
|
<div class="video-metadata">
|
2025-04-08 09:59:15 +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 09:34:19 +04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="video-actions">
|
2025-04-09 13:04:17 +04:00
|
|
|
<button disabled class="action-button disabled-button" title="Fonctionnalité disponible uniquement sur <?php echo PEERTUBE_DISPLAY_NAME; ?>">
|
2025-04-08 09:34:19 +04:00
|
|
|
<i class="fas fa-thumbs-up"></i>
|
|
|
|
|
<span><?php echo formatViewCount($video['likes']); ?></span>
|
|
|
|
|
</button>
|
2025-04-09 14:29:01 +04:00
|
|
|
<button class="action-button" id="share-btn">
|
2025-04-08 09:34:19 +04:00
|
|
|
<i class="fas fa-share"></i>
|
|
|
|
|
<span>Partager</span>
|
|
|
|
|
</button>
|
2025-04-09 13:46:25 +04:00
|
|
|
<button class="action-button" id="download-btn">
|
2025-04-08 09:34:19 +04:00
|
|
|
<i class="fas fa-download"></i>
|
|
|
|
|
<span>Télécharger</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-10 08:10:06 +04:00
|
|
|
|
|
|
|
|
<?php if (!empty($video['licence'])): ?>
|
|
|
|
|
<div class="video-licence">
|
|
|
|
|
<h4 class="licence-title">Licence</h4>
|
|
|
|
|
<?php
|
|
|
|
|
$licenceLabels = [
|
2025-04-10 08:21:45 +04:00
|
|
|
1 => "CC BY (Attribution)",
|
|
|
|
|
2 => "CC BY-SA (Attribution - Partage dans les Mêmes Conditions)",
|
|
|
|
|
3 => "CC BY-ND (Attribution - Pas de Modification)",
|
|
|
|
|
4 => "CC BY-NC (Attribution - Pas d'Utilisation Commerciale)",
|
|
|
|
|
5 => "CC BY-NC-SA (Attribution - Pas d'Utilisation Commerciale - Partage dans les Mêmes Conditions)",
|
|
|
|
|
6 => "CC BY-NC-ND (Attribution - Pas d'Utilisation Commerciale - Pas de Modification)",
|
|
|
|
|
7 => "CC0 (Domaine Public)"
|
2025-04-10 08:10:06 +04:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$licenceUrls = [
|
|
|
|
|
1 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by.png",
|
|
|
|
|
2 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-sa.png",
|
|
|
|
|
3 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nd.png",
|
|
|
|
|
4 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc.png",
|
|
|
|
|
5 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png",
|
|
|
|
|
6 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-nd.png",
|
|
|
|
|
7 => "https://mirrors.creativecommons.org/presskit/buttons/88x31/png/cc-zero.png"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$licenceInfoUrls = [
|
|
|
|
|
1 => "https://creativecommons.org/licenses/by/4.0/deed.fr",
|
|
|
|
|
2 => "https://creativecommons.org/licenses/by-sa/4.0/deed.fr",
|
|
|
|
|
3 => "https://creativecommons.org/licenses/by-nd/4.0/deed.fr",
|
|
|
|
|
4 => "https://creativecommons.org/licenses/by-nc/4.0/deed.fr",
|
|
|
|
|
5 => "https://creativecommons.org/licenses/by-nc-sa/4.0/deed.fr",
|
|
|
|
|
6 => "https://creativecommons.org/licenses/by-nc-nd/4.0/deed.fr",
|
|
|
|
|
7 => "https://creativecommons.org/publicdomain/zero/1.0/deed.fr"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$licenceId = $video['licence']['id'];
|
|
|
|
|
$licenceLabel = isset($licenceLabels[$licenceId]) ? $licenceLabels[$licenceId] : "Licence inconnue";
|
|
|
|
|
$licenceUrl = isset($licenceUrls[$licenceId]) ? $licenceUrls[$licenceId] : "";
|
|
|
|
|
$licenceInfoUrl = isset($licenceInfoUrls[$licenceId]) ? $licenceInfoUrls[$licenceId] : "";
|
|
|
|
|
?>
|
|
|
|
|
<div class="licence-info">
|
|
|
|
|
<?php if (!empty($licenceUrl) && !empty($licenceInfoUrl)): ?>
|
|
|
|
|
<a href="<?php echo $licenceInfoUrl; ?>" target="_blank" rel="noopener noreferrer" class="licence-link" title="En savoir plus sur cette licence">
|
|
|
|
|
<img src="<?php echo $licenceUrl; ?>" alt="<?php echo $licenceLabel; ?>" class="licence-logo">
|
|
|
|
|
<span class="licence-label"><?php echo $licenceLabel; ?></span>
|
|
|
|
|
</a>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<?php if (!empty($licenceUrl)): ?>
|
|
|
|
|
<img src="<?php echo $licenceUrl; ?>" alt="<?php echo $licenceLabel; ?>" class="licence-logo">
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<span class="licence-label"><?php echo $licenceLabel; ?></span>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="video-secondary-info">
|
|
|
|
|
<div class="channel-info">
|
2025-04-10 11:48:56 +04:00
|
|
|
<?php
|
|
|
|
|
$channelUrl = PEERTUBE_URL . '/c/' . $video['channelHandle'];
|
|
|
|
|
?>
|
2025-04-09 09:03:46 +04:00
|
|
|
<?php if (strpos($channelAvatar, 'default-avatar') !== false || empty($channelAvatar)): ?>
|
2025-04-10 11:48:56 +04:00
|
|
|
<a href="<?php echo $channelUrl; ?>" target="_blank" rel="noopener noreferrer" class="channel-avatar-link">
|
|
|
|
|
<div class="channel-avatar-placeholder">
|
|
|
|
|
<i class="fas fa-user-circle"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
2025-04-09 09:03:46 +04:00
|
|
|
<?php else: ?>
|
2025-04-10 11:48:56 +04:00
|
|
|
<a href="<?php echo $channelUrl; ?>" target="_blank" rel="noopener noreferrer" class="channel-avatar-link">
|
|
|
|
|
<div class="channel-avatar">
|
|
|
|
|
<img src="<?php echo $channelAvatar; ?>" alt="<?php echo $video['channel']; ?>">
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
2025-04-09 09:03:46 +04:00
|
|
|
<?php endif; ?>
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="channel-details">
|
2025-04-10 11:48:56 +04:00
|
|
|
<a href="<?php echo $channelUrl; ?>" target="_blank" rel="noopener noreferrer" class="channel-name-link">
|
|
|
|
|
<h3 class="channel-name"><?php echo $video['channel']; ?></h3>
|
|
|
|
|
</a>
|
2025-04-08 09:34:19 +04:00
|
|
|
</div>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-08 09:34:19 +04:00
|
|
|
|
|
|
|
|
<div class="video-description">
|
2025-04-10 08:28:09 +04:00
|
|
|
<?php
|
|
|
|
|
// Vérifier si on a une description tronquée et si la description complète est plus longue
|
|
|
|
|
$hasTruncatedDesc = !empty($video['truncatedDescription']) &&
|
|
|
|
|
strlen($video['truncatedDescription']) < strlen($video['description']);
|
|
|
|
|
|
|
|
|
|
if ($hasTruncatedDesc):
|
|
|
|
|
?>
|
|
|
|
|
<div class="truncated-description">
|
2025-04-10 08:49:24 +04:00
|
|
|
<?php echo markdown_to_html($video['truncatedDescription']); ?>
|
2025-04-10 08:28:09 +04:00
|
|
|
<button class="show-more-btn">
|
|
|
|
|
<span>Voir plus</span>
|
|
|
|
|
<i class="fas fa-chevron-down"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="full-description" style="display: none;">
|
2025-04-10 08:49:24 +04:00
|
|
|
<?php echo markdown_to_html($video['description']); ?>
|
2025-04-10 08:28:09 +04:00
|
|
|
<button class="show-less-btn">
|
|
|
|
|
<span>Voir moins</span>
|
|
|
|
|
<i class="fas fa-chevron-up"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
2025-04-10 08:49:24 +04:00
|
|
|
<?php echo markdown_to_html($video['description']); ?>
|
2025-04-10 08:28:09 +04:00
|
|
|
<?php endif; ?>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-08 09:34:19 +04:00
|
|
|
|
|
|
|
|
<?php if (!empty($video['tags'])): ?>
|
|
|
|
|
<div class="video-tags">
|
|
|
|
|
<?php foreach ($video['tags'] as $tag): ?>
|
2025-04-10 13:10:24 +04:00
|
|
|
<a href="recherche.php?q=<?php echo urlencode('#' . $tag); ?>" class="tag">#<?php echo htmlspecialchars($tag); ?></a>
|
2025-04-08 09:34:19 +04:00
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
2025-04-08 06:51:33 +04:00
|
|
|
</div>
|
2025-04-08 09:59:15 +04:00
|
|
|
|
2025-04-09 12:10:26 +04:00
|
|
|
<!-- Commentaires -->
|
2025-04-08 09:59:15 +04:00
|
|
|
<div class="comments-section">
|
2025-04-09 12:10:26 +04:00
|
|
|
<div class="section-header">
|
|
|
|
|
<div class="section-title-wrapper">
|
|
|
|
|
<h2 class="section-title">Commentaires</h2>
|
2025-04-08 09:59:15 +04:00
|
|
|
</div>
|
2025-04-09 12:10:26 +04:00
|
|
|
<a href="<?php echo PEERTUBE_URL; ?>/videos/watch/<?php echo $videoData['uuid']; ?>" target="_blank" class="view-on-peertube">
|
2025-04-09 12:27:46 +04:00
|
|
|
<i class="fas fa-external-link-alt"></i> Voir sur <?php echo PEERTUBE_DISPLAY_NAME; ?>
|
2025-04-09 12:10:26 +04:00
|
|
|
</a>
|
2025-04-08 09:59:15 +04:00
|
|
|
</div>
|
|
|
|
|
<div class="comments-list">
|
2025-04-09 13:03:23 +04:00
|
|
|
<?php
|
|
|
|
|
$comments = getVideoComments($videoData['uuid']);
|
|
|
|
|
if (!empty($comments)):
|
|
|
|
|
foreach ($comments as $comment):
|
|
|
|
|
?>
|
|
|
|
|
<div class="comment">
|
|
|
|
|
<div class="comment-avatar">
|
|
|
|
|
<?php if (isset($comment['account']['avatar']) && !empty($comment['account']['avatar']['path'])): ?>
|
|
|
|
|
<img src="<?php echo PEERTUBE_URL . $comment['account']['avatar']['path']; ?>" alt="<?php echo htmlspecialchars($comment['account']['displayName']); ?>">
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="channel-avatar-placeholder mini">
|
|
|
|
|
<i class="fas fa-user-circle"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="comment-content">
|
|
|
|
|
<div class="comment-header">
|
|
|
|
|
<span class="comment-author"><?php echo htmlspecialchars($comment['account']['displayName']); ?></span>
|
|
|
|
|
<span class="comment-date"><?php echo formatDate($comment['createdAt']); ?></span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="comment-text"><?php echo nl2br(htmlspecialchars($comment['text'])); ?></div>
|
|
|
|
|
|
|
|
|
|
<?php if (isset($comment['totalReplies']) && $comment['totalReplies'] > 0): ?>
|
|
|
|
|
<div class="comment-replies-toggle">
|
|
|
|
|
<a href="<?php echo PEERTUBE_URL; ?>/videos/watch/<?php echo $videoData['uuid']; ?>" target="_blank" class="show-replies">
|
|
|
|
|
<i class="fas fa-reply"></i> Voir les <?php echo $comment['totalReplies']; ?> réponse<?php echo $comment['totalReplies'] > 1 ? 's' : ''; ?>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
endforeach;
|
|
|
|
|
?>
|
|
|
|
|
<div class="comments-info">
|
|
|
|
|
<i class="fas fa-info-circle"></i>
|
|
|
|
|
<p>Les commentaires sont visibles mais l'ajout de commentaires et les threads de réponses sont désactivés sur cette page.</p>
|
|
|
|
|
<p>Pour ajouter des commentaires ou voir les réponses, veuillez vous rendre sur <a href="<?php echo PEERTUBE_URL; ?>/videos/watch/<?php echo $videoData['uuid']; ?>" target="_blank" class="show-replies"> <?php echo PEERTUBE_DISPLAY_NAME; ?></a>.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
2025-04-09 12:10:26 +04:00
|
|
|
<div class="no-comments">
|
|
|
|
|
<i class="fas fa-comments"></i>
|
2025-04-09 13:03:23 +04:00
|
|
|
<p>Aucun commentaire pour cette vidéo.</p>
|
|
|
|
|
<p>Pour ajouter des commentaires, veuillez vous rendre sur <a href="<?php echo PEERTUBE_URL; ?>/videos/watch/<?php echo $videoData['uuid']; ?>" target="_blank" class="show-replies"> <?php echo PEERTUBE_DISPLAY_NAME; ?></a>.</p>
|
2025-04-09 12:10:26 +04:00
|
|
|
</div>
|
2025-04-09 13:03:23 +04:00
|
|
|
<?php endif; ?>
|
2025-04-08 09:59:15 +04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-04-08 06:51:33 +04:00
|
|
|
</div>
|
|
|
|
|
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="video-suggestions">
|
|
|
|
|
<h3>Vidéos suggérées</h3>
|
|
|
|
|
|
|
|
|
|
<?php if (!empty($suggestedVideos)): ?>
|
|
|
|
|
<div class="suggestion-list">
|
|
|
|
|
<?php foreach ($suggestedVideos as $suggestedVideo): ?>
|
|
|
|
|
<a href="video.php?id=<?php echo $suggestedVideo['id']; ?>" class="suggested-video">
|
|
|
|
|
<div class="suggested-video-thumbnail">
|
|
|
|
|
<img src="<?php echo $suggestedVideo['thumbnail']; ?>" alt="<?php echo $suggestedVideo['title']; ?>">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="suggested-video-info">
|
2025-04-08 09:41:02 +04:00
|
|
|
<span class="suggested-video-duration"><?php echo formatDuration($suggestedVideo['duration']); ?></span>
|
2025-04-08 09:34:19 +04:00
|
|
|
<h4 class="suggested-video-title"><?php echo $suggestedVideo['title']; ?></h4>
|
2025-04-09 09:03:46 +04:00
|
|
|
<div class="suggested-video-channel">
|
|
|
|
|
<?php
|
|
|
|
|
// Vérifier si un avatar de chaîne est disponible pour la vidéo suggérée
|
|
|
|
|
$suggestedAvatar = isset($suggestedVideo['channelAvatar']) ? $suggestedVideo['channelAvatar'] : '';
|
|
|
|
|
|
|
|
|
|
if (empty($suggestedAvatar) || strpos($suggestedAvatar, 'default-avatar') !== false):
|
|
|
|
|
?>
|
|
|
|
|
<div class="channel-avatar-placeholder mini">
|
|
|
|
|
<i class="fas fa-user-circle"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<img src="<?php echo $suggestedAvatar; ?>" alt="<?php echo $suggestedVideo['channel']; ?>" class="channel-avatar mini">
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<span class="channel-name"><?php echo $suggestedVideo['channel']; ?></span>
|
|
|
|
|
</div>
|
2025-04-08 09:34:19 +04:00
|
|
|
<div class="suggested-video-metadata">
|
|
|
|
|
<span class="suggested-video-views"><?php echo formatViewCount($suggestedVideo['views']); ?> vues</span>
|
|
|
|
|
<span class="suggested-video-date"><?php echo formatDate($suggestedVideo['date']); ?></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<?php endforeach; ?>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
2025-04-08 09:34:19 +04:00
|
|
|
<?php else: ?>
|
|
|
|
|
<p>Aucune vidéo suggérée disponible</p>
|
|
|
|
|
<?php endif; ?>
|
2025-04-08 06:51:33 +04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-04-08 09:34:19 +04:00
|
|
|
<?php endif; ?>
|
2025-04-08 06:37:14 +04:00
|
|
|
</div>
|
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'; ?>
|
2025-04-08 06:37:14 +04:00
|
|
|
|
2025-04-09 13:46:25 +04:00
|
|
|
<!-- Modal de téléchargement -->
|
|
|
|
|
<div id="download-modal" class="modal">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h3>Télécharger la vidéo</h3>
|
|
|
|
|
<button class="modal-close"><i class="fas fa-times"></i></button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<p>Choisissez la résolution souhaitée :</p>
|
|
|
|
|
<div class="download-options">
|
|
|
|
|
<?php
|
|
|
|
|
$downloadOptions = getVideoDownloadOptions($videoData['uuid']);
|
|
|
|
|
if (!empty($downloadOptions)):
|
|
|
|
|
foreach ($downloadOptions as $option):
|
|
|
|
|
?>
|
|
|
|
|
<a href="<?php echo $option['url']; ?>" class="download-option" download>
|
|
|
|
|
<div class="download-resolution">
|
|
|
|
|
<i class="fas fa-film"></i>
|
|
|
|
|
<span><?php echo $option['resolution']; ?></span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="download-info">
|
|
|
|
|
<span class="download-size"><?php echo $option['size']; ?></span>
|
|
|
|
|
<i class="fas fa-download"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<?php
|
|
|
|
|
endforeach;
|
|
|
|
|
else:
|
|
|
|
|
?>
|
|
|
|
|
<p class="no-download-options">Aucune option de téléchargement disponible pour cette vidéo.</p>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<p class="download-info-text">Le téléchargement démarrera automatiquement après avoir cliqué sur une résolution.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-04-09 14:29:01 +04:00
|
|
|
<!-- Modal de partage -->
|
|
|
|
|
<div id="share-modal" class="modal">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h3>Partager la vidéo</h3>
|
|
|
|
|
<button class="modal-close"><i class="fas fa-times"></i></button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<div class="share-link-container">
|
|
|
|
|
<p>Lien de la vidéo :</p>
|
|
|
|
|
<div class="share-link-box">
|
2025-07-17 09:58:19 +04:00
|
|
|
<input type="text" id="share-link" value="<?php echo htmlspecialchars((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>" readonly>
|
2025-04-09 14:29:01 +04:00
|
|
|
<button id="copy-link-btn" class="copy-btn" title="Copier le lien">
|
|
|
|
|
<i class="fas fa-copy"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<p class="share-platforms-title">Partager sur :</p>
|
|
|
|
|
<div class="share-platforms">
|
2025-07-17 09:58:19 +04:00
|
|
|
<a href="mailto:?subject=<?php echo urlencode(htmlspecialchars($video['title'])); ?>&body=<?php echo urlencode(htmlspecialchars($video['title']) . ' - ' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>" class="share-platform-btn" title="Partager par e-mail">
|
2025-04-09 14:29:01 +04:00
|
|
|
<i class="fas fa-envelope"></i>
|
|
|
|
|
<span>E-mail</span>
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>" target="_blank" class="share-platform-btn" title="Partager sur Facebook">
|
|
|
|
|
<i class="fab fa-facebook-f"></i>
|
|
|
|
|
<span>Facebook</span>
|
|
|
|
|
</a>
|
|
|
|
|
|
2025-07-17 09:58:19 +04:00
|
|
|
<a href="https://twitter.com/intent/tweet?text=<?php echo urlencode(htmlspecialchars($video['title'])); ?>&url=<?php echo urlencode((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>" target="_blank" class="share-platform-btn" title="Partager sur X/Twitter">
|
2025-04-09 14:29:01 +04:00
|
|
|
<i class="fab fa-x-twitter"></i>
|
|
|
|
|
<span>X</span>
|
|
|
|
|
</a>
|
|
|
|
|
|
2025-07-17 09:58:19 +04:00
|
|
|
<a href="https://wa.me/?text=<?php echo urlencode(htmlspecialchars($video['title']) . ' - ' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>" target="_blank" class="share-platform-btn" title="Partager sur WhatsApp">
|
2025-04-09 14:29:01 +04:00
|
|
|
<i class="fab fa-whatsapp"></i>
|
|
|
|
|
<span>WhatsApp</span>
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<a href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo urlencode((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>" target="_blank" class="share-platform-btn" title="Partager sur LinkedIn">
|
|
|
|
|
<i class="fab fa-linkedin-in"></i>
|
|
|
|
|
<span>LinkedIn</span>
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<a href="https://t.me/share/url?url=<?php echo urlencode((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>&text=<?php echo urlencode($video['title']); ?>" target="_blank" class="share-platform-btn" title="Partager sur Telegram">
|
|
|
|
|
<i class="fab fa-telegram-plane"></i>
|
|
|
|
|
<span>Telegram</span>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="share-embed">
|
|
|
|
|
<p>Intégrer la vidéo :</p>
|
|
|
|
|
<div class="share-link-box">
|
|
|
|
|
<input type="text" id="embed-code" value='<iframe width="560" height="315" src="<?php echo $video['url']; ?>" frameborder="0" allowfullscreen></iframe>' readonly>
|
|
|
|
|
<button id="copy-embed-btn" class="copy-btn" title="Copier le code d'intégration">
|
|
|
|
|
<i class="fas fa-copy"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
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-09 13:46:25 +04:00
|
|
|
<script>
|
|
|
|
|
// Script pour la modal de téléchargement
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
2025-04-10 08:28:09 +04:00
|
|
|
// Gestion de la description tronquée
|
|
|
|
|
const showMoreBtn = document.querySelector('.show-more-btn');
|
|
|
|
|
const showLessBtn = document.querySelector('.show-less-btn');
|
|
|
|
|
|
|
|
|
|
if (showMoreBtn) {
|
|
|
|
|
showMoreBtn.addEventListener('click', function() {
|
|
|
|
|
document.querySelector('.truncated-description').style.display = 'none';
|
|
|
|
|
document.querySelector('.full-description').style.display = 'block';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (showLessBtn) {
|
|
|
|
|
showLessBtn.addEventListener('click', function() {
|
|
|
|
|
document.querySelector('.full-description').style.display = 'none';
|
|
|
|
|
document.querySelector('.truncated-description').style.display = 'block';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-09 14:29:01 +04:00
|
|
|
const downloadModal = document.getElementById('download-modal');
|
2025-04-09 13:46:25 +04:00
|
|
|
const downloadBtn = document.getElementById('download-btn');
|
2025-04-09 14:29:01 +04:00
|
|
|
const downloadCloseBtn = downloadModal.querySelector('.modal-close');
|
2025-04-09 13:46:25 +04:00
|
|
|
|
|
|
|
|
// Ouvrir la modal
|
|
|
|
|
downloadBtn.addEventListener('click', function() {
|
2025-04-09 14:29:01 +04:00
|
|
|
downloadModal.classList.add('show');
|
2025-04-09 13:46:25 +04:00
|
|
|
document.body.style.overflow = 'hidden'; // Empêcher le défilement
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Fermer la modal
|
2025-04-09 14:29:01 +04:00
|
|
|
downloadCloseBtn.addEventListener('click', function() {
|
|
|
|
|
downloadModal.classList.remove('show');
|
2025-04-09 13:46:25 +04:00
|
|
|
document.body.style.overflow = ''; // Réactiver le défilement
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Fermer la modal si on clique en dehors
|
|
|
|
|
window.addEventListener('click', function(event) {
|
2025-04-09 14:29:01 +04:00
|
|
|
if (event.target === downloadModal) {
|
|
|
|
|
downloadModal.classList.remove('show');
|
|
|
|
|
document.body.style.overflow = '';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Script pour la modal de partage
|
|
|
|
|
const shareModal = document.getElementById('share-modal');
|
|
|
|
|
const shareBtn = document.getElementById('share-btn');
|
|
|
|
|
const shareCloseBtn = shareModal.querySelector('.modal-close');
|
|
|
|
|
const copyLinkBtn = document.getElementById('copy-link-btn');
|
|
|
|
|
const copyEmbedBtn = document.getElementById('copy-embed-btn');
|
|
|
|
|
const shareLink = document.getElementById('share-link');
|
|
|
|
|
const embedCode = document.getElementById('embed-code');
|
|
|
|
|
|
|
|
|
|
// Ouvrir la modal de partage
|
|
|
|
|
shareBtn.addEventListener('click', function() {
|
|
|
|
|
shareModal.classList.add('show');
|
|
|
|
|
document.body.style.overflow = 'hidden';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Fermer la modal de partage
|
|
|
|
|
shareCloseBtn.addEventListener('click', function() {
|
|
|
|
|
shareModal.classList.remove('show');
|
|
|
|
|
document.body.style.overflow = '';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Fermer la modal si on clique en dehors
|
|
|
|
|
window.addEventListener('click', function(event) {
|
|
|
|
|
if (event.target === shareModal) {
|
|
|
|
|
shareModal.classList.remove('show');
|
2025-04-09 13:46:25 +04:00
|
|
|
document.body.style.overflow = '';
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-04-09 14:29:01 +04:00
|
|
|
|
|
|
|
|
// Copier le lien
|
|
|
|
|
copyLinkBtn.addEventListener('click', function() {
|
|
|
|
|
shareLink.select();
|
|
|
|
|
document.execCommand('copy');
|
|
|
|
|
showCopySuccess(copyLinkBtn);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Copier le code d'intégration
|
|
|
|
|
copyEmbedBtn.addEventListener('click', function() {
|
|
|
|
|
embedCode.select();
|
|
|
|
|
document.execCommand('copy');
|
|
|
|
|
showCopySuccess(copyEmbedBtn);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Afficher un message de succès après la copie
|
|
|
|
|
function showCopySuccess(button) {
|
|
|
|
|
const originalIcon = button.innerHTML;
|
|
|
|
|
button.innerHTML = '<i class="fas fa-check"></i>';
|
|
|
|
|
button.classList.add('copied');
|
|
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
button.innerHTML = originalIcon;
|
|
|
|
|
button.classList.remove('copied');
|
|
|
|
|
}, 2000);
|
|
|
|
|
}
|
2025-04-09 13:46:25 +04:00
|
|
|
});
|
|
|
|
|
</script>
|
2025-04-08 06:37:14 +04:00
|
|
|
</body>
|
|
|
|
|
</html>
|