fix: load markdown in direct.php, allow video-channels, guard modals
This commit is contained in:
@@ -140,9 +140,9 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<meta property="og:title" content="<?php echo !empty($video['title']) ? htmlspecialchars($video['title']) : 'Vidéo'; ?> - <?php echo SITE_NAME; ?>">
|
||||
<meta property="og:description" content="<?php echo !empty($video['description']) ? htmlspecialchars(substr(strip_tags($video['description']), 0, 200)) . '...' : 'Regardez cette vidéo sur ' . SITE_NAME; ?>">
|
||||
<?php if (isset($videoData['thumbnailPath'])): ?>
|
||||
<meta property="og:image" content="<?php echo PEERTUBE_URL . $videoData['thumbnailPath']; ?>">
|
||||
<meta property="og:image" content="<?php echo e(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:url" content="<?php echo htmlspecialchars(getCurrentUrl()); ?>">
|
||||
<meta property="og:type" content="video.other">
|
||||
<meta property="og:site_name" content="<?php echo SITE_NAME; ?>">
|
||||
<meta property="og:locale" content="fr_FR">
|
||||
@@ -152,7 +152,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<meta name="twitter:title" content="<?php echo !empty($video['title']) ? htmlspecialchars($video['title']) : 'Vidéo'; ?> - <?php echo SITE_NAME; ?>">
|
||||
<meta name="twitter:description" content="<?php echo !empty($video['description']) ? htmlspecialchars(substr(strip_tags($video['description']), 0, 200)) . '...' : 'Regardez cette vidéo sur ' . SITE_NAME; ?>">
|
||||
<?php if (isset($videoData['thumbnailPath'])): ?>
|
||||
<meta name="twitter:image" content="<?php echo PEERTUBE_URL . $videoData['thumbnailPath']; ?>">
|
||||
<meta name="twitter:image" content="<?php echo e(PEERTUBE_URL . $videoData['thumbnailPath']); ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!isset($videoNotFound) && !empty($video)): ?>
|
||||
@@ -224,7 +224,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<?php if (defined('SHOW_VIDEO_VIEWS') && SHOW_VIDEO_VIEWS): ?>
|
||||
<span class="video-views"><i class="fas fa-eye" aria-hidden="true"></i> <?php echo formatViewCount($video['views']); ?> vues</span>
|
||||
<?php endif; ?>
|
||||
<span class="video-date"><i class="far fa-calendar-alt" aria-hidden="true"></i> <time datetime="<?php echo $video['date']; ?>"><?php echo formatDate($video['date']); ?></time></span>
|
||||
<span class="video-date"><i class="far fa-calendar-alt" aria-hidden="true"></i> <time datetime="<?php echo e($video['date']); ?>"><?php echo formatDate($video['date']); ?></time></span>
|
||||
</div>
|
||||
|
||||
<div class="video-actions">
|
||||
@@ -301,20 +301,20 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
$channelUrl = PEERTUBE_URL . '/c/' . $video['channelHandle'];
|
||||
?>
|
||||
<?php if (strpos($channelAvatar, 'default-avatar') !== false || empty($channelAvatar)): ?>
|
||||
<a href="<?php echo $channelUrl; ?>" target="_blank" rel="noopener noreferrer" class="channel-avatar-link" aria-label="Voir la chaîne <?php echo htmlspecialchars($video['channel']); ?>">
|
||||
<a href="<?php echo e($channelUrl); ?>" target="_blank" rel="noopener noreferrer" class="channel-avatar-link" aria-label="Voir la chaîne <?php echo htmlspecialchars($video['channel']); ?>">
|
||||
<div class="channel-avatar-placeholder" role="img" aria-label="Avatar par défaut">
|
||||
<i class="fas fa-user-circle" aria-hidden="true"></i>
|
||||
</div>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="<?php echo $channelUrl; ?>" target="_blank" rel="noopener noreferrer" class="channel-avatar-link" aria-label="Voir la chaîne <?php echo htmlspecialchars($video['channel']); ?>">
|
||||
<a href="<?php echo e($channelUrl); ?>" target="_blank" rel="noopener noreferrer" class="channel-avatar-link" aria-label="Voir la chaîne <?php echo htmlspecialchars($video['channel']); ?>">
|
||||
<div class="channel-avatar">
|
||||
<img src="<?php echo $channelAvatar; ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($video['channel']); ?>">
|
||||
<img src="<?php echo e($channelAvatar); ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($video['channel']); ?>">
|
||||
</div>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<div class="channel-details">
|
||||
<a href="<?php echo $channelUrl; ?>" target="_blank" rel="noopener noreferrer" class="channel-name-link">
|
||||
<a href="<?php echo e($channelUrl); ?>" target="_blank" rel="noopener noreferrer" class="channel-name-link">
|
||||
<h2 class="channel-name"><?php echo htmlspecialchars($video['channel']); ?></h2>
|
||||
</a>
|
||||
</div>
|
||||
@@ -335,7 +335,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<i class="fas fa-chevron-down" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="full-description" class="full-description" style="display: none;" nonce="<?php echo getCspNonce(); ?>">
|
||||
<div id="full-description" class="full-description is-hidden">
|
||||
<?php echo markdown_to_html($video['description']); ?>
|
||||
<button class="show-less-btn" aria-expanded="true" aria-controls="full-description">
|
||||
<span>Voir moins</span>
|
||||
@@ -362,7 +362,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<div class="section-title-wrapper">
|
||||
<h2 id="comments-heading" class="section-title">Commentaires</h2>
|
||||
</div>
|
||||
<a href="<?php echo PEERTUBE_URL; ?>/videos/watch/<?php echo $videoData['uuid']; ?>" target="_blank" class="view-on-peertube" aria-label="Voir cette vidéo sur <?php echo PEERTUBE_DISPLAY_NAME; ?>">
|
||||
<a href="<?php echo e(PEERTUBE_URL . '/videos/watch/' . $videoData['uuid']); ?>" target="_blank" class="view-on-peertube" aria-label="Voir cette vidéo sur <?php echo PEERTUBE_DISPLAY_NAME; ?>">
|
||||
<i class="fas fa-external-link-alt" aria-hidden="true"></i> Voir sur <?php echo PEERTUBE_DISPLAY_NAME; ?>
|
||||
</a>
|
||||
</header>
|
||||
@@ -375,7 +375,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<article 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']); ?>">
|
||||
<img src="<?php echo e(PEERTUBE_URL . $comment['account']['avatar']['path']); ?>" alt="<?php echo htmlspecialchars($comment['account']['displayName']); ?>">
|
||||
<?php else: ?>
|
||||
<div class="channel-avatar-placeholder mini" role="img" aria-label="Avatar par défaut">
|
||||
<i class="fas fa-user-circle" aria-hidden="true"></i>
|
||||
@@ -385,14 +385,14 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<div class="comment-content">
|
||||
<header class="comment-header">
|
||||
<span class="comment-author"><?php echo htmlspecialchars($comment['account']['displayName']); ?></span>
|
||||
<time class="comment-date" datetime="<?php echo $comment['createdAt']; ?>"><?php echo formatDate($comment['createdAt']); ?></time>
|
||||
<time class="comment-date" datetime="<?php echo e($comment['createdAt']); ?>"><?php echo formatDate($comment['createdAt']); ?></time>
|
||||
</header>
|
||||
<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" aria-label="Voir les réponses sur PeerTube">
|
||||
<i class="fas fa-reply" aria-hidden="true"></i> Voir les <?php echo $comment['totalReplies']; ?> réponse<?php echo $comment['totalReplies'] > 1 ? 's' : ''; ?>
|
||||
<a href="<?php echo e(PEERTUBE_URL . '/videos/watch/' . $videoData['uuid']); ?>" target="_blank" class="show-replies" aria-label="Voir les réponses sur PeerTube">
|
||||
<i class="fas fa-reply" aria-hidden="true"></i> Voir les <?php echo e($comment['totalReplies']); ?> réponse<?php echo $comment['totalReplies'] > 1 ? 's' : ''; ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -404,13 +404,13 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<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>
|
||||
<p>Pour ajouter des commentaires ou voir les réponses, veuillez vous rendre sur <a href="<?php echo e(PEERTUBE_URL . '/videos/watch/' . $videoData['uuid']); ?>" target="_blank" class="show-replies"> <?php echo PEERTUBE_DISPLAY_NAME; ?></a>.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="no-comments">
|
||||
<i class="fas fa-comments"></i>
|
||||
<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>
|
||||
<p>Pour ajouter des commentaires, veuillez vous rendre sur <a href="<?php echo e(PEERTUBE_URL . '/videos/watch/' . $videoData['uuid']); ?>" target="_blank" class="show-replies"> <?php echo PEERTUBE_DISPLAY_NAME; ?></a>.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -424,27 +424,27 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<div class="suggestion-list">
|
||||
<?php foreach ($suggestedVideos as $suggestedVideo): ?>
|
||||
<article class="suggested-video">
|
||||
<a href="video.php?id=<?php echo $suggestedVideo['id']; ?>" class="suggested-video-link" aria-labelledby="suggestion-title-<?php echo $suggestedVideo['id']; ?>">
|
||||
<a href="video.php?id=<?php echo e($suggestedVideo['id']); ?>" class="suggested-video-link" aria-labelledby="suggestion-title-<?php echo e($suggestedVideo['id']); ?>">
|
||||
<div class="suggested-video-thumbnail">
|
||||
<img src="<?php echo $suggestedVideo['thumbnail']; ?>" alt="<?php echo $suggestedVideo['title']; ?>">
|
||||
<img src="<?php echo e($suggestedVideo['thumbnail']); ?>" alt="<?php echo e($suggestedVideo['title']); ?>">
|
||||
</div>
|
||||
<div class="suggested-video-info">
|
||||
<span class="suggested-video-duration"><?php echo formatDuration($suggestedVideo['duration']); ?></span>
|
||||
<h3 id="suggestion-title-<?php echo $suggestedVideo['id']; ?>" class="suggested-video-title"><?php echo htmlspecialchars($suggestedVideo['title']); ?></h3>
|
||||
<h3 id="suggestion-title-<?php echo e($suggestedVideo['id']); ?>" class="suggested-video-title"><?php echo htmlspecialchars($suggestedVideo['title']); ?></h3>
|
||||
<div class="suggested-video-channel">
|
||||
<?php
|
||||
<?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):
|
||||
|
||||
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">
|
||||
<img src="<?php echo e($suggestedAvatar); ?>" alt="<?php echo e($suggestedVideo['channel']); ?>" class="channel-avatar mini">
|
||||
<?php endif; ?>
|
||||
<span class="channel-name"><?php echo $suggestedVideo['channel']; ?></span>
|
||||
<span class="channel-name"><?php echo e($suggestedVideo['channel']); ?></span>
|
||||
</div>
|
||||
<div class="suggested-video-metadata">
|
||||
<?php if (defined('SHOW_VIDEO_VIEWS') && SHOW_VIDEO_VIEWS): ?>
|
||||
@@ -466,7 +466,8 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
</main>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
<?php include 'includes/mobile-menu.php'; ?>
|
||||
|
||||
|
||||
<?php if (!isset($videoNotFound)): ?>
|
||||
<!-- Modal de téléchargement -->
|
||||
<div id="download-modal" class="modal">
|
||||
<div class="modal-content">
|
||||
@@ -482,13 +483,13 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
if (!empty($downloadOptions)):
|
||||
foreach ($downloadOptions as $option):
|
||||
?>
|
||||
<a href="<?php echo $option['url']; ?>" class="download-option" download>
|
||||
<a href="<?php echo e($option['url']); ?>" class="download-option" download>
|
||||
<div class="download-resolution">
|
||||
<i class="fas fa-film"></i>
|
||||
<span><?php echo $option['resolution']; ?></span>
|
||||
<span><?php echo e($option['resolution']); ?></span>
|
||||
</div>
|
||||
<div class="download-info">
|
||||
<span class="download-size"><?php echo $option['size']; ?></span>
|
||||
<span class="download-size"><?php echo e($option['size']); ?></span>
|
||||
<i class="fas fa-download"></i>
|
||||
</div>
|
||||
</a>
|
||||
@@ -517,7 +518,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<div class="share-link-container">
|
||||
<p>Lien de la vidéo :</p>
|
||||
<div class="share-link-box">
|
||||
<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>
|
||||
<input type="text" id="share-link" value="<?php echo htmlspecialchars(getCurrentUrl()); ?>" readonly>
|
||||
<button id="copy-link-btn" class="copy-btn" title="Copier le lien">
|
||||
<i class="fas fa-copy"></i>
|
||||
</button>
|
||||
@@ -526,32 +527,32 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
|
||||
<p class="share-platforms-title">Partager sur :</p>
|
||||
<div class="share-platforms">
|
||||
<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">
|
||||
<a href="mailto:?subject=<?php echo urlencode(htmlspecialchars($video['title'])); ?>&body=<?php echo urlencode(htmlspecialchars($video['title']) . ' - ' . getCurrentUrl()); ?>" class="share-platform-btn" title="Partager par e-mail">
|
||||
<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">
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode(getCurrentUrl()); ?>" target="_blank" class="share-platform-btn" title="Partager sur Facebook">
|
||||
<i class="fab fa-facebook-f"></i>
|
||||
<span>Facebook</span>
|
||||
</a>
|
||||
|
||||
<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">
|
||||
<a href="https://twitter.com/intent/tweet?text=<?php echo urlencode(htmlspecialchars($video['title'])); ?>&url=<?php echo urlencode(getCurrentUrl()); ?>" target="_blank" class="share-platform-btn" title="Partager sur X/Twitter">
|
||||
<i class="fab fa-x-twitter"></i>
|
||||
<span>X</span>
|
||||
</a>
|
||||
|
||||
<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">
|
||||
<a href="https://wa.me/?text=<?php echo urlencode(htmlspecialchars($video['title']) . ' - ' . getCurrentUrl()); ?>" target="_blank" class="share-platform-btn" title="Partager sur WhatsApp">
|
||||
<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">
|
||||
<a href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo urlencode(getCurrentUrl()); ?>" 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">
|
||||
<a href="https://t.me/share/url?url=<?php echo urlencode(getCurrentUrl()); ?>&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>
|
||||
@@ -560,7 +561,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<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>
|
||||
<input type="text" id="embed-code" value='<iframe width="560" height="315" src="<?php echo e($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>
|
||||
@@ -580,15 +581,15 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
|
||||
if (showMoreBtn) {
|
||||
showMoreBtn.addEventListener('click', function() {
|
||||
document.querySelector('.truncated-description').style.display = 'none';
|
||||
document.querySelector('.full-description').style.display = 'block';
|
||||
document.querySelector('.truncated-description').classList.add('is-hidden');
|
||||
document.querySelector('.full-description').classList.remove('is-hidden');
|
||||
});
|
||||
}
|
||||
|
||||
if (showLessBtn) {
|
||||
showLessBtn.addEventListener('click', function() {
|
||||
document.querySelector('.full-description').style.display = 'none';
|
||||
document.querySelector('.truncated-description').style.display = 'block';
|
||||
document.querySelector('.full-description').classList.add('is-hidden');
|
||||
document.querySelector('.truncated-description').classList.remove('is-hidden');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -672,6 +673,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<script src="js/pwa-update.js?v=<?php echo filemtime('js/pwa-update.js'); ?>"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user