PMCORE-2115

This commit is contained in:
Julio Cesar Laura Avendaño
2020-08-31 19:29:26 +00:00
parent 58a95f605a
commit 161d61822a
4 changed files with 51 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
Deny from all
</FilesMatch>
<FilesMatch "^(app|sysGeneric|gmail|sso|templateForm|lostSession|uninstall)\.php">
<FilesMatch "^(app|sysGeneric|gmail|sso|templateForm|lostSession|uninstall|font|styles)\.php">
Order Allow,Deny
Allow from All
</FilesMatch>

View File

@@ -0,0 +1,25 @@
<?php
// Get the Home Directory, snippet adapted from sysGeneric.php
$documentRoot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$sections = explode('/', $documentRoot);
array_pop($sections);
$pathHome = implode('/', $sections) . '/';
// Include the "paths_installed.php" file
require_once $pathHome . 'engine/config/paths_installed.php';
// Get font file name requested
$fileName = $_REQUEST['file'] ?? '';
// Check if the requested font file exists and if is accessible
if (empty($fileName) || !file_exists(PATH_DATA . 'fonts/' . $fileName)) {
// Redirect to error page 404
header('Location: /errors/error404.php');
die();
} else {
// Stream the font file
header('Content-Disposition: inline; filename="' . $fileName . '"');
header('Content-Type: font/ttf');
readfile(PATH_DATA . 'fonts/' . $fileName);
}

View File

@@ -0,0 +1,24 @@
<?php
// Get the Home Directory, snippet adapted from sysGeneric.php
$documentRoot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$sections = explode('/', $documentRoot);
array_pop($sections);
$pathHome = implode('/', $sections) . '/';
// Include the "paths_installed.php" file
require_once $pathHome . 'engine/config/paths_installed.php';
// Set the fonts styles file
$fileName = 'fonts.css';
// Check if the requested css file exists and if is accessible
if (!file_exists(PATH_DATA . 'fonts/tcpdf/' . $fileName)) {
// Redirect to error page 404
header('Location: /errors/error404.php');
die();
} else {
// Stream the font file
header('Content-Type: text/css');
readfile(PATH_DATA . 'fonts/tcpdf/' . $fileName);
}