modules/email/include/vmail.php
90ff5748
 <?php
c208bd90
 /*
 This file belongs to the Webinterface of schokokeks.org Hosting
 
cf54502a
 Written 2008-2018 by schokokeks.org Hosting, namely
c208bd90
   Bernd Wurst <bernd@schokokeks.org>
   Hanno Böck <hanno@schokokeks.org>
 
 To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
 
2626dd47
 You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
c208bd90
 http://creativecommons.org/publicdomain/zero/1.0/
 
 Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
 */
 
90ff5748
 require_once('inc/base.php');
 require_once('inc/debug.php');
 
d70a5791
 require_once('hasdomain.php');
90ff5748
 
3000accf
 require_once('common.php');
 
fe1bf4bf
 
2626dd47
 function forward_type($target)
 {
     list($l, $d) = explode('@', strtolower($target), 2);
     DEBUG('Weiterleitung an '.$l.' @ '.$d);
     $result = db_query("SELECT id FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld) = ?", array($d));
     if ($result->rowCount() > 0) {
         // Lokale Domain
         return 'local';
     }
     // Auswärtige Domain aber keine aus der Liste
     return 'external';
fe1bf4bf
 }
 
 
 
90ff5748
 function empty_account()
 {
2626dd47
     $account = array(
         'id' => null,
         'local' => '',
         'domain' => null,
         'password' => null,
     'smtpreply' => null,
8d843ef1
     'quota' => config('vmail_basequota'),
7b78f3b8
     'quota_threshold' => 20,
2626dd47
         'forwards' => array(),
         'autoresponder' => null
         );
     return $account;
90ff5748
 }
 
5f53b473
 function empty_autoresponder_config()
 {
2626dd47
     $ar = array(
     'valid_from' => date('Y-m-d'),
     'valid_until' => null,
     'fromname' => null,
     'fromaddr' => null,
     'subject' => null,
5f53b473
     'message' => 'Danke für Ihre E-Mail.
 Ich bin aktuell nicht im Büro und werde Ihre Nachricht erst nach meiner Rückkehr beantworten.
 Ihre E-Mail wird nicht weitergeleitet.',
2626dd47
     'quote' => null
5f53b473
     );
2626dd47
     return $ar;
5f53b473
 }
 
 
2626dd47
 function get_vmail_id_by_emailaddr($emailaddr)
aa811d39
 {
2626dd47
     $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE CONCAT(local, '@', domainname) = ?", array($emailaddr));
     $entry = $result->fetch();
88902e9a
     if ($entry === false) {
         return false;
     }
2626dd47
     return (int) $entry['id'];
aa811d39
 }
 
b631cd6b
 function get_account_details($id, $checkuid = true)
