aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinydns/new_zone_wizard.xml
diff options
context:
space:
mode:
Diffstat (limited to 'config/tinydns/new_zone_wizard.xml')
-rw-r--r--config/tinydns/new_zone_wizard.xml29
1 files changed, 23 insertions, 6 deletions
diff --git a/config/tinydns/new_zone_wizard.xml b/config/tinydns/new_zone_wizard.xml
index 82d8d62b..0f75291f 100644
--- a/config/tinydns/new_zone_wizard.xml
+++ b/config/tinydns/new_zone_wizard.xml
@@ -92,7 +92,7 @@
<name>Mail exchanger record IP address</name>
<type>input</type>
<arraynum>1</arraynum>
- <description>Enter the IP address of your Mail exchanger (MX) - (example: 9.10.11.12)</description>
+ <description>Enter the IP address of your Mail exchanger (MX) - (not needed if hostname above is in a different domain)</description>
</field>
<field>
<name>First A record (optional)</name>
@@ -151,12 +151,14 @@
<![CDATA[
$changed = false;
-
+
if($_POST['domainname'] and $_POST['primarynameserver']) {
$tmp = array();
$tmp['hostname'] = $_POST['domainname'];
- $tmp['recordtype'] = "SOA";
+ $tmp['recordtype'] = "SOA";
$tmp['ipaddress'] = $_POST['primarynameserver'];
+ if(!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$tmp['ipaddress']) && substr($tmp['ipaddress'],-1) != ".")
+ $tmp['ipaddress'] = $tmp['ipaddress'] . ".";
$config['installedpackages']['tinydnsdomains']['config'][] = $tmp;
unset($tmp);
$changed = true;
@@ -167,6 +169,8 @@
$tmp['hostname'] = $_POST['domainname'];
$tmp['recordtype'] = "SOA";
$tmp['ipaddress'] = $_POST['secondarynameserver'];
+ if(!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$tmp['ipaddress']) && substr($tmp['ipaddress'],-1) != ".")
+ $tmp['ipaddress'] = $tmp['ipaddress'] . ".";
$config['installedpackages']['tinydnsdomains']['config'][] = $tmp;
unset($tmp);
$changed = true;
@@ -202,13 +206,26 @@
$changed = true;
}
- if($_POST['mailexchangerrecordipaddress'] and $_POST['mailexchangerrecordhostname']) {
+ if($_POST['mailexchangerrecordhostname']) {
$tmp = array();
- $tmp['hostname'] = $_POST['mailexchangerrecordhostname'];
+ $tmp['hostname'] = $_POST['domainname'];
$tmp['recordtype'] = "MX";
- $tmp['ipaddress'] = $_POST['secondarecordipaddress'];
+ $tmp['ipaddress'] = $_POST['mailexchangerrecordhostname'];
+ if(substr($tmp['ipaddress'],-1) != ".")
+ $tmp['ipaddress'] = $tmp['ipaddress'] . ".";
+ $config['installedpackages']['tinydnsdomains']['config'][] = $tmp;
unset($tmp);
$changed = true;
+
+ if($_POST['mailexchangerrecordipaddress']) {
+ $tmp = array();
+ $tmp['hostname'] = $_POST['mailexchangerrecordhostname'];
+ $tmp['recordtype'] = "A";
+ $tmp['ipaddress'] = $_POST['mailexchangerrecordipaddress'];
+ $config['installedpackages']['tinydnsdomains']['config'][] = $tmp;
+ unset($tmp);
+ $changed = true;
+ }
}
if($changed) {