From ab4ce295ed9d434a1f1ecba6f3fd282e3b923f4a Mon Sep 17 00:00:00 2001 From: bcyrill Date: Wed, 13 Feb 2013 21:17:27 +0100 Subject: Update dyndns service and widget --- .../www/widgets/widgets/dyn_dns_status.widget.php | 160 ++++++++++++--------- 1 file changed, 89 insertions(+), 71 deletions(-) (limited to 'usr/local/www/widgets/widgets/dyn_dns_status.widget.php') diff --git a/usr/local/www/widgets/widgets/dyn_dns_status.widget.php b/usr/local/www/widgets/widgets/dyn_dns_status.widget.php index 5680b64..94a4a1b 100644 --- a/usr/local/www/widgets/widgets/dyn_dns_status.widget.php +++ b/usr/local/www/widgets/widgets/dyn_dns_status.widget.php @@ -37,86 +37,104 @@ $nocsrf = true; require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); - -/* added the dyn_dns_status.inc file to the .inc directory, -copied from dyn_dns_status.inc and edited it to work with this file */ - require_once("/usr/local/www/widgets/include/dyn_dns_status.inc"); - if (!is_array($config['dyndnses']['dyndns'])) $config['dyndnses']['dyndns'] = array(); $a_dyndns = &$config['dyndnses']['dyndns']; function dyndnsCheckIP($int) { - - $ip_address = get_interface_ip($int); - if (is_private_ip($ip_address)) { - $hosttocheck = "checkip.dyndns.org"; - $checkip = gethostbyname($hosttocheck); - $ip_ch = curl_init("http://{$checkip}"); - curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE); - curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address); - $ip_result_page = curl_exec($ip_ch); - curl_close($ip_ch); - $ip_result_decoded = urldecode($ip_result_page); - preg_match('=Current IP Address: (.*)=siU', $ip_result_decoded, $matches); - $ip_address = trim($matches[1]); - } - return $ip_address; + $ip_address = get_interface_ip($int); + if (is_private_ip($ip_address)) { + $hosttocheck = "checkip.dyndns.org"; + $checkip = gethostbyname($hosttocheck); + $ip_ch = curl_init("http://{$checkip}"); + curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address); + $ip_result_page = curl_exec($ip_ch); + curl_close($ip_ch); + $ip_result_decoded = urldecode($ip_result_page); + preg_match('=Current IP Address: (.*)=siU', $ip_result_decoded, $matches); + $ip_address = trim($matches[1]); + } + return $ip_address; } ?> - - - - - - - - - - - - - - - - - -
-
- $ifdesc): - if ($dyndns['interface'] == $if): ?> - - - - - - - - $cached_ip) echo ""; - else echo ""; - echo htmlspecialchars($cached_ip); - echo ""; - } else echo "N/A"; - ?> -
+ + + + + + + + + + $ifdesc) { + if ($dyndns['interface'] == $if) { + if (!isset($dyndns['enable'])) + echo "{$ifdesc}"; + else + echo "{$ifdesc}"; + break; + } + } + $groupslist = return_gateway_groups_array(); + foreach ($groupslist as $if => $group) { + if ($dyndns['interface'] == $if) { + if (!isset($dyndns['enable'])) + echo "{$if}"; + else + echo "{$if}"; + break; + } + } + ?> + + + ".htmlspecialchars($types[$j]).""; + else + echo htmlspecialchars($types[$j]); + break; + } + ?> + + + ".htmlspecialchars($dyndns['host']).""; + else + echo htmlspecialchars($dyndns['host']); + ?> + + + $cached_ip) + echo ""; + else + echo ""; + echo htmlspecialchars($cached_ip); + echo ""; + } else { + echo "N/A"; + } + ?> + + + + \ No newline at end of file -- cgit v1.1