$val) { if (!str_starts_with($key, 'name_')) continue; $idx = substr($key, 5); $updated[] = [ 'name' => trim($val), 'url' => trim($_POST["url_$idx"] ?? ''), 'description' => trim($_POST["description_$idx"] ?? ''), 'groups' => (array)($_POST["groups_$idx"] ?? []), 'visible' => isset($_POST["visible_$idx"]), ]; } $new_name = trim($_POST['new_name'] ?? ''); if ($new_name) { $updated[] = [ 'name' => $new_name, 'url' => trim($_POST['new_url'] ?? ''), 'description' => trim($_POST['new_description'] ?? ''), 'groups' => (array)($_POST['new_groups'] ?? []), 'visible' => isset($_POST['new_visible']), ]; } services_save($updated); set_flash('success', 'Services sauvegardés.'); header('Location: /admin/services.php'); exit; } $services = services_list(); $title = 'Paramétrage des services'; require __DIR__ . '/../views/layout.php'; ?>