From 04e95895e716c8f85d16446b621ecb1734cd55ef Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 26 Feb 2016 15:36:09 +0100 Subject: [PATCH] (legacy) cleanup services_dyndns.php --- src/www/services_dyndns.php | 40 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/www/services_dyndns.php b/src/www/services_dyndns.php index 059904a70..ee65a5c1a 100644 --- a/src/www/services_dyndns.php +++ b/src/www/services_dyndns.php @@ -48,6 +48,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { configd_run('dyndns reload', true); } exit; + } elseif (isset($_POST['act']) && $_POST['act'] == "toggle" && isset($_POST['id'])) { + if (!empty($a_dyndns[$_POST['id']])) { + if (!empty($a_dyndns[$_POST['id']]['enabled'])) { + $a_dyndns[$_POST['id']]['enabled'] = false; + } else { + $a_dyndns[$_POST['id']]['enabled'] = true; + } + write_config(); + configd_run('dyndns reload', true); + } + exit; } } @@ -84,6 +95,12 @@ $main_buttons = array( }] }); }); + // link toggle buttons + $(".act_toggle").click(function(){ + $.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) { + location.reload(); + }); + }); }); @@ -112,6 +129,9 @@ $main_buttons = array( foreach ($a_dyndns as $dyndns): ?> + "> + "> + @@ -120,24 +140,26 @@ $main_buttons = array( $cached_ip) - echo ""; - else - echo ""; + if ($ipaddr <> $cached_ip) { + echo ""; + } else { + echo ""; + } echo htmlspecialchars($cached_ip); echo ""; } elseif (file_exists($filename_v6)) { $ipv6addr = get_interface_ipv6($dyndns['interface']); $cached_ipv6_s = explode("|", file_get_contents($filename_v6)); $cached_ipv6 = $cached_ipv6_s[0]; - if ($ipv6addr <> $cached_ipv6) - echo ""; - else - echo ""; + if ($ipv6addr <> $cached_ipv6) { + echo ""; + } else { + echo ""; + } echo htmlspecialchars($cached_ipv6); echo ""; } else {