fix(pages): make page URLs and assets base-aware

Root-absolute asset paths and ?p= links broke when the site is
served from a subfolder (WAMP). Screenshots from the database and
avatars from creators.json go through fws_url() as well.
This commit is contained in:
BlackAngelTV committed 2026-09-16 14:35:33 +02:00
1 parent da74767843
commit ae472fe30a
7 files changed
+25 -25

No files matched your search

+4 -4
View File
@@ -27,19 +27,19 @@ if ($pkg === null) {
$title = 'Paquet introuvable | FWS Linux';
echo '<section class="paquet-detail-page">'
. '<p class="paquet-empty">Ce paquet n\'existe pas (il y en a ' . count($packages) . ').</p>'
. '<a class="paquet-detail-back" href="/?p/paquets/">&larr; Tous les paquets</a>'
. '<a class="paquet-detail-back" href="' . e(fws_url('/?p/paquets/')) . '">&larr; Tous les paquets</a>'
. '</section>';
return;
}
$title = $pkg['name'] . ' | FWS Linux';
$description = (string) ($pkg['tagline'] ?? '') !== '' ? (string) $pkg['tagline'] : (string) ($pkg['description'] ?? '');
$extraJs[] = '/p/assets/js/packages-ui.js';
$extraJs[] = fws_url('/p/assets/js/packages-ui.js');
$latest = $pkg['latest'] ?? null;
?>
<section class="paquet-detail-page">
<a class="paquet-detail-back" href="/?p/paquets/">&larr; Tous les paquets</a>
<a class="paquet-detail-back" href="<?= e(fws_url('/?p/paquets/')) ?>">&larr; Tous les paquets</a>
<div class="paquet-detail-hero">
<span class="paquet-since" title="<?= !empty($pkg['since']) ? e('Depuis le ' . fws_format_date((string) $pkg['since'])) : '' ?>"><?= e($pkg['sinceLabel'] !== '' ? $pkg['sinceLabel'] : 'FWS') ?></span>
@@ -84,7 +84,7 @@ $latest = $pkg['latest'] ?? null;
<div class="paquet-screens-grid">
<?php foreach ($pkg['screens'] as $screen): ?>
<figure>
<img src="<?= e((string) ($screen['src'] ?? '')) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy" data-zoom<?php if (!empty($screen['caption'])): ?> data-caption="<?= e((string) $screen['caption']) ?>"<?php endif; ?>>
<img src="<?= e(fws_url((string) ($screen['src'] ?? ''))) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy" data-zoom<?php if (!empty($screen['caption'])): ?> data-caption="<?= e((string) $screen['caption']) ?>"<?php endif; ?>>
<?php if (!empty($screen['caption'])): ?>
<figcaption><?= e((string) $screen['caption']) ?> <span class="paquet-zoom-hint">— cliquez pour agrandir</span></figcaption>
<?php else: ?>