Skip to content

Commit df4375e

Browse files
author
Till Brehm
committed
Merge branch 'revert-8011b342' into 'develop'
Revert "Merge branch '5337-external_dkim' into 'develop'" See merge request ispconfig/ispconfig3!1976
2 parents 8011b34 + 176fca1 commit df4375e

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

interface/web/dns/dns_dkim_edit.php

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

7272
parent::onShowNew();
73-
}
74-
75-
function onShowEnd() {
76-
global $app, $conf;
7773

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);
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);
8089

81-
parent::onShowEnd();
8290
}
8391

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

interface/web/dns/dns_txt_edit.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ 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;
6360
}
6461
}
6562
}

interface/web/dns/templates/dns_dkim_edit.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
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'}">
2930

3031
<div class="clear"><div class="right">
3132
<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)