false, 'error'=>'Invalid request.']); exit; } $out = ''; $code = 0; if ($action === 'quarantine') { $res = bg_quarantine_alert_path($path); $code = (int)($res['code'] ?? 1); $out = trim((string)($res['output'] ?? '')); if ($code !== 0) { echo json_encode(['ok'=>false, 'error'=>$out ?: 'Quarantine failed.', 'code'=>$code], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); exit; } } bg_alert_mark_handled($id, $action); echo json_encode(['ok'=>true, 'output'=>$out], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);