feat : widget notation étoiles + admin onglet flux RSS (v1.6.22)

- post_view.php : widget ★ 1-5 étoiles pour les connectés, moyenne + nb votes pour tous (#13)
- admin : onglet /admin/flux liste tous les flux rss_feeds avec suppression (#87)
- case 'admin_delete_feed' : suppression admin d'un flux sans contrainte email (#87)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 11:18:55 +02:00
parent ca6cfa4ebf
commit e2d218f364
5 changed files with 129 additions and 2 deletions
+55
View File
@@ -69,6 +69,10 @@ function adminStatusBadge(array $a, int $now): string
<a class="nav-link <?= $tab === 'books' ? 'active' : '' ?>"
href="/admin/books">Livres</a>
</li>
<li class="nav-item">
<a class="nav-link <?= $tab === 'flux' ? 'active' : '' ?>"
href="/admin/flux">Flux</a>
</li>
<li class="nav-item">
<a class="nav-link <?= $tab === 'stats' ? 'active' : '' ?>"
href="/admin/stats">Statistiques</a>
@@ -1267,6 +1271,57 @@ foreach (COLOR_PALETTE_16 as $_i => $_rgb):
<?php endif; ?>
<!-- ─────────────────────────── FLUX RSS ─────────────────────────── -->
<?php if ($tab === 'flux' && isAdmin()): ?>
<?php if (($_GET['deleted'] ?? '') === '1'): ?>
<div class="alert alert-success py-2 small">Flux supprimé.</div>
<?php endif; ?>
<h5>Flux RSS agrégés</h5>
<p class="text-muted small">Tous les flux enregistrés par les utilisateurs. Seul un administrateur peut les supprimer.</p>
<?php if (empty($adminData['flux_feeds'] ?? [])): ?>
<p class="text-muted">Aucun flux enregistré.</p>
<?php else: ?>
<div class="table-responsive">
<table class="table table-sm table-hover align-middle">
<thead class="table-light">
<tr>
<th>Utilisateur</th>
<th>Libellé</th>
<th>URL</th>
<th>Ajouté le</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($adminData['flux_feeds'] as $_feed): ?>
<tr>
<td class="small"><?= htmlspecialchars($_feed['user_email'] ?? '') ?></td>
<td class="small"><?= htmlspecialchars($_feed['label'] ?? '') ?></td>
<td class="small text-truncate" style="max-width:260px">
<a href="<?= htmlspecialchars($_feed['feed_url'] ?? '') ?>" target="_blank" rel="noopener" class="text-muted">
<?= htmlspecialchars($_feed['feed_url'] ?? '') ?>
</a>
</td>
<td class="small text-nowrap"><?= htmlspecialchars(substr($_feed['created_at'] ?? '', 0, 10)) ?></td>
<td>
<form method="POST" action="/?action=admin_delete_feed"
data-confirm="Supprimer ce flux ?">
<input type="hidden" name="id" value="<?= (int)$_feed['id'] ?>">
<button type="submit" class="btn btn-outline-danger btn-sm py-0">Supprimer</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php endif; ?>
<!-- ─────────────────────────── LIVRES ─────────────────────────── -->
<?php if ($tab === 'books' && isAdmin()): ?>
+31
View File
@@ -261,6 +261,37 @@ $hasSources = (!empty($externalLinks) || !empty($files))
</div>
</div>
<?php if (($ratingStats['count'] ?? 0) > 0 || isLoggedIn()): ?>
<div class="d-flex align-items-center flex-wrap gap-3 my-3 py-2 border-top small">
<span class="text-muted">Note :</span>
<?php if (($ratingStats['avg'] ?? null) !== null): ?>
<span>
<strong><?= number_format((float)$ratingStats['avg'], 1) ?></strong>/5
<span class="text-muted">(<?= (int)$ratingStats['count'] ?> vote<?= (int)$ratingStats['count'] > 1 ? 's' : '' ?>)</span>
</span>
<?php else: ?>
<span class="text-muted">Pas encore noté</span>
<?php endif; ?>
<?php if (isLoggedIn()): ?>
<form method="POST" action="/?action=rate" class="d-flex align-items-center gap-1 mb-0">
<input type="hidden" name="uuid" value="<?= htmlspecialchars($article['uuid']) ?>">
<?php for ($_s = 1; $_s <= 5; $_s++): ?>
<button type="submit" name="rating" value="<?= $_s ?>"
class="btn btn-link p-0 lh-1 text-decoration-none<?= (($userRating ?? 0) >= $_s) ? ' text-warning' : ' text-muted' ?>"
title="<?= $_s ?> étoile<?= $_s > 1 ? 's' : '' ?>">
<?= (($userRating ?? 0) >= $_s) ? '★' : '☆' ?>
</button>
<?php endfor; ?>
<?php if (($userRating ?? null) !== null): ?>
<span class="text-muted ms-1">(votre note)</span>
<?php endif; ?>
</form>
<?php else: ?>
<span class="text-muted fst-italic">Connectez-vous pour noter</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($article['published'] ?? false): ?>
<?php
$_shareUrl = rtrim(defined('APP_URL') ? APP_URL : '', '/') . '/post/' . rawurlencode($article['slug'] ?? '');