From fac721841ec470d7c1269ec62eb094e101b75e29 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 27 Feb 2013 05:32:29 -0500
Subject: [PATCH] Fixed: FS#2727 - APS installations / deletions alters permissions

---
 interface/web/tools/form/interface_settings.tform.php |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/interface/web/tools/form/interface_settings.tform.php b/interface/web/tools/form/interface_settings.tform.php
index e992c33..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;
 	}
 }
 
@@ -113,7 +124,7 @@
 while ($file = @readdir ($handle)) { 
     if (substr($file, 0, 1) != '.') {
         if(@is_dir(ISPC_THEMES_PATH."/$file")) {
-			if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) {
+			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
                 $themes_list[$file] = $file;
             }
         }

--
Gitblit v1.9.1