true, 'samesite' => 'Lax', 'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https'), ]); session_start(); $STATUSES = [ 'nouveau' => '🆕 Nouveau', 'en_cours' => '🔧 En cours', 'resolu' => '✅ Résolu', 'ignore' => '🙈 Ignoré', ]; $STATUS_COLORS = [ 'nouveau' => '#38bdf8', 'en_cours' => '#fbbf24', 'resolu' => '#4ade80', 'ignore' => '#94a3b8', ]; /* ───────────────────────── helpers ───────────────────────── */ function h(?string $s): string { return htmlspecialchars((string) $s, ENT_QUOTES, 'UTF-8'); } function current_user(): ?array { return isset($_SESSION['admin_user_id']) ? [ 'id' => (int) $_SESSION['admin_user_id'], 'name' => (string) $_SESSION['admin_username'], ] : null; } function csrf_token(): string { if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(random_bytes(32)); } return $_SESSION['csrf']; } function csrf_ok(): bool { return hash_equals($_SESSION['csrf'] ?? '', $_POST['csrf'] ?? ''); } function format_date(string $utc): string { try { $d = new DateTime($utc, new DateTimeZone('UTC')); $d->setTimezone(new DateTimeZone('Europe/Paris')); return $d->format('d/m/Y H:i'); } catch (Throwable $e) { return $utc; } } function excerpt(string $s, int $len = 140): string { $s = trim(preg_replace('/\s+/', ' ', $s) ?? ''); if (mb_strlen($s) <= $len) { return $s; } return mb_substr($s, 0, $len - 1) . '…'; } /* ───────────────────────── actions POST ───────────────────────── */ $error = null; $notice = null; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action'] ?? ''; if ($action === 'login') { $username = trim((string) ($_POST['username'] ?? '')); $password = (string) ($_POST['password'] ?? ''); try { $pdo = fws_bugs_db(); $st = $pdo->prepare('SELECT * FROM admin_users WHERE username = :u'); $st->execute([':u' => $username]); $user = $st->fetch(); if ($user !== false && password_verify($password, $user['password_hash'])) { session_regenerate_id(true); $_SESSION['admin_user_id'] = (int) $user['id']; $_SESSION['admin_username'] = (string) $user['username']; $_SESSION['csrf'] = bin2hex(random_bytes(32)); header('Location: index.php'); exit; } $error = 'Identifiants incorrects.'; } catch (Throwable $e) { $error = 'Erreur base de données : ' . $e->getMessage(); } } elseif (current_user() !== null) { if (!csrf_ok()) { $error = 'Jeton de sécurité invalide, rechargez la page.'; } elseif ($action === 'logout') { $_SESSION = []; session_destroy(); header('Location: index.php'); exit; } elseif ($action === 'set_status') { $id = (int) ($_POST['id'] ?? 0); $status = (string) ($_POST['status'] ?? ''); if (!isset($STATUSES[$status])) { $error = 'Statut inconnu.'; } else { $pdo = fws_bugs_db(); $st = $pdo->prepare('UPDATE bug_reports SET status = :s WHERE id = :id'); $st->execute([':s' => $status, ':id' => $id]); $notice = "Signalement #$id marqué « " . $STATUSES[$status] . " »."; header('Location: index.php?id=' . $id); exit; } } elseif ($action === 'delete') { $id = (int) ($_POST['id'] ?? 0); $pdo = fws_bugs_db(); $st = $pdo->prepare('DELETE FROM bug_reports WHERE id = :id'); $st->execute([':id' => $id]); $notice = "Signalement #$id supprimé."; header('Location: index.php'); exit; } } } $user = current_user(); /* ───────────────────────── routage vues ───────────────────────── */ try { $pdo = fws_bugs_db(); } catch (Throwable $e) { http_response_code(500); exit('Erreur base de données : ' . h($e->getMessage())); } $view_id = (int) ($_GET['id'] ?? 0); /* Compteurs pour les filtres */ $counts = ['tous' => 0]; foreach ($STATUSES as $k => $v) { $counts[$k] = 0; } foreach ($pdo->query('SELECT status, COUNT(*) c FROM bug_reports GROUP BY status') as $row) { $s = $row['status']; if (isset($counts[$s])) { $counts[$s] = (int) $row['c']; $counts['tous'] += (int) $row['c']; } } /* ───────────────────────── affichage ───────────────────────── */ header('Content-Type: text/html; charset=utf-8'); ?> Signalements — FWS Linux

🔒 Panneau des signalements

Aucun compte admin pour l'instant.
Créez-le dans le conteneur :

docker exec -it fws-files php /var/www/html/admin/bugs/init.php

🐞 Signalements de bugs

Connecté : · Base SQLite · tester l'API
0): /* ─────────── DÉTAIL ─────────── */ $st = $pdo->prepare('SELECT * FROM bug_reports WHERE id = :id'); $st->execute([':id' => $view_id]); $r = $st->fetch(); if ($r === false): ?>

Signalement # introuvable.

← Retour à la liste ← Retour à la liste

# —

📅 📦

E-mail
Système
IP
User-agent
📜 Logs :
Changer le statut : $sv): if ($sk === $r['status']) continue; ?>
prepare("SELECT COUNT(*) FROM bug_reports $where"); $st->execute($params); $total = (int) $st->fetchColumn(); $pages = max(1, (int) ceil($total / $perPage)); $page = min($page, $pages); $offset = ($page - 1) * $perPage; $st = $pdo->prepare( "SELECT * FROM bug_reports $where ORDER BY id DESC LIMIT :lim OFFSET :off" ); $st->bindValue(':lim', $perPage, PDO::PARAM_INT); $st->bindValue(':off', $offset, PDO::PARAM_INT); foreach ($params as $k => $v) $st->bindValue($k, $v); $st->execute(); $reports = $st->fetchAll(); ?>
$c): ?> ()

Aucun signalement pour le moment. 🎉

# —

📅 📦 ✉️

1): ?>
1): ?>← Précédent Page / Suivant →