pour prod

This commit is contained in:
Loic Masi
2026-08-07 16:13:43 +02:00
commit 5fbf76868f
157 changed files with 24085 additions and 0 deletions

27
app/Core/PdfResponse.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Core;
final class PdfResponse
{
public static function inline(string $content, string $filename): void
{
$safeFilename = preg_replace('/[^A-Za-z0-9._-]+/', '_', $filename) ?: 'planning.pdf';
if (!str_ends_with(strtolower($safeFilename), '.pdf')) {
$safeFilename .= '.pdf';
}
if (!headers_sent()) {
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $safeFilename . '"');
header('Content-Length: ' . strlen($content));
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
}
echo $content;
exit;
}
}