feat : RSS content, feed catégorie, cookie commentaires, flux erreurs, email preview (v1.6.17)

- RSS : content:encoded (HTML complet) + fix description via plain (#42)
- RSS : flux filtré par ?category=nom (#43)
- Commentaires : cookie nom/email pour pré-remplir le formulaire (#51)
- flux/ : bandeau admin des feeds en erreur (#45)
- admin/emails : bouton « Voir ↗ » vers /admin/email-preview/{id} en nouvel onglet (#37)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 10:00:37 +02:00
parent dc4701d667
commit 51055b7321
8 changed files with 131 additions and 32 deletions
+7 -11
View File
@@ -1005,17 +1005,13 @@ foreach (COLOR_PALETTE_16 as $_i => $_rgb):
<td class="small"><?= htmlspecialchars((string)$em['subject']) ?></td>
<td><?= $emBadge ?></td>
<td>
<details>
<summary class="btn btn-outline-secondary btn-sm" style="display:inline;cursor:pointer">Voir</summary>
<div class="mt-2 p-2 border rounded bg-light" style="max-width:600px">
<?php if (!empty($em['error_message'])): ?>
<p class="text-danger small mb-2"><strong>Erreur :</strong> <?= htmlspecialchars((string)$em['error_message']) ?></p>
<?php endif; ?>
<?php if (!empty($em['content_text'])): ?>
<pre class="mb-0 small" style="white-space:pre-wrap;font-size:0.75rem"><?= htmlspecialchars((string)$em['content_text']) ?></pre>
<?php endif; ?>
</div>
</details>
<?php if (!empty($em['content_html']) || !empty($em['content_text'])): ?>
<a href="/admin/email-preview/<?= (int)$em['id'] ?>" target="_blank" rel="noopener"
class="btn btn-outline-secondary btn-sm">Voir ↗</a>
<?php endif; ?>
<?php if (!empty($em['error_message'])): ?>
<span class="text-danger small d-block mt-1" title="<?= htmlspecialchars((string)$em['error_message']) ?>">⚠ Erreur</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
+26
View File
@@ -142,3 +142,29 @@ setcookie('_csrf_c', $_csrfToken, [
</div>
</div>
<script>
(function () {
var maxAge = 365 * 24 * 3600;
function getCookie(name) {
var m = document.cookie.match('(?:^|; )' + name + '=([^;]*)');
return m ? decodeURIComponent(m[1]) : '';
}
function setCookie(name, value) {
document.cookie = name + '=' + encodeURIComponent(value) + ';max-age=' + maxAge + ';path=/;SameSite=Lax';
}
var nameEl = document.getElementById('comment-name');
var emailEl = document.getElementById('comment-email');
if (!nameEl || !emailEl) { return; }
var savedName = getCookie('cmt_name');
var savedEmail = getCookie('cmt_email');
if (savedName) { nameEl.value = savedName; }
if (savedEmail) { emailEl.value = savedEmail; }
var form = document.getElementById('comment-form');
if (form) {
form.addEventListener('submit', function () {
if (nameEl.value.trim()) { setCookie('cmt_name', nameEl.value.trim()); }
if (emailEl.value.trim()) { setCookie('cmt_email', emailEl.value.trim()); }
});
}
}());
</script>
+15
View File
@@ -4,6 +4,21 @@
<h1 class="h4 mb-0">Flux agrégés</h1>
</div>
<?php if (!empty($fluxErrors) && function_exists('isAdmin') && isAdmin()): ?>
<div class="alert alert-warning py-2 mb-4">
<strong><?= count($fluxErrors) ?> flux en erreur</strong>
<ul class="mb-0 mt-1 small">
<?php foreach ($fluxErrors as $_err): ?>
<li>
<?= htmlspecialchars($_err['label'] !== '' ? $_err['label'] : $_err['feed_url']) ?>
— <code><?= htmlspecialchars($_err['feed_url']) ?></code>
<span class="text-muted">(<?= htmlspecialchars($_err['user_email']) ?>)</span>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php if (empty($fluxItems)): ?>
<p class="text-muted">Aucun article disponible pour l'instant.</p>
<?php else: ?>