diff --git a/interface/lib/classes/system.inc.php b/interface/lib/classes/system.inc.php index 89507ea68cadba60599d469c6463fd521a706855..484ef2b6658788e04be4d6458a6fb04422517282 100644 --- a/interface/lib/classes/system.inc.php +++ b/interface/lib/classes/system.inc.php @@ -39,6 +39,18 @@ class system { if(!preg_match('/^[a-z]+$/', $service)) $app->error('Invalid service '.$service); + // Check the servers table to see which kinds of servers we actually have enabled. + // simple query cache + if($this->server_count === null) { + $this->server_count = $app->db->queryOneRecord("SELECT SUM(mail_server) as mail, SUM(web_server) AS web, SUM(dns_server) AS dns, SUM(file_server) AS file, + SUM(db_server) AS db, SUM(vserver_server) AS vserver, SUM(proxy_server) AS proxy, SUM(firewall_server) AS firewall, SUM(xmpp_server) AS xmpp + FROM `server` WHERE mirror_server_id = 0"); + } + // Check if we have the service enabled. + if ($this->server_count[$service] == 0) { + return FALSE; + } + if(isset($_SESSION['s']['user']) && $_SESSION['s']['user']['typ'] == 'admin') return true; //* We do not check admin-users // simple query cache diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php index cc100cd7d23a6994191ab283f7de2aac7fb221c7..d9d97bc8b2fb72c4b161791023177368f901000e 100644 --- a/interface/web/mail/lib/module.conf.php +++ b/interface/web/mail/lib/module.conf.php @@ -150,31 +150,33 @@ if($app->auth->get_client_limit($userid, 'fetchmail') != 0) } //**** XMPP Menu -$items = array(); - -if($app->auth->get_client_limit($userid, 'xmpp_domain') != 0) -{ - $items[] = array( 'title' => 'XMPP Domain', - 'target' => 'content', - 'link' => 'mail/xmpp_domain_list.php', - 'html_id' => 'xmpp_domain_list'); +if ($app->system->has_service($userid, 'xmpp')) { + $items = array(); + + if($app->auth->get_client_limit($userid, 'xmpp_domain') != 0) + { + $items[] = array( 'title' => 'XMPP Domain', + 'target' => 'content', + 'link' => 'mail/xmpp_domain_list.php', + 'html_id' => 'xmpp_domain_list'); + } + + if($app->auth->get_client_limit($userid, 'xmpp_user') != 0) + { + $items[] = array( 'title' => 'XMPP Account', + 'target' => 'content', + 'link' => 'mail/xmpp_user_list.php', + 'html_id' => 'xmpp_user_list'); + } + + if(count($items)) + { + $module['nav'][] = array( 'title' => 'Jabber / XMPP', + 'open' => 1, + 'items' => $items); + } } -if($app->auth->get_client_limit($userid, 'xmpp_user') != 0) -{ - $items[] = array( 'title' => 'XMPP Account', - 'target' => 'content', - 'link' => 'mail/xmpp_user_list.php', - 'html_id' => 'xmpp_user_list'); -} - -if(count($items) && $app->system->has_service($userid, 'xmpp')) - $module['nav'][] = array( 'title' => 'Jabber / XMPP', - 'open' => 1, - 'items' => $items); - - - //**** Statistics menu $items = array();