Files
nexus/modules/fx-rates/pages/asset.php
Lars Gebhardt-Kusche 77bc307781
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped
asdsd
2026-05-02 02:59:46 +02:00

32 lines
787 B
PHP

<?php
$file = (string) ($_GET['file'] ?? '');
$base = realpath(__DIR__ . '/../assets');
$map = [
'fx-rates.css' => $base . '/fx-rates.css',
'fx-rates.js' => $base . '/fx-rates.js',
'fx-rates-currencies.js' => $base . '/fx-rates-currencies.js',
];
if (!isset($map[$file])) {
http_response_code(404);
exit('Not found');
}
$path = $map[$file];
if (!$base || !is_file($path) || !str_starts_with($path, $base)) {
http_response_code(404);
exit('Not found');
}
$ext = pathinfo($path, PATHINFO_EXTENSION);
if ($ext === 'css') {
header('Content-Type: text/css; charset=utf-8');
} elseif ($ext === 'js') {
header('Content-Type: application/javascript; charset=utf-8');
} else {
header('Content-Type: application/octet-stream');
}
readfile($path);
exit;