From 2ef13cd37e25cab3febdf0e77ea8a71da3f5fd6a Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 26 Oct 2010 07:29:14 -0400
Subject: [PATCH] Fixed: FS#1358 - AWStats tools no in tools directory

---
 interface/lib/app.inc.php |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index 28ba6bc..a70b25c 100644
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -56,6 +56,15 @@
 
 		//* Start the session
 		if($this->_conf['start_session'] == true) {
+			
+			$this->uses('session');
+			session_set_save_handler(	array($this->session, 'open'),
+										array($this->session, 'close'),
+										array($this->session, 'read'),
+										array($this->session, 'write'),
+										array($this->session, 'destroy'),
+										array($this->session, 'gc'));
+			
 			session_start();
 
 			//* Initialize session variables
@@ -123,8 +132,20 @@
 		//$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);
@@ -203,6 +224,10 @@
 		if(isset($_SESSION['s']['user']) && $this->auth->has_clients($_SESSION['s']['user']['userid'])) {
 			$this->tpl->setVar('is_reseller', 1);
 		}
+		/* Show username */
+		if(isset($_SESSION['s']['user'])) {
+			$this->tpl->setVar('cpuser', $_SESSION['s']['user']['username']);
+		}
 	}
 
 } // end class

--
Gitblit v1.9.1