Browse Source

implement transaction key/value download

master
ghost 10 months ago
parent
commit
b38db16386
  1. 69
      src/Controller/MainController.php

69
src/Controller/MainController.php

@ -139,13 +139,68 @@ class MainController extends AbstractController @@ -139,13 +139,68 @@ class MainController extends AbstractController
{
if ($record['transaction'] === $request->get('transaction'))
{
return $this->render(
'default/main/transaction.html.twig',
[
'request' => $request,
'record' => $record
]
);
switch ($request->get('get'))
{
case 'key':
$response = new Response();
$response->headers->set(
'Content-length',
strlen(
$record['key']
)
);
$response->headers->set(
'Content-Disposition',
sprintf(
'attachment; filename="%s.key";',
$request->get('transaction')
)
);
$response->sendHeaders();
return $response->setContent(
$record['key']
);
case 'value':
$response = new Response();
$response->headers->set(
'Content-length',
strlen(
$record['value']
)
);
$response->headers->set(
'Content-Disposition',
sprintf(
'attachment; filename="%s.value";',
$request->get('transaction')
)
);
$response->sendHeaders();
return $response->setContent(
$record['value']
);
default:
return $this->render(
'default/main/transaction.html.twig',
[
'request' => $request,
'record' => $record
]
);
}
}
}

Loading…
Cancel
Save