git subrepo commit (merge) mailcow/src/mailcow-dockerized

subrepo: subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "02ae5285"
upstream: origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "649a5c01"
git-subrepo: version:  "0.4.3"
  origin:   "???"
  commit:   "???"
Change-Id: I870ad468fba026cc5abf3c5699ed1e12ff28b32b
diff --git a/mailcow/src/mailcow-dockerized/data/web/edit.php b/mailcow/src/mailcow-dockerized/data/web/edit.php
index 3a0bb04..30d584f 100644
--- a/mailcow/src/mailcow-dockerized/data/web/edit.php
+++ b/mailcow/src/mailcow-dockerized/data/web/edit.php
@@ -2,19 +2,19 @@
 require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';

 $AuthUsers = array("admin", "domainadmin", "user");

 if (!isset($_SESSION['mailcow_cc_role']) OR !in_array($_SESSION['mailcow_cc_role'], $AuthUsers)) {

-	header('Location: /');

-	exit();

+  header('Location: /');

+  exit();

 }

 require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';

 ?>

 <div class="container">

-	<div class="row">

-		<div class="col-md-12">

-			<div class="panel panel-default">

-				<div class="panel-heading">

-					<h3 class="panel-title"><?=$lang['edit']['title'];?></h3>

-				</div>

-				<div class="panel-body">

+  <div class="row">

+    <div class="col-md-12">

+      <div class="panel panel-default">

+        <div class="panel-heading">

+          <h3 class="panel-title"><?=$lang['edit']['title'];?></h3>

+        </div>

