From 5ca959fa688255a8de61f89fe2751eb4d24a6912 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Tue, 22 Mar 2016 09:22:07 -0400
Subject: [PATCH] fixed typo

---
 interface/web/dashboard/dashlets/modules.php |   48 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/interface/web/dashboard/dashlets/modules.php b/interface/web/dashboard/dashlets/modules.php
index cfb2e12..da1eb0b 100644
--- a/interface/web/dashboard/dashlets/modules.php
+++ b/interface/web/dashboard/dashlets/modules.php
@@ -1,21 +1,21 @@
 <?php
 
 class dashlet_modules {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		//* Loading Template
 		$app->uses('tpl');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/modules.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_modules.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		/*
 		 * Show all modules, the user is allowed to use
 		*/
@@ -25,24 +25,42 @@
 			foreach($modules as $mt) {
 				if(is_file('../' . $mt . '/lib/module.conf.php')) {
 					if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
-					include_once('../' . $mt.'/lib/module.conf.php');
+					include_once '../' . $mt.'/lib/module.conf.php';
 					/* We don't want to show the dashboard */
 					if ($mt != 'dashboard') {
+						if($mt == 'dns'){
+							$dns_servers = $app->db->queryOneRecord("SELECT COUNT(*) as cnt FROM server WHERE dns_server = 1 AND active = 1");
+							if($dns_servers['cnt'] == 0) continue;
+						}
+						if($mt == 'mail'){
+							$mail_servers = $app->db->queryOneRecord("SELECT COUNT(*) as cnt FROM server WHERE mail_server = 1 AND active = 1");
+							if($mail_servers['cnt'] == 0) continue;
+						}
+						if($mt == 'sites'){
+							$web_servers = $app->db->queryOneRecord("SELECT COUNT(*) as cnt FROM server WHERE web_server = 1 AND active = 1");
+							if($web_servers['cnt'] == 0) continue;
+						}
+					
 						$module_title = $app->lng($module['title']);
-						if(strlen($module_title) > 8) $module_title = substr($module_title,0,7).'..';
-						$mod[] = array(	'modules_title' 	=> $module_title,
-								'modules_startpage'	=> $module['startpage'],
-								'modules_name'  	=> $module['name']);
+						if(function_exists('mb_strlen')) {
+							if(mb_strlen($module_title, "UTF-8") > 8) $module_title = mb_substr($module_title, 0, 7, "UTF-8").'..';
+						} else {
+							if(strlen($module_title) > 8) $module_title = substr($module_title, 0, 7).'..';
+						}
+						$mod[$module['order']] = array( 'modules_title'  => $module_title,
+							'modules_startpage' => $module['startpage'],
+							'modules_name'   => $module['name']);
 					}
 				}
 			}
-
+			ksort($mod);
 			$tpl->setloop('modules', $mod);
 		}
-		
+
 		return $tpl->grab();
-		
+
 	}
+
 }
 
 
@@ -52,4 +70,4 @@
 
 
 
-?>
\ No newline at end of file
+?>

--
Gitblit v1.9.1