diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-04-04 18:41:56 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-04-04 18:42:00 -0400 |
commit | 713f69e2be5279b6b35bc916d176a782dfa65ef0 (patch) | |
tree | 6a52c814ff9b442bdfe5b3f5aeb258ad77ca9032 /src | |
parent | 9b6ea44ec7dbe40cc5d6896bab43d515af3acf4d (diff) | |
download | pfsense-713f69e2be5279b6b35bc916d176a782dfa65ef0.zip pfsense-713f69e2be5279b6b35bc916d176a782dfa65ef0.tar.gz |
Merge pull request #2835 from phil-davis/patch-5
(cherry picked from commit 146684ee657f0f146afad5aa9d74b89884ee4c53)
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/status_ipsec.php | 140 |
1 files changed, 71 insertions, 69 deletions
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("<tr>\n"); - print("<td>\n"); + $rgmap[$ph1ent['remote-gateway']] = $ph1ent['remote-gateway']; - print(htmlspecialchars($ph1ent['descr'])); - print("</td>\n"); - print("<td>\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("<tr>\n"); + print("<td>\n"); - print("</td>\n"); - print("<td>\n"); - $ph1src = ipsec_get_phase1_src($ph1ent); + print(htmlspecialchars($ph1ent['descr'])); + print("</td>\n"); + print("<td>\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("</td>\n"); - print("<td>\n"); + print("</td>\n"); + print("<td>\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(" </td>\n"); - print(" <td>\n"); - $ph1src = ipsec_get_phase1_dst($ph1ent); + print("</td>\n"); + print("<td>\n"); - if (empty($ph1src)) { - print(gettext("Unknown")); - } else { - print(htmlspecialchars($ph1src)); - } + list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap); - print("</td>\n"); - print("<td>\n"); - print("</td>\n"); - print("<td>\n"); - print("</td>\n"); - print("<td>\n"); - print("</td>\n"); + if (empty($peerid_data)) { + print(gettext("Unknown")); + } else { + print(htmlspecialchars($peerid_data)); + } + print(" </td>\n"); + print(" <td>\n"); + $ph1src = ipsec_get_phase1_dst($ph1ent); - if (isset($ph1ent['mobile'])) { + if (empty($ph1src)) { + print(gettext("Unknown")); + } else { + print(htmlspecialchars($ph1src)); + } - print("<td>\n"); - print(gettext("Awaiting connections")); print("</td>\n"); print("<td>\n"); print("</td>\n"); - print("</td>\n"); - } else { - print("<td>\n"); - print(gettext("Disconnected")); print("</td>\n"); print("<td>\n"); - print('<a href="status_ipsec.php?act=connect&ikeid=' . $ph1ent['ikeid'] . '" class="btn btn-xs btn-success">'); - print('<i class="fa fa-sign-in icon-embed-btn"></i>'); - print(gettext("Connect VPN")); - print("</a>\n"); print("</td>\n"); + if (isset($ph1ent['mobile'])) { + + print("<td>\n"); + print(gettext("Awaiting connections")); + print("</td>\n"); + print("<td>\n"); + print("</td>\n"); + print("</td>\n"); + } else { + + print("<td>\n"); + print(gettext("Disconnected")); + print("</td>\n"); + print("<td>\n"); + print('<a href="status_ipsec.php?act=connect&ikeid=' . $ph1ent['ikeid'] . '" class="btn btn-xs btn-success">'); + print('<i class="fa fa-sign-in icon-embed-btn"></i>'); + print(gettext("Connect VPN")); + print("</a>\n"); + print("</td>\n"); + + } + print("</tr>\n"); } - print("</tr>\n"); } unset($ipsecconnected, $phase1, $rgmap); @@ -539,7 +541,7 @@ print_info_box(sprintf(gettext('IPsec can be configured %1$shere%2$s.'), '<a hre <script type="text/javascript"> //<![CDATA[ -// Array in which to keep hte SA show/hide state +// Array in which to keep the SA show/hide state sa_open = new Array(); function show_childsa(id, buttonid) { |