+        <div class="panel-body">

 <?php

 if (isset($_SESSION['mailcow_cc_role'])) {

   if ($_SESSION['mailcow_cc_role'] == "admin"  || $_SESSION['mailcow_cc_role'] == "domainadmin") {

@@ -82,7 +82,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editalias" data-item="<?=htmlspecialchars($alias);?>" data-api-url='edit/alias' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editalias" data-item="<?=htmlspecialchars($alias);?>" data-api-url='edit/alias' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -106,7 +106,8 @@
         <div class="form-group">

           <label class="control-label col-sm-2" for="username_new"><?=$lang['edit']['username'];?></label>

           <div class="col-sm-10">

-            <input class="form-control" type="text" name="username_new" value="<?=htmlspecialchars($domain_admin);?>" />

+            <input class="form-control" type="text" name="username_new" value="<?=htmlspecialchars($domain_admin);?>" required onkeyup="this.value = this.value.toLowerCase();" />

+            &rdsh; <kbd>a-z - _ .</kbd>

           </div>

         </div>

         <div class="form-group">

@@ -156,7 +157,7 @@
         </div>

         <div class="form-group">

           <div class="col-sm-offset-2 col-sm-10">

-            <button class="btn btn-success" data-action="edit_selected" data-api-reload-location="/admin" data-id="editdomainadmin" data-item="<?=$domain_admin;?>" data-api-url='edit/domain-admin' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+            <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-api-reload-location="/admin" data-id="editdomainadmin" data-item="<?=$domain_admin;?>" data-api-url='edit/domain-admin' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

           </div>

         </div>

       </form>

@@ -167,7 +168,7 @@
           </div>

           <div class="col-sm-10">

             <div class="form-group">

-              <select id="da_acl" name="da_acl" size="10" multiple>

+              <select id="da_acl" name="da_acl" size="10" data-container="body" multiple>

               <?php

               $da_acls = acl('get', 'domainadmin', $domain_admin);

               foreach ($da_acls as $acl => $val):

@@ -179,7 +180,7 @@
               </select>

             </div>

             <div class="form-group">

-              <button class="btn btn-default" data-action="edit_selected" data-id="daacl" data-item="<?=htmlspecialchars($domain_admin);?>" data-api-url='edit/da-acl' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

+              <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="daacl" data-item="<?=htmlspecialchars($domain_admin);?>" data-api-url='edit/da-acl' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

             </div>

           </div>

         </div>

@@ -197,14 +198,15 @@
       $result = admin('details', $admin);

       if (!empty($result)) {

       ?>

-      <h4><?=$lang['edit']['domain_admin'];?></h4>

+      <h4><?=$lang['edit']['admin'];?></h4>

       <br>

       <form class="form-horizontal" data-id="editadmin" role="form" method="post" autocomplete="off">

         <input type="hidden" value="0" name="active">

         <div class="form-group">

           <label class="control-label col-sm-2" for="username_new"><?=$lang['edit']['username'];?></label>

           <div class="col-sm-10">

-            <input class="form-control" type="text" name="username_new" value="<?=htmlspecialchars($admin);?>" />

+            <input class="form-control" type="text" name="username_new" onkeyup="this.value = this.value.toLowerCase();" required value="<?=htmlspecialchars($admin);?>" />

+            &rdsh; <kbd>a-z - _ .</kbd>

           </div>

         </div>

         <div class="form-group">

@@ -235,7 +237,7 @@
         </div>

         <div class="form-group">

           <div class="col-sm-offset-2 col-sm-10">

-            <button class="btn btn-success" data-action="edit_selected" data-api-reload-location="/admin" data-id="editadmin" data-item="<?=$admin;?>" data-api-url='edit/admin' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+            <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-api-reload-location="/admin" data-id="editadmin" data-item="<?=$admin;?>" data-api-url='edit/admin' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

           </div>

         </div>

       </form>

@@ -252,189 +254,233 @@
       !empty($_GET["domain"])) {

         $domain = $_GET["domain"];

         $result = mailbox('get', 'domain_details', $domain);

+        $quota_notification_bcc = quota_notification_bcc('get', $domain);

         $rl = ratelimit('get', 'domain', $domain);

         $rlyhosts = relayhost('get');

         if (!empty($result)) {

         ?>

-          <h4><?=$lang['edit']['domain'];?></h4>

-          <form data-id="editdomain" class="form-horizontal" role="form" method="post">

-            <input type="hidden" value="0" name="active">

-            <input type="hidden" value="0" name="backupmx">

-            <input type="hidden" value="0" name="gal">

-            <input type="hidden" value="0" name="relay_all_recipients">

-            <input type="hidden" value="0" name="relay_unknown_only">

-            <div class="form-group" data-acl="<?=$_SESSION['acl']['domain_desc'];?>">

-              <label class="control-label col-sm-2" for="description"><?=$lang['edit']['description'];?></label>

-              <div class="col-sm-10">

-                <input type="text" class="form-control" name="description" value="<?=htmlspecialchars($result['description']);?>">

-              </div>

-            </div>

-            <?php

-            if ($_SESSION['mailcow_cc_role'] == "admin") {

-            ?>

-            <div class="form-group">

-              <label class="control-label col-sm-2" for="aliases"><?=$lang['edit']['max_aliases'];?></label>

-              <div class="col-sm-10">

-                <input type="number" class="form-control" name="aliases" value="<?=intval($result['max_num_aliases_for_domain']);?>">

-              </div>

-            </div>

-            <div class="form-group">

-              <label class="control-label col-sm-2" for="mailboxes"><?=$lang['edit']['max_mailboxes'];?></label>

-              <div class="col-sm-10">

-                <input type="number" class="form-control" name="mailboxes" value="<?=intval($result['max_num_mboxes_for_domain']);?>">

-              </div>

-            </div>

-            <div class="form-group">

-                <label class="control-label col-sm-2" for="defquota"><?=$lang['edit']['mailbox_quota_def'];?></label>

+          <ul class="nav nav-tabs responsive-tabs" role="tablist">

+            <li class="active"><a data-toggle="tab" href="#dedit"><?=$lang['edit']['domain'];?></a></li>

+            <li><a data-toggle="tab" href="#dratelimit"><?=$lang['edit']['ratelimit'];?></a></li>

+            <li><a data-toggle="tab" href="#dspamfilter"><?=$lang['edit']['spam_filter'];?></a></li>

+            <li><a data-toggle="tab" href="#dqwbcc"><?=$lang['edit']['quota_warning_bcc'];?></a></li>

+          </ul>

+          <hr>

+          <div class="tab-content">

+            <div id="dedit" class="tab-pane in active">

+            <form data-id="editdomain" class="form-horizontal" role="form" method="post">

+              <input type="hidden" value="0" name="active">

+              <input type="hidden" value="0" name="backupmx">

+              <input type="hidden" value="0" name="gal">

+              <input type="hidden" value="0" name="relay_all_recipients">

+              <input type="hidden" value="0" name="relay_unknown_only">

+              <div class="form-group" data-acl="<?=$_SESSION['acl']['domain_desc'];?>">

+                <label class="control-label col-sm-2" for="description"><?=$lang['edit']['description'];?></label>

                 <div class="col-sm-10">

-                    <input type="number" class="form-control" name="defquota" value="<?=intval($result['def_quota_for_mbox'] / 1048576);?>">

+                  <input type="text" class="form-control" name="description" value="<?=htmlspecialchars($result['description']);?>">

                 </div>

-            </div>

-            <div class="form-group">

-              <label class="control-label col-sm-2" for="maxquota"><?=$lang['edit']['max_quota'];?></label>

-              <div class="col-sm-10">

-                <input type="number" class="form-control" name="maxquota" value="<?=intval($result['max_quota_for_mbox'] / 1048576);?>">

               </div>

-            </div>

-            <div class="form-group">

-              <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['domain_quota'];?></label>

-              <div class="col-sm-10">

-                <input type="number" class="form-control" name="quota" value="<?=intval($result['max_quota_for_domain'] / 1048576);?>">

-              </div>

-            </div>

-            <div class="form-group">

-              <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['relayhost'];?></label>

-              <div class="col-sm-10">

-                <select data-live-search="true" name="relayhost" class="form-control">

-                  <?php

-                  foreach ($rlyhosts as $rlyhost) {

-                  ?>

-                  <option value="<?=$rlyhost['id'];?>" <?=($result['relayhost'] == $rlyhost['id']) ? 'selected' : null;?>>ID <?=$rlyhost['id'];?>: <?=$rlyhost['hostname'];?> (<?=$rlyhost['username'];?>)</option>

-                  <?php

-                  }

-                  ?>

-                  <option value="" <?=($result['relayhost'] == "0") ? 'selected' : null;?>>None</option>

-                </select>

-              </div>

-            </div>

-            <div class="form-group">

-              <label class="control-label col-sm-2"><?=$lang['edit']['backup_mx_options'];?></label>

-              <div class="col-sm-10">

-                <div class="checkbox">

-                  <label><input type="checkbox" value="1" name="backupmx" <?=(isset($result['backupmx']) && $result['backupmx']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_domain'];?></label>

-                  <br>

-                  <label><input type="checkbox" value="1" name="relay_all_recipients" <?=(isset($result['relay_all_recipients']) && $result['relay_all_recipients']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_all'];?></label>

-                  <p><?=$lang['edit']['relay_all_info'];?></p>

-                  <label><input type="checkbox" value="1" name="relay_unknown_only" <?=(isset($result['relay_unknown_only']) && $result['relay_unknown_only']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_unknown_only'];?></label>

-                  <br>

-                  <p><?=$lang['edit']['relay_transport_info'];?></p>

-                  <hr style="margin:25px 0px 0px 0px">

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="relayhost"><?=$lang['edit']['relayhost'];?></label>

+                <div class="col-sm-10">

+                  <select data-acl="<?=$_SESSION['acl']['domain_relayhost'];?>" data-live-search="true" id="relayhost" name="relayhost" class="form-control">

+                    <?php

+                    foreach ($rlyhosts as $rlyhost) {

+                    ?>

+                    <option class="<?=($rlyhost['active'] == 1) ? '' : 'background: #ff4136; color: #fff';?>" value="<?=$rlyhost['id'];?>" <?=($result['relayhost'] == $rlyhost['id']) ? 'selected' : null;?>>ID <?=$rlyhost['id'];?>: <?=$rlyhost['hostname'];?> (<?=$rlyhost['username'];?>)</option>

+                    <?php

+                    }

+                    ?>

+                    <option value="" <?=($result['relayhost'] == "0") ? 'selected' : null;?>><?=$lang['edit']['none_inherit'];?></option>

+                  </select>

                 </div>

               </div>

+              <?php

+              if ($_SESSION['mailcow_cc_role'] == "admin") {

+              ?>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="aliases"><?=$lang['edit']['max_aliases'];?></label>

+                <div class="col-sm-10">

+                  <input type="number" class="form-control" name="aliases" value="<?=intval($result['max_num_aliases_for_domain']);?>">

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="mailboxes"><?=$lang['edit']['max_mailboxes'];?></label>

+                <div class="col-sm-10">

+                  <input type="number" class="form-control" name="mailboxes" value="<?=intval($result['max_num_mboxes_for_domain']);?>">

+                </div>

+              </div>

+              <div class="form-group">

+                  <label class="control-label col-sm-2" for="defquota"><?=$lang['edit']['mailbox_quota_def'];?></label>

+                  <div class="col-sm-10">

+                      <input type="number" class="form-control" name="defquota" value="<?=intval($result['def_quota_for_mbox'] / 1048576);?>">

+                  </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="maxquota"><?=$lang['edit']['max_quota'];?></label>

+                <div class="col-sm-10">

+                  <input type="number" class="form-control" name="maxquota" value="<?=intval($result['max_quota_for_mbox'] / 1048576);?>">

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['domain_quota'];?></label>

+                <div class="col-sm-10">

+                  <input type="number" class="form-control" name="quota" value="<?=intval($result['max_quota_for_domain'] / 1048576);?>">

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2"><?=$lang['edit']['backup_mx_options'];?></label>

+                <div class="col-sm-10">

+                  <div class="checkbox">

+                    <label><input type="checkbox" value="1" name="backupmx" <?=(isset($result['backupmx']) && $result['backupmx']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_domain'];?></label>

+                    <br>

+                    <label><input type="checkbox" value="1" name="relay_all_recipients" <?=(isset($result['relay_all_recipients']) && $result['relay_all_recipients']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_all'];?></label>

+                    <p><?=$lang['edit']['relay_all_info'];?></p>

+                    <label><input type="checkbox" value="1" name="relay_unknown_only" <?=(isset($result['relay_unknown_only']) && $result['relay_unknown_only']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_unknown_only'];?></label>

+                    <br>

+                    <p><?=$lang['edit']['relay_transport_info'];?></p>

+                    <hr style="margin:25px 0px 0px 0px">

+                  </div>

+                </div>

+              </div>

+              <?php

+              }

+              ?>

+              <div class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                  <div class="checkbox">

+                    <label><input type="checkbox" value="1" name="gal" <?=(isset($result['gal']) && $result['gal']=="1") ? "checked" : null;?>> <?=$lang['edit']['gal'];?></label>

+                    <small class="help-block"><?=$lang['edit']['gal_info'];?></small>

+                  </div>

+                </div>

+              </div>

+              <hr>

+              <div class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                  <div class="checkbox">

+                    <label><input type="checkbox" value="1" name="active" <?=(isset($result['active']) && $result['active']=="1") ? "checked" : null;?> <?=($_SESSION['mailcow_cc_role'] == "admin") ? null : "disabled";?>> <?=$lang['edit']['active'];?></label>

+                  </div>

+                </div>

+              </div>

+              <div class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                  <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editdomain" data-item="<?=$domain;?>" data-api-url='edit/domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

+                </div>

+              </div>

+            </form>

+            <?php

+            if (!empty($dkim = dkim('details', $domain))) {

+            ?>

+            <hr>

+            <div class="row">

+              <div class="col-xs-12 col-sm-2">

+                <p>Domain: <strong><?=htmlspecialchars($result['domain_name']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>

+              </div>

+              <div class="col-xs-12 col-sm-10">

+                <pre><?=$dkim['dkim_txt'];?></pre>

+              </div>

             </div>

             <?php

             }

             ?>

-            <div class="form-group">

-              <div class="col-sm-offset-2 col-sm-10">

-                <div class="checkbox">

-                  <label><input type="checkbox" value="1" name="gal" <?=(isset($result['gal']) && $result['gal']=="1") ? "checked" : null;?>> <?=$lang['edit']['gal'];?></label>

-                  <small class="help-block"><?=$lang['edit']['gal_info'];?></small>

+            </div>

+            <div id="dratelimit" class="tab-pane">

+              <form data-id="domratelimit" class="form-inline well" method="post">

+                <div class="form-group">

+                  <label class="control-label"><?=$lang['edit']['ratelimit'];?></label>

+                  <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="<?=$lang['ratelimit']['disabled']?>">

+                </div>

+                <div class="form-group">

+                  <select name="rl_frame" class="form-control">

+                    <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>><?=$lang['ratelimit']['second']?></option>

+                    <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>><?=$lang['ratelimit']['minute']?></option>

+                    <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>><?=$lang['ratelimit']['hour']?></option>

+                    <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>><?=$lang['ratelimit']['day']?></option>

+                  </select>

+                </div>

+                <div class="form-group">

+                  <button data-acl="<?=$_SESSION['acl']['ratelimit'];?>" class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="domratelimit" data-item="<?=$domain;?>" data-api-url='edit/rl-domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

+                </div>

+              </form>

+            </div>

+            <div id="dspamfilter" class="tab-pane">

+              <div class="row">

+                <div class="col-sm-6">

+                  <h4><?=$lang['user']['spamfilter_wl'];?></h4>

+                  <p><?=$lang['user']['spamfilter_wl_desc'];?></p>

+                  <form class="form-inline space20" data-id="add_wl_policy_domain">

+                    <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

+                      <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>

+                      <span class="input-group-btn">

+                        <button class="btn btn-default" data-action="add_item" data-id="add_wl_policy_domain" data-api-url='add/domain-policy' data-api-attr='{"domain":"<?= $domain; ?>","object_list":"wl"}' href="#"><?=$lang['user']['spamfilter_table_add'];?></button>

+                      </span>

+                    </div>

+                  </form>

+                  <div class="table-responsive">

+                    <table class="table table-striped table-condensed" id="wl_policy_domain_table"></table>

+                  </div>

+                  <div class="mass-actions-user">

+                    <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

+                      <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_wl_domain" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>

+                      <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-danger" data-action="delete_selected" data-id="policy_wl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a>

+                      <div class="clearfix visible-xs"></div>

+                    </div>

+                  </div>

+                </div>

+                <div class="col-sm-6">

+                  <h4><?=$lang['user']['spamfilter_bl'];?></h4>

+                  <p><?=$lang['user']['spamfilter_bl_desc'];?></p>

+                  <form class="form-inline space20" data-id="add_bl_policy_domain">

+                    <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

+                      <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>

+                      <span class="input-group-btn">

+                        <button class="btn btn-default" data-action="add_item" data-id="add_bl_policy_domain" data-api-url='add/domain-policy' data-api-attr='{"domain":"<?= $domain; ?>","object_list":"bl"}' href="#"><?=$lang['user']['spamfilter_table_add'];?></button>

+                      </span>

+                    </div>

+                  </form>

+                  <div class="table-responsive">

+                    <table class="table table-striped table-condensed" id="bl_policy_domain_table"></table>

+                  </div>

+                  <div class="mass-actions-user">

+                    <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

+                      <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_bl_domain" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>

+                      <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-danger" data-action="delete_selected" data-id="policy_bl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a></li>

+                    </div>

+                  </div>

                 </div>

               </div>

             </div>

-            <div class="form-group">

-              <div class="col-sm-offset-2 col-sm-10">

-                <div class="checkbox">

-                  <label><input type="checkbox" value="1" name="active" <?=(isset($result['active']) && $result['active']=="1") ? "checked" : null;?> <?=($_SESSION['mailcow_cc_role'] == "admin") ? null : "disabled";?>> <?=$lang['edit']['active'];?></label>

+            <div id="dqwbcc" class="tab-pane">

+              <div class="row">

+                <div class="col-sm-12">

+                  <h4><?=$lang['edit']['quota_warning_bcc'];?></h4>

+                  <p><?=$lang['edit']['quota_warning_bcc_info'];?></p>

+                  <form class="form-horizontal" data-id="quota_bcc">

+                    <input type="hidden" value="0" name="active">

+                    <div class="form-group">

+                      <label class="control-label col-sm-2" for="script_data"><?=$lang['edit']['target_address'];?>:</label>

+                      <div class="col-sm-10">

+                        <textarea spellcheck="false" autocorrect="off" autocapitalize="none" class="form-control" rows="10" id="bcc_rcpt" name="bcc_rcpt"><?=implode(PHP_EOL, (array)$quota_notification_bcc['bcc_rcpts']);?></textarea>

+                      </div>

+                    </div>

+                    <div class="form-group">

+                      <div class="col-sm-offset-2 col-sm-10">

+                        <div class="checkbox">

+                        <label><input type="checkbox" value="1" name="active" <?=($quota_notification_bcc['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>

+                        </div>

+                      </div>

+                    </div>

+                    <div class="form-group">

+                      <div class="col-sm-offset-2 col-sm-10">

+                        <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="quota_bcc" data-item="quota_bcc" data-api-url='edit/quota_notification_bcc' data-api-attr='{"domain":"<?=$domain;?>"}' href="#"><?=$lang['edit']['save'];?></button>

+                      </div>

+                    </div>

+                  </form>

                 </div>

               </div>

             </div>

-            <div class="form-group">

-              <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editdomain" data-item="<?=$domain;?>" data-api-url='edit/domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

-              </div>

-            </div>

-          </form>

-          <?php

-          if (!empty($dkim = dkim('details', $domain))) {

-          ?>

-          <hr>

-          <div class="row">

-            <div class="col-xs-2">

-              <p>Domain: <strong><?=htmlspecialchars($result['domain_name']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>

-            </div>

-            <div class="col-xs-10">

-              <pre><?=$dkim['dkim_txt'];?></pre>

-            </div>

           </div>

           <?php

-          }

-          ?>

-      <hr>

-      <form data-id="domratelimit" class="form-inline well" method="post">

-        <div class="form-group">

-          <label class="control-label"><?=$lang['acl']['ratelimit'];?></label>

-          <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="disabled">

-        </div>

-        <div class="form-group">

-          <select name="rl_frame" class="form-control">

-            <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>

-            <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>

-            <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>

-            <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>>msgs / day</option>

-          </select>

-        </div>

-        <div class="form-group">

-          <button data-acl="<?=$_SESSION['acl']['ratelimit'];?>" class="btn btn-default" data-action="edit_selected" data-id="domratelimit" data-item="<?=$domain;?>" data-api-url='edit/rl-domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

-        </div>

-      </form>

-      <hr>

-      <div class="row">

-        <div class="col-sm-6">

-          <h4><?=$lang['user']['spamfilter_wl'];?></h4>

-          <p><?=$lang['user']['spamfilter_wl_desc'];?></p>

-          <div class="table-responsive">

-            <table class="table table-striped table-condensed" id="wl_policy_domain_table"></table>

-          </div>

-          <div class="mass-actions-user">

-            <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

-              <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_wl_domain" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>

-              <a class="btn btn-sm btn-danger" data-action="delete_selected" data-id="policy_wl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a></li>

-            </div>

-          </div>

-          <form class="form-inline" data-id="add_wl_policy_domain">

-            <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

-              <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>

-              <span class="input-group-btn">

-                <button class="btn btn-default" data-action="add_item" data-id="add_wl_policy_domain" data-api-url='add/domain-policy' data-api-attr='{"domain":"<?= $domain; ?>","object_list":"wl"}' href="#"><?=$lang['user']['spamfilter_table_add'];?></button>

-              </span>

-            </div>

-          </form>

-        </div>

-        <div class="col-sm-6">

-          <h4><?=$lang['user']['spamfilter_bl'];?></h4>

-          <p><?=$lang['user']['spamfilter_bl_desc'];?></p>

-          <div class="table-responsive">

-            <table class="table table-striped table-condensed" id="bl_policy_domain_table"></table>

-          </div>

-          <div class="mass-actions-user">

-            <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

-              <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_bl_domain" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>

-              <a class="btn btn-sm btn-danger" data-action="delete_selected" data-id="policy_bl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a></li>

-            </div>

-          </div>

-          <form class="form-inline" data-id="add_bl_policy_domain">

-            <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">

-              <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>

-              <span class="input-group-btn">

-                <button class="btn btn-default" data-action="add_item" data-id="add_bl_policy_domain" data-api-url='add/domain-policy' data-api-attr='{"domain":"<?= $domain; ?>","object_list":"bl"}' href="#"><?=$lang['user']['spamfilter_table_add'];?></button>

-              </span>

-            </div>

-          </form>

-        </div>

-      </div>

-          <?php

         }

         else {

         ?>

@@ -477,7 +523,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-default" data-action="edit_selected" data-id="oauth2client" data-item="<?=$oauth2client;?>" data-api-url='edit/oauth2-client' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="oauth2client" data-item="<?=$oauth2client;?>" data-api-url='edit/oauth2-client' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

               </div>

             </div>

           </form>

@@ -523,7 +569,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editaliasdomain" data-item="<?=$alias_domain;?>" data-api-url='edit/alias-domain' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editaliasdomain" data-item="<?=$alias_domain;?>" data-api-url='edit/alias-domain' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -531,18 +577,18 @@
           <form data-id="domratelimit" class="form-inline well" method="post">

             <div class="form-group">

               <label class="control-label"><?=$lang['acl']['ratelimit'];?></label>

-              <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="disabled">

+              <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="<?=$lang['ratelimit']['disabled']?>">

             </div>

             <div class="form-group">

               <select name="rl_frame" class="form-control">

-                <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>

-                <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>

-                <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>

-                <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>>msgs / day</option>

+                <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>><?=$lang['ratelimit']['second']?></option>

+                <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>><?=$lang['ratelimit']['minute']?></option>

+                <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>><?=$lang['ratelimit']['hour']?></option>

+                <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>><?=$lang['ratelimit']['day']?></option>

               </select>

             </div>

             <div class="form-group">

-              <button class="btn btn-default" data-action="edit_selected" data-id="domratelimit" data-item="<?=$alias_domain;?>" data-api-url='edit/rl-domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

+              <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="domratelimit" data-item="<?=$alias_domain;?>" data-api-url='edit/rl-domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>

             </div>

           </form>

           <?php

@@ -550,10 +596,10 @@
           ?>

           <hr>

           <div class="row">

-            <div class="col-xs-2">

+            <div class="col-xs-12 col-sm-2">

               <p>Domain: <strong><?=htmlspecialchars($result['alias_domain']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>

             </div>

-            <div class="col-xs-10">

+            <div class="col-xs-12 col-sm-10">

             <pre><?=$dkim['dkim_txt'];?></pre>

             </div>

           </div>

@@ -574,366 +620,402 @@
       $quarantine_notification = mailbox('get', 'quarantine_notification', $mailbox);

       $quarantine_category = mailbox('get', 'quarantine_category', $mailbox);

       $get_tls_policy = mailbox('get', 'tls_policy', $mailbox);

+      $rlyhosts = relayhost('get');

       if (!empty($result)) {

         ?>

-        <h4><?=$lang['edit']['mailbox'];?></h4>

-        <form class="form-horizontal" data-id="editmailbox" role="form" method="post">

-          <input type="hidden" value="default" name="sender_acl">

-          <input type="hidden" value="0" name="force_pw_update">

-          <input type="hidden" value="0" name="sogo_access">

-          <input type="hidden" value="0" name="protocol_access">

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="name"><?=$lang['edit']['full_name'];?></label>

-            <div class="col-sm-10">

-            <input type="text" class="form-control" name="name" value="<?=htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8');?>">

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['quota_mb'];?>

-              <br><span id="quotaBadge" class="badge">max. <?=intval($result['max_new_quota'] / 1048576)?> MiB</span>

-            </label>

-            <div class="col-sm-10">

-              <input type="number" name="quota" style="width:100%" min="0" max="<?=intval($result['max_new_quota'] / 1048576);?>" value="<?=intval($result['quota']) / 1048576;?>" class="form-control">

-              <small class="help-block">0 = ∞</small>

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="sender_acl"><?=$lang['edit']['sender_acl'];?></label>

-            <div class="col-sm-10">

-              <select data-live-search="true" data-width="100%" style="width:100%" id="editSelectSenderACL" name="sender_acl" size="10" multiple>

-              <?php

-              $sender_acl_handles = mailbox('get', 'sender_acl_handles', $mailbox);

-

-              foreach ($sender_acl_handles['sender_acl_domains']['ro'] as $domain):

-                ?>

-                <option data-subtext="Admin" value="<?=htmlspecialchars($domain);?>" disabled selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>

-                <?php

-              endforeach;

-

-              foreach ($sender_acl_handles['sender_acl_addresses']['ro'] as $alias):

-                ?>

-              <option data-subtext="Admin" disabled selected><?=htmlspecialchars($alias);?></option>

-                <?php

-              endforeach;

-

-              foreach ($sender_acl_handles['fixed_sender_aliases'] as $alias):

-                ?>

-                <option data-subtext="Alias" disabled selected><?=htmlspecialchars($alias);?></option>

-                <?php

-              endforeach;

-

-              foreach ($sender_acl_handles['sender_acl_domains']['rw'] as $domain):

-                ?>

-                <option value="<?=htmlspecialchars($domain);?>" selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>

-                <?php

-              endforeach;

-

-              foreach ($sender_acl_handles['sender_acl_domains']['selectable'] as $domain):

-                ?>

-                <option value="<?=htmlspecialchars($domain);?>"><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>

-                <?php

-              endforeach;

-

-              foreach ($sender_acl_handles['sender_acl_addresses']['rw'] as $address):

-                ?>

-                  <option selected><?=htmlspecialchars($address);?></option>

-                <?php

-              endforeach;

-

-              foreach ($sender_acl_handles['sender_acl_addresses']['selectable'] as $address):

-                ?>

-                  <option><?=htmlspecialchars($address);?></option>

-                <?php

-              endforeach;

-

-              // Generated here, but used in extended_sender_acl

-              if (!empty($sender_acl_handles['external_sender_aliases'])) {

-                $ext_sender_acl = implode(', ', $sender_acl_handles['external_sender_aliases']);

-              }

-              else {

-                $ext_sender_acl = '';

-              }

-

-              ?>

-              </select>

-              <div style="display:none" id="sender_acl_disabled"><?=$lang['edit']['sender_acl_disabled'];?></div>

-              <small class="help-block"><?=$lang['edit']['sender_acl_info'];?></small>

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2"><?=$lang['user']['quarantine_notification'];?></label>

-            <div class="col-sm-10">

-            <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_notification'];?>">

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "never") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_notification"

-                data-api-url='edit/quarantine_notification'

-                data-api-attr='{"quarantine_notification":"never"}'><?=$lang['user']['never'];?></button>

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "hourly") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_notification"

-                data-api-url='edit/quarantine_notification'

-                data-api-attr='{"quarantine_notification":"hourly"}'><?=$lang['user']['hourly'];?></button>

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "daily") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_notification"

-                data-api-url='edit/quarantine_notification'

-                data-api-attr='{"quarantine_notification":"daily"}'><?=$lang['user']['daily'];?></button>

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "weekly") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_notification"

-                data-api-url='edit/quarantine_notification'

-                data-api-attr='{"quarantine_notification":"weekly"}'><?=$lang['user']['weekly'];?></button>

-            </div>

-            <p class="help-block"><small><?=$lang['user']['quarantine_notification_info'];?></small></p>

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2"><?=$lang['user']['quarantine_category'];?></label>

-            <div class="col-sm-10">

-            <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_category'];?>">

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_category == "reject") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_category"

-                data-api-url='edit/quarantine_category'

-                data-api-attr='{"quarantine_category":"reject"}'><?=$lang['user']['q_reject'];?></button>

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_category == "add_header") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_category"

-                data-api-url='edit/quarantine_category'

-                data-api-attr='{"quarantine_category":"add_header"}'><?=$lang['user']['q_add_header'];?></button>

-              <button type="button" class="btn btn-sm btn-default <?=($quarantine_category == "all") ? "active" : null;?>"

-                data-action="edit_selected"

-                data-item="<?= htmlentities($mailbox); ?>"

-                data-id="quarantine_category"

-                data-api-url='edit/quarantine_category'

-                data-api-attr='{"quarantine_category":"all"}'><?=$lang['user']['q_all'];?></button>

-            </div>

-            <p class="help-block"><small><?=$lang['user']['quarantine_category_info'];?></small></p>

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="sender_acl"><?=$lang['user']['tls_policy'];?></label>

-            <div class="col-sm-10">

-              <div class="btn-group" data-acl="<?=$_SESSION['acl']['tls_policy'];?>">

-                <button type="button" class="btn btn-sm btn-default <?=($get_tls_policy['tls_enforce_in'] == "1") ? "active" : null;?>"

-                  data-action="edit_selected"

-                  data-item="<?= htmlentities($mailbox); ?>"

-                  data-id="tls_policy"

-                  data-api-url='edit/tls_policy'

-                  data-api-attr='{"tls_enforce_in":<?=($get_tls_policy['tls_enforce_in'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_in'];?></button>

-                <button type="button" class="btn btn-sm btn-default <?=($get_tls_policy['tls_enforce_out'] == "1") ? "active" : null;?>"

-                  data-action="edit_selected"

-                  data-item="<?= htmlentities($mailbox); ?>"

-                  data-id="tls_policy"

-                  data-api-url='edit/tls_policy'

-                  data-api-attr='{"tls_enforce_out":<?=($get_tls_policy['tls_enforce_out'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_out'];?></button>

-              </div>

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>

-            <div class="col-sm-10">

-            <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="<?=$lang['edit']['unchanged_if_empty'];?>" autocomplete="new-password">

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>

-            <div class="col-sm-10">

-            <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">

-            </div>

-          </div>

-          <div data-acl="<?=$_SESSION['acl']['extend_sender_acl'];?>" class="form-group">

-            <label class="control-label col-sm-2" for="extended_sender_acl"><?=$lang['edit']['extended_sender_acl'];?></label>

-            <div class="col-sm-10">

-            <input type="text" class="form-control" name="extended_sender_acl" value="<?=empty($ext_sender_acl) ? '' : $ext_sender_acl; ?>" placeholder="user1@example.com, user2@example.org, @example.com, ...">

-            <small class="help-block"><?=$lang['edit']['extended_sender_acl_info'];?></small>

-            </div>

-          </div>

-          <div class="form-group">

-            <label class="control-label col-sm-2" for="protocol_access"><?=$lang['edit']['allowed_protocols'];?></label>

-            <div class="col-sm-10">

-            <select data-acl="<?=$_SESSION['acl']['protocol_access'];?>" name="protocol_access" multiple class="form-control">

-              <option value="imap" <?=($result['attributes']['imap_access']=="1") ? 'selected' : null;?>>IMAP</option>

-              <option value="pop3" <?=($result['attributes']['pop3_access']=="1") ? 'selected' : null;?>>POP3</option>

-              <option value="smtp" <?=($result['attributes']['smtp_access']=="1") ? 'selected' : null;?>>SMTP</option>

-            </select>

-            </div>

-          </div>

-          <div hidden data-acl="<?=$_SESSION['acl']['smtp_ip_access'];?>" class="form-group">

-            <label class="control-label col-sm-2" for="allow_from_smtp"><?=$lang['edit']['allow_from_smtp'];?></label>

-            <div class="col-sm-10">

-            <input type="text" class="form-control" name="allow_from_smtp" value="<?=empty($allow_from_smtp) ? '' : $allow_from_smtp; ?>" placeholder="1.1.1.1, 10.2.0.0/24, ...">

-            <small class="help-block"><?=$lang['edit']['allow_from_smtp_info'];?></small>

-            </div>

-          </div>

-          <hr>

-          <div class="form-group">

-            <div class="col-sm-offset-2 col-sm-10">

-            <select name="active" class="form-control">

-              <option value="1" <?=($result['active']=="1") ? 'selected' : null;?>><?=$lang['edit']['active'];?></option>

-              <option value="2" <?=($result['active']=="2") ? 'selected' : null;?>><?=$lang['edit']['disable_login'];?></option>

-              <option value="0" <?=($result['active']=="0") ? 'selected' : null;?>><?=$lang['edit']['inactive'];?></option>

-            </select>

-            </div>

-          </div>

-          <div class="form-group">

-            <div class="col-sm-offset-2 col-sm-10">

-              <div class="checkbox">

-              <label><input type="checkbox" value="1" name="force_pw_update" <?=($result['attributes']['force_pw_update']=="1") ? "checked" : null;?>> <?=$lang['edit']['force_pw_update'];?></label>

-              <small class="help-block"><?=sprintf($lang['edit']['force_pw_update_info'], $UI_TEXTS['main_name']);?></small>

-              </div>

-            </div>

-          </div>

-          <?php if (getenv('SKIP_SOGO') != "y") { ?>

-          <div data-acl="<?=$_SESSION['acl']['sogo_access'];?>" class="form-group">

-            <div class="col-sm-offset-2 col-sm-10">

-              <div class="checkbox">

-              <label><input type="checkbox" value="1" name="sogo_access" <?=($result['attributes']['sogo_access']=="1") ? "checked" : null;?>> <?=$lang['edit']['sogo_access'];?></label>

-              <small class="help-block"><?=$lang['edit']['sogo_access_info'];?></small>

-              </div>

-            </div>

-          </div>

-          <?php } ?>

-          <div class="form-group">

-            <div class="col-sm-offset-2 col-sm-10">

-              <button class="btn btn-success" data-action="edit_selected" data-id="editmailbox" data-item="<?=htmlspecialchars($result['username']);?>" data-api-url='edit/mailbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

-            </div>

-          </div>

-        </form>

+        <ul class="nav nav-tabs responsive-tabs" role="tablist">

+          <li class="active"><a data-toggle="tab" href="#medit"><?=$lang['edit']['mailbox'];?></a></li>

+          <li><a data-toggle="tab" href="#mpushover"><?=$lang['edit']['pushover'];?></a></li>

+          <li><a data-toggle="tab" href="#macl"><?=$lang['edit']['acl'];?></a></li>

+          <li><a data-toggle="tab" href="#mrl"><?=$lang['edit']['ratelimit'];?></a></li>

+        </ul>

         <hr>

-        <form data-id="pushover" class="form well" method="post">

-          <input type="hidden" value="0" name="evaluate_x_prio">

-          <input type="hidden" value="0" name="only_x_prio">

-          <input type="hidden" value="0" name="active">

-          <div class="row">

-            <div class="col-sm-1">

-              <p class="help-block"><a href="https://pushover.net" target="_blank"><img src="data:image/png;base64,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" class="img img-fluid"></a></p>

-            </div>

-            <div class="col-sm-10">

-              <p class="help-block"><?=sprintf($lang['edit']['pushover_info'], $mailbox);?></p>

-              <p class="help-block"><?=$lang['edit']['pushover_vars'];?>: <code>{SUBJECT}</code>, <code>{SENDER}</code></p>

+        <div class="tab-content">

+          <div id="medit" class="tab-pane in active">

+            <form class="form-horizontal" data-id="editmailbox" role="form" method="post">

+              <input type="hidden" value="default" name="sender_acl">

+              <input type="hidden" value="0" name="force_pw_update">

+              <input type="hidden" value="0" name="sogo_access">

+              <input type="hidden" value="0" name="protocol_access">

               <div class="form-group">

-                <div class="row">

-                  <div class="col-sm-6">

-                    <div class="form-group">

-                      <label for="token">API Token/Key (Application)</label>

-                      <input type="text" class="form-control" name="token" maxlength="30" value="<?=$pushover_data['token'];?>" required>

-                    </div>

+                <label class="control-label col-sm-2" for="name"><?=$lang['edit']['full_name'];?></label>

+                <div class="col-sm-10">

+                <input type="text" class="form-control" name="name" value="<?=htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8');?>">

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['quota_mb'];?>

+                  <br><span id="quotaBadge" class="badge">max. <?=intval($result['max_new_quota'] / 1048576)?> MiB</span>

+                </label>

+                <div class="col-sm-10">

+                  <input type="number" name="quota" style="width:100%" min="0" max="<?=intval($result['max_new_quota'] / 1048576);?>" value="<?=intval($result['quota']) / 1048576;?>" class="form-control">

+                  <small class="help-block">0 = ∞</small>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="sender_acl"><?=$lang['edit']['sender_acl'];?></label>

+                <div class="col-sm-10">

+                  <select data-live-search="true" data-width="100%" style="width:100%" id="editSelectSenderACL" name="sender_acl" size="10" multiple>

+                  <?php

+                  $sender_acl_handles = mailbox('get', 'sender_acl_handles', $mailbox);

+

+                  foreach ($sender_acl_handles['sender_acl_domains']['ro'] as $domain):

+                    ?>

+                    <option data-subtext="Admin" value="<?=htmlspecialchars($domain);?>" disabled selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>

+                    <?php

+                  endforeach;

+

+                  foreach ($sender_acl_handles['sender_acl_addresses']['ro'] as $alias):

+                    ?>

+                  <option data-subtext="Admin" disabled selected><?=htmlspecialchars($alias);?></option>

+                    <?php

+                  endforeach;

+

+                  foreach ($sender_acl_handles['fixed_sender_aliases'] as $alias):

+                    ?>

+                    <option data-subtext="Alias" disabled selected><?=htmlspecialchars($alias);?></option>

+                    <?php

+                  endforeach;

+

+                  foreach ($sender_acl_handles['sender_acl_domains']['rw'] as $domain):

+                    ?>

+                    <option value="<?=htmlspecialchars($domain);?>" selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>

+                    <?php

+                  endforeach;

+

+                  foreach ($sender_acl_handles['sender_acl_domains']['selectable'] as $domain):

+                    ?>

+                    <option value="<?=htmlspecialchars($domain);?>"><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>

+                    <?php

+                  endforeach;

+

+                  foreach ($sender_acl_handles['sender_acl_addresses']['rw'] as $address):

+                    ?>

+                      <option selected><?=htmlspecialchars($address);?></option>

+                    <?php

+                  endforeach;

+

+                  foreach ($sender_acl_handles['sender_acl_addresses']['selectable'] as $address):

+                    ?>

+                      <option><?=htmlspecialchars($address);?></option>

+                    <?php

+                  endforeach;

+

+                  // Generated here, but used in extended_sender_acl

+                  if (!empty($sender_acl_handles['external_sender_aliases'])) {

+                    $ext_sender_acl = implode(', ', $sender_acl_handles['external_sender_aliases']);

+                  }

+                  else {

+                    $ext_sender_acl = '';

+                  }

+

+                  ?>

+                  </select>

+                  <div id="sender_acl_disabled"><i class="bi bi-shield-exclamation"></i> <?=$lang['edit']['sender_acl_disabled'];?></div>

+                  <small class="help-block"><?=$lang['edit']['sender_acl_info'];?></small>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="relayhost"><?=$lang['edit']['relayhost'];?></label>

+                <div class="col-sm-10">

+                  <select data-acl="<?=$_SESSION['acl']['mailbox_relayhost'];?>" data-live-search="true" id="relayhost" name="relayhost" class="form-control space20">

+                    <?php

+                    foreach ($rlyhosts as $rlyhost) {

+                    ?>

+                        <option style="<?=($rlyhost['active'] == 1) ? '' : 'background: #ff4136; color: #fff';?>" value="<?=$rlyhost['id'];?>" <?=($result['attributes']['relayhost'] == $rlyhost['id']) ? 'selected' : null;?>>ID <?=$rlyhost['id'];?>: <?=$rlyhost['hostname'];?> (<?=$rlyhost['username'];?>)</option>

+                    <?php

+                    }

+                    ?>

+                    <option value="" <?=($result['attributes']['relayhost'] == "0" || empty($result['attributes']['relayhost'])) ? 'selected' : null;?>><?=$lang['edit']['none_inherit'];?></option>

+                  </select>

+                  <p class="visible-xs" style="margin: 0;padding: 0">&nbsp;</p>

+                  <small class="help-block"><?=$lang['edit']['mailbox_relayhost_info'];?></small>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2"><?=$lang['user']['quarantine_notification'];?></label>

+                <div class="col-sm-10">

+                <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_notification'];?>">

+                  <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "never") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_notification"

+                    data-api-url='edit/quarantine_notification'

+                    data-api-attr='{"quarantine_notification":"never"}'><?=$lang['user']['never'];?></button>

+                  <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "hourly") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_notification"

+                    data-api-url='edit/quarantine_notification'

+                    data-api-attr='{"quarantine_notification":"hourly"}'><?=$lang['user']['hourly'];?></button>

+                  <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "daily") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_notification"

+                    data-api-url='edit/quarantine_notification'

+                    data-api-attr='{"quarantine_notification":"daily"}'><?=$lang['user']['daily'];?></button>

+                  <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "weekly") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_notification"

+                    data-api-url='edit/quarantine_notification'

+                    data-api-attr='{"quarantine_notification":"weekly"}'><?=$lang['user']['weekly'];?></button>

+                    <div class="clearfix visible-xs"></div>

+                </div>

+                <p class="help-block"><small><?=$lang['user']['quarantine_notification_info'];?></small></p>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2"><?=$lang['user']['quarantine_category'];?></label>

+                <div class="col-sm-10">

+                <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_category'];?>">

+                  <button type="button" class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_category == "reject") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_category"

+                    data-api-url='edit/quarantine_category'

+                    data-api-attr='{"quarantine_category":"reject"}'><?=$lang['user']['q_reject'];?></button>

+                  <button type="button" class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_category == "add_header") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_category"

+                    data-api-url='edit/quarantine_category'

+                    data-api-attr='{"quarantine_category":"add_header"}'><?=$lang['user']['q_add_header'];?></button>

+                  <button type="button" class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_category == "all") ? "active" : null;?>"

+                    data-action="edit_selected"

+                    data-item="<?= htmlentities($mailbox); ?>"

+                    data-id="quarantine_category"

+                    data-api-url='edit/quarantine_category'

+                    data-api-attr='{"quarantine_category":"all"}'><?=$lang['user']['q_all'];?></button>

+                    <div class="clearfix visible-xs"></div>

+                </div>

+                <p class="help-block"><small><?=$lang['user']['quarantine_category_info'];?></small></p>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="sender_acl"><?=$lang['user']['tls_policy'];?></label>

+                <div class="col-sm-10">

+                  <div class="btn-group" data-acl="<?=$_SESSION['acl']['tls_policy'];?>">

+                    <button type="button" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($get_tls_policy['tls_enforce_in'] == "1") ? "active" : null;?>"

+                      data-action="edit_selected"

+                      data-item="<?= htmlentities($mailbox); ?>"

+                      data-id="tls_policy"

+                      data-api-url='edit/tls_policy'

+                      data-api-attr='{"tls_enforce_in":<?=($get_tls_policy['tls_enforce_in'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_in'];?></button>

+                    <button type="button" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($get_tls_policy['tls_enforce_out'] == "1") ? "active" : null;?>"

+                      data-action="edit_selected"

+                      data-item="<?= htmlentities($mailbox); ?>"

+                      data-id="tls_policy"

+                      data-api-url='edit/tls_policy'

+                      data-api-attr='{"tls_enforce_out":<?=($get_tls_policy['tls_enforce_out'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_out'];?></button>

