You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$soa_rec = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $this->dataRecord['domain'].'.');
289
+
if ( isset($soa_rec) ) {
290
+
//* check for a dkim-record in the dns
291
+
$dns_data = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE name = ? AND sys_groupid = ?", $this->dataRecord['dkim_selector'].'._domainkey.'.$this->dataRecord['domain'].'.', $_SESSION["s"]["user"]['sys_groupid']);
292
+
if ( isset($dns_data) ) {
293
+
$dns_data['data'] = 'v=DKIM1; t=s; p='.str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"), '', $this->dataRecord['dkim_public']);
} else { //* no dkim-record found - create new record
302
+
$dns_data = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $this->dataRecord['domain'].'.');
if ( isset($this->dataRecord['dkim']) ) $post_data['dkim'] = 'y'; else$post_data['dkim'] = 'n';
355
+
if ( isset($this->dataRecord['active']) ) $post_data['active'] = 'y'; else$post_data['active'] = 'n';
356
+
}
357
+
358
+
//* dkim-value changed
359
+
if ( $mail_data != $post_data ) {
360
+
//* get the dns-record for the public from the db
361
+
$dns_data = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE name = ? AND sys_groupid = ?'", $mail_data['dkim_selector'].'._domainkey.'.$mail_data['domain'].'.', $mail_data['sys_groupid']);
362
+
363
+
//* we modify dkim dns-values for active mail-domains only
364
+
if ( $post_data['active'] == 'y' ) {
365
+
if ( $post_data['dkim'] == 'n' ) {
366
+
$new_dns_data['active'] = 'N';
367
+
} else {
368
+
if ( $post_data['dkim_selector'] != $mail_data['dkim_selector'] )
$new_dns_data = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $mail_data['domain'].'.');
389
+
//* create a new record only if the dns-zone exists
390
+
if ( isset($new_dns_data) && $post_data['dkim'] == 'y' ) {
0 commit comments