Bernd Wurst commited on 2023-05-16 17:06:02
Zeige 4 geänderte Dateien mit 45 Einfügungen und 14 Löschungen.
... | ... |
@@ -30,9 +30,20 @@ foreach ($_POST as $key => $value) { |
30 | 30 |
} elseif ($value == 'off') { |
31 | 31 |
$type = 'none'; |
32 | 32 |
} |
33 |
- DEBUG('change request for id #'.$id.' to '.$value); |
|
33 |
+ DEBUG('MAILCONFIG change request for id #'.$id.' to '.$value); |
|
34 | 34 |
change_domain($id, $type); |
35 | 35 |
} |
36 |
+ if (strpos($key, "dkim-") === 0) { |
|
37 |
+ $id = substr($key, 5); |
|
38 |
+ $type = 'none'; |
|
39 |
+ if ($value == 'dkim') { |
|
40 |
+ $type = 'dkim'; |
|
41 |
+ } elseif ($value == 'dmarc') { |
|
42 |
+ $type = 'dmarc'; |
|
43 |
+ } |
|
44 |
+ DEBUG('DKIM change request for id #'.$id.' to '.$value); |
|
45 |
+ change_domain_dkim($id, $type); |
|
46 |
+ } |
|
36 | 47 |
} |
37 | 48 |
|
38 | 49 |
if (!$debugmode) { |
... | ... |
@@ -1,8 +1,14 @@ |
1 | 1 |
ready(() => { |
2 | 2 |
document.querySelectorAll('.buttonset input[type=submit]').forEach(e => e.remove()); |
3 |
+ document.querySelectorAll('input[type=submit].hidden').forEach(e => e.remove()); |
|
3 | 4 |
document.querySelectorAll('.buttonset').forEach(el => { |
4 | 5 |
el.addEventListener('change', (e) => { |
5 | 6 |
e.currentTarget.closest('form').submit(); |
6 | 7 |
}); |
7 | 8 |
}); |
9 |
+ document.querySelectorAll('.autosubmit').forEach(el => { |
|
10 |
+ el.addEventListener('change', (e) => { |
|
11 |
+ e.currentTarget.closest('form').submit(); |
|
12 |
+ }); |
|
13 |
+ }); |
|
8 | 14 |
}) |
... | ... |
@@ -77,20 +77,12 @@ foreach ($domains as $id => $dom) { |
77 | 77 |
$check_dmarc = ($dom['dkim'] == 'dmarc' ? ' checked="checked"' : ''); |
78 | 78 |
$check_dkim = ($dom['dkim'] == 'dkim' ? ' checked="checked"' : ''); |
79 | 79 |
$check_dkimoff = ($dom['dkim'] == 'none' ? ' checked="checked"' : ''); |
80 |
- $buttons .= ' <p><label for="dkim-select">DKIM-Einstellung: </label><select name="dkim" id="dkim-select"> |
|
80 |
+ $buttons .= ' <p><label for="dkim-select-'.$id.'">DKIM-Einstellung: </label><select name="dkim-'.$id.'" id="dkim-select-'.$id.'" class="autosubmit"> |
|
81 | 81 |
<option value="dmarc" '.($dom['dkim'] == 'dmarc' ? 'selected' : '').'>DKIM + DMARC</option> |
82 | 82 |
<option value="dkim" '.($dom['dkim'] == 'dkim' ? 'selected' : '').'>Nur DKIM</option> |
83 | 83 |
<option value="none" '.($dom['dkim'] == 'none' ? 'selected' : '').'>DKIM ausgeschaltet</option> |
84 |
- </select></p> |
|
85 |
- <p>Werden E-Mails nur über unsere Anlagen versendet oder nutzen Sie für den Versand unter dieser Domain auch andere Anbieter?</p> |
|
86 |
- <p><span class="buttonset" id="buttonset-dkim-'.$id.'"> |
|
87 |
- <input type="radio" name="dkim-'.$id.'" id="dkim-'.$id.'-dmarc" value="dmarc"'.$check_dmarc.' /> |
|
88 |
- <label for="dkim-'.$id.'-dmarc">Nur schokokeks.org</label> |
|
89 |
- <input type="radio" name="dkim-'.$id.'" id="dkim-'.$id.'-dkim" value="dkim"'.$check_dkim.' /> |
|
90 |
- <label for="dkim-'.$id.'-dkim">Auch andere Anbieter</label> |
|
91 |
- <input type="radio" name="dkim-'.$id.'" id="dkim-'.$id.'-off" value="off"'.$check_dkimoff.' /> |
|
92 |
- <label for="dkim-'.$id.'-off">DKIM Ausgeschaltet</label> |
|
93 |
- <input type="submit" value="Speichern" /> |
|
84 |
+ </select> |
|
85 |
+ <input class="hidden" type="submit" value="Speichern" /></p> |
|
94 | 86 |
</span>'; |
95 | 87 |
|
96 | 88 |
} |
... | ... |
@@ -516,7 +516,7 @@ function domain_has_vmail_accounts($domid) |
516 | 516 |
function change_domain($id, $type) |
517 | 517 |
{ |
518 | 518 |
$id = (int) $id; |
519 |
- if (domain_has_vmail_accounts($id)) { |
|
519 |
+ if (domain_has_vmail_accounts($id) && type != 'virtual') { |
|
520 | 520 |
system_failure("Sie müssen zuerst alle E-Mail-Konten mit dieser Domain löschen, bevor Sie die Webinterface-Verwaltung für diese Domain abschalten können."); |
521 | 521 |
} |
522 | 522 |
|
... | ... |
@@ -526,7 +526,8 @@ function change_domain($id, $type) |
526 | 526 |
|
527 | 527 |
$old = domainsettings($id); |
528 | 528 |
if ($old['type'] == $type) { |
529 |
- system_failure('Domain ist bereits so konfiguriert'); |
|
529 |
+ return; |
|
530 |
+ //system_failure('Domain ist bereits so konfiguriert'); |
|
530 | 531 |
} |
531 | 532 |
|
532 | 533 |
if ($type == 'none') { |
... | ... |
@@ -545,6 +546,27 @@ function change_domain($id, $type) |
545 | 546 |
} |
546 | 547 |
} |
547 | 548 |
|
549 |
+function change_domain_dkim($id, $type) |
|
550 |
+{ |
|
551 |
+ if (! in_array($type, ['none','dkim','dmarc'])) { |
|
552 |
+ system_failure("Ungültige Aktion"); |
|
553 |
+ } |
|
554 |
+ |
|
555 |
+ $old = domainsettings($id); |
|
556 |
+ if ($old['dkim'] == $type) { |
|
557 |
+ return; |
|
558 |
+ //system_failure('Domain ist bereits so konfiguriert'); |
|
559 |
+ } |
|
560 |
+ |
|
561 |
+ if ($type == 'none') { |
|
562 |
+ db_query("UPDATE kundendaten.domains SET dkim='none', lastchange=NOW() WHERE id=?", [$id]); |
|
563 |
+ } elseif ($type == 'dkim') { |
|
564 |
+ db_query("UPDATE kundendaten.domains SET dkim='dkim', lastchange=NOW() WHERE id=?", [$id]); |
|
565 |
+ } elseif ($type == 'dmarc') { |
|
566 |
+ db_query("UPDATE kundendaten.domains SET dkim='dmarc', lastchange=NOW() WHERE id=?", [$id]); |
|
567 |
+ } |
|
568 |
+} |
|
569 |
+ |
|
548 | 570 |
|
549 | 571 |
/* |
550 | 572 |
function maildomain_type($type) { |
551 | 573 |