+                      <div class="clearfix visible-xs"></div>

                   </div>

-                  <div class="col-sm-6">

-                    <div class="form-group">

-                      <label for="key">User/Group Key</label>

-                      <input type="text" class="form-control" name="key" maxlength="30" value="<?=$pushover_data['key'];?>" required>

-                    </div>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>

+                <div class="col-sm-10">

+                <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="<?=$lang['edit']['unchanged_if_empty'];?>" autocomplete="new-password">

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>

+                <div class="col-sm-10">

+                <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">

+                </div>

+              </div>

+              <div data-acl="<?=$_SESSION['acl']['extend_sender_acl'];?>" class="form-group">

+                <label class="control-label col-sm-2" for="extended_sender_acl"><?=$lang['edit']['extended_sender_acl'];?></label>

+                <div class="col-sm-10">

+                <input type="text" class="form-control" name="extended_sender_acl" value="<?=empty($ext_sender_acl) ? '' : $ext_sender_acl; ?>" placeholder="user1@example.com, user2@example.org, @example.com, ...">

+                <small class="help-block"><?=$lang['edit']['extended_sender_acl_info'];?></small>

+                </div>

+              </div>

+              <div class="form-group">

+                <label class="control-label col-sm-2" for="protocol_access"><?=$lang['edit']['allowed_protocols'];?></label>

