From da5e7a023cec055984fbaab81609d2ddd4bccf13 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 19 Aug 2007 12:07:53 +0000
Subject: [PATCH] Fixed a problem in the session initialization

---
 interface/lib/app.inc.php               | 16 ++++++++--------
 interface/lib/config.inc.php            |  2 +-
 interface/web/js/scrigo.js              |  2 +-
 interface/web/login/index.php           |  9 +++++----
 interface/web/mail/mail_domain_list.php |  3 ++-
 5 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index bf5df99fe9..353297a1ef 100644
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -53,15 +53,15 @@ class app {
 				$this->load('db_'.$this->_conf['db_type']);
 				$this->db = new db;
 		}
-		if($this->_conf['start_session'] == true) {
+		
+		//* Start the session
+		if($conf["start_session"] == true) {
 			session_start();
-            //* Initialise vars if session is not set
-            if( !isset($_SESSION['s']['id']) ){
-                $_SESSION['s'] = array( 'id' => session_id(), 
-                                        'theme' => $this->_conf['theme'], 
-                                        'language' => $this->_conf['language']
-                                        );
-            }
+			
+			//* Initialize session variables
+			if(!isset($_SESSION['s']['id']) ) $_SESSION["s"]['id'] = session_id();
+			if(empty($_SESSION["s"]["theme"])) $_SESSION["s"]['theme'] = $conf['theme'];
+			if(empty($_SESSION["s"]["language"])) $_SESSION["s"]['language'] = $conf['language'];
 		}
 	}
 
diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php
index 16f7557746..efe42f9c35 100644
--- a/interface/lib/config.inc.php
+++ b/interface/lib/config.inc.php
@@ -27,7 +27,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-error_reporting(E_ALL|E_STRICT);
+error_reporting(E_ALL|E_NOTICE);
 
 header('Pragma: no-cache');
 header('Cache-Control: no-store, no-cache, max-age=0, must-revalidate');
diff --git a/interface/web/js/scrigo.js b/interface/web/js/scrigo.js
index 26d270ad9d..703c626226 100644
--- a/interface/web/js/scrigo.js
+++ b/interface/web/js/scrigo.js
@@ -61,7 +61,7 @@ function submitLoginForm(formname) {
     var userNameObj = frm.username;
     if(userNameObj.value == ''){
         userNameObj.focus();
-        return;q
+        return;
     }
     var passwordObj = frm.passwort;
     if(passwordObj.value == ''){
diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index b59a760db1..7e1efad3f6 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -36,11 +36,12 @@ public $status = '';
 private $target = '';
 
 public function render() {
+	
 	if(isset($_SESSION['s']['user']) && is_array($_SESSION['s']['user']) && is_array($_SESSION['s']['module'])) {
 		die('HEADER_REDIRECT:'.$_SESSION['s']['module']['startpage']);
 	}
 	
-	global $app;
+	global $app, $conf;
 	$app->uses('tpl');
 	$app->tpl->newTemplate('form.tpl.htm');
     
@@ -64,14 +65,14 @@ public function render() {
                                 $_SESSION['s']['user'] = $user;
                                 $_SESSION['s']['user']['theme'] = isset($user['app_theme']) ? $user['app_theme'] : 'default';
                                 $_SESSION['s']['language'] = $user['language'];
-								//print_r($_SESSION);
+								$_SESSION["s"]['theme'] = $_SESSION['s']['user']['theme'];
+								
 								if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
 									include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php');
 									$_SESSION['s']['module'] = $module;
 								}
-								
 								echo 'HEADER_REDIRECT:'.$_SESSION['s']['module']['startpage'];
-								//echo 'HEADER_REDIRECT:content.php?s_mod=admin&s_pg=index';
+								
                                 exit;
                         } else {
                                 $error = $app->lng(1003);
diff --git a/interface/web/mail/mail_domain_list.php b/interface/web/mail/mail_domain_list.php
index ffe2ecd181..ee8d88c70c 100644
--- a/interface/web/mail/mail_domain_list.php
+++ b/interface/web/mail/mail_domain_list.php
@@ -12,8 +12,9 @@ $list_def_file = "list/mail_domain.list.php";
 * End Form configuration
 ******************************************/
 
+
 // Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
 	header("Location: ../index.php");
 	exit;
 }
-- 
GitLab