90ff5748
 {
2626dd47
     $id = (int) $id;
     $uid_check = '';
     DEBUG("checkuid: ".$checkuid);
     $args = array(":id" => $id);
     if ($checkuid) {
         $uid = (int) $_SESSION['userinfo']['uid'];
         $uid_check = "useraccount=:uid AND ";
         $args[":uid"] = $uid;
     }
     $result = db_query("SELECT id, local, domain, password, smtpreply, forwards, autoresponder, server, quota, COALESCE(quota_used, 0) AS quota_used, quota_threshold from mail.v_vmail_accounts WHERE {$uid_check}id=:id LIMIT 1", $args);
     if ($result->rowCount() == 0) {
         system_failure('Ungültige ID oder kein eigener Account');
     }
     $acc = empty_account();
     $res = $result->fetch();
     foreach ($res as $key => $value) {
         if ($key == 'forwards') {
             continue;
         }
         $acc[$key] = $value;
     }
     if ($acc['forwards'] > 0) {
         $result = db_query("SELECT id, destination FROM mail.vmail_forward WHERE account=?", array($acc['id']));
         while ($item = $result->fetch()) {
             array_push($acc['forwards'], array("id" => $item['id'], 'destination' => $item['destination']));
         }
     }
     if ($acc['autoresponder'] > 0) {
         $result = db_query("SELECT id, IF(valid_from IS NULL OR valid_from > NOW() OR valid_until < NOW(), 0, 1) AS active, DATE(valid_from) AS valid_from, DATE(valid_until) AS valid_until, fromname, fromaddr, subject, message, quote FROM mail.vmail_autoresponder WHERE account=?", array($acc['id']));
         $item = $result->fetch();
         DEBUG($item);
         $acc['autoresponder'] = $item;
     } else {
         $acc['autoresponder'] = null;
     }
     if ($acc['quota_threshold'] === null) {
         $acc['quota_threshold'] = -1;
     }
     return $acc;
90ff5748
 }
 
 function get_vmail_accounts()
 {
2626dd47
     $uid = (int) $_SESSION['userinfo']['uid'];
     $result = db_query("SELECT * from mail.v_vmail_accounts WHERE useraccount=? ORDER BY domainname,local ASC", array($uid));
     $ret = array();
     while ($line = $result->fetch()) {
         array_push($ret, $line);
     }
     DEBUG($ret);
     return $ret;
90ff5748
 }
 
 
 
 function get_vmail_domains()
 {
2626dd47
     $uid = (int) $_SESSION['userinfo']['uid'];
     $result = db_query("SELECT id, domainname, server FROM mail.v_vmail_domains WHERE useraccount=? ORDER BY domainname", array($uid));
     if ($result->rowCount() == 0) {
         system_failure('Sie haben keine Domains für virtuelle Mail-Verarbeitung');
     }
     $ret = array();
     while ($tmp = $result->fetch()) {
         array_push($ret, $tmp);
     }
     return $ret;
90ff5748
 }
 
 
b631cd6b
 function find_account_id($accname)
 {
2626dd47
     DEBUG($accname);
     $tmp = explode('@', $accname, 2);
     DEBUG($tmp);
     if (count($tmp) != 2) {
         system_failure("Der Account hat nicht die korrekte Syntax");
     }
     list($local, $domainname) = $tmp;
 
     $result = db_query("SELECT id FROM mail.v_vmail_accounts WHERE local=? AND domainname=? LIMIT 1", array($local, $domainname));
     if ($result->rowCount() == 0) {
         system_failure("Der Account konnte nicht gefunden werden");
     }
     $tmp = $result->fetch();
     return $tmp[0];
b631cd6b
 }
 
 
 function change_vmail_password($accname, $newpass)
 {
2626dd47
     $accid = find_account_id($accname);
     $encpw = encrypt_mail_password($newpass);
     db_query("UPDATE mail.vmail_accounts SET password=:encpw WHERE id=:accid", array(":encpw" => $encpw, ":accid" => $accid));
b631cd6b
 }
 
90ff5748
 
2626dd47
 function domainselect($selected = null, $selectattribute = '')
90ff5748
 {
2626dd47
     $domainlist = get_vmail_domains();
     $selected = (int) $selected;
 
     $ret = '<select id="domain" name="domain" size="1" '.$selectattribute.' >';
     foreach ($domainlist as $dom) {
         $s = ($selected == $dom['id']) ? ' selected="selected" ': '';
         $ret .= "<option value=\"{$dom['id']}\"{$s}>{$dom['domainname']}</option>\n";
     }
     $ret .= '</select>';
     return $ret;
90ff5748
 }
 
 
2626dd47
 function get_max_mailboxquota($server, $oldquota)
 {
     $uid = (int) $_SESSION['userinfo']['uid'];
     $server = (int) $server;
     $result = db_query("SELECT systemquota - (COALESCE(systemquota_used,0) + COALESCE(mailquota,0)) AS free FROM system.v_quota WHERE uid=:uid AND server=:server", array(":uid" => $uid, ":server" => $server));
     $item = $result->fetch();
ef20939b
     if (! $item) {
         return $oldquota - config('vmail_basequota');
     }
2626dd47
     DEBUG("Free space: ".$item['free']." / Really: ".($item['free'] + ($oldquota - config('vmail_basequota'))));
     return max(0, $item['free'] + ($oldquota - config('vmail_basequota')));
8d843ef1
 }
 
 
