1
0

Добавлена загрузка rar, zip

1. Правка фронта
2. Правка бекенда
This commit is contained in:
2026-01-12 07:01:31 +07:00
parent 61c336b703
commit b4263bfe3f
5 changed files with 117 additions and 28 deletions

View File

@@ -1,9 +1,26 @@
<?php
// Игнорирование статических файлов
function ignore_favicon() {
// Обработка статических файлов
function routing_static_files() {
$requestUri = $_SERVER['REQUEST_URI'] ?? '';
if (preg_match('/\.(ico|png|jpg|jpeg|gif|css|js|svg|woff|woff2|ttf|eot)$/i', $requestUri)) {
$path = parse_url($requestUri, PHP_URL_PATH);
// Отдача файлов из /public/ (принудительное скачивание)
if (strpos($path, '/public/') === 0) {
$file = dirname(dirname(__DIR__)) . $path;
if (is_file($file)) {
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
readfile($file);
exit;
}
http_response_code(404);
exit;
}
// Игнорирование favicon и прочих статических запросов
if (preg_match('/\.(ico|css|js|woff|woff2|ttf|eot)$/i', $requestUri)) {
http_response_code(404);
exit;
}