Files
cmsPRO/download.php
Jacek Pyziak 3325eaf44c refactor: centralny autoloader, Shared\Email i Shared\Security
- Utworzono autoload/autoloader.php (hybrydowy PSR-4 + legacy)
- Zmigrowano 7 entry pointów do centralnego autoloadera
- Dodano PSR-4 mapowanie w composer.json (Domain, Shared, Admin, Frontend)
- Utworzono Shared\Email\Email (PHPMailer, migracja z Helpers)
- Utworzono Shared\Security\CsrfToken (random_bytes + hash_equals)
- Wrappery w Helpers delegują do nowych klas
- Zaktualizowano docs/PROJECT_STRUCTURE.md
- Inicjalizacja PAUL (.paul/) z roadmapą 19 faz refaktoryzacji

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 17:28:01 +02:00

43 lines
1.3 KiB
PHP

<?php
error_reporting( E_ALL & ~E_NOTICE & ~E_WARNING );
require_once __DIR__ . '/autoload/autoloader.php';
date_default_timezone_set( 'Europe/Warsaw' );
require_once 'config.php';
require_once 'libraries/medoo/medoo.php';
session_start();
$mdb = new medoo( [
'database_type' => 'mysql',
'database_name' => $database['name'],
'server' => $database['host'],
'username' => $database['user'],
'password' => $database['password'],
'charset' => 'utf8'
] );
if ( $file_id = \S::get( 'file' ) )
{
$result = $mdb -> get( 'pp_articles_files', [ 'src' ], [ 'id' => $file_id ] );
if ( $result )
{
$file = ltrim( $result['src'], '/' );
if ( file_exists( $file ) )
{
header( 'Content-Description: File Transfer' );
header( 'Content-Type: application/octet-stream' );
header( 'Content-Disposition: attachment; filename=' . basename( $file ) );
header( 'Expires: 0');
header( 'Cache-Control: must-revalidate');
header( 'Pragma: public');
header( 'Content-Length: ' . filesize( $file ) );
readfile( $file );
exit;
}
}
}
header( 'Content-Type: text/html; charset=utf-8' );
exit( 'Nieprawidłowy plik.' );
?>