90ff5748
 
 
 function save_vmail_account($account)
 {
2626dd47
     $accountlogin = ($_SESSION['role'] == ROLE_VMAIL_ACCOUNT);
     $id = $account['id'];
     if ($id != null) {
         $id = (int) $id;
         $oldaccount = get_account_details($id, !$accountlogin);
         // Erzeugt einen system_error() wenn ID ungültig
     }
     // Ab hier ist $id sicher, entweder NULL oder eine gültige ID des aktuellen users
aa811d39
 
2626dd47
     $newaccount = false;
     if ($id === null) {
         $newaccount = true;
aa811d39
     }
2626dd47
 
     if ($accountlogin) {
         if ($account['domain'] != $oldaccount['domain']) {
             system_failure('Sie können die E-Mail-Adresse nicht ändern!');
         }
         if ($account['local'] != $oldaccount['local']) {
             system_failure('Sie können die E-Mail-Adresse nicht ändern!');
         }
         if ($account['quota'] != $oldaccount['quota']) {
             system_failure('Sie können Ihren eigenen Speicherplatz nicht verändern.');
         }
         if ($account['smtpreply'] != null) {
             system_failure("Sie können nicht den Account stilllegen mit dem Sie grade angemeldet sind.");
         }
     } else {
         $account['local'] = filter_input_username($account['local']);
         if ($account['local'] == '') {
             system_failure('Die E-Mail-Adresse braucht eine Angabe vor dem »@«!');
             return false;
         }
         $account['domain'] = (int) $account['domain'];
         $domainlist = get_vmail_domains();
         $valid_domain = false;
         $domainname = null;
         $server = null;
         foreach ($domainlist as $dom) {
             if ($dom['id'] == $account['domain']) {
                 $domainname = $dom['domainname'];
                 $server = $dom['server'];
                 $valid_domain = true;
                 break;
             }
         }
         if (($account['domain'] == 0) || (! $valid_domain)) {
             system_failure('Bitte wählen Sie eine Ihrer Domains aus!');
             return false;
         }
         if ($id == null && get_vmail_id_by_emailaddr($account['local'].'@'.$domainname)) {
             system_failure('Diese E-Mail-Adresse gibt es bereits.');
             return false;
         }
7c5202e2
     }
9086c9ad
 
2626dd47
     $forwards = array();
     if (count($account['forwards']) > 0) {
         for ($i = 0 ; $i < count($account['forwards']) ; $i++) {
             if (! check_emailaddr($account['forwards'][$i]['destination'])) {
c42127d3
                 system_failure('Das Weiterleitungs-Ziel »'.filter_output_html($account['forwards'][$i]['destination']).'« ist keine E-Mail-Adresse!');
2626dd47
             }
         }
f0af5f49
     }
5f53b473
 
2626dd47
     if ($accountlogin) {
         $password = null;
         $set_password = false;
aa811d39
     } else {
2626dd47
         $password= null;
         if ($account['password'] != '') {
             $account['password'] = stripslashes($account['password']);
             $crack = strong_password($account['password']);
             if ($crack !== true) {
                 system_failure('Ihr Passwort ist zu einfach. bitte wählen Sie ein sicheres Passwort!'."\nDie Fehlermeldung lautet: »{$crack}«");
                 return false;
             }
             $password = encrypt_mail_password($account['password']);
         }
         $set_password = ($id == null || $password != null);
         if ($account['password'] === null) {
             $set_password=true;
         }
aa811d39
     }
2626dd47
 
     if (!$accountlogin) {
         $free = config('vmail_basequota');
         if ($newaccount) {
             // Neues Postfach
             $free = get_max_mailboxquota($server, config('vmail_basequota'));
         } else {
             $free = get_max_mailboxquota($oldaccount['server'], $oldaccount['quota']);
         }
9086c9ad
 
2626dd47
         $newquota = max((int) config('vmail_basequota'), (int) $account['quota']);
         if ($newquota > config('vmail_basequota') && $newquota > ($free+config('vmail_basequota'))) {
             $newquota = $free + config('vmail_basequota');
             if (isset($oldaccount) && $account['quota'] >= $oldaccount['quota'] && $newquota < $oldaccount['quota']) {
                 # Wenn das Limit künstlich reduziert wurde, dann maximal auf den alten Wert.
                 $newquota = $oldaccount['quota'];
             }
             warning("Ihr Speicherplatz reicht für diese Postfach-Größe nicht mehr aus. Ihr Postfach wurde auf {$newquota} MB reduziert. Bitte beachten Sie, dass damit Ihr Benutzerkonto keinen freien Speicherplatz mehr aufweist!");
         }
9086c9ad
 
2626dd47
         $account['quota'] = $newquota;
     }
67d3ffab
 
2626dd47
     if ($account['quota_threshold'] == -1) {
         $account['quota_threshold'] = null;
     } else {
         $account['quota_threshold'] = min((int) $account['quota_threshold'], (int) $account['quota']);
     }
9086c9ad
 
2626dd47
     $account['local'] = strtolower($account['local']);
     # Leerstring wird zu NULL
     $account['smtpreply'] = ($account['smtpreply'] ? $account['smtpreply'] : null);
90ff5748
 
2626dd47
     $args = array(":local" => $account['local'],
24c66a62
                 ":domain" => $account['domain'],
                 ":password" => $password,
f60ba9df
                 ":smtpreply" => $account['smtpreply'],
2626dd47
                 ":quota" => $account['quota'],
24c66a62
                 ":quota_threshold" => $account['quota_threshold'],
                 ":id" => $id
                 );
2626dd47
     $query = '';
     if ($newaccount) {
         unset($args[":id"]);
         $query = "INSERT INTO mail.vmail_accounts (local, domain, password, smtpreply, quota, quota_threshold) VALUES (:local, :domain, :password, :smtpreply, :quota, :quota_threshold)";
     } else {
         if ($set_password) {
             $pw=", password=:password";
         } else {
             unset($args[":password"]);
             $pw='';
         }
         $query = "UPDATE mail.vmail_accounts SET local=:local, domain=:domain{$pw}, smtpreply=:smtpreply, quota=:quota, quota_threshold=:quota_threshold WHERE id=:id";
     }
     db_query($query, $args);
     if ($newaccount) {
         $id = db_insert_id();
     }
f3525141
 
2626dd47
     if (is_array($account['autoresponder'])) {
         $ar = $account['autoresponder'];
         $quote = null;
         if ($ar['quote'] == 'attach') {
             $quote = "attach";
         } elseif ($ar['quote'] == 'inline') {
             $quote = 'inline';
         } elseif ($ar['quote'] == 'teaser') {
             $quote = 'teaser';
         }
         if (! check_emailaddr($ar['fromaddr'])) {
             input_error("Die Absenderadresse sieht ungültig aus. Es wird Ihre E-Mail-Adresse benutzt!");
             $ar['fromaddr'] = null;
         }
         $query = "REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
24c66a62
              "VALUES (:id, :valid_from, :valid_until, :fromname, :fromaddr, :subject, :message, :quote)";
2626dd47
         $args = array(":id" => $id,
24c66a62
                   ":valid_from" => $ar['valid_from'],
                   ":valid_until" => $ar['valid_until'],
                   ":fromname" => $ar['fromname'],
43ce5d8d
                   ":fromaddr" => $ar['fromaddr'],
24c66a62
                   ":subject" => $ar['subject'],
                   ":message" => $ar['message'],
                   ":quote" => $quote);
2626dd47
         db_query($query, $args);
     }
9086c9ad
 
f3525141
 
 
2626dd47
     if (! $newaccount) {
         db_query("DELETE FROM mail.vmail_forward WHERE account=?", array($id));
     }
b631cd6b
 
2626dd47
     if (count($account['forwards']) > 0) {
         $forward_query = "INSERT INTO mail.vmail_forward (account,destination) VALUES (:account, :destination)";
         for ($i=0;$i < count($account['forwards']); $i++) {
             if (! isset($account['forwards'][$i]['destination'])) {
                 continue;
             }
             db_query($forward_query, array(":account" => $id, ":destination" => $account['forwards'][$i]['destination']));
         }
83d84151
     }
2626dd47
     if ($newaccount && $password) {
         $servername = get_server_by_id($server);
         $emailaddr = 'vmail-'.$account['local'].'%'.$domainname.'@'.$servername;
         $username = $account['local'].'@'.$domainname;
         $webmailurl = config('webmail_url');
         $servername = get_server_by_id($server);
         $message = 'Ihr neues E-Mail-Postfach '.$username.' ist einsatzbereit!
cceaa6e5
 
 Wenn Sie diese Nachricht sehen, haben Sie das Postfach erfolgreich 
 abgerufen. Sie können diese Nachricht nach Kenntnisnahme löschen.
 
 Wussten Sie schon, dass Sie auf mehrere Arten Ihre E-Mails abrufen können?
 
 - Für unterwegs: Webmail
   Rufen Sie dazu einfach die Seite '.$webmailurl.' auf und 
   geben Sie Ihre E-Mail-Adresse und das Passwort ein.
 
 - Mit Ihrem Computer oder Smartphone: IMAP oder POP3
   Tragen Sie bitte folgende Zugangsdaten in Ihrem Programm ein:
e2a3572a
     Server-Name: '.$servername.'
e9ef15e8
     Benutzername: '.$username.'
cceaa6e5
   (Achten Sie bitte darauf, dass die Verschlüsselung mit SSL oder TLS 
   aktiviert ist.)
 ';
2626dd47
         # send welcome message
         mail($emailaddr, 'Ihr neues Postfach ist bereit', $message, "X-schokokeks-org-message: welcome\nFrom: ".config('company_name').' <'.config('adminmail').">\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\n");
         # notify the vmail subsystem of this new account
cceaa6e5
     #mail('vmail@'.config('vmail_server'), 'command', "user={$account['local']}\nhost={$domainname}", "X-schokokeks-org-message: command");
2626dd47
     }
67d3ffab
 
2626dd47
     // Clean up obsolete quota
     if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
         db_query("UPDATE mail.vmail_accounts SET quota_used=NULL, quota=NULL WHERE password IS NULL");
     }
