From f0cf40f964f2a559ddcf495f492bd9d38f924512 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 7 Feb 2017 13:35:24 -0500 Subject: Convert easyrule.php to use a confirmation landing page so that the parameters can be submitted via POST. Also, remove the JavaScript confirmation box since it is now redundant. Fixes #7228 The confirmation page displays the submitted parameters for an extra user sanity check. Also fixed a bunch of page formatting issues that were not apparent because users rarely if ever saw output from the page. --- src/usr/local/www/easyrule.php | 85 ++++++++++++++++++++++++-------- src/usr/local/www/status_logs_filter.php | 4 +- 2 files changed, 67 insertions(+), 22 deletions(-) diff --git a/src/usr/local/www/easyrule.php b/src/usr/local/www/easyrule.php index d9ea48e..7b0c525 100644 --- a/src/usr/local/www/easyrule.php +++ b/src/usr/local/www/easyrule.php @@ -59,7 +59,6 @@ ##|*MATCH=easyrule.php* ##|-PRIV -$pgtitle = gettext("Firewall: EasyRule"); require_once("guiconfig.inc"); require_once("easyrule.inc"); require_once("filter.inc"); @@ -67,17 +66,23 @@ require_once("shaper.inc"); $retval = 0; $message = ""; -$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn"); +$confirmed = isset($_POST['confirmed']) && $_POST['confirmed'] == 'true'; -if ($_GET && isset($_GET['action'])) { - switch ($_GET['action']) { +/* $specialsrcdst must be a defined global for functions being called. */ +global $specialsrcdst; +$specialsrcdst = explode(" ", "any pppoe l2tp openvpn"); + +if ($_POST && $confirmed && isset($_POST['action'])) { + switch ($_POST['action']) { case 'block': /* Check that we have a valid host */ - easyrule_parse_block($_GET['int'], $_GET['src'], $_GET['ipproto']); + $message = easyrule_parse_block($_POST['int'], $_POST['src'], $_POST['ipproto']); break; case 'pass': - easyrule_parse_pass($_GET['int'], $_GET['proto'], $_GET['src'], $_GET['dst'], $_GET['dstport'], $_GET['ipproto']); + $message = easyrule_parse_pass($_POST['int'], $_POST['proto'], $_POST['src'], $_POST['dst'], $_POST['dstport'], $_POST['ipproto']); break; + default: + $message = gettext("Invalid action specified."); } } @@ -85,23 +90,62 @@ if (stristr($retval, "error") == true) { $message = $retval; } +$pgtitle = array(gettext("Firewall"), gettext("Easy Rule")); include("head.inc"); -?> - - - - -
- -
-: -
+
+
+
+

+ +

+
+
+
+ + : +
: + +
: + +
: + + + : +
: + +
: + +
: + +
: + +
: + +
: + + +

+ + + + + ' . gettext("Status") . ' > ' . gettext('System Logs') . ', ' . gettext('Firewall Tab') . '.
'); } ?> -
+ + + + diff --git a/src/usr/local/www/status_logs_filter.php b/src/usr/local/www/status_logs_filter.php index 18b048c..f482e78 100644 --- a/src/usr/local/www/status_logs_filter.php +++ b/src/usr/local/www/status_logs_filter.php @@ -267,7 +267,7 @@ if (!$rawfilter) { ');" title=""> - " title="" onclick="return confirm('')"> + " title=""> '?> @@ -276,7 +276,7 @@ if (!$rawfilter) { ');" title=""> - " title="" onclick="return confirm('')"> + " title=""> '?> -- cgit v1.1