+                <div class="col-sm-10">

+                <select data-acl="<?=$_SESSION['acl']['protocol_access'];?>" name="protocol_access" multiple class="form-control">

+                  <option value="imap" <?=($result['attributes']['imap_access']=="1") ? 'selected' : null;?>>IMAP</option>

+                  <option value="pop3" <?=($result['attributes']['pop3_access']=="1") ? 'selected' : null;?>>POP3</option>

+                  <option value="smtp" <?=($result['attributes']['smtp_access']=="1") ? 'selected' : null;?>>SMTP</option>

+                </select>

+                </div>

+              </div>

+              <div hidden data-acl="<?=$_SESSION['acl']['smtp_ip_access'];?>" class="form-group">

+                <label class="control-label col-sm-2" for="allow_from_smtp"><?=$lang['edit']['allow_from_smtp'];?></label>

+                <div class="col-sm-10">

+                <input type="text" class="form-control" name="allow_from_smtp" value="<?=empty($allow_from_smtp) ? '' : $allow_from_smtp; ?>" placeholder="1.1.1.1, 10.2.0.0/24, ...">

+                <small class="help-block"><?=$lang['edit']['allow_from_smtp_info'];?></small>

+                </div>

+              </div>

+              <hr>

+              <div class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                <select name="active" class="form-control">

