Project

General

Profile

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

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

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

    
7
	Copyright (C) 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-relay-action
37
##|*NAME=Services: Load Balancer: Relay Actions page
38
##|*DESCR=Allow access to the 'Services: Load Balancer: Relay Actions' page.
39
##|*MATCH=load_balancer_relay_action.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

    
47
if (!is_array($config['load_balancer']['lbaction'])) {
48
	$config['load_balancer']['lbaction'] = array();
49
}
50
$a_action = &$config['load_balancer']['lbaction'];
51

    
52

    
53
if ($_POST) {
54

    
55
	$pconfig = $_POST;
56

    
57
	if ($_POST['apply']) {
58
		$retval = 0;
59
		$retval |= filter_configure();
60
		$retval |= relayd_configure();
61

    
62
		$savemsg = get_std_save_message($retval);
63
		clear_subsystem_dirty('loadbalancer');
64
	}
65
}
66

    
67
if ($_GET['act'] == "del") {
68
	if (array_key_exists($_GET['id'], $a_action)) {
69
		/* make sure no relay protocols reference this entry */
70
		if (is_array($config['load_balancer']['lbprotocol'])) {
71
			foreach ($config['load_balancer']['lbprotocol'] as $lbp) {
72
				foreach($lbp['lbaction'] as $lba) {
73
					if ($lba['name'] == $a_action[$_GET['id']]['name']) {
74
						$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one relay protocol.");
75
						break;
76
					}
77
				}
78
			}
79
		}
80

    
81
		if (!$input_errors) {
82
			unset($a_action[$_GET['id']]);
83
			write_config();
84
			mark_subsystem_dirty('loadbalancer');
85
			header("Location: load_balancer_relay_action.php");
86
			exit;
87
		}
88
	}
89
}
90

    
91
/* Index lbpool array for easy hyperlinking */
92
/* for ($i = 0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) {
93
	for ($o = 0; isset($config['load_balancer']['lbprotocol'][$i]['options'][$o]); o++) {
94
		$a_vs[$i]['options'][$o] = "	
95
	$a_vs[$i]['poolname'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['poolname']]}\">{$a_vs[$i]['poolname']}</a>";
96
	if ($a_vs[$i]['sitedown'] != '') {
97
		$a_vs[$i]['sitedown'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['sitedown']]}\">{$a_vs[$i]['sitedown']}</a>";
98
	} else {
99
		$a_vs[$i]['sitedown'] = 'none';
100
	}
101
}
102
*/
103

    
104
$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Relay Action"));
105
$shortcut_section = "relayd";
106

    
107
include("head.inc");
108

    
109
?>
110
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
111
<?php include("fbegin.inc"); ?>
112
<form action="load_balancer_relay_action.php" method="post">
113
<?php if ($input_errors) print_input_errors($input_errors); ?>
114
<?php if ($savemsg) print_info_box($savemsg); ?>
115
<?php if (is_subsystem_dirty('loadbalancer')): ?><p>
116
<?php print_info_box_np(gettext("The load balancer configuration has been changed.<br />You must apply the changes in order for them to take effect."));?><br />
117
<?php endif; ?>
118
<table width="100%" border="0" cellpadding="0" cellspacing="0">
119
  <tr><td class="tabnavtbl">
120
  <?php
121
        /* active tabs */
122
        $tab_array = array();
123
        $tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php");
124
        $tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php");
125
        $tab_array[] = array(gettext("Virtual Servers"), false, "load_balancer_virtual_server.php");
126
        $tab_array[] = array(gettext("Relay Actions"), true, "load_balancer_relay_action.php");
127
        $tab_array[] = array(gettext("Relay Protocols"), false, "load_balancer_relay_protocol.php");
128
        display_top_tabs($tab_array);
129
  ?>
130
  </td></tr>
131
  <tr>
132
    <td>
133
	<div id="mainarea">
134
<?
135
			$t = new MainTable();
136
			$t->edit_uri('load_balancer_relay_action_edit.php');
137
			$t->my_uri('load_balancer_relay_action.php');
138
			$t->add_column(gettext('Name'),'name',20);
139
			$t->add_column(gettext('Type'),'type',10);
140
			$t->add_column(gettext('Options'),'options',30);
141
			$t->add_column(gettext('Description'),'descr',30);
142
			$t->add_button('edit');
143
			$t->add_button('dup');
144
			$t->add_button('del');
145
			$t->add_content_array($a_action);
146
			$t->display();
147
?>
148
	</div>
149
    </td>
150
  </tr>
151
</table>
152
</form>
153
<?php include("fend.inc"); ?>
154
</body>
155
</html>
(120-120/256)