summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-02-17 16:17:29 -0500
committerSteve Beaver <sbeaver@netgate.com>2017-02-17 16:18:00 -0500
commit64d53c6939c0e81cc0e53631006a1b2fc4af4b0a (patch)
tree279b6c6eddd1a67846aac15a180abd86aac91143 /src/usr/local/www
parent3057a2ba467c5a4bcda3a004f876a43758d6e129 (diff)
downloadpfsense-64d53c6939c0e81cc0e53631006a1b2fc4af4b0a.zip
pfsense-64d53c6939c0e81cc0e53631006a1b2fc4af4b0a.tar.gz
Fixed #7274
Diffstat (limited to 'src/usr/local/www')
-rw-r--r--src/usr/local/www/js/pfSenseHelpers.js47
-rw-r--r--src/usr/local/www/status_ipsec.php43
2 files changed, 49 insertions, 41 deletions
diff --git a/src/usr/local/www/js/pfSenseHelpers.js b/src/usr/local/www/js/pfSenseHelpers.js
index f18b9a4..20bc298 100644
--- a/src/usr/local/www/js/pfSenseHelpers.js
+++ b/src/usr/local/www/js/pfSenseHelpers.js
@@ -704,35 +704,40 @@ $('[id*=restartservice-], [id*=stopservice-], [id*=startservice-]').click(functi
// Any time an anchor is clicked and the "usepost" attibute is present, convert the href attribute
// to POST format, make a POST form and submit it
-$('a').click(function(e) {
- // Does the clicked anchor have the "usepost" attribute?
- var attr = $(this).attr('usepost');
- if (typeof attr !== typeof undefined && attr !== false) {
- // Automatically apply a confirmation dialog to "Delete" icons
- if (!($(this).hasClass('no-confirm')) && !($(this).hasClass('icon-embed-btn')) &&
- ($(this).hasClass('fa-trash'))) {
- var msg = $.trim(this.textContent).toLowerCase();
+interceptGET();
- if (!msg)
- var msg = $.trim(this.value).toLowerCase();
+function interceptGET() {
+ $('a').click(function(e) {
+ // Does the clicked anchor have the "usepost" attribute?
+ var attr = $(this).attr('usepost');
- var q = 'Are you sure you wish to '+ msg +'?';
+ if (typeof attr !== typeof undefined && attr !== false) {
+ // Automatically apply a confirmation dialog to "Delete" icons
+ if (!($(this).hasClass('no-confirm')) && !($(this).hasClass('icon-embed-btn')) &&
+ ($(this).hasClass('fa-trash'))) {
+ var msg = $.trim(this.textContent).toLowerCase();
- if ($(this).attr('title') != undefined)
- q = 'Are you sure you wish to '+ $(this).attr('title').toLowerCase() + '?';
+ if (!msg)
+ var msg = $.trim(this.value).toLowerCase();
- if (!confirm(q)) {
- return false;
+ var q = 'Are you sure you wish to '+ msg +'?';
+
+ if ($(this).attr('title') != undefined)
+ q = 'Are you sure you wish to '+ $(this).attr('title').toLowerCase() + '?';
+
+ if (!confirm(q)) {
+ return false;
+ }
}
- }
- var target = $(this).attr("href").split("?");
+ var target = $(this).attr("href").split("?");
- postSubmit(get2post(target[1]),target[0]);
- return false;
- }
-});
+ postSubmit(get2post(target[1]),target[0]);
+ return false;
+ }
+ });
+}
// Convert a GET argument list such as ?name=fred&action=delete into an array of POST
// parameters such as [[name, fred],[action, delete]]
diff --git a/src/usr/local/www/status_ipsec.php b/src/usr/local/www/status_ipsec.php
index ff07656..f1de72d 100644
--- a/src/usr/local/www/status_ipsec.php
+++ b/src/usr/local/www/status_ipsec.php
@@ -45,35 +45,35 @@ if ($_REQUEST['ajax']) {
exit;
}
-if ($_REQUEST['act'] == 'connect') {
- if (ctype_digit($_REQUEST['ikeid'])) {
- $ph1ent = ipsec_get_phase1($_REQUEST['ikeid']);
+if ($_POST['act'] == 'connect') {
+ if (ctype_digit($_POST['ikeid'])) {
+ $ph1ent = ipsec_get_phase1($_POST['ikeid']);
if (!empty($ph1ent)) {
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == 'ikev1' || isset($ph1ent['splitconn'])) {
- $ph2entries = ipsec_get_number_of_phase2($_REQUEST['ikeid']);
+ $ph2entries = ipsec_get_number_of_phase2($_POST['ikeid']);
for ($i = 0; $i < $ph2entries; $i++) {
- $connid = escapeshellarg("con{$_REQUEST['ikeid']}00{$i}");
+ $connid = escapeshellarg("con{$_POST['ikeid']}00{$i}");
mwexec_bg("/usr/local/sbin/ipsec down {$connid}");
mwexec_bg("/usr/local/sbin/ipsec up {$connid}");
}
} else {
- mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_REQUEST['ikeid']));
- mwexec_bg("/usr/local/sbin/ipsec up con" . escapeshellarg($_REQUEST['ikeid']));
+ mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid']));
+ mwexec_bg("/usr/local/sbin/ipsec up con" . escapeshellarg($_POST['ikeid']));
}
}
}
-} else if ($_REQUEST['act'] == 'ikedisconnect') {
- if (ctype_digit($_REQUEST['ikeid'])) {
- if (!empty($_REQUEST['ikesaid']) && ctype_digit($_REQUEST['ikesaid'])) {
- mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_REQUEST['ikeid']) . "[" . escapeshellarg($_REQUEST['ikesaid']) . "]");
+} else if ($_POST['act'] == 'ikedisconnect') {
+ if (ctype_digit($_POST['ikeid'])) {
+ if (!empty($_POST['ikesaid']) && ctype_digit($_POST['ikesaid'])) {
+ mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid']) . "[" . escapeshellarg($_POST['ikesaid']) . "]");
} else {
- mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_REQUEST['ikeid']));
+ mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid']));
}
}
-} else if ($_REQUEST['act'] == 'childdisconnect') {
- if (ctype_digit($_REQUEST['ikeid'])) {
- if (!empty($_REQUEST['ikesaid']) && ctype_digit($_REQUEST['ikesaid'])) {
- mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_REQUEST['ikeid']) . "{" . escapeshellarg($_REQUEST['ikesaid']) . "}");
+} else if ($_POST['act'] == 'childdisconnect') {
+ if (ctype_digit($_POST['ikeid'])) {
+ if (!empty($_POST['ikesaid']) && ctype_digit($_POST['ikesaid'])) {
+ mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid']) . "{" . escapeshellarg($_POST['ikesaid']) . "}");
}
}
}
@@ -227,14 +227,14 @@ function print_ipsec_body() {
if ($ikesa['state'] != 'ESTABLISHED') {
- print('<a href="status_ipsec.php?act=connect&amp;ikeid=' . $con_id . '" class="btn btn-xs btn-success" data-toggle="tooltip" title="' . gettext("Connect VPN"). '">');
+ print('<a href="status_ipsec.php?act=connect&amp;ikeid=' . $con_id . '" class="btn btn-xs btn-success" data-toggle="tooltip" title="' . gettext("Connect VPN"). '" usepost>');
print('<i class="fa fa-sign-in icon-embed-btn"></i>');
print(gettext("Connect VPN"));
print("</a>\n");
} else {
- print('<a href="status_ipsec.php?act=ikedisconnect&amp;ikeid=' . $con_id . '" class="btn btn-xs btn-danger" data-toggle="tooltip" title="' . gettext("Disconnect VPN") . '">');
+ print('<a href="status_ipsec.php?act=ikedisconnect&amp;ikeid=' . $con_id . '" class="btn btn-xs btn-danger" data-toggle="tooltip" title="' . gettext("Disconnect VPN") . '" usepost>');
print('<i class="fa fa-trash icon-embed-btn"></i>');
print(gettext("Disconnect"));
print("</a><br />\n");
@@ -348,7 +348,7 @@ function print_ipsec_body() {
print("</td>\n");
print("<td>\n");
- print('<a href="status_ipsec.php?act=childdisconnect&amp;ikeid=' . $con_id . '&amp;ikesaid=' . $childsa['uniqueid'] . '" class="btn btn-xs btn-warning" data-toggle="tooltip" title="' . gettext('Disconnect Child SA') . '">');
+ print('<a href="status_ipsec.php?act=childdisconnect&amp;ikeid=' . $con_id . '&amp;ikesaid=' . $childsa['uniqueid'] . '" class="btn btn-xs btn-warning" data-toggle="tooltip" title="' . gettext('Disconnect Child SA') . '" usepost>');
print('<i class="fa fa-trash icon-embed-btn"></i>');
print(gettext("Disconnect"));
print("</a>\n");
@@ -448,7 +448,7 @@ function print_ipsec_body() {
print(gettext("Disconnected"));
print("</td>\n");
print("<td>\n");
- print('<a href="status_ipsec.php?act=connect&amp;ikeid=' . $ph1ent['ikeid'] . '" class="btn btn-xs btn-success">');
+ print('<a href="status_ipsec.php?act=connect&amp;ikeid=' . $ph1ent['ikeid'] . '" class="btn btn-xs btn-success" usepost>');
print('<i class="fa fa-sign-in icon-embed-btn"></i>');
print(gettext("Connect VPN"));
print("</a>\n");
@@ -567,6 +567,9 @@ events.push(function() {
}
});
+ // re-attached the GET to POST handler
+ interceptGET();
+
// and do it again
setTimeout(update_table, 5000);
});
OpenPOWER on IntegriCloud