mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
services: align the code some more, fix bugs #996
This commit is contained in:
parent
9f8e2d6712
commit
c7edcbf8a2
@ -127,7 +127,7 @@ function dyndns_cache_file($conf, $ipver = 4)
|
||||
{
|
||||
$ipver = $ipver == 6 ? '_v6' : '';
|
||||
|
||||
return "/var/cache/dyndns_{$conf['interface']}_{$conf['host']}_{$dyndns['id']}{$ipver}.cache";
|
||||
return "/var/cache/dyndns_{$conf['interface']}_{$conf['host']}_{$conf['id']}{$ipver}.cache";
|
||||
}
|
||||
|
||||
function dyndns_configure_client($conf)
|
||||
|
||||
@ -1252,7 +1252,7 @@
|
||||
$currentTime = time();
|
||||
notify_all_remote(sprintf(gettext("Dynamic DNS updated IP Address on %s (%s) to %s"), convert_real_interface_to_friendly_descr($this->_if), $this->_if, $wan_ip));
|
||||
log_error("Dynamic DNS: updating cache file {$this->_cacheFile}: {$wan_ip}");
|
||||
@file_put_contents($this->_cacheFile, "{$wan_ip}:{$currentTime}");
|
||||
@file_put_contents($this->_cacheFile, "{$wan_ip}|{$currentTime}");
|
||||
} else
|
||||
@unlink($this->_cacheFile);
|
||||
if ($this->_useIPv6 == true && $wan_ip > 0) {
|
||||
@ -1345,13 +1345,13 @@
|
||||
} else {
|
||||
if (file_exists($this->_cacheFile)) {
|
||||
$contents = file_get_contents($this->_cacheFile);
|
||||
list($cacheIP,$cacheTime) = explode(':', $contents);
|
||||
list($cacheIP,$cacheTime) = explode('|', $contents);
|
||||
$this->_debug($cacheIP.'/'.$cacheTime);
|
||||
$initial = false;
|
||||
$log_error .= "Cached IP: {$cacheIP} ";
|
||||
} else {
|
||||
$cacheIP = '0.0.0.0';
|
||||
@file_put_contents($this->_cacheFile, "0.0.0.0:{$currentTime}");
|
||||
@file_put_contents($this->_cacheFile, "0.0.0.0|{$currentTime}");
|
||||
$cacheTime = $currentTime;
|
||||
$initial = true;
|
||||
$log_error .= "No Cached IP found.";
|
||||
|
||||
@ -84,7 +84,7 @@ function rfc2136_cron()
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
function rfc2136_cache_file($dnspdate, $ipver = 4)
|
||||
function rfc2136_cache_file($dnsupdate, $ipver = 4)
|
||||
{
|
||||
$ipver = $ipver == 6 ? '_v6' : '';
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ $main_buttons = array(
|
||||
}
|
||||
|
||||
if (!empty($fdata)) {
|
||||
$cached_ip_s = explode(':', $fdata);
|
||||
$cached_ip_s = explode('|', $fdata);
|
||||
$cached_ip = $cached_ip_s[0];
|
||||
echo sprintf(
|
||||
'<font color="%s">%s</font>',
|
||||
|
||||
@ -148,7 +148,7 @@ $main_buttons = array(
|
||||
<td>
|
||||
<?php
|
||||
$filename = rfc2136_cache_file($rfc2136, 4);
|
||||
if (file_exists($filename) && !empty($rfc2136['enable']) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'A')) {
|
||||
if (file_exists($filename) && !empty($rfc2136['enable']) && (empty($rfc2136['recordtype']) || $rfc2136['recordtype'] == 'A')) {
|
||||
echo "IPv4: ";
|
||||
if (isset($rfc2136['usepublicip'])) {
|
||||
$ipaddr = get_dyndns_ip($rfc2136['interface'], 4);
|
||||
@ -169,7 +169,7 @@ $main_buttons = array(
|
||||
}
|
||||
echo "<br />";
|
||||
$filename6 = rfc2136_cache_file($rfc2136, 6);
|
||||
if (file_exists($filename6) && !empty($rfc2136['enable']) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'AAAA')) {
|
||||
if (file_exists($filename6) && !empty($rfc2136['enable']) && (empty($rfc2136['recordtype']) || $rfc2136['recordtype'] == 'AAAA')) {
|
||||
echo "IPv6: ";
|
||||
if (isset($rfc2136['usepublicip'])) {
|
||||
$ipaddr = get_dyndns_ip($rfc2136['interface'], 6);
|
||||
|
||||
@ -65,7 +65,7 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
|
||||
}
|
||||
|
||||
if (!empty($fdata)) {
|
||||
$cached_ip_s = preg_split('/:/', $fdata);
|
||||
$cached_ip_s = explode('|', $fdata);
|
||||
$cached_ip = $cached_ip_s[0];
|
||||
echo sprintf(
|
||||
'<font color="%s">%s</font>',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user