From 3752add11382afd162da603a50c8376ea460ca7f Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 4 Mar 2016 19:09:10 +0100 Subject: [PATCH] (legacy) refactor status_lb_vs.php --- src/www/status_lb_vs.php | 234 +++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 118 deletions(-) diff --git a/src/www/status_lb_vs.php b/src/www/status_lb_vs.php index 4d500d6c5..bb18e4ae8 100644 --- a/src/www/status_lb_vs.php +++ b/src/www/status_lb_vs.php @@ -1,48 +1,64 @@ . - All rights reserved. + Copyright (C) 2014-2016 Deciso B.V. + Copyright (C) 2010 Seth Mos . + All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ require_once("guiconfig.inc"); +require_once("filter.inc"); require_once("services.inc"); require_once("vslb.inc"); -if (!is_array($config['load_balancer']['lbpool'])) { - $config['load_balancer']['lbpool'] = array(); +if (empty($config['load_balancer']['lbpool']) || !is_array($config['load_balancer']['lbpool'])) { + $a_pool = array(); +} else { + $a_pool = &$config['load_balancer']['lbpool']; } -if (!is_array($config['load_balancer']['virtual_server'])) { - $config['load_balancer']['virtual_server'] = array(); +if (empty($config['load_balancer']['virtual_server']) || !is_array($config['load_balancer']['virtual_server'])) { + $a_vs = array(); +} else { + $a_vs = &$config['load_balancer']['virtual_server']; } -$a_vs = &$config['load_balancer']['virtual_server']; -$a_pool = &$config['load_balancer']['lbpool']; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if (!empty($_POST['apply'])) { + relayd_configure(); + filter_configure(); + clear_subsystem_dirty('loadbalancer'); + header("Location: status_lb_vs.php"); + exit; + } +} + $rdr_a = get_lb_redirects(); $service_hook = 'relayd'; - +legacy_html_escape_form_data($a_vs); +legacy_html_escape_form_data($a_pool); +legacy_html_escape_form_data($rdr_a); include("head.inc"); ?> @@ -51,96 +67,78 @@ include("head.inc"); -
-
-
- -
- "));?> - - -
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - "; - } - } - } - ?> -
{$server}
-
- - -
- Last: {$rdr_a[$vsent['name']]['last']}\n"; - if (!empty($rdr_a[$vsent['name']]['average'])) - echo "
Average: {$rdr_a[$vsent['name']]['average']}\n"; - ?> -
- -
-
-
-
-
-
-
-
+
+
+
+
+ "));?> + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + ',$vipent['servers']);?> + + + + +
+ + Last: {$rdr_a[$vsent['name']]['last']}" : "";?> + Average: {$rdr_a[$vsent['name']]['average']}" : "";?> +
+
+
+
+
+
+
+