From cab1344dab05f07f642c9b4d3bceda4ca69fcfc4 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 04 Jan 2013 10:33:10 -0500
Subject: [PATCH] Fixed: FS#2603 - admin module selectable as startmodule for clients

---
 interface/web/tools/form/interface_settings.tform.php |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/interface/web/tools/form/interface_settings.tform.php b/interface/web/tools/form/interface_settings.tform.php
index 49ed62d..52db8aa 100644
--- a/interface/web/tools/form/interface_settings.tform.php
+++ b/interface/web/tools/form/interface_settings.tform.php
@@ -84,14 +84,25 @@
 //* Pick out modules
 //* TODO: limit to activated modules of the user
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
-				$modules_list[$file] = $file;
+if($_SESSION["s"]["user"]["typ"] == 'admin') {
+	$handle = @opendir(ISPC_WEB_PATH); 
+	while ($file = @readdir ($handle)) { 
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH."/$file")) {
+				if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
+					$modules_list[$file] = $file;
+				}
 			}
-        }
+		}
+	}
+} else {
+	$modules = $conf['interface_modules_enabled'];
+	if($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+		$modules .= ',client';
+	}
+	$tmp = explode(',',$modules);
+	foreach($tmp as $m) {
+		$modules_list[$m] = $m;
 	}
 }
 

--
Gitblit v1.9.1