From 7b47c0aa0aeee6f059f00008e36cc210ca89ecb9 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 21 Aug 2013 10:28:20 -0400
Subject: [PATCH] Merged revisions 4069-4117 from stable branch.

---
 interface/web/dashboard/dashboard.php |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php
index dae00f8..0626758 100644
--- a/interface/web/dashboard/dashboard.php
+++ b/interface/web/dashboard/dashboard.php
@@ -157,8 +157,36 @@
 
 /* Which dashlets in which column */
 /******************************************************************************/
-$leftcol_dashlets = array('modules','invoices','quota','mailquota');
-$rightcol_dashlets = array('limits');
+$default_leftcol_dashlets = array('modules','invoices','quota','mailquota');
+$default_rightcol_dashlets = array('limits');
+
+$app->uses('getconf');
+$dashlets_config = $app->getconf->get_global_config('misc');
+//* Client: If the logged in user is not admin and has no sub clients (no reseller)
+if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+	$role = 'client';
+//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
+} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+	$role = 'reseller';
+//* Admin: If the logged in user is admin
+} else {
+	$role = 'admin';
+}
+$dashlets_config[$role.'_dashlets_left'] = trim($dashlets_config[$role.'_dashlets_left']);
+$dashlets_config[$role.'_dashlets_right'] = trim($dashlets_config[$role.'_dashlets_right']);
+
+if($dashlets_config[$role.'_dashlets_left'] != ''){
+	preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_left'], $matches);
+	$leftcol_dashlets = $matches[1]; 
+} else {
+	$leftcol_dashlets = $default_leftcol_dashlets;
+}
+if($dashlets_config[$role.'_dashlets_right'] != ''){
+	preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_right'], $matches);
+	$rightcol_dashlets = $matches[1];
+} else {
+	$rightcol_dashlets = $default_rightcol_dashlets;
+}
 /******************************************************************************/
 
 

--
Gitblit v1.9.1