feat : recherche titre, toggle à la une, date modif, retour sources (v1.6.15)
- admin/articles : champ filter_search (titre, insensible casse) cumulable avec auteur/catégorie/statut (#85) - admin/articles : colonne ★ avec toggle rapide featured + filtre filter_featured (#84) - post/ : date de modification sous la date de publication si modifié après mise en ligne (#81) - sources/ : bouton ← Retour à l'article vers post/<slug> au lieu de /edit/<uuid> (#83) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2355,9 +2355,13 @@ switch ($action) {
|
||||
$filterAuthor = trim($_GET['filter_author'] ?? '');
|
||||
$filterCategory = trim($_GET['filter_category'] ?? '');
|
||||
$filterStatus = trim($_GET['filter_status'] ?? '');
|
||||
$filterSearch = trim($_GET['filter_search'] ?? '');
|
||||
$filterFeatured = trim($_GET['filter_featured'] ?? '');
|
||||
$adminData['filter_author'] = $filterAuthor;
|
||||
$adminData['filter_category'] = $filterCategory;
|
||||
$adminData['filter_status'] = $filterStatus;
|
||||
$adminData['filter_search'] = $filterSearch;
|
||||
$adminData['filter_featured'] = $filterFeatured;
|
||||
|
||||
$nowTs = time();
|
||||
if ($filterAuthor !== '') {
|
||||
@@ -2373,6 +2377,12 @@ switch ($action) {
|
||||
} elseif ($filterStatus === 'preview') {
|
||||
$allArticles = array_values(array_filter($allArticles, fn ($a) => $a['published'] && strtotime((string)($a['published_at'] ?? '')) > $nowTs));
|
||||
}
|
||||
if ($filterSearch !== '') {
|
||||
$allArticles = array_values(array_filter($allArticles, fn ($a) => mb_stripos($a['title'] ?? '', $filterSearch) !== false));
|
||||
}
|
||||
if ($filterFeatured === 'yes') {
|
||||
$allArticles = array_values(array_filter($allArticles, fn ($a) => !empty($a['featured'])));
|
||||
}
|
||||
|
||||
$sortBy = in_array($_GET['sort'] ?? '', ['title', 'published', 'updated']) ? $_GET['sort'] : 'updated';
|
||||
$sortDir = ($_GET['dir'] ?? '') === 'asc' ? 'asc' : 'desc';
|
||||
@@ -2741,6 +2751,21 @@ switch ($action) {
|
||||
header('Location: /admin/smtp');
|
||||
exit;
|
||||
|
||||
case 'admin_toggle_featured':
|
||||
requireAuth();
|
||||
if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
http_response_code(403);
|
||||
exit;
|
||||
}
|
||||
$uid = trim((string)($_POST['uuid'] ?? ''));
|
||||
$art = $uid !== '' ? $articles->getByUuid($uid) : null;
|
||||
if ($art) {
|
||||
$articles->setFeatured($uid, !((bool)($art['featured'] ?? false)));
|
||||
}
|
||||
$back = $_POST['_back'] ?? '/admin/articles';
|
||||
header('Location: ' . $back);
|
||||
exit;
|
||||
|
||||
case 'admin_bulk_delete':
|
||||
requireAuth();
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
Reference in New Issue
Block a user