You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Controllers/LegalController.php

38 lines
1.2 KiB
PHP

<?php
namespace App\Controllers;
use App\Services\LegalDocumentService;
final class LegalController extends HomeController
{
public function terms($request, $response, $args)
{
return $this->renderDocument($request, $response, 'terms');
}
public function privacy($request, $response, $args)
{
return $this->renderDocument($request, $response, 'privacy');
}
private function renderDocument($request, $response, string $slug)
{
$locale = $this->publicLocale;
$document = LegalDocumentService::published($slug, $locale, (string) $this->appName);
$smarty = $this->publicView('legal.' . $slug)->assign([
'cdn' => $this->cdn,
'backup_cdn' => $this->backup_cdn,
'appName' => $this->appName,
'seo' => $this->seo,
'legal_document' => $document,
'legal_slug' => $slug,
]);
$response->getBody()->write($smarty->fetch('legal.tpl'));
return $response
->withHeader('Cache-Control', 'public, max-age=60')
->withHeader('Vary', 'Accept-Language, Cookie')
->withHeader('X-Content-Type-Options', 'nosniff');
}
}