diff --git a/controllers/TicketController.php b/controllers/TicketController.php index 5172336..1076220 100644 --- a/controllers/TicketController.php +++ b/controllers/TicketController.php @@ -36,16 +36,9 @@ class TicketController { // Get ticket data $ticket = $this->ticketModel->getTicketById($id); - if (!$ticket) { - header("HTTP/1.0 404 Not Found"); - echo "Ticket not found"; - return; - } - - // Check visibility access — return 404 rather than 403 to avoid leaking ticket existence - if (!$this->ticketModel->canUserAccessTicket($ticket, $currentUser)) { - header("HTTP/1.0 404 Not Found"); - echo "Ticket not found"; + if (!$ticket || !$this->ticketModel->canUserAccessTicket($ticket, $currentUser)) { + http_response_code(404); + include dirname(__DIR__) . '/views/error_404.php'; return; }