From 713f69e2be5279b6b35bc916d176a782dfa65ef0 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Mon, 4 Apr 2016 18:41:56 -0400 Subject: Merge pull request #2835 from phil-davis/patch-5 (cherry picked from commit 146684ee657f0f146afad5aa9d74b89884ee4c53) --- src/usr/local/www/status_ipsec.php | 140 +++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 69 deletions(-) (limited to 'src/usr/local/www/status_ipsec.php') diff --git a/src/usr/local/www/status_ipsec.php b/src/usr/local/www/status_ipsec.php index 9e895f9..35d4fb8 100644 --- a/src/usr/local/www/status_ipsec.php +++ b/src/usr/local/www/status_ipsec.php @@ -69,6 +69,10 @@ require_once("ipsec.inc"); global $g; +if (!is_array($config['ipsec']['phase1'])) { + $config['ipsec']['phase1'] = array(); +} + // If this is just an AJAX call to update the table body, just generate the body and quit if ($_REQUEST['ajax']) { print_ipsec_body(); @@ -108,10 +112,6 @@ if ($_GET['act'] == 'connect') { } } -if (!is_array($config['ipsec']['phase1'])) { - $config['ipsec']['phase1'] = array(); -} - // Table body is composed here so that it can be more easily updated via AJAX function print_ipsec_body() { global $config; @@ -391,91 +391,93 @@ function print_ipsec_body() { } $rgmap = array(); - foreach ($a_phase1 as $ph1ent) { - if (isset($ph1ent['disabled'])) { - continue; - } - - $rgmap[$ph1ent['remote-gateway']] = $ph1ent['remote-gateway']; - - if ($ipsecconnected[$ph1ent['ikeid']]) { - continue; - } + if (is_array($a_phase1)) { + foreach ($a_phase1 as $ph1ent) { + if (isset($ph1ent['disabled'])) { + continue; + } - print("\n"); - print("\n"); + $rgmap[$ph1ent['remote-gateway']] = $ph1ent['remote-gateway']; - print(htmlspecialchars($ph1ent['descr'])); - print("\n"); - print("\n"); - list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local"); + if ($ipsecconnected[$ph1ent['ikeid']]) { + continue; + } - if (empty($myid_data)) { - print(gettext("Unknown")); - } else { - print(htmlspecialchars($myid_data)); - } + print("\n"); + print("\n"); - print("\n"); - print("\n"); - $ph1src = ipsec_get_phase1_src($ph1ent); + print(htmlspecialchars($ph1ent['descr'])); + print("\n"); + print("\n"); + list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local"); - if (empty($ph1src)) { - print(gettext("Unknown")); - } else { - print(htmlspecialchars($ph1src)); - } + if (empty($myid_data)) { + print(gettext("Unknown")); + } else { + print(htmlspecialchars($myid_data)); + } - print("\n"); - print("\n"); + print("\n"); + print("\n"); + $ph1src = ipsec_get_phase1_src($ph1ent); - list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap); + if (empty($ph1src)) { + print(gettext("Unknown")); + } else { + print(htmlspecialchars($ph1src)); + } - if (empty($peerid_data)) { - print(gettext("Unknown")); - } else { - print(htmlspecialchars($peerid_data)); - } - print(" \n"); - print(" \n"); - $ph1src = ipsec_get_phase1_dst($ph1ent); + print("\n"); + print("\n"); - if (empty($ph1src)) { - print(gettext("Unknown")); - } else { - print(htmlspecialchars($ph1src)); - } + list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap); - print("\n"); - print("\n"); - print("\n"); - print("\n"); - print("\n"); - print("\n"); - print("\n"); + if (empty($peerid_data)) { + print(gettext("Unknown")); + } else { + print(htmlspecialchars($peerid_data)); + } + print(" \n"); + print(" \n"); + $ph1src = ipsec_get_phase1_dst($ph1ent); - if (isset($ph1ent['mobile'])) { + if (empty($ph1src)) { + print(gettext("Unknown")); + } else { + print(htmlspecialchars($ph1src)); + } - print("\n"); - print(gettext("Awaiting connections")); print("\n"); print("\n"); print("\n"); - print("\n"); - } else { - print("\n"); - print(gettext("Disconnected")); print("\n"); print("\n"); - print(''); - print(''); - print(gettext("Connect VPN")); - print("\n"); print("\n"); + if (isset($ph1ent['mobile'])) { + + print("\n"); + print(gettext("Awaiting connections")); + print("\n"); + print("\n"); + print("\n"); + print("\n"); + } else { + + print("\n"); + print(gettext("Disconnected")); + print("\n"); + print("\n"); + print(''); + print(''); + print(gettext("Connect VPN")); + print("\n"); + print("\n"); + + } + print("\n"); } - print("\n"); } unset($ipsecconnected, $phase1, $rgmap); @@ -539,7 +541,7 @@ print_info_box(sprintf(gettext('IPsec can be configured %1$shere%2$s.'), ' //