From 614bcdd887c5fc80a8b5a12c82d7291d31560b4a Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sat, 2 Dec 2023 22:00:43 +0100 Subject: [PATCH] Custom block: check if constants are defined and if files actually exist --- index.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 274d07a..db75619 100644 --- a/index.php +++ b/index.php @@ -70,19 +70,23 @@ if (isset($_SESSION[LookingGlass::SESSION_ERROR_MESSAGE])) { } if (LG_BLOCK_CUSTOM) { - include LG_CUSTOM_PHP; + if (defined('LG_CUSTOM_PHP') && file_exists(LG_CUSTOM_PHP)) { + include LG_CUSTOM_PHP; + } - ob_start(); - include LG_CUSTOM_HTML; - $templateData['custom_html'] = ob_get_clean(); + if (defined('LG_CUSTOM_HTML') && file_exists(LG_CUSTOM_HTML)) { + ob_start(); + include LG_CUSTOM_HTML; + $templateData['custom_html'] = ob_get_clean(); + } - if (defined('LG_CUSTOM_HEADER_PHP')) { + if (defined('LG_CUSTOM_HEADER_PHP') && file_exists(LG_CUSTOM_HEADER_PHP)) { ob_start(); include LG_CUSTOM_HEADER_PHP; $templateData['custom_header'] = ob_get_clean(); } - if (defined('LG_CUSTOM_FOOTER_PHP')) { + if (defined('LG_CUSTOM_FOOTER_PHP') && file_exists(LG_CUSTOM_FOOTER_PHP)) { ob_start(); include LG_CUSTOM_FOOTER_PHP; $templateData['custom_footer'] = ob_get_clean();