From b8f9e0d52d6a25746afbb0f57bd8d6cc6bde6466 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 13 Jun 2023 18:55:52 +0000 Subject: [PATCH] Quick backup before crash --- Mpdf/Mpdf.php | 6 +- Psr/Log/LoggerAwareInterface.php | 2 +- tcpdf/config/tcpdf_config.php | 70 ++++++------- tcpdf/tcpdf_autoconfig.php | 170 +++++++------------------------ 4 files changed, 75 insertions(+), 173 deletions(-) diff --git a/Mpdf/Mpdf.php b/Mpdf/Mpdf.php index 83591db..ec3280b 100755 --- a/Mpdf/Mpdf.php +++ b/Mpdf/Mpdf.php @@ -1550,11 +1550,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface } /** - * @param \Psr\Log\LoggerInterface - * - * @return void + * {@inheritdoc} */ - public function setLogger(LoggerInterface $logger) + public function setLogger(LoggerInterface $logger) : void { $this->logger = $logger; diff --git a/Psr/Log/LoggerAwareInterface.php b/Psr/Log/LoggerAwareInterface.php index 4d64f47..7fbd757 100755 --- a/Psr/Log/LoggerAwareInterface.php +++ b/Psr/Log/LoggerAwareInterface.php @@ -14,5 +14,5 @@ interface LoggerAwareInterface * * @return void */ - public function setLogger(LoggerInterface $logger); + public function setLogger(LoggerInterface $logger) : void; } diff --git a/tcpdf/config/tcpdf_config.php b/tcpdf/config/tcpdf_config.php index 92317b1..45dce79 100755 --- a/tcpdf/config/tcpdf_config.php +++ b/tcpdf/config/tcpdf_config.php @@ -45,182 +45,182 @@ * Installation path (/var/www/tcpdf/). * By default it is automatically calculated but you can also set it as a fixed string to improve performances. */ -//define ('K_PATH_MAIN', ''); +//const K_PATH_MAIN = ''; /** * URL path to tcpdf installation folder (http://localhost/tcpdf/). * By default it is automatically set but you can also set it as a fixed string to improve performances. */ -//define ('K_PATH_URL', ''); +//const K_PATH_URL = ''; /** * Path for PDF fonts. * By default it is automatically set but you can also set it as a fixed string to improve performances. */ -//define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); +//const K_PATH_FONTS = K_PATH_MAIN.'fonts/'; /** * Default images directory. * By default it is automatically set but you can also set it as a fixed string to improve performances. */ -//define ('K_PATH_IMAGES', ''); +//const K_PATH_IMAGES = ''; /** * Deafult image logo used be the default Header() method. * Please set here your own logo or an empty string to disable it. */ -//define ('PDF_HEADER_LOGO', ''); +const PDF_HEADER_LOGO = ''; /** * Header logo image width in user units. */ -//define ('PDF_HEADER_LOGO_WIDTH', 0); +const PDF_HEADER_LOGO_WIDTH = 0; /** * Cache directory for temporary files (full path). */ -//define ('K_PATH_CACHE', '/tmp/'); +//const K_PATH_CACHE = '/tmp/'; /** * Generic name for a blank image. */ -define ('K_BLANK_IMAGE', '_blank.png'); +const K_BLANK_IMAGE = '_blank.png'; /** * Page format. */ -define ('PDF_PAGE_FORMAT', 'A4'); +const PDF_PAGE_FORMAT = 'A4'; /** * Page orientation (P=portrait, L=landscape). */ -define ('PDF_PAGE_ORIENTATION', 'P'); +const PDF_PAGE_ORIENTATION = 'P'; /** * Document creator. */ -define ('PDF_CREATOR', 'TCPDF'); +const PDF_CREATOR = 'TCPDF'; /** * Document author. */ -define ('PDF_AUTHOR', 'TCPDF'); +const PDF_AUTHOR = 'TCPDF'; /** * Header title. */ -define ('PDF_HEADER_TITLE', 'TCPDF Example'); +const PDF_HEADER_TITLE = 'TCPDF Example'; /** * Header description string. */ -define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); +const PDF_HEADER_STRING = "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"; /** * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]. */ -define ('PDF_UNIT', 'mm'); +const PDF_UNIT = 'mm'; /** * Header margin. */ -define ('PDF_MARGIN_HEADER', 5); +const PDF_MARGIN_HEADER = 5; /** * Footer margin. */ -define ('PDF_MARGIN_FOOTER', 10); +const PDF_MARGIN_FOOTER = 10; /** * Top margin. */ -define ('PDF_MARGIN_TOP', 27); +const PDF_MARGIN_TOP = 27; /** * Bottom margin. */ -define ('PDF_MARGIN_BOTTOM', 25); +const PDF_MARGIN_BOTTOM = 25; /** * Left margin. */ -define ('PDF_MARGIN_LEFT', 15); +const PDF_MARGIN_LEFT = 15; /** * Right margin. */ -define ('PDF_MARGIN_RIGHT', 15); +const PDF_MARGIN_RIGHT = 15; /** * Default main font name. */ -define ('PDF_FONT_NAME_MAIN', 'helvetica'); +const PDF_FONT_NAME_MAIN = 'helvetica'; /** * Default main font size. */ -define ('PDF_FONT_SIZE_MAIN', 10); +const PDF_FONT_SIZE_MAIN = 10; /** * Default data font name. */ -define ('PDF_FONT_NAME_DATA', 'helvetica'); +const PDF_FONT_NAME_DATA = 'helvetica'; /** * Default data font size. */ -define ('PDF_FONT_SIZE_DATA', 8); +const PDF_FONT_SIZE_DATA = 8; /** * Default monospaced font name. */ -define ('PDF_FONT_MONOSPACED', 'courier'); +const PDF_FONT_MONOSPACED = 'courier'; /** * Ratio used to adjust the conversion of pixels to user units. */ -define ('PDF_IMAGE_SCALE_RATIO', 1.25); +const PDF_IMAGE_SCALE_RATIO = 1.25; /** * Magnification factor for titles. */ -define('HEAD_MAGNIFICATION', 1.1); +const HEAD_MAGNIFICATION = 1.1; /** * Height of cell respect font height. */ -define('K_CELL_HEIGHT_RATIO', 1.25); +const K_CELL_HEIGHT_RATIO = 1.25; /** * Title magnification respect main font size. */ -define('K_TITLE_MAGNIFICATION', 1.3); +const K_TITLE_MAGNIFICATION = 1.3; /** * Reduction factor for small font. */ -define('K_SMALL_RATIO', 2/3); +const K_SMALL_RATIO = 2/3; /** * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language. */ -define('K_THAI_TOPCHARS', true); +const K_THAI_TOPCHARS = true; /** * If true allows to call TCPDF methods using HTML syntax * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. */ -define('K_TCPDF_CALLS_IN_HTML', false); +const K_TCPDF_CALLS_IN_HTML = false; /** * If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. */ -define('K_TCPDF_THROW_EXCEPTION_ERROR', false); +const K_TCPDF_THROW_EXCEPTION_ERROR = false; /** * Default timezone for datetime functions */ -define('K_TIMEZONE', 'UTC'); +const K_TIMEZONE = 'UTC'; //============================================================+ // END OF FILE diff --git a/tcpdf/tcpdf_autoconfig.php b/tcpdf/tcpdf_autoconfig.php index 6ec9ce8..5c8e9aa 100755 --- a/tcpdf/tcpdf_autoconfig.php +++ b/tcpdf/tcpdf_autoconfig.php @@ -43,25 +43,25 @@ // DOCUMENT_ROOT fix for IIS Webserver if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { if(isset($_SERVER['SCRIPT_FILENAME'])) { - $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); + $_SERVER['DOCUMENT_ROOT'] = \str_replace( '\\', '/', \substr($_SERVER['SCRIPT_FILENAME'], 0, 0-\strlen($_SERVER['PHP_SELF']))); } elseif(isset($_SERVER['PATH_TRANSLATED'])) { - $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); + $_SERVER['DOCUMENT_ROOT'] = \str_replace( '\\', '/', \substr(\str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-\strlen($_SERVER['PHP_SELF']))); } else { // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') $_SERVER['DOCUMENT_ROOT'] = '/'; } } -$_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT']); -if (substr($_SERVER['DOCUMENT_ROOT'], -1) != '/') { +$_SERVER['DOCUMENT_ROOT'] = \str_replace('//', '/', $_SERVER['DOCUMENT_ROOT']); +if (\substr($_SERVER['DOCUMENT_ROOT'], -1) != '/') { $_SERVER['DOCUMENT_ROOT'] .= '/'; } // Load main configuration file only if the K_TCPDF_EXTERNAL_CONFIG constant is set to false. if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) { // define a list of default config files in order of priority - $tcpdf_config_files = array(dirname(__FILE__).'/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php'); + $tcpdf_config_files = array(__DIR__ . '/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php'); foreach ($tcpdf_config_files as $tcpdf_config) { - if (@file_exists($tcpdf_config) AND is_readable($tcpdf_config)) { + if (\is_file($tcpdf_config) AND \is_readable($tcpdf_config)) { require_once($tcpdf_config); break; } @@ -69,170 +69,74 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) { } if (!defined('K_PATH_MAIN')) { - define ('K_PATH_MAIN', dirname(__FILE__).'/'); + define('K_PATH_MAIN', __DIR__ . '/'); } if (!defined('K_PATH_FONTS')) { - define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); + define('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); } if (!defined('K_PATH_URL')) { $k_path_url = K_PATH_MAIN; // default value for console mode if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { - if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { + if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (\strtolower($_SERVER['HTTPS']) != 'off')) { $k_path_url = 'https://'; } else { $k_path_url = 'http://'; } $k_path_url .= $_SERVER['HTTP_HOST']; - $k_path_url .= str_replace( '\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); + $k_path_url .= \str_replace( '\\', '/', \substr(K_PATH_MAIN, (\strlen($_SERVER['DOCUMENT_ROOT']) - 1))); } - define ('K_PATH_URL', $k_path_url); + define('K_PATH_URL', $k_path_url); } if (!defined('K_PATH_IMAGES')) { $tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', K_PATH_MAIN.'images/', '/usr/share/doc/php-tcpdf/examples/images/', '/usr/share/doc/tcpdf/examples/images/', '/usr/share/doc/php/tcpdf/examples/images/', '/var/www/tcpdf/images/', '/var/www/html/tcpdf/images/', '/usr/local/apache2/htdocs/tcpdf/images/', K_PATH_MAIN); foreach ($tcpdf_images_dirs as $tcpdf_images_path) { - if (@file_exists($tcpdf_images_path)) { - define ('K_PATH_IMAGES', $tcpdf_images_path); + if (\is_dir($tcpdf_images_path)) { + define('K_PATH_IMAGES', $tcpdf_images_path); break; } } } -if (!defined('PDF_HEADER_LOGO')) { - $tcpdf_header_logo = ''; - if (@file_exists(K_PATH_IMAGES.'tcpdf_logo.jpg')) { - $tcpdf_header_logo = 'tcpdf_logo.jpg'; - } - define ('PDF_HEADER_LOGO', $tcpdf_header_logo); -} - -if (!defined('PDF_HEADER_LOGO_WIDTH')) { - if (!empty($tcpdf_header_logo)) { - define ('PDF_HEADER_LOGO_WIDTH', 30); - } else { - define ('PDF_HEADER_LOGO_WIDTH', 0); - } -} - if (!defined('K_PATH_CACHE')) { - $K_PATH_CACHE = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(); - if (substr($K_PATH_CACHE, -1) != '/') { + $K_PATH_CACHE = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : \sys_get_temp_dir(); + if (\substr($K_PATH_CACHE, -1) != '/') { $K_PATH_CACHE .= '/'; } - define ('K_PATH_CACHE', $K_PATH_CACHE); + define('K_PATH_CACHE', $K_PATH_CACHE); } +// defined in tcpdf_config.php if (!defined('K_BLANK_IMAGE')) { - define ('K_BLANK_IMAGE', '_blank.png'); -} - -if (!defined('PDF_PAGE_FORMAT')) { - define ('PDF_PAGE_FORMAT', 'A4'); -} - -if (!defined('PDF_PAGE_ORIENTATION')) { - define ('PDF_PAGE_ORIENTATION', 'P'); -} - -if (!defined('PDF_CREATOR')) { - define ('PDF_CREATOR', 'TCPDF'); -} - -if (!defined('PDF_AUTHOR')) { - define ('PDF_AUTHOR', 'TCPDF'); -} - -if (!defined('PDF_HEADER_TITLE')) { - define ('PDF_HEADER_TITLE', 'TCPDF Example'); -} - -if (!defined('PDF_HEADER_STRING')) { - define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); -} - -if (!defined('PDF_UNIT')) { - define ('PDF_UNIT', 'mm'); -} - -if (!defined('PDF_MARGIN_HEADER')) { - define ('PDF_MARGIN_HEADER', 5); -} - -if (!defined('PDF_MARGIN_FOOTER')) { - define ('PDF_MARGIN_FOOTER', 10); -} - -if (!defined('PDF_MARGIN_TOP')) { - define ('PDF_MARGIN_TOP', 27); -} - -if (!defined('PDF_MARGIN_BOTTOM')) { - define ('PDF_MARGIN_BOTTOM', 25); -} - -if (!defined('PDF_MARGIN_LEFT')) { - define ('PDF_MARGIN_LEFT', 15); -} - -if (!defined('PDF_MARGIN_RIGHT')) { - define ('PDF_MARGIN_RIGHT', 15); -} - -if (!defined('PDF_FONT_NAME_MAIN')) { - define ('PDF_FONT_NAME_MAIN', 'helvetica'); -} - -if (!defined('PDF_FONT_SIZE_MAIN')) { - define ('PDF_FONT_SIZE_MAIN', 10); -} - -if (!defined('PDF_FONT_NAME_DATA')) { - define ('PDF_FONT_NAME_DATA', 'helvetica'); -} - -if (!defined('PDF_FONT_SIZE_DATA')) { - define ('PDF_FONT_SIZE_DATA', 8); -} - -if (!defined('PDF_FONT_MONOSPACED')) { - define ('PDF_FONT_MONOSPACED', 'courier'); -} - -if (!defined('PDF_IMAGE_SCALE_RATIO')) { - define ('PDF_IMAGE_SCALE_RATIO', 1.25); -} - -if (!defined('HEAD_MAGNIFICATION')) { + define('K_BLANK_IMAGE', '_blank.png'); + define('PDF_PAGE_FORMAT', 'A4'); + define('PDF_PAGE_ORIENTATION', 'P'); + define('PDF_CREATOR', 'TCPDF'); + define('PDF_AUTHOR', 'TCPDF'); + define('PDF_HEADER_TITLE', 'TCPDF Example'); + define('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); + define('PDF_UNIT', 'mm'); + define('PDF_MARGIN_HEADER', 5); + define('PDF_MARGIN_FOOTER', 10); + define('PDF_MARGIN_TOP', 27); + define('PDF_MARGIN_BOTTOM', 25); + define('PDF_MARGIN_LEFT', 15); + define('PDF_MARGIN_RIGHT', 15); + define('PDF_FONT_NAME_MAIN', 'helvetica'); + define('PDF_FONT_SIZE_MAIN', 10); + define('PDF_FONT_NAME_DATA', 'helvetica'); + define('PDF_FONT_SIZE_DATA', 8); + define('PDF_FONT_MONOSPACED', 'courier'); + define('PDF_IMAGE_SCALE_RATIO', 1.25); define('HEAD_MAGNIFICATION', 1.1); -} - -if (!defined('K_CELL_HEIGHT_RATIO')) { define('K_CELL_HEIGHT_RATIO', 1.25); -} - -if (!defined('K_TITLE_MAGNIFICATION')) { define('K_TITLE_MAGNIFICATION', 1.3); -} - -if (!defined('K_SMALL_RATIO')) { define('K_SMALL_RATIO', 2/3); -} - -if (!defined('K_THAI_TOPCHARS')) { define('K_THAI_TOPCHARS', true); -} - -if (!defined('K_TCPDF_CALLS_IN_HTML')) { define('K_TCPDF_CALLS_IN_HTML', false); -} - -if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) { define('K_TCPDF_THROW_EXCEPTION_ERROR', false); -} - -if (!defined('K_TIMEZONE')) { define('K_TIMEZONE', @date_default_timezone_get()); }