Publiczna aplikacja fdmtech.pl: renderer CMS, formularz audytu, szablony i logotypy

This commit is contained in:
FDMTech
2026-10-09 15:22:48 +02:00
commit 48b544c6b3
32 changed files with 1914 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
// PHP built-in server router: expose only real assets under public/assets.
if (PHP_SAPI === 'cli-server') {
$path = explode('?', $_SERVER['REQUEST_URI'] ?? '/', 2)[0];
$assetRoot = realpath(__DIR__ . '/assets');
$asset = realpath(__DIR__ . $path);
if ($assetRoot && $asset && str_starts_with($path, '/assets/') && str_starts_with($asset, $assetRoot . DIRECTORY_SEPARATOR)
&& is_file($asset) && preg_match('/\.(?:css|js|png|jpe?g|webp|gif|svg|ico|woff2?)$/i', $asset)) {
return false;
}
}
require dirname(__DIR__) . '/app/bootstrap.php';
ini_set('display_errors', '0');
try {
$config = \FDMTech\Config::load(dirname(__DIR__));
ini_set('session.use_strict_mode', '1');
ini_set('session.use_only_cookies', '1');
session_name('fdmtech_session');
session_set_cookie_params(['lifetime' => 0, 'path' => '/', 'secure' => $config->bool('SESSION_SECURE', true),
'httponly' => true, 'samesite' => 'Lax']);
if (!session_start()) {
throw new RuntimeException('Session storage unavailable');
}
$response = (new \FDMTech\Application($config))->handle($_SERVER, $_POST, $_SESSION);
session_write_close();
$response->send(($_SERVER['REQUEST_METHOD'] ?? '') === 'HEAD');
} catch (Throwable $error) {
error_log('FDMTech bootstrap failure [' . $error::class . ']');
(new \FDMTech\Response(503, '<!doctype html><html lang="pl"><meta charset="utf-8"><title>Serwis niedostępny</title><h1>Serwis jest chwilowo niedostępny</h1></html>',
['Content-Type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'no-store', 'Retry-After' => '60',
'Content-Security-Policy' => "default-src 'none'; frame-ancestors 'none'; base-uri 'none'", 'X-Robots-Tag' => 'noindex, nofollow']))
->send(($_SERVER['REQUEST_METHOD'] ?? '') === 'HEAD');
}