Browse code

Zeige Mail-Deeplink korrekt an bei manueller Konfiguration

Bernd Wurst authored on16/02/2018 05:39:11
Showing2 changed files
... ...
@@ -75,7 +75,12 @@ if ($is_current_user) {
75 75
         $used = true;
76 76
     }
77 77
     if (have_module('email') && mail_in_use($dom->id)) {
78
-        output("<p>Es gibt E-Mail-Postfächer unter dieser Domain ".internal_link('../email/vmail', '&#x2192; Bearbeiten', 'filter='.$dom->fqdn)."</p>");
78
+        $vmail = count_vmail($dom->id);
79
+        if ($vmail > 0) {
80
+            output("<p>Es gibt <strong>{$vmail}</strong> E-Mail-Postfächer unter dieser Domain ".internal_link('../email/vmail', '&#x2192; Bearbeiten', 'filter='.$dom->fqdn)."</p>");
81
+        } else {
82
+            output("<p>Manuelle Mail-Konfiguration ist aktiv. ".internal_link('../email/imap', '&#x2192; IMAP-Postfächer verwalten')."</p>");
83
+        }
79 84
         $used = true;
80 85
     }
81 86
     if (have_module('mailman') && mailman_subdomains($dom->id)) {
... ...
@@ -63,6 +63,12 @@ function mail_in_use($domain)
63 63
   return ($result->rowCount() > 0);
64 64
 }
65 65
 
66
+function count_vmail($domain) {
67
+    $domain = (int) $domain;
68
+    $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", array($domain));
69
+    return $result->rowCount();
70
+}
71
+
66 72
 function web_in_use($domain)
67 73
 {
68 74
   if ( ! in_array('vhosts', config('modules')))