Commit dd1a3355 authored by Florian Schaal's avatar Florian Schaal

allow dkim-records if there is no maildomain (#4626)

parent fcc522b8
......@@ -72,16 +72,26 @@ class page_action extends tform_actions {
parent::onShowNew();
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_GET['zone']);
$sql=$app->db->queryOneRecord("SELECT dkim_public, dkim_selector FROM mail_domain WHERE domain = ? AND dkim = 'y' AND " . $app->tform->getAuthSQL('r'), substr_replace($soa['origin'],'',-1));
$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$sql['dkim_public']);
$app->tpl->setVar('public_key', $public_key);
$app->tpl->setVar('selector', $sql['dkim_selector']);
$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));
if(isset($sql['domain']) && $sql['domain'] != '') {
if($sql['dkim'] == 'y') {
$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$sql['dkim_public']);
$app->tpl->setVar('public_key', $public_key);
$app->tpl->setVar('selector', $sql['dkim_selector']);
} else {
//TODO: show warning - use mail_domain for dkim and enabled dkim
}
$app->tpl->setVar('edit_disabled', 1);
} else {
$app->tpl->setVar('edit_disabled', 0);
}
$app->tpl->setVar('name', $soa['origin']);
}
function onSubmit() {
global $app, $conf;
// Get the parent soa record of the domain
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_POST["zone"]);
// Check if Domain belongs to user
......@@ -110,15 +120,20 @@ class page_action extends tform_actions {
$this->dataRecord['name']=$this->dataRecord['selector'].'._domainkey.'.$this->dataRecord['name'];
$this->dataRecord['ttl']=60;
}
// Update the serial number and timestamp of the RR record
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ?", $this->id);
$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
// check for duplicate entry
$check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ? AND type = ? AND data = ? AND name = ?", $this->dataRecord["zone"], $this->dataRecord["type"], $this->dataRecord["data"], $this->dataRecord['name']);
if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"];
if (empty($this->dataRecord['data'])) $app->tform->errorMessage .= $app->tform->wordbook["dkim_disabled_txt"];
// Update the serial number and timestamp of the RR record
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ?", $this->id);
$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
// check for duplicate entry
$check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ? AND type = ? AND data = ? AND name = ?", $this->dataRecord["zone"], $this->dataRecord["type"], $this->dataRecord["data"], $this->dataRecord['name']);
if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"];
if (empty($this->dataRecord['data'])) $app->tform->errorMessage /= $app->tform->wordbook["dkim_disabled_txt"];
// validate selector and public-key
if (empty($this->dataRecord['selector'])) $app->tform->errorMessage .= '<br/>'.$app->tform->wordbook["dkim_selector_empty_txt"].'<br/>';
$this->dataRecord['data']=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$this->dataRecord['data']); // if the users entered his own key
parent::onSubmit();
}
......
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'O limite de registros dns para esta conta foi alc
$wb['no_zone_perm'] = 'Você não tem permissão para adicionar registros a esta zona dns.';
$wb['ttl_range_error'] = 'O ttl mínimo são 60 segundos.';
$wb['selector_txt'] = 'Seletor DKIM';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Byl dosažen max. počet DNS záznamů pro váš
$wb['no_zone_perm'] = 'Nemáte povolení k přidat záznam do této zóny DNS.';
$wb['ttl_range_error'] = 'Min. TTL doba je 60 sekund.';
$wb['selector_txt'] = 'DKIM selektor';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Die max. Anzahl von DNS Eintraegen für den Accou
$wb['no_zone_perm'] = 'Fehlende Berechtigung zum Hinzufuegen eines Eintrags zur DNS-Zone.';
$wb['ttl_range_error'] = 'Min. TTL time ist 60 Sekunden.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'öffentlicher Schlüssel fehlt';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector darf nicht leer sein';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account i
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['record_exists_txt'] = 'El registro DNS ya existe';
$wb['selector_txt'] = 'Seleccionador DKIM';
$wb['ttl_range_error'] = 'El tiempo mín. de TTL es 60 segundos.';
$wb['ttl_txt'] = 'TTL';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['no_zone_perm'] = 'Vous n\'avez pas la permission d\'ajouter un enregistreme
$wb['ttl_range_error'] = 'Le temps minimum TTL est de 60 secondes.';
$wb['selector_txt'] = 'Selecteur DKIM';
$wb['dkim_disabled_txt'] = 'DKIM disabled for this mail-domain';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Макс. количество DNS-записей
$wb['no_zone_perm'] = 'У Вас нет прав добавлять эту запись.';
$wb['ttl_range_error'] = 'Мин. время <b>TTL</b> 60 секунд.';
$wb['selector_txt'] = 'DKIM-селектор';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
......@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?>
<div class='page-header'>
<h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>
<div class='page-header'><h1><tmpl_var name="list_head_txt"></h1></div>
<p><tmpl_var name="list_desc_txt"></p>
<div class="form-group">
<label for="data" class="col-sm-3 control-label">{tmpl_var name='public_key_txt'}</label>
<div class="col-sm-9"><textarea class="form-control" readonly name="data" id="data" >{tmpl_var name='public_key'}</textarea></div>
</div>
<div class="form-group">
<label for="selector" class="col-sm-3 control-label">{tmpl_var name='selector_txt'}</label>
<div class="col-sm-9"><input type="text" name="selector" id="selector" value="{tmpl_var name='selector'}" readonly class="form-control" /></div></div>
<div class="form-group">
<label for="ttl" class="col-sm-3 control-label">{tmpl_var name='ttl_txt'}</label>
<div class="col-sm-9"><input type="text" name="ttl" id="ttl" value="{tmpl_var name='ttl'}" class="form-control" /></div></div>
<div class="form-group">
<label for="data" class="col-sm-3 control-label">{tmpl_var name='public_key_txt'}</label>
<tmpl_if name="edit_disabled">
<div class="col-sm-9"><textarea class="form-control" readonly name="data" id="data" >{tmpl_var name='public_key'}</textarea></div>
<tmpl_else>
<div class="col-sm-9"><textarea class="form-control" name="data" id="data" >{tmpl_var name='public_key'}</textarea></div>
</tmpl_if>
</div>
<div class="form-group">
<label for="selector" class="col-sm-3 control-label">{tmpl_var name='selector_txt'}</label>
<tmpl_if name="edit_disabled">
<div class="col-sm-9"><input type="text" name="selector" id="selector" value="{tmpl_var name='selector'}" readonly class="form-control" /></div>
<tmpl_else>
<div class="col-sm-9"><input type="text" name="selector" id="selector" value="{tmpl_var name='selector'}" class="form-control" /></div>
</tmpl_if>
</div>
<div class="form-group">
<label for="ttl" class="col-sm-3 control-label">{tmpl_var name='ttl_txt'}</label>
<div class="col-sm-9"><input type="text" name="ttl" id="ttl" value="{tmpl_var name='ttl'}" class="form-control" /></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
<div class="col-sm-9">{tmpl_var name='active'}</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
<div class="col-sm-9">
{tmpl_var name='active'}
</div>
</div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="zone" value="{tmpl_var name='zone'}" id="zone">
<input type="hidden" name="type" value="{tmpl_var name='type'}">
<input type="hidden" name="name" value="{tmpl_var name='name'}">
</div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="zone" value="{tmpl_var name='zone'}" id="zone">
<input type="hidden" name="type" value="{tmpl_var name='type'}">
<input type="hidden" name="name" value="{tmpl_var name='name'}">
<div class="clear"><div class="right">
<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>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='zone'}">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
<div class="clear"><div class="right">
<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>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='zone'}">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment