fix: add missing bootstrap require in markdown-cheatsheet-fragment.php, add bottom padding to dialog

This commit is contained in:
Pontoporeia
2026-07-03 15:24:07 +02:00
parent 00a106138e
commit e6a989bb36
7 changed files with 30 additions and 175 deletions
@@ -4,6 +4,8 @@
* Rendered as a <dialog> element; caller should call .showModal() after swap.
*/
require_once __DIR__ . '/../../bootstrap.php';
$rows = [
[
'syntax' => '# Titre 1',
+1 -1
View File
@@ -2335,7 +2335,7 @@ th.admin-ap-col {
.md-cheatsheet-dialog {
border: 1px solid var(--border);
border-radius: var(--radius-m, 8px);
padding: 0;
padding: 0 0 var(--space-m);
max-width: 640px;
width: 90vw;
box-shadow: 0 8px 32px rgba(0,0,0,0.18);
+3 -3
View File
@@ -20,8 +20,8 @@
minmax(9rem, 1fr)
minmax(7rem, 1fr)
minmax(8rem, 1fr)
minmax(min-content, 1fr);
grid-template-rows: auto 1fr;
minmax(3rem, 0.45fr);
grid-template-rows: auto minmax(0, 1fr);
gap: var(--space-s);
justify-content: space-between;
padding: 0;
@@ -69,7 +69,7 @@
overflow-wrap: break-word;
}
.repertoire-col > ul {
.repertoire-col .rep-accordion__panel > ul {
grid-row: 2;
overflow-y: auto;
overflow-x: hidden;
+2 -55
View File
@@ -52,6 +52,8 @@
height: auto;
display: block;
border-radius: var(--radius);
user-select: none;
-webkit-user-drag: none;
}
.tfe-file-item embed,
@@ -161,12 +163,6 @@
margin: 0;
}
/* PDF fallback download link */
.tfe-pdf-fallback {
font-size: var(--step--1);
margin: var(--space-3xs) 0 0;
}
/* Audio player */
.tfe-audio {
width: 100%;
@@ -174,55 +170,6 @@
display: block;
}
/* Download-only files */
.tfe-download-file {
display: flex;
align-items: center;
gap: var(--space-xs);
padding: var(--space-s) var(--space-m);
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius);
flex-wrap: wrap;
}
.tfe-download-link {
display: flex;
align-items: center;
gap: var(--space-xs);
font-size: var(--step--1);
font-weight: 500;
color: var(--text-primary);
text-decoration: none;
word-break: break-all;
}
.tfe-download-link:hover {
color: var(--accent-primary);
text-decoration: none;
}
.tfe-download-icon {
font-size: 1.3rem;
line-height: 1;
flex-shrink: 0;
}
.tfe-download-size {
font-size: var(--step--2);
color: var(--text-tertiary);
margin-left: auto;
}
.tfe-pdf-fallback a {
color: var(--text-primary);
text-decoration: none;
}
.tfe-pdf-fallback a:hover {
color: var(--accent-primary);
}
/* "Not available" and "no files" notices */
.tfe-restricted,
.tfe-no-files {
+6 -12
View File
@@ -108,10 +108,7 @@ class MediaController
exit;
}
// 5. Determine if download was explicitly requested
$forceDownload = !empty($_GET['download']) && $_GET['download'] === '1';
// 6. Send response headers
// 5. Send response headers
header('Content-Type: ' . $mimeType);
header('Content-Length: ' . (int) filesize($realFull));
header('X-Content-Type-Options: nosniff');
@@ -121,12 +118,10 @@ class MediaController
header('Cache-Control: public, max-age=86400');
} elseif (in_array($ext, ['jpg','jpeg','png','gif','webp'], true)) {
header('Cache-Control: public, max-age=604800');
if (!$forceDownload) {
header('Content-Disposition: inline');
}
header('Content-Disposition: inline');
} elseif ($ext === 'pdf') {
header('Cache-Control: public, max-age=86400');
header('Content-Disposition: ' . ($forceDownload ? 'attachment' : 'inline'));
header('Content-Disposition: inline');
} elseif (in_array($ext, ['mp4','webm','ogv','mov'], true)) {
// Video: no cache-control range requests should work
header('Accept-Ranges: bytes');
@@ -135,10 +130,9 @@ class MediaController
header('Accept-Ranges: bytes');
header('Cache-Control: public, max-age=86400');
} else {
// Unknown / other: force download
$safeFilename = preg_replace('/[^A-Za-z0-9._-]/', '_', basename($realFull));
header('Content-Disposition: attachment; filename="' . $safeFilename . '"');
header('Cache-Control: private, no-store');
// Unknown / other: serve inline, no download
header('Content-Disposition: inline');
header('Cache-Control: public, max-age=86400');
}
// 7. Stream file (with range support for media)
+14 -21
View File
@@ -253,7 +253,7 @@
<?php if (!empty($data["baiu_link"])): ?>
<?php
$_baiuHref = htmlspecialchars($data["baiu_link"]);
$_baiuLabel = preg_replace("#^https?://(www\\.)?#i", "", rtrim($data["baiu_link"], "/"));
$_baiuLabel = parse_url($data["baiu_link"], PHP_URL_HOST) ?: preg_replace("#^https?://(www\\.)?#i", "", rtrim($data["baiu_link"], "/"));
?>
<p class="tfe-meta-item">
<span class="tfe-meta-label">Lien :</span>
@@ -382,7 +382,7 @@
?>
<div class="tfe-file-item">
<?php if ($isPdf): ?>
<iframe src="<?= $mediaUrl ?>"
<iframe src="<?= $mediaUrl ?>#toolbar=0&navpanes=0"
width="100%" height="700px"
style="border:none"
title="<?= $fileName ?>">
@@ -395,15 +395,11 @@
sandbox="allow-scripts allow-same-origin"
loading="lazy">
</iframe>
<p class="tfe-pdf-fallback">
<a href="<?= $mediaUrl ?>" target="_blank" rel="noopener">
Ouvrir le site dans un nouvel onglet
<span class="sr-only">(ouvre dans un nouvel onglet)</span>
</a>
</p>
<?php elseif ($isImage): ?>
<img src="<?= $mediaUrl ?>"
alt="<?= htmlspecialchars($caption !== '' ? $caption : $data['title'] . ' — ' . ($data['authors'] ?? '')) ?>">
alt="<?= htmlspecialchars($caption !== '' ? $caption : $data['title'] . ' — ' . ($data['authors'] ?? '')) ?>"
draggable="false"
oncontextmenu="return false">
<?php elseif ($isVideo): ?>
<?php if ($isPeerTube): ?>
<?php
@@ -413,7 +409,10 @@
include APP_ROOT . '/templates/partials/peertube-embed.php';
?>
<?php else: ?>
<video width="100%" controls>
<video width="100%" controls
controlsList="nodownload nofullscreen noremoteplayback"
disablepictureinpicture
oncontextmenu="return false">
<source src="<?= $mediaUrl ?>" type="video/<?= htmlspecialchars($ext === 'mov' ? 'mp4' : $ext) ?>">
<?php if ($_vttPath): ?>
<track kind="captions"
@@ -433,7 +432,9 @@
include APP_ROOT . '/templates/partials/peertube-embed.php';
?>
<?php else: ?>
<audio controls class="tfe-audio">
<audio controls class="tfe-audio"
controlsList="nodownload noremoteplayback"
oncontextmenu="return false">
<source src="<?= $mediaUrl ?>" type="audio/<?= htmlspecialchars(match($ext) {
'mp3' => 'mpeg',
'ogg', 'oga' => 'ogg',
@@ -446,16 +447,8 @@
Votre navigateur ne supporte pas la lecture audio.
</audio>
<?php endif; ?>
<?php else: /* other — download only */ ?>
<div class="tfe-download-file">
<a href="<?= $mediaUrl ?>&download=1" class="tfe-download-link">
<span class="tfe-download-icon">📎</span>
<span><?= $fileName ?></span>
</a>
<?php if (!empty($file['file_size'])): ?>
<small class="tfe-download-size"><?= number_format($file['file_size'] / 1024 / 1024, 2) ?> MB</small>
<?php endif; ?>
</div>
<?php else: /* other — not previewable, skip */ ?>
<?php continue; ?>
<?php endif; ?>
<?php if ($caption !== '' && !$isOther): ?>
<figcaption><?= htmlspecialchars($caption) ?></figcaption>