Skip to content

Commit 9968469

Browse files
author
Till Brehm
committed
Merge branch 'patch-enabled-services' into 'stable-3.1'
Check if we actually have a service enabled See merge request ispconfig/ispconfig3!1059
2 parents 418a6da + c8ac70b commit 9968469

File tree

2 files changed

+37
-23
lines changed

2 files changed

+37
-23
lines changed

interface/lib/classes/system.inc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ public function has_service($userid, $service) {
3939

4040
if(!preg_match('/^[a-z]+$/', $service)) $app->error('Invalid service '.$service);
4141

42+
// Check the servers table to see which kinds of servers we actually have enabled.
43+
// simple query cache
44+
if($this->server_count === null) {
45+
$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,
46+
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
47+
FROM `server` WHERE mirror_server_id = 0");
48+
}
49+
// Check if we have the service enabled.
50+
if ($this->server_count[$service] == 0) {
51+
return FALSE;
52+
}
53+
4254
if(isset($_SESSION['s']['user']) && $_SESSION['s']['user']['typ'] == 'admin') return true; //* We do not check admin-users
4355

4456
// simple query cache

interface/web/mail/lib/module.conf.php

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,33 @@
150150
}
151151

152152
//**** XMPP Menu
153-
$items = array();
154-
155-
if($app->auth->get_client_limit($userid, 'xmpp_domain') != 0)
156-
{
157-
$items[] = array( 'title' => 'XMPP Domain',
158-
'target' => 'content',
159-
'link' => 'mail/xmpp_domain_list.php',
160-
'html_id' => 'xmpp_domain_list');
153+
if ($app->system->has_service($userid, 'xmpp')) {
154+
$items = array();
155+
156+
if($app->auth->get_client_limit($userid, 'xmpp_domain') != 0)
157+
{
158+
$items[] = array( 'title' => 'XMPP Domain',
159+
'target' => 'content',
160+
'link' => 'mail/xmpp_domain_list.php',
161+
'html_id' => 'xmpp_domain_list');
162+
}
163+
164+
if($app->auth->get_client_limit($userid, 'xmpp_user') != 0)
165+
{
166+
$items[] = array( 'title' => 'XMPP Account',
167+
'target' => 'content',
168+
'link' => 'mail/xmpp_user_list.php',
169+
'html_id' => 'xmpp_user_list');
170+
}
171+
172+
if(count($items))
173+
{
174+
$module['nav'][] = array( 'title' => 'Jabber / XMPP',
175+
'open' => 1,
176+
'items' => $items);
177+
}
161178
}
162179

163-
if($app->auth->get_client_limit($userid, 'xmpp_user') != 0)
164-
{
165-
$items[] = array( 'title' => 'XMPP Account',
166-
'target' => 'content',
167-
'link' => 'mail/xmpp_user_list.php',
168-
'html_id' => 'xmpp_user_list');
169-
}
170-
171-
if(count($items) && $app->system->has_service($userid, 'xmpp'))
172-
$module['nav'][] = array( 'title' => 'Jabber / XMPP',
173-
'open' => 1,
174-
'items' => $items);
175-
176-
177-
178180
//**** Statistics menu
179181
$items = array();
180182

0 commit comments

Comments
 (0)