From 903ede0a4bd6edadb913bf84b03bed6b98d14e11 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Wed, 12 May 2010 14:56:08 +0000
Subject: [PATCH] Fixed a bug with the new template-handling in combination
 with the new error-handling

---
 interface/lib/app.inc.php | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index 8694324984..76a3cd2305 100644
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -123,8 +123,20 @@ class app {
 		//$this->uses("error");
 		//$this->error->message($msg, $priority);
 		if($stop == true) {
-			$content = file_get_contents(dirname(__FILE__) .
-					'/../web/themes/' . $_SESSION['s']['theme'] . '/templates/error.tpl.htm');
+			/*
+			 * We always have a error. So it is better not to use any more objects like
+			 * the template or so, because we don't know why the error occours (it could be, that
+			 * the error occours in one of these objects..)
+			 */
+			/*
+			 * Use the template inside the user-template - Path. If it is not found, fallback to the
+			 * default-template (the "normal" behaviour of all template - files)
+			 */
+			if (file_exists(dirname(__FILE__) . '/../web/themes/' . $_SESSION['s']['theme'] . '/templates/error.tpl.htm')) {
+				$content = file_get_contents(dirname(__FILE__) . '/../web/themes/' . $_SESSION['s']['theme'] . '/templates/error.tpl.htm');
+			} else {
+				$content = file_get_contents(dirname(__FILE__) . '/../web/themes/default/templates/error.tpl.htm');
+			}
 			if($next_link != '') $msg .= '<a href="'.$next_link.'">Next</a>';
 			$content = str_replace('###ERRORMSG###', $msg, $content);
 			die($content);
-- 
GitLab