From e1ceb050e19c7574bca146a8da7047ee4ff456b5 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Sun, 10 Jul 2016 05:02:35 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 interface/web/index.php |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/interface/web/index.php b/interface/web/index.php
index 80eab11..4a21032 100644
--- a/interface/web/index.php
+++ b/interface/web/index.php
@@ -31,10 +31,18 @@
 require_once '../lib/config.inc.php';
 require_once '../lib/app.inc.php';
 
-if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'login';
+// Check if we have an active users ession and redirect to login if thats not the case.
+if($_SESSION['s']['user']['active'] != 1) {
+	header('Location: /login/');
+	die();
+}
+
+if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'dashboard';
 
 $app->uses('tpl');
 $app->tpl->newTemplate('main.tpl.htm');
+$app->tpl->setVar('startpage', isset($_SESSION['s']['module']['startpage']) ? $_SESSION['s']['module']['startpage'] : '');
+$app->tpl->setVar('logged_in', ($_SESSION['s']['user']['active'] != 1 ? 'n' : 'y'));
 
 // tab change warning?
 // read misc config
@@ -50,6 +58,14 @@
 if($sys_config['tab_change_discard'] == 'y') {
 	$app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
 }
+
+if($sys_config['use_loadindicator'] == 'y') {
+	$app->tpl->setVar('use_loadindicator', 'y');
+}
+if($sys_config['use_combobox'] == 'y') {
+	$app->tpl->setVar('use_combobox', 'y');
+}
+
 
 if(isset($_SESSION['show_info_msg'])) {
 	$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
@@ -77,6 +93,26 @@
 if (!empty($js_d_files)) $app->tpl->setLoop('js_d_includes', $js_d_files);
 unset($js_d_files);
 
+$app->tpl->setVar('current_theme', isset($_SESSION['s']['theme']) ? $_SESSION['s']['theme'] : 'default');
+
+// Logo
+$logo = $app->db->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1");
+if($logo['custom_logo'] != ''){
+	$base64_logo_txt = $logo['custom_logo'];
+} else {
+	$base64_logo_txt = $logo['default_logo'];
+}
+$tmp_base64 = explode(',', $base64_logo_txt, 2);
+$logo_dimensions = $app->functions->getimagesizefromstring(base64_decode($tmp_base64[1]));
+$app->tpl->setVar('base64_logo_width', $logo_dimensions[0].'px');
+$app->tpl->setVar('base64_logo_height', $logo_dimensions[1].'px');
+$app->tpl->setVar('base64_logo_txt', $base64_logo_txt);
+
+// Title
+if (!empty($sys_config['company_name'])) {
+	$app->tpl->setVar('company_name', $sys_config['company_name']. ' :: ');
+}
+
 $app->tpl_defaults();
 $app->tpl->pparse();
 ?>

--
Gitblit v1.9.1