summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dyndns.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2016-02-01 12:35:59 -0500
committerjim-p <jimp@pfsense.org>2016-02-01 12:35:59 -0500
commit6635aa0f6c7a166a56a92ea2492930a67e825ce1 (patch)
tree89ef7530c988626b748db3af5946fa553f741443 /src/usr/local/www/services_dyndns.php
parentde22e304d4b00a77089c337e1b8ef88097e9308b (diff)
downloadpfsense-6635aa0f6c7a166a56a92ea2492930a67e825ce1.zip
pfsense-6635aa0f6c7a166a56a92ea2492930a67e825ce1.tar.gz
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.
Diffstat (limited to 'src/usr/local/www/services_dyndns.php')
-rw-r--r--src/usr/local/www/services_dyndns.php18
1 files changed, 14 insertions, 4 deletions
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);
<?php
$i = 0;
foreach ($a_dyndns as $dyndns):
+ if ($dyndns['type'] == "namecheap") {
+ $hostname = $dyndns['host'] . "." . $dyndns['domainname'];
+ } else {
+ $hostname = $dyndns['host'];
+ }
?>
<tr<?=!isset($dyndns['enable'])?' class="disabled"':''?>>
<td>
@@ -162,13 +172,13 @@ foreach ($a_dyndns as $dyndns):
</td>
<td>
<?php
- print(htmlspecialchars($dyndns['host']));
+ print(htmlspecialchars($hostname));
?>
</td>
<td>
<?php
- $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
- $filename_v6 = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
+ $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($hostname) . "{$dyndns['id']}.cache";
+ $filename_v6 = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($hostname) . "{$dyndns['id']}_v6.cache";
if (file_exists($filename)) {
$ipaddr = dyndnsCheckIP($dyndns['interface']);
$cached_ip_s = explode(":", file_get_contents($filename));
OpenPOWER on IntegriCloud