$id > 0); if (empty($ids)) { App::flash('error', 'Aucun TFE sélectionné.'); header('Location: ../index.php'); exit; } $db->bulkSetPublished($ids, $published); $logger->logPublish($published, array_values($ids)); $count = count($ids); App::flash('success', $published ? "$count TFE(s) publié(s) avec succès." : "$count TFE(s) retiré(s) de la publication."); } else { $thesisId = filter_var($_POST['thesis_id'] ?? '', FILTER_VALIDATE_INT); if (!$thesisId || $thesisId <= 0) { App::flash('error', 'ID invalide.'); header('Location: ../index.php'); exit; } $db->setPublished($thesisId, $published); $logger->logPublish($published, [$thesisId]); App::flash('success', $published ? 'TFE publié avec succès.' : 'TFE retiré de la publication.'); } } catch (Exception $e) { error_log('publish.php error: ' . $e->getMessage()); App::flash('error', 'Erreur lors de la modification : ' . $e->getMessage()); } $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); header('Location: ../index.php'); exit;