PMCORE-2115
This commit is contained in:
@@ -1291,7 +1291,7 @@ class OutputDocument extends BaseOutputDocument
|
|||||||
private static function generateCssFile()
|
private static function generateCssFile()
|
||||||
{
|
{
|
||||||
// Initialize variables
|
// 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 = '';
|
$css = '';
|
||||||
|
|
||||||
// Load the custom fonts list
|
// Load the custom fonts list
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Deny from all
|
Deny from all
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
||||||
<FilesMatch "^(app|sysGeneric|gmail|sso|templateForm|lostSession|uninstall)\.php">
|
<FilesMatch "^(app|sysGeneric|gmail|sso|templateForm|lostSession|uninstall|font|styles)\.php">
|
||||||
Order Allow,Deny
|
Order Allow,Deny
|
||||||
Allow from All
|
Allow from All
|
||||||
</FilesMatch>
|
</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