- Introduced new `SettingsRepository` and `CacheRepository` classes in the `autoload\Domain` namespace. - Updated `SettingsController` in the `admin\Controllers` namespace to enhance settings management. - Added new templates for settings in `admin\templates\settings` and `admin\templates\site`. - Improved overall structure and organization of settings-related files.
58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
error_reporting( E_ALL & ~E_NOTICE & ~E_WARNING );
|
|
function __autoload_my_classes( $classname )
|
|
{
|
|
$q = explode( '\\' , $classname );
|
|
$c = array_pop( $q );
|
|
$f = 'autoload/' . implode( '/' , $q ) . '/class.' . $c . '.php';
|
|
|
|
if ( file_exists( $f ) )
|
|
require_once( $f );
|
|
else
|
|
{
|
|
$f = 'autoload/' . implode( '/' , $q ) . '/' . $c . '.php';
|
|
if ( file_exists( $f ) )
|
|
require_once( $f );
|
|
}
|
|
}
|
|
spl_autoload_register( '__autoload_my_classes' );
|
|
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.' );
|
|
?>
|