<?php
require_once('inc/base.php');
require_once('inc/security.php');
require_once('class/domain.php');
require_role(ROLE_SYSTEMUSER);
require_once('dnsinclude.php');
$section = 'dns_dns';
$domain = new Domain((int) $_REQUEST['dom']);
$domain->ensure_userdomain();
DEBUG($domain);
title('DNS-Records für '.filter_input_general($domain->fqdn));
headline('DNS-Records für <em>'.filter_input_general($domain->fqdn).'</em>');
$records = get_domain_records($domain->id);
$auto_records = get_domain_auto_records($domain->fqdn);
output('<table><tr><th>Hostname</th><th>Typ</th><th>IP-Adresse/Inhalt</th><th>TTL</th><th> </th></tr>
');
foreach ($records AS $rec)
{
$data = ( $rec['ip'] ? $rec['ip'] : $rec['data'] );
if ($rec['dyndns'])
{
$dyndns = get_dyndns_account($rec['dyndns']);
$data = internal_link('dyndns_edit', '<em>DynDNS #'.$rec['dyndns'].' ('.$dyndns['handle'].')</em>', 'id='.$rec['dyndns']);
}
if ($rec['type'] == 'mx')
{
$data .= ' ('.$rec['spec'].')';
}
if ($rec['type'] == 'sshfp')
{
$data = $rec['spec'] . ' 1 ' . $data;
}
$ttl = ($rec['ttl'] ? $rec['ttl'] : 3600);
$link = $rec['fqdn'];
if (in_array($rec['type'], array('a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr', 'sshfp'))) {
$link = internal_link('dns_record_edit', $rec['fqdn'], "id={$rec['id']}");
}
output("<tr><td>{$link}</td><td>".strtoupper($rec['type'])."</td><td>$data</td><td>{$ttl} Sek.</td><td>".internal_link('dns_record_save', '<img src="'.$prefix.'images/delete.png" width="16" height="16" alt="löschen" title="Record löschen" />', "id={$rec['id']}&action=delete")."</td></tr>\n");
}
foreach ($auto_records AS $rec)
{