From 6635aa0f6c7a166a56a92ea2492930a67e825ce1 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 1 Feb 2016 12:35:59 -0500 Subject: Change Namecheap dyndns to use split hostname and domain name fields. Upgrade existing entries automatically. Implements #4366 Code should be generic enough that if other DynDNS providers would work better with a separate domain field, they can pick up the feature without too much trouble. --- src/usr/local/www/services_dyndns.php | 18 ++++++++++--- src/usr/local/www/services_dyndns_edit.php | 42 +++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 8 deletions(-) (limited to 'src/usr/local/www') diff --git a/src/usr/local/www/services_dyndns.php b/src/usr/local/www/services_dyndns.php index c9f24ff..e095cb2 100644 --- a/src/usr/local/www/services_dyndns.php +++ b/src/usr/local/www/services_dyndns.php @@ -70,7 +70,12 @@ $a_dyndns = &$config['dyndnses']['dyndns']; if ($_GET['act'] == "del") { $conf = $a_dyndns[$_GET['id']]; - @unlink("{$g['conf_path']}/dyndns_{$conf['interface']}{$conf['type']}" . escapeshellarg($conf['host']) . "{$conf['id']}.cache"); + if ($conf['type'] == "namecheap") { + $hostname = $conf['host'] . "." . $conf['domainname']; + } else { + $hostname = $conf['host']; + } + @unlink("{$g['conf_path']}/dyndns_{$conf['interface']}{$conf['type']}" . escapeshellarg($hostname) . "{$conf['id']}.cache"); unset($a_dyndns[$_GET['id']]); write_config(); @@ -124,6 +129,11 @@ display_top_tabs($tab_array); > @@ -162,13 +172,13 @@ foreach ($a_dyndns as $dyndns): addInput(new Form_Select( $interfacelist ))->setHelp('This is almost always the same as the Interface to Monitor. '); -$section->addInput(new Form_Input( +$group = new Form_Group('Hostname'); + +$group->add(new Form_Input( 'host', 'Hostname', 'text', $pconfig['host'] -))->setHelp('Enter the complete fully qualified domain name. Example: myhost.dyndns.org'. '
' . +)); +$group->add(new Form_Input( + 'domainname', + 'Domain Name', + 'text', + $pconfig['domainname'] +)); + +$group->setHelp('Enter the complete fully qualified domain name. Example: myhost.dyndns.org'. '
' . 'he.net tunnelbroker: Enter your tunnel ID' . '
' . 'GleSYS: Enter your record ID' . '
' . - 'DNSimple: Enter only the domain name.'); + 'DNSimple: Enter only the domain name.' . '
' . + 'Namecheap: Enter the hostname and the domain separately, with the domain being the domain or subdomain zone being handled by Namecheap.'); + +$section->add($group); $section->addInput(new Form_Input( 'mx', @@ -434,6 +453,7 @@ events.push(function() { switch (service) { case "custom" : case "custom-v6" : + hideGroupInput('domainname', true); hideInput('resultmatch', false); hideInput('updateurl', false); hideInput('requestif', false); @@ -448,6 +468,7 @@ events.push(function() { case "dnsimple": case "route53": + hideGroupInput('domainname', true); hideInput('resultmatch', true); hideInput('updateurl', true); hideInput('requestif', true); @@ -459,8 +480,21 @@ events.push(function() { hideInput('zoneid', false); hideInput('ttl', false); break; - + case "namecheap": + hideGroupInput('domainname', false); + hideInput('resultmatch', true); + hideInput('updateurl', true); + hideInput('requestif', true); + hideCheckbox('curl_ipresolve_v4', true); + hideCheckbox('curl_ssl_verifypeer', true); + hideInput('host', false); + hideInput('mx', false); + hideCheckbox('wildcard', false); + hideInput('zoneid', true); + hideInput('ttl', true); + break; default: + hideGroupInput('domainname', true); hideInput('resultmatch', true); hideInput('updateurl', true); hideInput('requestif', true); -- cgit v1.1