IMAP/POP3 nur anzeigen wenn es benötigt wird
bernd

bernd commited on 2010-03-11 10:37:59
Zeige 4 geänderte Dateien mit 21 Einfügungen und 10 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1693 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -27,11 +27,3 @@ if (! function_exists("user_has_vmail_domain"))
27 27
   }
28 28
 }
29 29
 
30
-function user_has_regular_domain()
31
-{
32
-  $result = db_query("SELECT id FROM kundendaten.domains AS dom WHERE id NOT IN (SELECT domain FROM mail.virtual_mail_domains WHERE hostname IS NULL)");
33
-  return (mysql_num_rows($result) > 0);
34
-}
35
-
36
-
37
-?>
... ...
@@ -17,4 +17,22 @@ if (! function_exists("user_has_vmail_domain"))
17 17
   }  
18 18
 }
19 19
 
20
+if (! function_exists("user_has_dotcourier_domain"))
21
+{
22
+  function user_has_dotcourier_domain() 
23
+  {
24
+	$role = $_SESSION['role'];
25
+	if (! ($role & ROLE_SYSTEMUSER)) {
26
+		return false;
27
+	}
28
+	$uid = (int) $_SESSION['userinfo']['uid'];
29
+	$result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user={$uid} or c.uid={$uid} UNION ". 
30
+            "SELECT 1 FROM mail.v_domains AS d WHERE d.user={$uid} AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains);");
31
+  $ret = (mysql_num_rows($result) > 0);
32
+  if ($ret)
33
+    DEBUG("User {$uid} has dotcourier-domains");
34
+  return $ret;
35
+  }  
36
+}
37
+
20 38
 ?>
... ...
@@ -15,7 +15,7 @@ if ($role & (ROLE_VMAIL_ACCOUNT | ROLE_MAILACCOUNT))
15 15
 if ($role & ROLE_SYSTEMUSER) {
16 16
   $menu["email_domains"] = array("label" => "Mail-Verwaltung", "file" => "domains", "weight" => 1, "submenu" => "domains_domains");
17 17
 }
18
-if ($role & ROLE_SYSTEMUSER && (user_has_accounts() || ! user_has_vmail_domain() || user_has_regular_domain() ) )
18
+if ($role & ROLE_SYSTEMUSER && (user_has_accounts() || ! user_has_vmail_domain() || user_has_dotcourier_domain() ) )
19 19
 {
20 20
   $menu["email_imap"] = array("label" => "IMAP/POP3", "file" => "imap", "weight" => 20, 'submenu' => "email_vmail");
21 21
 }
... ...
@@ -1,10 +1,11 @@
1 1
 <?php
2 2
 
3 3
 require_once('include/hasaccount.php');
4
+require_once('include/hasdomain.php');
4 5
 
5 6
 $role = $_SESSION['role'];
6 7
 
7
-if ($role & ROLE_SYSTEMUSER && (user_has_accounts() || ! user_has_vmail_domain() || user_has_regular_domain() ) )
8
+if ($role & ROLE_SYSTEMUSER && (user_has_accounts() || ! user_has_vmail_domain() || user_has_dotcourier_domain() ) )
8 9
 {
9 10
   $menu["imap_accounts"] = array("label" => "IMAP/POP3", "file" => "accounts", "weight" => 10);
10 11
 }
11 12