feat: agrégateur RSS /flux + gestion feeds dans /profile

This commit is contained in:
Cedric Abonnel
2026-05-12 23:59:09 +02:00
parent 03177dc732
commit 2e8302dad4
7 changed files with 432 additions and 7 deletions
+48 -6
View File
@@ -1,7 +1,9 @@
<?php ob_start(); ?>
<div class="d-flex align-items-center gap-3 mb-4">
<form method="post" action="/profile">
<div class="d-flex align-items-center justify-content-between gap-3 mb-4">
<h1 class="h4 mb-0">Mon profil</h1>
<button type="submit" class="btn btn-primary btn-sm">Enregistrer</button>
</div>
<?php if ($profileSuccess): ?>
@@ -10,8 +12,6 @@
<?php if ($profileError !== ''): ?>
<div class="alert alert-danger py-2 small mb-3"><?= htmlspecialchars($profileError) ?></div>
<?php endif; ?>
<form method="post" action="/profile">
<div class="row g-4">
<!-- Colonne gauche : identité -->
@@ -36,9 +36,6 @@
<label class="form-label fw-semibold text-muted">Email</label>
<input type="text" class="form-control" value="<?= htmlspecialchars(currentUserEmail() ?? '') ?>" disabled>
</div>
<div class="mt-auto">
<button type="submit" class="btn btn-primary w-100">Enregistrer</button>
</div>
</div>
</div>
</div>
@@ -69,6 +66,51 @@
</div>
</form>
<!-- Flux RSS -->
<div class="mt-4" id="feeds">
<h2 class="h6 text-muted mb-3">Flux RSS</h2>
<div class="row g-3 align-items-start">
<div class="col-md-8">
<?php if (!empty($profileFeeds)): ?>
<div class="card mb-3">
<ul class="list-group list-group-flush">
<?php foreach ($profileFeeds as $_feed): ?>
<li class="list-group-item d-flex align-items-center gap-2 py-2">
<div class="flex-grow-1 min-w-0">
<div class="fw-semibold small text-truncate"><?= htmlspecialchars($_feed['label'] ?: $_feed['feed_url']) ?></div>
<div class="text-muted small text-truncate"><?= htmlspecialchars($_feed['feed_url']) ?></div>
</div>
<form method="post" action="/feed/delete" class="flex-shrink-0">
<input type="hidden" name="feed_id" value="<?= (int)$_feed['id'] ?>">
<button class="btn btn-sm btn-outline-danger py-0" data-confirm="Supprimer ce flux ?">✕</button>
</form>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header small fw-semibold">Ajouter un flux</div>
<div class="card-body">
<form method="post" action="/feed/add">
<div class="mb-2">
<input type="url" name="feed_url" class="form-control form-control-sm"
placeholder="https://example.com/feed.xml" required>
</div>
<div class="mb-3">
<input type="text" name="feed_label" class="form-control form-control-sm"
placeholder="Libellé (optionnel)" maxlength="100">
</div>
<button class="btn btn-primary btn-sm w-100">Ajouter</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
$pdo = dbPdo();
$_profileRoles = [];