Project

General

Profile

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

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

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

    
7
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
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-system-gatewaygroups
37
##|*NAME=System: Gateway Groups page
38
##|*DESCR=Allow access to the 'System: Gateway Groups' page.
39
##|*MATCH=system_gateway_groups.php*
40
##|-PRIV
41

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

    
48
if (!is_array($config['gateways']['gateway_group']))
49
	$config['gateways']['gateway_group'] = array();
50

    
51
$a_gateway_groups = &$config['gateways']['gateway_group'];
52
$a_gateways = &$config['gateways']['gateway_item'];
53
$changedesc = gettext("Gateway Groups") . ": ";
54

    
55
if ($_POST) {
56

    
57
	$pconfig = $_POST;
58

    
59
	if ($_POST['apply']) {
60

    
61
		$retval = 0;
62

    
63
		$retval = system_routing_configure();
64
		send_multiple_events(array("service reload dyndnsall", "service reload ipsecdns", "filter reload"));
65

    
66
		/* reconfigure our gateway monitor */
67
		setup_gateways_monitor();
68

    
69
		$savemsg = get_std_save_message($retval);
70
		if ($retval == 0)
71
			clear_subsystem_dirty('staticroutes');
72

    
73
		foreach ($a_gateway_groups as $gateway_group) {
74
			$gw_subsystem = 'gwgroup.' . $gateway_group['name'];
75
			if (is_subsystem_dirty($gw_subsystem)) {
76
				openvpn_resync_gwgroup($gateway_group['name']);
77
				clear_subsystem_dirty($gw_subsystem);
78
			}
79
		}
80
	}
81
}
82

    
83
if ($_GET['act'] == "del") {
84
	if ($a_gateway_groups[$_GET['id']]) {
85
		$changedesc .= gettext("removed gateway group") . " {$_GET['id']}";
86
		foreach ($config['filter']['rule'] as $idx => $rule) {
87
			if ($rule['gateway'] == $a_gateway_groups[$_GET['id']]['name'])
88
				unset($config['filter']['rule'][$idx]['gateway']);
89
		}
90
		unset($a_gateway_groups[$_GET['id']]);
91
		write_config($changedesc);
92
		mark_subsystem_dirty('staticroutes');
93
		header("Location: system_gateway_groups.php");
94
		exit;
95
	}
96
}
97

    
98
$pgtitle = array(gettext("System"),gettext("Gateway Groups"));
99
$shortcut_section = "gateway-groups";
100

    
101
include("head.inc");
102

    
103
?>
104

    
105
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
106
<?php include("fbegin.inc"); ?>
107
<form action="system_gateway_groups.php" method="post">
108
<input type="hidden" name="y1" value="1" />
109
<?php if ($savemsg) print_info_box($savemsg); ?>
110
<?php if (is_subsystem_dirty('staticroutes')): ?><br/>
111
<?php print_info_box_np(sprintf(gettext("The gateway configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /><br />
112
<?php endif; ?>
113
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system groups">
114
		<tr>
115
		  <td>
116
<?php
117
			$tab_array = array();
118
			$tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php");
119
			$tab_array[1] = array(gettext("Routes"), false, "system_routes.php");
120
			$tab_array[2] = array(gettext("Groups"), true, "system_gateway_groups.php");
121
			display_top_tabs($tab_array);
122
?>
123
</td></tr>
124
 <tr>
125
   <td>
126
	<div id="mainarea">
127
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
128
		<thead>
129
                <tr>
130
                  <td width="15%" class="listhdrr"><?=gettext("Group Name");?></td>
131
                  <td width="15%" class="listhdrr"><?=gettext("Gateways");?></td>
132
                  <td width="20%" class="listhdrr"><?=gettext("Priority");?></td>
133
                  <td width="30%" class="listhdr"><?=gettext("Description");?></td>
134
                  <td width="10%" class="list">
135
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
136
			   <tr>
137
				<td width="17"></td>
138
				<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="edit" /></a></td>
139
			   </tr>
140
			</table>
141
		  </td>
142
		</tr>
143
		</thead>
144
		<tfoot>
145
                  <tr><td class="list" colspan="4"></td>
146
                  <td class="list">
147
			<table border="0" cellspacing="0" cellpadding="1" summary="edit">
148
			   <tr>
149
				<td width="17"></td>
150
				<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="edit" /></a></td>
151
			   </tr>
152
		                    </table>
153
				  </td>
154
		                </tr>
155
		</tfoot>
156
		<tbody>
157
			  <?php $i = 0; foreach ($a_gateway_groups as $gateway_group): ?>
158
                <tr>
159
                  <td class="listlr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
160
                    <?php
161
			echo $gateway_group['name'];
162
		?>
163
                  </td>
164
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
165
                    <?php
166
			foreach($gateway_group['item'] as $item) {
167
				$itemsplit = explode("|", $item);
168
				echo htmlspecialchars(strtoupper($itemsplit[0])) . "<br />\n";
169
			}
170
		    ?>
171
                  </td>
172
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
173
		    <?php
174
			foreach($gateway_group['item'] as $item) {
175
				$itemsplit = explode("|", $item);
176
				echo "Tier ". htmlspecialchars($itemsplit[1]) . "<br />\n";
177
			}
178
		    ?>
179
                  </td>
180
                  <td class="listbg" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
181
				<?=htmlspecialchars($gateway_group['descr']);?>&nbsp;
182
                  </td>
183
                  <td valign="middle" class="list nowrap">
184
			<table border="0" cellspacing="0" cellpadding="1" summary="edit">
185
			   <tr>
186
				<td><a href="system_gateway_groups_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
187
				<td><a href="system_gateway_groups.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this gateway group?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
188
			   </tr>
189
			   <tr>
190
				<td width="17"></td>
191
				<td><a href="system_gateway_groups_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="duplicate" /></a></td>
192
			   </tr>
193
			</table>
194
                  </td>
195
		</tr>
196
			  <?php $i++; endforeach; ?>
197
                <tr style="display:none;"><td></td></tr>
198
		</tbody>
199
			</table>
200
			</div>
201
			</td>
202
		  </tr>
203
		</table>
204
            </form>
205
	<p><b><?=gettext("Note:");?></b>  <?=gettext("Remember to use these Gateway Groups in firewall rules in order to enable load balancing, failover, or policy-based routing. Without rules directing traffic into the Gateway Groups, they will not be used.");?></p>
206
<?php include("fend.inc"); ?>
207
</body>
208
</html>
(220-220/256)