From dd0130670fe3cab4c7e2c1ab4f3bf0d2b2d512b0 Mon Sep 17 00:00:00 2001
From: Denny Bortfeldt <denny@bortfeldt.net>
Date: Mon, 27 Jun 2016 18:02:16 -0400
Subject: [PATCH] When uploading a logo which is smaller than the current ispconfig one, then the logo will be on the left side of the header. In my opinion it will look better when it's centered. You could vote about it ;)
---
interface/web/index.php | 132 +++++++++++++++++++++++++------------------
1 files changed, 77 insertions(+), 55 deletions(-)
diff --git a/interface/web/index.php b/interface/web/index.php
index 28476f2..4a21032 100644
--- a/interface/web/index.php
+++ b/interface/web/index.php
@@ -1,7 +1,7 @@
<?php
/*
-Copyright (c) 2005, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -28,69 +28,91 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
+
+// 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->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'));
-
-// Checke User Login and current module
-if(!is_array($_SESSION["s"]['user']) or !is_array($_SESSION["s"]["module"])) {
- // Loading Login Module
- include_once('login/lib/module.conf.php');
- $_SESSION["s"]['module'] = $module;
- $topnav[] = array( 'title' => "Login",
- 'active' => 1);
- $module = null;
- unset($module);
+// tab change warning?
+// read misc config
+$app->uses('getconf');
+$sys_config = $app->getconf->get_global_config('misc');
+if($sys_config['tab_change_warning'] == 'y') {
+ $app->tpl->setVar('tabchange_warning_enabled', 'y');
+ $app->tpl->setVar('global_tabchange_warning_txt', $app->lng('global_tabchange_warning_txt'));
} else {
- // Loading modules of the user and building top navigation
- $modules = explode(',',$_SESSION["s"]["user"]["modules"]);
- if(is_array($modules)) {
- foreach($modules as $mt) {
- if(is_file($mt."/lib/module.conf.php")) {
- include_once($mt."/lib/module.conf.php");
- $active = ($module["name"] == $_SESSION["s"]["module"]["name"])?1:0;
- $topnav[] = array( 'title' => $app->lng($module["title"]),
- 'active' => $active,
- 'module' => $module["name"]);
- }
- }
- }
+ $app->tpl->setVar('tabchange_warning_enabled', 'n');
+}
+$app->tpl->setVar('tabchange_discard_enabled', $sys_config['tab_change_discard']);
+if($sys_config['tab_change_discard'] == 'y') {
+ $app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
}
-// Topnavigation
-$app->tpl->setLoop('nav_top',$topnav);
-
-// Loading Module part
-$app->tpl->setInclude('module_tpl',$_SESSION["s"]["module"]["template"]);
-
-// translating module navigation
-$nav_translated = array();
-if(is_array($_SESSION["s"]["module"]["nav"])) {
- foreach($_SESSION["s"]["module"]["nav"] as $nav) {
- $tmp_items = array();
- foreach($nav["items"] as $item) {
- $item["title"] = $app->lng($item["title"]);
- $tmp_items[] = $item;
- }
- $nav["title"] = $app->lng($nav["title"]);
- $nav["items"] = $tmp_items;
- $nav_translated[] = $nav;
- }
-} else {
- $nav_translated = null;
+if($sys_config['use_loadindicator'] == 'y') {
+ $app->tpl->setVar('use_loadindicator', 'y');
+}
+if($sys_config['use_combobox'] == 'y') {
+ $app->tpl->setVar('use_combobox', 'y');
}
-// Loading left navigation
-//$app->tpl->setLoop('nav_left',$_SESSION["s"]["module"]["nav"]);
-$app->tpl->setLoop('nav_left',$nav_translated);
-// Setting startpage
-$app->tpl->setVar('startpage',$_SESSION["s"]["module"]["startpage"]);
-$app->tpl->setVar('navframe_page',$_SESSION["s"]["module"]["navframe_page"]);
+if(isset($_SESSION['show_info_msg'])) {
+ $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+ unset($_SESSION['show_info_msg']);
+}
+if(isset($_SESSION['show_error_msg'])) {
+ $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+ unset($_SESSION['show_error_msg']);
+}
+
+// read js.d files
+$js_d = ISPC_WEB_PATH . '/js/js.d';
+$js_d_files = array();
+if(@is_dir($js_d)) {
+ $dir = opendir($js_d);
+ while($file = readdir($dir)) {
+ $filename = $js_d . '/' . $file;
+ if($file === '.' || $file === '..' || !is_file($filename)) continue;
+ if(substr($file, -3) !== '.js') continue;
+ $js_d_files[] = array('file' => $file);
+ }
+ closedir($dir);
+}
+
+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();
-?>
\ No newline at end of file
+?>
--
Gitblit v1.9.1