Bernd Wurst authored on24/08/2021 08:37:12
Showing3 changed files
... ...
@@ -54,7 +54,7 @@ if ($id == 0) {
54 54
     }
55 55
 }
56 56
 
57
-
57
+$has_extensions = $account['enableextensions'];
58 58
 $is_autoresponder = is_array($account['autoresponder']) && $account['autoresponder']['valid_from'] != null && ($account['autoresponder']['valid_until'] > date('Y-m-d') || $account['autoresponder']['valid_until'] == null);
59 59
 $is_forward = (count($account['forwards']) > 0);
60 60
 $is_mailbox = ($account['password'] != null  ||  $id == 0);
... ...
@@ -81,6 +81,7 @@ if (! $accountlogin) {
81 81
         $form .= "
82 82
     <p><strong>E-Mail-Adresse:</strong>&#160;<input type=\"text\" name=\"local\" id=\"local\" size=\"10\" value=\"".filter_output_html($account['local'])."\" /><strong style=\"font-size: 1.5em;\">&#160;@&#160;</strong>".domainselect($domain)."</p>";
83 83
     }
84
+    $form .= '<p><input type="checkbox" id="enableextensions" name="enableextensions" value="yes" '.($has_extensions ? 'checked="checked" ' : '').'/><label for=enableextensions">&#160;Ermögliche die Nutzung von Erweiterungsadressen (<a href="https://wiki.schokokeks.org/E-Mail/Erweiterungsadressen">Hilfe</a>)';
84 85
     $password_message = '';
85 86
     $password_value = '';
86 87
     if ($is_mailbox and ($account['password'] != '')) {
... ...
@@ -44,6 +44,7 @@ function empty_account()
44 44
         'local' => '',
45 45
         'domain' => null,
46 46
         'password' => null,
47
+        'enableextensions' => false,
47 48
     'smtpreply' => null,
48 49
     'quota' => config('vmail_basequota'),
49 50
     'quota_threshold' => 20,
... ...
@@ -91,7 +92,7 @@ function get_account_details($id, $checkuid = true)
91 92
         $uid_check = "useraccount=:uid AND ";
92 93
         $args[":uid"] = $uid;
93 94
     }
94
-    $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);
95
+    $result = db_query("SELECT id, local, domain, password, enableextensions, 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);
95 96
     if ($result->rowCount() == 0) {
96 97
         system_failure('Ungültige ID oder kein eigener Account');
97 98
     }
... ...
@@ -226,6 +227,7 @@ function save_vmail_account($account)
226 227
         $newaccount = true;
227 228
     }
228 229
 
230
+    $account['enableextensions'] = (bool) $account['enableextensions'];
229 231
     if ($accountlogin) {
230 232
         if ($account['domain'] != $oldaccount['domain']) {
231 233
             system_failure('Sie können die E-Mail-Adresse nicht ändern!');
... ...
@@ -51,6 +51,10 @@ if ($_GET['action'] == 'edit') {
51 51
             $account['local'] = $_POST['local'];
52 52
             $account['domain'] = (int) $_POST['domain'];
53 53
         }
54
+        $account['enableextensions'] = false;
55
+        if (isset($_POST['enableextensions']) && $_POST['enableextensions'] == 'yes') {
56
+            $account['enableextensions'] = true;
57
+        }
54 58
         $account['password'] = $_POST['password'];
55 59
 
56 60
         if (($account['password'] == '') && (isset($_POST['mailbox']) && $_POST['mailbox'] == 'yes')) {