From c420196e73eeb473b3d317234f4c6cfb29131df0 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 10 Jan 2023 16:53:36 +0100 Subject: [PATCH] check explicitly for template existence and try to use default theme as fallback; fixes #1071 Signed-off-by: Michael Kaufmann --- lib/Froxlor/UI/Panel/UI.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Froxlor/UI/Panel/UI.php b/lib/Froxlor/UI/Panel/UI.php index 7ddddd9d..bf6ace51 100644 --- a/lib/Froxlor/UI/Panel/UI.php +++ b/lib/Froxlor/UI/Panel/UI.php @@ -260,8 +260,17 @@ class UI */ public static function twigBuffer($name, array $context = []) { + $template_file = self::getTheme() . '/' . $name; + if (!file_exists(Froxlor::getInstallDir() . '/templates/' . $template_file)) { + PhpHelper::phpErrHandler(E_USER_WARNING, "Template '" . $template_file . "' could not be found, trying fallback theme", __FILE__, __LINE__); + $template_file = self::$default_theme . '/'. $name; + if (!file_exists(Froxlor::getInstallDir() . '/templates/' . $template_file)) { + PhpHelper::phpErrHandler(E_USER_ERROR, "Unknown template '" . $template_file . "'", __FILE__, __LINE__); + } + } + self::$twigbuf[] = [ - self::getTheme() . '/' . $name => $context + $template_file => $context ]; }