PMCORE-2115
This commit is contained in:
@@ -1291,7 +1291,7 @@ class OutputDocument extends BaseOutputDocument
|
||||
private static function generateCssFile()
|
||||
{
|
||||
// Initialize variables
|
||||
$template = "@font-face {font-family: @familyName;src: url(@fileName) format('truetype');@properties}\n";
|
||||
$template = "@font-face {font-family: @familyName;src: url(/fonts/font.php?file=@fileName) format('truetype');@properties}\n";
|
||||
$css = '';
|
||||
|
||||
// Load the custom fonts list
|
||||
|
||||
@@ -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>
|
||||
|
||||
25
workflow/public_html/fonts/font.php
Normal file
25
workflow/public_html/fonts/font.php
Normal 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);
|
||||
}
|
||||
24
workflow/public_html/fonts/styles.php
Normal file
24
workflow/public_html/fonts/styles.php
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user