5dd861d2
 
2626dd47
     // Update Mail-Quota-Cache
     if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
         $uid = (int) $_SESSION['userinfo']['uid'];
         $result = db_query("SELECT useraccount, server, SUM(quota-(SELECT value FROM misc.config WHERE `key`='vmail_basequota')) AS quota, SUM(GREATEST(quota_used-(SELECT value FROM misc.config WHERE `key`='vmail_basequota'), 0)) AS used FROM mail.v_vmail_accounts WHERE useraccount=? GROUP BY useraccount, server", array($uid));
         while ($line = $result->fetch()) {
             if ($line['quota'] !== null) {
                 db_query("REPLACE INTO mail.vmailquota (uid, server, quota, used) VALUES (:uid, :server, :quota, :used)", array(":uid" => $line['useraccount'], ":server" => $line['server'], ":quota" => $line['quota'], ":used" => $line['used']));
             }
         }
67d3ffab
     }
 
2626dd47
     return true;
90ff5748
 }
 
 
 
3e33ab37
 function delete_account($id)
 {
2626dd47
     $account = get_account_details($id);
     db_query("DELETE FROM mail.vmail_accounts WHERE id=?", array($account['id']));
3e33ab37
 }
 
90ff5748
 
8d3da690
 
2626dd47
 function domainsettings($only_domain=null)
 {
     $uid = (int) $_SESSION['userinfo']['uid'];
     if ($only_domain) {
         $only_domain = (int) $only_domain;
     }
     $domains = array();
     $subdomains = array();
 
     // Domains
     $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, d.mailserver_lock, m.id AS m_id, v.id AS v_id FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NULL) WHERE d.useraccount=:uid OR m.uid=:uid ORDER BY CONCAT_WS('.',d.domainname,d.tld);", array(":uid" => $uid));
 
     while ($mydom = $result->fetch()) {
         if (! array_key_exists($mydom['id'], $domains)) {
             if ($mydom['v_id']) {
                 $mydom['mail'] = 'virtual';
             }
             $domains[$mydom['id']] = array(
8d3da690
         "name" => $mydom['name'],
f0ca6337
         "type" => $mydom['mail'],
         "mailserver_lock" => $mydom['mailserver_lock']
8d3da690
         );
2626dd47
             if ($only_domain && $only_domain == $mydom['id']) {
                 return $domains[$only_domain];
             }
         }
8d3da690
     }
