Project

General

Profile

Download (5.2 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / load_balancer_virtual_server.php @ a1b66bec

1
<?php
2
/* $Id$ */
3
/*
4
	load_balancer_virtual_server.php
5
	part of pfSense (https://www.pfsense.org/)
6

    
7
	Copyright (C) 2005-2008 Bill Marquette <bill.marquette@gmail.com>.
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_MODULE:	routing
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-services-loadbalancer-virtualservers
37
##|*NAME=Services: Load Balancer: Virtual Servers page
38
##|*DESCR=Allow access to the 'Services: Load Balancer: Virtual Servers' page.
39
##|*MATCH=load_balancer_virtual_server.php*
40
##|-PRIV
41

    
42
require_once("guiconfig.inc");
43
require_once("functions.inc");
44
require_once("filter.inc");
45
require_once("shaper.inc");
46
require_once("vslb.inc");
47

    
48
if (!is_array($config['load_balancer']['virtual_server'])) {
49
	$config['load_balancer']['virtual_server'] = array();
50
}
51
$a_vs = &$config['load_balancer']['virtual_server'];
52

    
53
if ($_POST) {
54
	$pconfig = $_POST;
55

    
56
	if ($_POST['apply']) {
57
		$retval = 0;
58
		$retval |= filter_configure();
59
		$retval |= relayd_configure();
60
		$savemsg = get_std_save_message($retval);
61
		/* Wipe out old relayd anchors no longer in use. */
62
		cleanup_lb_marked();
63
		clear_subsystem_dirty('loadbalancer');
64
	}
65
}
66

    
67
if ($_GET['act'] == "del") {
68
	if (array_key_exists($_GET['id'], $a_vs)) {
69

    
70
		if (!$input_errors) {
71
			cleanup_lb_mark_anchor($a_vs[$_GET['id']]['name']);
72
			unset($a_vs[$_GET['id']]);
73
			write_config();
74
			mark_subsystem_dirty('loadbalancer');
75
			header("Location: load_balancer_virtual_server.php");
76
			exit;
77
		}
78
	}
79
}
80

    
81
/* Index lbpool array for easy hyperlinking */
82
$poodex = array();
83
for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
84
	$poodex[$config['load_balancer']['lbpool'][$i]['name']] = $i;
85
}
86
for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
87
	if($a_vs[$i]) {
88
		$a_vs[$i]['poolname'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['poolname']]}\">{$a_vs[$i]['poolname']}</a>";
89
		if ($a_vs[$i]['sitedown'] != '') {
90
			$a_vs[$i]['sitedown'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['sitedown']]}\">{$a_vs[$i]['sitedown']}</a>";
91
		} else {
92
			$a_vs[$i]['sitedown'] = 'none';
93
		}
94
	}
95
}
96

    
97
$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Virtual Servers"));
98
$shortcut_section = "relayd-virtualservers";
99

    
100
include("head.inc");
101

    
102
?>
103
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
104
<?php include("fbegin.inc"); ?>
105
<form action="load_balancer_virtual_server.php" method="post">
106
<?php if ($input_errors) print_input_errors($input_errors); ?>
107
<?php if ($savemsg) print_info_box($savemsg); ?>
108
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
109
<?php print_info_box_np(gettext("The virtual server configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
110
<?php endif; ?>
111
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer virtual server">
112
  <tr><td class="tabnavtbl">
113
  <?php
114
        /* active tabs */
115
        $tab_array = array();
116
        $tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php");
117
        $tab_array[] = array(gettext("Virtual Servers"), true, "load_balancer_virtual_server.php");
118
        $tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php");
119
        $tab_array[] = array(gettext("Settings"), false, "load_balancer_setting.php");
120
        display_top_tabs($tab_array);
121
  ?>
122
  </td></tr>
123
  <tr>
124
    <td>
125
	<div id="mainarea">
126
<?php
127
			$t = new MainTable();
128
			$t->edit_uri('load_balancer_virtual_server_edit.php');
129
			$t->my_uri('load_balancer_virtual_server.php');
130
			$t->add_column(gettext('Name'),'name',10);
131
			$t->add_column(gettext('Protocol'),'relay_protocol',10);
132
			$t->add_column(gettext('IP Address'),'ipaddr',15);
133
			$t->add_column(gettext('Port'),'port',10);
134
			$t->add_column(gettext('Pool'),'poolname',15);
135
			$t->add_column(gettext('Fall Back Pool'),'sitedown',15);
136
			$t->add_column(gettext('Description'),'descr',30);
137
			$t->add_button('edit');
138
			$t->add_button('dup');
139
			$t->add_button('del');
140
			$t->add_content_array($a_vs);
141
			$t->display();
142
?>
143
	   </div>
144
    </td>
145
  </tr>
146
</table>
147
</form>
148
<?php include("fend.inc"); ?>
149
</body>
150
</html>
(125-125/256)