+                  <option value="1" <?=($result['active']=="1") ? 'selected' : null;?>><?=$lang['edit']['active'];?></option>

+                  <option value="2" <?=($result['active']=="2") ? 'selected' : null;?>><?=$lang['edit']['disable_login'];?></option>

+                  <option value="0" <?=($result['active']=="0") ? 'selected' : null;?>><?=$lang['edit']['inactive'];?></option>

+                </select>

+                </div>

+              </div>

+              <div class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                  <div class="checkbox">

+                  <label><input type="checkbox" value="1" name="force_pw_update" <?=($result['attributes']['force_pw_update']=="1") ? "checked" : null;?>> <?=$lang['edit']['force_pw_update'];?></label>

+                  <small class="help-block"><?=sprintf($lang['edit']['force_pw_update_info'], $UI_TEXTS['main_name']);?></small>

                   </div>

-                  <div class="col-sm-6">

-                    <div class="form-group">

-                      <label for="title"><?=$lang['edit']['pushover_title'];?></label>

-                      <input type="text" class="form-control" name="title" value="<?=$pushover_data['title'];?>" placeholder="Mail">

-                    </div>

+                </div>

+              </div>

+              <?php if (getenv('SKIP_SOGO') != "y") { ?>

+              <div data-acl="<?=$_SESSION['acl']['sogo_access'];?>" class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                  <div class="checkbox">

+                  <label><input type="checkbox" value="1" name="sogo_access" <?=($result['attributes']['sogo_access']=="1") ? "checked" : null;?>> <?=$lang['edit']['sogo_access'];?></label>

+                  <small class="help-block"><?=$lang['edit']['sogo_access_info'];?></small>

                   </div>

-                  <div class="col-sm-6">

-                    <div class="form-group">

-                      <label for="text"><?=$lang['edit']['pushover_text'];?></label>

-                      <input type="text" class="form-control" name="text" value="<?=$pushover_data['text'];?>" placeholder="You've got mail 📧">

-                    </div>

-                  </div>

-                  <div class="col-sm-12">

-                    <div class="form-group">

-                      <label for="text"><?=$lang['edit']['pushover_sender_array'];?></label>

-                      <input type="text" class="form-control" name="senders" value="<?=$pushover_data['senders'];?>" placeholder="sender1@example.com, sender2@example.com">

-                    </div>

-                  </div>

-                  <div class="col-sm-12">

-                    <div class="checkbox">

-                    <label><input type="checkbox" value="1" name="active" <?=($pushover_data['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>

-                    </div>

-                  </div>

-                  <div class="col-sm-12">

-                    <legend style="cursor:pointer;margin-top:10px" data-target="#po_advanced" class="arrow-toggle" unselectable="on" data-toggle="collapse">

-                      <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['edit']['advanced_settings'];?>

-                    </legend>

-                  </div>

-                  <div class="col-sm-12">

-                    <div id="po_advanced" class="collapse">

-                      <div class="form-group">

-                        <label for="text"><?=$lang['edit']['pushover_sender_regex'];?></label>

-                        <input type="text" class="form-control" name="senders_regex" value="<?=$pushover_data['senders_regex'];?>" placeholder="/(.*@example\.org$|^foo@example\.com$)/i" regex="true">

-                        <div class="checkbox">

-                          <label><input type="checkbox" value="1" name="evaluate_x_prio" <?=($pushover_data['attributes']['evaluate_x_prio']=="1") ? "checked" : null;?>> <?=$lang['edit']['pushover_evaluate_x_prio'];?></label>

+                </div>

+              </div>

+              <?php } ?>

+              <div class="form-group">

+                <div class="col-sm-offset-2 col-sm-10">

+                  <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editmailbox" data-item="<?=htmlspecialchars($result['username']);?>" data-api-url='edit/mailbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                </div>

+              </div>

+            </form>

+          </div>

+          <div id="mpushover" class="tab-pane">

+            <form data-id="pushover" class="form well" method="post">

+              <input type="hidden" value="0" name="evaluate_x_prio">

+              <input type="hidden" value="0" name="only_x_prio">

+              <input type="hidden" value="0" name="active">

+              <div class="row">

+                <div class="col-sm-1">

+                  <p class="help-block"><a href="https://pushover.net" target="_blank"><img src="data:image/png;base64,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" class="img img-fluid"></a></p>

+                </div>

+                <div class="col-sm-10">

+                  <p class="help-block"><?=sprintf($lang['edit']['pushover_info'], $mailbox);?></p>

+                  <p class="help-block"><?=$lang['edit']['pushover_vars'];?>: <code>{SUBJECT}</code>, <code>{SENDER}</code></p>

+                  <div class="form-group">

+                    <div class="row">

+                      <div class="col-sm-6">

+                        <div class="form-group">

+                          <label for="token">API Token/Key (Application)</label>

+                          <input type="text" class="form-control" name="token" maxlength="30" value="<?=$pushover_data['token'];?>" required>

                         </div>

+                      </div>

+                      <div class="col-sm-6">

+                        <div class="form-group">

+                          <label for="key">User/Group Key</label>

+                          <input type="text" class="form-control" name="key" maxlength="30" value="<?=$pushover_data['key'];?>" required>

+                        </div>

+                      </div>

+                      <div class="col-sm-6">

+                        <div class="form-group">

+                          <label for="title"><?=$lang['edit']['pushover_title'];?></label>

+                          <input type="text" class="form-control" name="title" value="<?=$pushover_data['title'];?>" placeholder="Mail">

+                        </div>

+                      </div>

+                      <div class="col-sm-6">

+                        <div class="form-group">

+                          <label for="text"><?=$lang['edit']['pushover_text'];?></label>

+                          <input type="text" class="form-control" name="text" value="<?=$pushover_data['text'];?>" placeholder="You've got mail 📧">

+                        </div>

+                      </div>

+                      <div class="col-sm-12">

+                        <div class="form-group">

+                          <label for="text"><?=$lang['edit']['pushover_sender_array'];?></label>

+                          <input type="text" class="form-control" name="senders" value="<?=$pushover_data['senders'];?>" placeholder="sender1@example.com, sender2@example.com">

+                        </div>

+                      </div>

+                      <div class="col-sm-12">

                         <div class="checkbox">

-                          <label><input type="checkbox" value="1" name="only_x_prio" <?=($pushover_data['attributes']['only_x_prio']=="1") ? "checked" : null;?>> <?=$lang['edit']['pushover_only_x_prio'];?></label>

+                        <label><input type="checkbox" value="1" name="active" <?=($pushover_data['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>

+                        </div>

+                      </div>

+                      <div class="col-sm-12">

+                        <legend style="cursor:pointer;margin-top:10px" data-target="#po_advanced" unselectable="on" data-toggle="collapse">

+                          <i class="bi bi-plus"></i> <?=$lang['edit']['advanced_settings'];?>

+                        </legend>

+                      </div>

+                      <div class="col-sm-12">

+                        <div id="po_advanced" class="collapse">

+                          <div class="form-group">

+                            <label for="text"><?=$lang['edit']['pushover_sender_regex'];?></label>

+                            <input type="text" class="form-control" name="senders_regex" value="<?=$pushover_data['senders_regex'];?>" placeholder="/(.*@example\.org$|^foo@example\.com$)/i" regex="true">

+                            <div class="checkbox">

+                              <label><input type="checkbox" value="1" name="evaluate_x_prio" <?=($pushover_data['attributes']['evaluate_x_prio']=="1") ? "checked" : null;?>> <?=$lang['edit']['pushover_evaluate_x_prio'];?></label>

+                            </div>

+                            <div class="checkbox">

+                              <label><input type="checkbox" value="1" name="only_x_prio" <?=($pushover_data['attributes']['only_x_prio']=="1") ? "checked" : null;?>> <?=$lang['edit']['pushover_only_x_prio'];?></label>

+                            </div>

+                          </div>

                         </div>

                       </div>

                     </div>

                   </div>

+                  <div class="btn-group" data-acl="<?=$_SESSION['acl']['pushover'];?>">

+                      <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="pushover" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></a>

+                      <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="pushover-test" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover-test' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['edit']['pushover_verify'];?></a>

+                      <div class="clearfix visible-xs"></div>

+                      <a id="pushover_delete" class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-danger" data-action="edit_selected" data-id="pushover-delete" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover' data-api-attr='{"delete":"true"}' href="#"><i class="bi bi-trash"></i> <?=$lang['edit']['remove'];?></a>

+                  </div>

                 </div>

               </div>

-              <div class="btn-group" data-acl="<?=$_SESSION['acl']['pushover'];?>">

-                  <a class="btn btn-sm btn-default" data-action="edit_selected" data-id="pushover" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></a>

-                  <a class="btn btn-sm btn-default" data-action="edit_selected" data-id="pushover-test" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover-test' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['edit']['pushover_verify'];?></a>

-                  <a id="pushover_delete" class="btn btn-sm btn-danger" data-action="edit_selected" data-id="pushover-delete" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover' data-api-attr='{"delete":"true"}' href="#"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <?=$lang['edit']['remove'];?></a>

-              </div>

-            </div>

+            </form>

           </div>

-        </form>

-        <hr>

-        <form data-id="mboxratelimit" class="form-inline well" method="post">

-          <div class="row">

-            <div class="col-sm-1">

-              <p class="help-block"><?=$lang['acl']['ratelimit'];?></p>

-            </div>

-            <div class="col-sm-10">

-              <div class="form-group">

-                <input name="rl_value" type="number" autocomplete="off" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" class="form-control" placeholder="disabled">

+          <div id="macl" class="tab-pane">

+            <form data-id="useracl" class="form-inline well" method="post">

+              <div class="row">

+                <div class="col-sm-1">

+                  <p class="help-block">ACL</p>

+                </div>

+                <div class="col-sm-10">

+                  <div class="form-group">

+                    <select id="user_acl" name="user_acl" size="10" multiple>

+                    <?php

+                    $user_acls = acl('get', 'user', $mailbox);

+                    foreach ($user_acls as $acl => $val):

+                      ?>

+                      <option value="<?=$acl;?>" <?=($val == 1) ? 'selected' : null;?>><?=$lang['acl'][$acl];?></option>

+                      <?php

+                    endforeach;

+                    ?>

+                    </select>

+                  </div>

+                  <div class="form-group">

+                    <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="useracl" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/user-acl' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                  </div>

+                </div>

               </div>

-              <div class="form-group">

-                <select name="rl_frame" class="form-control">

-                  <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>

-                  <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>

-                  <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>

-                  <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>>msgs / day</option>

-                </select>

-              </div>

-              <div class="form-group">

-                <button class="btn btn-default" data-action="edit_selected" data-id="mboxratelimit" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/rl-mbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

-              </div>

-              <p class="help-block"><?=$lang['edit']['mbox_rl_info'];?></p>

-            </div>

+            </form>

           </div>

-        </form>

-        <form data-id="useracl" class="form-inline well" method="post">

-          <div class="row">

-            <div class="col-sm-1">

-              <p class="help-block">ACL</p>

-            </div>

-            <div class="col-sm-10">

-              <div class="form-group">

-                <select id="user_acl" name="user_acl" size="10" multiple>

-                <?php

-                $user_acls = acl('get', 'user', $mailbox);

-                foreach ($user_acls as $acl => $val):

-                  ?>

-                  <option value="<?=$acl;?>" <?=($val == 1) ? 'selected' : null;?>><?=$lang['acl'][$acl];?></option>

-                  <?php

-                endforeach;

-                ?>

-                </select>

+          <div id="mrl" class="tab-pane">

+            <form data-id="mboxratelimit" class="form-inline well" method="post">

+              <div class="row">

+                <div class="col-sm-1">

+                  <p class="help-block"><?=$lang['acl']['ratelimit'];?></p>

+                </div>

+                <div class="col-sm-10">

+                  <div class="form-group">

+                    <input name="rl_value" type="number" autocomplete="off" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" class="form-control" placeholder="<?=$lang['ratelimit']['disabled']?>">

+                  </div>

+                  <div class="form-group">

+                    <select name="rl_frame" class="form-control">

+                      <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>><?=$lang['ratelimit']['second']?></option>

+                      <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>><?=$lang['ratelimit']['minute']?></option>

+                      <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>><?=$lang['ratelimit']['hour']?></option>

+                      <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>><?=$lang['ratelimit']['day']?></option>

+                    </select>

+                  </div>

+                  <div class="form-group">

+                    <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="mboxratelimit" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/rl-mbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                  </div>

+                  <p class="help-block"><?=$lang['edit']['mbox_rl_info'];?></p>

+                </div>

               </div>

-              <div class="form-group">

-                <button class="btn btn-default" data-action="edit_selected" data-id="useracl" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/user-acl' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

-              </div>

-            </div>

+            </form>

           </div>

-        </form>

+        </div>

       <?php

       }

     }

@@ -973,7 +1055,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editrelayhost" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/relayhost' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editrelayhost" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/relayhost' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -993,6 +1075,7 @@
           <h4><?=$lang['edit']['resource'];?></h4>

           <form class="form-horizontal" role="form" method="post" data-id="edittransport">

             <input type="hidden" value="0" name="active">

+            <input type="hidden" value="0" name="is_mx_based">

             <div class="form-group">

               <label class="control-label col-sm-2" for="destination"><?=$lang['add']['destination'];?></label>

               <div class="col-sm-10">

@@ -1020,13 +1103,20 @@
             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

                 <div class="checkbox">

+                <label><input type="checkbox" value="1" name="is_mx_based" <?=($result['is_mx_based']=="1") ? "checked" : null;?>> <?=$lang['edit']['lookup_mx'];?></label>

+                </div>

+              </div>

+            </div>

+            <div class="form-group">

+              <div class="col-sm-offset-2 col-sm-10">

+                <div class="checkbox">

                 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>

                 </div>

               </div>

             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="edittransport" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/transport' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="edittransport" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/transport' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1086,7 +1176,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editresource" data-item="<?=htmlspecialchars($result['name']);?>" data-api-url='edit/resource' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editresource" data-item="<?=htmlspecialchars($result['name']);?>" data-api-url='edit/resource' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1132,7 +1222,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editbcc" data-item="<?=$bcc;?>" data-api-url='edit/bcc' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editbcc" data-item="<?=$bcc;?>" data-api-url='edit/bcc' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1181,7 +1271,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="edit_recipient_map" data-item="<?=$map;?>" data-api-url='edit/recipient_map' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="edit_recipient_map" data-item="<?=$map;?>" data-api-url='edit/recipient_map' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1242,7 +1332,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="edit_tls_policy_maps" data-item="<?=$map;?>" data-api-url='edit/tls-policy-map' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="edit_tls_policy_maps" data-item="<?=$map;?>" data-api-url='edit/tls-policy-map' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1410,7 +1500,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editsyncjob" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/syncjob' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editsyncjob" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/syncjob' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1461,7 +1551,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editfilter" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/filter' data-api-attr='{}' href="#"><?=$lang['edit']['validate_save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editfilter" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/filter' data-api-attr='{}' href="#"><?=$lang['edit']['validate_save'];?></button>

               </div>

             </div>

           </form>

@@ -1509,7 +1599,7 @@
             </div>

             <div class="form-group">

               <div class="col-sm-offset-2 col-sm-10">

-                <button class="btn btn-success" data-action="edit_selected" data-id="editapp" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/app-passwd' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

+                <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="editapp" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/app-passwd' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

               </div>

             </div>

           </form>

@@ -1525,14 +1615,14 @@
 }

 else {

 ?>

-	<div class="alert alert-danger" role="alert"><?=$lang['danger']['access_denied'];?></div>

+  <div class="alert alert-danger" role="alert"><?=$lang['danger']['access_denied'];?></div>

 <?php

 }

 ?>

-				</div>

-			</div>

-		</div>

-	</div>

+        </div>

+      </div>

+    </div>

+  </div>

 <a href="<?=$_SESSION['return_to'];?>">&#8592; <?=$lang['edit']['previous'];?></a>

 </div> <!-- /container -->

 <script type='text/javascript'>