diff --git a/dns_editor.php b/dns_editor.php
index 9fbddf2e..7d500f32 100644
--- a/dns_editor.php
+++ b/dns_editor.php
@@ -18,7 +18,7 @@ if (! defined('AREA'))
*/
// This file is being included in admin_domains and customer_domains
-// and therefore does not need to require lib/init.php
+ // and therefore does not need to require lib/init.php
$domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : null;
@@ -34,7 +34,7 @@ $domain = Database::pexecute_first($dom_stmt, array(
'did' => $domain_id
));
-if ($domain['isbinddomain'] != '0') {
+if ($domain['isbinddomain'] != '1') {
standard_error('dns_domain_nodns');
}
$domain = $idna_convert->decode($domain['domain']);
@@ -114,6 +114,17 @@ if ($action == 'add_record' && ! empty($_POST)) {
}
// append trailing dot (again)
$content .= '.';
+ } elseif ($type == 'NS') {
+ // check for trailing dot
+ if (substr($content, - 1) == '.') {
+ // remove it for checks
+ $content = substr($content, 0, - 1);
+ }
+ if (! validateDomain($content)) {
+ $errors[] = $lng['error']['dns_ns_invaliddom'];
+ }
+ // append trailing dot (again)
+ $content .= '.';
} elseif ($type == 'TXT' && ! empty($content)) {
// check that TXT content is enclosed in " "
if (substr($content, 0, 1) != '"') {
@@ -123,6 +134,9 @@ if ($action == 'add_record' && ! empty($_POST)) {
$content .= '"';
}
} elseif ($type == 'SRV') {
+ if ($prio === null || $prio < 0) {
+ $errors[] = $lng['error']['dns_srv_prioempty'];
+ }
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
@@ -131,7 +145,11 @@ if ($action == 'add_record' && ! empty($_POST)) {
// check only last part of content, as it can look like:
// _service._proto.name. TTL class SRV priority weight port target.
$_split_content = explode(" ", $content);
- $target = trim($_split_content[count($_split_content)-1]);
+ // SRV content must be [weight] [port] [target]
+ if (count($_split_content) != 3) {
+ $errors[] = $lng['error']['dns_srv_invalidcontent'];
+ }
+ $target = trim($_split_content[count($_split_content) - 1]);
if (! validateDomain($target)) {
$errors[] = $lng['error']['dns_srv_needdom'];
} else {
@@ -167,9 +185,9 @@ if ($action == 'add_record' && ! empty($_POST)) {
// sort by key
ksort($check_entry);
// format integer fields to real integer (as they are read as string from the DB)
- $check_entry['prio'] = (int)$check_entry['prio'];
- $check_entry['ttl'] = (int)$check_entry['ttl'];
- $check_entry['domain_id'] = (int)$check_entry['domain_id'];
+ $check_entry['prio'] = (int) $check_entry['prio'];
+ $check_entry['ttl'] = (int) $check_entry['ttl'];
+ $check_entry['domain_id'] = (int) $check_entry['domain_id'];
// serialize both
$check_entry = serialize($check_entry);
$new = serialize($new_entry);
@@ -202,6 +220,12 @@ if ($action == 'add_record' && ! empty($_POST)) {
// success message (inline)
$success_message = $lng['success']['dns_record_added'];
+
+ unset($record);
+ unset($type);
+ unset($prio);
+ unset($content);
+ unset($ttl);
} else {
// show $errors
$errors = implode("
", $errors);
@@ -238,6 +262,7 @@ $entriescount = 0;
if (! empty($dom_entries)) {
$entriescount = count($dom_entries);
foreach ($dom_entries as $entry) {
+ $entry['content'] = wordwrap($entry['content'], 100, '
', true);
eval("\$existing_entries.=\"" . getTemplate("dns_editor/entry_bit", true) . "\";");
}
}
diff --git a/lng/english.lng.php b/lng/english.lng.php
index 976c0ae7..a42edaf9 100644
--- a/lng/english.lng.php
+++ b/lng/english.lng.php
@@ -1999,6 +1999,9 @@ $lng['error']['dns_mx_needdom'] = 'The MX content value must be a valid domain-n
$lng['error']['dns_mx_noalias'] = 'The MX-content value cannot be an CNAME entry.';
$lng['error']['dns_cname_invaliddom'] = 'Invalid domain-name for CNAME record';
$lng['error']['dns_cname_nomorerr'] = 'There already exists a resource-record with the same record-name. It cannot be used as CNAME.';
+$lng['error']['dns_ns_invaliddom'] = 'Invalid domain-name for NS record';
+$lng['error']['dns_srv_prioempty'] = 'Invalid SRV priority given';
+$lng['error']['dns_srv_invalidcontent'] = 'Invalid SRV content, must contain of fields weight, port and target, e.g.: 5 5060 sipserver.example.com.';
$lng['error']['dns_srv_needdom'] = 'The SRV target value must be a valid domain-name';
$lng['error']['dns_srv_noalias'] = 'The SRV-target value cannot be an CNAME entry.';
$lng['error']['dns_duplicate_entry'] = 'Record already exists';
diff --git a/templates/Sparkle/dns_editor/entry_bit.tpl b/templates/Sparkle/dns_editor/entry_bit.tpl
index 1e80ff67..1882b0ba 100644
--- a/templates/Sparkle/dns_editor/entry_bit.tpl
+++ b/templates/Sparkle/dns_editor/entry_bit.tpl
@@ -1,7 +1,7 @@