109bf87e
 
2626dd47
     // Subdomains
     $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS name, d.mail, m.id AS m_id, v.id AS v_id, IF(ISNULL(v.hostname),m.subdomain,v.hostname) AS hostname FROM kundendaten.domains AS d LEFT JOIN mail.virtual_mail_domains AS v ON (d.id=v.domain AND v.hostname IS NOT NULL) LEFT JOIN mail.custom_mappings AS m ON (d.id=m.domain AND m.subdomain IS NOT NULL) WHERE (m.id IS NOT NULL OR v.id IS NOT NULL) AND d.useraccount=:uid OR m.uid=:uid;", array(":uid" => $uid));
     while ($mydom = $result->fetch()) {
         if (! array_key_exists($mydom['id'], $subdomains)) {
             $subdomains[$mydom['id']] = array();
         }
9086c9ad
 
2626dd47
         $type = 'auto';
         if ($mydom['v_id']) {
             $type = 'virtual';
         }
         $subdomains[$mydom['id']][] = array(
109bf87e
       "name" => $mydom['hostname'],
       "type" => $type
       );
2626dd47
     }
     return array("domains" => $domains, "subdomains" => $subdomains);
8d3da690
 }
 
 
 function domain_has_vmail_accounts($domid)
 {
2626dd47
     $domid = (int) $domid;
     $result = db_query("SELECT dom.id FROM mail.vmail_accounts AS acc LEFT JOIN mail.virtual_mail_domains AS dom ON (dom.id=acc.domain) WHERE dom.domain=?", array($domid));
     return ($result->rowCount() > 0);
8d3da690
 }
 
 
 function change_domain($id, $type)
 {
2626dd47
     $id = (int) $id;
     if (domain_has_vmail_accounts($id)) {
         system_failure("Sie müssen zuerst alle E-Mail-Konten mit dieser Domain löschen, bevor Sie die Webinterface-Verwaltung für diese Domain abschalten können.");
     }
9086c9ad
 
2626dd47
     if (! in_array($type, array('none','auto','virtual'))) {
         system_failure("Ungültige Aktion");
     }
9086c9ad
 
2626dd47
     $old = domainsettings($id);
     if ($old['type'] == $type) {
         system_failure('Domain ist bereits so konfiguriert');
     }
 
     if ($type == 'none') {
         db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL", array($id));
         db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
         db_query("UPDATE kundendaten.domains SET mail='none', lastchange=NOW() WHERE id=?", array($id));
     } elseif ($type == 'virtual') {
         $vmailserver = (int) $_SESSION['userinfo']['server'];
         db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL", array($id));
         db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=?", array($id));
         db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", array($id, $vmailserver));
     } elseif ($type == 'auto') {
         db_query("DELETE FROM mail.virtual_mail_domains WHERE domain=? AND hostname IS NULL LIMIT 1;", array($id));
         db_query("DELETE FROM mail.custom_mappings WHERE domain=? AND subdomain IS NULL LIMIT 1;", array($id));
         db_query("UPDATE kundendaten.domains SET mail='auto', lastchange=NOW() WHERE id=? LIMIT 1;", array($id));
     }
8d3da690
 }
 
 
 /*
 function maildomain_type($type) {
   switch ($type) {
     case 'none':
       $type = 'Diese Domain empfängt keine E-Mails';
       break;
     case 'auto':
       $type = 'E-Mail-Adressen werden manuell über .courier-Dateien verwaltet';
       break;
     case 'virtual':
       $type = 'E-Mail-Adressen werden über Webinterface verwaltet';
       break;
     case 'manual':
       $type = 'Manuelle Konfiguration, kann nur von den Admins geändert werden';
       break;
   }
   return $type;
 }
 */
 
2626dd47
 function maildomain_type($type)
 {
     switch ($type) {
8d3da690
     case 'none':
       $type = 'Deaktiviert';
       break;
     case 'auto':
       $type = '.courier-Dateien';
       break;
     case 'virtual':
       $type = 'Webinterface';
       break;
     case 'manual':
       $type = 'Manuell';
       break;
   }
2626dd47
     return $type;
8d3da690
 }