Skip to content

Commit 8011b34

Browse files
author
Till Brehm
committed
Merge branch '5337-external_dkim' into 'develop'
Resolve "support external DKIM keys combined with local mail_domain" Closes #5337 See merge request ispconfig/ispconfig3!1968
2 parents 1b58b83 + f104455 commit 8011b34

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

interface/web/dns/dns_dkim_edit.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,15 @@ function onShowNew() {
7070
}
7171

7272
parent::onShowNew();
73+
}
7374

74-
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_GET['zone']);
75-
$sql=$app->db->queryOneRecord("SELECT domain, dkim_public, dkim_selector, dkim FROM mail_domain WHERE domain = ? AND " . $app->tform->getAuthSQL('r'), substr_replace($soa['origin'],'',-1));
76-
if(isset($sql['domain']) && $sql['domain'] != '') {
77-
if($sql['dkim'] == 'y') {
78-
$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$sql['dkim_public']);
79-
$app->tpl->setVar('public_key', $public_key, true);
80-
$app->tpl->setVar('selector', $sql['dkim_selector'], true);
81-
} else {
82-
//TODO: show warning - use mail_domain for dkim and enabled dkim
83-
}
84-
$app->tpl->setVar('edit_disabled', 1);
85-
} else {
86-
$app->tpl->setVar('edit_disabled', 0);
87-
}
88-
$app->tpl->setVar('name', $soa['origin'], true);
75+
function onShowEnd() {
76+
global $app, $conf;
77+
78+
$app->tpl->setVar("selector", str_replace('._domainkey', '', $this->dataRecord['name']), true);
79+
$app->tpl->setVar("public_key", str_replace('v=DKIM1; t=s; p=', '', $this->dataRecord['data']), true);
8980

81+
parent::onShowEnd();
9082
}
9183

9284
function onSubmit() {
@@ -117,7 +109,7 @@ function onSubmit() {
117109
// add dkim-settings to the public-key in the txt-record
118110
if (!empty($this->dataRecord['data'])) {
119111
$this->dataRecord['data']='v=DKIM1; t=s; p='.$this->dataRecord['data'];
120-
$this->dataRecord['name']=$this->dataRecord['selector'].'._domainkey.'.$this->dataRecord['name'];
112+
$this->dataRecord['name']=$this->dataRecord['selector'].'._domainkey';
121113
// $this->dataRecord['ttl']=60;
122114
}
123115
// Update the serial number and timestamp of the RR record

interface/web/dns/dns_txt_edit.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ function onLoad() {
5757
if ('v=spf1' === mb_substr($this->dataRecord['data'], 0, 6)) {
5858
header(sprintf('Location: dns_spf_edit.php?id=%d', $this->dataRecord['id']));
5959
exit;
60+
} elseif ("v=DKIM1; t=s; p=" === mb_substr($this->dataRecord["data"], 0, 16)) {
61+
header(sprintf("Location: dns_dkim_edit.php?id=%d", $this->dataRecord["id"]));
62+
exit;
6063
}
6164
}
6265
}

interface/web/dns/templates/dns_dkim_edit.htm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<input type="hidden" name="id" value="{tmpl_var name='id'}">
2727
<input type="hidden" name="zone" value="{tmpl_var name='zone'}" id="zone">
2828
<input type="hidden" name="type" value="{tmpl_var name='type'}">
29-
<input type="hidden" name="name" value="{tmpl_var name='name'}">
3029

3130
<div class="clear"><div class="right">
3231
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="dns/dns_dkim_edit.php">{tmpl_var name='btn_save_txt'}</button>

0 commit comments

Comments
 (0)